From 3be151e2ea07a509dfdde5e9e6b870d60d3767db Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期四, 31 八月 2023 17:12:15 +0800
Subject: [PATCH] bug修复

---
 src/views/inspectionManagement/reportForInspection/index.vue |  123 +++++++++++++++-------------------------
 1 files changed, 47 insertions(+), 76 deletions(-)

diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index 6dbbd6f..cf50f4f 100644
--- a/src/views/inspectionManagement/reportForInspection/index.vue
+++ b/src/views/inspectionManagement/reportForInspection/index.vue
@@ -64,12 +64,6 @@
 			</el-dialog>
 			<div class="library-table">
 				<div class="table-header">
-					<div class="search-bar">
-						<el-radio-group v-model="radioValue" @change="radioclick">
-							<el-radio-button v-for="option in radioOptions" :key="option.value"
-								:label="option.value">{{ option.label }}</el-radio-button>
-						</el-radio-group>
-					</div>
 					<div class="generateInsp">
 						<el-button @click="addReportBtn" type="primary" size="mini" icon="el-icon-document"
 							style="background-color: rgb(1, 102, 226);">鐢熸垚鎶ユ鍗�</el-button>
@@ -79,10 +73,9 @@
 					<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-column type="selection" :selectable="checkSelect" min-width="5%">
-						</el-table-column>
+						<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="createTime" label="鏉ユ枡鏃ユ湡" min-width="8%" />
+						<el-table-column prop="dateSurvey" label="鏉ユ枡鏃ユ湡" min-width="8%" />
 						<el-table-column prop="supplierName" label="渚涘簲鍟嗗悕绉�" min-width="12%" />
 						<el-table-column prop="materialCoding" label="鏉愭枡缂栫爜" min-width="8%" />
 						<el-table-column prop="materialName" label="鏉愭枡鍚嶇О" min-width="8%" />
@@ -91,7 +84,7 @@
 						<el-table-column prop="quantity" label="鏁伴噺" min-width="5%" />
 						<el-table-column prop="inspectionDate" label="鎶ユ鏃ユ湡" min-width="8%" />
 						<el-table-column prop="surveyor" label="妫�楠屼汉" min-width="8%" />
-						<el-table-column prop="dateSurvey" label="妫�楠屾棩鏈�" min-width="8%" />
+						<el-table-column prop="insTime" label="妫�楠屾棩鏈�" min-width="8%" />
 						<el-table-column prop="type" label="鐘舵��" min-width="8%">
 							<template slot-scope="scope">
 								<span :style="{ color: scope.row.type === 1 ? 'green' : 'red' }">
@@ -116,7 +109,7 @@
 			</div>
 		</div>
 		<el-dialog title="閫夋嫨鏃ユ湡" :visible.sync="addReportDialog" width="60%">
-			<el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="addInspectionForm">
+			<el-form :model="addInspectionForm" :rules="addInspectionFormRules" ref="addInspectionForm">
 				<el-form-item label="妫�楠屾棩鏈�" label-width="100px" prop="inspectionDate">
 					<el-date-picker v-model="addInspectionForm.inspectionDate" type="daterange" value-format="yyyy-MM-dd"
 						range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡">
@@ -347,19 +340,7 @@
 					label: '鏈姤妫�'
 				}],
 				radioValue: null,
-				inspectionTable: [{
-					createTime: '2023-07-28',
-					supplier_name: '鍥界綉灞变笢鐪佺數鍔涙湁闄愬叕鍙�',
-					materialCoding: 'BP214274',
-					materialName: '閾濆寘閽㈢粸绾�',
-					specificationsModels: 'JLHA/G1A-185/30-26/7',
-					unit: '鍚�',
-					quantity: 21,
-					dateSurvey: '2023-08-02',
-					surveyor: '榛勫皬鏄�',
-					inspectionDate: '2023-12-09',
-					condition: 1
-				}],
+				inspectionTable: [],
 				currentPage: 1,
 				pageSize: 10,
 				total: 20,
@@ -437,7 +418,6 @@
 				});
 			},
 			blurOptions(row) {
-				console.log("鏇存柊", row);
 			},
 			async initNewSelection() {
 				const res = await selectUser();
@@ -446,8 +426,8 @@
 				this.deviceoptions = res2.data;
 			},
 			resetForm(formName) {
-				// this.addInspectionForm.inspectionDate = [],
-				// this.$refs[formName].resetFields();
+				this.addInspectionForm.inspectionDate = [],
+				this.$refs[formName].resetFields();
 				this.addReportDialog = false
 			},
 			removeFun(row, index) {
@@ -456,11 +436,10 @@
 					cancelButtonText: '鍙栨秷',
 					type: 'warning'
 				}).then(() => {
-					console.log(row.id);
 					this.deleteMaterialFun(row, index);
 				}).catch(() => {});
 			},
-			checkSelect(row, index) {
+			checkSelect(row) {
 				if (row.type === 1) {
 					return false;
 				} else {
@@ -468,8 +447,11 @@
 				}
 			},
 			handleSelectionChange(val) {
+        if (val.length > 1) {
+					this.$refs.inspectionTable.clearSelection();
+					this.$refs.inspectionTable.toggleRowSelection(val.pop())
+				}
 				this.checkData = val;
-        console.log(val);
 			},
 			//鐢熸垚鎶ユ鍗曟寜閽�
 			addReportBtn() {
@@ -483,7 +465,6 @@
             let name = this.checkData[0].materialName;
             let specifications = this.checkData[0].specificationsModels;
             this.getChooseVersionFun(mcode,name,specifications);
-            console.log(this.standardLibraryData);
 						this.addReportDialog = true;
 					}
 				}
@@ -504,7 +485,6 @@
               specifications : specifications,
               version: version
           }).then((res)=>{
-            console.log(res);
             vm.standardLibraryData = res.data;
           })
           
@@ -530,38 +510,39 @@
       },
 			//鐢熸垚鎶ユ鍗曠‘璁ゆ寜閽�
 			confirmBtn(formName) {
-				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.initNewSelection();
-				this.showNewPage = true;
+        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.initNewSelection();
+            this.showNewPage = true;
+          }
+        }));
 			},
 			//鐢熸垚鎶ユ鍗�
 			async createReport(param) {
 				let res = await addInspect(param);
-				const res2 = await selectInspectsListById({
-					id: res.data
-				});
-				this.resultData = res2.data;
-				this.inspectionForm = res2.data;
-				this.inspectionItems = res2.data.insProducts;
+				if(res.data==null)return
+				this.$message.success('鎶ユ鎴愬姛')
+				this.$router.push(`/experiment/Viewdetails/${res.data}`)
 			},
 			// 鑾峰彇鍒嗛〉鍒楄〃鏁版嵁
 			async getRawMaterialList() {
@@ -595,21 +576,6 @@
 					date: ''
 				}
 				this.getRawMaterialList()
-			},
-			radioclick() {
-				console.log(this.inspectionTable);
-				if (this.radioValue === 0) {
-
-				}
-			},
-			getAllTableData() {
-				this.getRawMaterialList()
-			},
-			getCheckData() {
-
-			},
-			getUnCheckData() {
-
 			},
 			// 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
 			handleSizeChange(val) {
@@ -707,10 +673,15 @@
 			flex-direction: column;
 
 			.table-header {
+        width: 100%;
+        height: 70px;
 				padding: 20px;
 				display: flex;
 				justify-content: space-between;
-
+        .generateInsp{
+          position: relative;
+          left: 92%;
+        }
 				.el-form-item {
 					margin-bottom: 30px !important;
 				}

--
Gitblit v1.9.3