Forráskód Böngészése

诱捕器管理更新 1/26

zhangyun 4 éve
szülő
commit
bd988f3ada

+ 330 - 0
minggao/src/page/forecasting/trap/bait.vue

@@ -0,0 +1,330 @@
+<!--  -->
+<template>
+  <div class="cbdbox">
+    <div class="cbdboxs_search">
+      <el-input
+        v-model="queryInfo.inducer_name"
+        placeholder="请输入诱剂名称"
+        size="mini"
+      ></el-input>
+      <el-button type="info" @click="search" size="mini">搜索</el-button>
+      <el-button type="info" size="mini" @click="addtraptf = true;addtitle='新增诱剂'"
+        >添加诱剂</el-button
+      >
+    </div>
+    <div class="cbdboxs_table" v-loading="loading">
+      <el-table :data="tableData" style="width: 100%" :stripe="true">
+        <el-table-column prop="index" label="序号"> </el-table-column>
+        <el-table-column
+          prop="inducer_name"
+          label="引诱剂名称"
+        ></el-table-column>
+        <el-table-column prop="expire" label="引诱剂有效天数">
+        </el-table-column>
+        <el-table-column prop="messages" label="描述"> </el-table-column>
+        <el-table-column label="操作" width="300">
+          <template slot-scope="scope">
+            <span
+              style="color: #409eff; margin-right: 5px"
+              @click="alter(scope.row)"
+              >编辑</span
+            >
+            <span
+              style="color: #409eff; margin-right: 5px"
+              @click="deletes(scope.row)"
+              >删除</span
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <el-pagination
+      background
+      layout="prev, pager, next"
+      :total="total"
+      @current-change="pageChange"
+    >
+    </el-pagination>
+    <el-dialog :title="addtitle" :visible.sync="addtraptf" width="30%" @close="resetForm('ruleForm')">
+      <div>
+        <el-form
+          :model="ruleForm"
+          :rules="rules"
+          ref="ruleForm"
+          label-width="100px"
+          class="demo-ruleForm"
+        >
+          <el-form-item label="诱剂名称" prop="inducer_name">
+            <el-input v-model="ruleForm.inducer_name"></el-input>
+          </el-form-item>
+          <el-form-item label="有效期天数" prop="expire">
+            <el-input v-model="ruleForm.expire"></el-input>
+          </el-form-item>
+          <el-form-item label="诱剂描述" prop="messages">
+            <el-input type="textarea" v-model="ruleForm.messages"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="resetForm('ruleForm')" size="mini">取 消</el-button>
+        <el-button type="primary" @click="submitForm('ruleForm')" size="mini"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: {},
+  data() {
+    //这里存放数据
+    var checklnglat = (rule, value, callback) => {
+      if (isNaN(value)) {
+        callback(new Error("请输入数字值"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      tableData: [],
+      queryInfo: {
+        page: 1,
+        inducer_name: "",
+      },
+      total: 10,
+      loading: false,
+      //新增诱剂
+      addtraptf: false, //弹框开关
+      ruleForm: {
+        //验证
+        inducer_name: "",
+        expire: "",
+        messages: "",
+        inducer_id:""
+      },
+      rules: {
+        inducer_name: [
+          { required: true, message: "请输入活动名称", trigger: "blur" },
+        ],
+        expire: [
+          { required: true, message: "请输入活动名称", trigger: "blur" },
+          { validator: checklnglat, trigger: "blur" },
+        ],
+        messages: [
+          { required: true, message: "请输入活动名称", trigger: "blur" },
+        ],
+      },
+      addtitle: "新增诱剂",
+    };
+  },
+  //监听属性 类似于data概念
+  computed: {},
+  //监控data中的数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    getcbdlist() {
+      //获取设备列表
+      this.loading = true;
+      this.$axios({
+        method: "POST",
+        url: "/api/api_gateway?method=monitor_manage.maintain.inducer_list",
+        data: this.qs.stringify({
+          page_size: 10,
+          page: this.queryInfo.page,
+          inducer_name: this.queryInfo.inducer_name, //              非必传(string)     诱剂名称 搜索项
+        }),
+      }).then((res) => {
+        this.loading = false;
+        console.log(res.data.data);
+        this.total = res.data.data.total_item;
+        this.tableData = res.data.data.page_list;
+        for (var i = 0; i < this.tableData.length; i++) {
+          this.tableData[i]["index"] = i + 1;
+        }
+      });
+    },
+    search() {
+      this.getcbdlist();
+    },
+    pageChange(e) {
+      // console.log(e)
+      this.queryInfo.page = e;
+      this.getcbdlist();
+    },
+    alter(events) {
+      this.addtitle = "修改诱剂";
+      this.addtraptf = true;
+      for (var key in this.ruleForm) {
+        this.ruleForm[key] = events[key];
+      }
+    }, //修改
+    deletes(events) {
+      //删除
+      //删除诱捕器
+      console.log(events);
+      var str = "您确定删除<" + events.inducer_name + ">吗?";
+      this.$confirm(str, "删除诱剂", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+      })
+        .then(() => {
+          this.$axios({
+            method: "POST",
+            url: "/api/api_gateway?method=monitor_manage.maintain.inducer_delete",
+            data: this.qs.stringify({
+              inducer_id: events.inducer_id,
+            }),
+          }).then((res) => {
+            console.log(res);
+            if (res.data.data) {
+              this.$message({
+                showClose: true,
+                message: "删除成功!",
+                type: "success",
+              });
+              this.getcbdlist();
+            } else {
+              this.$message({
+                showClose: true,
+                message: "删除失败," + res.data.message,
+                type: "warning",
+              });
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    submitForm(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          if (this.addtitle == "修改诱剂") {
+            this.$axios({
+              method: "POST",
+              url: "/api/api_gateway?method=monitor_manage.maintain.inducer_modify",
+              data: this.qs.stringify({
+                inducer_id:this.ruleForm.inducer_id,
+                inducer_name: this.ruleForm.inducer_name,
+                expire: Number(this.ruleForm.expire),
+                messages: this.ruleForm.messages,
+              }),
+            }).then((res) => {
+              console.log(res);
+              if (res.data.data) {
+                this.$message({
+                  showClose: true,
+                  message: "修改成功!",
+                  type: "success",
+                });
+                this.addtraptf = false;
+                this.getcbdlist();
+                this.$refs[formName].resetFields();
+              } else {
+                this.$message({
+                  showClose: true,
+                  message: "修改失败" + res.data.message,
+                  type: "warning",
+                });
+              }
+            });
+          } else if (this.addtitle == "新增诱剂") {
+            this.$axios({
+              method: "POST",
+              url: "/api/api_gateway?method=monitor_manage.maintain.inducer_add",
+              data: this.qs.stringify({
+                inducer_name: this.ruleForm.inducer_name,
+                expire: this.ruleForm.expire,
+                messages: this.ruleForm.messages,
+              }),
+            }).then((res) => {
+              console.log(res);
+              if (res.data.data) {
+                this.$message({
+                  showClose: true,
+                  message: "新增成功!",
+                  type: "success",
+                });
+                this.addtraptf = false;
+                this.getcbdlist();
+                this.$refs[formName].resetFields();
+              } else {
+                this.$message({
+                  showClose: true,
+                  message: "添加失败" + res.data.message,
+                  type: "warning",
+                });
+              }
+            });
+          }
+        } else {
+          // console.log("error submit!!");
+          // this.$refs[formName].resetFields();
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.addtraptf = false;
+      this.$refs[formName].resetFields();
+    },
+    dioclose(){
+      console.log(111)
+      // this.$refs[formName].resetFields();
+    }
+  },
+  beforeCreate() {}, //生命周期 - 创建之前
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  beforeMount() {}, //生命周期 - 挂载之前
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    this.getcbdlist();
+  },
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
+</script>
+<style scoped lang="less">
+.cbdboxs_search {
+  display: flex;
+  justify-content: flex-start;
+  // height: 40px;
+  /deep/.el-select {
+    width: 220px;
+    margin-right: 15px;
+  }
+  /deep/.el-input {
+    width: 220px;
+    margin-right: 15px;
+  }
+  /deep/.el-date-editor {
+    width: 250px !important;
+    margin-right: 15px;
+  }
+}
+.cbdboxs_table {
+  margin-top: 15px;
+  /deep/.el-table__header-wrapper {
+    th {
+      background-color: #fafafa;
+    }
+  }
+}
+/deep/.el-button--info {
+  background-color: #409eff;
+  border-color: #409eff;
+}
+</style>

+ 168 - 86
minggao/src/page/forecasting/trap/fillinrecord.vue

@@ -2,69 +2,63 @@
 <template>
 <template>
   <div class="cbdbox">
   <div class="cbdbox">
     <div class="cbdboxs_search">
     <div class="cbdboxs_search">
-      <el-input v-model="idinput" placeholder="请输入设备ID"></el-input>
-      <el-select v-model="inoffvalue" placeholder="请选择所在监测点">
+      <el-input v-model="idinput" placeholder="请输入诱捕器ID" size="mini"></el-input>
+      <el-input v-model="nameinput" placeholder="请输入填报人" size="mini"></el-input>
+      <el-select v-model="inoffvalue" placeholder="请选择所在监测点" size="mini">
         <el-option
         <el-option
           v-for="item in inoffoptions"
           v-for="item in inoffoptions"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
+          :key="item.point_id"
+          :label="item.point_name"
+          :value="item.point_id"
         >
         >
         </el-option>
         </el-option>
       </el-select>
       </el-select>
-      <el-select v-model="versionsvalue" placeholder="请选择组织">
+      <!-- <el-select v-model="versionsvalue" placeholder="请选择隶属海关" size="mini">
         <el-option
         <el-option
           v-for="item in versionsoptions"
           v-for="item in versionsoptions"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
+          :key="item.org_id"
+          :label="item.org_name"
+          :value="item.org_id"
         >
         >
         </el-option>
         </el-option>
-      </el-select>
-      <el-select v-model="versionsvalue" placeholder="请选择诱捕器">
-        <el-option
-          v-for="item in versionsoptions"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
-        >
-        </el-option>
-      </el-select>
-      <el-button type="info" @click="search">搜索</el-button>
-      <el-button>重置</el-button>
-      <el-button type="info">添加诱捕器</el-button>
-      <el-button type="info">批量导入诱捕器</el-button>
-      <el-button type="info">导出数据</el-button>
+      </el-select> -->
+      <el-cascader
+        :change-on-select="true"
+        :options="versionsoptions"
+        v-model="versionsvalue"
+        :props="defaultParams"
+        :clearable="true"
+        size="mini"
+        placeholder="请选择隶属海关"
+      ></el-cascader>
+      <el-date-picker
+        v-model="timevalue"
+        type="daterange"
+        range-separator="至"
+        start-placeholder="开始日期"
+        end-placeholder="结束日期"
+        @change="oickchange"
+        size="mini"
+      >
+      </el-date-picker>
+      <el-button type="info" @click="search" size="mini">搜索</el-button>
+      <el-button @click="reset" size="mini">重置</el-button>
+      <el-button type="info" size="mini" @click="deriveVisible = true">导出数据</el-button>
     </div>
     </div>
     <div class="cbdboxs_table" v-loading="loading">
     <div class="cbdboxs_table" v-loading="loading">
       <el-table :data="tableData" style="width: 100%" :stripe="true">
       <el-table :data="tableData" style="width: 100%" :stripe="true">
         <el-table-column prop="index" label="序号"> </el-table-column>
         <el-table-column prop="index" label="序号"> </el-table-column>
         <el-table-column prop="trap_number" label="编号"></el-table-column>
         <el-table-column prop="trap_number" label="编号"></el-table-column>
-        <el-table-column prop="lng" label="经度"> </el-table-column>
-        <el-table-column prop="lat" label="纬度"> </el-table-column>
         <el-table-column prop="org_name" label="组织"> </el-table-column>
         <el-table-column prop="org_name" label="组织"> </el-table-column>
         <el-table-column prop="point_name" label="监测点"> </el-table-column>
         <el-table-column prop="point_name" label="监测点"> </el-table-column>
         <el-table-column prop="inducer_name" label="诱剂"> </el-table-column>
         <el-table-column prop="inducer_name" label="诱剂"> </el-table-column>
-        <el-table-column prop="create_time" label="添加时间" width="200">
+        <el-table-column prop="pest_name" label="有害生物"> </el-table-column>
+        <el-table-column prop="pest_number" label="有害生物数量">
         </el-table-column>
         </el-table-column>
-        <el-table-column prop="is_online" label="状态">
-          <template slot-scope="scope">
-            <p>·{{ scope.row.trap_status == "1" ? "正常" : "停用" }}</p>
-          </template>
+        <el-table-column prop="user_name" label="填报人"> </el-table-column>
+        <el-table-column prop="report_status" label="填报渠道">
         </el-table-column>
         </el-table-column>
-        <el-table-column label="操作" width="300">
-          <template slot-scope="scope">
-            <span
-              style="color: #409eff; margin-right: 5px"
-              @click="viewPhotoDialog(scope.row)"
-              >编辑</span
-            >
-            <span
-              style="color: #409eff; margin-right: 5px"
-              @click="showTimeControlDialog(scope.row)"
-              >删除</span
-            >
-          </template>
+        <el-table-column prop="create_time" label="填报时间" width="200">
         </el-table-column>
         </el-table-column>
       </el-table>
       </el-table>
     </div>
     </div>
@@ -75,6 +69,22 @@
       @current-change="pageChange"
       @current-change="pageChange"
     >
     >
     </el-pagination>
     </el-pagination>
+    <el-dialog title="提示" :visible.sync="deriveVisible" width="30%">
+      <div class="derivebox">
+        <p><span>*</span>文件名称:</p>
+        <el-input
+          v-model="derivefilename"
+          placeholder="请输入文件名称"
+          size="mini"
+        ></el-input>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="deriveVisible = false" size="mini">取 消</el-button>
+        <el-button type="primary" @click="deriveclick" size="mini"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -88,31 +98,32 @@ export default {
     //这里存放数据
     //这里存放数据
     return {
     return {
       idinput: "",
       idinput: "",
+      nameinput: "",
       inoffvalue: "",
       inoffvalue: "",
-      inoffoptions: [
-        { label: "在线", value: "0" },
-        { label: "离线", value: "1" },
-      ],
+      inoffoptions: [],
       versionsvalue: "",
       versionsvalue: "",
-      versionsoptions: [
-        { label: "全部", value: "" },
-        { label: "版本1", value: "1" },
-        { label: "版本2", value: "2" },
-        { label: "版本3", value: "3" },
-        { label: "版本4", value: "4" },
-        { label: "版本5", value: "5" },
-      ],
+      versionsoptions: [],
       queryInfo: {
       queryInfo: {
         page: 1,
         page: 1,
-        is_online: "",
-        ename: "",
-        f_id: "",
-        dver: "",
+        trap_number: "", //   设备编号 搜索项
+        point_name: "", //       设备所属监测点 搜索项
+        org_name: "", //         设备所属组织   搜索项
+        user_name: "", //        填报人名字 搜索项
+        start_time: "", //       开始时间 搜索项
+        end_time: "", //         结束时间 搜索项
       },
       },
       tableData: [],
       tableData: [],
       device_id: "",
       device_id: "",
       total: 10,
       total: 10,
       loading: false,
       loading: false,
+      timevalue: "",//时间段
+      deriveVisible:false,//导出弹框
+      derivefilename:"",//导出文件名称
+      defaultParams: {
+        label: "org_name",
+        value: "id",
+        children: "childrens",
+      },
     };
     };
   },
   },
   //监听属性 类似于data概念
   //监听属性 类似于data概念
@@ -121,54 +132,109 @@ export default {
   watch: {},
   watch: {},
   //方法集合
   //方法集合
   methods: {
   methods: {
-    getcbdlist() {//获取设备列表
+    getcbdlist() {
+      //获取设备列表
       this.loading = true;
       this.loading = true;
       this.$axios({
       this.$axios({
         method: "POST",
         method: "POST",
-        url: "/api/api_gateway?method=monitor_manage.trap_manage.trap_list",
+        url: "/api/api_gateway?method=monitor_manage.trap_manage.trap_pest_record",
         data: this.qs.stringify({
         data: this.qs.stringify({
           page_size: 10,
           page_size: 10,
           page: this.queryInfo.page,
           page: this.queryInfo.page,
-          trap_number: this.queryInfo.f_id,
+          trap_number: this.queryInfo.trap_number, //              非必传(string)               设备编号 搜索项
+          point_name: this.queryInfo.point_name, //                  非必传(string)               设备所属监测点 搜索项
+          org_name: this.queryInfo.org_name, //                    非必传(string)               设备所属组织   搜索项
+          user_name: this.queryInfo.user_name, //                   非必传(string)               填报人名字 搜索项
+          start_time: this.queryInfo.start_time, //                  非必传(string)               开始时间 搜索项
+          end_time: this.queryInfo.end_time, //                    非必传(string)               结束时间 搜索项
         }),
         }),
       }).then((res) => {
       }).then((res) => {
         this.loading = false;
         this.loading = false;
         console.log(res.data.data);
         console.log(res.data.data);
-        this.total = res.data.data.total_item;
+        this.total = res.data.data.pest_num;
         this.tableData = res.data.data.trap_data;
         this.tableData = res.data.data.trap_data;
         for (var i = 0; i < this.tableData.length; i++) {
         for (var i = 0; i < this.tableData.length; i++) {
           this.tableData[i]["index"] = i + 1;
           this.tableData[i]["index"] = i + 1;
         }
         }
       });
       });
     },
     },
-    getmon(){//获取监测点列表
-      this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=monitor_manage.maintain.checkpoint_list",
-      }).then((res) => {
-        console.log(res.data.data);
-      });
-    },
-    getorgin(){//获取组织列表
+    getmon() {
+      //获取监测点列表 组织列表
       this.$axios({
       this.$axios({
         method: "POST",
         method: "POST",
         url: "/api/api_gateway?method=sysmenage.usermanager.org_list",
         url: "/api/api_gateway?method=sysmenage.usermanager.org_list",
       }).then((res) => {
       }).then((res) => {
         console.log(res.data.data);
         console.log(res.data.data);
+        this.versionsoptions = res.data.data.page_list; //组织
+        this.inoffoptions = res.data.data.point_data;
       });
       });
     },
     },
     search() {
     search() {
-      this.queryInfo.f_id = this.idinput;
-      this.queryInfo.is_online = this.inoffvalue;
-      this.queryInfo.dver = this.versionsvalue;
+      this.queryInfo.trap_number = this.idinput;
+      this.queryInfo.user_name = this.nameinput;
+      this.queryInfo.point_name = this.inoffoptions[this.inoffvalue - 1].point_name;
+      this.queryInfo.org_name = this.versionsvalue[this.versionsvalue.length - 1];
       // console.log(this.inoffvalue,this.versionsvalue)
       // console.log(this.inoffvalue,this.versionsvalue)
       this.getcbdlist();
       this.getcbdlist();
     },
     },
+    oickchange(e) {//搜索时间段
+      console.log(e);
+      this.queryInfo.start_time = this.tabtime(e[0]);
+      this.queryInfo.end_time = this.tabtime(e[1]);
+    },
+    tabtime(times){//时间转换
+        var years = times.getFullYear()
+        var month = times.getMonth()+1
+        var date =  times.getDate()
+        return years+"-"+month+"-"+date
+    },
     pageChange(e) {
     pageChange(e) {
       // console.log(e)
       // console.log(e)
       this.queryInfo.page = e;
       this.queryInfo.page = e;
       this.getcbdlist();
       this.getcbdlist();
     },
     },
+    reset() {//重置
+      this.idinput = "";
+      this.nameinput = "";
+      this.inoffvalue = "";
+      this.versionsvalue = "";
+      this.timevalue=""
+      this.queryInfo.start_time = "";
+      this.queryInfo.end_time = "";
+      this.getcbdlist();
+    },
+    downloadFile(res, name) {
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(new Blob([res.data]));
+      link.target = "_blank";
+      //文件名和格式
+      link.download = name;
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+    },
+    deriveclick() {
+      // this.deriveVisible = false;
+      this.$axios({
+        method: "POST",
+        url: "/api/pest_export",
+        data: this.qs.stringify({
+          trap_number: this.queryInfo.trap_number,
+          point_name: this.queryInfo.point_name,
+          org_name: this.queryInfo.org_name,
+          trap_status: this.queryInfo.trap_status,
+          file_name: this.derivefilename,
+          start_time:this.queryInfo.start_time,
+          end_time:this.queryInfo.end_time,
+          user_name:this.queryInfo.user_name,
+          user: localStorage.getItem("usernme"),
+        }),
+         responseType: "blob",
+      }).then((res) => {
+        console.log(res)
+        this.downloadFile(res, this.derivefilename+".xls");
+      });
+    },
   },
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeCreate() {}, //生命周期 - 创建之前
   //生命周期 - 创建完成(可以访问当前this实例)
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -176,8 +242,7 @@ export default {
   beforeMount() {}, //生命周期 - 挂载之前
   beforeMount() {}, //生命周期 - 挂载之前
   //生命周期 - 挂载完成(可以访问DOM元素)
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
   mounted() {
-    this.getmon()
-    this.getorgin()
+    this.getmon();
     this.getcbdlist();
     this.getcbdlist();
   },
   },
   beforeUpdate() {}, //生命周期 - 更新之前
   beforeUpdate() {}, //生命周期 - 更新之前
@@ -191,13 +256,17 @@ export default {
 .cbdboxs_search {
 .cbdboxs_search {
   display: flex;
   display: flex;
   justify-content: flex-start;
   justify-content: flex-start;
-  height: 40px;
-  .el-select {
-    width: 250px;
+  // height: 40px;
+  /deep/.el-select {
+    width: 220px;
     margin-right: 15px;
     margin-right: 15px;
   }
   }
-  .el-input {
-    width: 250px;
+  /deep/.el-input {
+    width: 220px;
+    margin-right: 15px;
+  }
+  /deep/.el-date-editor {
+    width: 250px !important;
     margin-right: 15px;
     margin-right: 15px;
   }
   }
 }
 }
@@ -209,8 +278,21 @@ export default {
     }
     }
   }
   }
 }
 }
