浏览代码

修改客户资料和现货合同

huangbin 4 年之前
父节点
当前提交
13767c1fd4

+ 13 - 0
src/common/export/table.ts

@@ -0,0 +1,13 @@
+// 通用表格需要的导入的数据
+
+import BtnList from '@/common/components/buttonList/index.vue';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import { initData } from '@/common/methods';
+import { getBtnList, getTableColumns, getTableEvent } from '@/common/setup/table/index';
+import { defineComponent } from 'vue';
+
+export {
+    defineComponent, initData,
+    getTableColumns, getTableEvent, getBtnList,
+    contextMenu, BtnList,
+};

+ 72 - 0
src/common/setup/table/button.ts

@@ -0,0 +1,72 @@
+import { ModalName } from '@/common/constants/modalName';
+import { OperationTabMenu } from '@/services/go/commonService/interface';
+import { sessionStorageUtil } from "@/utils/storage";
+import { inject, onUnmounted, ref, Ref } from 'vue';
+import { openModal } from "../modal";
+import { BtnClassName, BtnList, ButtonListKey } from './interface';
+
+/**
+ * 获取class 名
+ * @param val 
+ * @returns 
+ */
+function getClassName(val: string): BtnClassName {
+    let result: BtnClassName = 'btnDeafault'
+    if (val.includes('disable') || val.includes('cancle') || val.includes('delete')) {
+        result = 'btnDanger'
+    } else if (val === '') {
+        result = 'btnDeafault'
+    } else if (val.includes('add')) {
+        result = 'operBtn'
+    } else {
+        result = 'btnPrimary'
+    }
+    return result
+}
+
+/**
+ * 获取表格操作按钮列表
+ * @param menuType 
+ * @param hasDetail 操作按钮是否需要详情按钮(详情按钮服务 不配置)
+ * @returns 
+ */
+export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
+    // 获取 数据
+    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
+    const name = 'permissionData'
+    // 存入sessionStorageUtil 是为了处理页面刷新的情况(这个时候重新从服务获取数据,但页面已经先加载了,vue 中的 依赖注入在异步中不能建立通信)
+    const data: OperationTabMenu[] = permissionData.value.length ? permissionData.value : sessionStorageUtil.getItem(name)
+    sessionStorageUtil.setItem(name, data)
+
+    const commonBtn = ref<BtnList[]>([]); // 通用按钮列表,不用选中数据才显示
+    const forDataBtn = ref<BtnList[]>([]); // 针对数据按钮列表,选中某条数据才显示
+
+    const list = data.find((e) => e.code === menuType);
+    if (list && list.children) {
+        list.children.forEach(e => {
+            const { code, type, title } = e;
+            if (type === 2) { // 按钮类型
+                const { openAction } = openModal(code as keyof ModalName);
+                const item = { lable: title, callback: openAction, className: getClassName(code) }
+                const commonName = ['新增'] // 目前通用的按钮只要新增,需要添加其它的时候需要往这里添加
+                if (commonName.includes(title)) { // 
+                    commonBtn.value.push(item)
+                } else {
+                    forDataBtn.value.push(item)
+                }
+            }
+        })
+    } else {
+        console.warn(`menuType: ${menuType}未找到`)
+    }
+    // 详情
+    if (hasDetail) {
+        const { openAction } = openModal('detail')
+        forDataBtn.value.push({ lable: '详情', callback: openAction, className: getClassName('') })
+    }
+
+    onUnmounted(() => {
+        sessionStorageUtil.removeItem(name)
+    });
+    return { commonBtn, forDataBtn }
+}

+ 49 - 0
src/common/setup/table/clolumn.ts

