Commit 0bd52a8af10230e88515bcd35dde7d32df4b86bd

Authored by sqy
1 parent 842d11f3

'fix:修复bug和场景联动改变'

@@ -66,8 +66,8 @@ export default { @@ -66,8 +66,8 @@ export default {
66 signUpFormTitle: '注册', 66 signUpFormTitle: '注册',
67 forgetFormTitle: '重置密码', 67 forgetFormTitle: '重置密码',
68 userNameInFormTitle: '账号登录', 68 userNameInFormTitle: '账号登录',
69 - signInTitle: '物联网平台',  
70 - signInDesc: '输入您的个人详细信息开始使用!', 69 + signInTitle: '〔 连接世界 · 创造价值 〕',
  70 + signInDesc: '',
71 policy: '我同意xxx隐私政策', 71 policy: '我同意xxx隐私政策',
72 scanSign: `扫码后点击"确认",即可完成登录`, 72 scanSign: `扫码后点击"确认",即可完成登录`,
73 73
@@ -16,22 +16,7 @@ @@ -16,22 +16,7 @@
16 </div> 16 </div>
17 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> 17 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
18 </div> 18 </div>
19 - <div> 设备数(个) </div>  
20 - <div class="flex" style="align-items: center">  
21 - <div class="mr-2"  
22 - >在线  
23 - <span style="color: #41b883">{{ growCardList?.deviceInfo?.onLine ?? 0 }}</span></div  
24 - >  
25 - <div class="mr-2">  
26 - 离线  
27 - <span style="color: #f5222d">{{ growCardList?.deviceInfo?.offLine ?? 0 }} </span></div  
28 - >  
29 -  
30 - <div>  
31 - 未激活  
32 - <span style="color: #fa8c16">{{ growCardList?.deviceInfo?.inActive ?? 0 }}</span>  
33 - </div>  
34 - </div> 19 + <div> 设备数 </div>
35 </div> 20 </div>
36 </div> 21 </div>
37 <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> 22 <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
@@ -66,7 +51,7 @@ @@ -66,7 +51,7 @@
66 </div> 51 </div>
67 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> 52 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
68 </div> 53 </div>
69 - <div> {{ !isAdmin(role) ? `告警数(条)` : '租户总量(个)' }}</div> 54 + <div> {{ !isAdmin(role) ? `告警数` : '租户总量' }}</div>
70 </div> 55 </div>
71 </div> 56 </div>
72 <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> 57 <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
@@ -78,59 +63,38 @@ @@ -78,59 +63,38 @@
78 </Card> 63 </Card>
79 <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4" style="color: #666"> 64 <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4" style="color: #666">
80 <div class="flex" style="height: 100px"> 65 <div class="flex" style="height: 100px">
81 - <div class="mr-4"  
82 - ><img 66 + <div class="mr-4">
  67 + <img
83 v-if="!isAdmin(role)" 68 v-if="!isAdmin(role)"
84 src="/src/assets/images/msg-count.png" 69 src="/src/assets/images/msg-count.png"
85 style="width: 5.625rem; height: 5.625rem" 70 style="width: 5.625rem; height: 5.625rem"
86 - /><img v-else src="/src/assets/images/kf.png" style="width: 5.625rem; height: 5.625rem" /> 71 + />
  72 + <img v-else src="/src/assets/images/kf.png" style="width: 5.625rem; height: 5.625rem" />
87 </div> 73 </div>
88 - <div v-if="!isAdmin(role)" style="display: flex; align-items: center">  
89 - <div>  
90 - <div style="align-items: center">  
91 - <div style="font-size: 1.625rem; color: #333; font-weight: bold">  
92 - <CountTo  
93 - v-if="growCardList?.messageInfo?.messageCount"  
94 - :end-val="growCardList.messageInfo.messageCount"  
95 - />  
96 - <CountTo v-else :end-val="0" />  
97 - </div>  
98 - 消息量(条)  
99 - </div>  
100 - <div>  
101 - <span class="mr-2">数据点</span> 74 + <div class="flex-auto">
  75 + <div class="flex justify-between" style="align-items: center">
  76 + <div v-if="!isAdmin(role)" style="font-size: 1.625rem; color: #333; font-weight: bold">
102 <CountTo 77 <CountTo
103 - style="color: #333; font-weight: bold"  
104 - v-if="growCardList?.messageInfo?.dataPointsCount"  
105 - :end-val="growCardList.messageInfo.dataPointsCount" 78 + v-if="growCardList?.messageInfo?.messageCount"
  79 + :end-val="growCardList.messageInfo.messageCount"
106 /> 80 />
107 - <CountTo style="color: #333; font-weight: bold" :end-val="0" v-else /> 81 + <CountTo v-else :end-val="0" />
108 </div> 82 </div>
109 - </div>  
110 - </div>  
111 - <div class="flex-auto" v-else>  
112 - <div class="flex justify-between" style="align-items: center">  
113 - <div style="font-size: 1.625rem; color: #333; font-weight: bold"> 83 + <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>
114 <CountTo 84 <CountTo
115 v-if="growCardList?.customerInfo?.sumCount" 85 v-if="growCardList?.customerInfo?.sumCount"
116 :end-val="growCardList.customerInfo.sumCount" 86 :end-val="growCardList.customerInfo.sumCount"
117 /> 87 />
118 - <CountTo :end-val="0" v-else /> 88 + <CountTo v-else :end-val="0" />
119 </div> 89 </div>
120 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> 90 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
121 </div> 91 </div>
122 - <div>客户总量(个)</div> 92 + <div> {{ !isAdmin(role) ? `消息数` : '客户总量' }}</div>
123 </div> 93 </div>
124 </div> 94 </div>
125 <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> 95 <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
126 - 今日新增  
127 - <span class="ml-4"  
128 - >消息量 {{ toThousands(growCardList?.messageInfo?.todayMessageAdd) }}</span  
129 - >  
130 - <span class="ml-4"  
131 - >数据点 {{ toThousands(growCardList?.messageInfo?.todayDataPointsAdd) }}</span  
132 - >  
133 - </div> 96 + 今日新增 {{ toThousands(growCardList?.messageInfo?.todayMessageAdd) }}</div
  97 + >
134 <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> 98 <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
135 今日新增 {{ toThousands(growCardList?.customerInfo?.todayAdd) }}</div 99 今日新增 {{ toThousands(growCardList?.customerInfo?.todayAdd) }}</div
136 > 100 >
@@ -229,7 +229,7 @@ @@ -229,7 +229,7 @@
229 const point = new BMap.Point(longitude, latitude); 229 const point = new BMap.Point(longitude, latitude);
230 let options = { 230 let options = {
231 width: 330, // 信息窗口宽度 231 width: 330, // 信息窗口宽度
232 - height: 230, // 信息窗口高度 232 + height: 0, // 信息窗口高度
233 }; 233 };
234 map.centerAndZoom(point, 15); 234 map.centerAndZoom(point, 15);
235 map.enableScrollWheelZoom(true); 235 map.enableScrollWheelZoom(true);
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 <BasicDrawer 3 <BasicDrawer
4 v-bind="$attrs" 4 v-bind="$attrs"
5 @register="registerDrawer" 5 @register="registerDrawer"
6 - showFooter  
7 @ok="handleSubmit" 6 @ok="handleSubmit"
8 width="50vw" 7 width="50vw"
  8 + showFooter
9 @close="handleClose" 9 @close="handleClose"
10 :title="title" 10 :title="title"
11 > 11 >
@@ -24,7 +24,9 @@ @@ -24,7 +24,9 @@
24 /> 24 />
25 </template> 25 </template>
26 <!-- 按钮 --> 26 <!-- 按钮 -->
27 - <a-button type="primary" class="mt-4" @click="addTrigger"> 添加触发器</a-button> 27 + <a-button type="primary" class="mt-4" @click="addTrigger" v-if="isView">
  28 + 添加触发器</a-button
  29 + >
28 <!-- 按钮 --> 30 <!-- 按钮 -->
29 </div> 31 </div>
30 <!-- 触发器-end --> 32 <!-- 触发器-end -->
@@ -40,7 +42,9 @@ @@ -40,7 +42,9 @@
40 /> 42 />
41 </template> 43 </template>
42 <!-- 按钮 --> 44 <!-- 按钮 -->
43 - <a-button type="primary" class="mt-4" @click="addCondition"> 添加执行条件</a-button> 45 + <a-button type="primary" class="mt-4" @click="addCondition" v-if="isView">
  46 + 添加执行条件</a-button
  47 + >
44 <!-- 按钮 --> 48 <!-- 按钮 -->
45 </div> 49 </div>
46 <!-- 执行条件-end --> 50 <!-- 执行条件-end -->
@@ -58,7 +62,9 @@ @@ -58,7 +62,9 @@
58 </template> 62 </template>
59 63
60 <!-- 按钮 --> 64 <!-- 按钮 -->
61 - <a-button type="primary" class="mt-4" @click="addAction"> 添加执行动作</a-button> 65 + <a-button type="primary" class="mt-4" @click="addAction" v-if="isView">
  66 + 添加执行动作</a-button
  67 + >
62 <!-- 按钮 --> 68 <!-- 按钮 -->
63 </div> 69 </div>
64 <!-- 执行动作-end --> 70 <!-- 执行动作-end -->
@@ -100,7 +106,9 @@ @@ -100,7 +106,9 @@
100 conditionItemRefs: ref([]), 106 conditionItemRefs: ref([]),
101 actionItemRefs: ref([]), 107 actionItemRefs: ref([]),
102 }; 108 };
103 - const title = computed(() => `${isUpdate.value ? '编辑' : '新增'}场景联动`); 109 + const title = computed(
  110 + () => `${isUpdate.value === 3 ? '查看' : isUpdate.value ? '编辑' : '新增'}场景联动`
  111 + );
