소스 검색

状态全局方法

jiangyu 3 년 전
부모
커밋
c16a69bb14

+ 10 - 6
package-lock.json

@@ -4664,8 +4664,6 @@
     "echarts": {
       "version": "5.2.2",
       "resolved": "https://registry.npmmirror.com/echarts/download/echarts-5.2.2.tgz",
-
-
       "integrity": "sha512-yxuBfeIH5c+0FsoRP60w4De6omXhA06c7eUYBsC1ykB6Ys2yK5fSteIYWvkJ4xJVLQgCvAdO8C4mN6MLeJpBaw==",
       "requires": {
         "tslib": "2.3.0",
@@ -4674,7 +4672,6 @@
       "dependencies": {
         "tslib": {
           "version": "2.3.0",
-
           "resolved": "https://registry.nlark.com/tslib/download/tslib-2.3.0.tgz?cache=0&sync_timestamp=1628722556410&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftslib%2Fdownload%2Ftslib-2.3.0.tgz",
           "integrity": "sha1-gDuM2rPhK6WBpMpByIObuw2ssJ4="
         }
@@ -7496,6 +7493,11 @@
         "through2": "^2.0.0"
       }
     },
+    "mixin": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmmirror.com/mixin/download/mixin-0.2.0.tgz",
+      "integrity": "sha512-rG26haL24UI5gZEwUYjI4F57cghVUYvRdiN/7DjlbRu5DuXmx2sfmLqidYtP7Aq6C3xGvirRS+/ZtUQEgcO+Xw=="
+    },
     "mixin-deep": {
       "version": "1.3.2",
       "resolved": "https://registry.npm.taobao.org/mixin-deep/download/mixin-deep-1.3.2.tgz",
@@ -7517,6 +7519,11 @@
         }
       }
     },
+    "mixin.js": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmmirror.com/mixin.js/download/mixin.js-1.0.2.tgz",
+      "integrity": "sha1-cI5bUk5QOAq9JmOb5VOZZ6AoG/4="
+    },
     "mkdirp": {
       "version": "0.5.5",
       "resolved": "https://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.5.tgz",
@@ -12640,10 +12647,8 @@
     },
     "zrender": {
       "version": "5.2.1",
-
       "resolved": "https://registry.nlark.com/zrender/download/zrender-5.2.1.tgz",
       "integrity": "sha1-X0u9qRW6bUErCxncJDG+qtBUF7s=",
-
       "requires": {
         "tslib": "2.3.0"
       },
@@ -12652,7 +12657,6 @@
           "version": "2.3.0",
           "resolved": "https://registry.nlark.com/tslib/download/tslib-2.3.0.tgz?cache=0&sync_timestamp=1628722556410&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftslib%2Fdownload%2Ftslib-2.3.0.tgz",
           "integrity": "sha1-gDuM2rPhK6WBpMpByIObuw2ssJ4="
-
         }
       }
     }

+ 2 - 0
package.json

@@ -17,6 +17,8 @@
     "html2canvas": "^1.3.2",
     "jspdf": "^2.3.1",
     "less-loader": "^5.0.0",
+    "mixin": "^0.2.0",
+    "mixin.js": "^1.0.2",
     "moment": "^2.29.1",
     "node-sass": "^6.0.1",
     "pikaz-excel-js": "^0.2.16",

+ 23 - 0
src/assets/common.vue

@@ -0,0 +1,23 @@
+<script type="text/javascript">
+    // 定义一些公共的属性和方法
+    // const httpUrl = 'http://39.105.17.99:8080/'
+    function changeStatus(status) {
+        switch(status){
+            case 5: 
+                return '已查看'
+            case 13: 
+                return '抽样中'
+            case 14: 
+                return '抽样完成'
+            case 17: 
+                return '检测中'
+            case 18:  
+                return '检测完成'
+            case 21: 
+                return '已完成'       
+        }
+    }
+    export default {
+        changeStatus
+    }
+</script>

+ 18 - 0
src/assets/js/mixin.js

@@ -0,0 +1,18 @@
+export default{
+    changeStatus(status) {
+        switch(status){
+            case 5: 
+                return '已查看'
+            case 13: 
+                return '抽样中'
+            case 14: 
+                return '抽样完成'
+            case 17: 
+                return '检测中'
+            case 18:  
+                return '检测完成'
+            case 21: 
+                return '已完成'       
+        }
+    }
+}

+ 2 - 2
src/components/admin/recheckMonitor.vue

@@ -62,8 +62,8 @@
 					{{ scope.$index+1 }}
 				</template>
 			</el-table-column>
