Browse Source

监督任务统计问题

yf_zhb 2 years ago
parent
commit
41f20a0a4e

+ 99 - 98
minggao/src/page/monitoring/monitoringtask.vue

@@ -6,6 +6,7 @@
         v-model="uservalue"
         multiple
         filterable
+        clearable
         placeholder="请选择任务监督人"
         size="mini"
         collapse-tags
@@ -35,7 +36,7 @@
         size="mini"
         @click="download"
         :disabled="disabled"
-        >{{ disabled ? "下载中..." : "下载统计结果" }}</el-button
+        >{{ disabled ? '下载中...' : '下载统计结果' }}</el-button
       >
     </div>
     <el-card class="box-card">
@@ -50,17 +51,17 @@
 
 <script>
 //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
-import * as echarts from "echarts";
+import * as echarts from 'echarts';
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
   data() {
     //这里存放数据
     return {
-      monvalue: "", //月份
+      monvalue: '', //月份
       useroptions: [], //监测人员名单
       uservalue: [],
-      disabled: false,
+      disabled: false
     };
   },
   //监听属性 类似于data概念
@@ -72,12 +73,12 @@ export default {
     //监督人员列表
     getuserlist() {
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=control_center.task.task_user_list",
+        method: 'POST',
+        url: '/api/api_gateway?method=control_center.task.task_user_list',
         data: this.qs.stringify({
-          user_type: "supervisor",
-        }),
-      }).then((res) => {
+          user_type: 'supervisor'
+        })
+      }).then(res => {
         // console.log(res.data.data);
         this.useroptions = res.data.data;
       });
