yusheng пре 3 недеља
родитељ
комит
8d9408eab1
2 измењених фајлова са 256 додато и 270 уклоњено
  1. 225 224
      src/components/addDoc/main.vue
  2. 31 46
      src/views/warning/warningSetting/components/addWarningDialog.vue

+ 225 - 224
src/components/addDoc/main.vue

@@ -1,224 +1,225 @@
-<template>
-  <ele-modal
-    width="60%"
-    :visible.sync="showEditFlag"
-    :close-on-click-modal="false"
-    custom-class="ele-dialog-form"
-    append-to-body
-    ref="Emodal"
-    :maxable="true"
-    :resizable="true"
-  >
-    <!-- 数据表格 -->
-    <ele-pro-table
-      ref="table"
:pageSizes="tablePageSizes"
-      :columns="columns"
-      :datasource="tableList"
-      tool-class="ele-toolbar-form"
-      :needPage="false"
-      row-key="id"
-      :cache-key="cacheKeyUrl"
-    >
-      <template v-slot:toolbar v-if="type != 'view'">
-        <el-button type="primary" @click="fileEditOpen">本地上传</el-button>
-        <el-button type="primary" @click="fileShow = true">
-          关联文档库
-        </el-button>
-      </template>
-      <!-- 操作列 -->
-      <template v-slot:action="{ row }">
-        <el-link
-          type="primary"
-          :underline="false"
-          icon="el-icon-edit"
-          @click="browseOpen(row)"
-        >
-          浏览
-        </el-link>
-
-        <el-popconfirm
-          v-if="type != 'view'"
-          class="ele-action"
-          title="确定要删除吗?"
-          @confirm="remove(row)"
-        >
-          <template v-slot:reference>
-            <el-link type="danger" :underline="false" icon="el-icon-delete">
-              删除
-            </el-link>
-          </template>
-        </el-popconfirm>
-      </template>
-    </ele-pro-table>
-    <template v-slot:footer>
-      <el-button @click="showEditFlag = false">取消</el-button>
-      <el-button type="primary" @click="addFile" v-if="type != 'view'">
-        确认
-      </el-button>
-    </template>
-    <fileEdit ref="fileEditRef" @done="done"></fileEdit>
-    <ele-modal
-      width="80%"
-      :visible.sync="fileShow"
-      :close-on-click-modal="false"
-      custom-class="ele-dialog-form"
-      append-to-body
-      :maxable="true"
-      :resizable="true"
-    >
-      <doc_template
-        :disabledTableList="tableList"
-        ref="doc_templateRef"
-      ></doc_template>
-      <template v-slot:footer>
-        <el-button @click="fileShow = false">取消</el-button>
-        <el-button type="primary" @click="addTemplate"> 确认 </el-button>
-      </template>
-    </ele-modal>
-    <browse ref="browseRef"></browse>
-  </ele-modal>
-</template>
-
-<script>
-  import doc_template from './doc_template.vue';
-  import fileEdit from './file-edit.vue';
-  import browse from './browse.vue';
-  import { queryIds } from './api';
-  import { setFileUrl } from './util.js';
-  import tabMixins from '@/mixins/tableColumnsMixin';
-
-  export default {
-    mixins: [tabMixins],
-    components: { doc_template, fileEdit, browse },
-
-    data() {
-      return {
-        fileId: [],
-        fileShow: false,
-        showEditFlag: false,
-        tableList: [],
-        type: 'add',
-        cacheKeyUrl: 'eam-addDoc-main',
-        tabMixinsInit: false,
-        columns: [
-          {
-            label: '编码',
-            prop: 'code',
-            width: 180,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'name',
-            label: '文档名称',
-            align: 'center',
-            slot: 'name',
-            showOverflowTooltip: true,
-            minWidth: 200
-          },
-          {
-            prop: 'storagePath',
-            label: '文件名称',
-            align: 'center',
-
-            showOverflowTooltip: true,
-            minWidth: 200,
-            formatter: (_row, _column, cellValue) => {
-              return cellValue && cellValue[0]?.name;
-            }
-          },
-          {
-            prop: 'version',
-            label: '版本',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 100
-          },
-
-          {
-            prop: 'createUserName',
-            label: '创建人',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 100
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 160
-          },
-
-          {
-            prop: 'sizeUnit',
-            label: '文档大小',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 100
-          },
-
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ]
-      };
-    },
-    created() {},
-
-    methods: {
-      open(fileId, type) {
-        //查看详情:view 新增:add
-        this.showEditFlag = true;
-        this.fileId = fileId || [];
-        if (type) {
-          this.type = type;
-        }
-        this.init();
-      },
-      fileEditOpen() {
-        this.$refs.fileEditRef.open();
-      },
-      remove(row) {
-        this.tableList = this.tableList.filter((item) => item.code != row.code);
-        this.fileId = this.tableList.map((item) => item.id);
-      },
-      async init() {
-        if (this.fileId.length > 0) {
-          this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
-        } else {
-          this.tableList = [];
-        }
-      },
-      done(id) {
-        this.fileId.push(...id);
-        this.init();
-      },
-      browseOpen(row) {
-        window.open(setFileUrl(row));
-      },
-      addFile() {
-        this.$emit(
-          'success',
-          this.tableList.map((item) => item.id)
-        );
-        this.showEditFlag = false;
-      },
-      addTemplate() {
-        let list = this.$refs.doc_templateRef.getTableList();
-        this.fileShow = false;
-        if (list.length == 0) {
-          this.$message.error('请选择一条数据');
-          return;
-        }
-        this.tableList.push(...list);
-      }
-    }
-  };
-</script>
+<template>
+  <ele-modal
+    width="60%"
+    :visible.sync="showEditFlag"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    ref="Emodal"
+    :maxable="true"
+    :resizable="true"
+  >
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="table"
+      :pageSizes="tablePageSizes"
+      :columns="columns"
+      :datasource="tableList"
+      tool-class="ele-toolbar-form"
+      :needPage="false"
+      row-key="id"
+      :cache-key="cacheKeyUrl"
+    >
+      <template v-slot:toolbar v-if="type != 'view'">
+        <el-button type="primary" @click="fileEditOpen">本地上传</el-button>
+        <el-button type="primary" @click="fileShow = true">
+          关联文档库
+        </el-button>
+      </template>
+      <!-- 操作列 -->
+      <template v-slot:action="{ row }">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="browseOpen(row)"
+        >
+          浏览
+        </el-link>
+
+        <el-popconfirm
+          v-if="type != 'view'"
+          class="ele-action"
+          title="确定要删除吗?"
+          @confirm="remove(row)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete">
+              删除
+            </el-link>
+          </template>
+        </el-popconfirm>
+      </template>
+    </ele-pro-table>
+    <template v-slot:footer>
+      <el-button @click="showEditFlag = false">取消</el-button>
+      <el-button type="primary" @click="addFile" v-if="type != 'view'">
+        确认
+      </el-button>
+    </template>
+    <fileEdit ref="fileEditRef" @done="done"></fileEdit>
+    <ele-modal
+      width="80%"
+      :visible.sync="fileShow"
+      :close-on-click-modal="false"
+      custom-class="ele-dialog-form"
+      append-to-body
+      :maxable="true"
+      :resizable="true"
+    >
+      <doc_template
+        :disabledTableList="tableList"
+        ref="doc_templateRef"
+      ></doc_template>
+      <template v-slot:footer>
+        <el-button @click="fileShow = false">取消</el-button>
+        <el-button type="primary" @click="addTemplate"> 确认 </el-button>
+      </template>
+    </ele-modal>
+    <browse ref="browseRef"></browse>
+  </ele-modal>
+</template>
+
+<script>
+  import doc_template from './doc_template.vue';
+  import fileEdit from './file-edit.vue';
+  import browse from './browse.vue';
+  import { queryIds } from './api';
+  import { setFileUrl } from './util.js';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+
+  export default {
+    mixins: [tabMixins],
+    components: { doc_template, fileEdit, browse },
+
+    data() {
+      return {
+        fileId: [],
+        fileShow: false,
+        showEditFlag: false,
+        tableList: [],
+        type: 'add',
+        cacheKeyUrl: 'eam-addDoc-main',
+        tabMixinsInit: false,
+        columns: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
+
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue && cellValue[0]?.name;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+
+          {
+            prop: 'sizeUnit',
+            label: '文档大小',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    created() {},
+
+    methods: {
+      open(fileId, type) {
+        //查看详情:view 新增:add
+        this.showEditFlag = true;
+        this.fileId = fileId || [];
+        if (type) {
+          this.type = type;
+        }
+        this.init();
+      },
+      fileEditOpen() {
+        this.$refs.fileEditRef.open();
+      },
+      remove(row) {
+        this.tableList = this.tableList.filter((item) => item.code != row.code);
+        this.fileId = this.tableList.map((item) => item.id);
+      },
+      async init() {
+        if (this.fileId.length > 0) {
+          this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
+        } else {
+          this.tableList = [];
+        }
+      },
+      done(id) {
+        this.fileId.push(...id);
+        this.init();
+      },
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      addFile() {
+        this.$emit(
+          'success',
+          this.tableList.map((item) => item.id)
+        );
+        this.showEditFlag = false;
+      },
+      addTemplate() {
+        let list = this.$refs.doc_templateRef.getTableList();
+        this.fileShow = false;
+        if (list.length == 0) {
+          this.$message.error('请选择一条数据');
+          return;
+        }
+        this.tableList.push(...list);
+      }
+    }
+  };
+</script>

+ 31 - 46
src/views/warning/warningSetting/components/addWarningDialog.vue

@@ -439,6 +439,32 @@
   import { getUserPage } from '@/api/system/organization';
   import { getPhysicalModel } from '@/api/ledgerAssets/equipment';
   import { save, update, getById } from '@/api/warning/index.js';
+  const defaultForm = {
+    level: '', // 告警级别
+    deviceId: '',
+    deviceName: '',
+    deviceCode: '',
+    iotId: '',
+    name: '', // 告警名称
+    generateDocumentType: null, // 是否生成保修工单
+    description: '', // 告警描述
+    triggerLogic: 1, // 告警触发条件类型选择
+    alarmMode: '', // 告警方式
+    conditions: [
+      // {
+      //   attributeCode: 'identifier',
+      //   attributeName: '温度'
+      // }
+      {}
+    ], // 基本信息触发条件表格
+    notices: [
+      {
+        receiverIds: '', // 告警通知人id
+        receiverName: '', // 告警通知人name
+        noticeTypes: '3'
+      }
+    ] // 通知设置表格
+  };
 
   export default {
     components: { MaterialAdd },
@@ -453,32 +479,7 @@
         workItems: [],
         ruleId: '',
         saveLoading: false,
-        baseInfoForm: {
-          level: '', // 告警级别
-          deviceId: '',
-          deviceName: '',
-          deviceCode: '',
-          iotId: '',
-          name: '', // 告警名称
-          generateDocumentType: null, // 是否生成保修工单
-          description: '', // 告警描述
-          triggerLogic: 1, // 告警触发条件类型选择
-          alarmMode: '', // 告警方式
-          conditions: [
-            // {
-            //   attributeCode: 'identifier',
-            //   attributeName: '温度'
-            // }
-            {}
-          ], // 基本信息触发条件表格
-          notices: [
-            {
-              receiverIds: '', // 告警通知人id
-              receiverName: '', // 告警通知人name
-              noticeTypes: '3'
-            }
-          ] // 通知设置表格
-        },
+        baseInfoForm: { ...defaultForm },
         baseInfoFormRules: {
           level: [
             { required: true, message: '请选择告警级别', trigger: 'change' }
@@ -490,7 +491,7 @@
           name: [
             { required: true, message: '请输入告警名称', trigger: 'blur' }
           ],
-          alarmTrigger: [
+          triggerLogic: [
             { required: true, message: '请选择触发条件', trigger: 'change' }
           ]
         },
@@ -504,7 +505,7 @@
         this.baseInfoForm.deviceId = data.id;
         this.baseInfoForm.deviceName = data.name;
         this.baseInfoForm.deviceCode = data.code;
-        this.iotId == data.iotId;
+        this.iotId = data.iotId;
         this.baseInfoForm.conditions = [];
         getPhysicalModel(data.id).then((res) => {
           this.temperatureList = res.properties;
@@ -657,7 +658,7 @@
           return;
         } else {
           this.baseInfoForm?.conditions.forEach((item, index) => {
-            console.log(item,'item')
+            console.log(item, 'item');
             if (!item.attributeCode || !item.operator || !item.thresholdValue) {
               is = true;
             }
@@ -688,23 +689,7 @@
       // 重置弹窗信息
       _resetDialogInfo() {
         this.baseInfoForm = {
-          level: '', // 告警级别
-          alarmEquipmentId: '', // 告警设备类型id
-          alarmEquipmentName: '', // 告警设备类型name
-          name: '', // 告警名称
-          // status: false, // 状态
-          // generateDocumentType: false, // 是否生成保修工单
-          description: '', // 告警描述
-          alarmTrigger: 0, // 告警触发条件类型选择
-          alarmMode: '', // 告警方式
-          conditions: [{}], // 基本信息触发条件表格
-          notices: [
-            {
-              receiverIds: '', // 告警通知人id
-              receiverName: '', // 告警通知人name
-              noticeTypes: '3'
-            }
-          ] // 通知设置表格
+          ...defaultForm
         };
         this.tabActiveName = 'baseInfo';
         this.$refs.baseInfoFormRef.resetFields();