Commit 95e6bb261e35bfae9126b1ca11d8f5cd67b4cafc

Authored by ww
1 parent 7880b723

fix: set product profile button permission

  1 +<svg t="1671442803003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4002" width="200" height="200"><path d="M0 0m178.086957 0l667.826086 0q178.086957 0 178.086957 178.086957l0 667.826086q0 178.086957-178.086957 178.086957l-667.826086 0q-178.086957 0-178.086957-178.086957l0-667.826086q0-178.086957 178.086957-178.086957Z" fill="#2E7BFC" p-id="4003"></path><path d="M758.717217 394.373565v268.866783l-238.191304 134.455652v-268.911304l124.14887-70.054957v94.497391l51.956869-29.985391V429.412174l62.107826-35.038609z m-493.434434 0l238.191304 134.433392v268.866782l-238.191304-134.433391V394.373565zM512 226.304l246.717217 139.241739L512 504.787478l-246.717217-139.241739L512 226.326261z" fill="#FFFFFF" p-id="4004"></path></svg>
@@ -9,6 +9,14 @@ export enum Platform { @@ -9,6 +9,14 @@ export enum Platform {
9 PC = 'pc', 9 PC = 'pc',
10 } 10 }
11 11
  12 +export enum ConfigurationPermission {
  13 + CREATE = 'api:yt:configuration:center:post',
  14 + UPDATE = 'api:yt:configuration:center:update',
  15 + DELETE = 'api:yt:configuration:center:delete',
  16 + DESIGN = 'api:yt:configuration:center:get_configuration_info:design',
  17 + PREVIEW = 'api:yt:configuration:center:get_configuration_info:preview',
  18 +}
  19 +
