|
@@ -1,83 +1,130 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <!-- 客户信息: 停用 -->
|
|
|
|
|
- <div class="custom-stop">
|
|
|
|
|
- 客户信息: 停用
|
|
|
|
|
|
|
+ <!-- 客户信息: 正常 -->
|
|
|
|
|
+ <div class="custom-normal"
|
|
|
|
|
+ :loading="loading">
|
|
|
|
|
+ <filterCustomTable @add="add"
|
|
|
|
|
+ @search="search" />
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <a-table :columns="columns"
|
|
|
|
|
+ :pagination="false"
|
|
|
|
|
+ rowKey="key"
|
|
|
|
|
+ :data-source="customList">
|
|
|
|
|
+ <template #userinfotype="{ text }">
|
|
|
|
|
+ <a>{{ text === '2' ? '企业' : '个人'}}</a>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </a-table>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
-import { defineComponent, ref } from 'vue';
|
|
|
|
|
|
|
+import { defineComponent, Ref, ref } from 'vue';
|
|
|
|
|
+
|
|
|
|
|
+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 { getTableHead, ColumnType } from '@/services/bus/table';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
-import { initData } from '@/setup/methods/index';
|
|
|
|
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
|
|
|
|
|
// 查询客户资料列表
|
|
// 查询客户资料列表
|
|
|
function getCustomList() {
|
|
function getCustomList() {
|
|
|
- // const filteredInfo = ref();
|
|
|
|
|
- // const sortedInfo = ref();
|
|
|
|
|
- // const columns = computed(() => {
|
|
|
|
|
- // const filtered = filteredInfo.value || {};
|
|
|
|
|
- // const sorted = sortedInfo.value || {};
|
|
|
|
|
- // return [
|
|
|
|
|
- // {
|
|
|
|
|
- // title: '序号',
|
|
|
|
|
- // dataIndex: 'index',
|
|
|
|
|
- // key: 'index',
|
|
|
|
|
- // align: 'center',
|
|
|
|
|
- // width: 50,
|
|
|
|
|
- // customRender: (param: any) => `${param.index + 1}`,
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // title: 'Age',
|
|
|
|
|
- // dataIndex: 'age',
|
|
|
|
|
- // key: 'age',
|
|
|
|
|
- // sorter: (a: DataItem, b: DataItem) => a.age - b.age,
|
|
|
|
|
- // sortOrder: sorted.columnKey === 'age' && sorted.order,
|
|
|
|
|
- // },
|
|
|
|
|
- // {
|
|
|
|
|
- // title: 'Address',
|
|
|
|
|
- // dataIndex: 'address',
|
|
|
|
|
- // key: 'address',
|
|
|
|
|
- // filters: [
|
|
|
|
|
- // { text: 'London', value: 'London' },
|
|
|
|
|
- // { text: 'New York', value: 'New York' },
|
|
|
|
|
- // ],
|
|
|
|
|
- // filteredValue: filtered.address || null,
|
|
|
|
|
- // onFilter: (value: string, record: DataItem) => record.address.includes(value),
|
|
|
|
|
- // sorter: (a: DataItem, b: DataItem) => a.address.length - b.address.length,
|
|
|
|
|
- // sortOrder: sorted.columnKey === 'address' && sorted.order,
|
|
|
|
|
- // ellipsis: true,
|
|
|
|
|
- // },
|
|
|
|
|
- // ];
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ const router = useRouter();
|
|
|
|
|
+ const pathArr = router.currentRoute.value.fullPath.split('/');
|
|
|
|
|
+ console.log('pathArr', pathArr);
|
|
|
|
|
+
|
|
|
|
|
+ // 表格数据
|
|
|
const customList = ref<QueryCustomInfoType[]>([]);
|
|
const customList = ref<QueryCustomInfoType[]>([]);
|
|
|
|
|
+ // 表头数据
|
|
|
|
|
+ const columns = ref<ColumnType[]>([]);
|
|
|
|
|
+ // 过滤项
|
|
|
|
|
+ const filteredInfo = ref();
|
|
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
|
|
+ // 获取表头
|
|
|
|
|
+ function getColumns() {
|
|
|
|
|
+ const list = getTableHead('table_pcweb_userinfo');
|
|
|
|
|
+ const filtered = filteredInfo.value || {};
|
|
|
|
|
+ columns.value.length = 0;
|
|
|
|
|
+ list.forEach((e, i) => {
|
|
|
|
|
+ const { columnfield, columntitle, aligntype } = e;
|
|
|
|
|
+ const item: ColumnType = {
|
|
|
|
|
+ key: String(i),
|
|
|
|
|
+ dataIndex: columnfield, // 表格数据对应的key
|
|
|
|
|
+ title: columntitle,
|
|
|
|
|
+ align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
|
|
|
|
|
+ slots: { customRender: columnfield },
|
|
|
|
|
+ };
|
|
|
|
|
+ // 以下添加过滤数据对应的方法
|
|
|
|
|
+ if (e.columntitle === '客户类型') {
|
|
|
|
|
+ item.onFilter = (value: string, record: QueryCustomInfoType) => record.userinfotype.includes(String(value));
|
|
|
|
|
+ item.filteredValue = filtered.userinfotype || null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (e.columntitle === '客户简称') {
|
|
|
|
|
+ item.onFilter = (value: string, record: QueryCustomInfoType) => record.nickname.includes(value);
|
|
|
|
|
+ item.filteredValue = filtered.nickname || null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (e.columntitle === '客户名称') {
|
|
|
|
|
+ item.onFilter = (value: string, record: QueryCustomInfoType) => record.contactname.includes(value);
|
|
|
|
|
+ item.filteredValue = filtered.contactname || null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (e.columntitle === '手机号码') {
|
|
|
|
|
+ item.onFilter = (value: string, record: QueryCustomInfoType) => record.mobile.includes(value);
|
|
|
|
|
+ item.filteredValue = filtered.mobile || null;
|
|
|
|
|
+ }
|
|
|
|
|
+ columns.value.push(item);
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log('columns', columns);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询列表
|
|
|
function actionQuery() {
|
|
function actionQuery() {
|
|
|
- QueryCustomInfo(4)
|
|
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ QueryCustomInfo(3)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
- console.log('L', res);
|
|
|
|
|
|
|
+ customList.value = res.map((e, i) => {
|
|
|
|
|
+ return { ...e, key: String(i) };
|
|
|
|
|
+ });
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ console.log('查询列表', customList);
|
|
|
})
|
|
})
|
|
|
- .catch((err) => message.error(err));
|
|
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ message.error(err);
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询
|
|
|
|
|
+ function search(value: any) {
|
|
|
|
|
+ filteredInfo.value = value;
|
|
|
|
|
+ getColumns();
|
|
|
|
|
+ console.log('search', value);
|
|
|
}
|
|
}
|
|
|
|
|
+ return { customList, actionQuery, columns, filteredInfo, getColumns, search, loading };
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- return { customList, actionQuery };
|
|
|
|
|
|
|
+// 处理新增资料
|
|
|
|
|
+
|
|
|
|
|
+function add() {
|
|
|
|
|
+ console.log('add');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
- name: 'custom-stop',
|
|
|
|
|
- components: {},
|
|
|
|
|
|
|
+ name: 'custom-normal',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ filterCustomTable,
|
|
|
|
|
+ },
|
|
|
setup() {
|
|
setup() {
|
|
|
- const { customList, actionQuery } = getCustomList();
|
|
|
|
|
|
|
+ const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
|
|
|
initData(() => {
|
|
initData(() => {
|
|
|
actionQuery();
|
|
actionQuery();
|
|
|
|
|
+ getColumns();
|
|
|
// 加载数据在这里
|
|
// 加载数据在这里
|
|
|
});
|
|
});
|
|
|
- return { customList };
|
|
|
|
|
|
|
+ return { customList, columns, search, loading, add };
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
|
-.custom-stop {
|
|
|
|
|
|
|
+.custom-normal {
|
|
|
}
|
|
}
|
|
|
</style>;
|
|
</style>;
|