-/deep/.el-button--info{
-  background-color: #409EFF;
-    border-color: #409EFF;
+.derivebox {
+  display: flex;
+  p {
+    width: 100px;
+    line-height: 28px;
+    span {
+      color: red;
+    }
+  }
+  .el-input {
+    width: 250px;
+  }
+}
+/deep/.el-button--info {
+  background-color: #409eff;
+  border-color: #409eff;
 }
 }
 </style>
 </style>

+ 497 - 19
minggao/src/page/forecasting/trap/trap.vue

@@ -2,8 +2,12 @@
 <template>
 <template>
   <div class="cbdbox">
   <div class="cbdbox">
     <div class="cbdboxs_search">
     <div class="cbdboxs_search">
-      <el-input v-model="idinput" placeholder="请输入设备ID"></el-input>
-      <el-select v-model="trapvalue" placeholder="请选择所在监测点">
+      <el-input
+        v-model="idinput"
+        placeholder="请输入诱捕器编号"
+        size="mini"
+      ></el-input>
+      <el-select v-model="trapvalue" placeholder="请选择所在监测点" size="mini">
         <el-option
         <el-option
           v-for="item in traponsoptions"
           v-for="item in traponsoptions"
           :key="item.point_id"
           :key="item.point_id"
@@ -12,7 +16,11 @@
         >
         >
         </el-option>
         </el-option>
       </el-select>
       </el-select>
