From d762fc609a101b1a82576a54f835834f4e9cd9b9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 07 九月 2023 10:54:39 +0800
Subject: [PATCH] 	modified:   src/layout/components/Sidebar/SidebarItem.vue 	modified:   src/router/index.js 	modified:   src/views/CNAS/nonConformanceManage/index.vue 	modified:   src/views/CNAS/reviewAnnualPlan/index.vue 	modified:   src/views/CNAS/satisfactionSurveys/index.vue 	modified:   src/views/basicData/index.vue 	modified:   src/views/experiment/inspectionApplication/index.vue 	modified:   src/views/inspectionManagement/commissionInspection/index.vue 	modified:   src/views/inspectionManagement/reportForInspection/index.vue 	modified:   src/views/laboratory/organizational/index.vue 	modified:   src/views/login/index.vue

---
 src/views/inspectionManagement/reportForInspection/index.vue |  214 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 122 insertions(+), 92 deletions(-)

diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index f89e215..e3dd70b 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -4,27 +4,27 @@
 			<div class="top-bar">
 				<el-form ref="form" :inline="true" :model="searchData">
 					<el-form-item label="鏉愭枡缂栫爜:" position="left" class="sermargin">
-						<el-input v-model="searchData.code" class="input-form" placeholder="璇疯緭鍏�">
+						<el-input size="small" v-model="searchData.code" class="input-form" placeholder="璇疯緭鍏�">
 						</el-input>
 					</el-form-item>
 					<el-form-item label="鏉愭枡鍚嶇О:" class="sermargin">
-						<el-input v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏�">
+						<el-input size="small" v-model="searchData.name" class="input-form" placeholder="璇疯緭鍏ユ潗鏂欏悕绉�">
 						</el-input>
 					</el-form-item>
 					<el-form-item label="鐘舵��:" class="sermargin">
-						<el-select v-model="searchData.state" placeholder="鍏ㄩ儴">
+						<el-select size="small" v-model="searchData.state" placeholder="鍏ㄩ儴">
 							<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
 							</el-option>
 						</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 size="small" 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>
-						<el-button type="primary" plain @click="reset">閲嶇疆</el-button>
-						<el-button type="primary" icon="el-icon-plus" @click="addReportVisible = true">鏂板</el-button>
+						<el-button size="small" type="primary" @click="search">鏌ヨ</el-button>
+						<el-button size="small" type="primary" plain @click="reset">閲嶇疆</el-button>
+						<el-button size="small" type="primary" icon="el-icon-plus" @click="addReportVisible = true">鏂板</el-button>
 					</el-form-item>
 				</el-form>
 			</div>
@@ -48,13 +48,13 @@
 					</el-form-item>
 					<el-form-item label="瑙勬牸鍨嬪彿:" prop="specificationsNumber">
 						<el-cascader v-model="insertData.specificationsNumber" :options="childrenOptions"
-							:props="{label: 'Name', value: 'Name'}" separator="-"></el-cascader>
+							:props="{label: 'Name', value: 'Id'}" separator="-"></el-cascader>
 					</el-form-item>
 					<el-form-item label="鍗曚綅:" prop="unit">
 						<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,9 +70,11 @@
 					</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'}"
-						:data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange">
+					<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"
+						:default-sort = "{prop: 'createTime', order: 'descending'}"
+						>
 						<el-table-column type="selection" :selectable="checkSelect" min-width="5%"></el-table-column>
 						<el-table-column type="index" label="搴忓彿" min-width="8%" />
 						<el-table-column prop="dateSurvey" label="鏉ユ枡鏃ユ湡" min-width="8%" />
@@ -83,6 +85,7 @@
 						<el-table-column prop="unit" label="鍗曚綅" min-width="5%" />
 						<el-table-column prop="quantity" label="鏁伴噺" min-width="5%" />
 						<el-table-column prop="inspectionDate" label="鎶ユ鏃ユ湡" min-width="8%" />
+						<el-table-column v-if="1===0" prop="createTime" label="鏃ユ湡" min-width="8%" />
 						<el-table-column prop="surveyor" label="妫�楠屼汉" min-width="8%" />
 						<el-table-column prop="type" label="鐘舵��" min-width="8%">
 							<template slot-scope="scope">
@@ -143,9 +146,6 @@
 	import {
 		getRawMaterialList,
 		addInspect,
-		selectInspectsListById,
-		selectUser,
-		selectEquipment,
 		deleteMaterial,
 		addMaterial,
 		getMaterielName,
@@ -275,6 +275,13 @@
 		mounted() {
 			this.getMaterielName();
 		},
+		watch:{
+			addReportDialog(newVal){
+				if(newVal === false){
+					this.resetForm("addInspectionForm");
+				}
+			}
+		},
 		methods: {
 			handleChange() {
 
@@ -311,11 +318,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() {
@@ -325,86 +335,94 @@
 					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,
+					"specificationId": val.specificationsId,
+					"startTime": dateArr[0],
+					"supplier": val.supplierName,
+					"type": val.type,
+					"unit": val.unit,
+					"version": this.addInspectionForm.version
+					}
+					this.createReport(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(error.message)
+				});
 			},
 			// 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁
 			async getRawMaterialList() {
@@ -458,13 +476,25 @@
 			insert() {
 				this.$refs['addMaterialForm'].validate((valid) => {
 					if (valid) {
+						console.log(this.childrenOptions);
+						console.log(this.insertData);
+						let f=this.childrenOptions.filter(item=>{
+							return item.Id===this.insertData.specificationsNumber[0]
+						})[0]
+						console.log(f);
+						let fatherName=f.Name;
+						let c=f.children.filter(item=>{
+							return item.Id===this.insertData.specificationsNumber[1]
+						})[0]
+						let sonName=c.Name
+						let specificationsId=c.Id;
 						var str = {
 							"dateSurvey": this.insertData.fromDate,
 							"materialCoding": this.insertData.mCode,
 							"materialName": this.insertData.mName,
 							"quantity": this.insertData.num,
-							"specificationsModels": this.insertData.specificationsNumber[0] + '-' + this.insertData
-								.specificationsNumber[1],
+							"specificationsModels": fatherName+ '-' + sonName,
+							"specificationsId": specificationsId,	
 							"supplierName": this.insertData.supplierName,
 							"type": 0,
 							"unit": this.insertData.unit

--
Gitblit v1.9.3