jiangyu 3 năm trước cách đây
mục cha
commit
90987dbb5d
2 tập tin đã thay đổi với 199 bổ sung125 xóa
  1. 138 64
      src/components/jc/routineMonitorqt.vue
  2. 61 61
      src/components/jc/setTaskcd.vue

+ 138 - 64
src/components/jc/routineMonitorqt.vue

@@ -1,5 +1,4 @@
 <template>
-
 	<div style="width: 100%">
 
 			<div slot="header" class="clearfix">
@@ -7,56 +6,55 @@
 					<el-breadcrumb-item>首页</el-breadcrumb-item>
 					<el-breadcrumb-item>牵头单位</el-breadcrumb-item>
 					<el-breadcrumb-item>任务列表</el-breadcrumb-item>
+
 				</el-breadcrumb>
 			</div>
 			<!-- 头部搜索栏 -->
-			<div class="form">
-				<el-row :gutter="50" style="margin-right: 0px;">
-					<el-form style="display: flex; flex-flow: row nowrap;" size="mini">
-						<el-form-item label="年度" class="select" style="margin-left: -0.3%;">
-							<el-date-picker v-model="queryInfo.year" value-format="yyyy"
-								type="year" clearable />
-						</el-form-item>
-						<el-form-item label="任务状态" class="select">
-							<el-select v-model="queryInfo.ispublic">
-								<el-option v-for="item in taskstatus" :key="item.value" :label="item.label"
-									:value="item.value">
-								</el-option>
-							</el-select>
-						</el-form-item>
-						<el-form-item label="任务时间" class="select">
-							<el-date-picker v-model="queryInfo.starttime" align="right" type="date"
-								:picker-options="pickerOptions" lable clearable />
-						</el-form-item>
-						<el-form-item label="--" class="select" style="margin-left: -3.5%;">
-							<el-date-picker v-model="queryInfo.endtime" align="right" type="date"
-								:picker-options="pickerOptions" clearable />
-						</el-form-item>
-						<el-form-item label="任务名称" class="select">
-							<el-input v-model="queryInfo.task_name"></el-input>
-						</el-form-item>
-						<!-- 查询 -->
-						<el-button style="height: 28px;margin-left: 1%;" type="success"  size="mini" @click="searchData()">查询</el-button>
-						<!-- 重置 -->
-						<el-button style="height: 28px;margin-left: 0.5%;" type="success"  size="mini" @click="reset()">重置</el-button>
-					</el-form>
-				</el-row>
-			</div>
+			<el-row :gutter="50" style="margin-right: 0px;">
+				<el-form style="display: flex; flex-direction: row;">
+					<el-form-item label="年度" class="select" size="mini">
+						<el-date-picker v-model="queryInfo.year" style="width: 110px;" value-format="yyyy"
+							type="year" clearable />
+					</el-form-item>
+					<el-form-item label="任务状态" class="select" size="mini">
+						<el-select v-model="queryInfo.ispublic" style="width: 110px;">
+							<el-option v-for="item in taskstatus" :key="item.value" :label="item.label"
+								:value="item.value">
+							</el-option>
+						</el-select>
+					</el-form-item>
+					<el-form-item label="任务时间" class="select" size="mini">
+						<el-date-picker v-model="queryInfo.starttime" style="width: 180px;" align="right" type="date"
+							:picker-options="pickerOptions" clearable />
+					</el-form-item>
+					<el-form-item label="--" class="select" style="margin-left: 10px;" size="mini">
+						<el-date-picker v-model="queryInfo.endtime" style="width: 180px;" align="right" type="date"
+							:picker-options="pickerOptions" clearable />
+					</el-form-item>
+					<el-form-item label="任务名称" class="select" size="mini">
+						<el-input v-model="queryInfo.task_name"></el-input>
+					</el-form-item>
+					<!-- 查询 -->
+					<el-button style="height: 40px;margin-left: 10px;" type="success"  size="mini" @click="searchData()">查询</el-button>
+					<!-- 重置 -->
+					<el-button style="height: 40px;margin-left: 5px;" type="success"  size="mini" @click="reset()">重置</el-button>
+				</el-form>
+			</el-row>
 			<!--  头部钮区域-->