@@ -0,0 +1,49 @@
+import { ColumnType, getTableHead } from '@/common/methods/table';
+import { TableKey } from '@/common/methods/table/interface';
+import { ref } from "vue";
+
+/**
+ * 获取动态表头数据
+ * ant-design 表格数据的过滤功能与表头绑定在一起
+ */
+export function getTableColumns() {
+    // 表头数据
+    const columns = ref<ColumnType[]>([]);
+    // 过滤信息
+    const filteredInfo = ref();
+    // 缓存 注册表头回调
+    let cacheColumnCB: Function = (): void => { };
+    // 缓存 动态表头 key
+    let cacheTableKey: keyof TableKey = 'table_pcweb_userinfo';
+    /**
+     * 注册表头
+     * @param tableName 动态表头数据key
+     * @param cb 回调函数,处理添加不同表格过滤,排序等功能
+     */
+    function registerColumn(tableName: keyof TableKey, cb: Function) {
+        cacheTableKey = tableName;
+        cacheColumnCB = cb;
+        const list = getTableHead(tableName);
+        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 },
+            };
+            cb(e, item, filtered);
+            columns.value.push(item);
+        });
+    }
+    /**
+     * 更新动态表头
+     */
+    function updateColumn() {
+        registerColumn(cacheTableKey, cacheColumnCB)
+    }
+    return { columns, registerColumn, updateColumn, filteredInfo }
+}

+ 32 - 0
src/common/setup/table/event.ts

@@ -0,0 +1,32 @@
+import { reactive, ref } from "vue";
+import { TableEventCB } from './interface';
+
+/**
+ * 表格事件
+ * @param param TableEventCB
+ * @returns 
+ */
+export function getTableEvent<T>(param: TableEventCB) {
+    // 表格展开行
+    const expandedRowKeys = ref<string[]>([]);
+    // 表格选中的数据
+    const selectedRow = reactive({})
+    function Rowclick(record: T, index: number) {
+        return {
+            onClick: () => {  // 表格点击
+                Object.assign(selectedRow, record)
+                const value = expandedRowKeys.value;
+                expandedRowKeys.value = value.length ? [] : [`${index}`];
+                param.clickCB && param.clickCB()
+            },
+            // onDblclick: () => { // 双击
+            //     console.log('onDblclick');
+            // },
+            onContextmenu: () => {  // 表格右键
+                Object.assign(selectedRow, record)
+                param.contextmenuCB && param.contextmenuCB()
+            },
+        };
+    }
+    return { expandedRowKeys, selectedRow, Rowclick }
+}

+ 7 - 172
src/common/setup/table/index.ts