@@ -85,19 +86,19 @@ export default {
     //任务列表 data_report.report.task_report
     gettasklist(start_time, end_time) {
       //   console.log(JSON.stringify(this.uservalue));
-      var operator_user_id_list = "";
+      var operator_user_id_list = '';
       if (this.uservalue.length != 0) {
         operator_user_id_list = JSON.stringify(this.uservalue);
       }
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=data_report.report.supervisor_report",
+        method: 'POST',
+        url: '/api/api_gateway?method=data_report.report.supervisor_report',
         data: this.qs.stringify({
-          operator_user_id_list, // 非必填  任务处理人id数组  ['1', '2']
+          supervisor_user_id_list: operator_user_id_list, // 非必填  任务处理人id数组  ['1', '2']
           start_time, //月份
-          end_time, //结束
-        }),
-      }).then((res) => {
+          end_time //结束
+        })
+      }).then(res => {
         console.log(res.data.data);
         // this.useroptions = res.data.data;
         var tasklist = res.data.data;
@@ -113,104 +114,104 @@ export default {
     init(userlist, offtask) {
       let categoryData = userlist;
       let chartdata = offtask;
-      let backgroundColor = "rgba(255,255,255,1)";
+      let backgroundColor = 'rgba(255,255,255,1)';
       let itemcolor = {
-        type: "linear",
+        type: 'linear',
         colorStops: [
           {
             offset: 0,
-            color: "rgba(6, 120, 157,1)",
+            color: 'rgba(6, 120, 157,1)'
           },
           {
             offset: 0.5,
-            color: "rgba(6, 120, 157,0.2)",
+            color: 'rgba(6, 120, 157,0.2)'
           },
           {
             offset: 1,
-            color: "rgba(6, 120, 157,1)",
-          },
-        ],
+            color: 'rgba(6, 120, 157,1)'
+          }
+        ]
       };
 
       var option = {
         textStyle: {
-          color: "#c0c3cd",
-          fontSize: 14,
+          color: '#c0c3cd',
+          fontSize: 14
         },
         toolbox: {
           show: false,
           feature: {
             saveAsImage: {
-              backgroundColor: "#031245",
+              backgroundColor: '#031245'
             },
-            restore: {},
+            restore: {}
           },
           iconStyle: {
-            borderColor: "#c0c3cd",
-          },
+            borderColor: '#c0c3cd'
+          }
         },
         legend: {
           top: 10,
           itemWidth: 8,
           itemHeight: 8,
-          icon: "circle",
-          left: "center",
+          icon: 'circle',
+          left: 'center',
           padding: 0,
           textStyle: {
-            color: "#c0c3cd",
+            color: '#c0c3cd',
             fontSize: 14,
-            padding: [2, 0, 0, 0],
-          },
+            padding: [2, 0, 0, 0]
+          }
         },
-        color: ["#00D7E9", "rgba(0, 215, 233, 0.9)"],
+        color: ['#00D7E9', 'rgba(0, 215, 233, 0.9)'],
         grid: {
           containLabel: true,
           left: 40,
           right: 20,
           bottom: 40,
-          top: 40,
+          top: 40
         },
         xAxis: {
           axisLine: {
             lineStyle: {
-              color: "#999",
+              color: '#999'
             },
-            show: true,
+            show: true
           },
           axisLabel: {
-            color: "#333",
+            color: '#333',
             fontSize: 14,
             interval: 0,
-            rotate:-50
+            rotate: -50
           },
 
           data: categoryData,
-          type: "category",
+          type: 'category'
         },
         yAxis: {
           nameTextStyle: {
-            color: "#c0c3cd",
+            color: '#c0c3cd',
             padding: [0, 0, -10, 0],
-            fontSize: 14,
+            fontSize: 14
           },
           axisLabel: {
-            color: "#333",
-            fontSize: 14,
+            color: '#333',
+            fontSize: 14
           },
           axisTick: {
             lineStyle: {
-              color: "#668092",
-              width: 1,
+              color: '#668092',
+              width: 1
             },
-            show: true,
+            show: true
           },
-          name: "",
+          name: ''
         },
         series: [
           {
             data: chartdata,
-            type: "bar",
-            barMaxWidth: "auto",
+            type: 'bar',
+            barMaxWidth: 'auto',
             barWidth: 20,
             itemStyle: {
               color: {
@@ -218,52 +219,52 @@ export default {
                 y: 1,
                 x2: 0,
                 y2: 0,
-                type: "linear",
+                type: 'linear',
                 colorStops: [
                   {
                     offset: 0,
-                    color: "#00D7E9",
+                    color: '#00D7E9'
                   },
                   {
                     offset: 1,
-                    color: "rgba(0, 167, 233,0.3)",
-                  },
-                ],
-              },
+                    color: 'rgba(0, 167, 233,0.3)'
+                  }
+                ]
+              }
             },
             label: {
               show: true,
-              position: "top",
+              position: 'top',
               distance: 10,
-              color: "#00D7E9",
-            },
+              color: '#00D7E9'
+            }
           },
           {
-            data: [1, 1, 1, 1, 1, 1],
-            type: "pictorialBar",
-            barMaxWidth: "20",
-            symbol: "diamond",
-            symbolOffset: [0, "50%"],
-            symbolSize: [20, 10],
+            data: (userlist || []).map(i => 1),
+            type: 'pictorialBar',
+            barMaxWidth: '20',
+            symbol: 'diamond',
+            symbolOffset: [0, '50%'],
+            symbolSize: [20, 10]
           },
           {
             data: chartdata,
-            type: "pictorialBar",
-            barMaxWidth: "20",
+            type: 'pictorialBar',
+            barMaxWidth: '20',
 
-            symbolPosition: "end",
-            symbol: "diamond",
-            symbolOffset: [0, "-50%"],
+            symbolPosition: 'end',
+            symbol: 'diamond',
+            symbolOffset: [0, '-50%'],
             symbolSize: [20, 12],
-            zlevel: 2,
-          },
+            zlevel: 2
+          }
         ],
         tooltip: {
           show: true,
-          formatter: "{b}:{c0}",
-        },
+          formatter: '{b}:{c0}'
+        }
       };