-			<!-- <el-row :gutter="90" style="margin-right: 0px;">
+			<el-row :gutter="90" style="margin-right: 0px;">
 				<div style="display: flex;flex-direction: row;float: right;">
-					<el-button type="primary" size="small" plain icon="el-icon-plus" @click="add()">新增</el-button>
+				<!-- 	<el-button type="primary" size="small" plain icon="el-icon-plus" @click="add()">新增</el-button>
 					<el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="ispublic()">发布</el-button>
 					<el-button type="primary" size="small" plain icon="el-icon-scissors" @click="repeal()">废止</el-button>
 					<el-button type="primary" size="small" plain icon="el-icon-delete" @click="delArray()">删除</el-button> -->
-					<!-- <el-button type="primary" size="small" plain icon="el-icon-download">导出</el-button> -->
-				<!-- </div>
-			</el-row> -->
+					<el-button type="primary" size="small" plain icon="el-icon-download" @click="exportData">导出Excel</el-button>
+				</div>
+			</el-row>
 			<!--  表格数据区域-->
 			<el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row style="width: 100%"
 				:row-style="rowStyle" :cell-style="cellStyle" @selection-change="handleSelectionChange">
-				<el-table-column type="selection" width="50" align="center"></el-table-column>
-				<el-table-column label="序号" width="50px" align="center">
+				<el-table-column type="selection" width="50"></el-table-column>
+				<el-table-column label="序号" width="50px">
 					<template slot-scope="scope">
 						{{ scope.$index+1 }}
 					</template>
@@ -104,6 +102,34 @@
 </template>
 
 <script>
+		const qee = require('qf-export-excel')
+		const HeadersList = [{
+				title: '任务名称',
+				key: 'task_name'
+			}, {
+				title: '年度',
+				key: 'year'
+			},
+			{
+				title: '文件号',
+				key: 'filenum'
+			}, {
+				title: '开始时间',
+				key: 'starttime'
+			}, {
+				title: '结束时间',
+				key: 'endtime'
+			}, {
+				title: '创建者',
+				key: 'releaser'
+			}, {
+				title: '任务优先级',
+				key: 'level'
+			}, {
+				title: '任务状态',
+				key: 'ispublic'
+			}
+		]
 	export default {
 		name: '',
 		data() {
@@ -282,6 +308,64 @@
 					this.total = result.data.data.total
 				}
 			},