-      <el-select v-model="versionsvalue" placeholder="请选择组织">
+      <!-- <el-select
+        v-model="versionsvalue"
+        placeholder="请选择隶属海关"
+        size="mini"
+      >
         <el-option
         <el-option
           v-for="item in versionsoptions"
           v-for="item in versionsoptions"
           :key="item.org_id"
           :key="item.org_id"
@@ -20,8 +28,22 @@
           :value="item.org_id"
           :value="item.org_id"
         >
         >
         </el-option>
         </el-option>
-      </el-select>
-      <el-select v-model="inoffvalue" placeholder="请选择诱捕器状态">
+      </el-select> -->
+      <el-cascader
+        :change-on-select="true"
+        :options="versionsoptions"
+        v-model="versionsvalue"
+        :props="defaultParams"
+        :clearable="true"
+        @change="cascaderchange"
+        size="mini"
+        placeholder="请选择隶属海关"
+      ></el-cascader>
+      <el-select
+        v-model="inoffvalue"
+        placeholder="请选择诱捕器状态"
+        size="mini"
+      >
         <el-option
         <el-option
           v-for="item in inoffoptions"
           v-for="item in inoffoptions"
           :key="item.value"
           :key="item.value"
@@ -30,11 +52,23 @@
         >
         >
         </el-option>
         </el-option>
       </el-select>
       </el-select>
