|
|
@@ -4,8 +4,10 @@
|
|
|
:loading="loading">
|
|
|
<filterCustomTable @add="add"
|
|
|
@search="search" />
|
|
|
- <div>
|
|
|
+ <contextMenu :contextMenuList="contextMenuList"
|
|
|
+ :tableList="customList">
|
|
|
<a-table :columns="columns"
|
|
|
+ class="topTable"
|
|
|
:pagination="false"
|
|
|
rowKey="key"
|
|
|
:data-source="customList">
|
|
|
@@ -13,93 +15,19 @@
|
|
|
<a>{{ text === '2' ? '企业' : '个人'}}</a>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
- </div>
|
|
|
+ </contextMenu>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, Ref, ref } from 'vue';
|
|
|
+import { defineComponent, ref } from 'vue';
|
|
|
|
|
|
import { initData } from '@/setup/methods/index';
|
|
|
-import { QueryCustomInfo } from '@/goServiceAPI/ermcp/customInfo/index';
|
|
|
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 { useRouter } from 'vue-router';
|
|
|
-
|
|
|
-// 查询客户资料列表
|
|
|
-function getCustomList() {
|
|
|
- const router = useRouter();
|
|
|
- const pathArr = router.currentRoute.value.fullPath.split('/');
|
|
|
- console.log('pathArr', pathArr);
|
|
|
-
|
|
|
- // 表格数据
|
|
|
- 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() {
|
|
|
- loading.value = true;
|
|
|
- QueryCustomInfo(3)
|
|
|
- .then((res) => {
|
|
|
- customList.value = res.map((e, i) => {
|
|
|
- return { ...e, key: String(i) };
|
|
|
- });
|
|
|
- loading.value = false;
|
|
|
- console.log('查询列表', customList);
|
|
|
- })
|
|
|
- .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 };
|
|
|
-}
|
|
|
+import { MenuItem } from '@/components/contextMenu/interface';
|
|
|
+import contextMenu from '@/components/contextMenu/index.vue';
|
|
|
+import { getCustomList } from '../setup';
|
|
|
|
|
|
// 处理新增资料
|
|
|
|
|
|
@@ -111,15 +39,26 @@ export default defineComponent({
|
|
|
name: 'custom-normal',
|
|
|
components: {
|
|
|
filterCustomTable,
|
|
|
+ contextMenu,
|
|
|
},
|
|
|
setup() {
|
|
|
const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
|
|
|
+
|
|
|
+ const contextMenuList = ref<MenuItem[]>([
|
|
|
+ {
|
|
|
+ lable: '修改',
|
|
|
+ callback: (data: QueryCustomInfoType) => {
|
|
|
+ console.log('data', data);
|
|
|
+ console.log('lll');
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
initData(() => {
|
|
|
- actionQuery();
|
|
|
+ actionQuery(4);
|
|
|
getColumns();
|
|
|
// 加载数据在这里
|
|
|
});
|
|
|
- return { customList, columns, search, loading, add };
|
|
|
+ return { customList, columns, search, loading, add, contextMenuList };
|
|
|
},
|
|
|
});
|
|
|
</script>
|