-      echarts.init(document.getElementById("mychartpie")).setOption(option);
+      echarts.init(document.getElementById('mychartpie')).setOption(option);
     },
     pickerchange() {
       this.searchchilk();
@@ -275,14 +276,14 @@ export default {
       this.gettasklist(start_time, end_time);
     },
     timetag(i) {
-      var time = "";
+      var time = '';
       if (this.monvalue) {
         if (this.monvalue.length != 0) {
           time =
             this.monvalue[i].getFullYear() +
-            "-" +
+            '-' +
             (this.monvalue[i].getMonth() + 1 < 10
-              ? "0" + (this.monvalue[i].getMonth() + 1)
+              ? '0' + (this.monvalue[i].getMonth() + 1)
               : this.monvalue[i].getMonth() + 1);
         }
       }
@@ -290,36 +291,36 @@ export default {
       return time;
     },
     download(start_time, end_time) {
-      //   var operator_user_id_list = "";
-      //   if (this.uservalue.length != 0) {
-      //     operator_user_id_list = JSON.stringify(this.uservalue);
-      //   }
+      var operator_user_id_list = '';
+      if (this.uservalue.length != 0) {
+        operator_user_id_list = JSON.stringify(this.uservalue);
+      }
       this.disabled = true;
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=data_report.report.supervisor_export",
-        // data: this.qs.stringify({
-        //   operator_user_id_list, // 非必填  任务处理人id数组  ['1', '2']
-        //   start_time, //月份
-        //   end_time, //结束
-        // }),
-        responseType: "blob",
-      }).then((res) => {
+        method: 'POST',
+        url: '/api/api_gateway?method=data_report.report.supervisor_export',
+        data: this.qs.stringify({
+          supervisor_user_id_list: operator_user_id_list, // 非必填  任务处理人id数组  ['1', '2']
+          start_time, //月份
+          end_time //结束
+        }),
+        responseType: 'blob'
+      }).then(res => {
         console.log(res.data.data);
-        this.downloadFile(res, "监督任务统计.xls");
+        this.downloadFile(res, '监督任务统计.xls');
       });
     },
     downloadFile(res, name) {
-      let link = document.createElement("a");
+      let link = document.createElement('a');
       link.href = window.URL.createObjectURL(new Blob([res.data]));
-      link.target = "_blank";
+      link.target = '_blank';
       //文件名和格式
       link.download = name;
       document.body.appendChild(link);
       link.click();
       document.body.removeChild(link);
       this.disabled = false;
-    },
+    }
   },
   beforeCreate() {}, //生命周期 - 创建之前
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -334,7 +335,7 @@ export default {
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style lang="less" scoped>
@@ -385,4 +386,4 @@ export default {
     cursor: pointer;
   }
 }
-</style>
+</style>

+ 1 - 0
minggao/src/page/monitoring/supervisiontask.vue

@@ -6,6 +6,7 @@
         v-model="uservalue"
         multiple
         filterable
+        clearable
         placeholder="请选择任务监测人"
         size="mini"
         collapse-tags

+ 90 - 90
minggao/src/page/systemmanger/harmfulBiology.vue

@@ -118,7 +118,7 @@
                   text-overflow: ellipsis;
                 "
               >
-                {{ scope.row.describe || "无" }}
+                {{ scope.row.describe || '无' }}
               </p>
             </el-popover>
           </template>
@@ -129,7 +129,7 @@
           label="备注"
         >
           <template slot-scope="scope">
-            <span>{{ scope.row.messages || "无" }}</span>
+            <span>{{ scope.row.messages || '无' }}</span>
           </template>
         </el-table-column>
         <el-table-column prop="create_time" label="添加时间"> </el-table-column>
@@ -233,7 +233,7 @@
             size="small"
             type="primary"
             @click="submitForm"
-            >{{ submitBtn == true ? "发布中..." : "发布" }}</el-button
+            >{{ submitBtn == true ? '发布中...' : '发布' }}</el-button
           >
           <el-button size="small" @click="cancel">取消</el-button>
         </el-form-item>