@@ -1,176 +1,11 @@
-import { ModalName } from '@/common/constants/modalName';
-import { ColumnType, getTableHead } from '@/common/methods/table';
-import { TableKey } from '@/common/methods/table/interface';
-import { Column, OperationTabMenu } from '@/services/go/commonService/interface';
-import { sessionStorageUtil } from "@/utils/storage";
-import { inject, onUnmounted, reactive, Ref, ref } from "vue";
-import { MenuType } from "../buttonPermission/interface";
-import { openModal } from "../modal";
-import { BtnClassName, BtnList, TableEventCB } from './interface';
+import { ColumnType } from '@/common/methods/table';
+import { Column } from '@/services/go/commonService/interface';
+import { getBtnList } from './button';
+import { getTableColumns } from './clolumn';
+import { getTableEvent } from './event';
 
 
-/**
- * 获取动态表头数据
- * ant-design 表格数据的过滤功能与表头绑定在一起
- */
-export function getTableColumns() {
-    // 表头数据
-    const columns = ref<ColumnType[]>([]);
-    // 过滤信息
-    const filteredInfo = ref();
-    // 缓存 注册表头回调
-    let cacheColumnCB: Function = (): void => { };
-    // 缓存 动态表头 key
-    let cacheTableKey: keyof TableKey = 'table_pcweb_userinfo';
-    /**
-     * 注册表头
-     * @param tableName 动态表头数据key
-     * @param cb 回调函数,处理添加不同表格过滤,排序等功能
-     */
-    function registerColumn(tableName: keyof TableKey, cb: Function) {
-        cacheTableKey = tableName;
-        cacheColumnCB = cb;
-        const list = getTableHead(tableName);
-        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 },
-            };
-            cb(e, item, filtered);
-            columns.value.push(item);
-        });
-    }
-    /**
-     * 更新动态表头
-     */
-    function updateColumn() {
-        registerColumn(cacheTableKey, cacheColumnCB)
-    }
-    return { columns, registerColumn, updateColumn, filteredInfo }
-}
-
-/**
- * 表格事件
- * @param param TableEventCB
- * @returns 
- */
-export function getTableEvent<T>(param: TableEventCB) {
-    // 表格展开行
-    const expandedRowKeys = ref<string[]>([]);
-    // 表格选中的数据
-    const selectedRow = reactive({})
-    function Rowclick(record: T, index: number) {
-        return {
-            onClick: () => {  // 表格点击
-                Object.assign(selectedRow, record)
-                const value = expandedRowKeys.value;
-                expandedRowKeys.value = value.length ? [] : [`${index}`];
-                param.clickCB && param.clickCB()
-            },
-            // onDblclick: () => { // 双击
-            //     console.log('onDblclick');
-            // },
-            onContextmenu: () => {  // 表格右键
-                Object.assign(selectedRow, record)
-                param.contextmenuCB && param.contextmenuCB()
-            },
-        };
-    }
-    return { expandedRowKeys, selectedRow, Rowclick }
-}
-
-/**
- * 获取class 名
- * @param val 
- * @returns 
- */
-function getClassName(val: string): BtnClassName {
-    let result: BtnClassName = 'btnDeafault'
-    if (val.includes('disable') || val.includes('cancle') || val.includes('delete')) {
-        result = 'btnDanger'
-    } else if (val === '') {
-        result = 'btnDeafault'
-    } else if (val.includes('add')) {
-        result = 'operBtn'
-    } else {
-        result = 'btnPrimary'
-    }
-    return result
-}
-
-/**
- * 获取表格操作按钮列表
- * @param menuType 
- * @param hasDetail 操作按钮是否需要详情按钮(详情按钮服务 不配置)
- * @returns 
- */
-export function getBtnList(menuType: keyof MenuType, hasDetail: boolean) {
-    // 获取 数据
-    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
-    const name = 'permissionData'
-    // 存入sessionStorageUtil 是为了处理页面刷新的情况(这个时候重新从服务获取数据,但页面已经先加载了,vue 中的 依赖注入在异步中不能建立通信)
-    const data: OperationTabMenu[] = permissionData.value.length ? permissionData.value : sessionStorageUtil.getItem(name)
-    sessionStorageUtil.setItem(name, data)
-
-    const commonBtn = ref<BtnList[]>([]); // 通用按钮列表,不用选中数据才显示
-    const forDataBtn = ref<BtnList[]>([]); // 针对数据按钮列表,选中某条数据才显示
-
-    const list = data.find((e) => e.code === menuType);
-    if (list && list.children) {
-        list.children.forEach(e => {
-            const { code, type, title } = e;
-            if (type === 2) { // 按钮类型
-                const { openAction } = openModal(code as keyof ModalName);
-                const item = { lable: title, callback: openAction, className: getClassName(code) }
-                const commonName = ['新增'] // 目前通用的按钮只要新增,需要添加其它的时候需要往这里添加
-                if (commonName.includes(title)) { // 
-                    commonBtn.value.push(item)
-                } else {
-                    forDataBtn.value.push(item)
-                }
-            }
-        })
-    } else {
-        console.warn(`menuType: ${menuType}未找到`)
-    }
-    // 详情
-    if (hasDetail) {
-        const { openAction } = openModal('detail')
-        forDataBtn.value.push({ lable: '详情', callback: openAction, className: getClassName('') })
-    }
-
-
-    onUnmounted(() => {
-        sessionStorageUtil.removeItem(name)
-    });
-    return { commonBtn, forDataBtn }
-}
+export { getTableColumns, getTableEvent, getBtnList };
+export type { Column, ColumnType };
 