-			<el-table-column v-for="table in tableHeader" :label="table.label" :prop="table.prop" align="center"
-				:width="table.width" :fixed="table.fixed" />
+			<!-- <el-table-column v-for="table in tableHeader" :label="table.label" :prop="table.prop" align="center"
+				:width="table.width" :fixed="table.fixed" /> -->
 			<el-table-column label="操作" align="center" fixed="right">
 				<!-- 操作按钮区域的作用域插槽 -->
 				<template slot-scope="scope">

+ 1 - 1
src/components/jc/fillSampleReport.vue

@@ -266,7 +266,7 @@
 					contact_name: [{required: true, message: '请输入联系人', trigger: 'blur'},],
 					contact_phone: [{required: true, message: '请输入联系电话', trigger: 'blur'},
 									{validator: checkNumber, trigger: 'blur' }],
-					contact_email:[{required: true, message: '请输入联系电话', trigger: 'blur'},
+					contact_email:[{required: true, message: '请输入邮箱', trigger: 'blur'},
 									{validator: checkEmail, trigger: 'blur' }]
 						},
 				rules1: {

+ 6 - 5
src/components/jc/routineMonitor.vue

@@ -65,11 +65,12 @@
 					align="center" :width="table.width" :fixed="table.fixed" />
 				<el-table-column prop="ispublic" label="任务状态" align="center">
 					<template slot-scope="scope">
-						<el-tag type="danger" v-if="scope.row.ispublic==1">已发布</el-tag>
-						<el-tag type="danger" v-if="scope.row.ispublic==2">废止</el-tag>
-						<el-tag type="info" v-if="scope.row.ispublic==3">已结束,未完成</el-tag>
-						<el-tag type="success" v-if="scope.row.ispublic==4">已结束,已完成</el-tag>
-						<el-tag type="warning" v-if="scope.row.ispublic==5">执行中</el-tag>
+						<el-tag type="" v-if="scope.row.ispublic==1">已发布</el-tag>
+						<el-tag type="danger" v-if="scope.row.ispublic==9">抽样中</el-tag>
+						<el-tag type="info" v-if="scope.row.ispublic==13">检测中</el-tag>
+						<el-tag type="success" v-if="scope.row.ispublic==17">检测中</el-tag>
+						<el-tag type="" v-if="scope.row.ispublic==21">已完成</el-tag>
+						<el-tag type="warning" v-if="scope.row.ispublic==25">未完成</el-tag>
 					</template>
 				</el-table-column>
 				<el-table-column prop="level" label="任务优先级" width="100" align="center">

+ 68 - 77
src/components/jc/setTaskcd.vue

@@ -147,16 +147,16 @@
 						: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 style="margin:5px 0" type="primary" size="small" plain @click="input(scope.row.id)">填报抽样单
+						<el-button style="margin:5px 0" type="primary" size="small" plain @click="input(scope.row.id)" v-if="scope.row.task_profile_status!== '14'">填报抽样单
 						</el-button>
 						<el-button style="margin-bottom:5px" type="primary" size="small" @click="getCydlist(scope.row.id)">查看抽样单列表
 						</el-button>
-							<!-- <el-button type="success" size="small" plain @click="sampleDetail(scope.row.sample_id)" @focus="getSampleListDialog = true">查看抽样单列表
-						</el-button> -->
-						<!-- <el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="appear">上报抽样信息
-						</el-button> -->
+						<el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" @click="putCydStatus(scope.row.id)" 
+						v-if="scope.row.task_profile_status == '已查看' || scope.row.task_profile_status == '抽样中'">上报抽样信息
+								</el-button>
 					</template>
 					</el-table-column>
+					 
 				</el-table>
 
 				<!-- 抽样单列表对话框 -->
@@ -185,12 +185,12 @@
 							<template slot-scope="scope">
 								<el-button style="margin:5px 5px" type="success" size="small" plain @click="sampleDetail(scope.row.id)">查看
 								</el-button>
-								<el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" v-if="scope.row.cyd_status == 1" @click="putCydStatus(scope.row.id)">上报抽样信息
-								</el-button>
+								<!-- <el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" v-if="scope.row.cyd_status == 1" @click="putCydStatus(scope.row.id)">上报抽样信息
+								</el-button> -->
 								<el-button style="margin:5px 5px" type="success" size="small" plain v-if="scope.row.cyd_status == 1" @click="deleteCyd(scope.row.id)">删除
 								</el-button>
-								<el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" v-else>抽样信息已上报
-								</el-button>
+								<!-- <el-button style="margin:5px 5px" type="primary" size="small" plain icon="el-icon-edit-outline" v-else>抽样信息已上报
+								</el-button> -->
 							</template>
 						</el-table-column>
 					</el-table>
@@ -211,8 +211,13 @@
 					: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 style="margin:5px 0" type="primary" size="small" @click="getJcdList(scope.row.id)">查看检测单列表
 					</el-button>
+					<el-button style="margin:5px 5px" type="primary" size="small" plain @click="putJcdStatus(scope.row.id)"
+					v-if="scope.row.task_profile_status == '已查看'|| scope.row.task_profile_status == '抽样中' || scope.row.task_profile_status == '检测中'">上报检测单
+					</el-button>
+
 				</template>
 				</el-table-column>
 			</el-table>
@@ -268,8 +273,8 @@
 							<el-button style="margin:5px 5px" type="primary" size="mini" v-if="scope.row.jcd==null" plain
 								@click="getJcdObj(scope.row.id,scope.row.cyd_id)">填报检测单</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="putJcdStatus(scope.row.jcd.id,scope.row.cyd_id)" v-else-if="scope.row.jcd.jcd_status == '1'">上报检测单
-							</el-button>
+							<!-- <el-button style="margin:5px 5px" type="primary" size="mini" plain @click="putJcdStatus(scope.row.jcd.id,scope.row.cyd_id)" v-else-if="scope.row.jcd.jcd_status == '1'">上报检测单
+							</el-button> -->
 							<el-button style="margin:5px 5px" type="primary" size="mini" plain v-else-if="scope.row.jcd.jcd_status == '3'">检测单已上报
 							</el-button>
 						</el-col>
@@ -343,59 +348,15 @@
 					</template>
 				</el-table-column>
 			</el-table>
-			<!-- <el-table ref="multipleTable" :data="jcxItems" border stripe highlight-current-row style="margin:auto;width:100%;"
-				:row-style="rowStyle" :cell-style="cellStyle">
-				<el-table-column type="selection" width="50px"></el-table-column>
-				<el-table-column label="序号" width="50px">
-					<template slot-scope="scope">
-						{{ scope.$index+1 }}
-					</template>
-				</el-table-column>
 
-				<el-table-column :key="table.label" v-for="table in jcxHeader" :label="table.label" :prop="table.prop"
-					align="center" :width="table.width" :fixed="table.fixed" />
-				<el-table-column label="操作" align="center">
-						<template slot-scope="scope">
-						<el-col style="margin-bottom: 5px;">
-							<el-button type="success" size="mini" @click="delJcdItem(scope.row.id)">删除</el-button>
-						</el-col>
-					</template>
-				</el-table-column>
-			</el-table> -->
 
 			<!--    分页器区域-->
 			<el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2"
 				:current-page="queryInfo2.pageNum" :page-sizes="[1,10, 15, 20]" :page-size="queryInfo2.pageSize"
 				layout="total, sizes, prev, pager, next, jumper" :total="jcxItemTotal" background />
 		
-			</div>
-
-			
-<!-- 
-				<el-table :data="jcxItems" border stripe highlight-current-row style="width: 100%;"
-					:row-style="rowStyle" :cell-style="cellStyle" align="center" v-show="jcd.jcd_result==0">
-					<el-table-column label="序号" align="center" style="width: auto;">
-						<template slot-scope="scope">
-							{{ scope.$index+1 }}
-						</template>
-					</el-table-column>
-
-					<el-table-column :key="table.label" v-for="table in jcxHeader" :label="table.label"
-						:prop="table.prop" align="center" :width="table.width" :fixed="table.fixed">
-						
-					</el-table-column>
-					<el-table-column label="操作" align="center">
-							<template slot-scope="scope">
-							<el-col style="margin: 5px auto">
-								<el-button type="success" size="mini" @click="delJcdItem(scope.row.id)">删除</el-button>
-							</el-col>
-						</template>
-					</el-table-column>
-				</el-table> -->
-
-				
+			</div>		
 
-		
 			<div class="footer">
 				<el-button type="primary" style="margin-bottom:30px;" size="small" @click="putJcd()">完成</el-button>
 			</div>
@@ -781,7 +742,7 @@
 				tableHeader2: [{
 						label: '抽样机构',
 						prop: 'sampleOrgId.name',
-						width: 180,
+						// width: 180,
 					}, {
 						label: '检测机构',
 						prop: 'checkOrgId.name'
@@ -789,7 +750,11 @@
 					{
 						label: '抽样地区',
 						prop: 'sample_address'
-					}, 
+					},
+					{
+						label: '状态',
+						prop: this.COMMON.changeStatus('task_profile_status')
+					},
 					// {
 					// 	label: '抽样数量',
 					// 	prop: 'sample_number',
@@ -1076,9 +1041,26 @@
 					// pageNum: that.queryInfo.pageNum,
 					// pageSize: that.queryInfo.pageSize
 				});
