|
@@ -1,61 +1,55 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 客户信息: 正常 -->
|
|
<!-- 客户信息: 正常 -->
|
|
|
- <div class="custom-normal">
|
|
|
|
|
|
|
+ <div class="custom-normal"
|
|
|
|
|
+ :loading="loading">
|
|
|
<filterCustomTable @add="add"
|
|
<filterCustomTable @add="add"
|
|
|
@search="search" />
|
|
@search="search" />
|
|
|
<a-table :columns="columns"
|
|
<a-table :columns="columns"
|
|
|
:pagination="false"
|
|
:pagination="false"
|
|
|
rowKey="key"
|
|
rowKey="key"
|
|
|
- :data-source="customList" />
|
|
|
|
|
|
|
+ :data-source="customList">
|
|
|
|
|
+ <template #userinfotype="{ text }">
|
|
|
|
|
+ <a>{{ text === '2' ? '企业' : '个人'}}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
-import { computed, defineComponent, ref } from 'vue';
|
|
|
|
|
|
|
+import { defineComponent, Ref, ref } from 'vue';
|
|
|
|
|
|
|
|
import { initData } from '@/setup/methods/index';
|
|
import { initData } from '@/setup/methods/index';
|
|
|
import { QueryCustomInfo } from '@/goServiceAPI/ermcp/customInfo/index';
|
|
import { QueryCustomInfo } from '@/goServiceAPI/ermcp/customInfo/index';
|
|
|
import { QueryCustomInfoType } from '@/goServiceAPI/ermcp/customInfo/interface';
|
|
import { QueryCustomInfoType } from '@/goServiceAPI/ermcp/customInfo/interface';
|
|
|
import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
|
|
import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
|
|
|
-import { getTableHead } from '@/services/bus/table';
|
|
|
|
|
|
|
+import { getTableHead, ColumnType } from '@/services/bus/table';
|
|
|
import { TableState, TableStateFilters } from 'ant-design-vue/es/table/interface';
|
|
import { TableState, TableStateFilters } from 'ant-design-vue/es/table/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
|
|
|
// 查询客户资料列表
|
|
// 查询客户资料列表
|
|
|
function getCustomList() {
|
|
function getCustomList() {
|
|
|
- interface ColumnType {
|
|
|
|
|
- key: string;
|
|
|
|
|
- dataIndex: string;
|
|
|
|
|
- title: string;
|
|
|
|
|
- onFilter?: Function;
|
|
|
|
|
- sorter?: Function;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 表格数据
|
|
|
const customList = ref<QueryCustomInfoType[]>([]);
|
|
const customList = ref<QueryCustomInfoType[]>([]);
|
|
|
|
|
+ // 表头数据
|
|
|
const columns = ref<ColumnType[]>([]);
|
|
const columns = ref<ColumnType[]>([]);
|
|
|
|
|
+ // 过滤项
|
|
|
const filteredInfo = ref();
|
|
const filteredInfo = ref();
|
|
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
// 获取表头
|
|
// 获取表头
|
|
|
function getColumns() {
|
|
function getColumns() {
|
|
|
- interface ColumnType {
|
|
|
|
|
- key: string;
|
|
|
|
|
- dataIndex: string;
|
|
|
|
|
- title: string;
|
|
|
|
|
- filteredValue?: string | null;
|
|
|
|
|
- onFilter?: Function;
|
|
|
|
|
- sorter?: Function;
|
|
|
|
|
- }
|
|
|
|
|
const list = getTableHead('table_pcweb_userinfo');
|
|
const list = getTableHead('table_pcweb_userinfo');
|
|
|
- console.log('list', list);
|
|
|
|
|
-
|
|
|
|
|
const filtered = filteredInfo.value || {};
|
|
const filtered = filteredInfo.value || {};
|
|
|
columns.value.length = 0;
|
|
columns.value.length = 0;
|
|
|
list.forEach((e, i) => {
|
|
list.forEach((e, i) => {
|
|
|
- const { columnfield, columntitle } = e;
|
|
|
|
|
|
|
+ const { columnfield, columntitle, aligntype } = e;
|
|
|
const item: ColumnType = {
|
|
const item: ColumnType = {
|
|
|
key: String(i),
|
|
key: String(i),
|
|
|
- dataIndex: columnfield,
|
|
|
|
|
|
|
+ dataIndex: columnfield, // 表格数据对应的key
|
|
|
title: columntitle,
|
|
title: columntitle,
|
|
|
|
|
+ align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
|
|
|
|
|
+ slots: { customRender: columnfield },
|
|
|
};
|
|
};
|
|
|
|
|
+ // 以下添加过滤数据对应的方法
|
|
|
if (e.columntitle === '客户类型') {
|
|
if (e.columntitle === '客户类型') {
|
|
|
item.onFilter = (value: string, record: QueryCustomInfoType) => record.userinfotype.includes(String(value));
|
|
item.onFilter = (value: string, record: QueryCustomInfoType) => record.userinfotype.includes(String(value));
|
|
|
item.filteredValue = filtered.userinfotype || null;
|
|
item.filteredValue = filtered.userinfotype || null;
|
|
@@ -83,14 +77,19 @@ function getCustomList() {
|
|
|
}
|
|
}
|
|
|
// 查询列表
|
|
// 查询列表
|
|
|
function actionQuery() {
|
|
function actionQuery() {
|
|
|
|
|
+ loading.value = true;
|
|
|
QueryCustomInfo(3)
|
|
QueryCustomInfo(3)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
customList.value = res.map((e, i) => {
|
|
customList.value = res.map((e, i) => {
|
|
|
return { ...e, key: String(i) };
|
|
return { ...e, key: String(i) };
|
|
|
});
|
|
});
|
|
|
|
|
+ loading.value = false;
|
|
|
console.log('查询列表', customList);
|
|
console.log('查询列表', customList);
|
|
|
})
|
|
})
|
|
|
- .catch((err) => message.error(err));
|
|
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ message.error(err);
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
// 查询
|
|
// 查询
|
|
|
function search(value: any) {
|
|
function search(value: any) {
|
|
@@ -98,7 +97,7 @@ function getCustomList() {
|
|
|
getColumns();
|
|
getColumns();
|
|
|
console.log('search', value);
|
|
console.log('search', value);
|
|
|
}
|
|
}
|
|
|
- return { customList, actionQuery, columns, filteredInfo, getColumns, search };
|
|
|
|
|
|
|
+ return { customList, actionQuery, columns, filteredInfo, getColumns, search, loading };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function add() {
|
|
function add() {
|
|
@@ -111,13 +110,13 @@ export default defineComponent({
|
|
|
filterCustomTable,
|
|
filterCustomTable,
|
|
|
},
|
|
},
|
|
|
setup() {
|
|
setup() {
|
|
|
- const { customList, actionQuery, columns, getColumns, search } = getCustomList();
|
|
|
|
|
|
|
+ const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
|
|
|
initData(() => {
|
|
initData(() => {
|
|
|
actionQuery();
|
|
actionQuery();
|
|
|
getColumns();
|
|
getColumns();
|
|
|
// 加载数据在这里
|
|
// 加载数据在这里
|
|
|
});
|
|
});
|
|
|
- return { customList, add, columns, search };
|
|
|
|
|
|
|
+ return { customList, add, columns, search, loading };
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|