104 let getTriggerFormValue = ref([]); 112 let getTriggerFormValue = ref([]);
105 let getConditionFormValue = ref([]); 113 let getConditionFormValue = ref([]);
106 let getActionFormValue = ref([]); 114 let getActionFormValue = ref([]);
@@ -108,6 +116,7 @@ @@ -108,6 +116,7 @@
108 const isUpdate = ref(false); 116 const isUpdate = ref(false);
109 const id = ref(undefined); 117 const id = ref(undefined);
110 const tenantId = ref(undefined); 118 const tenantId = ref(undefined);
  119 + const isView = ref(true);
111 const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({ 120 const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({
112 labelWidth: 120, 121 labelWidth: 120,
113 schemas: formSchema, 122 schemas: formSchema,
@@ -116,6 +125,7 @@ @@ -116,6 +125,7 @@
116 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 125 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
117 setDrawerProps({ confirmLoading: false }); 126 setDrawerProps({ confirmLoading: false });
118 isUpdate.value = data.isUpdate; 127 isUpdate.value = data.isUpdate;
  128 +
119 if (!unref(isUpdate)) { 129 if (!unref(isUpdate)) {
120 resetFields(); 130 resetFields();
121 //初始化执行动作 131 //初始化执行动作
@@ -191,6 +201,10 @@ @@ -191,6 +201,10 @@
191 }); 201 });
192 }); 202 });
193 } 203 }
  204 + if (unref(isUpdate) === 3) isView.value = false;
  205 + setDrawerProps({
  206 + showFooter: isView.value,
  207 + });