@@ -250,61 +250,61 @@ export default {
     //这里存放数据
     return {
       fullHeight: document.documentElement.clientHeight - 116, //
-      input: "", // 搜索
+      input: '', // 搜索
       page: 1, //当前页码
       pageSum: 0, // 总数量
 
       // 列表
       tableData: [
         {
-          ind: "1",
-          name: "冥蛾引诱剂",
-          judge: "是",
-          judge2: "是",
-          remark: "这是一个有害虫类",
-          addDate: "2016-05-02 10:00:00",
-          endDate: "2021-01-06 10:00:00",
-        },
+          ind: '1',
+          name: '冥蛾引诱剂',
+          judge: '是',
+          judge2: '是',
+          remark: '这是一个有害虫类',
+          addDate: '2016-05-02 10:00:00',
+          endDate: '2021-01-06 10:00:00'
+        }
       ],
       loading: false, // 加载
 
       // 编辑、 添加
-      tltData: "添加有害生物",
+      tltData: '添加有害生物',
       addrInsectVisible: false,
       form: {
-        name: "", //有害生物名称
-        judge: "", // 检疫性有害生物
-        judge2: "", //是否外来入侵物种
-        remark: "", // 备注
-        level: "1",
-        describe: "",
+        name: '', //有害生物名称
+        judge: '', // 检疫性有害生物
+        judge2: '', //是否外来入侵物种
+        remark: '', // 备注
+        level: '1',
+        describe: ''
       },
       rules: {
         name: [
-          { required: true, message: "请输入有害生物名称", trigger: "blur" },
+          { required: true, message: '请输入有害生物名称', trigger: 'blur' }
           //   { min: 3, max: 5, message: "长度在 1 到 15 个字符", trigger: "blur" },
         ],
         judge: [
-          { required: true, message: "请选检疫性有害生物", trigger: "blur" },
+          { required: true, message: '请选择检疫性有害生物', trigger: 'blur' }
           //   { min: 3, max: 5, message: "长度在 1 到 15 个字符", trigger: "blur" },
         ],
         judge2: [
           {
             required: true,
-            message: "请选择是否外来入侵物种",
-            trigger: "blur",
-          },
+            message: '请选择是否外来入侵物种',
+            trigger: 'blur'
+          }
         ],
         level: [
-          { required: true, message: "请选择有害生物等级", trigger: "change" },
+          { required: true, message: '请选择有害生物等级', trigger: 'change' }
         ],
         describe: [
-          { required: true, message: "请填写活动形式", trigger: "blur" },
-        ],
+          { required: true, message: '请填写有害生物描述', trigger: 'blur' }
+        ]
       },
       insectObj: {},
       isClick: true, // 防止重复弹框
-      submitBtn: false, // 防止弹框确定按钮重复请求
+      submitBtn: false // 防止弹框确定按钮重复请求
     };
   },
   //监听属性 类似于data概念
@@ -317,7 +317,7 @@ export default {
         this.fullHeight = val;
         this.timer = true;
         let that = this;
-        setTimeout(function () {
+        setTimeout(function() {
           //防止过度调用监测事件,导致卡顿
           that.timer = false;
         }, 400);
@@ -326,16 +326,16 @@ export default {
 
     addrInsectVisible(val) {
       if (val == false) {
-        console.log("gsjdgsjdgjsgdjsgdghj");
-        this.form.name = ""; // 有害生物名称
-        this.form.judge = ""; // 检疫性有害生物
-        this.form.judge2 = ""; // 是否外来入侵物种
-        this.form.remark = ""; // 备注
-        this.form.level = "";
-        this.form.describe = "";
+
+        this.form.name = ''; // 有害生物名称
+        this.form.judge = ''; // 检疫性有害生物
+        this.form.judge2 = ''; // 是否外来入侵物种
+        this.form.remark = ''; // 备注
+        this.form.level = '';
+        this.form.describe = '';
         // this.$refs["form"].resetFields();
       }
-    },
+    }
   },
   //方法集合
   methods: {
@@ -358,22 +358,22 @@ export default {
 
     // 添加有害生物
     addrHarmfulBiology() {
-      this.tltData = "添加有害生物";
+      this.tltData = '添加有害生物';
       this.addrInsectVisible = true;
     },
 
     // 获取有害生物列表
     harmfulBiologyList() {
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=sysmenage.maintain.pest_list",
+        method: 'POST',
+        url: '/api/api_gateway?method=sysmenage.maintain.pest_list',
         data: this.qs.stringify({
           page: this.page,
-          page_item: "20",
-          pest_name: this.input,
-        }),
+          page_item: '20',
+          pest_name: this.input
+        })
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.data.total_item !== 0) {
             var data = res.data.data;
             this.pageSum = data.total_item;
@@ -391,7 +391,7 @@ export default {
           });
           this.loading = false;
         })
