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']
|
||||
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
|
||||
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']
|
||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
||||
@ -17,16 +19,21 @@ declare module 'vue' {
|
||||
AForm: typeof import('ant-design-vue/es')['Form']
|
||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||
AInput: typeof import('ant-design-vue/es')['Input']
|
||||
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
||||
AMenu: typeof import('ant-design-vue/es')['Menu']
|
||||
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||
APagination: typeof import('ant-design-vue/es')['Pagination']
|
||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||
ARadio: typeof import('ant-design-vue/es')['Radio']
|
||||
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||
ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
|
||||
ARow: typeof import('ant-design-vue/es')['Row']
|
||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||
ATable: typeof import('ant-design-vue/es')['Table']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
|
@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { watch } from "vue";
|
||||
|
||||
import { Line } from "@antv/g2plot";
|
||||
// hooks
|
||||
import useChart from "./useChart";
|
||||
@ -22,8 +22,6 @@ const props = defineProps({
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
watch(() => props.config, (newVal) => {
|
||||
console.log('newVal', newVal)
|
||||
})
|
||||
|
||||
const { container } = useChart(Line, props);
|
||||
</script>
|
||||
|
@ -104,7 +104,7 @@ const routeList: RouteType[] = [
|
||||
name: "page-info",
|
||||
component: () =>
|
||||
import("@/views/page-show-info/page-info/index,.vue"),
|
||||
meta: { title: "页面展示" },
|
||||
meta: { title: "项目报表" },
|
||||
isMenu: true,
|
||||
children: [],
|
||||
},
|
||||
|
@ -56,19 +56,12 @@
|
||||
/>
|
||||
</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-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { getDbTableSelect } from "@/views/config-manage/module-cfg/service";
|
||||
|
||||
const props = defineProps({
|
||||
@ -124,6 +117,7 @@ watch(
|
||||
project_id: newVal.project_id,
|
||||
modular_name: newVal.modular_name,
|
||||
is_show: newVal.is_show,
|
||||
original_type: newVal.original_type,
|
||||
// show_type_id: newVal.show_type_id,
|
||||
original_sql: newVal.original_sql,
|
||||
table: newVal.table,
|
||||
|
@ -84,7 +84,6 @@
|
||||
:title="item.data.preview_name"
|
||||
@toFilt="
|
||||
(params?:object) => {
|
||||
console.log('xxxx',params)
|
||||
handleSingle(ids[index], params,);
|
||||
}
|
||||
"
|
||||
@ -121,7 +120,6 @@ import { searchInfo } from "@/api/preview/index";
|
||||
import { getProjectDrop } from "@/api/common";
|
||||
import { getPageInfo } from "./service";
|
||||
import type { SelectProps } from "ant-design-vue";
|
||||
import { Item } from "ant-design-vue/es/menu";
|
||||
|
||||
interface ItemDetail {
|
||||
id: number | string;
|
||||
@ -230,23 +228,7 @@ const getSinglePreview = (data: {
|
||||
searchInfo(params)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
const 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;
|
||||
}
|
||||
info.data = res.data;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -48,7 +48,7 @@
|
||||
<a-button
|
||||
class="preview-btn"
|
||||
:loading="previewLoading"
|
||||
@click="toPreview"
|
||||
@click="() => {toPreview({})}"
|
||||
>预览</a-button
|
||||
>
|
||||
<a-button type="primary" @click="addViewName">点击保存</a-button>
|
||||
@ -83,7 +83,7 @@
|
||||
v-model:value="previewData.filterData[item.name]"
|
||||
@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 class="y-table-content">
|
||||
@ -102,11 +102,11 @@
|
||||
:hide-on-single-page="false"
|
||||
size="small"
|
||||
class="pagination-box"
|
||||
@change="toPreview"
|
||||
@change="() => { toPreview({}) }"
|
||||
/>
|
||||
</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><BarChartOutlined /></div>
|
||||
<div>预览区</div>
|
||||
@ -209,17 +209,16 @@ const toGetFieldOpts = () => {
|
||||
};
|
||||
|
||||
const onProjectChange = (val) => {
|
||||
// 重置数据
|
||||
const target = projectSel.value.find((item) => item.value === val);
|
||||
modularSel.value = target.child;
|
||||
modularId.value = undefined;
|
||||
fieldList.value = [];
|
||||
fieldIds.value = [];
|
||||
resetSelectData();
|
||||
resetPreviewData();
|
||||
};
|
||||
|
||||
const onModularChange = (val) => {
|
||||
// const target = modularSel.value.find((item) => item.value === val);
|
||||
// fieldList.value = target.child;
|
||||
const onModularChange = () => {
|
||||
resetSelectData();
|
||||
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 = () => {
|
||||
previewData.type = "";
|
||||
previewData.filterConfig = [];
|
||||
previewData.columnConfig = [];
|
||||
previewData.dataList = [];
|
||||
previewData.filterData = {};
|
||||
previewData.config = {};
|
||||
previewData.page = 1;
|
||||
previewData.perPage = 20;
|
||||
previewData.total = 0;
|
||||
};
|
||||
|
||||
// 请求预览数据
|
||||
const toPreview = ({filter}) => {
|
||||
previewLoading.value = true;
|
||||
let filterData
|
||||
if (!filter) {
|
||||
|
||||
filterData = previewData.filterConfig
|
||||
.filter((item) => {
|
||||
return previewData.filterData[item.name] !== undefined;
|
||||
})
|
||||
.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,
|
||||
type: item.type,
|
||||
value: previewData.filterData[item.name],
|
||||
};
|
||||
}
|
||||
});
|
||||
} else {
|
||||
filterData = filter;
|
||||
}
|
||||
console.log('filterData',filterData)
|
||||
|
||||
preview({
|
||||
modularId: modularId.value,
|
||||
@ -325,7 +341,7 @@ const toSaveView = () => {
|
||||
|
||||
const toFilt = () => {
|
||||
previewData.page = 1;
|
||||
toPreview();
|
||||
toPreview({});
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -389,6 +405,9 @@ const toFilt = () => {
|
||||
.input-item {
|
||||
width: 180px;
|
||||
}
|
||||
.date-item {
|
||||
width: 240px;
|
||||
}
|
||||
.y-table-content {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
@ -151,9 +151,6 @@ 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
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user