Browse Source

承担单位检测页面修改

jiangyu 3 năm trước cách đây
mục cha
commit
644ce525b5
1 tập tin đã thay đổi với 39 bổ sung32 xóa
  1. 39 32
      src/components/jc/setTaskcd.vue

+ 39 - 32
src/components/jc/setTaskcd.vue

@@ -193,7 +193,7 @@
 				</el-table>
 
 				<!-- 抽样单列表对话框 -->
-			<el-dialog title="抽样单列表" :visible.sync="getSampleListDialog" width="80%" :close-on-click-modal="false" class="dialogItem">
+			<el-dialog title="抽样单列表" :visible.sync="getSampleListDialog" width="75%" :close-on-click-modal="false" class="dialogItem">
 				<el-form v-if="getSampleListDialog">
 					<!--  表格数据区域-->
 					<el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row
@@ -210,9 +210,9 @@
 							:prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
 						<el-table-column label="操作" align="center" fixed="right">
 							<template slot-scope="scope">
-								<el-button type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)">查看
+								<el-button style="margin:5px 5px" type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)">查看
 								</el-button>
-								<el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="upCydItem(scope.row.sample_id)">上报抽样信息
+								<el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" @click="upCydItem(scope.row.sample_id)">上报抽样信息
 								</el-button>
 							</template>
 						</el-table-column>
@@ -247,7 +247,7 @@
 				</el-table-column>
 			</el-table>
 			<!-- 查看检测单列表弹框 -->
-			<el-dialog title="检测单列表" :visible.sync="checkTestList" width="70%" :close-on-click-modal="false"
+			<el-dialog title="检测单列表" :visible.sync="checkTestList" width="80%" :close-on-click-modal="false"
 				class="dialogItem">
 				<!--  表格数据区域-->
 				<el-table :data="tableData1" border stripe highlight-current-row style="width: 100%"
@@ -261,14 +261,14 @@
 
 					<el-table-column :key="table.label" v-for="table in checkHeader" :label="table.label"
 						:prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
-					<el-table-column label="操作" align="center" fixed="right" width="220px">
+					<el-table-column label="操作" align="center" fixed="right" width="350px">
 						<template slot-scope="scope">
-							<el-button type="success" size="mini" v-if="scope.row.jc_value_id==null" plain
-								@click="check(scope.row.sample_id,scope.row.sample_name)">检测</el-button>
-							<el-button type="primary" v-else size="mini" plain @click="update(scope.row)">修改</el-button>
-							<el-button type="primary" size="mini" plain @click="upJcdItem(scope.row.sample_id)">上报
+							<el-button style="margin:5px 5px" type="success" size="mini" v-if="scope.row.jc_value_id==null" plain
+								@click="getJcdObjectItem(scope.row.sample_id,scope.row.sample_name)">检测</el-button>
+							<el-button style="margin:5px 5px" type="primary" v-else size="mini" plain @click="update(scope.row)">修改</el-button>
+							<el-button style="margin:5px 5px" type="primary" size="mini" plain @click="upJcdItem(scope.row.sample_id)">上报
 							</el-button>
-							<el-button type="primary" size="mini" plain @click="creatpdf(scope.row.sample_id)">生成检测报告
+							<el-button style="margin:5px 5px" type="primary" size="mini" plain @click="creatpdf(scope.row.sample_id)">生成检测报告
 							</el-button>
 						</template>
 					</el-table-column>
@@ -284,9 +284,9 @@
 
 			<el-dialog title="填写检测单" :visible.sync="inputCheckShow" width="70%" :close-on-click-modal="false"
 				class="dialogItem">
-				<span class="demonstration">样品编码:{{check_id}}</span>
-				<span class="demonstration">样品名称:{{check_name}}</span>
-				<el-button type="success" size="small" plain @click="onSubmit">保存</el-button>
+				<span class="demonstration">样品编码:{{sample_id}}</span>
+				<span class="demonstration">样品名称:{{sample_name}}</span>
+				<el-button type="success" size="small" plain @click="saveJcdItem()">保存</el-button>
 				<span class="demonstration">注意:“不得检出”只能填为“ND”</span>
 				<!--  表格数据区域-->
 				<el-table :data="testPesticides" border stripe highlight-current-row style="width: 100%"
@@ -584,16 +584,18 @@
 					}, {
 						label: '抽样日期',
 						prop: 'sample_date',
-						width: 180
+						width: 150
 					}, {
 						label: '状态',
 						prop: 'status',
-						width: 180
+						width: 100
 					}
 				],
+				//获取检测单列表表格
 				checkHeader: [{
 						label: '样品名称',
 						prop: 'sample_name',
+						width: 150
 						// fixed: 'left'
 					}, {
 						label: '样品编码',
@@ -602,7 +604,7 @@
 					},
 					{
 						label: '受检单位',
-						prop: 'units_id',
+						prop: 'unitTest.unit_test_name',
 						width: 180
 					},
 					{
@@ -616,11 +618,11 @@
 					}, {
 						label: '判定结果',
 						prop: 'test_result',
-						width: 180
+						width: 100
 					}, {
 						label: '状态',
-						prop: 'test_status',
-						width: 180
+						prop: 'testStatus',
+						width: 100
 					}
 				],
 				checkHeader2: [{
@@ -683,7 +685,8 @@
 						prop: 'address'
 					}, {
 						label: '抽样数量',
-						prop: 'sample_number'
+						prop: 'sample_number',
+						width: 100,
 					},
 					{
 						label: '报告上传单位',
@@ -886,7 +889,8 @@
 				// },
 
 			},
-			async onSubmit() {
+			//保存检测单
+			async saveJcdItem() {
 				console.log(this.testPesticides)
 				for (let i = 0; i < this.testPesticides.length; i++) {
 					this.testPesticides[i]['unit'] = 'mg/kg'
@@ -907,9 +911,9 @@
 
 
 				var that = this
-				const result = await this.$http.post("saveSamplePesticides", {
+				const result = await this.$http.post("saveJcdItem", {
 					pesticides: that.testPesticides,
-					sample_id: that.check_id
+					sample_id: that.sample_id
 				});
 				if (result.data.code == 0) {
 					this.$message({
@@ -917,7 +921,7 @@
 						message: '检测成功!'
 					});
 					that.inputCheckShow = false
-					that.getSampleList()
+					that.getJcdList()//需要undertake_id
 				} else {
 					this.$message({
 						type: 'error',
@@ -927,16 +931,18 @@
 				}
 			},
 			//检测单列表-检测
-			async check(id) {
+			async getJcdObjectItem(id,name) {
 				this.inputCheckShow = true
 
 				var that = this
 				const {
 					data: res
 				} = await this.$http.post("getJcdObjectItem", {
-					sample_id: id
+					sample_id: id,
 				});
 				that.testPesticides = res.data
+				that.sample_name = name
+				that.sample_id = id
 				console.log(that.testPesticides)
 			},
 			//检测单列表-上报
@@ -981,14 +987,15 @@
 				console.log(res.data)
 			
 				this.tableData1 = res.data.rows
-				if(res.data.rows.test_status = '0'){
-					this.tableData1.test_status = '未上报'
-				}else{
-					this.tableData1.test_status = '已上报'
-				}
+				for (let i = 0; i < this.tableData1.length; i++) {
+					if (this.tableData1[i].test_status == '0') {
+						this.tableData1[i].testStatus = '未上报'
+					} else {
+						this.tableData1[i].testStatus = '已上报'
+					}
 				console.log(this.tableData1)
 				this.testListTotal = res.data.total
-				
+				}
 			},
 			// 获取抽样单列表
 			async getSampleList(id) {