-        .catch((err) => {
+        .catch(err => {
           this.loading = false;
         });
     },
@@ -406,49 +406,49 @@ export default {
 
     // 编辑
     actionFunc(data) {
-      this.tltData = "编辑有害生物";
+      this.tltData = '编辑有害生物';
       this.insectObj = data;
       this.form = {
         name: data.pest_name, //有害生物名称
         judge: data.quarantine, // 检疫性有害生物
         judge2: data.alien_specie, //是否外来入侵物种
         remark: data.messages, // 备注
-        level: data.level == "" ? "1" : data.level,
-        describe: data.describe,
+        level: data.level == '' ? '1' : data.level,
+        describe: data.describe
       };
       this.addrInsectVisible = true;
     },
 
     // 删除
     deleteFunc(data) {
-      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
+      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
       })
         .then(() => {
           this.$axios({
-            method: "POST",
-            url: "/api/api_gateway?method=sysmenage.maintain.pest_delete",
+            method: 'POST',
+            url: '/api/api_gateway?method=sysmenage.maintain.pest_delete',
             data: this.qs.stringify({
-              pest_id: data.pest_id,
-            }),
-          }).then((res) => {
+              pest_id: data.pest_id
+            })
+          }).then(res => {
             console.log(res.data.data);
             if (res.data.data == true) {
-              if (document.getElementsByClassName("el-message").length == 0) {
+              if (document.getElementsByClassName('el-message').length == 0) {
                 this.$message({
-                  type: "success",
-                  message: "成功",
-                  duration: 1500,
+                  type: 'success',
+                  message: '成功',
+                  duration: 1500
                 });
               }
             } else {
-              if (document.getElementsByClassName("el-message").length == 0) {
+              if (document.getElementsByClassName('el-message').length == 0) {
                 this.$message({
-                  type: "error",
-                  message: "失败",
-                  duration: 1500,
+                  type: 'error',
+                  message: '失败',
+                  duration: 1500
                 });
               }
             }
@@ -456,10 +456,10 @@ export default {
           });
         })
         .catch(() => {
-          if (document.getElementsByClassName("el-message").length == 0) {
+          if (document.getElementsByClassName('el-message').length == 0) {
             this.$message({
-              type: "info",
-              message: "已取消删除",
+              type: 'info',
+              message: '已取消删除'
             });
           }
         });
@@ -467,21 +467,21 @@ export default {
 
     // 添加 - 编辑 确定
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           this.submitBtn = true;
-          if (this.tltData == "添加有害生物") {
-            var url = "/api/api_gateway?method=sysmenage.maintain.pest_add";
+          if (this.tltData == '添加有害生物') {
+            var url = '/api/api_gateway?method=sysmenage.maintain.pest_add';
             var postData = this.qs.stringify({
               pest_name: this.form.name,
               alien_specie: this.form.judge2,
               quarantine: this.form.judge,
               messages: this.form.remark,
               level: this.form.level,
-              describe: this.form.describe,
+              describe: this.form.describe
             });
-          } else if (this.tltData == "编辑有害生物") {
-            var url = "/api/api_gateway?method=sysmenage.maintain.pest_modify";
+          } else if (this.tltData == '编辑有害生物') {
+            var url = '/api/api_gateway?method=sysmenage.maintain.pest_modify';
             var postData = this.qs.stringify({
               pest_id: this.insectObj.pest_id,
               pest_name: this.form.name,
@@ -489,31 +489,31 @@ export default {
               quarantine: this.form.judge,
               messages: this.form.remark,
               level: this.form.level,
-              describe: this.form.describe,
+              describe: this.form.describe
             });
           }
           this.$axios({
-            method: "POST",
+            method: 'POST',
             url,
-            data: postData,
+            data: postData
           })
-            .then((res) => {
-              if (res.data.message == "") {
-                if (document.getElementsByClassName("el-message").length == 0) {
+            .then(res => {
+              if (res.data.message == '') {
+                if (document.getElementsByClassName('el-message').length == 0) {
                   this.$message({
-                    type: "success",
-                    message: "成功",
-                    duration: 1500,
+                    type: 'success',
+                    message: '成功',
+                    duration: 1500
                   });
                 }
               }
 
-              this.$refs["form"].resetFields();
+              this.$refs['form'].resetFields();
               this.addrInsectVisible = false;
               this.harmfulBiologyList();
               this.submitBtn = false;
             })
-            .catch((err) => {
+            .catch(err => {
               this.submitBtn = false;
             });
         } else {
@@ -522,9 +522,9 @@ export default {
       });
     },
     cancel() {
-      this.$refs["form"].resetFields();
+      this.$refs['form'].resetFields();
       this.addrInsectVisible = false;
-    },
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
@@ -539,7 +539,7 @@ export default {
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style lang="less" scoped>
@@ -578,8 +578,8 @@ export default {
 
 // 文本域样式更改
 /deep/.el-textarea__inner {
-  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
-    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
+  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
+    'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
 }
 
 /deep/.el-button--info {