+			// 导出Excel
+			async exportData() {
+			
+				// for (var key in this.exportInfo) {
+				// 	if (this.exportInfo[key] == '') {
+				// 		delete this.exportInfo[key]
+				// 	}
+				// }
+			
+				let exportList = []
+					exportList = this.tableData
+					
+					for (let i = 0; i < exportList.length; i++) {
+						if (exportList[i].level == '0') {
+							exportList[i].level = '一般'
+						} else if (exportList[i].level == '1')  {
+							exportList[i].level = '紧急'
+						}else{
+							exportList[i].level = '特急'
+						}
+						if (exportList[i].ispublic == '1') {
+							exportList[i].ispublic = '已发布'
+						} else if(exportList[i].ispublic == '2')  {
+							exportList[i].ispublic = '废止'
+						}else if(exportList[i].ispublic == '3') {
+							exportList[i].ispublic = '已结束,未完成'
+						}else if(exportList[i].ispublic == '4') {
+							exportList[i].ispublic = '已结束,已完成'
+						}else if(exportList[i].ispublic == '5') {
+							exportList[i].ispublic = '执行中'
+						}
+					}
+				// 导出表格的表头设置
+				// let allColumns = exportList
+				var columnNames = []
+				var columnValues = []
+				// var columns = []
+				require.ensure([], () => {
+					const {
+						export_json_to_excel
+					} = require('@/vendor/Export2Excel.js')
+			
+					for (var i = 0; i < HeadersList.length; i++) {
+						columnNames[i] = HeadersList[i].title
+						columnValues[i] = HeadersList[i].key
+					}
+					const tHeader = columnNames
+					const filterVal = columnValues
+					// console.log(columns)
+					const list = exportList
+					const data = this.formatJson(filterVal, list)
+					export_json_to_excel(tHeader, data, '例行监测任务')
+				
+				})
+			},
+			formatJson(filterVal, jsonData) {
+				return jsonData.map(v => filterVal.map(j => v[j]))
+			},
 			// 执行任务
 			runtask(id) {
 				// console.log(id)
@@ -324,39 +408,37 @@
 	// }
 
 	.el-select {
-		// width: 210px;
+		width: 210px;
 		height: 100%;
 	}
 
 	.select {
 		display: flex;
 		flex-direction: row;
-		margin-left: 0.6%;
+		margin-left: 10px;
 	}
 
 	.dialogItem /deep/ .el-dialog__body {
 		padding: 15px 12px 0;
 		color: #606266;
-		font-size: .875rem;
+		font-size: 14px;
 		word-break: break-all;
 	}
 
-	// .el-form-item {
-	// 	margin-left: 0.8%;
-	// }
-	
+	.el-form-item {
+		margin-bottom: 30px;
+		padding-left: 18px;
+	}
 
-	// .labelItem /deep/ 
-	/deep/ .el-form-item__label {
-		width: 5.625rem;
-		margin-right: -1%;
-		text-align: right;
+	.labelItem /deep/ .el-form-item__label {
+		// width: 80px;
+		text-align: center;
 		vertical-align: middle;
-		// float: left;
-		font-size: .8125rem;
+		float: left;
+		font-size: 13px;
 		color: #606266;
 		// line-height: 40px;
-		padding: 0% 4% 0% 0%;
+		padding: 0 2px 0 0;
 		-webkit-box-sizing: border-box;
 		box-sizing: border-box;
 	}
@@ -367,18 +449,10 @@
 	}
 	
 	.footer {
-		padding: 1%;
+		padding: 10px;
 		text-align: center;
 	}
 
-	.el-form{
-		width: 80%;
-	}
-
-
-	.el-date-editor.el-input, .el-date-editor.el-input__inner{
-		width:100%;
-	}
 	// .el-form-item__content{
 	// 	margin-left: 0;
 	// }

+ 61 - 61
src/components/jc/setTaskcd.vue

@@ -3,14 +3,13 @@
 
 		<el-breadcrumb separator-class="el-icon-arrow-right">
 			<el-breadcrumb-item>首页</el-breadcrumb-item>
-			<el-breadcrumb-item>承担单位</el-breadcrumb-item>
 			<el-breadcrumb-item :to="{ path: '/jc/routineMonitor' }">任务列表</el-breadcrumb-item>
 			<el-breadcrumb-item>基本信息</el-breadcrumb-item>
 		</el-breadcrumb>
 
 		<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
 			<el-tab-pane label="任务详情" name="first">
-				<el-descriptions class="margin-top" :title="readForm.task_class+'任务'" :column="2" :size="size" border>
+				<el-descriptions class="margin-top" title="例行监测任务" :column="2" :size="size" border>
 					<el-descriptions-item>
 						<template slot="label">
 							发布单位
@@ -99,11 +98,11 @@
 				<div class="footer">
 					<el-button type="success" size="mini" @click="input()">填报抽样单</el-button>
 					<!-- <el-button type="success" size="mini" @click="next">导出总览</el-button> -->
-					<el-button type="success" size="mini" @click="back()">返回</el-button>
+					<el-button type="success" size="mini">返回</el-button>
 				</div>
 			</el-tab-pane>
 
-			<el-tab-pane label="抽样" name="second">
+			<el-tab-pane v-if="sampleShow==true" label="抽样" name="second">
 				<!-- 头部搜索栏 -->
 				<el-row style="margin-right: 0px;">
 					<el-form style="display: flex; flex-direction: row;">
@@ -135,19 +134,19 @@
 						<el-form-item label="抽样机构" class="select" size="small">
 							<el-input v-model="queryInfo.task_name"></el-input>
 						</el-form-item>
-						<el-button style="height: 32px;margin-left: 15px;" size="mini" type="success"
+						<el-button style="height: 30px;margin-left: 10px;" size="mini" type="success"
 							@click="searchData()">查询
 						</el-button>
 						<!-- 重置 -->
-						<el-button style="height: 32px;margin-left: 5px;" size="mini" type="success" @click="reset()">
+						<el-button style="height: 30px;margin-left: 5px;" size="mini" type="success" @click="reset()">
 							重置
 						</el-button>
 					</el-form>
-				
+
 				</el-row>
 				<el-row style="margin-right: 0px;">
 					<el-form style="display: flex; flex-direction: row;">
-					<!-- 	<el-form-item label="产地" class="select">
+						<!-- 	<el-form-item label="产地" class="select">
 							<el-select v-model="value" placeholder="请选择省份" size="small">
 								<el-option v-for="item in options" :key="item.value" :label="item.label"
 									:value="item.value">
@@ -165,7 +164,7 @@
 							</el-select>
 						</el-form-item> -->
 						<!-- 查询 -->
-						
+
 					</el-form>
 					<div style="display: flex;flex-direction: row;float: right;">
 						<el-button type="primary" size="small" plain icon="el-icon-plus" @click="input()">填报抽样单
@@ -184,7 +183,7 @@
 					@selection-change="handleSelectionChange" style="width: 100%" :row-style="rowStyle"
 					:cell-style="cellStyle">
 					<el-table-column type="selection" width="50"></el-table-column>
-					<el-table-column label="序号" width="50px" align="center">
+					<el-table-column label="序号" width="50px">
 						<template slot-scope="scope">
 							{{ scope.$index+1 }}
 						</template>
@@ -192,13 +191,12 @@
 
 					<el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label"
 						:prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
-
-					<el-table-column label="操作" width="150px" align="center">
-						<template>
-							<el-button type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)">查看</el-button>
+					<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>
 						</template>
 					</el-table-column>
