huang_an 2 роки тому
батько
коміт
a1375fe9fe

+ 102 - 0
pages/home/wt/components/measuringToolInspection/taskForm.vue

@@ -0,0 +1,102 @@
+<template>
+	<view class="">123</view>
+</template>
+
+<script>
+	import { getBusinessOpportunityDetailAPI, businessOpportunityUpdateAPI } from '@/api/wt/index.js'
+	export default {
+		props: {
+			businessId: {
+				default: ''
+			},
+			taskDefinitionKey: {
+				default: ''
+			}
+		},
+		data() {
+			return {
+				form: {},
+				calendarShow: false,
+				tableField: [
+					{
+						label: '名称',
+						field: 'productName'
+					},
+					{
+						label: '编码',
+						field: 'productCode'
+					},
+					{
+						label: '类型',
+						field: 'productCategoryName'
+					},
+					{
+						label: '单价',
+						field: 'singlePrice'
+					},
+					{
+						label: '数量',
+						field: 'totalCount'
+					},
+					{
+						label: '合计',
+						field: 'totalPrice'
+					},
+					{
+						label: '生产交付交期',
+						field: 'produceDeliveryDeadline',
+						type: 'date',
+						disabled: !['productionSupervisorApprove1', 'productionSupervisorApprove2'].includes(this.taskDefinitionKey)
+					}
+				],
+				list: ['基本信息', '产品清单'],
+				totalPrice: 0,
+				curNow: 0,
+				curIndex: null,
+				rules: {
+					produceDeliveryDeadline: {
+						type: 'string',
+						required: true,
+						message: '请选择生产交付日期',
+						trigger: ['blur', 'change']
+					}
+				}
+			}
+		},
+		methods: {
+			sectionChange(index) {
+				this.curNow = index
+			},
+			async getDetailData(id) {
+				const data = await getBusinessOpportunityDetailAPI(id)
+				if (data) {
+					this.form = data
+					console.log(this.form.productList)
+					this.totalPrice = this.form.productList.reduce((num, row) => (num += row.totalPrice), 0)
+				}
+			},
+			openCalendar(e, index) {
+				this.calendarShow = true
+				this.curIndex = index
+			},
+			confirm(e) {
+				this.$set(this.form.productList[this.curIndex], 'produceDeliveryDeadline', ...e)
+				this.calendarShow = false
+			},
+			//
+			getTableValue() {
+				let validField = ['produceDeliveryDeadline']
+				let valid = false
+				for (var i = 0; i < validField.length; i++) {
+					valid = this.form.productList.some(item => !!item[validField[i]] == false)
+					if (valid) break
+				}
+				return new Promise(async (resolve, reject) => {
+					valid ? reject(uni.$u.toast('请完善产品清单信息')) : resolve(this.form)
+				})
+			}
+		}
+	}
+</script>
+
+<style></style>

+ 180 - 0
pages/home/wt/components/measuringToolInspection/taskSubmit.vue

