Bladeren bron

修改客户资料

huangbin 4 jaren geleden
bovenliggende
commit
935b390c32

+ 2 - 2
src/goServiceAPI/ermcp/customInfo/index.ts

@@ -3,7 +3,7 @@
 import { commonSearch_go } from '@/goServiceAPI/index';
 import APP from '@/services';
 import * as type from './interface';
-import { QueryCustomInfoType } from './type';
+import { QueryCustomInfoEnum } from './type';
 
 /**
  * 查询客户资料
@@ -11,7 +11,7 @@ import { QueryCustomInfoType } from './type';
  * @param queryType 查询类型(1:未提交 2:待审核 3:正常 4:停用)
  * @returns 
  */
-export function QueryCustomInfo(queryType: QueryCustomInfoType): Promise<type.QueryCustomInfoType[]> {
+export function QueryCustomInfo(queryType: QueryCustomInfoEnum): Promise<type.QueryCustomInfoType[]> {
     const MemberUserID = APP.get('userAccount').memberuserid;
     return commonSearch_go('/Ermcp/QueryUserInfo', { MemberUserID, queryType })
         .catch(err => {

+ 1 - 1
src/goServiceAPI/ermcp/customInfo/type.ts

@@ -1 +1 @@
-export type QueryCustomInfoType = 1 | 2 | 3 | 4;
+export type QueryCustomInfoEnum = 1 | 2 | 3 | 4;

+ 2 - 78
src/views/information/custom/list/normal-use/index.vue

@@ -23,87 +23,11 @@
 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';
 import { MenuItem } from '@/components/contextMenu/interface';
 import contextMenu from '@/components/contextMenu/index.vue';
-
-// 查询客户资料列表
-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 { getCustomList } from '../setup';
 
 // 处理新增资料
 
@@ -130,7 +54,7 @@ export default defineComponent({
             },
         ]);
         initData(() => {
-            actionQuery();
+            actionQuery(3);
             getColumns();
             // 加载数据在这里
         });

+ 79 - 0
src/views/information/custom/list/setup.ts

@@ -0,0 +1,79 @@
+import { QueryCustomInfo } from '@/goServiceAPI/ermcp/customInfo';
+import { QueryCustomInfoType } from '@/goServiceAPI/ermcp/customInfo/interface';
+import { QueryCustomInfoEnum } from '@/goServiceAPI/ermcp/customInfo/type';
+import { ColumnType, getTableHead } from '@/services/bus/table';
+import { message } from 'ant-design-vue';
+import { ref } from 'vue';
+import { useRouter } from 'vue-router';
+// 查询客户资料列表
+export 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(type: QueryCustomInfoEnum) {
+        loading.value = true;
+        QueryCustomInfo(type)
+            .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 };
+}

+ 21 - 82
src/views/information/custom/list/stop-use/index.vue

@@ -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>