fix: 修复数据来源操作bug
This commit is contained in:
parent
0dfdb11c58
commit
7b15075276
7
components.d.ts
vendored
7
components.d.ts
vendored
@ -10,6 +10,8 @@ declare module 'vue' {
|
|||||||
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
|
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
|
||||||
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
|
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
|
||||||
AButton: typeof import('ant-design-vue/es')['Button']
|
AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
|
ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
|
||||||
|
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
|
||||||
ACol: typeof import('ant-design-vue/es')['Col']
|
ACol: typeof import('ant-design-vue/es')['Col']
|
||||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||||
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
||||||
@ -17,16 +19,21 @@ declare module 'vue' {
|
|||||||
AForm: typeof import('ant-design-vue/es')['Form']
|
AForm: typeof import('ant-design-vue/es')['Form']
|
||||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||||
AInput: typeof import('ant-design-vue/es')['Input']
|
AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
|
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
||||||
AMenu: typeof import('ant-design-vue/es')['Menu']
|
AMenu: typeof import('ant-design-vue/es')['Menu']
|
||||||
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||||
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
APagination: typeof import('ant-design-vue/es')['Pagination']
|
APagination: typeof import('ant-design-vue/es')['Pagination']
|
||||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||||
|
ARadio: typeof import('ant-design-vue/es')['Radio']
|
||||||
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
|
ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
|
||||||
ARow: typeof import('ant-design-vue/es')['Row']
|
ARow: typeof import('ant-design-vue/es')['Row']
|
||||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
|
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||||
|
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||||
ATable: typeof import('ant-design-vue/es')['Table']
|
ATable: typeof import('ant-design-vue/es')['Table']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { watch } from "vue";
|
|
||||||
import { Line } from "@antv/g2plot";
|
import { Line } from "@antv/g2plot";
|
||||||
// hooks
|
// hooks
|
||||||
import useChart from "./useChart";
|
import useChart from "./useChart";
|
||||||
@ -22,8 +22,6 @@ const props = defineProps({
|
|||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
watch(() => props.config, (newVal) => {
|
|
||||||
console.log('newVal', newVal)
|
|
||||||
})
|
|
||||||
const { container } = useChart(Line, props);
|
const { container } = useChart(Line, props);
|
||||||
</script>
|
</script>
|
||||||
|
@ -104,7 +104,7 @@ const routeList: RouteType[] = [
|
|||||||
name: "page-info",
|
name: "page-info",
|
||||||
component: () =>
|
component: () =>
|
||||||
import("@/views/page-show-info/page-info/index,.vue"),
|
import("@/views/page-show-info/page-info/index,.vue"),
|
||||||
meta: { title: "页面展示" },
|
meta: { title: "项目报表" },
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
@ -56,19 +56,12 @@
|
|||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<!-- <a-form-item label="展示类型" name="show_type_id">
|
|
||||||
<a-select
|
|
||||||
placeholder="请选择展示类型"
|
|
||||||
v-model:value="formData.show_type_id"
|
|
||||||
:options="showTypes"
|
|
||||||
/>
|
|
||||||
</a-form-item> -->
|
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { getDbTableSelect } from "@/views/config-manage/module-cfg/service";
|
import { getDbTableSelect } from "@/views/config-manage/module-cfg/service";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -124,6 +117,7 @@ watch(
|
|||||||
project_id: newVal.project_id,
|
project_id: newVal.project_id,
|
||||||
modular_name: newVal.modular_name,
|
modular_name: newVal.modular_name,
|
||||||
is_show: newVal.is_show,
|
is_show: newVal.is_show,
|
||||||
|
original_type: newVal.original_type,
|
||||||
// show_type_id: newVal.show_type_id,
|
// show_type_id: newVal.show_type_id,
|
||||||
original_sql: newVal.original_sql,
|
original_sql: newVal.original_sql,
|
||||||
table: newVal.table,
|
table: newVal.table,
|
||||||
|
@ -84,7 +84,6 @@
|
|||||||
:title="item.data.preview_name"
|
:title="item.data.preview_name"
|
||||||
@toFilt="
|
@toFilt="
|
||||||
(params?:object) => {
|
(params?:object) => {
|
||||||
console.log('xxxx',params)
|
|
||||||
handleSingle(ids[index], params,);
|
handleSingle(ids[index], params,);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@ -121,7 +120,6 @@ import { searchInfo } from "@/api/preview/index";
|
|||||||
import { getProjectDrop } from "@/api/common";
|
import { getProjectDrop } from "@/api/common";
|
||||||
import { getPageInfo } from "./service";
|
import { getPageInfo } from "./service";
|
||||||
import type { SelectProps } from "ant-design-vue";
|
import type { SelectProps } from "ant-design-vue";
|
||||||
import { Item } from "ant-design-vue/es/menu";
|
|
||||||
|
|
||||||
interface ItemDetail {
|
interface ItemDetail {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
@ -230,23 +228,7 @@ const getSinglePreview = (data: {
|
|||||||
searchInfo(params)
|
searchInfo(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const data = res.data;
|
info.data = res.data;
|
||||||
if (type === SEARCH_TYPE.SEARCH) {
|
|
||||||
// 只更新数据
|
|
||||||
switch (data.type) {
|
|
||||||
case VIEW_TYPE.TABLE:
|
|
||||||
info.data.data = data.data;
|
|
||||||
info.data.count = data.count;
|
|
||||||
break;
|
|
||||||
case VIEW_TYPE:
|
|
||||||
info.data.config = data.config;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
info.data = res.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<a-button
|
<a-button
|
||||||
class="preview-btn"
|
class="preview-btn"
|
||||||
:loading="previewLoading"
|
:loading="previewLoading"
|
||||||
@click="toPreview"
|
@click="() => {toPreview({})}"
|
||||||
>预览</a-button
|
>预览</a-button
|
||||||
>
|
>
|
||||||
<a-button type="primary" @click="addViewName">点击保存</a-button>
|
<a-button type="primary" @click="addViewName">点击保存</a-button>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
v-model:value="previewData.filterData[item.name]"
|
v-model:value="previewData.filterData[item.name]"
|
||||||
@change="toFilt"
|
@change="toFilt"
|
||||||
/>
|
/>
|
||||||
<a-range-picker v-if="item.type === 'date'" class="input-item" v-model:value="previewData.filterData[item.name]" @change="toFilt" />
|
<a-range-picker v-if="item.type === 'time'" class="date-item" v-model:value="previewData.filterData[item.name]" @change="toFilt" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="y-table-content">
|
<div class="y-table-content">
|
||||||
@ -102,11 +102,11 @@
|
|||||||
:hide-on-single-page="false"
|
:hide-on-single-page="false"
|
||||||
size="small"
|
size="small"
|
||||||
class="pagination-box"
|
class="pagination-box"
|
||||||
@change="toPreview"
|
@change="() => { toPreview({}) }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<y-chart v-else-if="previewData.type === 'chart'" :chart-cfg="previewData.chartCfg" :filter-config="previewData.filter" @toFilt="toPreview"></y-chart>
|
<y-chart v-else-if="previewData.type === 'chart'" :chart-cfg="previewData.chartCfg" :filter-config="previewData.filter" @toFilt="() => {toPreview({})}"></y-chart>
|
||||||
<div class="preview-area" v-else>
|
<div class="preview-area" v-else>
|
||||||
<div><BarChartOutlined /></div>
|
<div><BarChartOutlined /></div>
|
||||||
<div>预览区</div>
|
<div>预览区</div>
|
||||||
@ -209,17 +209,16 @@ const toGetFieldOpts = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onProjectChange = (val) => {
|
const onProjectChange = (val) => {
|
||||||
|
// 重置数据
|
||||||
const target = projectSel.value.find((item) => item.value === val);
|
const target = projectSel.value.find((item) => item.value === val);
|
||||||
modularSel.value = target.child;
|
modularSel.value = target.child;
|
||||||
modularId.value = undefined;
|
modularId.value = undefined;
|
||||||
fieldList.value = [];
|
resetSelectData();
|
||||||
fieldIds.value = [];
|
|
||||||
resetPreviewData();
|
resetPreviewData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onModularChange = (val) => {
|
const onModularChange = () => {
|
||||||
// const target = modularSel.value.find((item) => item.value === val);
|
resetSelectData();
|
||||||
// fieldList.value = target.child;
|
|
||||||
resetPreviewData();
|
resetPreviewData();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -236,37 +235,54 @@ const tranformList = (list) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置配置数据
|
||||||
|
const resetSelectData = () => {
|
||||||
|
showTypeId.value = undefined
|
||||||
|
fieldList.value = [];
|
||||||
|
fieldIds.value = [];
|
||||||
|
xDataList.value = [];
|
||||||
|
yDataList.value = [];
|
||||||
|
xDataId.value = undefined;
|
||||||
|
yDataId.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置预览数据
|
||||||
const resetPreviewData = () => {
|
const resetPreviewData = () => {
|
||||||
previewData.type = "";
|
previewData.type = "";
|
||||||
previewData.filterConfig = [];
|
previewData.filterConfig = [];
|
||||||
previewData.columnConfig = [];
|
previewData.columnConfig = [];
|
||||||
previewData.dataList = [];
|
previewData.dataList = [];
|
||||||
previewData.filterData = {};
|
previewData.filterData = {};
|
||||||
|
previewData.config = {};
|
||||||
previewData.page = 1;
|
previewData.page = 1;
|
||||||
previewData.perPage = 20;
|
previewData.perPage = 20;
|
||||||
previewData.total = 0;
|
previewData.total = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 请求预览数据
|
||||||
const toPreview = ({filter}) => {
|
const toPreview = ({filter}) => {
|
||||||
previewLoading.value = true;
|
previewLoading.value = true;
|
||||||
let filterData
|
let filterData
|
||||||
if (!filter) {
|
if (!filter) {
|
||||||
|
|
||||||
filterData = previewData.filterConfig
|
filterData = previewData.filterConfig
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
return previewData.filterData[item.name] !== undefined;
|
return previewData.filterData[item.name] !== undefined;
|
||||||
})
|
})
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
return {
|
return item.type === 'time' ? {
|
||||||
|
name: item.name,
|
||||||
|
type: item.type,
|
||||||
|
start_time: previewData.filterData[item.name][0].format('YYYY-MM-DD'),
|
||||||
|
end_time: previewData.filterData[item.name][1].format('YYYY-MM-DD'),
|
||||||
|
} : {
|
||||||
name: item.name,
|
name: item.name,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
value: previewData.filterData[item.name],
|
value: previewData.filterData[item.name],
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
filterData = filter;
|
filterData = filter;
|
||||||
}
|
}
|
||||||
console.log('filterData',filterData)
|
|
||||||
|
|
||||||
preview({
|
preview({
|
||||||
modularId: modularId.value,
|
modularId: modularId.value,
|
||||||
@ -325,7 +341,7 @@ const toSaveView = () => {
|
|||||||
|
|
||||||
const toFilt = () => {
|
const toFilt = () => {
|
||||||
previewData.page = 1;
|
previewData.page = 1;
|
||||||
toPreview();
|
toPreview({});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -389,6 +405,9 @@ const toFilt = () => {
|
|||||||
.input-item {
|
.input-item {
|
||||||
width: 180px;
|
width: 180px;
|
||||||
}
|
}
|
||||||
|
.date-item {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
.y-table-content {
|
.y-table-content {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
@ -151,9 +151,6 @@ const toGetViewInfo = (params = {}) => {
|
|||||||
...params,
|
...params,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
selectViewInfo.value = res.data;
|
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
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user