Ver código fonte

诊断阈值管理-添加编辑

humingshi-7@163.com 11 meses atrás
pai
commit
991c24051d

+ 39 - 2
src/api/iot/diagnoseThreshold.js

@@ -2,9 +2,9 @@ import request from '@/utils/request'
 
 
 //列表
-export function list(query) {
+export function cameraList(query) {
     return request({
-      url: '/iot/diagnoseThreshold/list',
+      url: '/iot/diagnoseThreshold/cameraList',
       method: 'post',
       data: query
     })
@@ -37,3 +37,40 @@ export function unbindThreshold(query) {
     data: query
   })
 }
+
+
+//阈值管理列表
+export function list(query) {
+  return request({
+    url: '/iot/diagnoseThreshold/list',
+    method: 'get',
+    data: query
+  })
+}
+
+
+//删除阈值
+export function deleteThreshold(thresholdCode) {
+  return request({
+    url: `/iot/diagnoseThreshold/deleteThreshold?thresholdCode=${thresholdCode}`,
+    method: 'get'
+  })
+}
+
+//新增阈值
+export function addThreshold(query) {
+  return request({
+    url: `/iot/diagnoseThreshold/addThreshold`,
+    method: 'post',
+    data: query
+  })
+}
+
+//编辑阈值
+export function editThreshold(query) {
+  return request({
+    url: `/iot/diagnoseThreshold/editThreshold`,
+    method: 'post',
+    data: query
+  })
+}

+ 16 - 2
src/views/iot/diagnoseMission/indexMission.vue

@@ -58,7 +58,13 @@
             <el-table-column label="开始时间" align="center" prop="beginTime" width="220"/>
             <el-table-column label="结束时间" align="center" prop="endTime" width="220"/>
             <el-table-column label="周期(小时)" align="center" prop="cycle" width="150"/>
-            <el-table-column label="启用/禁用" align="center" prop="enabled" width="150"/>
+            <el-table-column label="启用/禁用" align="center" prop="enabled" width="150">
+                <template slot-scope="scope">
+                  <div :style="{color: scope.row.enabled ===1?'green':'red'}">
+                  {{ formatterEnabled(scope.row.enabled) }}
+                  </div>
+                </template>
+            </el-table-column>
             <el-table-column label="创建时间" align="center" prop="createTime" width="220"/>
             <el-table-column
                           label="操作"
@@ -70,7 +76,7 @@
                               size="mini"
                               type="text"
                               icon="el-icon-edit-outline"
-                              v-if="!scope.row.doTime"
+                              v-if="scope.row.name != '默认'"
                               @click="editMission(scope.row)"
                               v-hasPermi="['core:task:query']"
                               >编辑</el-button>
@@ -78,6 +84,7 @@
                               size="mini"
                               type="text"
                               icon="el-icon-view"
+                              v-if="scope.row.name != '默认'"
                               @click="deleteMission(scope.row.missionId)"
                               v-hasPermi="['core:task:query']"
                               >删除</el-button>
@@ -226,6 +233,13 @@ export default {
            this.getList();
       });
     },
+    formatterEnabled(enabled) {
+      if (enabled === 1) {
+        return "启用";
+      } else {
+        return "禁用";
+      }
+    },
   },
 };
 </script>

+ 163 - 0
src/views/iot/diagnoseThreshold/dialog.addThreshold.vue

