Commit 20e86003df4e0bcd30c763973c22b18c4c3ee1d3

Authored by xp.Huang
2 parents 722e9352 ad61b048

Merge branch 'ww' into 'main'

fix: rule data flow carry params incorrect

See merge request huang/yun-teng-iot-front!474
... ... @@ -5,6 +5,8 @@
5 5 <meta charset="UTF-8" />
6 6 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7 7 <meta name="renderer" content="webkit" />
  8 + <meta name="keywords" content="Thingskit 物联网平台" />
  9 + <meta name="description" content="Thingskit 物联网平台" />
8 10 <meta http-equiv="Expires" content="0" />
9 11 <meta http-equiv="Cache-control" content="no-cache" />
10 12 <meta http-equiv="Cache" content="no-cache" />
... ...
... ... @@ -168,6 +168,7 @@ export interface DeviceRecord {
168 168 provisionType: string;
169 169 deviceType: string;
170 170 deviceCount: number;
  171 + tbDeviceId: string;
171 172 tbProfileId: string;
172 173 profileData: ProfileData;
173 174 defaultQueueName: string;
... ...
... ... @@ -307,6 +307,7 @@
307 307 if (keys === Active.PENDING) {
308 308 reloadPending();
309 309 } else {
  310 + reloadSelected();
310 311 setProps({
311 312 dataSource: unref(selectedRows),
312 313 });
... ... @@ -319,6 +320,8 @@
319 320 if (props.value && !props.value.length) {
320 321 selectedRowKeys.value = [];
321 322 selectedRows.value = [];
  323 + pendingTotal.value = 0;
  324 + selectedTotal.value = 0;
322 325 }
323 326 }
324 327 );
... ...
  1 +<script lang="ts" setup>
  2 + import { h } from 'vue';
  3 + import { Description, useDescription } from '/@/components/Description';
  4 + import { BasicModal, useModal } from '/@/components/Modal';
  5 +
  6 + const [register] = useModal();
  7 +
  8 + const [registerDes] = useDescription({
  9 + bordered: false,
  10 + column: 1,
  11 + labelStyle: {
  12 + width: '100px',
  13 + textAlign: 'right',
  14 + justifyContent: 'right',
  15 + paddingRight: '20px',
  16 + },
  17 + data: {
  18 + copyright:
  19 + 'ThingsKit物联网平台版权归成都云腾五洲科技有限公司所有,您可以任意商用,但请注意保留本版权声明',
  20 + website: 'https://thingskit.com',
  21 + authorization: '若不想保留本版权声明,请前往以下链接查看移出方法,',
  22 + },
  23 + schema: [
  24 + {
  25 + field: 'copyright',
  26 + label: '版权声明',
  27 + },
  28 + {
  29 + field: 'website',
  30 + label: '官网',
  31 + render: (val: string) => {
  32 + return h(
  33 + 'span',
  34 + { class: 'text-blue-500 cursor-pointer', onClick: () => open(val) },
  35 + val
  36 + );
  37 + },
  38 + },
  39 + {
  40 + field: 'authorization',
  41 + label: '商业授权',
  42 + render: (val: string) => {
  43 + console.log(val);
  44 + // https://community.thingskit.com/question/20.html
  45 + return h('div', {}, [
  46 + h('span', val),
  47 + h(
  48 + 'span',
  49 + {
  50 + class: 'text-blue-500 cursor-pointer',
  51 + onClick: () => open('https://community.thingskit.com/question/20.html'),
  52 + },
  53 + '点击前往'
  54 + ),
  55 + ]);
  56 + },
  57 + },
  58 + ],
  59 + });
  60 +</script>
  61 +
  62 +<template>
  63 + <BasicModal
  64 + @register="register"
  65 + title="关于我们"
  66 + width="50%"
  67 + cancel-text="关闭"
  68 + :show-ok-btn="false"
  69 + >
  70 + <Description @register="registerDes" />
  71 + </BasicModal>
  72 +</template>
... ...
  1 +<script lang="ts" setup>
  2 + import { QuestionCircleOutlined } from '@ant-design/icons-vue';
  3 + import { Tooltip } from 'ant-design-vue';
  4 +
  5 + const handleJump = () => {
  6 + open('https://docs.thingskit.com');
  7 + };
  8 +</script>
  9 +
  10 +<template>
  11 + <Tooltip title="帮助文档">
  12 + <QuestionCircleOutlined class="text-base cursor-pointer" @click="handleJump" />
  13 + </Tooltip>
  14 +</template>
... ...
... ... @@ -37,6 +37,7 @@
37 37 :text="t('layout.header.dropdownItemChangePassword')"
38 38 icon="ant-design:unlock-twotone"
39 39 />
  40 + <MenuItem key="aboutSoftware" text="关于软件" icon="ant-design:message-outline" />
