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