@@ -0,0 +1,163 @@
+<template>
+  <div class="edu-training-edit">
+    <DialogCom :title="title" @close="onHide" :visible.sync="isShow" width="460px">
+      <div class="page-body">
+        <el-form :model="formData" :rules="formDataRules" size="small" ref="form" label-position="top"
+                 label-width="150px" label-prefix=":">
+          <el-row>
+            <el-col :span="19">
+              <el-form-item prop="thresholdName" label="阈值名称">
+                <el-input
+                  v-model="formData.thresholdName"
+                  :maxlength="32"
+                  placeholder="请输入阈值名称"
+                  clearable
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="19">
+              <el-form-item  prop="timeRange" label="有效时段">
+                <el-time-picker style="width:100%"  v-model="formData.timeRange" value-format="HH:mm:ss"
+                               is-range  start-placeholder="开始时间" end-placeholder="结束时间" @change="startDateChanged">
+                </el-time-picker>
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row>
+                <el-col :span="19">
+                  <el-form-item prop="nosignal" label="信号丢失">
+                    <el-input
+                      v-model="formData.nosignal"
+                      :maxlength="32"
+                      clearable
+                    />
+                  </el-form-item>
+                </el-col>
+                <el-col :span="19">
+                  <el-form-item prop="covered" label="遮挡">
+                    <el-input
+                      v-model="formData.covered"
+                      :maxlength="32"
+                      clearable
+                    />
+                  </el-form-item>
+                </el-col>
+          </el-row>
+
+        </el-form>
+
+      </div>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+        <el-button @click="onHide">取 消</el-button>
+      </div>
+    </DialogCom>
+  </div>
+</template>
+
+<script>
+import {mapMutations, mapState} from "vuex";
+import {addThreshold,editThreshold} from "@/api/iot/diagnoseThreshold";
+import dayjs from "dayjs";
+
+export default {
+  components: {},
+  data() {
+    const params = this.$route.params;
+    return {
+      missionId: params ? params.missionId : null,
+      isShow: false,
+      title: '',
+      formData: this.reset(),
+      isEdit: false,
+      formDataRules: {
+        thresholdName: [{required: true, message: "请输入阈值名称", trigger: 'blur'}],
+        timeRange: [{required: true, message: "请选择有效时段", trigger: 'blur'}],
+        nosignal: [
+          {required: true, message: '请输入信号丢失', trigger: 'blur'},
+          {validator: this.validatePort, trigger: 'blur'}
+        ],
+        covered: [
+          {required: true, message: '请输入遮挡', trigger: 'blur'},
+          {validator: this.validatePort, trigger: 'blur'}
+        ],
+      },
+    };
+  },
+  props: {},
+  watch: {},
+  created() {
+
+  },
+
+  mounted() {
+
+  },
+  computed: {
+    ...mapState(["loginUser", "org"]),
+  },
+  methods: {
+    ...mapMutations([]),
+    reset() {
+      return {
+        thresholdCode: null,
+        thresholdName: null,
+        timeRange: ['00:00:00', '23:59:59'],
+        nosignal: "@value==255",
+        covered: "@value>=255",
+      };
+    },
+    async show(formData) {
+      this.title = '新增阈值';
+      this.isEdit=false;
+      if (formData.thresholdCode){
+        this.formData = formData;
+        this.formData.timeRange=[formData.beginTime,formData.endTime];
+        this.title = '编辑阈值';
+        this.isEdit=true;
+      }
+      this.isShow = true;
+    },
+
+    // 事件
+    onHide() {
+      this.isShow = false;
+      this.formData = this.reset();
+    },
+    async onSubmit() {
+      this.$refs["form"].validate(async (valid) => {
+        if (valid) {
+
+            if (!this.formData.thresholdCode) {
+              await addThreshold(this.formData).then(r => {
+                  this.$modal.msgSuccess("新增成功");
+              })
+            } else {
+              await editThreshold(this.formData).then(r => {
+                   this.$modal.msgSuccess("修改成功");
+              })
+            }
+            this.$emit("success");
+            this.isShow = false;
+        }
+      });
+    },
+    validatePort(rule, value, callback) {
+      if (!value) {
+        return callback(new Error('请输入诊断周期'));
+      }
+      callback();
+    },
+
+  },
+
+};
+</script>
+<style lang="scss" scoped>
+  .el-form-item{
+      justify-content:center;
+      align-items:center;
+  }
+</style>

+ 41 - 319
src/views/iot/diagnoseThreshold/index.vue

@@ -1,337 +1,59 @@
 <template>
-  <div class="app-container">
-    <el-row :gutter="20">
-      <el-col :span="24" :xs="24">
-        <div class="main-right-box">
-          <div class="main-search-box">
-            <el-form
-              :model="queryParams"
-              ref="queryForm"
-              size="small"
-              :inline="true"
-              v-show="showSearch"
-            >
-              <el-form-item label="组织机构">
-                <org-tree
-                  v-model="queryParams.orgId"
-                  @defaultKey="getDefaultKey"
-                  @defaultOrg="getDefaultOrg"
-                  @checkChange="checkChange"
-                  @click="clickTreeNode"
-                  ref="orgTree"
-                ></org-tree>
-              </el-form-item>
-              <el-form-item label="设备名称" prop="deviceName">
-                <el-input
-                  v-model="queryParams.deviceName"
-                  clearable
-                  placeholder="请输入关键字"
-                  @keyup.enter.native="handleQuery"/>
-              </el-form-item>
-              <el-form-item label="绑定阈值" prop="state">
-                <el-select
-                  v-model="queryParams.state" clearable
-                  label="绑定阈值" placeholder="请选择绑定状态" prop="state">
-                  <el-option
-                    v-for="item in bindTypes"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"/>
-                </el-select>
-              </el-form-item>
-              <el-form-item label="阈值名称" prop="thresholdCode">
-                <el-select
-                  v-model="queryParams.thresholdCode"
-                  clearable
-                  label="阈值名称"
-                  placeholder="请选择阈值名称"
-                  prop="thresholdCode"
-                >
-                  <el-option
-                    v-for="item in deviceTypes"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-            </el-form>
+  <div class="diagnoseThreshold app-container">
 
