Commit aa0a85c1c1ae1e840d4f359844782b0855a46ae1

Authored by ww
1 parent ffa666b6

feat: product detail add model of matter permission

... ... @@ -9,6 +9,13 @@ import { FormField, FunctionType } from './step/cpns/physical/cpns/config';
9 9 import { h } from 'vue';
10 10 import { Tag } from 'ant-design-vue';
11 11
  12 +export enum ModelOfMatterPermission {
  13 + CREATE = 'api:yt:things_model:post',
  14 + UPDATE = 'api:yt:things_model:put',
  15 + DELETE = 'api:yt:things_model:delete',
  16 + RELEASE = 'api:yt:things_model:release',
  17 +}
  18 +
12 19 export const steps = [
13 20 {
14 21 title: '产品',
... ...
... ... @@ -27,18 +27,16 @@
27 27 </div>
28 28 <div class="flex justify-between items-end">
29 29 <div class="flex gap-2">
30   - <Authority value="">
  30 + <Authority :value="ModelOfMatterPermission.CREATE">
31 31 <Button v-if="isShowBtn" type="primary" @click="handleCreateOrEdit()">
32 32 新增物模型
33 33 </Button>
34   - <Button type="primary" @click="handleOpenTsl"> 物模型TSL </Button>
35   - <Button v-if="isShowBtn" type="primary" @click="handleImportModel"
36   - >导入物模型</Button
37   - >
38 34 </Authority>
  35 + <Button type="primary" @click="handleOpenTsl"> 物模型TSL </Button>
  36 + <Button v-if="isShowBtn" type="primary" @click="handleImportModel">导入物模型</Button>
39 37 </div>
40 38 <div class="flex gap-2">
41   - <Authority value="">
  39 + <Authority :value="ModelOfMatterPermission.RELEASE">
42 40 <Popconfirm
43 41 title="是否需要发布上线?"
44 42 ok-text="确定"
... ... @@ -49,9 +47,12 @@
49 47 发布上线
50 48 </Button>
51 49 </Popconfirm>
52   - <Button v-if="isShowBtn" class="!bg-gray-200" type="text" @click="handleReturn">
53   - 返回
54   - </Button>
  50 + </Authority>
  51 +
  52 + <Button v-if="isShowBtn" class="!bg-gray-200" type="text" @click="handleReturn">
  53 + 返回
  54 + </Button>
  55 + <Authority :value="ModelOfMatterPermission.DELETE">
55 56 <Popconfirm
56 57 title="您确定要批量删除数据"
57 58 ok-text="确定"
... ... @@ -84,14 +85,14 @@
84 85 {
85 86 label: '编辑',
86 87 icon: 'clarity:note-edit-line',
87   - auth: '',
  88 + auth: ModelOfMatterPermission.UPDATE,
88 89 onClick: handleCreateOrEdit.bind(null, record),
89 90 ifShow: !isShowBtn ? false : true,
90 91 },
91 92 {
92 93 label: '删除',
93 94 icon: 'ant-design:delete-outlined',
94   - auth: '',
  95 + auth: ModelOfMatterPermission.DELETE,
95 96 color: 'error',
96 97 ifShow: !isShowBtn ? false : true,
97 98 popConfirm: {
... ... @@ -114,7 +115,11 @@
114 115 <script lang="ts" setup>
115 116 import { BasicTable, useTable, TableAction } from '/@/components/Table';
116 117 import { useModal } from '/@/components/Modal';
117   - import { modelOfMatterForm, physicalColumn } from '../device.profile.data';
  118 + import {
  119 + modelOfMatterForm,
  120 + ModelOfMatterPermission,
  121 + physicalColumn,
  122 + } from '../device.profile.data';
118 123 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
119 124 import { Authority } from '/@/components/Authority';
120 125 import PhysicalModelModal from './cpns/physical/PhysicalModelModal.vue';
... ...