lishuangjiang@potevio.com hace 1 año
padre
commit
1fc7b123f7
Se han modificado 1 ficheros con 39 adiciones y 4 borrados
  1. 39 4
      src/views/iot/alarm/list.vue

+ 39 - 4
src/views/iot/alarm/list.vue

@@ -21,13 +21,23 @@
 <script lang="ts" setup>
 import { IColumn } from '@/components/common/types/tableCommon'
 import { getMsgList } from './api/alarm.api'
+import { listDept} from '@/api/system/dept'
 
 import YtCrud from '@/components/common/yt-crud.vue'
 
-const column: IColumn[] = [{
+interface DeptOptionsType {
+  id: number | string
+  deptName: string
+  children: DeptOptionsType[]
+}
+
+const deptOptions = ref<DeptOptionsType[]>([])
+
+const column= ref<IColumn[]>([{
   label: '名称',
   key: 'name',
   search: true,
+  tableWidth: 260,
   rules: [{ required: true, message: '告警名称不能为空' }],
 }, {
   label: '告警等级',
@@ -54,7 +64,21 @@ const column: IColumn[] = [{
       value: 5,
     }],
   }
-}, {
+},
+  {
+    label: '所属部门',
+    key: 'createDept',
+    search: true,
+    type: 'select',
+    hide: true,
+    formHide: true,
+    componentProps: {
+      labelAlias: 'deptName',
+      valueAlias: 'id',
+      options: [],
+    }
+  },
+  {
   label: '是否已读',
   key: 'read',
   tableWidth: 120,
@@ -68,12 +92,11 @@ const column: IColumn[] = [{
 }, {
   label: '告警内容',
   key: 'details',
-  tableWidth: 360,
   componentProps: {
     type: 'textarea',
     rows: 4,
   }
-}]
+}])
 
 
 const data = ref([])
@@ -98,4 +121,16 @@ const getData =  () => {
     state.loading = false
   })
 }
+
+const getDept = () => {
+  listDept().then((res) => {
+    deptOptions.value = res.data || []
+    column.value.forEach(item => {
+      if (item.key === 'createDept') {
+        item.componentProps.options = deptOptions.value
+      }
+    })
+  })
+}
+getDept()
 </script>