40 41 <MenuItem
41 42 v-if="getUseLockPage"
42 43 key="lock"
... ... @@ -57,6 +58,7 @@
57 58 ref="personalRef"
58 59 @register="registerPersonal"
59 60 />
  61 + <AboutSoftwareModal @register="registerModal" />
60 62 </template>
61 63 <script lang="ts">
62 64 // components
... ... @@ -74,8 +76,9 @@
74 76 import { getAuthCache } from '/@/utils/auth';
75 77 import { useRouter } from 'vue-router';
76 78 import { usePermission } from '/@/hooks/web/usePermission';
  79 + import AboutSoftwareModal from '../AboutSoftwareModal.vue';
77 80
78   - type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal' | 'changePassword';
  81 + type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal' | 'changePassword' | 'aboutSoftware';
79 82
80 83 export default defineComponent({
81 84 name: 'UserDropdown',
... ... @@ -85,6 +88,7 @@
85 88 MenuItem: createAsyncComponent(() => import('./DropMenuItem.vue')),
86 89 LockAction: createAsyncComponent(() => import('../lock/LockModal.vue')),
87 90 PersonalChild: createAsyncComponent(() => import('../personal/index.vue')),
  91 + AboutSoftwareModal,
88 92 },
89 93 props: {
90 94 theme: propTypes.oneOf(['dark', 'light']),
... ... @@ -120,6 +124,11 @@
120 124 openModal(true);
121 125 }
122 126
  127 + const [registerModal, { openModal: openAboutSoftwareModal }] = useModal();
  128 + function handleOpenAboutSoftwareModal() {
  129 + openAboutSoftwareModal();
  130 + }
  131 +
123 132 // login out
124 133 function handleLoginOut() {
125 134 userStore.confirmLoginOut();
... ... @@ -138,6 +147,8 @@
138 147 case 'changePassword':
139 148 changePassword();
140 149 break;
  150 + case 'aboutSoftware':
  151 + handleOpenAboutSoftwareModal();
141 152 }
142 153 }
143 154
... ... @@ -180,6 +191,7 @@
180 191 register,
181 192 getUseLockPage,
182 193 hasPermission,
  194 + registerModal,
183 195 };
184 196 },
185 197 });
... ...
... ... @@ -39,6 +39,8 @@
39 39
40 40 <Notify v-if="getShowNotice" :class="`${prefixCls}-action__item notify-item`" />
41 41
  42 + <HelpDoc />
  43 +
42 44 <FullScreen v-if="getShowFullScreen" :class="`${prefixCls}-action__item fullscreen-item`" />
43 45
44 46 <AppLocalePicker
... ... @@ -75,6 +77,7 @@
75 77
76 78 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
77 79 import { useLocale } from '/@/locales/useLocale';
  80 + import HelpDoc from './components/HelpDoc.vue';
78 81
79 82 export default defineComponent({
80 83 name: 'LayoutHeader',
... ... @@ -92,6 +95,7 @@
92 95 SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), {
93 96 loading: true,
94 97 }),
  98 + HelpDoc,