@@ -0,0 +1,180 @@
+<template>
+	<view class="">
+		<u--form style="margin: 0 20px;" labelPosition="left" :model="form" :rules="rules" ref="uForm"
+			labelWidth='140rpx'>
+			<u-form-item v-if="['productionSupervisorApprove1'].includes(taskDefinitionKey)" label="技术员"
+				prop="technicalAnswerName" required>
+				<u--input clearable placeholder="请选择" border="surround" v-model="form.technicalAnswerName"
+					@click.native="showTechnicianPicker"></u--input>
+			</u-form-item>
+
+			<u-form-item label="审批建议" prop="reason" required>
+				<u--textarea style="width: 100%;" height='120' border='surround' placeholder="请输入审批建议"
+					v-model="form.reason"></u--textarea>
+			</u-form-item>
+		</u--form>
+		<view>
+			<u-button style="width: 100%;margin-bottom: 10rpx;" icon="edit-pen" :loading='loading' type="success"
+				text="通过" @click="handleAudit(1)">
+			</u-button>
+			<u-button style="width: 100%;" :loading='loading' type="error" icon="close" text="驳回"
+				@click="handleAudit(0)" v-if="!['starter'].includes(taskDefinitionKey)"></u-button>
+		</view>
+		<u-picker itemHeight='60' :show="technicianShow" visibleItemCount='10' :columns="userOptions" keyName="name"
+			@confirm='selectTechnicianInfo' @cancel='technicianShow = false' title='选择技术员'></u-picker>
+	</view>
+</template>
+
+<script>
+	import {
+		approveTaskWithVariables,
+		businessOpportunityUpdateAPI
+	} from '@/api/wt/index.js'
+	import {
+		listAllUserBind
+	} from '@/api/common.js'
+	export default {
+		name: 'taskSubmit',
+		props: {
+			businessId: {
+				default: ''
+			},
+			taskId: {
+				default: ''
+			},
+			id: {
+				default: ''
+			},
+			taskDefinitionKey: {
+				default: ''
+			}
+		},
+
+		data() {
+			return {
+				loading: false,
+				technicianShow: false,
+				userOptions: [],
+				form: {
+					technicalAnswerId: '',
+					technicalAnswerName: '',
+					reason: '',
+				},
+				rules: {
+					reason: {
+						type: 'string',
+						required: true,
+						message: '请输入审批建议',
+						trigger: 'blur'
+					},
+					technicalAnswerName: {
+						type: 'string',
+						required: true,
+						message: '请选择技术员',
+						trigger: ['blur', 'change']
+					},
+				},
+				tabOptions: [{
+					key: 'productionSupervisorApprove1',
+					permissionType: 'update',
+					name: '生产主管审批',
+				}, {
+					key: 'techLeaderApprove',
+					permissionType: 'view',
+					name: '技术部主管审批',
+				}, {
+					key: 'productionSupervisorApprove2',
+					permissionType: 'view',
+					name: '生产主管审批',
+				}, {
+					key: 'salesManagerApprove',
+					permissionType: 'view',
+					name: '销售主管审批',
+				}],
+			}
+		},
+		mounted() {
+			this.$refs.uForm.setRules(this.rules)
+			this.getUserOptions()
+		},
+		methods: {
+			async getUserOptions() {
+				const data = await listAllUserBind()
+				this.userOptions.push(data)
+			},
+			showTechnicianPicker(val) {
+				if (val.target.nodeName == 'I') {
+					this.form.technicalAnswerId = ''
+					this.form.technicalAnswerName = ''
+					return
+				}
+				this.technicianShow = true
+			},
+			selectTechnicianInfo(e) {
+				this.form.technicalAnswerId = e.value[0]?.id
+				this.form.technicalAnswerName = e.value[0]?.name
+				this.technicianShow = false
+			},
+
+			async handleAudit(status) {
+				if (!!status) await this.$refs.uForm.validate()
+				let permissionType = this.tabOptions.find(item => item.key == this.taskDefinitionKey)?.permissionType
+				if (!!status && permissionType === 'update') {
+					let date = await this.getTableValue();
+					let arr = []
+					if (this.taskDefinitionKey == 'productionSupervisorApprove1') {
+						arr = date.productList.map(item => {
+							return {
+								...item,
+								technicalAnswerId: this.form.technicalAnswerId,
+								technicalAnswerName: this.form.technicalAnswerName
+							}
+						})
+					}
+					if (this.taskDefinitionKey == 'productionSupervisorApprove2') {
+						arr = date.productList.map(item => {
+							return {
+								...item
+							}
+						})
+					}
+					await businessOpportunityUpdateAPI(arr)
+				}
+				this.loading = true
+				await this._approveTaskWithVariables(status);
+			},
+			async _approveTaskWithVariables(status) {
+				let variables = {
+					pass: !!status,
+				};
+				if (!!status) {
+					variables.technicianId = this.form.technicalAnswerId
+				}
+				let res = await approveTaskWithVariables({
+					id: this.taskId,
+					reason: this.form.reason,
+					variables
+				})
+
+				if (res.code != '-1') {
+					this.$emit('handleAudit', {
+						status,
+						title: status === 0 ? '驳回' : ''
+					});
+				}
+				this.loading = false
+			},
+
+			getTableValue() {
+				return new Promise((resolve, reject) => {
+					this.$emit('getTableValue', async (data) => {
+						resolve(await data);
+					});
+				});
+			}
+		}
+	}
+</script>
+
+<style>
+</style>