-				console.log(res)
+				console.log(res.data.rows)
+				// this.changeStatus(res.data.rows[0].task_profile_status)
 				that.underTask = res.data.rows
-				console.log(that.underTask)
+				// for(let i= 0; i < that.underTask.length; i++) {
+				// 	if(that.underTask[i].task_profile_status == '11') {
+				// 		that.underTask[i].task_profile_status = '已查看'
+				// 	}else if(that.underTask[i].task_profile_status == '13') {
+				// 		that.underTask[i].task_profile_status = '抽样单'
+				// 	}else if(that.underTask[i].task_profile_status == '14') {
+				// 		that.underTask[i].task_profile_status = '抽样完成'
+				// 	}else if(that.underTask[i].task_profile_status == '17') {
+				// 		that.underTask[i].task_profile_status = '检测中'
+				// 	}else if(that.underTask[i].task_profile_status == '18') {
+				// 		that.underTask[i].task_profile_status = '检测完成'
+				// 	}else if(that.underTask[i].task_profile_status == '21') {
+				// 		that.underTask[i].task_profile_status = '已完成'
+				// 	}
+				// }
+
+				// console.log(that.underTask)
 			},
 			
 			// 上传成功
@@ -1191,22 +1173,24 @@
 				// console.log(that.cyd_id)
 			},
 			//检测单列表-上报
