Commit 61be65f3f1e4859f6f6f0c857ac19d4e669f9158
Merge branch 'ft' into 'main_dev'
feat: 系统管理下的角色管理 配置状态新增权限控制 See merge request yunteng/thingskit-front!829
Showing
6 changed files
with
86 additions
and
37 deletions
... | ... | @@ -97,10 +97,13 @@ |
97 | 97 | ...operationString, |
98 | 98 | ...operationBoolean, |
99 | 99 | ].find((item) => item.value === curr.value.logic)?.symbol; |
100 | + const findAttribute = item.attribute.find( | |
101 | + (findItem) => findItem.identifier === curr.value.key | |
102 | + ); | |
100 | 103 | const value = { |
101 | 104 | ['触发属性']: findName, |
102 | 105 | ['触发条件']: `${findLogin}${curr.value.logicValue}`, |
103 | - ['触发值']: curr.value.realValue, | |
106 | + ['触发值']: `${curr.value.realValue}${findAttribute.detail?.dataType?.specs?.unit?.key}`, | |
104 | 107 | }; |
105 | 108 | const data = { |
106 | 109 | [item.name]: value, |
... | ... | @@ -142,6 +145,7 @@ |
142 | 145 | const attribute = attributes.map((item) => ({ |
143 | 146 | identifier: item.identifier, |
144 | 147 | name: item.name, |
148 | + detail: item.detail, | |
145 | 149 | })); |
146 | 150 | return { |
147 | 151 | name, | ... | ... |
... | ... | @@ -17,16 +17,26 @@ |
17 | 17 | </Authority> |
18 | 18 | </template> |
19 | 19 | <template #config="{ record }"> |
20 | - <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | |
20 | + <Authority value="api:yt:message:get"> | |
21 | + <a-button type="link" class="ml-2" @click="showData(record)"> 查看配置 </a-button> | |
22 | + </Authority> | |
21 | 23 | </template> |
22 | 24 | <template #status="{ record }"> |
23 | - <Switch | |
24 | - :checked="record.status === 1" | |
25 | - :loading="record.pendingStatus" | |
26 | - checkedChildren="启用" | |
27 | - unCheckedChildren="禁用" | |
28 | - @change="(checked:boolean)=>statusChange(checked,record)" | |
29 | - /> | |
25 | + <Authority value="api:yt:message:status"> | |
26 | + <Switch | |
27 | + :checked="record.status === 1" | |
28 | + :loading="record.pendingStatus" | |
29 | + checkedChildren="启用" | |
30 | + unCheckedChildren="禁用" | |
31 | + @change="(checked:boolean)=>statusChange(checked,record)" | |
32 | + /> | |
33 | + </Authority> | |
34 | + <Tag | |
35 | + v-if="!hasPermission('api:yt:message:status')" | |
36 | + :color="record.status ? 'green' : 'red'" | |
37 | + > | |
38 | + {{ record.status ? '启用' : '禁用' }} | |
39 | + </Tag> | |
30 | 40 | </template> |
31 | 41 | <template #action="{ record }"> |
32 | 42 | <TableAction |
... | ... | @@ -62,18 +72,20 @@ |
62 | 72 | import { useDrawer } from '/@/components/Drawer'; |
63 | 73 | import ConfigDrawer from './ConfigDrawer.vue'; |
64 | 74 | import { columns, searchFormSchema } from './config.data'; |
65 | - import { Modal, Popconfirm } from 'ant-design-vue'; | |
75 | + import { Modal, Popconfirm, Tag } from 'ant-design-vue'; | |
66 | 76 | import { JsonPreview } from '/@/components/CodeEditor'; |
67 | 77 | import { useMessage } from '/@/hooks/web/useMessage'; |
68 | 78 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
69 | 79 | import { Switch } from 'ant-design-vue'; |
70 | 80 | import { setMessageConfigStatus } from '/@/api/message/config'; |
71 | 81 | import { Authority } from '/@/components/Authority'; |
82 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
72 | 83 | |
73 | 84 | export default defineComponent({ |
74 | 85 | name: 'MessageConfigManagement', |
75 | - components: { BasicTable, ConfigDrawer, TableAction, Switch, Authority, Popconfirm }, | |
86 | + components: { BasicTable, ConfigDrawer, TableAction, Switch, Authority, Popconfirm, Tag }, | |
76 | 87 | setup() { |
88 | + const { hasPermission } = usePermission(); | |
77 | 89 | const [registerDrawer, { openDrawer }] = useDrawer(); |
78 | 90 | function handleSuccess() { |
79 | 91 | reload(); |
... | ... | @@ -168,6 +180,7 @@ |
168 | 180 | handleDeleteOrBatchDelete, |
169 | 181 | hasBatchDelete, |
170 | 182 | statusChange, |
183 | + hasPermission, | |
171 | 184 | }; |
172 | 185 | }, |
173 | 186 | }); | ... | ... |
... | ... | @@ -22,13 +22,21 @@ |
22 | 22 | </a-button> |
23 | 23 | </template> |
24 | 24 | <template #status="{ record }"> |
25 | - <Switch | |
26 | - :checked="record.status === 1" | |
27 | - :loading="record.pendingStatus" | |
28 | - checkedChildren="启用" | |
29 | - unCheckedChildren="禁用" | |
30 | - @change="(checked:boolean)=>statusChange(checked,record)" | |
31 | - /> | |
25 | + <Authority value="api:yt:template:status"> | |
26 | + <Switch | |
27 | + :checked="record.status === 1" | |
28 | + :loading="record.pendingStatus" | |
29 | + checkedChildren="启用" | |
30 | + unCheckedChildren="禁用" | |
31 | + @change="(checked:boolean)=>statusChange(checked,record)" | |
32 | + /> | |
33 | + </Authority> | |
34 | + <Tag | |
35 | + v-if="!hasPermission('api:yt:template:status')" | |
36 | + :color="record.status ? 'green' : 'red'" | |
37 | + > | |
38 | + {{ record.status ? '启用' : '禁用' }} | |
39 | + </Tag> | |
32 | 40 | </template> |
33 | 41 | <template #action="{ record }"> |
34 | 42 | <TableAction |
... | ... | @@ -80,9 +88,10 @@ |
80 | 88 | import SendEmail from '/@/views/message/template/SendEmail.vue'; |
81 | 89 | import { useMessage } from '/@/hooks/web/useMessage'; |
82 | 90 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
83 | - import { Switch, Popconfirm } from 'ant-design-vue'; | |
91 | + import { Switch, Popconfirm, Tag } from 'ant-design-vue'; | |
84 | 92 | import { setMessageTemplateStatus } from '/@/api/message/template'; |
85 | 93 | import { Authority } from '/@/components/Authority'; |
94 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
86 | 95 | |
87 | 96 | export default defineComponent({ |
88 | 97 | name: 'MessageTemplateManagement', |
... | ... | @@ -95,8 +104,10 @@ |
95 | 104 | Switch, |
96 | 105 | Authority, |
97 | 106 | Popconfirm, |
107 | + Tag, | |
98 | 108 | }, |
99 | 109 | setup() { |
110 | + const { hasPermission } = usePermission(); | |
100 | 111 | const [registerModal, { openModal: openModal }] = useModal(); |
101 | 112 | const [registerMailModal, { openModal: openMailModal }] = useModal(); |
102 | 113 | const go = useGo(); |
... | ... | @@ -218,6 +229,7 @@ |
218 | 229 | handleDeleteOrBatchDelete, |
219 | 230 | statusChange, |
220 | 231 | hasBatchDelete, |
232 | + hasPermission, | |
221 | 233 | }; |
222 | 234 | }, |
223 | 235 | }); | ... | ... |
... | ... | @@ -9,6 +9,7 @@ export enum PermissionReportConfigEnum { |
9 | 9 | PERMISSION_GET = 'api:yt:report:get', |
10 | 10 | PERMISSION_DELETE = 'api:yt:report_form:config:delete', |
11 | 11 | PERMISSION_UPDATE = 'api:yt:report_form:config:update', |
12 | + PERMISSION_STATUS = 'api:yt:report_form:config:status', | |
12 | 13 | } |
13 | 14 | |
14 | 15 | //业务文字描述配置枚举 | ... | ... |
... | ... | @@ -74,14 +74,22 @@ |
74 | 74 | /> |
75 | 75 | </template> |
76 | 76 | <template #configStatus="{ record }"> |
77 | - <Switch | |
78 | - :disabled="disabledSwitch" | |
79 | - :checked="record.status === 1" | |
80 | - :loading="record.pendingStatus" | |
81 | - :checkedChildren="BusinessReportConfigTextEnum.BUSINESS_ENABLE_TEXT" | |
82 | - :unCheckedChildren="BusinessReportConfigTextEnum.BUSINESS_DISABLE_TEXT" | |
83 | - @change="(checked: boolean) => statusChange(checked, record)" | |
84 | - /> | |
77 | + <Authority :value="PermissionReportConfigEnum.PERMISSION_STATUS"> | |
78 | + <Switch | |
79 | + :disabled="disabledSwitch" | |
80 | + :checked="record.status === 1" | |
81 | + :loading="record.pendingStatus" | |
82 | + :checkedChildren="BusinessReportConfigTextEnum.BUSINESS_ENABLE_TEXT" | |
83 | + :unCheckedChildren="BusinessReportConfigTextEnum.BUSINESS_DISABLE_TEXT" | |
84 | + @change="(checked: boolean) => statusChange(checked, record)" | |
85 | + /> | |
86 | + </Authority> | |
87 | + <Tag | |
88 | + v-if="!hasPermission(PermissionReportConfigEnum.PERMISSION_STATUS)" | |
89 | + :color="record.status ? 'green' : 'red'" | |
90 | + > | |
91 | + {{ record.status ? '启用' : '禁用' }} | |
92 | + </Tag> | |
85 | 93 | </template> |
86 | 94 | </BasicTable> |
87 | 95 | <ReportConfigDrawer @register="registerDrawer" @success="handleSuccess" /> |
... | ... | @@ -101,7 +109,7 @@ |
101 | 109 | import { defaultTableAttribtes } from './config'; |
102 | 110 | import { Authority } from '/@/components/Authority'; |
103 | 111 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
104 | - import { Popconfirm, Switch } from 'ant-design-vue'; | |
112 | + import { Popconfirm, Switch, Tag } from 'ant-design-vue'; | |
105 | 113 | import { useModal } from '/@/components/Modal'; |
106 | 114 | import { useGo } from '/@/hooks/web/usePage'; |
107 | 115 | import { useMessage } from '/@/hooks/web/useMessage'; |
... | ... | @@ -111,6 +119,9 @@ |
111 | 119 | BusinessReportConfigTextEnum, |
112 | 120 | BusinessReportConfigStatusEnum, |
113 | 121 | } from './enum'; |
122 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
123 | + | |
124 | + const { hasPermission } = usePermission(); | |
114 | 125 | |
115 | 126 | const disabledSwitch = ref(false); |
116 | 127 | ... | ... |
... | ... | @@ -21,13 +21,18 @@ |
21 | 21 | </Authority> |
22 | 22 | </template> |
23 | 23 | <template #status="{ record }"> |
24 | - <Switch | |
25 | - :checked="record.status === 1" | |
26 | - :loading="record.pendingStatus" | |
27 | - checkedChildren="启用" | |
28 | - unCheckedChildren="禁用" | |
29 | - @change="(checked:boolean)=>statusChange(checked,record)" | |
30 | - /> | |
24 | + <Authority value="api:yt:role:status"> | |
25 | + <Switch | |
26 | + :checked="record.status === 1" | |
27 | + :loading="record.pendingStatus" | |
28 | + checkedChildren="启用" | |
29 | + unCheckedChildren="禁用" | |
30 | + @change="(checked:boolean)=>statusChange(checked,record)" | |
31 | + /> | |
32 | + </Authority> | |
33 | + <Tag v-if="!hasPermission('api:yt:role:status')" :color="record.status ? 'green' : 'red'"> | |
34 | + {{ record.status ? '启用' : '禁用' }} | |
35 | + </Tag> | |
31 | 36 | </template> |
32 | 37 | <template #action="{ record }"> |
33 | 38 | <TableAction |
... | ... | @@ -67,12 +72,14 @@ |
67 | 72 | import { Authority } from '/@/components/Authority'; |
68 | 73 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
69 | 74 | import { useMessage } from '/@/hooks/web/useMessage'; |
70 | - import { Switch, Popconfirm } from 'ant-design-vue'; | |
75 | + import { Switch, Popconfirm, Tag } from 'ant-design-vue'; | |
76 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
71 | 77 | |
72 | 78 | export default defineComponent({ |
73 | 79 | name: 'RoleManagement', |
74 | - components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm }, | |
80 | + components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm, Tag }, | |
75 | 81 | setup() { |
82 | + const { hasPermission } = usePermission(); | |
76 | 83 | const [registerDrawer, { openDrawer }] = useDrawer(); |
77 | 84 | function handleSuccess() { |
78 | 85 | reload(); |
... | ... | @@ -157,6 +164,7 @@ |
157 | 164 | hasBatchDelete, |
158 | 165 | handleDeleteOrBatchDelete, |
159 | 166 | statusChange, |
167 | + hasPermission, | |
160 | 168 | }; |
161 | 169 | }, |
162 | 170 | }); | ... | ... |