-			
 				</el-table>
 				<!--    分页器区域-->
 				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
@@ -206,13 +204,13 @@
 					layout="total, sizes, prev, pager, next, jumper" :total="total" background />
 			</el-tab-pane>
 
-			<el-tab-pane label="检测" name="third">
+			<el-tab-pane  v-if="checkShow==true"  label="检测" name="third">
 
 				<!--  表格数据区域-->
 				<el-table :data="tableData" border stripe highlight-current-row style="width: 100%"
 					:row-style="rowStyle" :cell-style="cellStyle">
 					<!-- <el-table-column type="selection" width="50"></el-table-column> -->
-					<el-table-column label="序号" width="50px" align="center">
+					<el-table-column label="序号" width="50px">
 						<template slot-scope="scope">
 							{{ scope.$index+1 }}
 						</template>
@@ -220,7 +218,7 @@
 
 					<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"  width="220px">
+					<el-table-column label="操作" align="center" fixed="right" width="220px">
 						<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>
@@ -266,9 +264,9 @@
 					</el-table-column>
 					<el-table-column label="抽检结果">
 						<template slot-scope="scope">
-							<span v-if="scope.row.test_value<=scope.row.state_value&&scope.row.state_value!='ND'"
+							<span v-if="parseFloat(scope.row.test_value)<=parseFloat(scope.row.state_value)&&scope.row.state_value!='ND'"
 								size="small">合格</span>
-							<span v-else-if="scope.row.test_value>scope.row.state_value" size="small">不合格</span>
+							<span v-else-if="parseFloat(scope.row.test_value)>parseFloat(scope.row.state_value)" size="small">不合格</span>
 							<span v-else-if="scope.row.test_value=='ND'&&scope.row.state_value=='ND'"
 								size="small">合格</span>
 							<span v-else-if="scope.row.test_value!='ND'&&scope.row.state_value=='ND'"
@@ -420,7 +418,7 @@
 				</div>
 				<el-button @click="dialogVisible2 = false">取 消</el-button>
 				<el-button type="primary" @click="download">生成检测报告pdf</el-button>
-				<!-- </span> -->
+				</span>
 			</el-dialog>
 
 			<el-tab-pane label="报告上传" name="five">
@@ -439,6 +437,7 @@
 	import htmlToPdf from '../../assets/js/htmlToPdf.js'
 	import inputCheck from './inputCheck'
 	const token = window.sessionStorage.getItem('token')