-			async putJcdStatus(id,cyd_id){
+			async putJcdStatus(id){
 				var that = this
-				console.log(cyd_id)
+				console.log(id)
 				const result = await this.$http.post('putJcdStatus', {
-					jcd_id: id
+					task_profile_id: id,
+					task_id: that.task_id,
+					task_profile_status: 18
 				})
 				console.log(result.data.data)
 				// this.getCyds()
 					// 判断业务逻辑
-					if (result.data.code == 0) {
+					if (result.data.data == 1) {
 						this.$message({
 							type: 'success',
 							message: '上报抽样信息成功'
 						})
 						
-						this.getSamples(cyd_id)
+						this.getCheckTaskList(that.task_id)
 					}
 			},
 			handleClick(tab, event) {
@@ -1250,27 +1234,34 @@
 			async putCydStatus(id) {
 				let that = this
 				// that.orgs = that.multipleSelection
-				// console.log(that.multipleSelection)
+				console.log(that.task_id)
+				console.log(id)
 				const result = await this.$http.post('putCydStatus', {
-					cyd_id: id
+					task_profile_id: id,
+					task_profile_status: 14,
+					task_id: that.task_id
 				})
 				console.log(result.data.data)
 				// this.getCyds()
 					// 判断业务逻辑
-					this.$message({
-							type: 'success',
-							message: '上报抽样信息成功'
-						})
-						
-						this.getCyds(result.data.data)
-					// if (result.data.code == 0) {
-					// 	this.$message({
+					// this.$message({
 					// 		type: 'success',
 					// 		message: '上报抽样信息成功'
 					// 	})
 						
-					// 	this.getCyds(result.data.data)
-					// }
+					// 	this.getCheckTaskList(that.task_id)
+					if (result.data.code == 1) {
+						this.$message({
+							type: 'success',
+							message: '上报抽样信息成功'
+						})
+						
+						this.getCheckTaskList(that.task_id)
+					}else
+					{this.$message({
+							type: 'success',
+							message: '上报抽样信息失败'
+						})}
 			},
 		
 			/** 修复当用户在大于1的分页进行数据搜索没有返回值的问题 */

+ 5 - 1
src/main.js

@@ -6,11 +6,15 @@ import router from './router'
 import './plugins/element.js'
 // 导入全局样式表
 import './assets/css/global.css'
+// import mixinx from './assets/js/mixin.js'
 import axios from 'axios'
 //导入echart
 import * as echarts from 'echarts';
 Vue.prototype.$echarts = echarts
-
+// 导入全局方法
+import global from './assets/common.vue'
+Vue.prototype.COMMON = global
+// Vue.prototype.mixinx = mixinx
 
 // 使用axios
 // axios.defaults.baseURL = 'http://syjcapi.aielab.net/api/v1'