更新
This commit is contained in:
parent
4923dde629
commit
da394abd70
5
App.vue
5
App.vue
@ -88,6 +88,11 @@
|
|||||||
console.error('获取用户信息失败', err)
|
console.error('获取用户信息失败', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.screen.lockOrientation('portrait-primary'); //锁死屏幕方向为竖屏
|
||||||
|
plus.navigator.setFullscreen(false);
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
|
|||||||
@ -241,6 +241,7 @@
|
|||||||
* 接单
|
* 接单
|
||||||
*/
|
*/
|
||||||
openFile(orderId) {
|
openFile(orderId) {
|
||||||
|
console.log('执行');
|
||||||
this.$emit('getOrder', orderId);
|
this.$emit('getOrder', orderId);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
8
main.js
8
main.js
@ -1,6 +1,12 @@
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
import uView from "uview-ui";
|
import uView from "uview-ui";
|
||||||
import config from '@/config'
|
import config from '@/config';
|
||||||
|
import {
|
||||||
|
checkPermi,
|
||||||
|
checkRole
|
||||||
|
} from './utils/permission'
|
||||||
|
Vue.prototype.checkPermi = checkPermi
|
||||||
|
Vue.prototype.checkRole = checkRole
|
||||||
const baseUrl = config.baseUrl
|
const baseUrl = config.baseUrl
|
||||||
Vue.prototype.$baseUrl = baseUrl;
|
Vue.prototype.$baseUrl = baseUrl;
|
||||||
const baseImageUrl = config.baseImageUrl
|
const baseImageUrl = config.baseImageUrl
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<image src="/static/images/j2.png" mode=""></image>
|
<image src="/static/images/j2.png" mode=""></image>
|
||||||
<view class="">业务管理</view>
|
<view class="">业务管理</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])">
|
<view class="jg_box" v-if="checkPermi(['repair_statistics_show'])" @click="goToPage(3)">
|
||||||
<image src="/static/images/j3.png" mode=""></image>
|
<image src="/static/images/j3.png" mode=""></image>
|
||||||
<view class="">数据统计</view>
|
<view class="">数据统计</view>
|
||||||
</view>
|
</view>
|
||||||
@ -70,23 +70,24 @@
|
|||||||
<view class="three1">
|
<view class="three1">
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="t_size">进厂数</view>
|
<view class="t_size">进厂数</view>
|
||||||
<view class="t_num">{{ bossNum.inCompanyNum }}</view>
|
<view class="t_num">{{ bossNum.newOrderNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="/static/images/t1.png" mode=""></image>
|
<image src="/static/images/t1.png" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="three2">
|
<view class="three2">
|
||||||
<view class="" @click="viewOrder('wxz')">
|
<view class="">
|
||||||
<view class="t_size">维修中</view>
|
<view class="t_size">维修中</view>
|
||||||
<view class="t_num">{{ bossNum.workingNum }}</view>
|
<view class="t_num">{{ bossNum.workingNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="/static/images/t2.png" mode=""></image>
|
<image src="/static/images/t2.png" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="three3">
|
<view class="three3">
|
||||||
<view class="" @click="viewOrder('yjg')">
|
<view class="">
|
||||||
<view class="t_size">已竣工</view>
|
<view class="t_size">已竣工</view>
|
||||||
<view class="t_num">{{ bossNum.overNum }}</view>
|
<view class="t_num">{{ bossNum.overNum }}</view>
|
||||||
</view>
|
</view>
|
||||||
<image src="/static/images/t3.png" mode=""></image>
|
<image src="/static/images/t3.png" mode="">
|
||||||
|
</image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="db_" style="margin: 30rpx auto; " v-if="checkRole(['repair_staff'])">
|
<view class="db_" style="margin: 30rpx auto; " v-if="checkRole(['repair_staff'])">
|
||||||
@ -423,6 +424,11 @@
|
|||||||
url: '/pages-business/businessManage/businessManage' // 3. 建议使用单引号
|
url: '/pages-business/businessManage/businessManage' // 3. 建议使用单引号
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 3: // 2. 补上冒号
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages-business/statistics/statistics' // 3. 建议使用单引号
|
||||||
|
});
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-home/msg/message' // 3. 建议使用单引号
|
url: '/pages-home/msg/message' // 3. 建议使用单引号
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -25,8 +25,8 @@
|
|||||||
汇报内容
|
汇报内容
|
||||||
</view>
|
</view>
|
||||||
<!-- <u--textarea v-if="type != 'look'" v-model="report.reportContent" placeholder="请输入内容"></u--textarea> -->
|
<!-- <u--textarea v-if="type != 'look'" v-model="report.reportContent" placeholder="请输入内容"></u--textarea> -->
|
||||||
<textarea auto-height v-model="report.reportContent" placeholder="请输入内容"></textarea>
|
<textarea maxlength="-1" auto-height v-model="report.reportContent" placeholder="请输入内容"></textarea>
|
||||||
<view class="x_"></view>
|
<!-- <view class="x_"></view> -->
|
||||||
<view class="d_b" @click="handleUpload" v-if="type != 'look'">
|
<view class="d_b" @click="handleUpload" v-if="type != 'look'">
|
||||||
<view class="">附件</view>
|
<view class="">附件</view>
|
||||||
<view class="lan_">上传附件
|
<view class="lan_">上传附件
|
||||||
|
|||||||
@ -233,7 +233,7 @@
|
|||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="display: flex;align-items: center">
|
<!-- <view style="display: flex;align-items: center">
|
||||||
<view class="infoItem" style="flex: 1" v-if="cusFromList && cusFromList.length>0">
|
<view class="infoItem" style="flex: 1" v-if="cusFromList && cusFromList.length>0">
|
||||||
<text class="label">客户来源</text>
|
<text class="label">客户来源</text>
|
||||||
<picker @change="cusFromChange" :value="cusFromIndex" :range="cusFromList"
|
<picker @change="cusFromChange" :value="cusFromIndex" :range="cusFromList"
|
||||||
@ -248,6 +248,12 @@
|
|||||||
<view class="uni-input">{{ busiFromList[busiFromIndex].label}}</view>
|
<view class="uni-input">{{ busiFromList[busiFromIndex].label}}</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<view style="display: flex;align-items: center">
|
||||||
|
<text class="label">渠道/来源</text>
|
||||||
|
<uni-data-picker :localdata="busiAndCusList" v-model='busIAndCusValue'
|
||||||
|
popup-title="请选择渠道和来源" :map="{text:'name',value:'name'}"
|
||||||
|
@change="onBusiAndCuschange"></uni-data-picker>
|
||||||
</view>
|
</view>
|
||||||
<view style="display: flex;align-items: center">
|
<view style="display: flex;align-items: center">
|
||||||
<view class="infoItem" style="flex: 1">
|
<view class="infoItem" style="flex: 1">
|
||||||
@ -392,7 +398,8 @@
|
|||||||
import config from "@/config";
|
import config from "@/config";
|
||||||
import {
|
import {
|
||||||
formatTimestamp,
|
formatTimestamp,
|
||||||
formatTimestampCustom
|
formatTimestampCustom,
|
||||||
|
handleTree
|
||||||
} from "@/utils/utils";
|
} from "@/utils/utils";
|
||||||
import upload from "@/utils/upload";
|
import upload from "@/utils/upload";
|
||||||
import {
|
import {
|
||||||
@ -424,6 +431,7 @@
|
|||||||
cusFromIndex: 0,
|
cusFromIndex: 0,
|
||||||
busiFromList: [],
|
busiFromList: [],
|
||||||
busiFromIndex: 0,
|
busiFromIndex: 0,
|
||||||
|
busiAndCusList: [],
|
||||||
partDisposals: [],
|
partDisposals: [],
|
||||||
partDisposalIndex: 0,
|
partDisposalIndex: 0,
|
||||||
formData: {
|
formData: {
|
||||||
@ -479,6 +487,7 @@
|
|||||||
ticketNo: '',
|
ticketNo: '',
|
||||||
//前一个页面传过来的参数
|
//前一个页面传过来的参数
|
||||||
pageData: {},
|
pageData: {},
|
||||||
|
busIAndCusValue: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -543,6 +552,7 @@
|
|||||||
this.initDict("repair_type")
|
this.initDict("repair_type")
|
||||||
this.initDict("cus_data_from")
|
this.initDict("cus_data_from")
|
||||||
this.initDict("repair_part_disposal")
|
this.initDict("repair_part_disposal")
|
||||||
|
this.queryBusiAndCus()
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
methods: {
|
methods: {
|
||||||
@ -588,8 +598,6 @@
|
|||||||
this.partDisposalIndex = newIndex;
|
this.partDisposalIndex = newIndex;
|
||||||
this.formData.partDisposal = this.partDisposals[newIndex].value;
|
this.formData.partDisposal = this.partDisposals[newIndex].value;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
async initDict(dictCode) {
|
async initDict(dictCode) {
|
||||||
let dictArray = getStorageWithExpiry(dictCode);
|
let dictArray = getStorageWithExpiry(dictCode);
|
||||||
console.log(dictArray, "partDisposals")
|
console.log(dictArray, "partDisposals")
|
||||||
@ -652,6 +660,24 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 获取业务来源和渠道
|
||||||
|
*/
|
||||||
|
queryBusiAndCus() {
|
||||||
|
request({
|
||||||
|
url: `/admin-api/business/list`,
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
systemCode: 'repair'
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
this.busiAndCusList = handleTree(res.data, 'id', 'pid')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onBusiAndCuschange(e) {
|
||||||
|
this.formData.busiFrom = e.detail.value[0].value
|
||||||
|
this.formData.cusFrom = e.detail.value[1].value
|
||||||
|
},
|
||||||
buildRepairType() {
|
buildRepairType() {
|
||||||
if (this.pageData.repairType) {
|
if (this.pageData.repairType) {
|
||||||
this.repairTypes.map((item, index) => {
|
this.repairTypes.map((item, index) => {
|
||||||
@ -708,7 +734,8 @@
|
|||||||
* 创建工单前上传图片
|
* 创建工单前上传图片
|
||||||
*/
|
*/
|
||||||
submitUpload() {
|
submitUpload() {
|
||||||
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0) {
|
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0 || !this.formData
|
||||||
|
.busiFrom || !this.formData.cusFrom) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请完善信息',
|
title: '请完善信息',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -721,12 +748,12 @@
|
|||||||
//新增工单
|
//新增工单
|
||||||
submit() {
|
submit() {
|
||||||
let fileStr = this.fileList.map(item => item.url.replace(config.baseImageUrl, "")).join(",")
|
let fileStr = this.fileList.map(item => item.url.replace(config.baseImageUrl, "")).join(",")
|
||||||
if (!this.formData.busiFrom) {
|
// if (!this.formData.busiFrom) {
|
||||||
this.formData.busiFrom = this.busiFromList[this.busiFromIndex].value
|
// this.formData.busiFrom = this.busiFromList[this.busiFromIndex].value
|
||||||
}
|
// }
|
||||||
if (!this.formData.cusFrom) {
|
// if (!this.formData.cusFrom) {
|
||||||
this.formData.cusFrom = this.cusFromList[this.cusFromIndex].value
|
// this.formData.cusFrom = this.cusFromList[this.cusFromIndex].value
|
||||||
}
|
// }
|
||||||
const data = {
|
const data = {
|
||||||
userId: this.userInfo.id,
|
userId: this.userInfo.id,
|
||||||
ticketNo: this.ticketNo,
|
ticketNo: this.ticketNo,
|
||||||
@ -798,9 +825,20 @@
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: params
|
params: params
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.records.length > 0) {
|
if (res.data.records.length == 1) {
|
||||||
this.userInfo = res.data.records[0]
|
this.userInfo = res.data.records[0]
|
||||||
this.getCarList()
|
this.getCarList()
|
||||||
|
} else if (res.data.records.length != 0) {
|
||||||
|
uni.showActionSheet({
|
||||||
|
title: '选择客户',
|
||||||
|
itemList: res.data.records.map(m => m.cusName + m.phoneNumber),
|
||||||
|
success: ({
|
||||||
|
tapIndex
|
||||||
|
}) => {
|
||||||
|
this.userInfo = res.data.records[tapIndex]
|
||||||
|
this.getCarList()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -55,43 +55,46 @@
|
|||||||
class="carImage" mode="aspectFit"></image>
|
class="carImage" mode="aspectFit"></image>
|
||||||
<view class="carHeaderRight">
|
<view class="carHeaderRight">
|
||||||
<text class="carNumber">{{ ticketInfo.carNo }}</text>
|
<text class="carNumber">{{ ticketInfo.carNo }}</text>
|
||||||
<text class="carType">{{ ticketInfo.carBrandName+" " }} <text
|
<text class="carType">{{ ticketInfo.carBrandName+" " }} <span
|
||||||
v-if="ticketInfo.carInfo && ticketInfo.carInfo.carModel"> -
|
v-if="ticketInfo.carInfo && ticketInfo.carInfo.carModel"> -
|
||||||
{{ticketInfo.carInfo.carModel}}</text></text>
|
{{ticketInfo.carInfo.carModel}}</span></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="carBody">
|
<view class="carBody">
|
||||||
<view style="display: flex;flex-direction: column;">
|
<view style="display: flex;flex-direction: column;">
|
||||||
<view class="infoItem">
|
<view v-if="checkPermi(['repair:user:look'])">
|
||||||
<view class="label">车主</view>
|
<view class="infoItem">
|
||||||
<view class="value">{{ ticketInfo.userName }}</view>
|
<view class="label">车主</view>
|
||||||
|
<view class="value">{{ ticketInfo.userName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem">
|
||||||
|
<text class="label">联系方式</text>
|
||||||
|
<text class="value">{{ ticketInfo.userMobile }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem">
|
||||||
|
<text class="label">客户来源</text>
|
||||||
|
<text class="value">{{ ticketInfo.customerInfo.dataFromText }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem">
|
||||||
|
<text class="label">性别</text>
|
||||||
|
<text class="value">{{ ticketInfo.customerInfo.sex === '1' ? '女' : '男' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem" v-if="ticketInfo.handleName">
|
||||||
|
<text class="label">经办人</text>
|
||||||
|
<text class="value">{{ ticketInfo.handleName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem" v-if="ticketInfo.handleMobile">
|
||||||
|
<text class="label">经办人电话</text>
|
||||||
|
<text class="value">{{ ticketInfo.handleMobile }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem">
|
||||||
|
<text class="label">业务来源</text>
|
||||||
|
<text class="value">{{ ticketInfo.busiFrom }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
|
||||||
<text class="label">联系方式</text>
|
|
||||||
<text class="value">{{ ticketInfo.userMobile }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem">
|
|
||||||
<text class="label">客户来源</text>
|
|
||||||
<text class="value">{{ ticketInfo.customerInfo.dataFromText }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem">
|
|
||||||
<text class="label">性别</text>
|
|
||||||
<text class="value">{{ ticketInfo.customerInfo.sex === '1' ? '女' : '男' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem" v-if="ticketInfo.handleName">
|
|
||||||
<text class="label">经办人</text>
|
|
||||||
<text class="value">{{ ticketInfo.handleName }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem" v-if="ticketInfo.handleMobile">
|
|
||||||
<text class="label">经办人电话</text>
|
|
||||||
<text class="value">{{ ticketInfo.handleMobile }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem">
|
|
||||||
<text class="label">业务来源</text>
|
|
||||||
<text class="value">{{ ticketInfo.busiFrom }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="line"></view>
|
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">车架号</view>
|
<view class="label">车架号</view>
|
||||||
<view class="value">{{ ticketInfo.carVin }}</view>
|
<view class="value">{{ ticketInfo.carVin }}</view>
|
||||||
@ -102,48 +105,62 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">车辆注册日期</view>
|
<view class="label">车辆注册日期</view>
|
||||||
<view class="value">{{ ticketInfo.carRegisterDate }}</view>
|
<view class="value">{{ formatDate(ticketInfo.carInfo.carRegisterDate) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">车龄(年)</view>
|
<view class="label">车龄(年)</view>
|
||||||
<view class="value">{{ ticketInfo.carInfo.carYear }}</view>
|
<view class="value">{{ ticketInfo.carInfo.carYear }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">年检到期时间</view>
|
<view class="label">当前表显里程</view>
|
||||||
<view class="value">{{ ticketInfo.nextInspectionDate}}</view>
|
<view class="value">{{ ticketInfo.carInfo.mileageTraveled}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem">
|
||||||
|
<view class="label">下次年检时间</view>
|
||||||
|
<view class="value">{{ formatDate(ticketInfo.carInfo.nextInspectionDate)}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">保险到期时间</view>
|
<view class="label">保险到期时间</view>
|
||||||
<view class="value">{{ ticketInfo.insuranceExpiryDate}}</view>
|
<view class="value">{{ formatDate(ticketInfo.carInfo.insuranceExpiryDate)}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<!-- <view class="infoItem">
|
||||||
<view class="label">承保险种</view>
|
<view class="label">承保险种</view>
|
||||||
<view class="value">{{ ticketInfo.insuranceType}}</view>
|
<view class="value">{{ ticketInfo.insuranceType}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">上年保费</view>
|
<view class="label">上年保费</view>
|
||||||
<view class="value">交:{{ ticketInfo.jiaoqiang}} 商:{{ ticketInfo.shangye}}</view>
|
<view class="value">交:{{ ticketInfo.jiaoqiang}} 商:{{ ticketInfo.shangye}}</view>
|
||||||
|
</view> -->
|
||||||
|
<view class="infoItem">
|
||||||
|
<view class="label">下次保养里程</view>
|
||||||
|
<view class="value">{{ ticketInfo.carInfo.nextMaintenanceMileage}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">最近保养日期</view>
|
<view class="label">最近保养日期</view>
|
||||||
<view class="value">{{ ticketInfo.maintenanceDate}}</view>
|
<view class="value">{{ ticketInfo.maintenanceDate}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="infoItem">
|
|
||||||
<view class="label">表显里程</view>
|
|
||||||
<view class="value">{{ ticketInfo.mileageTraveled}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="infoItem">
|
<view class="infoItem">
|
||||||
<view class="label">最近保养公里数</view>
|
<view class="label">最近保养公里数</view>
|
||||||
<view class="value">{{ ticketInfo.maintenanceMileage}}</view>
|
<view class="value">{{ ticketInfo.maintenanceMileage}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="infoItem" style="display: block;">
|
||||||
<view class="projList">
|
<view class="label">档案资料</view>
|
||||||
<view class="projImg" v-if="carImgList.length>0">
|
<view class="value">
|
||||||
<image v-for="(img, imgIndex) in carImgList"
|
<view class="projList">
|
||||||
@click="prviewImage(carImgList,imgIndex)" :key="imgIndex"
|
<view class="projImg" v-if="carImgList.length>0">
|
||||||
:src="imgUrlPrex + img.image" class="projImgItem"></image>
|
<image v-for="(img, imgIndex) in carImgList"
|
||||||
|
@click="prviewImage(carImgList,imgIndex)" :key="imgIndex"
|
||||||
|
:src="img.image" class="projImgItem"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="infoItem" v-if="checkPermi(['tickets:car:edit'])">
|
||||||
|
<view class="label" style="color: rgb(41, 121, 255);" @click="showCarPopup">点击编辑车辆信息
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -456,6 +473,32 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
<uni-popup ref="carPopup" type="center" border-radius="10px 10px 10px 10px" background-color="#fff">
|
||||||
|
<view class="car-popup-out">
|
||||||
|
<uni-forms ref="baseForm" :modelValue="carFormData">
|
||||||
|
<uni-forms-item label="下次年检日期" required>
|
||||||
|
<picker mode="date" :value="carFormData.nextInspectionDate" :start="startDate" :end="endDate"
|
||||||
|
@change="bindnextInspectionDateChange">
|
||||||
|
<view class="uni-input">
|
||||||
|
{{ carFormData.nextInspectionDate ? carFormData.nextInspectionDate : '选择日期' }}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="下次保养里程" required>
|
||||||
|
<uni-easyinput v-model="carFormData.nextMaintenanceMileage" placeholder="请输入" />
|
||||||
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="保险到期时间" required>
|
||||||
|
<picker mode="date" :value="carFormData.insuranceExpiryDate" :start="startDate" :end="endDate"
|
||||||
|
@change="bindInsuranceExpiryDateChange">
|
||||||
|
<view class="uni-input">
|
||||||
|
{{ carFormData.insuranceExpiryDate ? carFormData.insuranceExpiryDate : '选择日期' }}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
<button @click="submitCarForm">确定</button>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
<view>
|
<view>
|
||||||
<u-modal :show="show" :title="title" confirmText="电话" cancelText="短信" showCancelButton @cancel="message"
|
<u-modal :show="show" :title="title" confirmText="电话" cancelText="短信" showCancelButton @cancel="message"
|
||||||
@confirm="phone " closeOnClickOverlay @close="show = false">
|
@confirm="phone " closeOnClickOverlay @close="show = false">
|
||||||
@ -487,7 +530,10 @@
|
|||||||
setStorageWithExpiry,
|
setStorageWithExpiry,
|
||||||
getStorageWithExpiry
|
getStorageWithExpiry
|
||||||
} from '@/utils/auth'
|
} from '@/utils/auth'
|
||||||
import config from '@/config'
|
import config from '@/config';
|
||||||
|
import {
|
||||||
|
fixScreen
|
||||||
|
} from '@/utils/fixScreen.js';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
VNavigationBar,
|
VNavigationBar,
|
||||||
@ -526,10 +572,29 @@
|
|||||||
repairItemId: "",
|
repairItemId: "",
|
||||||
itemName: "",
|
itemName: "",
|
||||||
},
|
},
|
||||||
|
// 补充车辆信息
|
||||||
|
carFormData: {
|
||||||
|
nextInspectionDate: undefined,
|
||||||
|
insuranceExpiryDate: undefined,
|
||||||
|
nextMaintenanceMileage: undefined,
|
||||||
|
mileageTraveled: undefined,
|
||||||
|
},
|
||||||
//是否可以授权给客户看
|
//是否可以授权给客户看
|
||||||
canOpenCus: false,
|
canOpenCus: false,
|
||||||
//是否可以看见钱
|
//是否可以看见钱
|
||||||
canSeeMoney: false,
|
canSeeMoney: false,
|
||||||
|
listStyles: {
|
||||||
|
// 是否显示边框
|
||||||
|
border: false,
|
||||||
|
// 是否显示分隔线
|
||||||
|
dividline: false,
|
||||||
|
// 线条样式
|
||||||
|
borderStyle: {
|
||||||
|
width: 1,
|
||||||
|
color: 'blue',
|
||||||
|
radius: 2
|
||||||
|
}
|
||||||
|
},
|
||||||
//当前选择的操作:working-维修期间|done_half-阶段完成|done-全部完成递交下一维修班组选人维修
|
//当前选择的操作:working-维修期间|done_half-阶段完成|done-全部完成递交下一维修班组选人维修
|
||||||
nowChooseOperate: "",
|
nowChooseOperate: "",
|
||||||
carInfo: {},
|
carInfo: {},
|
||||||
@ -555,7 +620,8 @@
|
|||||||
activeProjTabKey: 0,
|
activeProjTabKey: 0,
|
||||||
activePartTabKey: 0,
|
activePartTabKey: 0,
|
||||||
processList: [{}, {}],
|
processList: [{}, {}],
|
||||||
carImgList: []
|
carImgList: [],
|
||||||
|
cararchivesPhotos: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -587,8 +653,20 @@
|
|||||||
this.refreshData(false)
|
this.refreshData(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
// 调用修复方法
|
||||||
|
fixScreen();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
startDate() {
|
||||||
|
return this.getDate('start');
|
||||||
|
},
|
||||||
|
endDate() {
|
||||||
|
return this.getDate('end');
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDate,
|
||||||
chooseProjTab(index) {
|
chooseProjTab(index) {
|
||||||
this.activeProjTabKey = index
|
this.activeProjTabKey = index
|
||||||
},
|
},
|
||||||
@ -641,6 +719,67 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 打开编辑车辆弹窗
|
||||||
|
*/
|
||||||
|
showCarPopup() {
|
||||||
|
this.carFormData = this.ticketInfo.carInfo
|
||||||
|
if (this.carFormData.insuranceExpiryDate) {
|
||||||
|
this.carFormData.insuranceExpiryDate = formatDate(this.carFormData.insuranceExpiryDate)
|
||||||
|
}
|
||||||
|
if (this.carFormData.nextInspectionDate) {
|
||||||
|
this.carFormData.nextInspectionDate = formatDate(this.carFormData.nextInspectionDate)
|
||||||
|
}
|
||||||
|
this.$refs.carPopup.open()
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @param {Object} type获取时间
|
||||||
|
*/
|
||||||
|
getDate(type) {
|
||||||
|
const date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let day = date.getDate();
|
||||||
|
|
||||||
|
if (type === 'start') {
|
||||||
|
year = year - 10;
|
||||||
|
} else if (type === 'end') {
|
||||||
|
year = year + 10;
|
||||||
|
}
|
||||||
|
month = month > 9 ? month : '0' + month;
|
||||||
|
day = day > 9 ? day : '0' + day;
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 修改下次年检时间
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
bindnextInspectionDateChange(e) {
|
||||||
|
console.log('e', e);
|
||||||
|
this.carFormData.nextInspectionDate = e.detail.value
|
||||||
|
},
|
||||||
|
bindInsuranceExpiryDateChange(e) {
|
||||||
|
this.carFormData.insuranceExpiryDate = e.detail.value
|
||||||
|
},
|
||||||
|
submitCarForm() {
|
||||||
|
// 如果 nextInspectionDate 有值,并且格式是 yyyy-MM-dd,就补上时分秒
|
||||||
|
if (this.carFormData.nextInspectionDate) {
|
||||||
|
this.carFormData.nextInspectionDate = new Date(this.carFormData.nextInspectionDate).getTime()
|
||||||
|
}
|
||||||
|
// 如果 nextInspectionDate 有值,并且格式是 yyyy-MM-dd,就补上时分秒
|
||||||
|
if (this.carFormData.insuranceExpiryDate) {
|
||||||
|
this.carFormData.insuranceExpiryDate = new Date(this.carFormData.insuranceExpiryDate).getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: `/admin-api/base/carMain/update`,
|
||||||
|
method: 'PUT',
|
||||||
|
data: this.carFormData
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$refs.carPopup.close()
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 监听输入框
|
* 监听输入框
|
||||||
*/
|
*/
|
||||||
@ -669,7 +808,11 @@
|
|||||||
prviewImage(imgList, index) {
|
prviewImage(imgList, index) {
|
||||||
let urls = []
|
let urls = []
|
||||||
imgList.forEach(i => {
|
imgList.forEach(i => {
|
||||||
urls.push(this.imgUrlPrex + i.image)
|
if (!i.image.includes("http")) {
|
||||||
|
urls.push(this.imgUrlPrex + i.image)
|
||||||
|
} else {
|
||||||
|
urls.push(i.image)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: urls,
|
urls: urls,
|
||||||
@ -782,6 +925,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
afterRead(file) {
|
afterRead(file) {
|
||||||
|
console.log('文件', file);
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在上传中...',
|
title: '正在上传中...',
|
||||||
mask: true
|
mask: true
|
||||||
@ -1012,8 +1156,11 @@
|
|||||||
}
|
}
|
||||||
if (this.loginUser.roleCodes.includes("repair_staff")) {
|
if (this.loginUser.roleCodes.includes("repair_staff")) {
|
||||||
//维修工角色,可以提交配件申请
|
//维修工角色,可以提交配件申请
|
||||||
|
const has02 = this.ticketInfo.items.some(item => item.itemType === '02');
|
||||||
|
console.log('has02', has02);
|
||||||
this.content.push({
|
this.content.push({
|
||||||
text: '配件申请',
|
// text: '配件申请',
|
||||||
|
text: !has02 ? '是否申请配件' : '是否增加配件',
|
||||||
active: false,
|
active: false,
|
||||||
code: "apply"
|
code: "apply"
|
||||||
})
|
})
|
||||||
@ -1275,6 +1422,7 @@
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
let resultObj = res.data
|
let resultObj = res.data
|
||||||
resultObj.statusStr = getOrderStatusText(res.data.ticketsStatus, res.data.isHandover)
|
resultObj.statusStr = getOrderStatusText(res.data.ticketsStatus, res.data.isHandover)
|
||||||
|
|
||||||
//注册日期
|
//注册日期
|
||||||
if (null != resultObj.carInfo.carRegisterDate) {
|
if (null != resultObj.carInfo.carRegisterDate) {
|
||||||
resultObj.carRegisterDate = formatDate(resultObj.carInfo.carRegisterDate)
|
resultObj.carRegisterDate = formatDate(resultObj.carInfo.carRegisterDate)
|
||||||
@ -1379,8 +1527,17 @@
|
|||||||
}
|
}
|
||||||
if (resultObj.carInfo.carLicenseImg) {
|
if (resultObj.carInfo.carLicenseImg) {
|
||||||
resultObj.carInfo.carLicenseImg.split(",").map((item) => {
|
resultObj.carInfo.carLicenseImg.split(",").map((item) => {
|
||||||
|
let url = item.includes("http") ? item : this.imgUrlPrex + item;
|
||||||
this.carImgList.push({
|
this.carImgList.push({
|
||||||
image: item
|
image: url
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
if (resultObj.carInfo.archivesPhoto) {
|
||||||
|
resultObj.carInfo.archivesPhoto.split(",").map((item) => {
|
||||||
|
this.cararchivesPhotos.push({
|
||||||
|
url: this.$baseImageUrl + item
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1457,7 +1614,7 @@
|
|||||||
url: '/pages-order/reviewList/reviewList?formData=' + encodeURIComponent(JSON.stringify(
|
url: '/pages-order/reviewList/reviewList?formData=' + encodeURIComponent(JSON.stringify(
|
||||||
formData))
|
formData))
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -2309,4 +2466,8 @@
|
|||||||
background-color: #efefef;
|
background-color: #efefef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.car-popup-out {
|
||||||
|
padding: 30rpx 40rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -33,9 +33,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: center" v-if="repairList.length==0">
|
<view style="text-align: center" v-if="repairList.length==0">
|
||||||
<image class="" src="@/static/images/nothing.png" ></image>
|
<image class="" src="@/static/images/nothing.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -46,34 +46,38 @@
|
|||||||
<view class="submit" v-if="!ticketId" @click="addTwi">确认添加</view>
|
<view class="submit" v-if="!ticketId" @click="addTwi">确认添加</view>
|
||||||
<view class="submit" v-if="ticketId" @click="openUpload">拍照上传</view>
|
<view class="submit" v-if="ticketId" @click="openUpload">拍照上传</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 普通弹窗---打开已选配件 -->
|
<!-- 普通弹窗---打开已选配件 -->
|
||||||
<uni-popup ref="waresPopup" background-color="#fff" :mask-click="false">
|
<uni-popup ref="waresPopup" background-color="#fff" :mask-click="false">
|
||||||
<view class="popup-content" style="padding: 15px;">
|
<view class="popup-content" style="padding: 15px;">
|
||||||
<view class="dl-avatar-box" style="height: 400px;overflow-y: scroll">
|
<view class="dl-avatar-box" style="height: 400px;overflow-y: scroll">
|
||||||
<view v-for="(item, index) in selectedRepairList" :key="index" class="listItem">
|
<view v-for="(item, index) in selectedRepairList" :key="index" class="listItem">
|
||||||
<view class="repairName">{{ item.name }}</view>
|
<view class="repairName">{{ item.name }}</view>
|
||||||
<view class="repairBottom">
|
<view class="repairBottom">
|
||||||
<text class="repairDesc">单位:
|
<text class="repairDesc">单位:
|
||||||
<text class="repairUnit">{{ item.unitText }}</text>
|
<text class="repairUnit">{{ item.unitText }}</text>
|
||||||
</text>
|
</text>
|
||||||
<view class="repairBtns">
|
<view class="repairBtns">
|
||||||
<u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>
|
<u-icon name="minus-circle-fill" size="24" @click="delNum(item)"></u-icon>
|
||||||
<text class="repairNum">{{ item.num }}</text>
|
<text class="repairNum">{{ item.num }}</text>
|
||||||
<u-icon color="#0174F6" name="plus-circle-fill" size="24"
|
<u-icon color="#0174F6" name="plus-circle-fill" size="24"
|
||||||
@click="addNum(item)"></u-icon>
|
@click="addNum(item)"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: center" v-if="selectedRepairList.length==0">
|
<view style="text-align: center" v-if="selectedRepairList.length==0">
|
||||||
<image class="" src="@/static/images/nothing.png" ></image>
|
<image class="" src="@/static/images/nothing.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button type="primary" @click="closeWaresPopup">关闭</button>
|
<button type="primary" @click="closeWaresPopup">关闭</button>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
<!-- 普通弹窗---拍照上传 -->
|
<!-- 普通弹窗---拍照上传 -->
|
||||||
<uni-popup ref="popup" background-color="#fff">
|
<uni-popup ref="popup" background-color="#fff">
|
||||||
<view class="popup-content" style="padding: 15px;">
|
<view class="popup-content" style="padding: 15px;">
|
||||||
|
<view class="dl-avatar-box">
|
||||||
|
<text>备注</text>
|
||||||
|
<uni-easyinput v-model="remark" placeholder="请输入备注"></uni-easyinput>
|
||||||
|
</view>
|
||||||
<view class="dl-avatar-box">
|
<view class="dl-avatar-box">
|
||||||
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
|
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
|
||||||
limit="9" title="请上传配件申请单照片(最多选择9张图片)"></uni-file-picker>
|
limit="9" title="请上传配件申请单照片(最多选择9张图片)"></uni-file-picker>
|
||||||
@ -96,7 +100,9 @@
|
|||||||
} from "@/utils/auth";
|
} from "@/utils/auth";
|
||||||
import upload from "@/utils/upload";
|
import upload from "@/utils/upload";
|
||||||
import config from "@/config";
|
import config from "@/config";
|
||||||
import {data} from "uview-ui/libs/mixin/mixin";
|
import {
|
||||||
|
data
|
||||||
|
} from "uview-ui/libs/mixin/mixin";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
VNavigationBar
|
VNavigationBar
|
||||||
@ -124,8 +130,10 @@
|
|||||||
isTriggered: false,
|
isTriggered: false,
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
fileList: [],
|
fileList: [],
|
||||||
|
//备注
|
||||||
|
remark: undefined,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
twId: null
|
twId: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -138,74 +146,74 @@
|
|||||||
onLoad(data) {
|
onLoad(data) {
|
||||||
this.userInfo = getUserInfo()
|
this.userInfo = getUserInfo()
|
||||||
this.ticketId = data.ticketId
|
this.ticketId = data.ticketId
|
||||||
this.twId = data.twId
|
this.twId = data.twId
|
||||||
this.ifHouse = data.ifHouse
|
this.ifHouse = data.ifHouse
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeWaresPopup(){
|
closeWaresPopup() {
|
||||||
this.$refs.waresPopup.close()
|
this.$refs.waresPopup.close()
|
||||||
//刷新数据列表
|
//刷新数据列表
|
||||||
this.chooseTab("")
|
this.chooseTab("")
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 打开已选择的配件弹出框
|
* 打开已选择的配件弹出框
|
||||||
*/
|
*/
|
||||||
openChoosed(){
|
openChoosed() {
|
||||||
if(this.selectedRepairList.length==0){
|
if (this.selectedRepairList.length == 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$refs.waresPopup.open("bottom")
|
this.$refs.waresPopup.open("bottom")
|
||||||
},
|
},
|
||||||
addTwi(){
|
addTwi() {
|
||||||
if (!this.selectedRepairList || this.selectedRepairList.length === 0){
|
if (!this.selectedRepairList || this.selectedRepairList.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择配件!',
|
title: '请选择配件!',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let dataObj = {
|
let dataObj = {
|
||||||
id: this.twId
|
id: this.twId
|
||||||
}
|
}
|
||||||
dataObj.items = [...this.selectedRepairList.map(item => {
|
dataObj.items = [...this.selectedRepairList.map(item => {
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
count: item.num,
|
count: item.num,
|
||||||
name: item.name
|
name: item.name
|
||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
if(this.ifHouse){
|
if (this.ifHouse) {
|
||||||
//仓管
|
//仓管
|
||||||
dataObj.ifHouseAdd = true
|
dataObj.ifHouseAdd = true
|
||||||
}else{
|
} else {
|
||||||
//服务顾问
|
//服务顾问
|
||||||
dataObj.ifHouseAdd = false
|
dataObj.ifHouseAdd = false
|
||||||
}
|
}
|
||||||
request({
|
request({
|
||||||
url: "/admin-api/repair/twi/addTwi",
|
url: "/admin-api/repair/twi/addTwi",
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: dataObj
|
data: dataObj
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功!',
|
title: '提交成功!',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 700)
|
}, 700)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openUpload() {
|
openUpload() {
|
||||||
this.$refs.popup.open("bottom")
|
this.$refs.popup.open("bottom")
|
||||||
},
|
},
|
||||||
afterRead(file) {
|
afterRead(file) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在上传中...',
|
title: '正在上传中...',
|
||||||
mask:true
|
mask: true
|
||||||
});
|
});
|
||||||
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||||
upload({
|
upload({
|
||||||
url: '/admin-api/infra/file/upload',
|
url: '/admin-api/infra/file/upload',
|
||||||
@ -214,9 +222,9 @@
|
|||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
url: config.baseImageUrl + res.data
|
url: config.baseImageUrl + res.data
|
||||||
})
|
})
|
||||||
if(i==file.tempFilePaths.length-1){
|
if (i == file.tempFilePaths.length - 1) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
console.log(this.fileList)
|
console.log(this.fileList)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -291,7 +299,7 @@
|
|||||||
* 分页加载所有配件
|
* 分页加载所有配件
|
||||||
*/
|
*/
|
||||||
pageList() {
|
pageList() {
|
||||||
let that = this
|
let that = this
|
||||||
let paramsObj = {
|
let paramsObj = {
|
||||||
pageNo: this.pageNo,
|
pageNo: this.pageNo,
|
||||||
pageSize: this.pageSize
|
pageSize: this.pageSize
|
||||||
@ -324,19 +332,19 @@
|
|||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
})
|
})
|
||||||
console.log(thisDataList,"thisDataList")
|
console.log(thisDataList, "thisDataList")
|
||||||
//判断 如果获取的数据的页码不是第一页,就让之前赋值获取过的数组数据 concat连接 刚获取的第n页数据
|
//判断 如果获取的数据的页码不是第一页,就让之前赋值获取过的数组数据 concat连接 刚获取的第n页数据
|
||||||
if (that.pageNo != 1) {
|
if (that.pageNo != 1) {
|
||||||
that.repairList = that.repairList.concat(thisDataList)
|
that.repairList = that.repairList.concat(thisDataList)
|
||||||
} else {
|
} else {
|
||||||
that.repairList = thisDataList
|
that.repairList = thisDataList
|
||||||
}
|
}
|
||||||
//将获取的总条数赋值
|
//将获取的总条数赋值
|
||||||
that.total = res.data.total
|
that.total = res.data.total
|
||||||
that.isTriggered = false
|
that.isTriggered = false
|
||||||
}else{
|
} else {
|
||||||
that.isTriggered = false
|
that.isTriggered = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addNum(repair) {
|
addNum(repair) {
|
||||||
@ -390,34 +398,37 @@
|
|||||||
})
|
})
|
||||||
dataObj.items = itemList
|
dataObj.items = itemList
|
||||||
}
|
}
|
||||||
if (this.fileList.length > 0){
|
if (this.fileList.length > 0) {
|
||||||
dataObj.images = this.fileList.map(item => {
|
dataObj.images = this.fileList.map(item => {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
return item.path.replace(config.baseImageUrl, '')
|
return item.path.replace(config.baseImageUrl, '')
|
||||||
}).join(",")
|
}).join(",")
|
||||||
}
|
}
|
||||||
|
if (this.remark) {
|
||||||
|
dataObj.remark = this.remark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/repair/tw/update',
|
url: '/admin-api/repair/tw/update',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data:dataObj
|
data: dataObj
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功!',
|
title: '提交成功!',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 700)
|
}, 700)
|
||||||
}else{
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交失败!',
|
title: '提交失败!',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// if(this.selectedRepairList.length>0){
|
// if(this.selectedRepairList.length>0){
|
||||||
// let itemList = []
|
// let itemList = []
|
||||||
// this.selectedRepairList.map((item)=>{
|
// this.selectedRepairList.map((item)=>{
|
||||||
@ -608,39 +619,40 @@
|
|||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listItem {
|
|
||||||
padding: 30rpx 0;
|
|
||||||
border-bottom: 2rpx solid #DDDDDD;
|
|
||||||
|
|
||||||
&:last-child {
|
.listItem {
|
||||||
border-bottom: none;
|
padding: 30rpx 0;
|
||||||
}
|
border-bottom: 2rpx solid #DDDDDD;
|
||||||
|
|
||||||
.repairName {
|
&:last-child {
|
||||||
font-size: 32rpx;
|
border-bottom: none;
|
||||||
color: #333333;
|
}
|
||||||
margin-bottom: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.repairBottom {
|
.repairName {
|
||||||
display: flex;
|
font-size: 32rpx;
|
||||||
align-items: center;
|
color: #333333;
|
||||||
justify-content: space-between;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.repairDesc {
|
.repairBottom {
|
||||||
font-size: 28rpx;
|
display: flex;
|
||||||
color: #858BA0;
|
align-items: center;
|
||||||
}
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.repairUnit {
|
.repairDesc {
|
||||||
color: #333333;
|
font-size: 28rpx;
|
||||||
}
|
color: #858BA0;
|
||||||
|
}
|
||||||
|
|
||||||
.repairBtns {
|
.repairUnit {
|
||||||
display: flex;
|
color: #333333;
|
||||||
align-items: center;
|
}
|
||||||
column-gap: 10rpx;
|
|
||||||
}
|
.repairBtns {
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
column-gap: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
18
pages.json
18
pages.json
@ -81,6 +81,13 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": ""
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/white/white",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [{
|
"subPackages": [{
|
||||||
@ -345,12 +352,11 @@
|
|||||||
{
|
{
|
||||||
"root": "pages-detail",
|
"root": "pages-detail",
|
||||||
"pages": [{
|
"pages": [{
|
||||||
"path": "detail/detail",
|
"path": "detail/detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "详情页"
|
"navigationBarTitleText": "详情页"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"root": "pages-business",
|
"root": "pages-business",
|
||||||
@ -368,7 +374,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "white/white",
|
"path" : "statistics/statistics",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : ""
|
"navigationBarTitleText" : ""
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
## 2.0.10(2024-06-07)
|
## 2.0.12(2025-08-26)
|
||||||
- 优化 uni-app x 中,size 属性的类型
|
- 优化 uni-app x 下 size 类型问题
|
||||||
|
## 2.0.11(2025-08-18)
|
||||||
|
- 修复 图标点击事件返回
|
||||||
## 2.0.9(2024-01-12)
|
## 2.0.9(2024-01-12)
|
||||||
fix: 修复图标大小默认值错误的问题
|
fix: 修复图标大小默认值错误的问题
|
||||||
## 2.0.8(2023-12-14)
|
## 2.0.8(2023-12-14)
|
||||||
|
|||||||
@ -1,91 +1,91 @@
|
|||||||
<template>
|
<template>
|
||||||
<text class="uni-icons" :style="styleObj">
|
<text class="uni-icons" :style="styleObj">
|
||||||
<slot>{{unicode}}</slot>
|
<slot>{{unicode}}</slot>
|
||||||
</text>
|
</text>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fontData, IconsDataItem } from './uniicons_file'
|
import { fontData, IconsDataItem } from './uniicons_file'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icons 图标
|
* Icons 图标
|
||||||
* @description 用于展示 icon 图标
|
* @description 用于展示 icon 图标
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
|
||||||
* @property {Number,String} size 图标大小
|
* @property {Number} size 图标大小
|
||||||
* @property {String} type 图标图案,参考示例
|
* @property {String} type 图标图案,参考示例
|
||||||
* @property {String} color 图标颜色
|
* @property {String} color 图标颜色
|
||||||
* @property {String} customPrefix 自定义图标
|
* @property {String} customPrefix 自定义图标
|
||||||
* @event {Function} click 点击 Icon 触发事件
|
* @event {Function} click 点击 Icon 触发事件
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
name: "uni-icons",
|
name: "uni-icons",
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#333333'
|
default: '#333333'
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 16
|
default: 16
|
||||||
},
|
},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
unicode() : string {
|
unicode() : string {
|
||||||
let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
|
let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
|
||||||
if (codes !== null) {
|
if (codes !== null) {
|
||||||
return codes.unicode
|
return codes.unicode
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
iconSize() : string {
|
iconSize() : string {
|
||||||
const size = this.size
|
const size = this.size
|
||||||
if (typeof size == 'string') {
|
if (typeof size == 'string') {
|
||||||
const reg = /^[0-9]*$/g
|
const reg = /^[0-9]*$/g
|
||||||
return reg.test(size as string) ? '' + size + 'px' : '' + size;
|
return reg.test(size as string) ? '' + size + 'px' : '' + size;
|
||||||
// return '' + this.size
|
// return '' + this.size
|
||||||
}
|
}
|
||||||
return this.getFontSize(size as number)
|
return this.getFontSize(size as number)
|
||||||
},
|
},
|
||||||
styleObj() : UTSJSONObject {
|
styleObj() : UTSJSONObject {
|
||||||
if (this.fontFamily !== '') {
|
if (this.fontFamily !== '') {
|
||||||
return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
|
return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
|
||||||
}
|
}
|
||||||
return { color: this.color, fontSize: this.iconSize }
|
return { color: this.color, fontSize: this.iconSize }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() { },
|
created() { },
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 字体大小
|
* 字体大小
|
||||||
*/
|
*/
|
||||||
getFontSize(size : number) : string {
|
getFontSize(size : number) : string {
|
||||||
return size + 'px';
|
return size + 'px';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: UniIconsFontFamily;
|
font-family: UniIconsFontFamily;
|
||||||
src: url('./uniicons.ttf');
|
src: url('./uniicons.ttf');
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-icons {
|
.uni-icons {
|
||||||
font-family: UniIconsFontFamily;
|
font-family: UniIconsFontFamily;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -85,8 +85,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
_onClick() {
|
_onClick(e) {
|
||||||
this.$emit('click')
|
this.$emit('click', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-icons",
|
"id": "uni-icons",
|
||||||
"displayName": "uni-icons 图标",
|
"displayName": "uni-icons 图标",
|
||||||
"version": "2.0.10",
|
"version": "2.0.12",
|
||||||
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
|
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -11,12 +11,14 @@
|
|||||||
],
|
],
|
||||||
"repository": "https://github.com/dcloudio/uni-ui",
|
"repository": "https://github.com/dcloudio/uni-ui",
|
||||||
"engines": {
|
"engines": {
|
||||||
"HBuilderX": "^3.2.14"
|
"HBuilderX": "^3.2.14",
|
||||||
|
"uni-app": "^4.08",
|
||||||
|
"uni-app-x": "^4.61"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,54 +36,74 @@
|
|||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||||
"type": "component-vue"
|
"type": "component-vue",
|
||||||
|
"darkmode": "x",
|
||||||
|
"i18n": "x",
|
||||||
|
"widescreen": "x"
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-scss"],
|
"dependencies": [
|
||||||
|
"uni-scss"
|
||||||
|
],
|
||||||
"encrypt": [],
|
"encrypt": [],
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"cloud": {
|
"cloud": {
|
||||||
"tcb": "y",
|
"tcb": "x",
|
||||||
"aliyun": "y",
|
"aliyun": "x",
|
||||||
"alipay": "n"
|
"alipay": "x"
|
||||||
},
|
},
|
||||||
"client": {
|
"client": {
|
||||||
"App": {
|
"uni-app": {
|
||||||
"app-vue": "y",
|
"vue": {
|
||||||
"app-nvue": "y",
|
"vue2": "√",
|
||||||
"app-uvue": "y"
|
"vue3": "√"
|
||||||
|
},
|
||||||
|
"web": {
|
||||||
|
"safari": "√",
|
||||||
|
"chrome": "√"
|
||||||
|
},
|
||||||
|
"app": {
|
||||||
|
"vue": "√",
|
||||||
|
"nvue": "-",
|
||||||
|
"android": {
|
||||||
|
"extVersion": "",
|
||||||
|
"minVersion": "29"
|
||||||
|
},
|
||||||
|
"ios": "√",
|
||||||
|
"harmony": "√"
|
||||||
|
},
|
||||||
|
"mp": {
|
||||||
|
"weixin": "√",
|
||||||
|
"alipay": "√",
|
||||||
|
"toutiao": "√",
|
||||||
|
"baidu": "√",
|
||||||
|
"kuaishou": "-",
|
||||||
|
"jd": "-",
|
||||||
|
"harmony": "-",
|
||||||
|
"qq": "√",
|
||||||
|
"lark": "-"
|
||||||
|
},
|
||||||
|
"quickapp": {
|
||||||
|
"huawei": "√",
|
||||||
|
"union": "√"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"H5-mobile": {
|
"uni-app-x": {
|
||||||
"Safari": "y",
|
"web": {
|
||||||
"Android Browser": "y",
|
"safari": "√",
|
||||||
"微信浏览器(Android)": "y",
|
"chrome": "√"
|
||||||
"QQ浏览器(Android)": "y"
|
},
|
||||||
},
|
"app": {
|
||||||
"H5-pc": {
|
"android": {
|
||||||
"Chrome": "y",
|
"extVersion": "",
|
||||||
"IE": "y",
|
"minVersion": "29"
|
||||||
"Edge": "y",
|
},
|
||||||
"Firefox": "y",
|
"ios": "√",
|
||||||
"Safari": "y"
|
"harmony": "√"
|
||||||
},
|
},
|
||||||
"小程序": {
|
"mp": {
|
||||||
"微信": "y",
|
"weixin": "√"
|
||||||
"阿里": "y",
|
}
|
||||||
"百度": "y",
|
|
||||||
"字节跳动": "y",
|
|
||||||
"QQ": "y",
|
|
||||||
"钉钉": "y",
|
|
||||||
"快手": "y",
|
|
||||||
"飞书": "y",
|
|
||||||
"京东": "y"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "y",
|
|
||||||
"联盟": "y"
|
|
||||||
},
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "y",
|
|
||||||
"vue3": "y"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -333,6 +333,9 @@ export function builderOrder(order) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatDate(timestamp) {
|
export function formatDate(timestamp) {
|
||||||
|
if (!timestamp) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
// 将时间戳转换为Date对象
|
// 将时间戳转换为Date对象
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
// 获取年月日时分秒
|
// 获取年月日时分秒
|
||||||
@ -504,3 +507,95 @@ export function formatDateCus(date) {
|
|||||||
const d = date.getDate().toString().padStart(2, '0')
|
const d = date.getDate().toString().padStart(2, '0')
|
||||||
return `${y}-${m}-${d}`
|
return `${y}-${m}-${d}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将扁平数组转换为树形结构,并支持按 sort 字段排序
|
||||||
|
* @param {Array} data 源数据
|
||||||
|
* @param {String} id 节点ID字段名,默认为 'id'
|
||||||
|
* @param {String} parentId 父节点ID字段名,默认为 'parentId'
|
||||||
|
* @param {String} children 子节点字段名,默认为 'children'
|
||||||
|
* @param {Number|String} rootId 根节点ID值,默认为最小的parentId或0
|
||||||
|
* @param {String} sortKey 排序字段名,默认为 'sort'
|
||||||
|
* @returns {Array} 树形结构数据
|
||||||
|
*/
|
||||||
|
export function handleTree(data, id, parentId, children, rootId, sortKey) {
|
||||||
|
// 参数默认值处理
|
||||||
|
id = id || 'id';
|
||||||
|
parentId = parentId || 'parentId';
|
||||||
|
children = children || 'children';
|
||||||
|
sortKey = sortKey || 'sort';
|
||||||
|
|
||||||
|
// 自动计算根节点ID(取最小的parentId,若无则用0)
|
||||||
|
rootId = rootId || Math.min(...data.map(item => item[parentId])) || 0;
|
||||||
|
|
||||||
|
// 深拷贝源数据以避免污染原数组
|
||||||
|
const cloneData = JSON.parse(JSON.stringify(data));
|
||||||
|
|
||||||
|
// 先对所有数据进行排序(确保父节点在前)
|
||||||
|
cloneData.sort((a, b) => {
|
||||||
|
const aSort = a[sortKey] ?? 0; // 使用空值合并运算符处理undefined
|
||||||
|
const bSort = b[sortKey] ?? 0;
|
||||||
|
return aSort - bSort; // 升序排序
|
||||||
|
});
|
||||||
|
|
||||||
|
// 构建哈希表加速查找
|
||||||
|
const nodeMap = {};
|
||||||
|
cloneData.forEach(item => {
|
||||||
|
nodeMap[item[id]] = item;
|
||||||
|
item[children] = []; // 初始化children数组
|
||||||
|
});
|
||||||
|
|
||||||
|
// 构建树形结构
|
||||||
|
const tree = [];
|
||||||
|
cloneData.forEach(item => {
|
||||||
|
if (item[parentId] === rootId) {
|
||||||
|
// 根节点直接加入结果
|
||||||
|
tree.push(item);
|
||||||
|
} else {
|
||||||
|
// 非根节点找到父节点并插入
|
||||||
|
const parent = nodeMap[item[parentId]];
|
||||||
|
parent?.[children]?.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 递归排序所有子节点
|
||||||
|
const sortChildren = (nodes) => {
|
||||||
|
nodes.forEach(node => {
|
||||||
|
if (node[children]?.length) {
|
||||||
|
node[children].sort((a, b) => {
|
||||||
|
const aSort = a[sortKey] ?? 0;
|
||||||
|
const bSort = b[sortKey] ?? 0;
|
||||||
|
return aSort - bSort;
|
||||||
|
});
|
||||||
|
sortChildren(node[children]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
sortChildren(tree);
|
||||||
|
|
||||||
|
return tree.length ? tree : data; // 空树时返回原数据
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将树形结构数据转成 uniapp multiSelector picker 可用的二维数组
|
||||||
|
* @param {Array} tree 树形结构数据
|
||||||
|
* @param {String} labelKey 节点显示字段,默认为 'name'
|
||||||
|
* @param {String} childrenKey 子节点字段,默认为 'children'
|
||||||
|
* @returns {Array} picker二维数组,例如 [[一级], [二级], [三级]...]
|
||||||
|
*/
|
||||||
|
export function toPickerData(tree, labelKey = 'name', childrenKey = 'children') {
|
||||||
|
const result = []
|
||||||
|
|
||||||
|
function buildColumns(nodes, level = 0) {
|
||||||
|
if (!nodes || !nodes.length) return
|
||||||
|
// 当前层级的所有 name
|
||||||
|
result[level] = nodes.map(n => n[labelKey])
|
||||||
|
// 默认取第一个子节点继续递归
|
||||||
|
if (nodes[0][childrenKey] && nodes[0][childrenKey].length) {
|
||||||
|
buildColumns(nodes[0][childrenKey], level + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildColumns(tree, 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user