Browse Source

售后工单 页面开发

8521520123jsy 1 năm trước cách đây
mục cha
commit
5de688de9e

+ 8 - 0
api/salesServiceManagement/workOrder/index.js

@@ -16,3 +16,11 @@ export async function getSalesWorkOrder(params) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+export async function getSalesWorkOrderById(id) {
+	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesWorkOrder/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 1 - 0
pages/saleManage/components/myCard.vue

@@ -12,6 +12,7 @@
 				<view class="item_one rx-sc" v-else-if="val.type=='action'">
 					<view class="lable">{{val.label}}</view>
 					<view class="text">
+						
 						<template v-for="(btn,bI) in btnList">
 							
 							<u-button :plain="true" :hairline="true" size='mini' :type="btn.btnType" v-if="judge(btn)"

+ 36 - 7
pages/salesServiceManagement/demandList/components/AfterSales.vue

@@ -14,8 +14,8 @@
 				</text>
 				<u-button @click="goProblem('add')" :plain="true" :hairline="true" size='mini' type="default"
 					text="添加故障"></u-button>
-				<u-button @click="del" :plain="true" :hairline="true" size='mini' type="default" class="delete"
-					text="删除"></u-button>
+				<u-button v-if="!isReport" @click="del" :plain="true" :hairline="true" size='mini' type="default"
+					class="delete" text="删除"></u-button>
 			</view>
 		</view>
 		<view v-for="(item, index) in faultDetails" :key="index" style="position: relative;">
@@ -41,12 +41,18 @@
 			type: {
 				type: String,
 				default: 'edit'
+			},
+			// 是否是售后工单的 报工或者修改进入
+			isReport: {
+				type: Boolean,
+				default: false
 			}
 		},
 		watch: {
 			itemList: {
 				handler(newVal) {
 					let list = JSON.parse(JSON.stringify(newVal));
+					console.log(list, 'list');
 					list.map((el) => {
 						el.faultDetails = el.faultDetails ? el.faultDetails : []
 					})
@@ -69,10 +75,23 @@
 					return this.tableList[0][field]
 				}
 			},
-			btnData(){
-				if(this.type == 'view'){
+			btnData() {
+				if (this.type == 'view') {
 					return []
 				}
+				if (this.isReport) {
+					let list = JSON.parse(JSON.stringify(this.btnList));
+					list.map((el) => {
+						el.judge = [{
+							authorities: '',
+						}, {
+							key: 'customize',
+							value: ['5'],
+
+						}]
+					})
+					return list;
+				}
 				return this.btnList;
 			}
 		},
@@ -117,7 +136,7 @@
 					[{
 						label: '操作:',
 						prop: 'action',
-						type: this.type !='view' ? 'action' : '',
+						type: this.type != 'view' ? 'action' : '',
 						className: 'perce100',
 					}],
 				],
@@ -149,11 +168,13 @@
 				index
 			}) => {
 				if (type == 'add') {
+					if (this.isReport) {
+						data.customize = '5'
+					}
 					this.tableList[0].faultDetails.push(data)
 				} else {
 					this.$set(this.tableList[0].faultDetails, index, data)
 				}
-				console.log(this.tableList, 'this.tableList ===')
 			})
 
 		},
@@ -201,8 +222,16 @@
 			addFault() {
 
 			},
+			// 返回列表数据
 			getTabData() {
-				return this.tableList || []
+				if (!this.isReport) return this.tableList || [];
+				let list = this.tableList.map((el) => {
+					if (el.customize) {
+						delete el.customize;
+					}
+					return el;
+				})
+				return list;
 			}
 		},
 	}

+ 31 - 14
pages/salesServiceManagement/demandList/components/contactList.vue

@@ -2,15 +2,16 @@
 	<view class="after_sales">
 		<view class="bth_oper" v-if="type != 'view'">
 			<view class="btn add" @click="goContact('add')">添加</view>
-			<view class="btn del" @click="batchDelete">删除</view>
-			<text class="reserve">请至少保留一条联系人数据</text>
+			<view class="btn del" v-if="!isReport" @click="batchDelete">删除</view>
+			<text class="reserve" v-if="!isReport">请至少保留一条联系人数据</text>
 		</view>
 		<u-list class="listContent">
 			<checkbox-group v-for="(item, index) in contactList" :key="index" @change="e => selectVal(e, item, index)">
 				<label>
 					<view class="listBox">
 						<view class="listBox-sel">