-      <el-button type="info" @click="search">搜索</el-button>
-      <el-button>重置</el-button>
-      <el-button type="info">添加诱捕器</el-button>
-      <el-button type="info">批量导入诱捕器</el-button>
-      <el-button type="info">导出数据</el-button>
+      <el-button type="info" @click="search" size="mini">搜索</el-button>
+      <el-button size="mini" @click="reset">重置</el-button>
+      <el-button
+        type="info"
+        @click="
+          addtraptf = true;
+          parameter = 'add';
+        "
+        size="mini"
+        >添加诱捕器</el-button
+      >
+      <el-button type="info" @click="downloadtf = true" size="mini"
+        >批量导入诱捕器</el-button
+      >
+      <el-button type="info" size="mini" @click="deriveVisible = true"
+        >导出数据</el-button
+      >
     </div>
     </div>
     <div class="cbdboxs_table" v-loading="loading">
     <div class="cbdboxs_table" v-loading="loading">
       <el-table :data="tableData" style="width: 100%" :stripe="true">
       <el-table :data="tableData" style="width: 100%" :stripe="true">
@@ -49,19 +83,34 @@
         </el-table-column>
         </el-table-column>
         <el-table-column prop="is_online" label="状态">
         <el-table-column prop="is_online" label="状态">
           <template slot-scope="scope">
           <template slot-scope="scope">
-            <p>·{{ scope.row.trap_status == "1" ? "正常" : "停用" }}</p>
+            <div class="state">
+              <p
+                :style="{
+                  color: scope.row.trap_status == '1' ? '#30A031 ' : 'red',
+                }"
+              >
+                ·
+              </p>
+              <p
+                :style="{
+                  color: scope.row.trap_status == '1' ? '#30A031 ' : 'red',
+                }"
+              >
+                {{ scope.row.trap_status == "1" ? "正常" : "停用" }}
+              </p>
+            </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         <el-table-column label="操作" width="300">
         <el-table-column label="操作" width="300">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <span
             <span
               style="color: #409eff; margin-right: 5px"
               style="color: #409eff; margin-right: 5px"
-              @click="viewPhotoDialog(scope.row)"
+              @click="addtrap(scope.row)"
               >编辑</span
               >编辑</span
             >
             >
             <span
             <span
               style="color: #409eff; margin-right: 5px"
               style="color: #409eff; margin-right: 5px"
-              @click="showTimeControlDialog(scope.row)"
+              @click="deletes(scope.row)"
               >删除</span
               >删除</span
             >
             >
           </template>
           </template>
@@ -75,6 +124,139 @@
       @current-change="pageChange"
       @current-change="pageChange"
     >
     >
     </el-pagination>
     </el-pagination>