95 99 },
96 100 props: {
97 101 fixed: propTypes.bool,
... ...
... ... @@ -196,26 +196,25 @@
196 196 const dataSource = ref([]);
197 197 const go = useGo();
198 198 const helpDoc = ref([
199   - {
200   - title: '如何接入设备?',
201   - href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E5%88%97%E8%A1%A8',
202   - target: '_blank ',
203   - },
204   - {
205   - title: '什么是产品?',
206   - href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E9%85%8D%E7%BD%AE',
207   - target: '_blank ',
208   - },
209   - {
210   - title: '云组态模板如何使用?',
211   - href: 'https://docs.thingskit.com/',
212   - target: '_blank ',
213   - },
214   - {
215   - title: '查看全部>>',
216   - href: 'https://docs.thingskit.com/',
217   - target: '_blank ',
218   - },
  199 + // title: '如何接入设备?',
  200 + // href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E5%88%97%E8%A1%A8',
  201 + // target: '_blank ',
  202 + // },
  203 + // {
  204 + // title: '什么是产品?',
  205 + // href: 'https://docs.thingskit.com/thingskit-link/operation-guide/device-manage.html#%E8%AE%BE%E5%A4%87%E9%85%8D%E7%BD%AE',
  206 + // target: '_blank ',
  207 + // },
  208 + // {
  209 + // title: '云组态模板如何使用?',
  210 + // href: 'https://docs.thingskit.com/',
  211 + // target: '_blank ',
  212 + // },
  213 + // {
  214 + // title: '查看全部>>',
  215 + // href: 'https://docs.thingskit.com/',
  216 + // target: '_blank ',
  217 + // },
219 218 ]);
220 219 const activeKey = ref('tab1');
221 220 const tabListTitle = [
... ...
1 1 <template>
2 2 <div class="p-4 md:flex">
3   - <div class="md:w-7/10 w-full !mr-4 enter-y">
  3 + <div
  4 + class="md:w-7/10 w-full !mr-4 enter-y"
  5 + :class="role !== RoleEnum.SYS_ADMIN && '!md:w-full !mr-0'"
  6 + >
4 7 <GrowCard :loading="loading" class="enter-y" :role="role" />
5 8 <SiteAnalysisMessage class="!my-4 enter-y" :loading="loading" :role="role" />
6 9 <SiteAnalysis class="!my-4 enter-y" :loading="loading" :role="role" />
... ... @@ -10,7 +13,7 @@
10 13 </Card>
11 14 </div>
12 15 </div>
13   - <div class="md:w-3/10 w-full enter-y">
  16 + <div v-if="role === RoleEnum.SYS_ADMIN" class="md:w-3/10 w-full enter-y">
14 17 <Card
15 18 :style="{ width: '100%', height: !isAdmin(role) ? '100%' : '98.4%' }"
16 19 :title="!isAdmin(role) ? '帮助文档' : ''"
... ... @@ -29,7 +32,7 @@
29 32 import HelpDoc from './components/HelpDoc.vue';
30 33 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
31 34 import { getAuthCache } from '/@/utils/auth';
32   - import { isAdmin } from '/@/enums/roleEnum';
  35 + import { isAdmin, RoleEnum } from '/@/enums/roleEnum';
33 36
34 37 defineExpose({
35 38 isAdmin,
... ... @@ -39,6 +42,8 @@
39 42
40 43 const role: string = userInfo?.roles[0];
41 44
  45 + console.log({ role });
  46 +
42 47 const loading = ref(true);
43 48
44 49 setTimeout(() => {
... ...
... ... @@ -278,6 +278,7 @@
278 278 if (isApiHeaders && Object.values(isApiHeaders).includes('')) {
279 279 return createMessage.error('请填写属性');
280 280 }
  281 + Object.assign(allPostForm, { clientProperties: {} });
281 282 const res = await postAddConvertApi(allPostForm);
282 283 if (res) {
283 284 closeModalAfterSuccess && closeModal();
... ... @@ -303,6 +304,7 @@
303 304 }
304 305 }
305 306 Object.assign(noEditObj, getTypeObj, {
  307 + clientProperties: {},
306 308 datasourceType: allPostForm.datasourceType,
307 309 datasourceContent: allPostForm.datasourceContent,
308 310 });
... ...
... ... @@ -64,9 +64,9 @@ const handleGroupDevice = (options: DeviceRecord[]) => {
64 64 options.forEach((item) => {
65 65 if (map.has(item.profileId)) {
66 66 const deviceList = map.get(item.profileId)!;
67   - deviceList.push(item.id);
  67 + deviceList.push(item.tbDeviceId);
68 68 } else {
69   - map.set(item.profileId, [item.id]);
  69 + map.set(item.profileId, [item.tbDeviceId]);
70 70 }
71 71 });
72 72 const value = Array.from(map.entries()).map(([product, devices]) => ({ product, devices }));
... ... @@ -230,7 +230,8 @@ export const modeForm = (submitFn?: Function): FormSchema[] => {
230 230
231 231 return {
232 232 labelField: 'name',
233   - valueField: 'id',
  233 + valueField: 'tbDeviceId',
  234 + primaryKey: 'tbDeviceId',
234 235 pendingTableProps: {
235 236 ...TransferTableProps,
236 237 api: devicePage,
... ... @@ -261,12 +262,14 @@ export const modeForm = (submitFn?: Function): FormSchema[] => {
261 262 initSelectedOptions: async ({ setSelectedTotal }) => {
262 263 const values = getFieldsValue();
263 264 const convertConfigId = Reflect.get(values, BasicInfoFormField.CONVERT_CONFIG_ID);
  265 + const deviceProfileIds = Reflect.get(values, BasicInfoFormField.DATA_SOURCE_PRODUCT);
264 266 const devices = Reflect.get(values, BasicInfoFormField.DATA_SOURCE_DEVICE);
265 267 if (convertConfigId && devices) {
266 268 const { items, total } = await devicePage({
267 269 page: 1,
268 270 pageSize: 10,
269 271 convertConfigId: values[BasicInfoFormField.CONVERT_CONFIG_ID],
  272 + deviceProfileIds,
270 273 selected: true,
271 274 });
272 275 setSelectedTotal(total);
... ...
... ... @@ -69,10 +69,11 @@
69 69 ...record,
70 70 [BasicInfoFormField.DATA_SOURCE_PRODUCT]:
71 71 record?.datasourceContent?.convertProducts || [],
72   - [BasicInfoFormField.DATA_SOURCE_DEVICE]:
73   - (record?.datasourceContent?.convertDevices || []).reduce((prev, next) => {
74   - return [...prev, ...(next?.devices || [])];
75   - }, []) || [],
  72 + [BasicInfoFormField.DATA_SOURCE_DEVICE]: record?.datasourceContent?.convertDevices,
  73 + // [BasicInfoFormField.DATA_SOURCE_DEVICE]:
  74 + // (record?.datasourceContent?.convertDevices || []).reduce((prev, next) => {
  75 + // return [...prev, ...(next?.devices || [])];
  76 + // }, []) || [],
76 77 };
77 78 setFieldsValue(value);
78 79 };
... ...
... ... @@ -132,13 +132,13 @@
132 132 const provideOrgid = ref('');
133 133
134 134 const { createMessage } = useMessage();
135   - const triggerData = ref([]);
136   - const conditionData = ref([]);
137   - const actionData = ref([]);
  135 + const triggerData = ref<number[]>([]);
  136 + const conditionData = ref<number[]>([]);
  137 + const actionData = ref<number[]>([]);
138 138 const skipUnwrap = {
139   - triggerItemRefs: ref([]),
140   - conditionItemRefs: ref([]),
141   - actionItemRefs: ref([]),
  139 + triggerItemRefs: ref<InstanceType<typeof TriggerOrCondition>[]>([]),
  140 + conditionItemRefs: ref<InstanceType<typeof TriggerOrCondition>[]>([]),
  141 + actionItemRefs: ref<InstanceType<typeof Action>[]>([]),
142 142 };
143 143 const title = computed(
144 144 () => `${isUpdate.value === 3 ? '查看' : isUpdate.value ? '编辑' : '新增'}场景联动`
... ... @@ -387,6 +387,7 @@
387 387 doActions.forEach((action, index) => {
388 388 nextTick(() => {
389 389 const selectProductId = ref('');
  390 + console.log('doActions', unref(skipUnwrap.actionItemRefs));
390 391 // 设置执行动作外层值
391 392 unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({
392 393 ...action,
... ...
... ... @@ -536,6 +536,7 @@ export const actionSchema: FormSchema[] = [
536 536 params: {
537 537 dictCode: 'custom_define',
538 538 },
  539 + numberToString: true,
539 540 getPopupContainer: () => document.body,
540 541 onChange: () => {
541 542 setFieldsValue({ doContext: null, thingsModelId: null });
... ...
... ... @@ -81,6 +81,7 @@
81 81
82 82 <script lang="ts">
83 83 import { defineComponent } from 'vue';
  84 + import { isNumber } from '/@/utils/is';
84 85 export default defineComponent({
85 86 components: {
86 87 VNodes: (_, { attrs }) => {
... ... @@ -261,9 +262,13 @@
261 262 };
262 263
263 264 const setFieldsFormValueFun = (fieldsValue) => {
  265 + console.log(getFieldsValue());
  266 +
264 267 setFieldsValue({
265 268 ...fieldsValue,
266   - ...(fieldsValue.commandType ? { commandType: String(fieldsValue.commandType) } : {}),
  269 + ...(isNumber(fieldsValue.commandType)
  270 + ? { commandType: String(fieldsValue.commandType) }
  271 + : {}),
267 272 });
268 273 };
269 274 //ft-add
... ...
... ... @@ -80,6 +80,7 @@
80 80 // import { useUserStore } from '/@/store/modules/user';
81 81 import { getPlatForm } from '/@/api/oem/index';
82 82 import defaultShowLogoImg from '/@/assets/svg/login-bg.svg';
  83 + import { useTitle } from '@vueuse/core';
83 84
84 85 defineProps({
85 86 sessionTimeout: {
... ... @@ -136,6 +137,10 @@
136 137 const localeStore = useLocaleStore();
137 138 const showLocale = localeStore.getShowPicker;
138 139 // const title = computed(() => globSetting?.title ?? '');
  140 +
  141 + onMounted(() => {
  142 + useTitle('ThingsKit 物联网平台');
  143 + });
139 144 </script>
140 145 <style lang="less">
141 146 @prefix-cls: ~'@{namespace}-login';
... ... @@ -195,7 +200,7 @@
195 200 width: 100%;
196 201 height: 100%;
197 202 margin-left: -48%;
198   - background-image: v-bind(logoUrl);
  203 + background-image: v-bind(logourl);
199 204 // background-image: url(/@/assets/svg/login-bg.svg);
200 205 background-position: 100%;
201 206 background-repeat: no-repeat;
... ...