-							<checkbox v-if="type != 'view'" :value="item.id" color="#fff" :disabled="item.disabled" :checked="item.checked" />
+							<checkbox v-if="btnOperate(item)" :value="item.id" color="#fff" :disabled="item.disabled"
+								:checked="item.checked" />
 						</view>
 						<view class="listBox-con">
 							<view class="listBox-bottom">
@@ -26,10 +27,10 @@
 									<text class="text">
 										操作:
 									</text>
-									<u-button v-if="type != 'view'" @click="goContact('edit',index,item)" :plain="true" :hairline="true"
-										size='mini' type="default" text="编辑"></u-button>
-									<u-button v-if="type != 'view'" @click="del(index)" :plain="true" :hairline="true" size='mini' type="default"
-										class="delete" text="删除"></u-button>
+									<u-button v-if="btnOperate(item)" @click="goContact('edit',index,item)"
+										:plain="true" :hairline="true" size='mini' type="default" text="编辑"></u-button>
+									<u-button v-if="btnOperate(item)" @click="del(index)" :plain="true" :hairline="true"
+										size='mini' type="default" class="delete" text="删除"></u-button>
 								</view>
 							</view>
 						</view>
@@ -54,9 +55,13 @@
 				type: Array,
 				default: () => []
 			},
-			type:{
-				type:String,
-				default:''
+			type: {
+				type: String,
+				default: ''
+			},
+			isReport: {
+				type: Boolean,
+				default: false
 			}
 		},
 		watch: {
@@ -69,7 +74,19 @@
 				immediate: true
 			}
 		},
