From e09b848b65d7fda7264e9e536e37ad8e45f65e9c Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期三, 06 九月 2023 17:42:47 +0800
Subject: [PATCH] 	modified:   src/views/inspectionManagement/commissionInspection/index.vue 	modified:   src/views/standardLibrary/index.vue

---
 src/views/inspectionManagement/commissionInspection/index.vue |  143 ++++++++++++++++++++++++++++-------------------
 1 files changed, 84 insertions(+), 59 deletions(-)

diff --git a/src/views/inspectionManagement/commissionInspection/index.vue b/src/views/inspectionManagement/commissionInspection/index.vue
index b4bc55b..2bf4083 100644
--- a/src/views/inspectionManagement/commissionInspection/index.vue
+++ b/src/views/inspectionManagement/commissionInspection/index.vue
@@ -1,45 +1,45 @@
 <template>
 	<div>
-		<div v-if="!showDetail">
+		<div>
 			<div class="content-main">
 				<div class="top-bar">
 					<el-form ref="form" :inline="true" :model="searchData">
 						<el-form-item label="濮旀墭缂栧彿:" 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="濮旀墭鍗曚綅:" style="margin-right: 20px;">
-							<el-select v-model="searchData.department" placeholder="鍏ㄩ儴">
+							<el-select v-model="searchData.department" placeholder="鍏ㄩ儴" size="small">
 								<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>
-							<el-button type="primary" @click="search">鏌ヨ</el-button>
-							<el-button type="primary" plain @click="reset">閲嶇疆</el-button>
+							<el-button type="primary" size="small" @click="search">鏌ヨ</el-button>
+							<el-button type="primary" size="small" plain @click="reset">閲嶇疆</el-button>
 						</el-form-item>
 					</el-form>
 					<el-form>
-						<el-popover placement="left" width="350" trigger="click">
+						<el-popover placement="left" width="400" trigger="click">
 							<div class="vue_qr_div">
 								<el-row>
 									<el-col>
 										<el-input v-model="view" readonly size="medium" style="width: 250px;margin-right: 10px;"></el-input>
-										<el-button size="small" type="primary" v-if="viewId==null" @click="viewDia=true">鐢熸垚</el-button>
-										<el-button size="small" type="primary" v-else-if="viewId!=null" @click="copy">澶嶅埗</el-button>
+										<el-button size="small" type="primary" @click="viewDia=true">鐢熸垚</el-button>
+										<el-button size="small" type="primary" @click="copy">澶嶅埗</el-button>
 									</el-col>
 								</el-row>
 								<el-row style="margin-top: 10px;">
 									<el-col v-if="viewId==null">褰撳墠閾炬帴宸茶繃鏈燂紝璇风偣鍑荤敓鎴愭寜閽噸鏂扮敓鎴�</el-col>
 									<el-col
-										v-else-if="viewId!=null">褰撳墠閾炬帴灏嗗湪{{(parseInt(viewTime)/60/60)>1?(parseInt(viewTime)/60/60).toFixed(1)+'灏忔椂':Math.round(parseInt(viewTime)/60)+'鍒嗛挓'}}鍚庤繃鏈�</el-col>
+										v-else-if="viewId!=null">褰撳墠閾炬帴灏嗗湪{{(parseInt(viewTime2)/60/60)>1?(parseInt(viewTime2)/60/60).toFixed(1)+'灏忔椂':Math.round(parseInt(viewTime2)/60)+'鍒嗛挓'}}鍚庤繃鏈�</el-col>
 								</el-row>
 							</div>
-							<el-button slot="reference" class="rightBtn" type="primary" @click="goToaddCommision">鏂板濮旀墭</el-button>
+							<el-button size="small" slot="reference" class="rightBtn" type="primary" @click="goToaddCommision">鏂板濮旀墭</el-button>
 						</el-popover>
 					</el-form>
 				</div>
@@ -58,8 +58,8 @@
 						</div>
 					</div>
 					<div class="table-box">