+ 11 - 30
pages/home/wt/todo/todo.vue

@@ -1,10 +1,8 @@
 <template>
 	<view class="blacklog-container">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="我的待办" @clickLeft="back"
-			background-color="#157A2C" color="#fff"></uni-nav-bar>
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="我的待办" @clickLeft="back" background-color="#157A2C" color="#fff"></uni-nav-bar>
 
 		<view class="list-container">
-
 			<u-list @scrolltolower="scrolltolower">
 				<u-list-item v-for="(item, index) in list" :key="index">
 					<view class="kd-card">
@@ -20,20 +18,14 @@
 								</view>
 							</view>
 							<view class="card-footer">
-								<u-button v-if="['0','2'].includes(item.extensionProperty.taskHandlePlatform)"
-									type='success' @click="handleDetail(item,'handle')">处理</u-button>
-								<u-button v-else type='error'>请在PC端处理</u-button>
-								<u-button type='info' @click="handleDetail(item,'detail')">流程详情</u-button>
-
+								<u-button v-if="['0', '2'].includes(item.extensionProperty.taskHandlePlatform)" type="success" @click="handleDetail(item, 'handle')">处理</u-button>
+								<u-button v-else type="error">请在PC端处理</u-button>
+								<u-button type="info" @click="handleDetail(item, 'detail')">流程详情</u-button>
 							</view>
 						</view>
 					</view>
-
 				</u-list-item>
 			</u-list>
-
-
-
 		</view>
 		<view v-show="list.length === 0" class="no_data">
 			<u-empty mode="data" textSize="30"></u-empty>
@@ -42,22 +34,21 @@
 </template>
 
 <script>
-	import {
-		getTodoTaskPage
-	} from '@/api/wt/index.js'
+	import { getTodoTaskPage } from '@/api/wt/index.js'
 	let [page, size, isEnd] = [1, 10, true]
 
 	export default {
 		computed: {
 			colOptions() {
-				return [{
+				return [
+					{
 						label: '任务名称',
 						key: 'name'
 					},
 					{
 						label: '流程发起人',
 						key: `startUserNickname`
-					},
+					}
 				]
 			}
 		},
@@ -85,19 +76,16 @@
 			//miniHandleRouter
 			handleDetail(item, type) {
 				if (type == 'handle') {
-					let queryParams =
-						`id=${item.processInstance.id}&businessId=${item.businessId}&taskId=${item.id}&taskDefinitionKey=${item.taskDefinitionKey}&miniHandleRouter=${item.miniHandleRouter}&miniViewRouter=${item.miniViewRouter}`
+					let queryParams = `id=${item.processInstance.id}&businessId=${item.businessId}&taskId=${item.id}&taskDefinitionKey=${item.taskDefinitionKey}&miniHandleRouter=${item.miniHandleRouter}&miniViewRouter=${item.miniViewRouter}`
 					uni.navigateTo({
 						url: `/pages/home/wt/components/processTask?${queryParams}`
 					})
-					// 
-
+					//
 				} else {
 					uni.navigateTo({
 						url: `/pages/home/wt/components/detail?processInstanceId=${item.processInstance.id}`
 					})
 				}
-
 			},
 			async getList() {
 				let paging = {
@@ -179,10 +167,8 @@
 			display: flex;
 			justify-content: space-between;
 			padding: 30rpx 30rpx;
-
 		}
 
-
 		.card-footer {
 			padding: 10rpx 30rpx 18rpx 30rpx;
 			font-size: 0.8rem;
@@ -196,8 +182,6 @@
 			padding: 0 28rpx;
 			position: relative;
 			min-height: 150rpx;
-
-
 		}
 
 		.card-body:after {
@@ -212,15 +196,12 @@
 			background-color: #f1f1f1;
 		}
 
-
-
 		.card-col {
 			padding: 8rpx 0;
 			display: flex;
 
 			// line-height: ;
 
-
 			.content {
 				flex: 1;
 				overflow: hidden;
@@ -234,4 +215,4 @@
 			}
 		}
 	}
-</style>
+</style>