+	const name = window.sessionStorage.getItem('name')
 	export default {
 		name: 'setTask',
 		data() {
@@ -479,7 +478,7 @@
 					{
 						label: '受检单位',
 						prop: 'units_name',
-						width: 150
+						width: 180
 					},
 					{
 						label: '样品产地',
@@ -492,7 +491,7 @@
 					}, {
 						label: '状态',
 						prop: 'status',
-						width: 150
+						width: 180
 					}
 				],
 				checkHeader: [{
@@ -596,8 +595,10 @@
 						prop: 'uploadtime'
 					}
 				],
-				fileList:[],
-				total:0,
+				fileList: [],
+				total: 0,
+				sampleShow: false, //是否展示抽样卡片
+				checkShow: false //是否展示检测卡片
 			};
 		},
 		components: {
@@ -606,7 +607,8 @@
 		mounted() {},
 		created() {
 			this.task_id = this.$route.params.id
-			// console.log(this.$route.params)
+
+
 			this.getTaskDetail()
 			this.getSampleList()
 			// this.getmodelList()
@@ -621,6 +623,15 @@
 				// 判断业务逻辑
 				if (result.data.code == 0) {
 					this.underTask = result.data.data.rows
+					// 抽检分离时判断用户是抽样机构还是检测机构
+					for (let i = 0; i < this.underTask.length; i++) {
+						if (this.underTask[i].bear_name == name) {
+							this.sampleShow = true
+						}
+						if (this.underTask[i].check_name == name) {
+							this.checkShow = true
+						}
+					}
 					this.underTasktotal = result.data.data.total
 				}
 			},
@@ -657,25 +668,13 @@
 					}
 				}
 				that.readForm = res.data
-				console.log(res.data+'11111')
-
-				// this.bindForm.endtime_cydsb = res.data.endtime_cydsb
-			},
-			// 任务详情页面返回任务列表
-			async back() {
-				this.$router.push('routineMonitor')
+				// 抽检不分离
+				if (that.readForm.is_divide == 0) {
+					this.sampleShow = true
+					this.checkShow = true
+				}
 			},
-			// 修改检测报告
-			// async update(){
 
-			// 	const result = await this.$http.post('editSamplePesticides', {
-			// 		sample_id: sample_id,
-
-			// 	})
-			// 	if (result.data.code == 0) {
-			// 		that.formjc = result.data.data
-			// 	}
-			// },
 			// 上传成功
 			async uploadSuccess(res) {
 				console.log(res.data)
@@ -765,7 +764,7 @@
 			handleClick(tab, event) {
 				console.log(tab, event);
 			},
-		
+
 			// 获取抽样单列表
 			async getSampleList() {
 				this.queryInfo['task_id'] = this.task_id
@@ -915,24 +914,24 @@
 	// 	margin-left: 35%;
 	// }
 
-	.el-form-item {
-		margin-left: 15px;
-		// margin-bottom: 5px;
-	}
+	// .el-form-item {
+	// 	// margin-bottom: 8px;
+	// 	margin: 0 auto;
+	// }
 
-	.labelItem /deep/ .el-form-item__label {
-		// width: 80px;
-		text-align: center;
-		vertical-align: middle;
-		float: left;
-		font-size: 14px;
-		color: #606266;
-		font-weight: bold;
-		// line-height: 40px;
-		padding: 0 20px 0 0;
-		-webkit-box-sizing: border-box;
-		box-sizing: border-box;
-	}
+	// .labelItem /deep/ .el-form-item__label {
+	// 	// width: 80px;
+	// 	text-align: center;
+	// 	vertical-align: middle;
+	// 	float: left;
+	// 	font-size: 14px;
+	// 	color: #606266;
+	// 	font-weight: bold;
+	// 	// line-height: 40px;
+	// 	padding: 0 20px 0 0;
+	// 	-webkit-box-sizing: border-box;
+	// 	box-sizing: border-box;
+	// }
 
 	.demonstration {
 		margin: 20px;
@@ -941,6 +940,7 @@
 	.el-form-item__content {
 		// width: 200px;
 	}
+
 	.footer {
 		margin-top: 20px;
 		margin-left: 45%;