-            <el-row :gutter="10">
-              <el-col :span="1.5">
-                <el-button
-                  type="primary"
-                  icon="el-icon-search"
-                  size="mini"
-                  @click="handleQuery"
-                  >搜索
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button
-                  type="primary"
-                  icon="el-icon-refresh"
-                  size="mini"
-                  @click="resetQuery"
-                  >重置
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button
-                  type="primary"
-                  icon="el-icon-refresh"
-                  size="mini"
-                  @click="unbindThreshold()"
-                  >解绑阈值
-                </el-button>
-              </el-col>
-              <el-col :span="1.5">
-                <el-button
-                  type="primary"
-                  icon="el-icon-refresh"
-                  size="mini"
-                  @click="bindThreshold()"
-                  >绑定阈值
-                </el-button>
-              </el-col>
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane  label="阈值关联摄像机" name="阈值关联摄像机">
 
-              <el-col :span="1.5">
-                <el-button
-                  type="primary"
-                  icon="el-icon-download"
-                  size="mini"
-                  @click="handleExport"
-                >导出数据
-                </el-button>
-              </el-col>
+      </el-tab-pane>
+      <el-tab-pane label="阈值管理" name="阈值管理">
 
-              <right-toolbar
-                :showSearch.sync="showSearch"
-                @queryTable="getList"
-              ></right-toolbar>
-            </el-row>
-          </div>
+      </el-tab-pane>
+    </el-tabs>
+
+    <index-camera v-if="activeName==='阈值关联摄像机'"></index-camera>
+    <index-threshold  v-if="activeName==='阈值管理'"></index-threshold>
 
-          <el-table
-            v-loading="loading"
-            :data="dataList"
-            border
-            height="600"
-            size="small"
-          >
-          <el-table-column label="序号" type="index" align="center" width="70">
-          <template slot-scope="scope">
-            {{
-              (queryParams.pageNum - 1) * queryParams.pageSize +
-              scope.$index +
-              1
-            }}
-          </template>
-        </el-table-column>
-            <el-table-column label="地区" align="center" prop="firstOrgName" width="180"/>
-            <el-table-column label="行社名称" align="center" prop="secondOrgName" width="220"/>
-            <el-table-column label="所属机构" align="center" prop="orgName" width="220"/>
-            <el-table-column label="设备名称" align="center" prop="deviceName" width="300"/>
-            <el-table-column label="所属主机" align="center" prop="hostName" width="280"/>
-            <el-table-column label="阈值" align="center" prop="thresholdName" width="380"/>
-          </el-table>
-          <pagination
-            v-show="total > 0"
-            :total="total"
-            :page.sync="queryParams.pageNum"
-            :limit.sync="queryParams.pageSize"
-            @pagination="getList"
-          />
-        </div>
-      </el-col>
-    </el-row>
-    <dialog-bind-threshold ref="bindThresholdDialog" @success="getList()"></dialog-bind-threshold>
-    <dialog-unbind-threshold ref="unbindThresholdDialog" @success="getList()"></dialog-unbind-threshold>
   </div>
 </template>
 
 <script>
