Commit 0bd52a8af10230e88515bcd35dde7d32df4b86bd

Authored by sqy
1 parent 842d11f3

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

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