+    <el-dialog :title="addtitle" :visible.sync="addtraptf" width="30%" @close="resetForm('ruleForm')">
+      <div>
+        <el-form
+          :model="ruleForm"
+          :rules="rules"
+          ref="ruleForm"
+          label-width="100px"
+          class="demo-ruleForm"
+        >
+          <el-form-item label="诱捕器编号" prop="trap_number">
+            <el-input v-model="ruleForm.trap_number"></el-input>
+          </el-form-item>
+
+          <div class="addtrapbox">
+            <el-form-item label="所在纬度" prop="lng">
+              <el-input v-model="ruleForm.lng"></el-input>
+            </el-form-item>
+            <el-form-item label="所在纬度" prop="lat">
+              <el-input v-model="ruleForm.lat"></el-input>
+            </el-form-item>
+          </div>
+          <el-form-item label="隶属海关" prop="org_id">
+            <!-- <el-select v-model="ruleForm.org_id" placeholder="请选择隶属海关">
+              <el-option
+                v-for="item in versionsoptions"
+                :label="item.org_name"
+                :value="item.org_id"
+                :key="item.org_id"
+              ></el-option>
+            </el-select> -->
+            <el-cascader
+              :change-on-select="true"
+              v-model="ruleForm.org_id"
+              :options="versionsoptions"
+              :props="defaultParams"
+              :clearable="true"
+              placeholder="请选择隶属海关"
+              size="mini"
+            ></el-cascader>
+          </el-form-item>
+          <el-form-item label="所在监测点" prop="point_id">
+            <el-select
+              v-model="ruleForm.point_id"
+              placeholder="请选择所在监测点"
+            >
+              <el-option
+                v-for="item in traponsoptions"
+                :label="item.point_name"
+                :value="item.point_id"
+                :key="item.point_id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="诱剂名称" prop="inducer_id">
+            <el-select
+              v-model="ruleForm.inducer_id"
+              placeholder="请选择诱剂名称"
+            >
+              <el-option
+                v-for="item in inducer_data"
+                :label="item.inducer_name"
+                :value="item.inducer"
+                :key="item.inducer"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="设备状态" prop="trap_status">
+            <el-radio-group
+              v-model="ruleForm.trap_status"
+              placeholder="请选择设备状态"
+            >
+              <el-radio label="1">正常</el-radio>
+              <el-radio label="0">停用</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="resetForm('ruleForm')" size="mini">取 消</el-button>
+        <el-button type="primary" @click="submitForm('ruleForm')" size="mini"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
+    <el-dialog title="提示" :visible.sync="downloadtf" width="25%">
+      <div class="downloadbox">
+        <div class="downloadbox_item">
+          <p class="title">导入诱捕器</p>
+          <!-- <el-input placeholder="请输入内容" v-model="input1">
+          <template slot="prepend">Http://</template>
+        </el-input> -->
+          <el-upload
+            action=""
+            :auto-upload="false"
+            accept=".xlsx, .xls"
+            :show-file-list="false"
+            :on-change="handle"
+          >
+            <el-button type="success" size="mini">点击上传</el-button>
+          </el-upload>
+          <el-input
+            v-model="downloadinput"
+            placeholder="请输入内容"
+            :disabled="true"
+            size="mini"
+          ></el-input>
+        </div>
+        <p class="tishi">
+          <span>注:请先下模板,在模板中填入数据上传</span
+          ><span @click="download">下载模板</span>
+        </p>
+      </div>
+      <!-- <span slot="footer" class="dialog-footer">
+        <el-button @click="downloadtf = false">取 消</el-button>
+        <el-button type="primary" @click="downloadtf = false">确 定</el-button>
+      </span> -->
+    </el-dialog>
+    <el-dialog title="提示" :visible.sync="deriveVisible" width="30%">
+      <div class="derivebox">
+        <p><span>*</span>文件名称:</p>
+        <el-input
+          v-model="derivefilename"
+          placeholder="请输入文件名称"
+          size="mini"
+        ></el-input>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="deriveVisible = false" size="mini">取 消</el-button>
+        <el-button type="primary" @click="deriveclick" size="mini"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -86,6 +268,20 @@ export default {
   components: {},
   components: {},
   data() {
   data() {
     //这里存放数据
     //这里存放数据
+    var checkname = (rule, value, callback) => {
+      if (/^[A-Za-z0-9\u4e00-\u9fa5]+$/.test(value)) {
+        callback();
+      } else {
+        callback(new Error("请输入非中文格式"));
+      }
+    };
+    var checklnglat = (rule, value, callback) => {
+      if (isNaN(value)) {
+        callback(new Error("请输入数字值"));
+      } else {
+        callback();
+      }
+    };
     return {
     return {
       idinput: "",
       idinput: "",
       inoffvalue: "",
       inoffvalue: "",
@@ -94,9 +290,16 @@ export default {
         { label: "正常", value: "1" },
         { label: "正常", value: "1" },
       ],
       ],
       versionsvalue: "",
       versionsvalue: "",
+      versionsvalue1: "", //组织id
       versionsoptions: [], //组织
       versionsoptions: [], //组织
+      defaultParams: {
+        label: "org_name",
+        value: "id",
+        children: "childrens",
+      },
       trapvalue: "",
       trapvalue: "",
       traponsoptions: [], //监测点
       traponsoptions: [], //监测点
+      inducer_data: [],
       queryInfo: {
       queryInfo: {
         page: 1,
         page: 1,
         point_id: "", //监测点id
         point_id: "", //监测点id
@@ -108,12 +311,65 @@ export default {
       device_id: "",
       device_id: "",
       total: 10,
       total: 10,
       loading: false,
       loading: false,
+      addtraptf: false, //增加诱捕器弹框
+      ruleForm: {
+        trap_id: "", //诱捕器id 修改时用到
+        trap_number: "", //诱捕器编号
+        lat: "", //           必传(string)               纬度
+        lng: "", //      必传(string)               经度
+        org_id: "", //     必传(string)               所属海关id
+        inducer_id: "", //     必传(string)               诱剂id
+        point_id: "", //     必传(string)               所属监测点id
+        trap_status: "", //    必传(string)               设备状态0停用 1正常
+      },
+      rules: {
+        trap_number: [
+          { required: true, message: "请输入诱捕器编号", trigger: "blur" },
+          { validator: checkname, trigger: "blur" },
+        ],
+        lng: [
+          { required: true, message: "请输入经度", trigger: "blur" },
+          { validator: checklnglat, trigger: "blur" },
+        ],
+        lat: [
+          { required: true, message: "请输入纬度", trigger: "blur" },
+          { validator: checklnglat, trigger: "blur" },
+        ],
+        org_id: [
+          { required: true, message: "请选择隶属海关", trigger: "change" },
+        ],
+        point_id: [
+          { required: true, message: "请选择所在监测点", trigger: "change" },
+        ],
+        inducer_id: [
+          { required: true, message: "请选择诱剂名称", trigger: "change" },
+        ],
+        trap_status: [
+          { required: true, message: "请选择设备状态", trigger: "change" },
+        ],
+      },
+      parameter: "",
+      addtitle: "新增诱捕器",
+      downloadtf: false,
+      downloadinput: "", //上传的文件名
+      deriveVisible: false, //导出弹框
+      derivefilename: "", //导出文件名称
     };
     };
   },
   },
   //监听属性 类似于data概念
   //监听属性 类似于data概念
   computed: {},
   computed: {},
   //监控data中的数据变化
   //监控data中的数据变化
-  watch: {},
+  watch: {
+    parameter: function (e) {
+      // console.log(e);
+      if (e == "add") {
+        // console.log(this.$data.addtitle)
+        this.$data.addtitle = "新增诱捕器";
+      } else if (e == "modify") {
+        this.$data.addtitle = "修改诱捕器";
+      }
+    },
+  },
   //方法集合
   //方法集合
   methods: {
   methods: {
     getcbdlist() {
     getcbdlist() {
@@ -144,19 +400,25 @@ export default {
       //获取监测点列表 组织列表
       //获取监测点列表 组织列表
       this.$axios({
       this.$axios({
         method: "POST",
         method: "POST",
-        url: "/api/api_gateway?method=monitor_manage.trap_manage.trap_org",
+        url: "/api/api_gateway?method=sysmenage.usermanager.org_list",
       }).then((res) => {
       }).then((res) => {
         console.log(res.data.data);
         console.log(res.data.data);
-        this.versionsoptions = res.data.data.org_data; //组织
+        this.versionsoptions = res.data.data.page_list; //组织
         this.traponsoptions = res.data.data.point_data;
         this.traponsoptions = res.data.data.point_data;
+        this.inducer_data = res.data.data.inducer_data;
       });
       });
     },
     },
+    cascaderchange(e) {
+      // console.log(this.versionsvalue, e);
+      console.log(e[e.length - 1]);
+      this.versionsvalue1 = e[e.length - 1];
+    },
     search() {
     search() {
       this.queryInfo.point_id = this.trapvalue;
       this.queryInfo.point_id = this.trapvalue;
       this.queryInfo.trap_number = this.idinput;
       this.queryInfo.trap_number = this.idinput;
-      this.queryInfo.org_id = this.versionsvalue;
+      this.queryInfo.org_id = this.versionsvalue1;
       this.queryInfo.trap_status = this.inoffvalue;
       this.queryInfo.trap_status = this.inoffvalue;
-      console.log(this.inoffvalue,this.versionsvalue,this.inoffvalue)
+      // console.log(this.inoffvalue, this.versionsvalue, this.inoffvalue);
       this.getcbdlist();
       this.getcbdlist();
     },
     },
     pageChange(e) {
     pageChange(e) {
@@ -164,6 +426,173 @@ export default {
       this.queryInfo.page = e;
       this.queryInfo.page = e;
       this.getcbdlist();
       this.getcbdlist();
     },
     },
+    submitForm(formName) {
+      console.log(this.ruleForm);
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.$axios({
+            method: "POST",
+            url: "/api/api_gateway?method=monitor_manage.trap_manage.add_trap",
+            data: this.qs.stringify({
+              trap_id: this.ruleForm.trap_id, //                  非必传(num)                诱捕器id 修改项
+              trap_number: this.ruleForm.trap_number, //               必传(string)               设备编号
+              lat: this.ruleForm.lat, //                       必传(string)               纬度
+              lng: this.ruleForm.lng, //                       必传(string)               经度
+              org_id: this.ruleForm.org_id[this.ruleForm.org_id.length - 1], //                    必传(string)               所属海关id
+              inducer_id: this.ruleForm.inducer_id, //                必传(string)               诱剂id
+              point_id: this.ruleForm.point_id, //                  必传(string)               所属监测点id
+              trap_status: this.ruleForm.trap_status, //               必传(string)               设备状态0停用 1正常
+              parameter: this.parameter,
+            }),
+          }).then((res) => {
+            console.log(res);
+            if (res.data.data) {
+              var message = "";
+              if (this.parameter == "add") {
+                // console.log(this.$data.addtitle)
+                message = "添加成功!";
+              } else if (this.parameter == "modify") {
+                message = "修改成功!";
+              }
+              this.$message({
+                showClose: true,
+                message: message,
+                type: "success",
+              });
+              this.addtraptf = false;
+              this.getcbdlist();
+            } else {
+              this.$message({
+                showClose: true,
+                message: "添加失败" + res.data.message,
+                type: "warning",
+              });
+            }
+          });
+        } else {
+          this.$message({
+            message: "请将信息填写完全",
+            type: "warning",
+          });
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.addtraptf = false;
+      this.$refs[formName].resetFields();
+    },
+    addtrap(e) {
+      //增加诱捕器
+      console.log(e);
+      // this.
+      for (var key in this.ruleForm) {
+        this.ruleForm[key] = e[key];
+      }
+      this.ruleForm.trap_status = this.ruleForm.trap_status.toString();
+      this.parameter = "modify";
+      this.addtraptf = true;
+    },
+    deletes(events) {
+      //删除诱捕器
+      console.log(events);
+      var str = "您确定删除编号为<" + events.trap_number + ">的诱捕器吗?";
+      this.$confirm(str, "删除诱捕器", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+      })
+        .then(() => {
+          this.$axios({
+            method: "POST",
+            url: "/api/api_gateway?method=monitor_manage.trap_manage.add_trap",
+            data: this.qs.stringify({
+              trap_id: events.trap_id,
+              parameter: "del",
+            }),
+          }).then((res) => {
+            console.log(res);
+            if (res.data.data) {
+              this.$message({
+                showClose: true,
+                message: "删除成功!",
+                type: "success",
+              });
+              this.getcbdlist();
+            } else {
+              this.$message({
+                showClose: true,
+                message: "删除失败," + res.data.message,
+                type: "warning",
+              });
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    handle(ev) {
+      this.downloadinput = ev.name;
+      var datas = new FormData();
+      datas.append("username", localStorage.getItem("usernme"));
+      datas.append("file", ev.raw);
+      this.$axios({
+        method: "POST",
+        url: "/api/trap_export",
+        data: datas,
+        responseType: "blob",
+      }).then((res) => {
+        console.log(res);
+        this.downloadFile(res, "allot_result.xls");
+      });
+    },
+    download() {
+      //下载模板
+      window.location.href =
+        // this.$deriveData +
+        "http://192.168.1.77:12345/api/trap_export";
+    },
+    downloadFile(res, name) {
+      let link = document.createElement("a");
+      link.href = window.URL.createObjectURL(new Blob([res.data]));
+      link.target = "_blank";
+      //文件名和格式
+      link.download = name;
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+    },
+    deriveclick() {
+      // this.deriveVisible = false;
+      this.$axios({
+        method: "POST",
+        url: "api/trap_list_export",
+        data: this.qs.stringify({
+          trap_number: this.ruleForm.trap_number,
+          point_id: this.ruleForm.point_id,
+          org_id: this.ruleForm.org_id,
+          trap_status: this.ruleForm.trap_status,
+          file_name: this.derivefilename,
+          user: localStorage.getItem("usernme"),
+        }),
+        responseType: "blob",
+      }).then((res) => {
+        console.log(res);
+        this.downloadFile(res, this.derivefilename + ".xls");
+      });
+    },
+    reset() {
+      //重置
+      this.queryInfo.trap_number = "";
+      this.queryInfo.point_id = "";
+      this.queryInfo.org_id = "";
+      this.queryInfo.trap_status = "";
+      this.versionsvalue = []
+      this.getcbdlist();
+    },
   },
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeCreate() {}, //生命周期 - 创建之前
   //生命周期 - 创建完成(可以访问当前this实例)
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -185,7 +614,7 @@ export default {
 .cbdboxs_search {
 .cbdboxs_search {
   display: flex;
   display: flex;
   justify-content: flex-start;
   justify-content: flex-start;
-  height: 40px;
+  // height: 40px;
   .el-select {
   .el-select {
     width: 250px;
     width: 250px;
     margin-right: 15px;
     margin-right: 15px;
@@ -194,6 +623,10 @@ export default {
     width: 250px;
     width: 250px;
     margin-right: 15px;
     margin-right: 15px;
   }
   }
+  .el-cascader {
+    width: 250px;
+    margin-right: 15px;
+  }
 }
 }
 .cbdboxs_table {
 .cbdboxs_table {
   margin-top: 15px;
   margin-top: 15px;
@@ -202,6 +635,51 @@ export default {
       background-color: #fafafa;
       background-color: #fafafa;
     }
     }
   }
   }
+  .state {
+    display: flex;
+    p:first-child {
+      font-size: 40px;
+    }
+  }
+}
+.addtrapbox {
+  display: flex;
+}
+.downloadbox {
+  .downloadbox_item {
+    display: flex;
+    .title {
+      width: 100px;
+      line-height: 28px;
+    }
+    .el-input {
+      width: 250px;
+      margin-left: 15px;
+    }
+  }
+  .tishi {
+    padding-left: 100px;
+    margin-top: 15px;
+    display: flex;
+    justify-content: space-between;
+    color: #409eff;
+    span:last-child {
+      cursor: pointer;
+    }
+  }
+}
+.derivebox {
+  display: flex;
+  p {
+    width: 100px;
+    line-height: 28px;
+    span {
+      color: red;
+    }
+  }
+  .el-input {
+    width: 250px;
+  }
 }
 }
 /deep/.el-button--info {
 /deep/.el-button--info {
   background-color: #409eff;
   background-color: #409eff;

+ 50 - 24
minggao/src/page/home/index.vue

@@ -14,9 +14,9 @@
           default-active="2"
           default-active="2"
           class="el-menu-vertical-demo"
           class="el-menu-vertical-demo"
           @open="handleOpen"
           @open="handleOpen"
-          @close="handleClose"
           background-color="#0D3756"
           background-color="#0D3756"
           text-color="#fff"
           text-color="#fff"
+          :default-active="menuActiveId"
           active-text-color="#409EFF"
           active-text-color="#409EFF"
           :unique-opened="true"
           :unique-opened="true"
         >
         >
@@ -31,7 +31,7 @@
           <el-submenu
           <el-submenu
             v-for="item in infodata"
             v-for="item in infodata"
             :key="item.pur_id"
             :key="item.pur_id"
-            :index="'index' + item.pur_id"
+            :index="item.pur_id.toString()"
           >
           >
             <template slot="title">
             <template slot="title">
               <i class="el-icon-collection-tag"></i>
               <i class="el-icon-collection-tag"></i>
@@ -39,7 +39,7 @@
             </template>
             </template>
             <template v-for="items in item.children">
             <template v-for="items in item.children">
               <el-submenu
               <el-submenu
-                :index="'/index/' + items.pur_id"
+                :index="items.pur_id.toString()"
                 v-if="items.children"
                 v-if="items.children"
                 :key="items.pur_id"
                 :key="items.pur_id"
                 @click="skip('/index/' + items.menu)"
                 @click="skip('/index/' + items.menu)"
@@ -51,7 +51,7 @@
                 <el-menu-item-group>
                 <el-menu-item-group>
                   <el-menu-item
                   <el-menu-item
                     v-for="item2 in items.children"
                     v-for="item2 in items.children"
-                    :index="'/index/' + item2.pur_id"
+                    :index="item2.pur_id.toString()"
                     :key="item2.pur_id"
                     :key="item2.pur_id"
                     @click="skip('/index/' + item2.menu)"
                     @click="skip('/index/' + item2.menu)"
                   >
                   >
@@ -63,10 +63,11 @@
                 </el-menu-item-group>
                 </el-menu-item-group>
               </el-submenu>
               </el-submenu>
               <el-menu-item
               <el-menu-item
-                :index="'/index/' + items.pur_id"
+                :index="items.pur_id.toString()"
                 v-else
                 v-else
                 :key="items.pur_id"
                 :key="items.pur_id"
                 @click="skip('/index/' + items.menu)"
                 @click="skip('/index/' + items.menu)"
+                class="el-menu-item2"
               >
               >
                 <span slot="title"
                 <span slot="title"
                   ><i class="el-icon-collection-tag"></i
                   ><i class="el-icon-collection-tag"></i
@@ -74,21 +75,6 @@
                 >
                 >
               </el-menu-item>
               </el-menu-item>
             </template>
             </template>
-            <!-- <template v-else>
-              <el-menu-item-group>
-                  <el-menu-item
-                    v-for="items in item.children"
-                    :index="'/index/' + items.pur_id"
-                    :key="items.pur_id"
-                    @click="skip('/index/' + items.menu)"
-                  >
-                    <span slot="title"
-                      ><i class="el-icon-collection-tag"></i
-                      >{{ items.purview_name }}</span
-                    >
-                  </el-menu-item>
-                </el-menu-item-group>
-            </template> -->
           </el-submenu>
           </el-submenu>
         </el-menu>
         </el-menu>
       </div>
       </div>
@@ -129,6 +115,8 @@ export default {
       infodata: [],
       infodata: [],
       username: "",
       username: "",
       routerdata: [],
       routerdata: [],
+      menuActiveId: "1",
+      // menuOpeneds:["18"]
     };
     };
   },
   },
   //监听属性 类似于data概念
   //监听属性 类似于data概念
@@ -137,11 +125,15 @@ export default {
   watch: {
   watch: {
     "$route.path": function (newVal) {
     "$route.path": function (newVal) {
       console.log(newVal);
       console.log(newVal);
+      // this.menuActiveId = this.$route.path;
     },
     },
   },
   },
   //方法集合
   //方法集合
   methods: {
   methods: {
-    handleOpen() {},
+    handleOpen(e) {
+      console.log(e);
+      // localStorage.setItem("menuActiveId", e);
+    },
     handleClose() {},
     handleClose() {},
     // user.login.user_login_info
     // user.login.user_login_info
     getuserinfo() {
     getuserinfo() {
@@ -155,6 +147,7 @@ export default {
         this.infodata.shift();
         this.infodata.shift();
         this.username = res.data.data.username;
         this.username = res.data.data.username;
         localStorage.setItem("usernme", this.username);
         localStorage.setItem("usernme", this.username);
+        this.routemap(this.routerdata);
       });
       });
     },
     },
     quit() {
     quit() {
@@ -171,7 +164,36 @@ export default {
       });
       });
     },
     },
     skip(path) {
     skip(path) {
-      this.$router.push(path);
+      // console.log(this.$route);ssssss
+      if (this.$route.path != path) {
+        this.$router.push(path);
+      }
+    },
+    routemap(routerdata) {
+      var newrouter = this.$route.path;
+      var tf = routerdata.filter((item) => {
+        if (item.menu != "") {
+          if (newrouter.indexOf(item.menu)!=-1) {
+            //第一层菜单是否包含当前路由
+            // console.log(item.menu);
+            return [item.menu,item.pur_id]
+          } else {
+            if (item.children) {
+              // console.log(item.children);
+              this.routemap(item.children);
+            }
+          }
+        } else {
+          if (item.children) {
+            // console.log(item.children);
+            this.routemap(item.children);
+          }
+        }
+      });
+      if(tf.length!=0){
+        this.menuActiveId = tf[0].pur_id.toString()
+      }
+      // console
     },
     },
   },
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeCreate() {}, //生命周期 - 创建之前
@@ -180,6 +202,7 @@ export default {
   beforeMount() {}, //生命周期 - 挂载之前
   beforeMount() {}, //生命周期 - 挂载之前
   //生命周期 - 挂载完成(可以访问DOM元素)
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
   mounted() {
+    // this.menuActiveId = localStorage.getItem("menuActiveId");
     this.getuserinfo();
     this.getuserinfo();
   },
   },
   beforeUpdate() {}, //生命周期 - 更新之前
   beforeUpdate() {}, //生命周期 - 更新之前
@@ -241,9 +264,12 @@ p {
     }
     }
     /deep/.el-menu-item {
     /deep/.el-menu-item {
       text-align: left;
       text-align: left;
-      padding-left: 53px !important;
+      // padding-left: 53px !important;
       background-color: rgba(0, 0, 0, 0.3) !important;
       background-color: rgba(0, 0, 0, 0.3) !important;
     }
     }
+    .el-menu-item2 {
+      background-color: transparent !important;
+    }
     /deep/.el-menu-item:hover {
     /deep/.el-menu-item:hover {
       background-color: #490eff !important;
       background-color: #490eff !important;
     }
     }
@@ -277,7 +303,7 @@ p {
   }
   }
 }
 }
 .contentbox {
 .contentbox {
-  width: 100%;
+  width: calc(100% - 240px);
   .contentbox_top {
   .contentbox_top {
     display: flex;
     display: flex;
     justify-content: space-between;
     justify-content: space-between;

+ 2 - 2
minggao/src/page/monitor/Monitor.vue

@@ -149,8 +149,8 @@
             @click="checkPlayType(0)"
             @click="checkPlayType(0)"
             class="playtype0"
             class="playtype0"
           ></div>
           ></div>
-          <div @click="addEquip()" class="addequip"></div>
-          <div @click="bindingSIM()" class="addequipA"></div>
+          <!-- <div @click="addEquip()" class="addequip"></div>
+          <div @click="bindingSIM()" class="addequipA"></div> -->
           <!-- 绑定SIM卡及SIM卡查询 -->
           <!-- 绑定SIM卡及SIM卡查询 -->
           <!--  <div style="width: 140px; display: flex; margin: 0 auto">
           <!--  <div style="width: 140px; display: flex; margin: 0 auto">
            
            

+ 16 - 4
minggao/src/router/index.js

@@ -8,7 +8,7 @@ import Login from '@/page/login/login'
 // *****************首页**********************
 // *****************首页**********************
 import Index from '@/page/home/index'
 import Index from '@/page/home/index'
 //---------------------------------------系统管理----------------------------------------------------
 //---------------------------------------系统管理----------------------------------------------------
-const customsManger = () => import('@/Page/systemmanger/customsManger') 
+const customsManger = () => import('@/Page/systemmanger/customsManger')
 const role = () => import('@/Page/systemmanger/role')
 const role = () => import('@/Page/systemmanger/role')
 const motif = () => import('@/Page/systemmanger/motif')
 const motif = () => import('@/Page/systemmanger/motif')
 
 
@@ -24,7 +24,9 @@ import deviceTongji from '@/page/forecasting/cbd/deviceTongji'//害虫排行
 import monitor from '@/page/monitor/Monitor'
 import monitor from '@/page/monitor/Monitor'
 import photoView from '@/page/monitor/PhotoView'
 import photoView from '@/page/monitor/PhotoView'
 //*********************诱捕器系统********************
 //*********************诱捕器系统********************
-import trap from '@/page/forecasting/trap/trap'//害虫排行
+import trap from '@/page/forecasting/trap/trap'//诱捕器
+import fillinrecord from '@/page/forecasting/trap/fillinrecord'//填报记录
+import bait from '@/page/forecasting/trap/bait'//填报记录
 
 
 Vue.use(Router)
 Vue.use(Router)
 
 
@@ -67,13 +69,13 @@ export default new Router({
             title: '主题管理'
             title: '主题管理'
           }
           }
         },
         },
-        //------------------系统管理--------------------------
+        //------------------测报管理--------------------------
+        //------------------测报灯--------------------------
         {
         {
           path: 'cbd',
           path: 'cbd',
           component: cbd
           component: cbd
         },
         },
         {
         {
-          
           path: 'cbdDataDetails/:e_id/:d_id',
           path: 'cbdDataDetails/:e_id/:d_id',
           component: cbdDataDetails
           component: cbdDataDetails
         },
         },
@@ -101,10 +103,20 @@ export default new Router({
           path: 'photoView',
           path: 'photoView',
           component: photoView
           component: photoView
         },
         },
+        // ------------------诱捕器管理-------------------
         {
         {
           path: 'trap',
           path: 'trap',
           component: trap
           component: trap
         },
         },
+        {
+          path: 'fillinrecord',
+          component: fillinrecord
+        },
+        {
+          path: 'bait',
+          component: bait
+        },
+        
       ]
       ]
     },
     },
   ]
   ]