-// /**
-//  * 获取表格数据
-//  * @param param 
-//  * @returns 
-//  */
-// export function getTableData<T>(param: TableEventCB) {
-//     // 加载状态
-//     const loading = ref<boolean>(false);
-//     // 表格数据
-//     const tableList = ref<T[]>([]);
-//     // 获取表头数据
-//     const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns()
-//     // 获取表格事件
-//     const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(param)
-//     return {
-//         loading, tableList,
-//         columns, registerColumn, updateColumn, filteredInfo,
-//         expandedRowKeys, selectedRow, Rowclick,
-//     }
-// }
 
-export type { Column, ColumnType };

+ 42 - 0
src/common/setup/table/interface.ts

@@ -9,4 +9,46 @@ export interface BtnList {
     lable: string;  // 按钮名字
     callback: Function;
     className: BtnClassName    // 按钮 class 名字
+}
+export interface ButtonListKey {
+    custom_info_normal: string; // 客户资料 正常
+    custom_info_disabled: string; // 客户资料 停用
+
+    spot_contract_unsubmitted: string; // 现货合同 未提交
+    spot_contract_checkpending: string; // 现货合同 待审核
+    spot_contract_performance: string; // 现货合同 履约中
+    spot_contract_finished: string; // 现货合同 已完成
+
+    warehouse_info_normal: string; // 仓库信息 正常
+    warehouse_info_disabled: string; // 仓库信息 停用
+
+    purchase_pending: string;   // 采购 待点价
+    purchase_performance: string;   // 采购 履约交收
+    purchase_all: string;   // 采购 全部
+
+    sell_pending: string;   // 销售 待点价
+    sell_performance: string;   // 销售 履约交收
+    sell_all: string;   // 销售 全部
+
+    exposure_realtime: string;   //实时敞口
+    exposure_spot: string;   //现货头寸
+    exposure_futures: string;   //期货头寸
+    exposure_history: string;   //历史敞口
+
+    business_review_someprice: string; // 业务审核 点价
+    business_review_settlement: string; // 业务审核 交收
+
+    finance_review_funds: string; // 财务审核 款项
+    finance_review_invoice: string; // 财务审核 发票
+
+    inventory_review_checkin: string; // 库存审核 入库
+    inventory_review_checkout: string; // 财务审核 出库
+
+    inventory_current: string; // 库存查询 当前库存
+    inventory_applyrecord: string; // 库存查询 申请记录
+
+    finance_report_finance: string; // 财务报表
+    exposure_report_exposure: string; // 敞口报表
+    spot_report_spot: string; // 现货报表
+    inventory_report_inventory: string; // 库存报表
 }

+ 9 - 0
src/views/information/custom/compoments/index.ts

@@ -0,0 +1,9 @@
+import AddCustom from './add/index.vue';
+import DeleteCustom from './delete/index.vue';
+import CustomDetail from './detail/index.vue';
+import DisableCustom from './disable/index.vue';
+import filterCustomTable from './filterTable/index.vue';
+import ModifyCustom from './modify/index.vue';
+import RecoverCustom from './recover/index.vue';
+
+export { filterCustomTable, CustomDetail, DeleteCustom, RecoverCustom, ModifyCustom, DisableCustom, AddCustom };

+ 5 - 12
src/views/information/custom/list/normal-use/index.vue