-		computed: {},
+		computed: {
+			btnOperate() {
+				return (item) => {
+					// 详情进入 不显示
+					if (this.type == 'view') return false
+					// 工单 的报工或修改进入 不能对原有数据进行操作
+					if (this.isReport && item.id) {
+						return false;
+					}
+					return true
+				}
+			}
+		},
 		data() {
 			return {
 				contactList: []
@@ -115,8 +132,8 @@
 			},
 			// 批量删除
 			batchDelete() {
-				let list = this.contactList.filter(item=> item.checked);
-				console.log(list,'list')
+				let list = this.contactList.filter(item => item.checked);
+				console.log(list, 'list')
 				if (list.length == 0) {
 					this.$refs.uToast.show({
 						type: "warning",
@@ -131,7 +148,7 @@
 					confirmColor: '#FF4D4F',
 					success: (res) => {
 						if (res.confirm) {
-							this.contactList = this.contactList.filter(item=> !item.checked);
+							this.contactList = this.contactList.filter(item => !item.checked);
 						} else if (res.cancel) {
 							// 用户点击了取消按钮
 							console.log('用户取消删除');

+ 0 - 8
pages/salesServiceManagement/demandList/components/demandInfor.vue

@@ -1,8 +0,0 @@
-<template>
-</template>
-
-<script>
-</script>
-
-<style>
-</style>

+ 72 - 0
pages/salesServiceManagement/workOrder/components/demandInfo.vue

@@ -0,0 +1,72 @@
+<template>
+	<u-cell-group>
+		<!-- 售后对象信息 -->
+		<u-cell title="需求编码" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input readonly style="flex:1" border="surround" v-model="demandForm.code">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="需求名称" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly placeholder="请输入" border="surround" v-model="demandForm.name">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="客户名称" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly placeholder="请选择" border="surround" v-model="demandForm.contactName">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="发货单" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly placeholder="请选择" border="surround" v-model="demandForm.orderCode">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="报修地址" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly placeholder="请输入" border="surround" v-model="demandForm.contactAddress">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="故障等级" arrow-direction="down">
+	<view slot="value" style="display: flex;align-items: center;width: 100%;">
+		<u--input style="flex:1" readonly placeholder="请输入" border="surround" v-model="demandForm.fault_level">
+		</u--input>
+	</view>
+		</u-cell>
+		<u-cell title="期望解决时间" arrow-direction="down">
+			<uni-datetime-picker disabled type="date" slot="value" v-model="demandForm.expectedTime">
+			</uni-datetime-picker>
+		</u-cell>
+		<u-cell title="报修人" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" placeholder="请输入" readonly border="surround"
+					v-model="demandForm.createUserName">
+				</u--input>
+			</view>
+		</u-cell>
+	</u-cell-group>
+</template>
+
+<script>
+	export default {
+		props: {
+			demandForm: {
+				type: Object,
+				default: () => {}
+			}
+		},
+		data() {
+			return {
+
+			}
+		},
+
+	}
+</script>
+
+<style>
+</style>

+ 103 - 146
pages/salesServiceManagement/workOrder/components/editPlan.vue

@@ -4,73 +4,32 @@
 			:title="title" @clickLeft="back">
 		</uni-nav-bar>
 		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
-		<u-cell-group v-if="current == 0">
-			<u-cell title="需求编码" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--input readonly style="flex:1" border="surround" v-model="form.code">
-					</u--input>
-				</view>
-			</u-cell>
-			<u-cell title="名称" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--input placeholder="请输入" :readonly="!isDisable" style="flex:1" border="surround"
-						v-model="form.name">
-					</u--input>
-				</view>
-			</u-cell>
-			<u-cell title="自动派单" arrow-direction="down">
-				<uni-data-picker :readonly="!isDisable" v-model="form.isSyncBill" slot="value" placeholder="请选择"
-					:localdata="isSyncBillist" @change="dispatchOnchange">
-				</uni-data-picker>
-			</u-cell>
-			<u-cell title="预计售后时长" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--input :readonly="!isDisable" style="flex:1" border="surround" v-model="form.duration">
-						<template #suffix>
-							<uni-data-picker class="time_select" :readonly="!isDisable" v-model="form.durationUnit"
-								slot="value" placeholder="请选择" :localdata="durationList" @change="durationOnchange">
-							</uni-data-picker>
-						</template>
-					</u--input>
-				</view>
-			</u-cell>
-			<u-cell title="部门" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--input :disabled="!isDisable" style="flex:1" placeholder="请选择" border="surround"
-						@click.native="selectDepartment" v-model="form.executeGroupName">
-					</u--input>
-				</view>
-			</u-cell>
-			<u-cell title="执行人" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<zxz-uni-data-select class="executor_user" :localdata="userList" v-model="form.executeUserId" @change="handleUserChange"
-						:multiple="Usertype==2"></zxz-uni-data-select>
-				</view>
-			</u-cell>
-			<u-cell title="紧急程度" arrow-direction="down">
-					<uni-data-picker :readonly="!isDisable" v-model="form.urgent" slot="value" placeholder="请选择"
-						:localdata="urgentList" @change="urgentOnchange">
-					</uni-data-picker>
-			</u-cell>
-			<u-cell title="备注" arrow-direction="down">
-				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--textarea> :readonly="!isDisable" style="flex:1" border="surround" v-model="form.remark">
-					</u--textarea>
-				</view>
-			</u-cell>
-		</u-cell-group>
-		<SchemeList v-if="current == 1" />
+
+		<DemandInfo :demandForm="demandForm" v-show="current == 0" :itemList="productDetail" />
+		<PlanInfo :planForm="planForm" v-show="current == 1" />
+		<AfterSales v-show="current == 2" :itemList="productDetail" :type="type" :isReport="isReport" />
+		<ContactList ref="contactRef" :type="type" v-show="current == 3" :itemList="contactInfoVOS"
+			:isReport="isReport" />
+		<SchemeList v-if="current == 4" :type='type' :itemList="costListVOS" />
+
 		<view class="footerButton" v-if="isDisable">
 			<u-button type="default" text="返回" @click="back"></u-button>
 			<u-button type="primary" @click="save" text="保存"></u-button>
 		</view>
-		<ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
-			valueKey="id" textKey="name" childrenKey="children" />
+		<!-- 	<ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData"
+			valueKey="id" textKey="name" childrenKey="children" /> -->
 		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
- 
+
 <script>
+	import AfterSales from '@/pages/salesServiceManagement/demandList/components/AfterSales.vue'
+	import ContactList from '@/pages/salesServiceManagement/demandList/components/contactList.vue'
+	import {
+		getSalesWorkOrderById
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	import PlanInfo from './planInfo.vue'
+	import DemandInfo from './demandInfo.vue'
 	import SchemeList from './schemeList.vue'
 	import {
 		getByCode
@@ -81,60 +40,39 @@
 	} from '@/api/myTicket/index.js'
 	export default {
 		components: {
-			SchemeList
+			SchemeList,
+			PlanInfo,
+			DemandInfo,
+			AfterSales,
+			ContactList
 		},
 		computed: {
 			isDisable() {
 				let flag = this.type != 'view'
 				return flag;
+			},
+			isReport() {
+				let flag = this.type != 'view' ? true : false
+				return flag
 			}
 		},
 		data() {
 			return {
 				current: 0,
-				title: '修改计划',
+				title: '修改工单',
 				type: 'edit',
-				form: {
-					name: '',
-					remark: '',
-					duration: '',
-					durationUnit: '',
-					executeGroupId: '',
-					executeGroupName: '',
-					executeUserName: '',
-					executeUserId: ''
-				},
 				Usertype: '',
-				list: ['基本信息', '方案', '联系人'],
-				isSyncBillist: [{
-						value: '1',
-						text: '是'
-					},
-					{
-						value: '1',
-						text: '否'
-					}
-				],
-				durationList: [{
-						value: '1',
-						text: '分钟'
-					},
-					{
-						value: '2',
-						text: '小时'
-					},
-					{
-						value: '3',
-						text: '天'
-					},
-				],
-				urgentList: [],
+				list: ['需求信息', '计划信息', '售后对象', '联系人', '方案'],
 				listData: [], // 部门数据
 				userList: [], // 执行人列表
+				demandForm: {}, // 需求基本信息
+				planForm: {}, // 计划基本信息
+				productDetail: [], // 售后对象
+				contactInfoVOS: [], // 联系人
+				costListVOS: [], // 方案
 			}
 		},
 		onLoad(params) {
-			console.log(params, 'params')
 			this.type = params.type;
 			this.title = params.type == 'view' ? '工单详情' : '修改工单';
 			this.getDetails(params.id);
@@ -143,66 +81,85 @@
 		created() {},
 		methods: {
 			async getDetails(id) {
-				this.getByData();
-				this.getDept();
+				// await this.getByData();
+				// this.getDept();
+				const res = await getSalesWorkOrderById(id);
+				console.log(res, 'res 1=1')
+				this.costListVOS = res.costListVOS;
+				this.demandData(res.afterSalesDemandVO);
+				this.planData(res.afterSalesPlanVO);
+			},
+			// 需求数据
+			async demandData(data) {
+				this.contactInfoVOS = data.contactInfoVOS || [];
+				this.productDetail = data.productDetail || [];
+				let fault_level = await this.getByData('fault_level', data.faultLevel);
+				this.demandForm = {
+					code: data.code,
+					name: data.name,
+					contactName: data.contactName,
+					orderCode: data.orderCode,
+					contactAddress: data.contactAddress,
+					expectedTime: data.expectedTime,
+					createUserName: data.createUserName,
+					fault_level,
+				}
 			},
-			async getByData() {
-				const codeValue = await getByCode('urgent_type');
-				console.log(codeValue, 'codeValue');
-				let list = codeValue.map(item => {
-					const key = Object.keys(item)[0]
-					return {
-						value: key,
-						text: item[key]
+			// 计划信息
+			async planData(data) {
+				let isSyncBill = data.isSyncBill == '0' ? '否' : data.isSyncBill == '1' ? '是' : ''
+				let urgent = await this.getByData('urgent_type', data.urgent);
+				this.planForm = {
+					code: data.code,
+					name: data.name,
+					isSyncBill,
+					executeGroupName: data.executeGroupName,
+					executeUserName: data.executeUserName,
+					remark: data.remark,
+					duration: data.duration,
+					durationUnit: data.durationUnit,
+					urgent,
+				}
+			},
+			async getByData(code, value) {
+				const codeValue = await getByCode(code);
+				let label = '';
+				codeValue.forEach((el) => {
+					if (el[value]) {
+						label = el[value];
+						return;
 					}
 				})
-				this.urgentList = list;
+				return label || ''
 			},
 			getDept() {
 				listOrganizations(1).then(data => {
-					console.log(data, 'data --');
 					this.listData = data;
 				})
 			},
-			confirm(data, name) {
-				this.form.executeGroupName = name
-				this.form.executeGroupId = data[0]
-				this.form.executeUserName = ''
-				this.form.executeUserId = ''
-				this.getUser(data[0])
-			},
-			getUser(deptCode) {
-				getUserPage({
-					pageNum: 1,
-					size: -1,
-					groupId: deptCode
-				}).then(data => {
-					this.userList = data.list.map(item => {
-						item.text = item.name
-						item.value = item.id
-						return item
-					})
-				})
-			},
+			// confirm(data, name) {
+			// 	this.form.executeGroupName = name
+			// 	this.form.executeGroupId = data[0]
+			// 	this.form.executeUserName = ''
+			// 	this.form.executeUserId = ''
+			// 	this.getUser(data[0])
+			// },
+			// getUser(deptCode) {
+			// 	getUserPage({
+			// 		pageNum: 1,
+			// 		size: -1,
+			// 		groupId: deptCode
+			// 	}).then(data => {
+			// 		this.userList = data.list.map(item => {
+			// 			item.text = item.name
+			// 			item.value = item.id
+			// 			return item
+			// 		})
+			// 	})
+			// },
 			sectionChange(index) {
 				this.current = index;
 			},
-			// 选择部门
-			selectDepartment() {
-				console.log('选择部门');
-				this.$refs.treePicker._show();
-			},
-			// 选择人
-			handleUserChange(obj) {
-				this.form.executeUserName = obj.name;
-				console.log(obj, 'obj')
-			},
-			dispatchOnchange() {
-
-			},
-			durationOnchange(){
-				
-			}
 		}
 	}
 </script>
@@ -220,8 +177,8 @@
 	/deep/ .time_select .uni-data-tree-input {
 		width: 200rpx;
 	}
-	
-	/deep/ .executor_user{
+
+	/deep/ .executor_user {
 		background: #fff;
 	}
 

+ 103 - 0
pages/salesServiceManagement/workOrder/components/planInfo.vue

@@ -0,0 +1,103 @@
+<template>
+	<u-cell-group>
+		<u-cell title="需求编码" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input readonly style="flex:1" border="surround" v-model="planForm.code">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="名称" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input placeholder="请输入" readonly style="flex:1" border="surround" v-model="planForm.name">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="自动派单" arrow-direction="down">
+			<!-- 		<uni-data-picker  v-model="planForm.isSyncBill" slot="value" placeholder="请选择"
+				:localdata="isSyncBillist" @change="dispatchOnchange">
+			</uni-data-picker> -->
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input placeholder="请输入" readonly style="flex:1" border="surround" v-model="planForm.isSyncBill">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="预计售后时长" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly border="surround" v-model="planForm.duration">
+					<template #suffix>
+						<uni-data-picker class="time_select" readonly v-model="planForm.durationUnit" slot="value"
+							placeholder="请选择" :localdata="durationList">
+						</uni-data-picker>
+					</template>
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="部门" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" placeholder="请选择" border="surround" v-model="planForm.executeGroupName">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="执行人" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--input style="flex:1" readonly placeholder="请选择" border="surround" v-model="planForm.executeUserName">
+				</u--input>
+			</view>
+		</u-cell>
+		<u-cell title="紧急程度" arrow-direction="down"> 
+		<view slot="value" style="display: flex;align-items: center;width: 100%;">
+			<u--input style="flex:1" readonly placeholder="请选择" border="surround" v-model="planForm.urgent">
+			</u--input>
+		</view>
+			<!-- 			<uni-data-picker  v-model="planForm.urgent" slot="value" placeholder="请选择"
+					:localdata="urgentList" @change="urgentOnchange">
+				</uni-data-picker> -->
+		</u-cell>
+		<u-cell title="备注" arrow-direction="down">
+			<view slot="value" style="display: flex;align-items: center;width: 100%;">
+				<u--textarea disabled style="flex:1" border="surround" v-model="planForm.remark">
+				</u--textarea>
+			</view>
+		</u-cell>
+	</u-cell-group>
+</template>
+
+<script>
+	export default {
+		props: {
+			planForm: {
+				type: Object,
+				default: () => {}
+			}
+		},
+		watch:{
+			planForm:{
+				handler(val){
+					this.planForm = val;
+				},
+				immediate:true,
+				deep:true,
+			}
+		},
+		data() {
+			return {
+				durationList: [{
+						value: '1',
+						text: '分钟'
+					},
+					{
+						value: '2',
+						text: '小时'
+					},
+					{
+						value: '3',
+						text: '天'
+					},
+				],
+			}
+		}
+	}
+</script>
+
+<style>
+</style>

+ 1 - 1
pages/salesServiceManagement/workOrder/components/schemeAdd.vue

@@ -168,7 +168,7 @@
 			},
 			selectProduct() {
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/toDoList/components/selectProduct?obtain=${this.obtain}`
+					url: `/pages/salesServiceManagement/workOrder/components/selectProduct?obtain=${this.obtain}`
 				})
 			},
 			save() {

+ 53 - 24
pages/salesServiceManagement/workOrder/components/schemeList.vue

@@ -3,11 +3,11 @@
 		<u-list class="listContent">
 			<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
 				<myCard :item="item" @details="add('view',item)" @edit="add('edit',item,index)" :index="index+1"
-					:columns="columns" :btnList="btnList">
+					:columns="columns" :btnList="btnData">
 				</myCard>
 			</view>
 		</u-list>
-		<view class="add" @click="add('add')">
+		<view class="add" @click="add('add')" v-if="type != 'view'">
 			<u-icon name="plus" color="#fff"></u-icon>
 		</view>
 	</view>
@@ -19,6 +19,26 @@
 		components: {
 			myCard
 		},
+		props: {
+			type: {
+				type: String,
+				default: 'edit'
+			},
+			itemList: {
+				type: Array,
+				default: () => []
+			},
+		},
+		watch: {
+			itemList: {
+				handler(newVal) {
+					let list = JSON.parse(JSON.stringify(newVal));
+					this.tableList = list
+				},
+				deep: true,
+				immediate: true
+			}
+		},
 		data() {
 			return {
 				columns: [
@@ -86,35 +106,42 @@
 					}],
 				],
 				btnList: [{
-						name: '详情',
-						apiName: 'details',
-						btnType: 'primary',
-						type: '2',
-						pageUrl: '',
-					},
-					{
-						name: '修改',
-						apiName: 'edit',
-						btnType: 'primary',
-						type: '2',
-						pageUrl: '',
-					}
-				],
+					name: '修改',
+					apiName: 'edit',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
+					juge: [{
+						authorities: '',
+					}, {
+						key: 'customize',
+						value: ['5'],
+
+					}]
+				}],
 				tableList: []
 			}
 		},
-		computed: {},
+		computed: {
+			btnData() {
+				if (this.type == 'view') {
+					return [];
+				}
+				return this.btnList;
+			}
+		},
 		created() {
 			uni.$off('updateInfo');
 			uni.$on('updateInfo', (data) => {
-				if(data.index || data.index == 0){
+				console.log(data,'data ----')
+				data.customize = '5';
+				if (data.index || data.index == 0) {
 					let index = data.index;
 					delete data.index;
-					this.$set(this.tableList,index,data);
-				}else{
-					this.tableList.push(data);
+					this.$set(this.tableList, index, data);
+					return
 				}
-				console.log(data, 'data 接收的数据')
+				this.tableList.push(data);
 			})
 		},
 		onShow() {
@@ -127,10 +154,12 @@
 				}
 				let data = JSON.stringify(item);
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/toDoList/components/schemeAdd?obtain=仓库&type=${type}&data=${data}`
+					url: `/pages/salesServiceManagement/workOrder/components/schemeAdd?obtain=仓库&type=${type}&data=${data}`
 				})
 			},
-
+			getTabData() {
+				return this.tableList || [];
+			}
 		}
 	}
 </script>

+ 88 - 28
pages/salesServiceManagement/workOrder/index.vue

@@ -46,8 +46,7 @@
 
 		data() {
 			return {
-				tabList: [
-					{
+				tabList: [{
 						value: 'all',
 						label: '全部',
 					},
@@ -68,6 +67,37 @@
 						label: '已完成',
 					},
 				],
+				workOrderStatus: [
+					// { code: 0, label: '待接收' },
+					{
+						code: 0,
+						label: '待执行'
+					},
+					{
+						code: 1,
+						label: '已接收'
+					},
+					{
+						code: 2,
+						label: '执行中'
+					},
+					{
+						code: 3,
+						label: '待验收'
+					},
+					{
+						code: 4,
+						label: '待评价'
+					},
+					{
+						code: 5,
+						label: '已完成'
+					},
+					{
+						code: 6,
+						label: '验收不通过'
+					}
+				],
 				pickTabIndex: 'all',
 				searchVal: '',
 				isEnd: false,
@@ -76,15 +106,33 @@
 				tableList: [],
 				columns: [
 					[{
-						label: '计划单号:',
+						label: '工单编号:',
 						prop: 'code',
 						type: 'title',
 						className: 'perce100',
 					}],
 					[{
-						label: '计划名称:',
-						prop: 'name'
+						label: '计划单号:',
+						prop: 'planCode'
 					}, ],
+					[{
+						label: '计划名称:',
+						prop: 'planName',
+					}],
+					[{
+						label: '报工人:',
+						prop: 'executeUserName'
+					}, {
+						label: '验收人:',
+						prop: 'accepterUserName',
+					}],
+					[{
+						label: '故障等级:',
+						prop: 'faultLevel'
+					}, {
+						label: '客户名称:',
+						prop: 'contactName',
+					}],
 					[{
 						label: '设备名称:',
 						prop: 'categoryName',
@@ -102,25 +150,36 @@
 						}
 					}],
 					[{
-						label: '客户名称:',
-						prop: 'contactName'
+						label: '验收时间:',
+						prop: 'accepterTime'
 					}, {
-						label: '紧急程度:',
-						prop: 'urgent',
-						formatter: (item) => {
-							return {
-								1: '普通',
-								2: '紧急',
-								3: '重要'
-							} [item.urgent];
-						}
+						label: '开始时间:',
+						prop: 'acceptTime',
 					}],
 					[{
-						label: '创建人:',
-						prop: 'createUserName'
+						label: '结束时间:',
+						prop: 'finishTime'
 					}, {
-						label: '创建时间:',
-						prop: 'createTime',
+						label: '计划完成时间:',
+						prop: 'planFinishTime',
+					}],
+					[{
+						label: '实际售后时长:',
+						prop: 'inFactDuration',
+						formatter: (row) => {
+							if (row.inFactDuration || row.inFactDuration == 0) {
+								let str = ((row.inFactDuration - 0) / 60).toFixed(1);
+								return str + '  小时';
+							}
+						}
+					}, {
+						label: '状态:',
+						prop: 'orderStatus',
+						formatter: (row) => {
+							return this.workOrderStatus.find(
+								(item) => item.code == row.orderStatus
+							)?.label;
+						}
 					}],
 					[{
 						label: '操作:',
@@ -145,14 +204,14 @@
 						judge: [{
 							authorities: '',
 						}, {
-							key: 'planStatus',
-							value: [0, 4, 5],
+							key: 'orderStatus',
+							value: [1, 6],
 
 						}],
 					},
 					{
-						name: '删除',
-						apiName: 'del',
+						name: '报工',
+						apiName: 'edit',
 						btnType: 'error ',
 						type: '2',
 						pageUrl: '',
@@ -163,7 +222,7 @@
 							value: [0, 4, 5],
 						}],
 					}, {
-						name: '派',
+						name: '派',
 						apiName: 'handleAudit',
 						btnType: 'primary',
 						type: '2',
@@ -176,7 +235,7 @@
 						}],
 					},
 					{
-						name: '撤回',
+						name: '申请配件',
 						apiName: 'handleAudit',
 						btnType: 'primary',
 						type: '2',
@@ -223,7 +282,7 @@
 					pageNum: this.page,
 					size: this.size,
 				}
-				if(this.pickTabIndex != 'all'){
+				if (this.pickTabIndex != 'all') {
 					data.orderStatus = this.pickTabIndex;
 				}
 				getSalesWorkOrder(data).then(res => {
@@ -249,8 +308,9 @@
 
 			},
 			edit(type, id) {
+				console.log(type,'type');
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/toDoList/components/editPlan?type=${type}&id=${id}`
+					url: `/pages/salesServiceManagement/workOrder/components/editPlan?type=${type}&id=${id}`
 				})
 			}
 		}