Commit 9cf40bee3e6fe0c2cd3824bce946fda2e815d085

Authored by fengwotao
1 parent a28b46f1

feat: 告警配置,新增修改状态权限标识

... ... @@ -37,13 +37,21 @@
37 37 </a-button>
38 38 </template>
39 39 <template #status="{ record }">
40   - <Switch
41   - :checked="record.status === 1"
42   - :loading="record.pendingStatus"
43   - checkedChildren="启用"
44   - unCheckedChildren="禁用"
45   - @change="(checked:boolean)=>statusChange(checked,record)"
46   - />
  40 + <Authority value="api:yt:alarm:profile:status">
  41 + <Switch
  42 + :checked="record.status === 1"
  43 + :loading="record.pendingStatus"
  44 + checkedChildren="启用"
  45 + unCheckedChildren="禁用"
  46 + @change="(checked:boolean)=>statusChange(checked,record)"
  47 + />
  48 + </Authority>
  49 + <Tag
  50 + v-if="!hasPermission('api:yt:alarm:profile:status')"
  51 + :color="record.status ? 'green' : 'red'"
  52 + >
  53 + {{ record.status ? '启用' : '禁用' }}
  54 + </Tag>
47 55 </template>
48 56 <template #action="{ record }">
49 57 <TableAction
... ... @@ -88,7 +96,7 @@
88 96 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
89 97 import { deleteAlarmConfig, queryAlarmConfig } from '/@/api/alarm/config/alarmConfig';
90 98 import { searchFormSchema, columns } from './config.data';
91   - import { Modal, Popconfirm } from 'ant-design-vue';
  99 + import { Modal, Popconfirm, Tag } from 'ant-design-vue';
92 100 import { JsonPreview } from '/@/components/CodeEditor';
93 101 import { findDictItemByCode } from '/@/api/system/dict';
94 102 import { alarmContactGetPage } from '/@/api/device/deviceConfigApi';
... ... @@ -97,6 +105,7 @@
97 105 import { putAlarmConfigStatus } from '/@/api/alarm/config/alarmConfig';
98 106 import { useMessage } from '/@/hooks/web/useMessage';
99 107 import { Authority } from '/@/components/Authority';
  108 + import { usePermission } from '/@/hooks/web/usePermission';
100 109
101 110 export default defineComponent({
102 111 components: {
... ... @@ -108,8 +117,10 @@
108 117 Switch,
109 118 Authority,
110 119 Popconfirm,
  120 + Tag,
111 121 },
112 122 setup() {
  123 + const { hasPermission } = usePermission();
113 124 const searchInfo = reactive<Recordable>({});
114 125 const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
115 126 // 刷新
... ... @@ -250,6 +261,7 @@
250 261 showAlarmContact,
251 262 showMessageMode,
252 263 statusChange,
  264 + hasPermission,
253 265 };
254 266 },
255 267 });
... ...