@@ -34,18 +34,12 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods/index';
-import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
-import ModifyCustom from '@/views/information/custom/compoments/modify/index.vue';
-import DisableCustom from '@/views/information/custom/compoments/disable/index.vue';
-import AddCustom from '@/views/information/custom/compoments/add/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+
+import { filterCustomTable, CustomDetail, ModifyCustom, DisableCustom, AddCustom } from '../../compoments';
+
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-import { getTableColumns, getTableEvent } from '@/common/setup/table/index';
+
 import { queryTableList, getFilterTableCB } from '../setup';
 
 export default defineComponent({
@@ -76,7 +70,6 @@ export default defineComponent({
         });
         // 查询
         function search(value: any) {
-            debugger;
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();

+ 4 - 11
src/views/information/custom/list/stop-use/index.vue

@@ -34,18 +34,11 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods/index';
-import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
-import DeleteCustom from '@/views/information/custom/compoments/delete/index.vue';
-import RecoverCustom from '@/views/information/custom/compoments/recover/index.vue';
-import AddCustom from '@/views/information/custom/compoments/add/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+
+import { filterCustomTable, CustomDetail, DeleteCustom, RecoverCustom, AddCustom } from '../../compoments';
+
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-import { getTableColumns, getTableEvent } from '@/common/setup/table/index';
 import { queryTableList, getFilterTableCB } from '../setup';
 
 export default defineComponent({

+ 12 - 0
src/views/information/spot-contract/components/index.ts

@@ -0,0 +1,12 @@
+import AddSpotContract from './add/index.vue';
+import Cancel from './cancel/index.vue';
+import Check from './check/index.vue';
+import DeleteSpotContract from './delete/index.vue';
+import SpotContractDeatil from './detail/index.vue';
+import filterCustomTable from './filterTable/index.vue';
+import Finish from './finish/index.vue';
+import ModifySpotContract from './modify/index.vue';
+import ResubmitSpotContract from './resubmit/index.vue';
+
+export { AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable, Finish, ModifySpotContract, DeleteSpotContract, ResubmitSpotContract };
+

+ 36 - 22
src/views/information/spot-contract/list/checkpending/index.vue

@@ -23,7 +23,7 @@
       </a-table>
     </contextMenu>
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil  :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" />
     <!-- 现货合同: 审核 -->
     <Check />
     <!-- 现货合同: 撤销 -->
@@ -32,19 +32,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
-import { getCustomList } from '../setup';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
-import SpotContractDeatil from '@/views/information/spot-contract/components/detail/index.vue';
-import Check from '@/views/information/spot-contract/components/check/index.vue';
-import Cancel from '@/views/information/spot-contract/components/cancel/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import { handleTableEvent } from '@/common/setup/event/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable } from '../../components';
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-peddding',
@@ -58,14 +48,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const contextMenuList = ref<MenuItem[]>([]);
-        const { spotContractList, actionQuery, columns, getColumns, search, loading } = getCustomList();
-
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        // 表格操作按钮列表
+        const { commonBtn, forDataBtn } = getBtnList('spot_contract_checkpending', true);
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(2);
+        // 查询
+        function search(value: any) {
+            debugger;
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(2);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_delivery', getFilterTableCB);
         });
-        return { spotContractList, columns, search, contextMenuList, ...getBtnList('spot_contract_checkpending', true), loading, ...handleTableEvent() };
+        return {
+            columns,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            commonBtn,
+            forDataBtn,
+            loading,
+            tableList,
+            search,
+        };
     },
 });
 </script>
@@ -73,5 +88,4 @@ export default defineComponent({
 <style lang="less">
 .spot-contract-peddding {
 }
-</style
->;
+</style>;

+ 36 - 18
src/views/information/spot-contract/list/finished/index.vue

@@ -25,22 +25,15 @@
     <!-- 新增现货合同 -->
     <AddSpotContract />
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil  :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" />
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
-import { getCustomList } from '../setup';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
-import SpotContractDeatil from '@/views/information/spot-contract/components/detail/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import { handleTableEvent } from '@/common/setup/event/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { AddSpotContract, SpotContractDeatil, filterCustomTable } from '../../components';
+
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-done',
@@ -52,14 +45,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const contextMenuList = ref<MenuItem[]>([]);
-        const { spotContractList, actionQuery, columns, getColumns, search, loading } = getCustomList();
-
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        // 表格操作按钮列表
+        const { commonBtn, forDataBtn } = getBtnList('spot_contract_finished', true);
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(4);
+        // 查询
+        function search(value: any) {
+            debugger;
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(4);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_delivery', getFilterTableCB);
         });
-        return { spotContractList, columns, search, contextMenuList, ...getBtnList('spot_contract_finished', true), loading, ...handleTableEvent() };
+        return {
+            columns,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            commonBtn,
+            forDataBtn,
+            loading,
+            tableList,
+            search,
+        };
     },
 });
 </script>

