From 0b9a9b4aa3051565b213b9efcb5e02ecbda0e791 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期一, 04 九月 2023 15:22:35 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.73.113:9001/r/lims-before

---
 src/views/inspectionManagement/reportForInspection/index.vue |  179 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 99 insertions(+), 80 deletions(-)

diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index 5984f31..7931628 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -8,7 +8,7 @@
 						</el-input>
 					</el-form-item>
 					<el-form-item label="鏉愭枡鍚嶇О:" class="sermargin">
-						<el-input v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏�">
+						<el-input v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏ユ潗鏂欏悕绉�">
 						</el-input>
 					</el-form-item>
 					<el-form-item label="鐘舵��:" class="sermargin">
@@ -18,8 +18,8 @@
 						</el-select>
 					</el-form-item>
 					<el-form-item label="鏉ユ枡鏃ユ湡:" style="margin-right: 20px;">
-						<el-input v-model="searchData.date" class="input-form" placeholder="璇疯緭鍏�">
-						</el-input>
+						<el-date-picker value-format="yyyy-MM-dd" v-model="searchData.date" class="input-form" placeholder="璇烽�夋嫨鏉ユ枡鏃ユ湡">
+						</el-date-picker>
 					</el-form-item>
 					<el-form-item>
 						<el-button type="primary" @click="search">鏌ヨ</el-button>
@@ -54,7 +54,7 @@
 						<el-input type="text" v-model="insertData.unit" />
 					</el-form-item>
 					<el-form-item label="鏁伴噺:" prop="num">
-						<el-input type="number" v-model="insertData.num"/>
+						<el-input type="number" min="0" v-model="insertData.num"/>
 					</el-form-item>
 				</el-form>
 				<span slot="footer" class="dialog-footer">
@@ -70,8 +70,8 @@
 					</div>
 				</div>
 				<div class="table-box">
-					<el-table ref="inspectionTable" :max-height="600" :cell-style="{textAlign: 'center'}"
-						:header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
+					<el-table ref="inspectionTable" :max-height="450" :cell-style="{textAlign: 'left'}"
+						:header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}"
 						:data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange">
 						<el-table-column type="selection" :selectable="checkSelect" min-width="5%"></el-table-column>
 						<el-table-column type="index" label="搴忓彿" min-width="8%" />
@@ -276,6 +276,13 @@
 		mounted() {
 			this.getMaterielName();
 		},
+		watch:{
+			addReportDialog(newVal){
+				if(newVal === false){
+					this.resetForm("addInspectionForm");
+				}
+			}
+		},
 		methods: {
 			handleChange() {
 
@@ -312,11 +319,14 @@
 				}
 			},
 			handleSelectionChange(val) {
-        if (val.length > 1) {
+				if (val.length > 1) {
+					let data = val.pop();
 					this.$refs.inspectionTable.clearSelection();
-					this.$refs.inspectionTable.toggleRowSelection(val.pop())
+					this.$refs.inspectionTable.toggleRowSelection(data);
+					this.checkData = new Array(data);
+				}else{
+					this.checkData = val;
 				}
-				this.checkData = val;
 			},
 			//鐢熸垚鎶ユ鍗曟寜閽�
 			addReportBtn() {
@@ -326,86 +336,95 @@
 					if (this.checkData.length > 1) {
 						this.$message.error("鏈�澶氶�夋嫨涓�鏉℃暟鎹�!");
 					} else {
-            let mcode = this.checkData[0].materialCoding;
-            let name = this.checkData[0].materialName;
-            let specifications = this.checkData[0].specificationsModels;
-            this.getChooseVersionFun(mcode,name,specifications);
+            			let mcode = this.checkData[0].materialCoding;
+            			let name = this.checkData[0].materialName;
+            			let speId = this.checkData[0].specificationsId;
+            			this.getChooseVersionFun(mcode,name,speId);
 						this.addReportDialog = true;
 					}
 				}
 			},