-						<el-table ref="commisionTable" :max-height="800" :cell-style="{textAlign: 'center'}"
-							:header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
+						<el-table ref="commisionTable" :max-height="800" :cell-style="{textAlign: 'left'}"
+							:header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}"
 							:data="commisionTable" @selection-change="handleSelectionChange" style="width: 100%">
 							<el-table-column type="selection" :selectable="checkSelect" min-width="10%" />
 							<el-table-column type="index" label="搴忓彿" min-width="10%" />
@@ -67,14 +67,13 @@
 							<el-table-column prop="entrusted" label="濮旀墭鍗曚綅" min-width="12%" />
 							<el-table-column prop="samples_number" label="鏍峰搧鏁伴噺" min-width="8%" />
 							<el-table-column prop="sample_name" label="鏍峰搧鍚嶇О" min-width="8%" />
-							<el-table-column prop="specifications_models" label="瑙勬牸鍨嬪彿" min-width="12%" />
+							<el-table-column prop="speName" label="瑙勬牸鍨嬪彿" min-width="12%" />
 							<el-table-column prop="inspectionTime" label="閫佹牱鏃堕棿" min-width="8%" />
 							<el-table-column prop="completionDeadline" label="瀹屾垚鏈熼檺" min-width="8%" />
 							<el-table-column prop="contacts" label="濮旀墭缂栧埗浜�" min-width="8%" />
-							<el-table-column prop="insTime" label="妫�楠屾棩鏈�" min-width="8%" />
 							<el-table-column prop="inspection_status" label="鐘舵��" min-width="8%">
 								<template slot-scope="scope">
-									<div v-if="scope.row.inspection_status === 0">
+									<div v-if="scope.row.inspection_status === 2">
 										<span style="color: green;">宸叉姤妫�</span>
 									</div>
 									<div v-else>
@@ -98,9 +97,6 @@
 					</div>
 				</div>
 			</div>
-		</div>
-		<div v-else>
-			<router-view />
 		</div>
 		<el-dialog title="閾炬帴鏃堕暱璁剧疆" :visible.sync="viewDia" width="30%">
 			<div>
@@ -163,7 +159,8 @@
 		selectViewUUID,
 		delLink,
 		chooseVersion,
-		lookProByVer
+		lookProByVer,
+		addInspect
 	} from '@/api/inspection/commisioninspection'
 	export default {
 		data() {
@@ -193,7 +190,7 @@
 					value: '1',
 					label: '閮ㄩ棬1'
 				}],
-				radioValue: 0,
+				radioValue: null,
 				commisionTable: [{
 					specifications_models: "GGXH-AAAAA",
 					inspectionTime: "2023-08-03",
@@ -209,15 +206,15 @@
 				}],
 				conditionsOptions: [{
 						label: '鍏ㄩ儴',
-						value: 0
+						value: null
 					},
 					{
-						label: '宸叉楠�',
-						value: 1
-					},
-					{
-						label: '寰呮楠�',
+						label: '宸叉姤妫�',
 						value: 2
+					},
+					{
+						label: '鏈姤妫�',
+						value: 1
 					}
 				],
 				currentPage: 1,
@@ -228,7 +225,15 @@
 				view: null,
 				viewId: null,
 				viewTime: 1,
+				viewTime2: 1,
 				viewDia: false
+			}
+		},
+		watch:{
+			addReportDialog(newVal){
+				if(newVal === false){
+					this.resetForm("addInspectionForm");
+				}
 			}
 		},
 		created() {
@@ -254,39 +259,48 @@
 			},
 			handleSelectionChange(val) {
 				if (val.length > 1) {
+					let data = val.pop();
 					this.$refs.commisionTable.clearSelection();
-					this.$refs.commisionTable.toggleRowSelection(val.pop())
+					this.$refs.commisionTable.toggleRowSelection(data);
+					this.checkData = data;
+				}else{
+					this.checkData = val;
 				}
-				this.checkData = val;
-				console.log(this.checkData);
 			},
 			//鐢熸垚鎶ユ鍗曠‘璁ゆ寜閽�
 			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.initNewSelection();