+ 6 - 0
src/views/information/spot-contract/list/index.ts

@@ -0,0 +1,6 @@
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { getFilterTableCB, queryTableList } from './setup';
+
+export { queryTableList, getFilterTableCB };
+export type { QueryCustomInfoType };
+

+ 35 - 19
src/views/information/spot-contract/list/performance/index.vue

@@ -23,25 +23,17 @@
       </a-table>
     </contextMenu>
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil  :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" />
     <!-- 现货合同: 正常完结 -->
     <Finish />
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
-import { getCustomList } from '../setup';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
-import SpotContractDeatil from '@/views/information/spot-contract/components/detail/index.vue';
-import Finish from '@/views/information/spot-contract/components/finish/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import { handleTableEvent } from '@/common/setup/event/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { AddSpotContract, SpotContractDeatil, filterCustomTable, Finish } from '../../components';
+
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-performance',
@@ -54,15 +46,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const contextMenuList = ref<MenuItem[]>([]);
-        const { spotContractList, actionQuery, columns, getColumns, search, loading } = getCustomList();
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_performance', true);
-
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(3);
+        // 查询
+        function search(value: any) {
+            debugger;
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(3);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_delivery', getFilterTableCB);
         });
-        return { spotContractList, columns, search, contextMenuList, commonBtn, forDataBtn, loading, ...handleTableEvent() };
+        return {
+            columns,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            commonBtn,
+            forDataBtn,
+            loading,
+            tableList,
+            search,
+        };
     },
 });
 </script>

+ 52 - 66
src/views/information/spot-contract/list/setup.ts

@@ -1,84 +1,70 @@
-import { ColumnType, getTableHead } from '@/common/methods/table';
+// import { ColumnType, getTableHead } from '@/common/methods/table';
+import { Column, ColumnType } from '@/common/setup/table/index';
 import { QuerySpotContract } from '@/services/go/ermcp/spot-contract/index';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { message } from 'ant-design-vue';
 import { ref } from 'vue';
 