+ 11 - 3
minggao/src/util/http.js

@@ -37,8 +37,15 @@ axios.interceptors.request.use(req => {
   //     req.data = req.data ? req.data + '&token=' + session : 'token=' + session;
   //     req.data = req.data ? req.data + '&token=' + session : 'token=' + session;
   //   }
   //   }
   // }
   // }
-  url = req.url.split('=')[1]
-  if (url != 'sysmenage.usermanager.user_login' ) {
+  if(req.url.split('=')[1]){
+    url = req.url.split('=')[1]
+  }else{
+    url = req.url
+  }
+  console.log(req)
+  if (url != 'sysmenage.usermanager.user_login' && url != '/api/trap_export') {
+    console.log(url != 'sysmenage.usermanager.user_login')
+    console.log(url != '/api/trap_export')
     req.data = req.data ? req.data + '&token=' + session : 'token=' + session;
     req.data = req.data ? req.data + '&token=' + session : 'token=' + session;
   }
   }
   return req
   return req
@@ -51,7 +58,8 @@ axios.interceptors.response.use(res => {
   if (res.data.data) {
   if (res.data.data) {
     res.data.data.session_key && localStorage.setItem('session', res.data.data.session_key);
     res.data.data.session_key && localStorage.setItem('session', res.data.data.session_key);
   }
   }
-  if(res.data.message!=""){ 
+  // console.log(res.data.message)
+  if(res.data.message!="" && res.data.message != undefined){ 
     Message.warning(res.data.message);
     Message.warning(res.data.message);
   }
   }
   return res
   return res