From 3ef19c59f59bb1b5a43434b8d14ec12e06d505b0 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 19 三月 2024 13:07:19 +0800
Subject: [PATCH] 检验下单-下发功能更新

---
 src/components/view/b1-inspection-order.vue |  217 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 122 insertions(+), 95 deletions(-)

diff --git a/src/components/view/b1-inspection-order.vue b/src/components/view/b1-inspection-order.vue
index b180ebf..563273b 100644
--- a/src/components/view/b1-inspection-order.vue
+++ b/src/components/view/b1-inspection-order.vue
@@ -12,19 +12,19 @@
 	}
 
 	.search_thing {
-		width: 350px;
 		display: flex;
 		align-items: center;
+		height: 50px;
 	}
 
 	.search_label {
-		width: 110px;
+		width: 120px;
 		font-size: 14px;
 		text-align: right;
 	}
 
 	.search_input {
-		width: calc(100% - 110px);
+		width: calc(100% - 120px);
 	}
 
 	.table {
@@ -75,7 +75,7 @@
 				<el-row class="title">
 					<el-col :span="12" style="padding-left: 20px;">妫�楠屼笅鍗�</el-col>
 					<el-col :span="12" style="text-align: right;">
-						<el-button size="medium" type="primary" @click="playOrder(1)">涓嬪崟</el-button>
+						<el-button size="medium" type="primary" @click="playOrder(1)" v-if="addPower">涓嬪崟</el-button>
 					</el-col>
 				</el-row>
 			</div>
@@ -83,12 +83,12 @@
 				<div class="search_thing">
 					<div class="search_label">濮旀墭缂栧彿锛�</div>
 					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="componentData.entity.deviceName" @keyup.enter.native="refreshTable()"></el-input></div>
+							v-model="componentData.entity.entrustCode" @keyup.enter.native="refreshTable()"></el-input></div>
 				</div>
 				<div class="search_thing">
 					<div class="search_label">鏍峰搧鍚嶇О锛�</div>
 					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="componentData.entity.specificationModel" @keyup.enter.native="refreshTable()"></el-input></div>
+							v-model="componentData.entity.sample" @keyup.enter.native="refreshTable()"></el-input></div>
 				</div>
 				<div class="search_thing" style="padding-left: 30px;">
 					<el-button size="small" @click="refresh()">閲� 缃�</el-button>
@@ -99,11 +99,8 @@
 				<ul class="tab">
 					<li v-for="(m,i) in tabList" :key="i" :class="{active:i==tabIndex}" @click="handleTab(m,i)">{{m.label}}</li>
 				</ul>
-				<!-- 璇硶 瀛愮粍浠堕�氳繃 this.$emit +浼犲叆鏂规硶鍚� 璋冪敤鐖剁粍浠舵柟娉� 渚嬪  this.$emit锛坰electAllByOne锛� 灏遍渶鍦ㄧ埗缁勪欢澹版槑骞朵紶鍏�  @selectAllByOne="selectAllByOne"-->
 				<ValueTable ref="ValueTable" :url="$api.insOrder.selectInsOrderParameter" :componentData="componentData"
-					:key="upIndex" style="height: calc(100% - 44px)" @selectAllByOne="selectAllByOne"
-					@handleDataLook="handleDataLook" @download="download" @handleVerify="handleVerify" @handlEquash="handlEquash"
-					@handleIssued="handleIssued" />
+					:key="upIndex" style="height: calc(100% - 44px)" />
 			</div>
 			<!-- 瀹℃牳 -->
 			<el-dialog title="涓嬪崟瀹℃牳" :visible.sync="verifyDialogVisible" width="30%" :before-close="handleClose">
@@ -146,22 +143,28 @@
 				</span>
 			</el-dialog>
 			<!-- 涓嬪彂 -->
-			<el-dialog title="妫�楠屼笅鍙�" :visible.sync="issuedDialogVisible" width="30%" :before-close="handleClose">
-				<el-form :label-position="labelPosition" :model="formData2" label-width="150px" ref="ruleForm">
-					<el-form-item label="绾﹀畾鏃堕棿锛�">
-						<el-date-picker style="width:100%" format="yyyy-MM-dd" value-format="yyyy-MM-dd" v-model="formData2.appointed2"
-							type="date" size="small" placeholder="閫夋嫨鏃堕棿">
-						</el-date-picker>
-					</el-form-item>
-					<el-form-item >
-					</el-form-item>
-					<el-form-item label="鎸囨淳浜哄憳锛�">
-						<el-select v-model="formData2.id" placeholder="璇烽�夋嫨" size="small" style="width:100%">
-							<el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
-							</el-option>
-						</el-select>
-					</el-form-item>
-				</el-form>
+			<el-dialog title="妫�楠屼笅鍙�" :visible.sync="issuedDialogVisible" width="400px" :before-close="handleClose">
+				<div class="body" style="max-height: 60vh;">
+					<el-row>
+						<el-col class="search_thing" :span="22">
+							<div class="search_label"><span class="required-span">* </span>绾﹀畾鏃堕棿锛�</div>
+							<div class="search_input">
+								<el-date-picker size="small" v-model="distributeData.appointed" type="date" placeholder="閫夋嫨鏃ユ湡"
+									value-format="yyyy-MM-dd" style="width: 100%;" format="yyyy-MM-dd">
+								</el-date-picker>
+							</div>
+						</el-col>
+						<el-col class="search_thing" :span="22">
+							<div class="search_label"><span class="required-span" v-show="distributeData.type==2">* </span>鎸囨淳浜哄憳锛�</div>
+							<div class="search_input">
+								<el-select v-model="distributeData.userId" placeholder="璇烽�夋嫨" size="small" style="width: 100%;">
+									<el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
+									</el-option>
+								</el-select>
+							</div>
+						</el-col>
+					</el-row>
+				</div>
 				<span slot="footer" class="dialog-footer">
 					<el-row>
 						<el-button @click="handleClose2">鍙� 娑�</el-button>
@@ -176,8 +179,8 @@
 				</div>
 			</el-dialog>
 		</div>
-		<div style="width: 100%;height: 100%;" v-if="active == 1">
-			<Add/>
+		<div style="width: 100%;height: 100%;" v-if="active >0">
+			<Add :active="active" :currentId="currentId" />
 		</div>
 	</div>
 </template>
@@ -199,21 +202,22 @@
 				verifyDialogVisible: false,
 				quashDialogVisible: false,
 				issuedDialogVisible: false,
-				issuedDialogVisible2: false,
 				dataDialogVisible: false,
 				formData: {},
-				formData0:{},
-				formData1:{},
-				formData2:{
-					id:'',
-					orderName:'',
-					data:'',
+				formData0: {},
+				formData1: {},
+				distributeData: {
+					orderId: '',
+					sampleId: '',
+					appointed: '',
+					userId: ''
 				},
 				// 浜哄憳鍒楄〃
 				personList: [],
-				labelPosition: 'right',
 				componentData: {
 					entity: {
+						entrustCode: null,
+						sample: null,
 						state: 1,
 						orderBy: {
 							field: 'id',
@@ -227,28 +231,44 @@
 						id: 'dataLook',
 						font: '鏁版嵁鏌ョ湅',
 						type: 'text',
-						method: 'handleDataLook'
+						method: 'handleDataLook',
+						disabFun: (row, index) => {
+							return row.state != 1
+						}
 					}, {
 						id: 'download',
 						font: '鎶ュ憡涓嬭浇',
 						type: 'text',
-						method: 'download'
+						method: 'download',
+						disabFun: (row, index) => {
+							return row.state != 1
+						}
 					}, {
 						id: 'verify',
 						font: '瀹℃牳',
 						type: 'text',
-						method: 'handleVerify'
+						method: 'handleVerify',
+						disabFun: (row, index) => {
+							return row.state != 0
+						}
 					}, {
 						id: 'quash',
 						font: '鎾ら攢',
 						type: 'text',
 						method: 'handlEquash'
 					}, {
-						id: 'issued',
 						font: '涓嬪彂',
 						type: 'text',
-						method: 'handleIssued'
+						method: 'handleIssued',
+						disabFun: (row, index) => {
+							return row.state != 1 || row.sendTime != null
+						}
 					}],
+					linkEvent:{
+					  entrustCode:{
+					    method:'selectAllByOne'
+					  }
+					},
 					tagField: {
 						type: {
 							select: [{
@@ -265,16 +285,13 @@
 								label: '绱ф��'
 							}]
 						},
-					},
-					linkEvent:{
-					  deviceName:{
-					    id: 'details',
-					    method:'selectAllByOne',
-					  }
+						createUser: {
+							select: []
+						}
 					},
 					selectField: {},
-					requiredAdd: ['largeCategory', 'subclass', 'deviceName', 'internalCode', 'specificationModel', 'manufacturer'],
-					requiredUp: ['largeCategory', 'subclass', 'deviceName', 'internalCode', 'specificationModel', 'manufacturer']
+					requiredAdd: [],
+					requiredUp: []
 				},
 				componentDataDataLook: {
 					entity: {
@@ -330,19 +347,21 @@
 					},
 				],
 				tabIndex: 0,
-				active: 0
+				active: 0,//1锛氫笅鍗曪紝2锛氭煡鐪嬶紝3锛氬鏍�
+        currentId:null
 			}
 		},
 		mounted() {
 			this.entityCopy = this.HaveJson(this.componentData.entity)
 			this.getPower()
+			this.getUserMenu()
 			this.getAuthorizedPerson()
 		},
 		methods: {
-			getAuthorizedPerson(){
-        	this.$axios.post(this.$api.deviceScope.selectDevicePrincipal).then(res => {
+			getAuthorizedPerson() {
+				this.$axios.get(this.$api.user.getUserMenu).then(res => {
 					let data = []
-					res.data.forEach(a=>{
+					res.data.forEach(a => {
 						data.push({
 							label: a.name,
 							value: a.id
@@ -350,7 +369,7 @@
 					})
 					this.personList = data
 				})
-      },
+			},
 			refreshTable() {
 				this.$refs['ValueTable'].selectList()
 			},
@@ -365,21 +384,15 @@
 				let del = false
 				let add = false
 				for (var i = 0; i < power.length; i++) {
-					if (power[i].menuMethod == 'upDeviceParameter') {
+					if (power[i].menuMethod == 'upInsOrder') {
 						up = true
 					}
-					if (power[i].menuMethod == 'delDeviceParameter') {
-						del = true
-					}
-					if (power[i].menuMethod == 'addDeviceParameter') {
+					if (power[i].menuMethod == 'addInsOrder') {
 						add = true
 					}
 				}
-				if (!del) {
-					this.componentData.do.splice(1, 1)
-				}
 				if (!up) {
-					this.componentData.do.splice(0, 1)
+					this.componentData.do.splice(4, 1)
 				}
 				this.addPower = add
 			},
@@ -399,11 +412,14 @@
 			},
 			// 璇︽儏
 			selectAllByOne(row) {
-				//鎵撳紑寮规
-				this.dialogVisible = true;
-				//row = 鐐瑰嚮瀵瑰簲琛屽��
-				//澶嶅埗缁檉ormData
-				this.formData = this.HaveJson(row);
+        this.active = 2;
+				// console.log(row);
+				// //鎵撳紑寮规
+				// this.dialogVisible = true;
+				// //row = 鐐瑰嚮瀵瑰簲琛屽��
+				// //澶嶅埗缁檉ormData
+				// this.formData = this.HaveJson(row);
+        this.currentId = row.id
 			},
 			// 鏁版嵁鏌ョ湅
 			handleDataLook(row) {
@@ -411,11 +427,12 @@
 			},
 			// 涓嬭浇鎶ュ憡
 			download(row) {
-
 			},
 			// 瀹℃牳
 			handleVerify(row) {
-				this.verifyDialogVisible = true;
+				// this.verifyDialogVisible = true;
+        this.active = 3;
+        this.currentId = row.id
 			},
 			// 鎾ら攢
 			handlEquash(row) {
@@ -424,13 +441,30 @@
 			// 涓嬪彂
 			handleIssued(row) {
 				this.issuedDialogVisible = true;
+				this.$axios.post(this.$api.insOrder.selectOrderManDay,{
+					id: row.sampleId
+				}).then(res=>{
+					this.distributeData.orderId = row.id
+					this.distributeData.sampleId = row.sampleId
+					this.distributeData.appointed = res.data
+          this.distributeData.type = row.type
+				})
 			},
-			submitForm2(){
+			submitForm2() {
+				if(this.distributeData.appointed==null||this.distributeData.appointed==''){
+					this.$message.error('绾﹀畾鏃堕棿鏈~鍐�')
+					return
+				}
+        if(this.distributeData.type==2&&(this.distributeData.userId==null||this.distributeData.userId=='')){
+					this.$message.error('鎸囨淳浜哄憳鏈~鍐�')
+					return
+				}
 				this.upLoad = true;
-				this.$axios.post(this.$api.insOrder.getDeviceManager, this.formData2, {
-					headers: {
-						'Content-Type': 'application/json'
-					}
+				this.$axios.post(this.$api.insOrder.upInsOrder, {
+					orderId: this.distributeData.orderId,
+					sampleId: this.distributeData.sampleId,
+					appointed: this.distributeData.appointed,
+					userId: this.distributeData.userId
 				}).then(res => {
 					if (res.code === 201) {
 						this.upLoad = false
@@ -438,11 +472,10 @@
 					}
 					this.$message.success('淇敼鎴愬姛')
 					this.upLoad = false
+					this.issuedDialogVisible = false
 					this.refreshTable()
-					this.dialogVisible = false
 				}).catch(e => {
 					this.$message.error('淇敼澶辫触')
-					this.dialogVisible = false
 					this.upLoad = false
 				})
 			},
@@ -454,24 +487,6 @@
 				delete this.formData.createUser
 				delete this.formData.updateUser
 				this.formData.authorizedPerson = authorizedPerson
-				this.$axios.post(this.$api.insOrder.getDeviceManager, this.formData, {
-					headers: {
-						'Content-Type': 'application/json'
-					}
-				}).then(res => {
-					if (res.code === 201) {
-						this.upLoad = false
-						return
-					}
-					this.$message.success('淇敼鎴愬姛')
-					this.upLoad = false
-					this.refreshTable()
-					this.dialogVisible = false
-				}).catch(e => {
-					this.$message.error('淇敼澶辫触')
-					this.dialogVisible = false
-					this.upLoad = false
-				})
 			},
 			// 涓嬪崟
 			playOrder(num) {
@@ -481,6 +496,18 @@
 				this.tabIndex = i;
 				this.componentData.entity.state = m.value
 				this.refreshTable()
+			},
+			getUserMenu() {
+				this.$axios.get(this.$api.user.getUserMenu).then(res => {
+					let data = []
+					res.data.forEach(a => {
+						data.push({
+							label: a.name,
+							value: a.id
+						})
+					})
+					this.componentData.tagField.createUser.select = data
+				})
 			}
 		}
 	}

--
Gitblit v1.9.3