From 66234bdfd49037e6861314836c5e88f4a94a0987 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Mon, 6 Mar 2023 11:19:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BadgeStatus/index.vue | 1 - src/components/JUpload/index.vue | 4 +- src/components/index.ts | 4 +- src/views/device/Instance/Export/index.vue | 104 +++++++++++++-------- src/views/device/Instance/Import/index.vue | 50 +++++----- src/views/device/Instance/Save/index.vue | 24 ++--- src/views/device/Instance/index.vue | 8 +- src/views/device/Instance/typings.d.ts | 13 +++ src/views/rule-engine/Scene/index.vue | 32 ++++--- yarn.lock | 4 +- 10 files changed, 151 insertions(+), 93 deletions(-) diff --git a/src/components/BadgeStatus/index.vue b/src/components/BadgeStatus/index.vue index 6929f8bb..403cbbe6 100644 --- a/src/components/BadgeStatus/index.vue +++ b/src/components/BadgeStatus/index.vue @@ -28,5 +28,4 @@ const props = defineProps({ */ statusNames: { type: Object }, }); - diff --git a/src/components/JUpload/index.vue b/src/components/JUpload/index.vue index 03ee6536..18def1a3 100644 --- a/src/components/JUpload/index.vue +++ b/src/components/JUpload/index.vue @@ -1,7 +1,7 @@ - +
diff --git a/src/components/index.ts b/src/components/index.ts index 3e8f4b57..fdbb2309 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -8,7 +8,7 @@ import CardBox from './CardBox/index.vue'; // import Search from './Search' import NormalUpload from './NormalUpload/index.vue' import FileFormat from './FileFormat/index.vue' -// import JUpload from './JUpload/index.vue' +import JProUpload from './JUpload/index.vue' import { BasicLayoutPage, BlankLayoutPage } from './Layout' import { PageContainer } from 'jetlinks-ui-components/es/components' import Ellipsis from './Ellipsis/index.vue' @@ -27,7 +27,7 @@ export default { // .component('Search', Search) .component('NormalUpload', NormalUpload) .component('FileFormat', FileFormat) - // .component('JUpload', JUpload) + .component('JProUpload', JProUpload) .component('BasicLayoutPage', BasicLayoutPage) .component('BlankLayoutPage', BlankLayoutPage) .component('PageContainer', PageContainer) diff --git a/src/views/device/Instance/Export/index.vue b/src/views/device/Instance/Export/index.vue index 9f49c011..1b422fde 100644 --- a/src/views/device/Instance/Export/index.vue +++ b/src/views/device/Instance/Export/index.vue @@ -1,5 +1,12 @@ \ No newline at end of file diff --git a/src/views/device/Instance/Import/index.vue b/src/views/device/Instance/Import/index.vue index 899cdb61..335ff68d 100644 --- a/src/views/device/Instance/Import/index.vue +++ b/src/views/device/Instance/Import/index.vue @@ -1,36 +1,35 @@ \ No newline at end of file diff --git a/src/views/device/Instance/Save/index.vue b/src/views/device/Instance/Save/index.vue index b49cd0ba..00bf127c 100644 --- a/src/views/device/Instance/Save/index.vue +++ b/src/views/device/Instance/Save/index.vue @@ -18,7 +18,7 @@ - + @@ -60,15 +60,14 @@ {{item.name}} @@ -105,16 +104,12 @@ const formRef = ref(); const modelRef = reactive({ productId: undefined, - id: '', + id: undefined, name: '', describe: '', photoUrl: getImage('/device/instance/device-card.png'), }); -const filterOption = (input: string, option: any) => { - return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; -}; - const vailId = async (_: Record, value: string) => { if (!props?.data?.id && value) { const resp = await isExists(value); @@ -202,10 +197,15 @@ const handleCancel = () => { const handleSave = () => { formRef.value .validate() - .then(async () => { + .then(async (_data: any) => { loading.value = true; - const resp = await update(toRaw(modelRef)); - loading.value = false; + const obj = {...toRaw(modelRef), ..._data} + if(!obj.id){ + delete obj.id + } + const resp = await update(obj).finally(() => { + loading.value = false; + }) if (resp.status === 200) { message.success('操作成功!'); emit('save'); diff --git a/src/views/device/Instance/index.vue b/src/views/device/Instance/index.vue index d28d075d..5320be4e 100644 --- a/src/views/device/Instance/index.vue +++ b/src/views/device/Instance/index.vue @@ -229,7 +229,7 @@ - + >({}); @@ -696,4 +696,8 @@ const saveBtn = () => { const handleSearch = (_params: any) => { params.value = _params; }; + +const onRefresh = () => { + instanceRef.value?.reload(); +} diff --git a/src/views/device/Instance/typings.d.ts b/src/views/device/Instance/typings.d.ts index e00c9319..035c56f0 100644 --- a/src/views/device/Instance/typings.d.ts +++ b/src/views/device/Instance/typings.d.ts @@ -83,4 +83,17 @@ type InstanceModel = { params: Set; // 处理无限循环Card active?: string; // 当前编辑的Card selectedRows: Map; +} + +export interface ActionsType { + key: string; + text?: string; + disabled?: boolean; + permission?: boolean; + onClick?: (data: any) => void; + style?: CSSProperties; + tooltip?: TooltipProps; + popConfirm?: PopconfirmProps; + icon?: string; + children?: ActionsType[]; } \ No newline at end of file diff --git a/src/views/rule-engine/Scene/index.vue b/src/views/rule-engine/Scene/index.vue index 9d49e85d..1ec7c88f 100644 --- a/src/views/rule-engine/Scene/index.vue +++ b/src/views/rule-engine/Scene/index.vue @@ -1,6 +1,6 @@