lishuangjiang@potevio.com 1 год назад
Родитель
Сommit
1fc7b123f7
1 измененных файлов с 39 добавлено и 4 удалено
  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>
 <script lang="ts" setup>
 import { IColumn } from '@/components/common/types/tableCommon'
 import { IColumn } from '@/components/common/types/tableCommon'
 import { getMsgList } from './api/alarm.api'
 import { getMsgList } from './api/alarm.api'
+import { listDept} from '@/api/system/dept'
 
 
 import YtCrud from '@/components/common/yt-crud.vue'
 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: '名称',
   label: '名称',
   key: 'name',
   key: 'name',
   search: true,
   search: true,
+  tableWidth: 260,
   rules: [{ required: true, message: '告警名称不能为空' }],
   rules: [{ required: true, message: '告警名称不能为空' }],
 }, {
 }, {
   label: '告警等级',
   label: '告警等级',
@@ -54,7 +64,21 @@ const column: IColumn[] = [{
       value: 5,
       value: 5,
     }],
     }],
   }
   }
-}, {
+},
+  {
+    label: '所属部门',
+    key: 'createDept',
+    search: true,
+    type: 'select',
+    hide: true,
+    formHide: true,
+    componentProps: {
+      labelAlias: 'deptName',
+      valueAlias: 'id',
+      options: [],
+    }
+  },
+  {
   label: '是否已读',
   label: '是否已读',
   key: 'read',
   key: 'read',
   tableWidth: 120,
   tableWidth: 120,
@@ -68,12 +92,11 @@ const column: IColumn[] = [{
 }, {
 }, {
   label: '告警内容',
   label: '告警内容',
   key: 'details',
   key: 'details',
-  tableWidth: 360,
   componentProps: {
   componentProps: {
     type: 'textarea',
     type: 'textarea',
     rows: 4,
     rows: 4,
   }
   }
-}]
+}])
 
 
 
 
 const data = ref([])
 const data = ref([])
@@ -98,4 +121,16 @@ const getData =  () => {
     state.loading = false
     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>
 </script>