-					// this.showNewPage = true;
+					let dateArr = this.addInspectionForm.inspectionDate;
+					//娣诲姞鎶ユ鍗�
+					let val = this.checkData[0];
+					let obj = {
+						"endTime": dateArr[1],
+						"mcode":"mcode",
+						"formTime": val.inspectionTime,
+						"id": val.id,
+						"name": val.sample_name,
+						"num": val.samples_number,
+						"specifications": val.speName,
+						"startTime": dateArr[0],
+						"supplier": val.entrusted,
+						"type": 2,
+						// "unit": "mm",
+						"version": this.addInspectionForm.version
 					}
+					this.createReport(obj);
+					this.addReportDialog = false;
+					}
+				});
+			},
+			//鐢熸垚鎶ユ鍗曡姹�
+			async createReport(param) {
+				await addInspect(param).then(res =>{
+					this.search();
+					this.$message.success('鎶ユ鎴愬姛')
+					this.$router.push(`/experiment/Viewdetails/${res.data}`)
+				}).catch(()=>{
+					this.$message.error('鎶ユ澶辫触')
 				});
 			},
 			//鐢熸垚鎶ユ鍗曟寜閽�
@@ -299,7 +313,7 @@
 					} else {
 						let mcode = this.checkData[0].entrust_coding;
 						let name = this.checkData[0].sample_name;
-						let specifications = this.checkData[0].specifications_models;
+						let specifications = this.checkData[0].speName;
 						let id = this.checkData[0].id;
 						this.getChooseVersionFun(mcode,name,specifications,id);
 						this.addReportDialog = true;
@@ -309,7 +323,7 @@
 			changeVersionFun(){
 				let mCode = this.checkData[0].entrust_coding;
 				let name = this.checkData[0].sample_name;
-				let specifications = this.checkData[0].specifications_models;
+				let specifications = this.checkData[0].speName;
 				let version = this.addInspectionForm.version;
 				let id = this.checkData[0].id;
 				this.getProByVersion(mCode,name,specifications,version,id);
@@ -324,7 +338,10 @@
 					specifications : specifications,
 					version: version
 				}).then((res)=>{
-					console.log(res);
+					var data = res.data;
+					for(var i=0;i<data.length;i++){
+						data[i].id = "0" + i;
+					}
 					vm.standardLibraryData = res.data;
 				})
 			},
@@ -333,7 +350,7 @@
 				var vm = this;
 				this.chooseVersion = [];
 				await chooseVersion({
-				mcode : mCode,
+				id : id,
 				name : name,
 				specifications : specifications
 				}).then((res)=>{
@@ -401,8 +418,6 @@
 			async radioclick() {
 				// 澶勭悊鐐瑰嚮radio鐨勬椂闂�
 				if (this.radioValue === 0) {
-					this.getCommisionList()
-				} else {
 					const res = await getCommisionList({
 						pageNo: this.currentPage,
 						pageSize: this.pageSize,
@@ -410,6 +425,16 @@
 					})
 					this.commisionTable = res.data.row
 					this.total = res.data.total
+				} else if(this.radioValue === 1) {
+					const res = await getCommisionList({
+						pageNo: this.currentPage,
+						pageSize: this.pageSize,
+						inspectionStatus: this.radioValue
+					})
+					this.commisionTable = res.data.row
+					this.total = res.data.total
+				}else{
+					this.getCommisionList();
 				}
 
 			},
@@ -451,7 +476,7 @@
 				}).then(res => {
 					this.view = `${this.vueIp}addCommision/${res.data.id}`
 					this.viewId = res.data.id
-					this.viewTime = res.data.time
+					this.viewTime2 = res.data.time
 				})
 			},
 			getViewId() {

--
Gitblit v1.9.3