-import { list,thresholdTypeList} from "@/api/iot/diagnoseThreshold";
-import DialogBindThreshold from "./dialog.bindThreshold.vue";
-import DialogUnbindThreshold  from "./dialog.unbindThreshold.vue";
-import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
-import { mapGetters } from "vuex";
-import dayjs from "dayjs";
+import IndexCamera from './indexCamera'
+import IndexThreshold from './indexThreshold'
+
 export default {
-  components: { OrgTree,DialogBindThreshold,DialogUnbindThreshold},
-  name: "Task",
-  dicts: ["sys_org_type",'sensor_alarm_status','sensor_device_type'],
+  components:{
+    IndexCamera,
+    IndexThreshold
+  },
   data() {
     return {
-      bindTypes:[
-            {
-              value: '0',
-              label: '未绑定'
-            },
-            {
-              value: '1',
-              label: '已绑定'
-            }
-      ],
-      deviceTypes: [],
-      // 遮罩层
-      loading: false,
-      // 选中数组
-      ids: [],
-      // 非单个停用
-      single: true,
-      // 非多个停用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 1,
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        checkSub: true,
-        thresholdCode: null,
-        state: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {},
-      timeClearable: true,
-      showOverflowTooltip:true,
-      dataList:[],
+      activeName:'阈值关联摄像机'
     };
   },
-  created() {
-    this.queryParams.orgId = this.$store.getters.orgId;
-    this.initDeviceTypeList();
-  },
-  computed: {
-    ...mapGetters(["orgId"]),
-  },
-  methods: {
-    initDeviceTypeList(){
-          thresholdTypeList()
-            .then((r) => {
-              // 使用 map 而不是 filter 进行数据转换
-              const transformedList = r.map((item) => ({
-                value: item.value,
-                label: item.label,
-                type: item.type,
-              }));
-
-              // 将转换后的数据推送到 this.deviceTypeList
-              this.deviceTypes.push(...transformedList);
-            })
-            .catch((error) => {
-              // 处理错误
-              console.error('Error fetching device type list:', error);
-            });
-    },
-    /** 查询列表 */
-    getList() {
-      this.loading = true;
-      list(this.queryParams).then((response) => {
-        this.dataList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消弹框
-    closeHandler() {
-      this.reset();
-    },
-    handleImport() {},
-    getDefaultOrg(org) {
-      this.orgName = org.name;
-      this.selectedOrgName = org.shortName;
-    },
+  methods:{
+    handleClick(){
 
-    getDefaultKey(key) {
-      this.queryParams.orgId = key;
-      this.getList();
-    },
-    checkChange(state) {
-      this.queryParams.checkSub = state;
-      this.handleQuery();
-    },
-    // 节点单击事件
-    clickTreeNode(data) {
-      this.queryParams.orgId = data.id;
-      this.orgName = data.name;
-      this.selectedOrgName = data.shortName;
-      this.handleQuery();
     },
-    /** 下穿状态改变*/
-    changeCheckBox() {
-      this.getList();
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        orgId: null,
-        orgPath: null,
-        orgName: null
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.queryParams.orgId = this.orgId;
-      this.selectedOrgName = this.orgName;
-      this.queryParams.checkSub = true;
-      this.queryParams.planStartTime = null;
-      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
-      this.handleQuery();
-    },
-
-    /** 绑定阈值 */
-    bindThreshold() {
-      this.$refs["bindThresholdDialog"].show(this.queryParams, this.deviceTypes);
-    },
-    /** 解绑阈值 */
-    unbindThreshold() {
-      this.$refs["unbindThresholdDialog"].show(this.queryParams, this.deviceTypes);
-    },
-
-    /** 导出按钮操作 */
-    handleExport() {
-      if (this.total==null || this.total===0){
-        this.$modal.alert("暂无可用数据导出");
-        return;
-      }
-      if (this.total>50000){
-        this.$modal.alert("导出数据超过5万条,请缩小查询范围后重试");
-        return;
-      }
-      this.download(
-        "iot/sensor/export",
-        {
-          ...this.queryParams,
-        },
-        `${
-          this.selectedOrgName
-        }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
-      );
-    },
-  },
+  }
 };
 </script>
-<style lang="scss" scoped></style>
+<style lang="scss">
+.diagnoseThreshold{
+  .el-tabs__header{
+    margin-bottom: 10px;
+    background-color: #fff;
+    padding: 0 10px;
+    box-shadow: 0 2px 8px #eee;
+
+  }
+  .el-tabs__nav-wrap::after{
+    background-color: #fff;
+  }
+  .el-tabs__item{
+    font-size: 16px;
+  }
+}
+</style>
+<style lang="scss" scoped>
+
+</style>

+ 337 - 0
src/views/iot/diagnoseThreshold/indexCamera.vue

@@ -0,0 +1,337 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <el-col :span="24" :xs="24">
+        <div class="main-right-box">
+          <div class="main-search-box">
+            <el-form
+              :model="queryParams"
+              ref="queryForm"
+              size="small"
+              :inline="true"
+              v-show="showSearch"
+            >
+              <el-form-item label="组织机构">
+                <org-tree
+                  v-model="queryParams.orgId"
+                  @defaultKey="getDefaultKey"
+                  @defaultOrg="getDefaultOrg"
+                  @checkChange="checkChange"
+                  @click="clickTreeNode"
+                  ref="orgTree"
+                ></org-tree>
+              </el-form-item>
+              <el-form-item label="设备名称" prop="deviceName">
+                <el-input
+                  v-model="queryParams.deviceName"
+                  clearable
+                  placeholder="请输入关键字"
+                  @keyup.enter.native="handleQuery"/>
+              </el-form-item>
+              <el-form-item label="绑定阈值" prop="state">
+                <el-select
+                  v-model="queryParams.state" clearable
+                  label="绑定阈值" placeholder="请选择绑定状态" prop="state">
+                  <el-option
+                    v-for="item in bindTypes"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"/>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="阈值名称" prop="thresholdCode">
+                <el-select
+                  v-model="queryParams.thresholdCode"
+                  clearable
+                  label="阈值名称"
+                  placeholder="请选择阈值名称"
+                  prop="thresholdCode"
+                >
+                  <el-option
+                    v-for="item in deviceTypes"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-form>
+
+            <el-row :gutter="10">
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-search"
+                  size="mini"
+                  @click="handleQuery"
+                  >搜索
+                </el-button>
+              </el-col>
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="resetQuery"
+                  >重置
+                </el-button>
+              </el-col>
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="unbindThreshold()"
+                  >解绑阈值
+                </el-button>
+              </el-col>
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="bindThreshold()"
+                  >绑定阈值
+                </el-button>
+              </el-col>
+
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-download"
+                  size="mini"
+                  @click="handleExport"
+                >导出数据
+                </el-button>
+              </el-col>
+
+              <right-toolbar
+                :showSearch.sync="showSearch"
+                @queryTable="getList"
+              ></right-toolbar>
+            </el-row>
+          </div>
+
+          <el-table
+            v-loading="loading"
+            :data="dataList"
+            border
+            height="600"
+            size="small"
+          >
+          <el-table-column label="序号" type="index" align="center" width="70">
+          <template slot-scope="scope">
+            {{
+              (queryParams.pageNum - 1) * queryParams.pageSize +
+              scope.$index +
+              1
+            }}
+          </template>
+        </el-table-column>
+            <el-table-column label="地区" align="center" prop="firstOrgName" width="180"/>
+            <el-table-column label="行社名称" align="center" prop="secondOrgName" width="220"/>
+            <el-table-column label="所属机构" align="center" prop="orgName" width="220"/>
+            <el-table-column label="设备名称" align="center" prop="deviceName" width="300"/>
+            <el-table-column label="所属主机" align="center" prop="hostName" width="280"/>
+            <el-table-column label="阈值" align="center" prop="thresholdName" width="380"/>
+          </el-table>
+          <pagination
+            v-show="total > 0"
+            :total="total"
+            :page.sync="queryParams.pageNum"
+            :limit.sync="queryParams.pageSize"
+            @pagination="getList"
+          />
+        </div>
+      </el-col>
+    </el-row>
+    <dialog-bind-threshold ref="bindThresholdDialog" @success="getList()"></dialog-bind-threshold>
+    <dialog-unbind-threshold ref="unbindThresholdDialog" @success="getList()"></dialog-unbind-threshold>
+  </div>
+</template>
+
+<script>
+import { cameraList,thresholdTypeList} from "@/api/iot/diagnoseThreshold";
+import DialogBindThreshold from "./dialog.bindThreshold.vue";
+import DialogUnbindThreshold  from "./dialog.unbindThreshold.vue";
+import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
+import { mapGetters } from "vuex";
+import dayjs from "dayjs";
+export default {
+  components: { OrgTree,DialogBindThreshold,DialogUnbindThreshold},
+  name: "Task",
+  dicts: ["sys_org_type",'sensor_alarm_status','sensor_device_type'],
+  data() {
+    return {
+      bindTypes:[
+            {
+              value: '0',
+              label: '未绑定'
+            },
+            {
+              value: '1',
+              label: '已绑定'
+            }
+      ],
+      deviceTypes: [],
+      // 遮罩层
+      loading: false,
+      // 选中数组
+      ids: [],
+      // 非单个停用
+      single: true,
+      // 非多个停用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 1,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        checkSub: true,
+        thresholdCode: null,
+        state: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+      timeClearable: true,
+      showOverflowTooltip:true,
+      dataList:[],
+    };
+  },
+  created() {
+    this.queryParams.orgId = this.$store.getters.orgId;
+    this.initDeviceTypeList();
+  },
+  computed: {
+    ...mapGetters(["orgId"]),
+  },
+  methods: {
+    initDeviceTypeList(){
+          thresholdTypeList()
+            .then((r) => {
+              // 使用 map 而不是 filter 进行数据转换
+              const transformedList = r.map((item) => ({
+                value: item.value,
+                label: item.label,
+                type: item.type,
+              }));
+
+              // 将转换后的数据推送到 this.deviceTypeList
+              this.deviceTypes.push(...transformedList);
+            })
+            .catch((error) => {
+              // 处理错误
+              console.error('Error fetching device type list:', error);
+            });
+    },
+    /** 查询列表 */
+    getList() {
+      this.loading = true;
+      cameraList(this.queryParams).then((response) => {
+        this.dataList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消弹框
+    closeHandler() {
+      this.reset();
+    },
+    handleImport() {},
+    getDefaultOrg(org) {
+      this.orgName = org.name;
+      this.selectedOrgName = org.shortName;
+    },
+
+    getDefaultKey(key) {
+      this.queryParams.orgId = key;
+      this.getList();
+    },
+    checkChange(state) {
+      this.queryParams.checkSub = state;
+      this.handleQuery();
+    },
+    // 节点单击事件
+    clickTreeNode(data) {
+      this.queryParams.orgId = data.id;
+      this.orgName = data.name;
+      this.selectedOrgName = data.shortName;
+      this.handleQuery();
+    },
+    /** 下穿状态改变*/
+    changeCheckBox() {
+      this.getList();
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        orgId: null,
+        orgPath: null,
+        orgName: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.queryParams.orgId = this.orgId;
+      this.selectedOrgName = this.orgName;
+      this.queryParams.checkSub = true;
+      this.queryParams.planStartTime = null;
+      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
+      this.handleQuery();
+    },
+
+    /** 绑定阈值 */
+    bindThreshold() {
+      this.$refs["bindThresholdDialog"].show(this.queryParams, this.deviceTypes);
+    },
+    /** 解绑阈值 */
+    unbindThreshold() {
+      this.$refs["unbindThresholdDialog"].show(this.queryParams, this.deviceTypes);
+    },
+
+    /** 导出按钮操作 */
+    handleExport() {
+      if (this.total==null || this.total===0){
+        this.$modal.alert("暂无可用数据导出");
+        return;
+      }
+      if (this.total>50000){
+        this.$modal.alert("导出数据超过5万条,请缩小查询范围后重试");
+        return;
+      }
+      this.download(
+        "iot/sensor/export",
+        {
+          ...this.queryParams,
+        },
+        `${
+          this.selectedOrgName
+        }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
+      );
+    },
+  },
+};
+</script>
+<style lang="scss" scoped></style>

+ 238 - 0
src/views/iot/diagnoseThreshold/indexThreshold.vue

@@ -0,0 +1,238 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <el-col :span="24" :xs="24">
+        <div class="main-right-box">
+          <div class="main-search-box">
+            <el-form
+              :model="queryParams"
+              ref="queryForm"
+              size="small"
+              :inline="true"
+              v-show="showSearch"
+            ></el-form>
+            <el-row :gutter="10">
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-search"
+                  size="mini"
+                  @click="handleQuery"
+                  >搜索
+                </el-button>
+              </el-col>
+              <el-col :span="1.5">
+                <el-button
+                  type="primary"
+                  icon="el-icon-refresh"
+                  size="mini"
+                  @click="addThreshold()"
+                  >添加
+                </el-button>
+              </el-col>
+
+              <right-toolbar
+                :showSearch.sync="showSearch"
+                @queryTable="getList"
+              ></right-toolbar>
+            </el-row>
+          </div>
+
+          <el-table
+            v-loading="loading"
+            :data="dataList"
+            border
+            height="600"
+            size="small"
+          >
+          <el-table-column label="序号" type="index" align="center" width="70">
+          <template slot-scope="scope">
+            {{
+
+              scope.$index +
+              1
+            }}
+          </template>
+        </el-table-column>
+            <el-table-column label="阈值名称" align="center" prop="thresholdName" width="340"/>
+            <el-table-column label="通道数量" align="center" prop="diagnoseNumber" width="220"/>
+            <el-table-column label="有效时段" align="center"  width="220">
+                <template slot-scope="scope">
+                    {{ formatterTimeRange(scope.row) }}
+                </template>
+            </el-table-column>
+            <el-table-column label="创建时间" align="center" prop="createTime" width="220"/>
+            <el-table-column
+                          label="操作"
+                          fixed="right"
+                          align="center"
+                        >
+                          <template slot-scope="scope">
+                            <el-button
+                              size="mini"
+                              type="text"
+                              icon="el-icon-edit-outline"
+                              v-if="scope.row.thresholdName != '默认'"
+                              @click="editThreshold(scope.row)"
+                              v-hasPermi="['core:task:query']"
+                              >编辑</el-button>
+                              <el-button
+                              size="mini"
+                              type="text"
+                              icon="el-icon-view"
+                              v-if="scope.row.thresholdName != '默认'"
+                              @click="deleteThreshold(scope.row.thresholdCode)"
+                              v-hasPermi="['core:task:query']"
+                              >删除</el-button>
+                          </template>
+             </el-table-column>
+          </el-table>
+        </div>
+      </el-col>
+    </el-row>
+    <dialog-add-threshold ref="addThresholdDialog" @success="getList()"></dialog-add-threshold>
+    <dialog-edit-threshold ref="editThresholdDialog" @success="getList()"></dialog-edit-threshold>
+  </div>
+</template>
+
+<script>
+import { list,deleteThreshold} from "@/api/iot/diagnoseThreshold";
+import DialogAddThreshold from "./dialog.addThreshold.vue";
+import DialogEditThreshold from "./dialog.addThreshold.vue";
+import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
+import { mapGetters } from "vuex";
+import dayjs from "dayjs";
+export default {
+  components: { OrgTree,DialogAddThreshold,DialogEditThreshold },
+  name: "Task",
+  data() {
+    return {
+      bindTypes:[
+            {
+              value: '0',
+              label: '未绑定'
+            },
+            {
+              value: '1',
+              label: '已绑定'
+            }
+      ],
+      // 遮罩层
+      loading: false,
+      // 选中数组
+      ids: [],
+      // 非单个停用
+      single: true,
+      // 非多个停用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 1,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        checkSub: true,
+        missionCode: null,
+        state: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+      timeClearable: true,
+      showOverflowTooltip:true,
+      dataList:[],
+    };
+  },
+  created() {
+    this.queryParams.orgId = this.$store.getters.orgId;
+    this.getList();
+  },
+  computed: {
+    ...mapGetters(["orgId"]),
+  },
+  methods: {
+    /** 查询列表 */
+    getList() {
+      this.loading = true;
+      list(this.queryParams).then((response) => {
+        this.dataList = response;
+        this.loading = false;
+      });
+    },
+    // 取消弹框
+    closeHandler() {
+      this.reset();
+    },
+    handleImport() {},
+    getDefaultOrg(org) {
+      this.orgName = org.name;
+      this.selectedOrgName = org.shortName;
+    },
+
+    getDefaultKey(key) {
+      this.queryParams.orgId = key;
+      this.getList();
+    },
+    checkChange(state) {
+      this.queryParams.checkSub = state;
+      this.handleQuery();
+    },
+    // 节点单击事件
+    clickTreeNode(data) {
+      this.queryParams.orgId = data.id;
+      this.orgName = data.name;
+      this.selectedOrgName = data.shortName;
+      this.handleQuery();
+    },
+    /** 下穿状态改变*/
+    changeCheckBox() {
+      this.getList();
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        orgId: null,
+        orgPath: null,
+        orgName: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 编辑阈值 */
+    addThreshold() {
+      this.$refs["addThresholdDialog"].show({});
+    },
+    /** 编辑阈值 */
+    editThreshold(threshold) {
+      this.$refs["editThresholdDialog"].show(threshold);
+    },
+    /** 删除阈值 */
+    deleteThreshold(thresholdCode) {
+      this.loading = true;
+      deleteThreshold(thresholdCode).then((response) => {
+           this.loading = false;
+           this.getList();
+      });
+    },
+    formatterTimeRange(row) {
+        return row.beginTime + "--" + row.endTime;
+    },
+  },
+};
+</script>
+<style lang="scss" scoped></style>