From 3519ce17c359497a5dc3ddf14261beb4cbd64475 Mon Sep 17 00:00:00 2001 From: huanghao1412 Date: Thu, 22 Feb 2024 21:35:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=8B=E5=8A=A8=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commonDataComponents/useManualInputRes.ts | 20 +++++++ .../useManualInputSingleRes.ts | 20 +++++++ src/hooks/useChartCommonData.hook.ts | 15 ++++- .../Tables/Tables/TableList1/index.vue | 10 +++- src/packages/public/publicConfig.ts | 11 ++++ .../chartEditStore/chartEditStore.d.ts | 27 ++++++++- .../ChartDataV2/components/ManualInput.vue | 57 ++++++++++++++++++ .../components/ManualInputSingle.vue | 58 +++++++++++++++++++ .../components/ChartDataV2/index.d.ts | 10 ++++ .../components/ChartDataV2/index.vue | 6 +- 10 files changed, 227 insertions(+), 7 deletions(-) create mode 100644 src/hooks/commonDataComponents/useManualInputRes.ts create mode 100644 src/hooks/commonDataComponents/useManualInputSingleRes.ts create mode 100644 src/views/chart/ContentConfigurations/components/ChartDataV2/components/ManualInput.vue create mode 100644 src/views/chart/ContentConfigurations/components/ChartDataV2/components/ManualInputSingle.vue diff --git a/src/hooks/commonDataComponents/useManualInputRes.ts b/src/hooks/commonDataComponents/useManualInputRes.ts new file mode 100644 index 00000000..f419a2aa --- /dev/null +++ b/src/hooks/commonDataComponents/useManualInputRes.ts @@ -0,0 +1,20 @@ +import { publicInterface } from "@/api/path"; +import { commonDataType, ManualInputType } from '@/store/modules/chartEditStore/chartEditStore.d' +import { CreateComponentType } from '@/packages/index.d' +import { ResultErrcode } from "@/enums/httpEnum"; +import dataJson from './data.json' + +export const handleManulInput = (targetComponent: CreateComponentType) => { + let { enable, dataset } = (targetComponent.commonData as commonDataType).manualInput as ManualInputType + if(!enable) return { + errcode: ResultErrcode.SUCCESS, + data: { ...dataJson }, + errmsg: '' + } + + return { + errcode: ResultErrcode.SUCCESS, + data: dataset, + errmsg: '' + } +} diff --git a/src/hooks/commonDataComponents/useManualInputSingleRes.ts b/src/hooks/commonDataComponents/useManualInputSingleRes.ts new file mode 100644 index 00000000..92c45176 --- /dev/null +++ b/src/hooks/commonDataComponents/useManualInputSingleRes.ts @@ -0,0 +1,20 @@ +import { publicInterface } from "@/api/path"; +import { commonDataType, ManualInputSingleType } from '@/store/modules/chartEditStore/chartEditStore.d' +import { CreateComponentType } from '@/packages/index.d' +import { ResultErrcode } from "@/enums/httpEnum"; +import singleDataJson from './singleData.json' + +export const handleManulInputSingle = (targetComponent: CreateComponentType) => { + let { enable, result } = (targetComponent.commonData as commonDataType).manualInputSingle as ManualInputSingleType + if(!enable) return { + errcode: ResultErrcode.SUCCESS, + data: { ...singleDataJson }, + errmsg: '' + } + + return { + errcode: ResultErrcode.SUCCESS, + data: result, + errmsg: '' + } +} diff --git a/src/hooks/useChartCommonData.hook.ts b/src/hooks/useChartCommonData.hook.ts index 5b9d8c05..0841d255 100644 --- a/src/hooks/useChartCommonData.hook.ts +++ b/src/hooks/useChartCommonData.hook.ts @@ -15,6 +15,8 @@ import { handleMonthAlarmClass } from './commonDataComponents/useMonthAlarmClass import { handleDeviceClass } from './commonDataComponents/useDeviceClassRes' import { handlePointTable } from "./commonDataComponents/usePointTableRes"; import { handleNoParam } from './commonDataComponents/useNoParamRes' +import { handleManulInput } from './commonDataComponents/useManualInputRes' +import { handleManulInputSingle } from './commonDataComponents/useManualInputSingleRes' import { ResultErrcode } from '@/enums/httpEnum' // 获取类型 @@ -46,7 +48,8 @@ export const useChartCommonData = ( // if(!dataset.dimensions) return if(targetComponent.option){ const SingleDataArr = [ - CurrentSourceEnum.SINGLEPOINT + CurrentSourceEnum.SINGLEPOINT, + CurrentSourceEnum.MANUALINPUTSINGLE ] const currentSource = targetComponent.commonData?.currentSource // 多个值的处理方式 @@ -130,6 +133,13 @@ export const useChartCommonData = ( case CurrentSourceEnum.POINTTABLE: res = await handlePointTable(targetComponent) break; + case CurrentSourceEnum.MANUALINPUT: + res = await handleManulInput(targetComponent) + break; + case CurrentSourceEnum.MANUALINPUTSINGLE: + res = await handleManulInputSingle(targetComponent) + isMultiple = false + break; default: // res = await handleNoParam(targetComponent) break; @@ -163,9 +173,10 @@ export const useChartCommonData = ( // 更新回调函数 if (updateCallback) updateCallback(data) } - else throw Error() + else throw Error('1234') } } catch (error) { + console.log(error) if(!isPreview()) window['$message'].error('数据错误') } } diff --git a/src/packages/components/Tables/Tables/TableList1/index.vue b/src/packages/components/Tables/Tables/TableList1/index.vue index e805b4b4..71635e94 100644 --- a/src/packages/components/Tables/Tables/TableList1/index.vue +++ b/src/packages/components/Tables/Tables/TableList1/index.vue @@ -1,7 +1,7 @@