12 export const PC_DEFAULT_CONTENT = 20 export const PC_DEFAULT_CONTENT =
13 '<mxfile><diagram>dZHBDsIgDIafhvuEzOh5Tr142sEzGXWQsHVhmKFP7xbAidMT5fv/UtoSVrTuZHgvLyhAE5oJR9iBUMrybT4dM3l4stnTzJPGKBHYAir1hACj7a4EDInRImqr+hTW2HVQ24RxY3BMbTfUadWeN7ACVc31ml6VsPK7jVk4g2pkLJ3tgtLy6A5gkFzg+IFYSVhhEK2PWleAnscXB+Pzjn/U988MdPZHwhQsb0+XZEesfAE=</diagram></mxfile>'; 21 '<mxfile><diagram>dZHBDsIgDIafhvuEzOh5Tr142sEzGXWQsHVhmKFP7xbAidMT5fv/UtoSVrTuZHgvLyhAE5oJR9iBUMrybT4dM3l4stnTzJPGKBHYAir1hACj7a4EDInRImqr+hTW2HVQ24RxY3BMbTfUadWeN7ACVc31ml6VsPK7jVk4g2pkLJ3tgtLy6A5gkFzg+IFYSVhhEK2PWleAnscXB+Pzjn/U988MdPZHwhQsb0+XZEesfAE=</diagram></mxfile>';
14 22
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 EditOutlined, 7 EditOutlined,
8 EllipsisOutlined, 8 EllipsisOutlined,
9 } from '@ant-design/icons-vue'; 9 } from '@ant-design/icons-vue';
10 - import { onMounted, reactive, ref, unref } from 'vue'; 10 + import { computed, onMounted, reactive, ref, unref } from 'vue';
11 import { OrganizationIdTree, useResetOrganizationTree } from '../../common/organizationIdTree'; 11 import { OrganizationIdTree, useResetOrganizationTree } from '../../common/organizationIdTree';
12 import { 12 import {
13 deleteConfigurationCenter, 13 deleteConfigurationCenter,
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 import { PageWrapper } from '/@/components/Page'; 17 import { PageWrapper } from '/@/components/Page';
18 import { Dropdown } from '/@/components/Dropdown'; 18 import { Dropdown } from '/@/components/Dropdown';
19 import { BasicForm, useForm } from '/@/components/Form'; 19 import { BasicForm, useForm } from '/@/components/Form';
20 - import { searchFormSchema } from './center.data'; 20 + import { ConfigurationPermission, searchFormSchema } from './center.data';
21 import { useMessage } from '/@/hooks/web/useMessage'; 21 import { useMessage } from '/@/hooks/web/useMessage';
22 import { Authority } from '/@/components/Authority'; 22 import { Authority } from '/@/components/Authority';
23 import { isDevMode } from '/@/utils/env'; 23 import { isDevMode } from '/@/utils/env';
@@ -98,6 +98,16 @@ @@ -98,6 +98,16 @@
98 98
99 const [registerDrawer, { openDrawer }] = useDrawer(); 99 const [registerDrawer, { openDrawer }] = useDrawer();
100 100
  101 + const { hasPermission } = usePermission();
  102 +
  103 + const getPreviewFlag = computed(() => {
  104 + return hasPermission(ConfigurationPermission.PREVIEW);
  105 + });
  106 +
  107 + const getDesignFlag = computed(() => {
  108 + return hasPermission(ConfigurationPermission.DESIGN);
  109 + });
  110 +
101 const handleCreateOrUpdate = (record?: ConfigurationCenterItemsModal) => { 111 const handleCreateOrUpdate = (record?: ConfigurationCenterItemsModal) => {
102 if (record) { 112 if (record) {
103 openDrawer(true, { 113 openDrawer(true, {
@@ -114,15 +124,15 @@ @@ -114,15 +124,15 @@
114 const { configurationPrefix } = useGlobSetting(); 124 const { configurationPrefix } = useGlobSetting();
115 const isDev = isDevMode(); 125 const isDev = isDevMode();
116 126
117 - const { hasPermission } = usePermission();  
118 const handlePreview = (record: ConfigurationCenterItemsModal) => { 127 const handlePreview = (record: ConfigurationCenterItemsModal) => {
119 - if (!hasPermission('api:yt:configuration:center:get_configuration_info:get')) return; 128 + if (!unref(getPreviewFlag)) return;
120 window.open( 129 window.open(
121 `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}&lightbox=1` 130 `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}&lightbox=1`
122 ); 131 );
123 }; 132 };
124 133
125 const handleDesign = (record: ConfigurationCenterItemsModal) => { 134 const handleDesign = (record: ConfigurationCenterItemsModal) => {
  135 + if (!unref(getDesignFlag)) return;
126 window.open(`${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}`); 136 window.open(`${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${record!.id}`);
127 }; 137 };
128 138
@@ -175,7 +185,9 @@ @@ -175,7 +185,9 @@
175 > 185 >
176 <template #header> 186 <template #header>
177 <div class="flex gap-3 justify-end"> 187 <div class="flex gap-3 justify-end">
178 - <Button type="primary" @click="handleCreateOrUpdate()">新增组态</Button> 188 + <Authority :value="ConfigurationPermission.CREATE">
  189 + <Button type="primary" @click="handleCreateOrUpdate()">新增组态</Button>
  190 + </Authority>
179 <Popover :trigger="['hover']"> 191 <Popover :trigger="['hover']">
180 <template #content> 192 <template #content>
181 <div class="w-50"> 193 <div class="w-50">
@@ -214,29 +226,35 @@ @@ -214,29 +226,35 @@
214 </div> 226 </div>
215 </template> 227 </template>
216 <template class="ant-card-actions" #actions> 228 <template class="ant-card-actions" #actions>
217 - <Authority value="api:yt:configuration:center:get_configuration_info:get">  
218 - <Tooltip title="预览">  
219 - <EyeOutlined key="setting" @click="handlePreview(item)" />  
220 - </Tooltip>  
221 - </Authority>  
222 - <Authority value="api:yt:configuration:center:get_configuration_info:get">  
223 - <Tooltip title="设计">  
224 - <EditOutlined key="edit" @click="handleDesign(item)" />  
225 - </Tooltip>  
226 - </Authority> 229 + <Tooltip title="预览">
  230 + <EyeOutlined
  231 + :class="getPreviewFlag ? '' : '!cursor-not-allowed !text-gray-200'"
  232 + key="setting"
  233 + @click="handlePreview(item)"
  234 + />
  235 + </Tooltip>
  236 + <Tooltip title="设计">
  237 + <EditOutlined
  238 + :class="getDesignFlag ? '' : '!cursor-not-allowed !text-gray-200'"
  239 + key="edit"
  240 + @click="handleDesign(item)"
  241 + />
  242 + </Tooltip>
227 <Dropdown 243 <Dropdown
228 :dropMenuList="[ 244 :dropMenuList="[
229 { 245 {
230 text: '编辑', 246 text: '编辑',
231 - auth: 'api:yt:configuration:center:update', 247 + auth: ConfigurationPermission.UPDATE,
232 icon: 'clarity:note-edit-line', 248 icon: 'clarity:note-edit-line',
  249 + event: '',
233 onClick: handleCreateOrUpdate.bind(null, item), 250 onClick: handleCreateOrUpdate.bind(null, item),
234 }, 251 },
235 { 252 {
236 text: '删除', 253 text: '删除',
237 - auth: 'api:yt:configuration:center:delete', 254 + auth: ConfigurationPermission.DELETE,
238 icon: 'ant-design:delete-outlined', 255 icon: 'ant-design:delete-outlined',
239 color: 'error', 256 color: 'error',
  257 + event: '',
240 onClick: handleDelete.bind(null, item), 258 onClick: handleDelete.bind(null, item),
241 }, 259 },
242 ]" 260 ]"
@@ -13,16 +13,23 @@ @@ -13,16 +13,23 @@
13 } from '/@/api/device/deviceConfigApi'; 13 } from '/@/api/device/deviceConfigApi';
14 import { ProfileRecord } from '/@/api/device/model/deviceConfigModel'; 14 import { ProfileRecord } from '/@/api/device/model/deviceConfigModel';
15 import { Dropdown } from '/@/components/Dropdown'; 15 import { Dropdown } from '/@/components/Dropdown';
16 - import { defaultObj, searchFormSchema, DeviceTypeName } from './device.profile.data'; 16 + import {
  17 + defaultObj,
  18 + searchFormSchema,
  19 + DeviceTypeName,
  20 + ProductPermission,
  21 + } from './device.profile.data';
17 import { useMessage } from '/@/hooks/web/useMessage'; 22 import { useMessage } from '/@/hooks/web/useMessage';
18 import { useSyncConfirm } from '/@/hooks/component/useSyncConfirm'; 23 import { useSyncConfirm } from '/@/hooks/component/useSyncConfirm';
19 import DeviceProfileModal from './DeviceProfileModal.vue'; 24 import DeviceProfileModal from './DeviceProfileModal.vue';
20 import DeviceProfileDrawer from './DeviceProfileDrawer.vue'; 25 import DeviceProfileDrawer from './DeviceProfileDrawer.vue';
21 import { useModal } from '/@/components/Modal'; 26 import { useModal } from '/@/components/Modal';
22 import { useDrawer } from '/@/components/Drawer'; 27 import { useDrawer } from '/@/components/Drawer';
  28 + import productDefault from '/@/assets/icons/product-default.svg';
  29 + import { usePermission } from '/@/hooks/web/usePermission';
23 30
24 defineProps<{ 31 defineProps<{
25 - mode: Mode; 32 + mode: EnumTableCardMode;
26 }>(); 33 }>();
27 34
28 const emit = defineEmits(['changeMode']); 35 const emit = defineEmits(['changeMode']);
@@ -31,8 +38,7 @@ @@ -31,8 +38,7 @@
31 SET_DEFAULT = 'setDefault', 38 SET_DEFAULT = 'setDefault',
32 DELETE = 'delete', 39 DELETE = 'delete',
33 } 40 }
34 - const IMAGE_FALLBACK =  
35 - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8L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aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=='; 41 + const IMAGE_FALLBACK = productDefault;
36 42
37 const { createMessage } = useMessage(); 43 const { createMessage } = useMessage();
38 const { createSyncConfirm } = useSyncConfirm(); 44 const { createSyncConfirm } = useSyncConfirm();
@@ -94,6 +100,40 @@ @@ -94,6 +100,40 @@
94 } 100 }
95 }; 101 };
96 102
  103 + const { hasPermission } = usePermission();
  104 +
  105 + const getHasDeleteFlag = computed(() => {
  106 + return hasPermission(ProductPermission.DELETE);
  107 + });
  108 +
  109 + const getHasDetailFlag = computed(() => {
  110 + return hasPermission(ProductPermission.DETAIL);
  111 + });
  112 +
  113 + const getHasUpdateFlag = computed(() => {
  114 + return hasPermission(ProductPermission.UPDATE);
  115 + });
  116 +
  117 + const getDropDownList = (record: ProfileRecord) => {
  118 + const list = [
  119 + {
  120 + text: '默认',
  121 + event: DropMenuEvent.SET_DEFAULT,
  122 + icon: 'ant-design:unordered-list-outlined',
  123 + onClick: handleSetDefault.bind(null, record),
  124 + },
  125 + ];
  126 + if (unref(getHasDeleteFlag)) {
  127 + list.push({
  128 + text: '删除',
  129 + event: DropMenuEvent.DELETE,
  130 + icon: 'ant-design:delete-outlined',
  131 + onClick: handleDelete.bind(null, [record.id]),
  132 + });
  133 + }
  134 + return list;
  135 + };
  136 +
97 const handleModeChange = (mode: EnumTableCardMode) => { 137 const handleModeChange = (mode: EnumTableCardMode) => {
98 emit('changeMode', mode); 138 emit('changeMode', mode);
99 }; 139 };
@@ -118,10 +158,12 @@ @@ -118,10 +158,12 @@
118 }; 158 };
119 159
120 const handleShowDetail = (record: ProfileRecord) => { 160 const handleShowDetail = (record: ProfileRecord) => {
  161 + if (!unref(getHasDetailFlag)) return;
121 openDrawer(true, { record }); 162 openDrawer(true, { record });
122 }; 163 };
123 164
124 const handleUpdate = (record: ProfileRecord) => { 165 const handleUpdate = (record: ProfileRecord) => {
  166 + if (!unref(getHasUpdateFlag)) return;
125 openModal(true, { 167 openModal(true, {
126 record, 168 record,
127 isUpdate: true, 169 isUpdate: true,
@@ -173,20 +215,27 @@ @@ -173,20 +215,27 @@
173 > 215 >
174 <template #header> 216 <template #header>
175 <div class="flex gap-3 justify-end"> 217 <div class="flex gap-3 justify-end">
176 - <Button type="primary" @click="handleCreate">新增产品</Button> 218 + <Authority :value="ProductPermission.CREATE">
  219 + <Button type="primary" @click="handleCreate">新增产品</Button>
  220 + </Authority>
  221 +
177 <Button type="primary" @click="handleSelectAll"> 222 <Button type="primary" @click="handleSelectAll">
178 {{ getSelectAllFlag ? '反选' : '全选' }} 223 {{ getSelectAllFlag ? '反选' : '全选' }}
179 </Button> 224 </Button>
180 - <Button  
181 - type="primary"  
182 - danger  
183 - :disabled="!getCheckedRecord.length"  
184 - @click="handleDelete(getCheckedRecord)"  
185 - >  
186 - 批量删除  
187 - </Button> 225 + <Authority :value="ProductPermission.DELETE">
  226 + <Button
  227 + type="primary"
  228 + danger
  229 + :disabled="!getCheckedRecord.length"
  230 + @click="handleDelete(getCheckedRecord)"
  231 + >
  232 + 批量删除
  233 + </Button>
  234 + </Authority>
  235 +
188 <ModeSwitchButton :value="$props.mode" @change="handleModeChange" /> 236 <ModeSwitchButton :value="$props.mode" @change="handleModeChange" />
189 <CardLayoutButton v-model:value="colNumber" @change="getDataSource" /> 237 <CardLayoutButton v-model:value="colNumber" @change="getDataSource" />
  238 +
190 <Tooltip title="刷新"> 239 <Tooltip title="刷新">
191 <Button type="primary" @click="getDataSource"> 240 <Button type="primary" @click="getDataSource">
192 <ReloadOutlined :spin="loading" /> 241 <ReloadOutlined :spin="loading" />
@@ -213,33 +262,21 @@ @@ -213,33 +262,21 @@
213 </div> 262 </div>
214 </template> 263 </template>
215 <template class="ant-card-actions" #actions> 264 <template class="ant-card-actions" #actions>
216 - <Authority>  
217 - <Tooltip title="详情">  
218 - <EyeOutlined key="setting" @click.stop="handleShowDetail(item)" />  
219 - </Tooltip>  
220 - </Authority>  
221 - <Authority>  
222 - <Tooltip title="编辑">  
223 - <FormOutlined key="edit" @click.stop="handleUpdate(item)" />  
224 - </Tooltip>  
225 - </Authority>  
226 - <Dropdown  
227 - :trigger="['hover']"  
228 - :drop-menu-list="[  
229 - {  
230 - text: '默认',  
231 - event: DropMenuEvent.SET_DEFAULT,  
232 - icon: 'ant-design:unordered-list-outlined',  
233 - onClick: handleSetDefault.bind(null, item),  
234 - },  
235 - {  
236 - text: '删除',  
237 - event: DropMenuEvent.DELETE,  
238 - icon: 'ant-design:delete-outlined',  
239 - onClick: handleDelete.bind(null, [item.id]),  
240 - },  
241 - ]"  
242 - > 265 + <Tooltip title="详情">
  266 + <EyeOutlined
  267 + :class="getHasDetailFlag ? '' : '!cursor-not-allowed !text-gray-200'"
  268 + key="setting"
  269 + @click.stop="handleShowDetail(item)"
  270 + />
  271 + </Tooltip>
  272 + <Tooltip title="编辑">
  273 + <FormOutlined
  274 + :class="getHasUpdateFlag ? '' : '!cursor-not-allowed !text-gray-200'"
  275 + key="edit"
  276 + @click.stop="handleUpdate(item)"
  277 + />
  278 + </Tooltip>
  279 + <Dropdown :trigger="['hover']" :drop-menu-list="getDropDownList(item)">
243 <MoreOutlined @click.stop class="transform rotate-90" /> 280 <MoreOutlined @click.stop class="transform rotate-90" />
244 </Dropdown> 281 </Dropdown>
245 </template> 282 </template>
@@ -7,15 +7,15 @@ @@ -7,15 +7,15 @@
7 :clickToRowSelect="false" 7 :clickToRowSelect="false"
8 > 8 >
9 <template #toolbar> 9 <template #toolbar>
10 - <Authority value="api:yt:deviceProfile:post"> 10 + <Authority :value="ProductPermission.CREATE">
11 <a-button type="primary" @click="handleCreate"> 新增产品 </a-button> 11 <a-button type="primary" @click="handleCreate"> 新增产品 </a-button>
12 </Authority> 12 </Authority>
13 - <Authority value="api:yt:deviceProfile:import"> 13 + <Authority :value="ProductPermission.IMPORT">
14 <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> 14 <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD">
15 <a-button @click="handleImport"> 导入产品 </a-button> 15 <a-button @click="handleImport"> 导入产品 </a-button>
16 </ImpExcel> 16 </ImpExcel>
17 </Authority> 17 </Authority>
18 - <Authority value="api:yt:deviceProfile:delete"> 18 + <Authority :value="ProductPermission.DELETE">
19 <Popconfirm 19 <Popconfirm
20 title="您确定要批量删除数据" 20 title="您确定要批量删除数据"
21 ok-text="确定" 21 ok-text="确定"
@@ -44,13 +44,13 @@ @@ -44,13 +44,13 @@
44 :actions="[ 44 :actions="[
45 { 45 {
46 label: '详情', 46 label: '详情',
47 - auth: 'api:yt:deviceProfile:get', 47 + auth: ProductPermission.DETAIL,
48 icon: 'ant-design:eye-outlined', 48 icon: 'ant-design:eye-outlined',
49 onClick: handleDetailView.bind(null, record), 49 onClick: handleDetailView.bind(null, record),
50 }, 50 },
51 { 51 {
52 label: '编辑', 52 label: '编辑',
53 - auth: 'api:yt:deviceProfile:update', 53 + auth: ProductPermission.UPDATE,
54 icon: 'clarity:note-edit-line', 54 icon: 'clarity:note-edit-line',
55 onClick: handleEdit.bind(null, record), 55 onClick: handleEdit.bind(null, record),
56 ifShow: () => { 56 ifShow: () => {
@@ -69,13 +69,13 @@ @@ -69,13 +69,13 @@
69 }, 69 },
70 { 70 {
71 label: '导出', 71 label: '导出',
72 - auth: 'api:yt:deviceProfile:export', 72 + auth: ProductPermission.EXPORT,
73 icon: 'ant-design:login-outlined', 73 icon: 'ant-design:login-outlined',
74 onClick: handleExport.bind(null, record), 74 onClick: handleExport.bind(null, record),
75 }, 75 },
76 { 76 {
77 label: '删除', 77 label: '删除',
78 - auth: 'api:yt:deviceProfile:delete', 78 + auth: ProductPermission.DELETE,
79 icon: 'ant-design:delete-outlined', 79 icon: 'ant-design:delete-outlined',
80 color: 'error', 80 color: 'error',
81 popConfirm: { 81 popConfirm: {
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 <script lang="ts" setup> 102 <script lang="ts" setup>
103 import { ref, nextTick, onUnmounted } from 'vue'; 103 import { ref, nextTick, onUnmounted } from 'vue';
104 import { BasicTable, TableImg, useTable, TableAction, BasicColumn } from '/@/components/Table'; 104 import { BasicTable, TableImg, useTable, TableAction, BasicColumn } from '/@/components/Table';
105 - import { columns, searchFormSchema, defaultObj } from './device.profile.data'; 105 + import { columns, searchFormSchema, defaultObj, ProductPermission } from './device.profile.data';
106 import { useMessage } from '/@/hooks/web/useMessage'; 106 import { useMessage } from '/@/hooks/web/useMessage';
107 import { 107 import {
108 deviceConfigGetQuery, 108 deviceConfigGetQuery,
@@ -19,6 +19,15 @@ export enum DeviceTypeName { @@ -19,6 +19,15 @@ export enum DeviceTypeName {
19 GATEWAY = '网关设备', 19 GATEWAY = '网关设备',
20 SENSOR = '网关子设备', 20 SENSOR = '网关子设备',
21 } 21 }
  22 +export enum ProductPermission {
  23 + DETAIL = 'api:yt:deviceProfile:get',
  24 + CREATE = 'api:yt:deviceProfile:post',
  25 + UPDATE = 'api:yt:deviceProfile:update',
  26 + DELETE = 'api:yt:deviceProfile:delete',
  27 + SET_DEFAULT = '',
  28 + IMPORT = 'api:yt:deviceProfile:import',
  29 + EXPORT = 'api:yt:deviceProfile:export',
  30 +}
22 31
23 export enum ModelOfMatterPermission { 32 export enum ModelOfMatterPermission {
24 CREATE = 'api:yt:things_model:post', 33 CREATE = 'api:yt:things_model:post',