From 7afe485d90c52faf6414bdbd8052ca1d03fb4540 Mon Sep 17 00:00:00 2001 From: sy2084 Date: Wed, 17 Jul 2024 23:19:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/y-chart.vue | 10 +++--- src/components/common/y-table.vue | 6 ++-- src/plugins/antv-g2plot/column.vue | 2 +- src/plugins/antv-g2plot/line.vue | 7 ++-- src/plugins/antv-g2plot/pie.vue | 2 +- src/plugins/antv-g2plot/useChart.js | 10 +++--- .../module-cfg/components/field-modal.vue | 32 ++++++++++++++++--- src/views/config-manage/module-cfg/config.ts | 3 +- src/views/config-manage/module-cfg/service.js | 9 +++++- src/views/view-all-manage/view-list/index.vue | 8 +++++ 10 files changed, 67 insertions(+), 22 deletions(-) diff --git a/src/components/common/y-chart.vue b/src/components/common/y-chart.vue index 581779d..5d33496 100644 --- a/src/components/common/y-chart.vue +++ b/src/components/common/y-chart.vue @@ -52,7 +52,9 @@ const emit = defineEmits(["toFilt"]); const chartType = ref("line"); const dateType = ref("day"); -const filterData = ref({}); +const filterData = ref({ + +}); const rangePicker = computed(() => { switch(dateType.value) { @@ -72,9 +74,9 @@ const currentChart = computed(() => { watch( () => props.filterConfig, (newVal) => { - newVal.forEach((item) => { - filterData.value[item.name] = undefined; - }); + // newVal.forEach((item) => { + // filterData.value[item.name] = undefined; + // }); }, ); diff --git a/src/components/common/y-table.vue b/src/components/common/y-table.vue index 8ec7284..e519106 100644 --- a/src/components/common/y-table.vue +++ b/src/components/common/y-table.vue @@ -91,9 +91,9 @@ watch( () => props.filterConfig, (newVal) => { - newVal.forEach((item) => { - filterData.value[item.name] = undefined; - }); + // newVal.forEach((item) => { + // filterData.value[item.name] = undefined; + // }); } ); diff --git a/src/plugins/antv-g2plot/column.vue b/src/plugins/antv-g2plot/column.vue index b29bc97..24130c9 100644 --- a/src/plugins/antv-g2plot/column.vue +++ b/src/plugins/antv-g2plot/column.vue @@ -22,5 +22,5 @@ const props = defineProps({ }, }); -const { container } = useChart(Column, props.config); +const { container } = useChart(Column, props); diff --git a/src/plugins/antv-g2plot/line.vue b/src/plugins/antv-g2plot/line.vue index e0eb1fe..1012be1 100644 --- a/src/plugins/antv-g2plot/line.vue +++ b/src/plugins/antv-g2plot/line.vue @@ -3,6 +3,7 @@ diff --git a/src/plugins/antv-g2plot/pie.vue b/src/plugins/antv-g2plot/pie.vue index 6bcc8de..ed7bebb 100644 --- a/src/plugins/antv-g2plot/pie.vue +++ b/src/plugins/antv-g2plot/pie.vue @@ -22,5 +22,5 @@ const props = defineProps({ }, }); -const { container } = useChart(Pie, props.config); +const { container } = useChart(Pie, props); diff --git a/src/plugins/antv-g2plot/useChart.js b/src/plugins/antv-g2plot/useChart.js index 1fb5e17..8f1d1f2 100644 --- a/src/plugins/antv-g2plot/useChart.js +++ b/src/plugins/antv-g2plot/useChart.js @@ -1,20 +1,20 @@ import { onBeforeUnmount, onMounted, ref, watch } from "vue"; import _ from "lodash"; -export default function useChart(ChartClass, config) { +export default function useChart(ChartClass, props) { const chart = ref(null); // 表格实例 const chartOptions = ref(null); // 图表配置 const container = ref(null); // 渲染图表元素 - const { onReady, onEvent } = config; + const { onReady, onEvent } = props.config; // 全局事件侦听器 let handler; onMounted(() => { - chartOptions.value = _.cloneDeep(config); + chartOptions.value = _.cloneDeep(props.config); // 实例化图表 - const chartInstance = new ChartClass(container.value, { ...config }); + const chartInstance = new ChartClass(container.value, { ...props.config }); chartInstance.toDataURL = (type, encoderOptions) => { return toDataURL(type, encoderOptions); }; @@ -46,7 +46,7 @@ export default function useChart(ChartClass, config) { // 配置更改时更新图表 watch( - () => config, + () => props.config, (config) => { const newConfig = _.cloneDeep(config); chartOptions.value = newConfig; diff --git a/src/views/config-manage/module-cfg/components/field-modal.vue b/src/views/config-manage/module-cfg/components/field-modal.vue index 62d150f..e6a9c86 100644 --- a/src/views/config-manage/module-cfg/components/field-modal.vue +++ b/src/views/config-manage/module-cfg/components/field-modal.vue @@ -40,6 +40,18 @@ {{ record[column.dataIndex] }} + @@ -96,6 +108,7 @@ import { onMounted, reactive, ref, watch } from "vue"; import { viewCfgCols } from "@/views/config-manage/module-cfg/config"; import { getFieldTypeSelect, + getFieldNumSelect, getFieldList, // deleteField, saveField, @@ -117,6 +130,7 @@ const listLoading = ref(false); const fieldName = ref(""); const dataList = ref([]); const fieldTypeSel = ref([]); +const fieldNumTypeSel = ref([]); const pageState = reactive({ page: 1, perPage: 20, @@ -135,15 +149,23 @@ watch( onMounted(() => { toGetFieldTypes(); + toGetFieldNumSelect(); }); -// 字段类型下拉 +// 字段搜索类型下拉 const toGetFieldTypes = () => { getFieldTypeSelect().then((res) => { fieldTypeSel.value = res.data; }); }; +// 字段类型下拉 +const toGetFieldNumSelect = () => { + getFieldNumSelect().then((res) => { + fieldNumTypeSel.value = res.data; + }) +}; + // 字段列表 const toGetList = () => { listLoading.value = true; @@ -172,6 +194,7 @@ const addField = () => { field_id: new Date().getTime() + "", field_title: undefined, field_name: undefined, + field_numerical_type_id: undefined, is_search: 0, field_type_id: undefined, belong_to_table: undefined, @@ -203,6 +226,7 @@ const handleSave = (record) => { field_id: record.field_id, field_title: record.field_title, field_name: record.field_name, + field_numerical_type_id: record.field_numerical_type_id, is_search: record.is_search, field_type_id: record.field_type_id, belong_to_table: record.belong_to_table, diff --git a/src/views/config-manage/module-cfg/config.ts b/src/views/config-manage/module-cfg/config.ts index cbe882f..d05f3b6 100644 --- a/src/views/config-manage/module-cfg/config.ts +++ b/src/views/config-manage/module-cfg/config.ts @@ -11,7 +11,8 @@ export const moduleCfgCols = [ export const viewCfgCols = [ { dataIndex: 'field_name', title: '字段名称', align: 'center'}, { dataIndex: 'field_title', title: '字段标题', align: 'center'}, - { dataIndex: 'field_type_name', title: '字段类型', align: 'center'}, + { dataIndex: 'field_numerical_name', title: '字段类型', align: 'center'}, + { dataIndex: 'field_type_name', title: '搜索类型', align: 'center'}, { dataIndex: 'is_search', title: '是否可搜索', align: 'center'}, { dataIndex: 'sort', title: '排序', align: 'center'}, { dataIndex: 'belong_to_table', title: '所属表名称', align: 'center'}, diff --git a/src/views/config-manage/module-cfg/service.js b/src/views/config-manage/module-cfg/service.js index 29272be..e2a57be 100644 --- a/src/views/config-manage/module-cfg/service.js +++ b/src/views/config-manage/module-cfg/service.js @@ -64,13 +64,20 @@ export function getDbTableSelect({ projectId }) { }); } -// 字段类型下拉 +// 字段搜索类型下拉 export function getFieldTypeSelect() { return get({ url: `/api/v1/field/get-field-type-drop`, }); } +// 字段类型下拉 +export function getFieldNumSelect() { + return get({ + url: `/api/v1/field/get-field-numerical-type-drop`, + }) +} + // 获取字段列表 export function getFieldList({ modularId, fieldName, page, perPage }) { return get({ diff --git a/src/views/view-all-manage/view-list/index.vue b/src/views/view-all-manage/view-list/index.vue index bf6103c..d6ac8ed 100644 --- a/src/views/view-all-manage/view-list/index.vue +++ b/src/views/view-all-manage/view-list/index.vue @@ -111,6 +111,11 @@ const selectedRowId = ref(); const selectViewInfo = ref({ type: "", filter: [], + config: { + line: { + data: [] + } + } }); const pageState = reactive({ @@ -146,6 +151,9 @@ const toGetViewInfo = (params = {}) => { ...params, }).then((res) => { selectViewInfo.value = res.data; + delete selectViewInfo.value.config.line.isGroup + delete selectViewInfo.value.config.line.label + selectViewInfo.value.config.line.data = res.data.config.line.data }); };