194 }); 208 });
195 209
196 // 设置设备的options 210 // 设置设备的options
@@ -298,6 +312,7 @@ @@ -298,6 +312,7 @@
298 id.value = undefined; 312 id.value = undefined;
299 tenantId.value = undefined; 313 tenantId.value = undefined;
300 organizationId.value = undefined; 314 organizationId.value = undefined;
  315 + isView.value = true;
301 getTriggerFormValue.value = []; 316 getTriggerFormValue.value = [];
302 getConditionFormValue.value = []; 317 getConditionFormValue.value = [];
303 getActionFormValue.value = []; 318 getActionFormValue.value = [];
@@ -334,6 +349,8 @@ @@ -334,6 +349,8 @@
334 skipUnwrap, 349 skipUnwrap,
335 handleSubmit, 350 handleSubmit,
336 handleClose, 351 handleClose,
  352 +
  353 + isView,
337 }; 354 };
338 }, 355 },
339 }); 356 });
@@ -140,6 +140,11 @@ export const columns: BasicColumn[] = [ @@ -140,6 +140,11 @@ export const columns: BasicColumn[] = [
140 width: 200, 140 width: 200,
141 }, 141 },
142 { 142 {
  143 + title: '创建者',
  144 + dataIndex: 'creatorName',
  145 + width: 200,
  146 + },
  147 + {
143 title: '创建时间', 148 title: '创建时间',
144 dataIndex: 'createTime', 149 dataIndex: 'createTime',
145 width: 180, 150 width: 180,
@@ -242,7 +247,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -242,7 +247,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
242 // { label: '手动触发', value: 'HAND_ACT' }, 247 // { label: '手动触发', value: 'HAND_ACT' },
243 ], 248 ],
244 }, 249 },
245 - colProps: { span: 12 }, 250 + colProps: { span: 8 },
246 }, 251 },
247 { 252 {
248 field: 'entityId', 253 field: 'entityId',
@@ -253,7 +258,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -253,7 +258,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
253 }, 258 },
254 ifShow: ({ values }) => isDevice(values.triggerType), 259 ifShow: ({ values }) => isDevice(values.triggerType),
255 colProps: { 260 colProps: {
256 - span: 12, 261 + span: 8,
257 }, 262 },
258 }, 263 },
259 { 264 {
@@ -266,18 +271,18 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -266,18 +271,18 @@ export const useTriggerDrawerSchema: FormSchema[] = [
266 }, 271 },
267 ifShow: ({ values }) => isDevice(values.triggerType), 272 ifShow: ({ values }) => isDevice(values.triggerType),
268 dynamicDisabled: ({ values }) => !values.entityId, 273 dynamicDisabled: ({ values }) => !values.entityId,
269 - colProps: { span: 12 }, 274 + colProps: { span: 8 },
270 }, 275 },
271 { 276 {
272 field: 'type2', 277 field: 'type2',
273 label: '', 278 label: '',
274 - component: 'Select', 279 + component: 'AutoComplete',
275 componentProps: { 280 componentProps: {
276 placeholder: '请选择属性', 281 placeholder: '请选择属性',
277 }, 282 },
278 ifShow: ({ values }) => isDevice(values.triggerType), 283 ifShow: ({ values }) => isDevice(values.triggerType),
279 dynamicDisabled: ({ values }) => !values.type1, 284 dynamicDisabled: ({ values }) => !values.type1,
280 - colProps: { span: 12 }, 285 + colProps: { span: 8 },
281 }, 286 },
282 { 287 {
283 field: 'operation', 288 field: 'operation',
@@ -295,7 +300,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -295,7 +300,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
295 }, 300 },
296 show: ({ values }) => isDevice(values.triggerType), 301 show: ({ values }) => isDevice(values.triggerType),
297 dynamicDisabled: ({ values }) => !values.type2, 302 dynamicDisabled: ({ values }) => !values.type2,
298 - colProps: { span: 12 }, 303 + colProps: { span: 8 },
299 }, 304 },
300 { 305 {
301 field: 'value', 306 field: 'value',
@@ -308,7 +313,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -308,7 +313,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
308 show: ({ values }) => isDevice(values.triggerType), 313 show: ({ values }) => isDevice(values.triggerType),
309 dynamicDisabled: ({ values }) => !values.operation, 314 dynamicDisabled: ({ values }) => !values.operation,
310 colProps: { 315 colProps: {
311 - span: 12, 316 + span: 8,
312 }, 317 },
313 }, 318 },
314 { 319 {
@@ -339,7 +344,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ @@ -339,7 +344,7 @@ export const useConditionDrawerSchema: FormSchema[] = [
339 // { label: '时间范围', value: 'SCHEDULE_TRIGGER' }, 344 // { label: '时间范围', value: 'SCHEDULE_TRIGGER' },
340 ], 345 ],
341 }, 346 },
342 - colProps: { span: 12 }, 347 + colProps: { span: 8 },
343 }, 348 },
344 { 349 {
345 field: 'entityId', 350 field: 'entityId',
@@ -352,19 +357,19 @@ export const useConditionDrawerSchema: FormSchema[] = [ @@ -352,19 +357,19 @@ export const useConditionDrawerSchema: FormSchema[] = [
352 }, 357 },
353 ifShow: ({ values }) => isDevice(values.triggerType), 358 ifShow: ({ values }) => isDevice(values.triggerType),
354 colProps: { 359 colProps: {
355 - span: 12, 360 + span: 8,
356 }, 361 },
357 }, 362 },
358 { 363 {
359 field: 'type', 364 field: 'type',
360 label: '', 365 label: '',
361 - component: 'Select', 366 + component: 'AutoComplete',
362 componentProps: { 367 componentProps: {
363 placeholder: '请选择属性', 368 placeholder: '请选择属性',
364 }, 369 },
365 ifShow: ({ values }) => isDevice(values.triggerType), 370 ifShow: ({ values }) => isDevice(values.triggerType),
366 dynamicDisabled: ({ values }) => !values.entityId, 371 dynamicDisabled: ({ values }) => !values.entityId,
367 - colProps: { span: 12 }, 372 + colProps: { span: 8 },
368 }, 373 },
369 { 374 {
370 field: 'operation', 375 field: 'operation',
@@ -382,7 +387,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ @@ -382,7 +387,7 @@ export const useConditionDrawerSchema: FormSchema[] = [
382 }, 387 },
383 show: ({ values }) => isDevice(values.triggerType), 388 show: ({ values }) => isDevice(values.triggerType),
384 dynamicDisabled: ({ values }) => !values.type, 389 dynamicDisabled: ({ values }) => !values.type,
385 - colProps: { span: 12 }, 390 + colProps: { span: 8 },
386 }, 391 },
387 { 392 {
388 field: 'value', 393 field: 'value',
@@ -395,7 +400,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ @@ -395,7 +400,7 @@ export const useConditionDrawerSchema: FormSchema[] = [
395 show: ({ values }) => isDevice(values.triggerType), 400 show: ({ values }) => isDevice(values.triggerType),
396 dynamicDisabled: ({ values }) => !values.operation, 401 dynamicDisabled: ({ values }) => !values.operation,
397 colProps: { 402 colProps: {
398 - span: 12, 403 + span: 8,
399 }, 404 },
400 }, 405 },
401 // { 406 // {
@@ -466,7 +471,7 @@ export const useActionDrawerSchema: FormSchema[] = [ @@ -466,7 +471,7 @@ export const useActionDrawerSchema: FormSchema[] = [
466 slot: 'doContext', 471 slot: 'doContext',
467 show: ({ values }) => isDeviceOut(values.outTarget), 472 show: ({ values }) => isDeviceOut(values.outTarget),
468 colProps: { 473 colProps: {
469 - span: 12, 474 + span: 24,
470 }, 475 },
471 }, 476 },
472 // { 477 // {
1 <template> 1 <template>
2 - <CollapseContainer style="background-color: #eeeeee" :title="`执行动作 ${actionIndex + 1}`"> 2 + <CollapseContainer style="background-color: #f8f9fa" :title="`执行动作 ${actionIndex + 1}`">
3 <template #action> 3 <template #action>
4 <Tooltip title="移除" v-if="actionData.length > 1"> 4 <Tooltip title="移除" v-if="actionData.length > 1">
5 <Icon 5 <Icon
1 <template> 1 <template>
2 - <CollapseContainer style="background-color: #eeeeee" :title="`执行条件 ${conditionIndex + 1}`"> 2 + <CollapseContainer style="background-color: #f8f9fa" :title="`执行条件 ${conditionIndex + 1}`">
3 <template #action> 3 <template #action>
4 <Tooltip title="移除"> 4 <Tooltip title="移除">
5 <Icon 5 <Icon
1 <template> 1 <template>
2 <div> 2 <div>
3 - <CollapseContainer style="background-color: #eee" :title="`触发器 ${triggerIndex + 1}`"> 3 + <CollapseContainer style="background-color: #f8f9fa" :title="`触发器 ${triggerIndex + 1}`">
4 <template #action> 4 <template #action>
5 <Tooltip title="移除"> 5 <Tooltip title="移除">
6 <Icon 6 <Icon
@@ -2,15 +2,8 @@ @@ -2,15 +2,8 @@
2 <div> 2 <div>
3 <BasicTable @register="registerTable"> 3 <BasicTable @register="registerTable">
4 <template #toolbar> 4 <template #toolbar>
5 - <a-button v-if="isTenant || isCustomer || isPlatform" type="primary" @click="handleAdd">  
6 - 新增场景联动  
7 - </a-button>  
8 - <a-button  
9 - v-if="isTenant || isCustomer || isPlatform"  
10 - color="error"  
11 - @click="handleDeleteOrBatchDelete(null)"  
12 - :disabled="hasBatchDelete"  
13 - > 5 + <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button>
  6 + <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete">
14 批量删除 7 批量删除
15 </a-button> 8 </a-button>
16 </template> 9 </template>
@@ -18,16 +11,22 @@ @@ -18,16 +11,22 @@
18 <TableAction 11 <TableAction
19 :actions="[ 12 :actions="[
20 { 13 {
  14 + label: '查看',
  15 + icon: 'ant-design:eye-outlined',
  16 + ifShow: record.creator !== userId,
  17 + onClick: handleView.bind(null, record),
  18 + },
  19 + {
21 label: '编辑', 20 label: '编辑',
22 icon: 'clarity:note-edit-line', 21 icon: 'clarity:note-edit-line',
23 onClick: handleEdit.bind(null, record), 22 onClick: handleEdit.bind(null, record),
24 - ifShow: isTenant || isCustomer || isPlatform, 23 + ifShow: record.creator === userId,
25 }, 24 },
26 { 25 {
27 label: '删除', 26 label: '删除',
28 icon: 'ant-design:delete-outlined', 27 icon: 'ant-design:delete-outlined',
29 color: 'error', 28 color: 'error',
30 - ifShow: isTenant || isCustomer || isPlatform, 29 + ifShow: record.creator === userId,
31 popConfirm: { 30 popConfirm: {
32 title: '是否确认删除', 31 title: '是否确认删除',
33 confirm: handleDeleteOrBatchDelete.bind(null, record), 32 confirm: handleDeleteOrBatchDelete.bind(null, record),
@@ -45,32 +44,30 @@ @@ -45,32 +44,30 @@
45 </div> 44 </div>
46 </template> 45 </template>
47 <script lang="ts"> 46 <script lang="ts">
48 - import { defineComponent, ref, computed } from 'vue'; 47 + import { defineComponent, ref } from 'vue';
49 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 48 import { BasicTable, useTable, TableAction } from '/@/components/Table';
50 import { useDrawer } from '/@/components/Drawer'; 49 import { useDrawer } from '/@/components/Drawer';
51 import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; 50 import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi';
52 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 51 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
53 - import { RoleEnum } from '/@/enums/roleEnum';  
54 - import { useUserStore } from '/@/store/modules/user'; 52 +
55 import { columns, searchFormSchema } from './config'; 53 import { columns, searchFormSchema } from './config';
  54 + import { USER_INFO_KEY } from '/@/enums/cacheEnum';
  55 + import { getAuthCache } from '/@/utils/auth';
  56 + import { authBtn } from '/@/enums/roleEnum';
56 import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue'; 57 import SceneLinkAgeDrawer from './SceneLinkAgeDrawer.vue';
57 58
58 export default defineComponent({ 59 export default defineComponent({
59 name: 'LinkEdge', 60 name: 'LinkEdge',
60 components: { BasicTable, SceneLinkAgeDrawer, TableAction }, 61 components: { BasicTable, SceneLinkAgeDrawer, TableAction },
61 -  
62 setup() { 62 setup() {
63 - const userStore = useUserStore();  
64 - const isTenant = computed(() => userStore.getRoleList.includes(RoleEnum.TENANT_ADMIN));  
65 - const isCustomer = computed(() => userStore.getRoleList.includes(RoleEnum.CUSTOMER_USER));  
66 - const isSysadmin = computed(() => userStore.getRoleList.includes(RoleEnum.SYS_ADMIN));  
67 - const isPlatform = computed(() => userStore.getRoleList.includes(RoleEnum.PLATFORM_ADMIN));  
68 const sceneLinkAgeDrawerRef: any = ref(null); 63 const sceneLinkAgeDrawerRef: any = ref(null);
69 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( 64 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
70 screenLinkPageDeleteApi, 65 screenLinkPageDeleteApi,
71 handleSuccess 66 handleSuccess
72 ); 67 );
73 - 68 + const userInfo: any = getAuthCache(USER_INFO_KEY);
  69 + const userId = userInfo.userId;
  70 + const role: string = userInfo.roles[0];
74 const [registerDrawer, { openDrawer }] = useDrawer(); 71 const [registerDrawer, { openDrawer }] = useDrawer();
75 const [registerTable, { reload }] = useTable({ 72 const [registerTable, { reload }] = useTable({
76 title: '场景联动列表', 73 title: '场景联动列表',
@@ -106,14 +103,16 @@ @@ -106,14 +103,16 @@
106 isUpdate: true, 103 isUpdate: true,
107 }); 104 });
108 } 105 }
  106 + function handleView(record: Recordable) {
  107 + openDrawer(true, {
  108 + record,
  109 + isUpdate: 3,
  110 + });
  111 + }
109 function handleSuccess() { 112 function handleSuccess() {
110 reload(); 113 reload();
111 } 114 }
112 return { 115 return {
113 - isPlatform,  
114 - isSysadmin,  
115 - isCustomer,  
116 - isTenant,  
117 sceneLinkAgeDrawerRef, 116 sceneLinkAgeDrawerRef,
118 registerTable, 117 registerTable,
119 registerDrawer, 118 registerDrawer,
@@ -122,30 +121,11 @@ @@ -122,30 +121,11 @@
122 handleSuccess, 121 handleSuccess,
123 hasBatchDelete, 122 hasBatchDelete,
124 handleDeleteOrBatchDelete, 123 handleDeleteOrBatchDelete,
  124 + handleView,
  125 + authBtn,
  126 + role,
  127 + userId,
125 }; 128 };
126 }, 129 },
127 }); 130 });
128 </script> 131 </script>
129 -  
130 -<!-- <script setup lang="ts">  
131 - import { ref, onMounted } from 'vue';  
132 - const refList = ref([]);  
133 - const list = ref(['张三', '李四', '王五', '赵牛']);  
134 - onMounted(() => {  
135 - console.log(refList.value);  
136 - });  
137 - let flag = 0;  
138 - const add = () => {  
139 - refList.value = [];  
140 - list.value.push(`哈哈${flag++}`);  
141 - console.log(refList.value);  
142 - };  
143 -</script>  
144 -<template>  
145 - <div>  
146 - <template v-for="item in list" :key="item">  
147 - <div :ref="(el) => refList.push(el)">{{ item }}</div>  
148 - </template>  
149 - <a-button @click="add" type="primary" class="ml-4 mt-4">添加元素</a-button>  
150 - </div>  
151 -</template> -->