-      changeVersionFun(){
-        let mCode = this.checkData[0].materialCoding;
-        let name = this.checkData[0].materialName;
-        let specifications = this.checkData[0].specificationsModels;
-        let version = this.addInspectionForm.version;
-        this.getProByVersion(mCode,name,specifications,version);
-      },
-      //鑾峰彇鐗堟湰涓嬬殑鏍囧噯搴撴暟鎹�
-      async getProByVersion(mCode,name,specifications,version){
-          var vm = this;
-          await lookProByVer({
-              mcode : mCode,
-              name : name,
-              specifications : specifications,
-              version: version
-          }).then((res)=>{
-            vm.standardLibraryData = res.data;
-          })
-          
-      },
-      //鑾峰彇鐗堟湰鍒楄〃
-      async getChooseVersionFun(mCode,name,specifications){
-        var vm = this;
-        this.chooseVersion = [];
-        await getChooseVersion({
-          mcode : mCode,
-          name : name,
-          specifications : specifications
-        }).then((res)=>{
-              vm.getProByVersion(mCode,name,specifications,res.data[0])
-              for(let i=0;i<res.data.length;i++){
-                vm.chooseVersion.push({
-                  value: res.data[i],
-                  label: "V"+res.data[i]
-                });
-              }
-              vm.addInspectionForm.version = res.data[0];
-        });
-      },
+			changeVersionFun(){
+				let mCode = this.checkData[0].materialCoding;
+				let name = this.checkData[0].materialName;
+				let specifications = this.checkData[0].specificationsModels;
+				let version = this.addInspectionForm.version;
+				this.getProByVersion(mCode,name,specifications,version);
+			},
+			//鑾峰彇鐗堟湰涓嬬殑鏍囧噯搴撴暟鎹�
+			async getProByVersion(mCode,name,specifications,version){
+				var vm = this;
+				await lookProByVer({
+					mcode : mCode,
+					name : name,
+					specifications : specifications,
+					version: version
+				}).then((res)=>{
+					var arr = res.data;
+					for(var i=0;i<arr.length;i++){
+						arr[i].id = "0" + i;
+					}
+					vm.standardLibraryData = arr;
+				})
+				
+			},
+			//鑾峰彇鐗堟湰鍒楄〃
+			async getChooseVersionFun(mCode,name,specifications){
+				var vm = this;
+				this.chooseVersion = [];
+				await getChooseVersion({
+				mcode : mCode,
+				name : name,
+				specifications : specifications
+				}).then((res)=>{
+					vm.getProByVersion(mCode,name,specifications,res.data[0])
+					for(let i=0;i<res.data.length;i++){
+						vm.chooseVersion.push({
+						value: res.data[i],
+						label: "V"+res.data[i]
+						});
+					}
+					vm.addInspectionForm.version = res.data[0];
+				});
+			},
 			//鐢熸垚鎶ユ鍗曠‘璁ゆ寜閽�
 			confirmBtn(formName) {
-        this.$refs[formName].validate((valid=>{
-          if(valid){
-            let dateArr = this.addInspectionForm.inspectionDate;
-            //娣诲姞鎶ユ鍗�
-            let val = this.checkData[0];
-            let obj = {
-              "endTime": dateArr[1],
-              "experiment": "",
-              "formTime": val.createTime,
-              "id": val.id,
-              "mcode": val.materialCoding,
-              "name": val.materialName,
-              "num": val.quantity,
-              "specifications": val.specificationsModels,
-              "startTime": dateArr[0],
-              "supplier": val.supplierName,
-              "type": val.type,
-              "unit": val.unit,
-              "version": this.addInspectionForm.version
-            }
-            this.createReport(obj);
-            this.addReportDialog = false;
-          }
-        }));
+				this.$refs[formName].validate((valid=>{
+				if(valid){
+					let dateArr = this.addInspectionForm.inspectionDate;
+					//娣诲姞鎶ユ鍗�
+					let val = this.checkData[0];
+					let obj = {
+					"endTime": dateArr[1],
+					"experiment": "",
+					"formTime": val.createTime,
+					"id": val.id,
+					"mcode": val.materialCoding,
+					"name": val.materialName,
+					"num": val.quantity,
+					"specifications": val.specificationsModels,
+					"specificationsId": val.specificationsId,
+					"startTime": dateArr[0],
+					"supplier": val.supplierName,
+					"type": val.type,
+					"unit": val.unit,
+					"version": this.addInspectionForm.version
+					}
+					// this.createReport(obj);
+					console.log("obj---",obj);
+					this.addReportDialog = false;
+				}
+				}));
 			},
 			//鐢熸垚鎶ユ鍗�
 			async createReport(param) {
-				let res = await addInspect(param);
-				if(res.data==null)return
-				this.$message.success('鎶ユ鎴愬姛')
-				this.$router.push(`/experiment/Viewdetails/${res.data}`)
+				await addInspect(param).then(res =>{
+					this.search();
+					this.$message.success('鎶ユ鎴愬姛')
+					this.$router.push(`/experiment/Viewdetails/${res.data}`)
+				}).catch(error =>{
+					this.$message.error('鎶ユ澶辫触')
+				});
 			},
 			// 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁
 			async getRawMaterialList() {

--
Gitblit v1.9.3