-// 处理现货列表
-export function getCustomList() {
-    // 表格数据
-    const spotContractList = ref<Ermcp3ContractRsp[]>([]);
-    // 表头数据
-    const columns = ref<ColumnType[]>([]);
-    // 过滤项
-    const filteredInfo = ref();
+// 1-未提交 2-待审核 3-履约中 4-已完成
+type EnumType = 1 | 2 | 3 | 4;
+
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList(type: EnumType) {
+    // 加载状态
     const loading = ref<boolean>(false);
-    // 获取表头
-    function getColumns() {
-        const list = getTableHead('table_pcweb_delivery');
-        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: Ermcp3ContractRsp) => String(record.contracttype).includes(value);
-                item.filteredValue = filtered.contracttype || null;
-            }
-            if (e.columntitle === '定价类型') {
-                item.onFilter = (value: string, record: Ermcp3ContractRsp) => String(record.pricetype).includes(value);
-                item.filteredValue = filtered.pricetype || null;
-            }
-            if (e.columntitle === '合同编号') {
-                item.onFilter = (value: string, record: Ermcp3ContractRsp) => record.contractno.includes(value);
-                item.filteredValue = filtered.contractno || null;
-            }
-            if (e.columntitle === '对手方') {
-                item.onFilter = (value: string, record: Ermcp3ContractRsp) => {
-                    if (record.contracttype === 1) {
-                        //采购方
-                        return record.sellusername.includes(value);
-                    } else {
-                        // 销售
-                        return record.buyusername.includes(value);
-                    }
-                };
-                item.filteredValue = filtered.negative || null;
-            }
-            columns.value.push(item);
-        });
-        console.log('columns', columns);
-    }
-    // 1-未提交 2-待审核 3-履约中 4-已完成
-    type EnumType = 1 | 2 | 3 | 4;
-    // 查询列表
-    function actionQuery(type: EnumType) {
-        loading.value = true;
+    // 表格数据
+    const tableList = ref<Ermcp3ContractRsp[]>([]);
+    function queryTable() {
         QuerySpotContract({ querytype: type })
             .then((res) => {
-                spotContractList.value = res.map((e, i) => {
+                tableList.value = res.map((e, i) => {
                     return { ...e, key: String(i) };
                 });
                 loading.value = false;
-                console.log('查询列表', spotContractList);
+                console.log('查询列表', tableList);
             })
             .catch((err) => {
                 message.error(err);
                 loading.value = false;
             });
     }
-    // 查询
-    function search(value: any) {
-        filteredInfo.value = value;
-        getColumns();
-    }
-
-    return { spotContractList, actionQuery, columns, filteredInfo, getColumns, search, loading };
+    return { loading, tableList, queryTable }
 }
+
+/**
+ * 过滤表格的回调函数
+ * @param e 
+ * @param item 
+ * @param filtered 
+ */
+export function getFilterTableCB(e: Column, item: ColumnType, filtered: any) {
+    // 以下添加过滤数据对应的方法
+    if (e.columntitle === '类型') {
+        item.onFilter = (value: string, record: Ermcp3ContractRsp) => String(record.contracttype).includes(value);
+        item.filteredValue = filtered.contracttype || null;
+    }
+    if (e.columntitle === '定价类型') {
+        item.onFilter = (value: string, record: Ermcp3ContractRsp) => String(record.pricetype).includes(value);
+        item.filteredValue = filtered.pricetype || null;
+    }
+    if (e.columntitle === '合同编号') {
+        item.onFilter = (value: string, record: Ermcp3ContractRsp) => record.contractno.includes(value);
+        item.filteredValue = filtered.contractno || null;
+    }
+    if (e.columntitle === '对手方') {
+        item.onFilter = (value: string, record: Ermcp3ContractRsp) => {
+            if (record.contracttype === 1) {
+                //采购方
+                return record.sellusername.includes(value);
+            } else {
+                // 销售
+                return record.buyusername.includes(value);
+            }
+        };
+        item.filteredValue = filtered.negative || null;
+    }
+}

+ 35 - 24
src/views/information/spot-contract/list/unsubmitted/index.vue

@@ -25,7 +25,7 @@
     <!-- 新增现货合同 -->
     <AddSpotContract />
     <!-- 现货合同: 详情 -->
-    <SpotContractDeatil  :selectedRow="selectedRow" />
+    <SpotContractDeatil :selectedRow="selectedRow" />
     <!-- 现货合同: 修改 -->
     <ModifySpotContract />
     <!-- 现货合同: 删除 -->
@@ -36,20 +36,10 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, onUnmounted, ref } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
-import { getCustomList } from '../setup';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import AddSpotContract from '@/views/information/spot-contract/components/add/index.vue';
-import SpotContractDeatil from '@/views/information/spot-contract/components/detail/index.vue';
-import ModifySpotContract from '@/views/information/spot-contract/components/modify/index.vue';
-import DeleteSpotContract from '@/views/information/spot-contract/components/delete/index.vue';
-import ResubmitSpotContract from '@/views/information/spot-contract/components/resubmit/index.vue';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import { handleTableEvent } from '@/common/setup/event/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { AddSpotContract, SpotContractDeatil, filterCustomTable, ModifySpotContract, DeleteSpotContract, ResubmitSpotContract } from '../../components';
+
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-not-commit',
@@ -64,18 +54,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const contextMenuList = ref<MenuItem[]>([]);
-        const { spotContractList, actionQuery, columns, getColumns, search, loading } = getCustomList();
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_unsubmitted', true);
-
-        onUnmounted(() => {
-            stop();
-        });
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList(1);
+        // 查询
+        function search(value: any) {
+            debugger;
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         initData(() => {
-            actionQuery(1);
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_delivery', getFilterTableCB);
         });
-        return { spotContractList, columns, search, contextMenuList, commonBtn, forDataBtn, loading, ...handleTableEvent() };
+        return {
+            columns,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            commonBtn,
+            forDataBtn,
+            loading,
+            tableList,
+            search,
+        };
     },
 });
 </script>