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,10 +97,13 @@ | ||
97 | ...operationString, | 97 | ...operationString, |
98 | ...operationBoolean, | 98 | ...operationBoolean, |
99 | ].find((item) => item.value === curr.value.logic)?.symbol; | 99 | ].find((item) => item.value === curr.value.logic)?.symbol; |
100 | + const findAttribute = item.attribute.find( | ||
101 | + (findItem) => findItem.identifier === curr.value.key | ||
102 | + ); | ||
100 | const value = { | 103 | const value = { |
101 | ['触发属性']: findName, | 104 | ['触发属性']: findName, |
102 | ['触发条件']: `${findLogin}${curr.value.logicValue}`, | 105 | ['触发条件']: `${findLogin}${curr.value.logicValue}`, |
103 | - ['触发值']: curr.value.realValue, | 106 | + ['触发值']: `${curr.value.realValue}${findAttribute.detail?.dataType?.specs?.unit?.key}`, |
104 | }; | 107 | }; |
105 | const data = { | 108 | const data = { |
106 | [item.name]: value, | 109 | [item.name]: value, |
@@ -142,6 +145,7 @@ | @@ -142,6 +145,7 @@ | ||
142 | const attribute = attributes.map((item) => ({ | 145 | const attribute = attributes.map((item) => ({ |
143 | identifier: item.identifier, | 146 | identifier: item.identifier, |
144 | name: item.name, | 147 | name: item.name, |
148 | + detail: item.detail, | ||
145 | })); | 149 | })); |
146 | return { | 150 | return { |
147 | name, | 151 | name, |
@@ -17,16 +17,26 @@ | @@ -17,16 +17,26 @@ | ||
17 | </Authority> | 17 | </Authority> |
18 | </template> | 18 | </template> |
19 | <template #config="{ record }"> | 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 | </template> | 23 | </template> |
22 | <template #status="{ record }"> | 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 | </template> | 40 | </template> |
31 | <template #action="{ record }"> | 41 | <template #action="{ record }"> |
32 | <TableAction | 42 | <TableAction |
@@ -62,18 +72,20 @@ | @@ -62,18 +72,20 @@ | ||
62 | import { useDrawer } from '/@/components/Drawer'; | 72 | import { useDrawer } from '/@/components/Drawer'; |
63 | import ConfigDrawer from './ConfigDrawer.vue'; | 73 | import ConfigDrawer from './ConfigDrawer.vue'; |
64 | import { columns, searchFormSchema } from './config.data'; | 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 | import { JsonPreview } from '/@/components/CodeEditor'; | 76 | import { JsonPreview } from '/@/components/CodeEditor'; |
67 | import { useMessage } from '/@/hooks/web/useMessage'; | 77 | import { useMessage } from '/@/hooks/web/useMessage'; |
68 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 78 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
69 | import { Switch } from 'ant-design-vue'; | 79 | import { Switch } from 'ant-design-vue'; |
70 | import { setMessageConfigStatus } from '/@/api/message/config'; | 80 | import { setMessageConfigStatus } from '/@/api/message/config'; |
71 | import { Authority } from '/@/components/Authority'; | 81 | import { Authority } from '/@/components/Authority'; |
82 | + import { usePermission } from '/@/hooks/web/usePermission'; | ||
72 | 83 | ||
73 | export default defineComponent({ | 84 | export default defineComponent({ |
74 | name: 'MessageConfigManagement', | 85 | name: 'MessageConfigManagement', |
75 | - components: { BasicTable, ConfigDrawer, TableAction, Switch, Authority, Popconfirm }, | 86 | + components: { BasicTable, ConfigDrawer, TableAction, Switch, Authority, Popconfirm, Tag }, |
76 | setup() { | 87 | setup() { |
88 | + const { hasPermission } = usePermission(); | ||
77 | const [registerDrawer, { openDrawer }] = useDrawer(); | 89 | const [registerDrawer, { openDrawer }] = useDrawer(); |
78 | function handleSuccess() { | 90 | function handleSuccess() { |
79 | reload(); | 91 | reload(); |
@@ -168,6 +180,7 @@ | @@ -168,6 +180,7 @@ | ||
168 | handleDeleteOrBatchDelete, | 180 | handleDeleteOrBatchDelete, |
169 | hasBatchDelete, | 181 | hasBatchDelete, |
170 | statusChange, | 182 | statusChange, |
183 | + hasPermission, | ||
171 | }; | 184 | }; |
172 | }, | 185 | }, |
173 | }); | 186 | }); |
@@ -22,13 +22,21 @@ | @@ -22,13 +22,21 @@ | ||
22 | </a-button> | 22 | </a-button> |
23 | </template> | 23 | </template> |
24 | <template #status="{ record }"> | 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 | </template> | 40 | </template> |
33 | <template #action="{ record }"> | 41 | <template #action="{ record }"> |
34 | <TableAction | 42 | <TableAction |
@@ -80,9 +88,10 @@ | @@ -80,9 +88,10 @@ | ||
80 | import SendEmail from '/@/views/message/template/SendEmail.vue'; | 88 | import SendEmail from '/@/views/message/template/SendEmail.vue'; |
81 | import { useMessage } from '/@/hooks/web/useMessage'; | 89 | import { useMessage } from '/@/hooks/web/useMessage'; |
82 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 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 | import { setMessageTemplateStatus } from '/@/api/message/template'; | 92 | import { setMessageTemplateStatus } from '/@/api/message/template'; |
85 | import { Authority } from '/@/components/Authority'; | 93 | import { Authority } from '/@/components/Authority'; |
94 | + import { usePermission } from '/@/hooks/web/usePermission'; | ||
86 | 95 | ||
87 | export default defineComponent({ | 96 | export default defineComponent({ |
88 | name: 'MessageTemplateManagement', | 97 | name: 'MessageTemplateManagement', |
@@ -95,8 +104,10 @@ | @@ -95,8 +104,10 @@ | ||
95 | Switch, | 104 | Switch, |
96 | Authority, | 105 | Authority, |
97 | Popconfirm, | 106 | Popconfirm, |
107 | + Tag, | ||
98 | }, | 108 | }, |
99 | setup() { | 109 | setup() { |
110 | + const { hasPermission } = usePermission(); | ||
100 | const [registerModal, { openModal: openModal }] = useModal(); | 111 | const [registerModal, { openModal: openModal }] = useModal(); |
101 | const [registerMailModal, { openModal: openMailModal }] = useModal(); | 112 | const [registerMailModal, { openModal: openMailModal }] = useModal(); |
102 | const go = useGo(); | 113 | const go = useGo(); |
@@ -218,6 +229,7 @@ | @@ -218,6 +229,7 @@ | ||
218 | handleDeleteOrBatchDelete, | 229 | handleDeleteOrBatchDelete, |
219 | statusChange, | 230 | statusChange, |
220 | hasBatchDelete, | 231 | hasBatchDelete, |
232 | + hasPermission, | ||
221 | }; | 233 | }; |
222 | }, | 234 | }, |
223 | }); | 235 | }); |
@@ -9,6 +9,7 @@ export enum PermissionReportConfigEnum { | @@ -9,6 +9,7 @@ export enum PermissionReportConfigEnum { | ||
9 | PERMISSION_GET = 'api:yt:report:get', | 9 | PERMISSION_GET = 'api:yt:report:get', |
10 | PERMISSION_DELETE = 'api:yt:report_form:config:delete', | 10 | PERMISSION_DELETE = 'api:yt:report_form:config:delete', |
11 | PERMISSION_UPDATE = 'api:yt:report_form:config:update', | 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,14 +74,22 @@ | ||
74 | /> | 74 | /> |
75 | </template> | 75 | </template> |
76 | <template #configStatus="{ record }"> | 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 | </template> | 93 | </template> |
86 | </BasicTable> | 94 | </BasicTable> |
87 | <ReportConfigDrawer @register="registerDrawer" @success="handleSuccess" /> | 95 | <ReportConfigDrawer @register="registerDrawer" @success="handleSuccess" /> |
@@ -101,7 +109,7 @@ | @@ -101,7 +109,7 @@ | ||
101 | import { defaultTableAttribtes } from './config'; | 109 | import { defaultTableAttribtes } from './config'; |
102 | import { Authority } from '/@/components/Authority'; | 110 | import { Authority } from '/@/components/Authority'; |
103 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 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 | import { useModal } from '/@/components/Modal'; | 113 | import { useModal } from '/@/components/Modal'; |
106 | import { useGo } from '/@/hooks/web/usePage'; | 114 | import { useGo } from '/@/hooks/web/usePage'; |
107 | import { useMessage } from '/@/hooks/web/useMessage'; | 115 | import { useMessage } from '/@/hooks/web/useMessage'; |
@@ -111,6 +119,9 @@ | @@ -111,6 +119,9 @@ | ||
111 | BusinessReportConfigTextEnum, | 119 | BusinessReportConfigTextEnum, |
112 | BusinessReportConfigStatusEnum, | 120 | BusinessReportConfigStatusEnum, |
113 | } from './enum'; | 121 | } from './enum'; |
122 | + import { usePermission } from '/@/hooks/web/usePermission'; | ||
123 | + | ||
124 | + const { hasPermission } = usePermission(); | ||
114 | 125 | ||
115 | const disabledSwitch = ref(false); | 126 | const disabledSwitch = ref(false); |
116 | 127 |
@@ -21,13 +21,18 @@ | @@ -21,13 +21,18 @@ | ||
21 | </Authority> | 21 | </Authority> |
22 | </template> | 22 | </template> |
23 | <template #status="{ record }"> | 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 | </template> | 36 | </template> |
32 | <template #action="{ record }"> | 37 | <template #action="{ record }"> |
33 | <TableAction | 38 | <TableAction |
@@ -67,12 +72,14 @@ | @@ -67,12 +72,14 @@ | ||
67 | import { Authority } from '/@/components/Authority'; | 72 | import { Authority } from '/@/components/Authority'; |
68 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 73 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
69 | import { useMessage } from '/@/hooks/web/useMessage'; | 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 | export default defineComponent({ | 78 | export default defineComponent({ |
73 | name: 'RoleManagement', | 79 | name: 'RoleManagement', |
74 | - components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm }, | 80 | + components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm, Tag }, |
75 | setup() { | 81 | setup() { |
82 | + const { hasPermission } = usePermission(); | ||
76 | const [registerDrawer, { openDrawer }] = useDrawer(); | 83 | const [registerDrawer, { openDrawer }] = useDrawer(); |
77 | function handleSuccess() { | 84 | function handleSuccess() { |
78 | reload(); | 85 | reload(); |
@@ -157,6 +164,7 @@ | @@ -157,6 +164,7 @@ | ||
157 | hasBatchDelete, | 164 | hasBatchDelete, |
158 | handleDeleteOrBatchDelete, | 165 | handleDeleteOrBatchDelete, |
159 | statusChange, | 166 | statusChange, |
167 | + hasPermission, | ||
160 | }; | 168 | }; |
161 | }, | 169 | }, |
162 | }); | 170 | }); |