From b723865e2b3ad6032d10deda501644ebabef8368 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 31 八月 2023 15:43:58 +0800
Subject: [PATCH] 	modified:   src/api/inspection/commisioninspection.js 	modified:   src/api/inspection/rawmaterial.js 	modified:   src/views/inspectionManagement/commissionInspection/index.vue 	modified:   src/views/inspectionManagement/reportForInspection/index.vue

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

diff --git a/src/views/inspectionManagement/reportForInspection/index.vue b/src/views/inspectionManagement/reportForInspection/index.vue
index 6dbbd6f..2081aa0 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,8 +73,7 @@
 					<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="supplierName" label="渚涘簲鍟嗗悕绉�" min-width="12%" />
@@ -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="缁撴潫鏃ユ湡">
@@ -446,8 +439,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) {
@@ -460,7 +453,7 @@
 					this.deleteMaterialFun(row, index);
 				}).catch(() => {});
 			},
-			checkSelect(row, index) {
+			checkSelect(row) {
 				if (row.type === 1) {
 					return false;
 				} else {
@@ -468,8 +461,11 @@
 				}
 			},
 			handleSelectionChange(val) {
+        if (val.length > 1) {
+					this.$refs.inspectionTable.clearSelection();
+					this.$refs.inspectionTable.toggleRowSelection(val.pop())
+				}
 				this.checkData = val;
-        console.log(val);
 			},
 			//鐢熸垚鎶ユ鍗曟寜閽�
 			addReportBtn() {
@@ -530,28 +526,32 @@
       },
 			//鐢熸垚鎶ユ鍗曠‘璁ゆ寜閽�
 			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) {
@@ -595,21 +595,6 @@
 					date: ''
 				}
 				this.getRawMaterialList()
-			},
-			radioclick() {
-				console.log(this.inspectionTable);
-				if (this.radioValue === 0) {
-
-				}
-			},
-			getAllTableData() {
-				this.getRawMaterialList()
-			},
-			getCheckData() {
-
-			},
-			getUnCheckData() {
-
 			},
 			// 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
 			handleSizeChange(val) {
@@ -707,10 +692,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