diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index 9562fd06..9f4cf6f9 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -571,3 +571,6 @@ export const queryLog = (deviceId: string, data: Record) => ser */ export const queryLogsType = () => server.get(`/dictionary/device-log-type/items`) +export const getDeviceNumber = (data?:any) => server.post('/device-instance/_count', data) + + diff --git a/src/components/Layout/components/Notice.vue b/src/components/Layout/components/Notice.vue index 54716086..51d9a5df 100644 --- a/src/components/Layout/components/Notice.vue +++ b/src/components/Layout/components/Notice.vue @@ -107,8 +107,10 @@ const read = (type: string, data: any) => { const getList = () => { loading.value = true; const params = { - 'sorts[0].name': 'notifyTime', - 'sorts[0].order': 'desc', + sorts: [{ + name: 'notifyTime', + order: 'desc' + }], terms: [ { terms: [ diff --git a/src/components/NormalUpload/index.vue b/src/components/NormalUpload/index.vue index 42cc2455..1ed86af6 100644 --- a/src/components/NormalUpload/index.vue +++ b/src/components/NormalUpload/index.vue @@ -40,14 +40,13 @@ import { FILE_UPLOAD } from '@/api/comm'; import { TOKEN_KEY } from '@/utils/variable'; import { LocalStore, onlyMessage } from '@/utils/comm'; -import { downloadFile, downloadFileByUrl } from '@/utils/utils'; +import { downloadFileByUrl } from '@/utils/utils'; import { deviceImport, - deviceTemplateDownload, templateDownload, } from '@/api/device/instance'; import { EventSourcePolyfill } from 'event-source-polyfill'; -import { message } from 'ant-design-vue'; +import { message } from 'jetlinks-ui-components'; type Emits = { (e: 'update:modelValue', data: string[]): void; @@ -73,6 +72,15 @@ const props = defineProps({ }; }, }, + url: { + type: Object, + default: () => { + return { + fileType: 'xlsx', + autoDeploy: false, + }; + }, + }, }); const importLoading = ref(false); @@ -81,7 +89,6 @@ const count = ref(0); const errMessage = ref(''); const downFile = async (type: string) => { - // downloadFile(deviceTemplateDownload(props.product, type)); const res: any = await templateDownload(props.product, type); if (res) { const blob = new Blob([res], { type: type }); diff --git a/src/components/ValueItem/index.vue b/src/components/ValueItem/index.vue index 79725601..09d33c26 100644 --- a/src/components/ValueItem/index.vue +++ b/src/components/ValueItem/index.vue @@ -85,6 +85,7 @@ width="700px" @cancel="modalVis = false" @ok="handleItemModalSubmit" + :zIndex='1100' >
@@ -157,15 +158,17 @@ const componentsType = ref({ }); const typeMap = new Map(Object.entries(componentsType.value)); -const myValue = computed({ - get: () => { - return props.modelValue; - }, - set: (val: any) => { - objectValue.value = val; - emit('update:modelValue', val); - }, -}); +// const myValue = computed({ +// get: () => { +// return props.modelValue; +// }, +// set: (val: any) => { +// objectValue.value = val; +// emit('update:modelValue', val); +// }, +// }); + +const myValue = ref(props.modelValue) // 代码编辑器弹窗 const modalVis = ref(false); @@ -174,6 +177,7 @@ const handleItemModalSubmit = () => { myValue.value = objectValue.value.replace(/[\r\n]\s*/g, ''); modalVis.value = false; emit('change', objectValue.value) + emit('update:modelValue', myValue.value); }; // 文件上传 @@ -189,18 +193,28 @@ const handleFileChange = (info: UploadChangeParam>) => { const selectChange = (e: string, option: any) => { emit('change', e, option) + emit('update:modelValue', myValue.value); } const timeChange = (e: any) => { emit('change', e) + emit('update:modelValue', myValue.value); } const inputChange = (e: any) => { emit('change', e && e.target ? e.target.value : e) + emit('update:modelValue', myValue.value); } const dateChange = (e: any) => { emit('change', e) + emit('update:modelValue', myValue.value); +} + +myValue.value = props.modelValue + +if (props.itemType === 'object') { + objectValue.value = props.modelValue as string } diff --git a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue index 325ae6e6..916cab23 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveModBus.vue @@ -187,19 +187,14 @@ - @@ -346,15 +341,6 @@ const changeFunction = (value: string) => { value === 'InputRegisters' ? ['read'] : ['read', 'write']; }; -const checkLength = (_rule: Rule, value: string): Promise => - new Promise(async (resolve, reject) => { - if (value) { - return String(value).length > 64 - ? reject('最多可输入64个字符') - : resolve(''); - } - }); - const checkProvider = (_rule: Rule, value: string): Promise => new Promise(async (resolve, reject) => { if (value) { diff --git a/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue b/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue index 8af6c961..869d0954 100644 --- a/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue +++ b/src/views/DataCollect/Collector/Point/Save/SaveOPCUA.vue @@ -49,19 +49,14 @@ - @@ -156,17 +151,6 @@ const handleCancel = () => { emit('change', false); }; -const checkLength = (_rule: Rule, value: string): Promise => - new Promise(async (resolve, reject) => { - if (value) { - return String(value).length > 64 - ? reject('最多可输入64个字符') - : resolve(''); - } else { - reject(''); - } - }); - const filterOption = (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; }; diff --git a/src/views/DataCollect/Collector/Point/Scan/Table.vue b/src/views/DataCollect/Collector/Point/Scan/Table.vue index 40b5ca5e..bb6712cd 100644 --- a/src/views/DataCollect/Collector/Point/Scan/Table.vue +++ b/src/views/DataCollect/Collector/Point/Scan/Table.vue @@ -111,17 +111,13 @@ 'value', ]" :rules="[ - { - validator: checkLength, - trigger: 'change', - }, { pattern: regOnlyNumber, message: '请输入0或者正整数', }, ]" > - + > - diff --git a/src/views/DataCollect/Collector/Point/index.vue b/src/views/DataCollect/Collector/Point/index.vue index a7011686..7782d0b2 100644 --- a/src/views/DataCollect/Collector/Point/index.vue +++ b/src/views/DataCollect/Collector/Point/index.vue @@ -572,20 +572,20 @@ const handleClick = (dt: any) => { }; const subscribeProperty = (value: any) => { - const list = value.map((item: any) => item.id); - const id = `collector-${props.data?.channelId || 'channel'}-${ - props.data?.id || 'point' - }-data-${list.join('-')}`; - const topic = `/collector/${props.data?.channelId || '*'}/${ - props.data?.id || '*' - }/data`; - subRef.value = getWebSocket(id, topic, { - pointId: list.join(','), - }) - ?.pipe(map((res: any) => res.payload)) - .subscribe((payload: any) => { - propertyValue.value.set(payload.pointId, payload); - }); + // const list = value.map((item: any) => item.id); + // const id = `collector-${props.data?.channelId || 'channel'}-${ + // props.data?.id || 'point' + // }-data-${list.join('-')}`; + // const topic = `/collector/${props.data?.channelId || '*'}/${ + // props.data?.id || '*' + // }/data`; + // subRef.value = getWebSocket(id, topic, { + // pointId: list.join(','), + // }) + // ?.pipe(map((res: any) => res.payload)) + // .subscribe((payload: any) => { + // propertyValue.value.set(payload.pointId, payload); + // }); }; const onCheckAllChange = (e: any) => { diff --git a/src/views/DataCollect/Collector/Tree/index.vue b/src/views/DataCollect/Collector/Tree/index.vue index 48cd8035..5a2f7259 100644 --- a/src/views/DataCollect/Collector/Tree/index.vue +++ b/src/views/DataCollect/Collector/Tree/index.vue @@ -237,7 +237,8 @@ const handleSearch = async (value: any) => { if (clickSearch) { defualtDataSource.value = res.result; if (res.result.length !== 0) { - selectedKeys.value = [res.result[0].id]; // 通道跳转进来或者搜索时,默认选中第一个 + selectedKeys.value.length === 0 && + (selectedKeys.value = [res.result[0].id]); // 通道跳转进来或者搜索时,默认选中第一个 } } else { defualtDataSource.value = _.cloneDeep(root); @@ -285,7 +286,11 @@ watch( watch( () => searchValue.value, (value) => { - !value && handleSearch(value); + if (!value) { + setTimeout(() => { + handleSearch(value); + }, 0); + } }, ); diff --git a/src/views/DataCollect/Collector/index.vue b/src/views/DataCollect/Collector/index.vue index 7d3e24b5..4bc78162 100644 --- a/src/views/DataCollect/Collector/index.vue +++ b/src/views/DataCollect/Collector/index.vue @@ -30,7 +30,7 @@ const changeTree = (row: any) => { collectorId: row?.id, }; spinning.value = false; - }, 300); + }, 1000); }; diff --git a/src/views/DataCollect/Dashboard/tool.ts b/src/views/DataCollect/Dashboard/tool.ts index 7ca5d408..4fd5a133 100644 --- a/src/views/DataCollect/Dashboard/tool.ts +++ b/src/views/DataCollect/Dashboard/tool.ts @@ -86,7 +86,7 @@ export const pointParams = (data: any) => { from: Number(data.time.time[0]), to: Number(data.time.time[1]), interval: getParams(data.time).interval, - format: getParams(data.time).format, + format: 'YYYY-MM-dd HH:mm', }, }, ]; diff --git a/src/views/device/Instance/Process/index.vue b/src/views/device/Instance/Process/index.vue index eb6fe298..0437cc9d 100644 --- a/src/views/device/Instance/Process/index.vue +++ b/src/views/device/Instance/Process/index.vue @@ -23,7 +23,7 @@ @@ -188,3 +194,4 @@ getConfig(); color: @primary-color; } + diff --git a/src/views/iot-card/CardManagement/UploadFile.vue b/src/views/iot-card/CardManagement/UploadFile.vue new file mode 100644 index 00000000..ed5e3b72 --- /dev/null +++ b/src/views/iot-card/CardManagement/UploadFile.vue @@ -0,0 +1,115 @@ + + + \ No newline at end of file diff --git a/src/views/iot-card/Platform/index.vue b/src/views/iot-card/Platform/index.vue index 50e2e170..c3cafec1 100644 --- a/src/views/iot-card/Platform/index.vue +++ b/src/views/iot-card/Platform/index.vue @@ -26,7 +26,7 @@ @@ -124,6 +124,7 @@ const props = defineProps({ }) const emit = defineEmits() +const unitMax = ref(99) const cronRules = [ { max: 64, message: '最多可输入64个字符' }, @@ -170,7 +171,9 @@ const showPeriod = computed(() => { return formModel.trigger !== 'cron' && formModel.mod === 'period' }) + const updateValue = () => { + const cloneValue = cloneDeep(formModel) if (cloneValue.trigger === 'cron') { delete cloneValue.when @@ -186,6 +189,26 @@ const updateValue = () => { emit('update:value', cloneValue) } +const triggerChange = () => { + formModel.when = [] + formModel.cron = undefined + updateValue() +} + +/** + * 频率单位切换 + * @param v + */ +const periodUnitChange = (v: any) => { + if(v === 'hours') { + unitMax.value = 99999 + } else { + unitMax.value = 99 + } + formModel.period!.every = 1 + updateValue() +} + defineExpose({ validateFields: () => new Promise(async (resolve) => { const data = await timerForm.value?.validateFields() diff --git a/src/views/system/DataSource/Management/index.vue b/src/views/system/DataSource/Management/index.vue index ea797fec..2f3f119e 100644 --- a/src/views/system/DataSource/Management/index.vue +++ b/src/views/system/DataSource/Management/index.vue @@ -147,7 +147,7 @@ :danger="true" :popConfirm="{ title: `确认删除`, - onConfirm: () => clickDel(record), + onConfirm: () => clickDel(record, index), }" :disabled="record.status" > @@ -358,14 +358,18 @@ const addRow = () => { table.data.push(initData); }; -const clickDel = (row: any) => { +const clickDel = (row: any, index: number) => { if (row.scale !== undefined) { delSaveRow_api(id, leftData.selectedKeys[0], [row.name]).then( (resp: any) => { - if (resp.status === 200) table.data.splice(row.index, 1); + if (resp.status === 200) { + table.data.splice(index, 1) + } }, ); - } else table.data.splice(row.index, 1); + } else { + table.data.splice(index, 1) + }; }; const clickSave = () => { diff --git a/yarn.lock b/yarn.lock index 12ea964d..95dc6559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3: jetlinks-ui-components@^1.0.5: version "1.0.5" - resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#031a300df4df31a353d738cacee8b4ff630ae2d0" - integrity sha512-SfucQ7LzlE13VdyZsDhrhzwF9Le/NOke5F6UY3bNN1OJiRD/bZMJecGQxWBQGv567lKcV60SOPCMT8ExiZxUgw== + resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#a8c912f424b8e6c3e0aa8e2aa9ddcc59fe13cd3a" + integrity sha512-zZsVbqG7sLfKsizK+8sT0bCmAz7rEu/qoS5yYSEUzGMvTGQU3Q5W6qdT/5o5v92BYFP+1Kud1l5CNhA3e3NtWQ== dependencies: "@vueuse/core" "^9.12.0" ant-design-vue "^3.2.15"