huangbin 4 tahun lalu
induk
melakukan
53800cc3be

+ 7 - 15
src/views/manage/inventory-review/components/checkinAudit/index.vue

@@ -64,7 +64,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -166,10 +167,11 @@ import { getLongTypeLoginID } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface';
 import { passStockControl, refuseStockControl } from '@/views/manage/inventory-review/components/setup';
 import moment from 'moment';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'inventory_review_checkin_audit',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
@@ -177,16 +179,9 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('inventory_review_checkin_audit');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
-        function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 200);
-        }
 
         // 审核通过
         function pass() {
@@ -202,8 +197,7 @@ export default defineComponent({
                     };
                     passStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -226,8 +220,7 @@ export default defineComponent({
                     };
                     refuseStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -237,7 +230,6 @@ export default defineComponent({
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 7 - 10
src/views/manage/inventory-review/components/checkinCancel/index.vue

@@ -11,7 +11,7 @@
       <a-button key="submit"
                 type="primary"
                 :loading="loading"
-                @click="submit">关闭
+                @click="cancel">关闭
       </a-button>
 
       <a-button key="submit"
@@ -58,7 +58,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -160,10 +161,11 @@ import { getLongTypeLoginID } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface';
 import moment from 'moment';
 import { refuseStockControl } from '@/views/manage/inventory-review/components/setup';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'inventory_review_checkin_cancel',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
@@ -171,12 +173,9 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('inventory_review_checkin_cancel');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
-        function submit() {
-            cancel();
-        }
         function back() {
             Modal.confirm({
                 title: '是否确认撤销',
@@ -192,8 +191,7 @@ export default defineComponent({
                     };
                     refuseStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -203,7 +201,6 @@ export default defineComponent({
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 7 - 10
src/views/manage/inventory-review/components/checkinDetail/index.vue

@@ -11,7 +11,7 @@
       <a-button key="submit"
                 type="primary"
                 :loading="loading"
-                @click="submit">关闭
+                @click="cancel">关闭
       </a-button>
     </template>
     <a-form class="inlineForm"
@@ -54,7 +54,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname}}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname}}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -149,29 +150,25 @@ import { InOutTypeName, isShowContractInfo } from '@/views/manage/inventory-revi
 import { getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
 
 import { getGoodsUnitEnumItemName, getApplyStatusName } from '@/common/constants/enumsName';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'finance_review_funds_detail',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
             default: {},
         },
     },
-    setup(props) {
-        const { visible, cancel } = closeModal('detail');
+    setup(props, context) {
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
 
-        function submit() {
-            cancel();
-        }
-
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 7 - 15
src/views/manage/inventory-review/components/checkoutAudit/index.vue

@@ -63,7 +63,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty)  + " " +  selectedRow.enumdicname}}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty)  + " " +  selectedRow.enumdicname}}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -162,10 +163,11 @@ import { AreaInOutApplyAuditPassReq, AuditERMCPAreaInOutStockApplyReq } from '@/
 import { getLongTypeLoginID } from '@/services/bus/login';
 import moment from 'moment';
 import { LongType } from '@/services/socket/login/interface';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'inventory_review_checkout_audit',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
@@ -173,16 +175,9 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('inventory_review_checkout_audit');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
-        function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 200);
-        }
 
         // 审核通过
         function pass() {
@@ -198,8 +193,7 @@ export default defineComponent({
                     };
                     passStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -222,8 +216,7 @@ export default defineComponent({
                     };
                     refuseStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -234,7 +227,6 @@ export default defineComponent({
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 6 - 13
src/views/manage/inventory-review/components/checkoutCancel/index.vue

@@ -60,7 +60,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -159,10 +160,11 @@ import { refuseStockControl } from '@/views/manage/inventory-review/components/s
 import { InOutTypeName, isShowContractInfo } from '@/views/manage/inventory-review/setup';
 import { getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
 import { getGoodsUnitEnumItemName, getApplyStatusName } from '@/common/constants/enumsName';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'inventory_review_checkout_cancel',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
@@ -170,17 +172,10 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('inventory_review_checkout_cancel');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
 
-        function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
-        }
         function back() {
             Modal.confirm({
                 title: '是否确认撤销',
@@ -196,8 +191,7 @@ export default defineComponent({
                     };
                     refuseStockControl(param, loading)
                         .then((res) => {
-                            context.emit('refresh');
-                            cancel();
+                            cancel(true);
                         })
                         .catch((err) => {});
                 },
@@ -208,7 +202,6 @@ export default defineComponent({
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 6 - 13
src/views/manage/inventory-review/components/checkoutDetail/index.vue

@@ -11,7 +11,7 @@
       <a-button key="submit"
                 type="primary"
                 :loading="loading"
-                @click="submit">关闭</a-button>
+                @click="cancel">关闭</a-button>
     </template>
     <a-form class="inlineForm">
       <fieldset class="formFieldSet"
@@ -50,7 +50,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-item label="合同签署量">
-              <span class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
+              <span
+                    class="white">{{ formatValue(selectedRow.contractqty) + " " +  selectedRow.enumdicname }}</span>
             </a-form-item>
           </a-col>
         </a-row>
@@ -141,10 +142,11 @@ import { Ermcp3AreaStockApply } from '@/services/go/ermcp/inventory-review/inter
 import { InOutTypeName, isShowContractInfo } from '@/views/manage/inventory-review/setup';
 import { getGoodsUnitEnumItemName, getStatusName, getApplyStatusName } from '@/common/constants/enumsName';
 import { getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
+import { _closeModal } from '@/common/setup/modal/modal';
 
 export default defineComponent({
     name: 'finance_review_invoice_detail',
-    components: {},
+    emits: ['cancel', 'update'],
     props: {
         selectedRow: {
             type: Object as PropType<Ermcp3AreaStockApply>,
@@ -152,21 +154,12 @@ export default defineComponent({
         },
     },
     setup(props, context) {
-        const { visible, cancel } = closeModal('detail');
+        const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
-        function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                context.emit('refresh');
-                cancel();
-            }, 200);
-        }
         return {
             visible,
             cancel,
-            submit,
             loading,
             formatValue,
             getStatusName,

+ 86 - 91
src/views/manage/inventory-review/list/checkin/index.vue

@@ -4,56 +4,55 @@
        :loading="loading">
     <Filter @search="updateColumn"
             :inOrOut="'in'">
-      <BtnList :btnList="commonBtn" />
     </Filter>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{ record }">
-          <BtnList :btnList="record.btnList" />
-        </template>
-        <!-- 状态 -->
-        <template #applystatus="{ text }">
-          <a>{{ getApplyStatusName(text) }}</a>
-        </template>
-        <!-- 现货合同类型 -->
-        <template #contracttype="{ text }">
-          <a>{{ getContractTypeName(text) }}</a>
-        </template>
-        <!-- 点价类型 -->
-        <template #pricetype="{ text }">
-          <a>{{ getPriceTypeName(text) }}</a>
-        </template>
-        <!-- 出入库类型 -->
-        <template #inouttype="{ text }">
-          <a>{{ InOutTypeName(text) }}</a>
-        </template>
-        <template #buynicknameOrsellusername="{ record }">
-          <a>{{ handleName(record) }}</a>
-        </template>
+    <a-table :columns="columns"
+             class="topTable"
+             :pagination="false"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template #expandedRowRender="{ record }">
+        <BtnList :btnList="handlePermissionBtn(firstBtn, record)"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <!-- 状态 -->
+      <template #applystatus="{ text }">
+        <a>{{ getApplyStatusName(text) }}</a>
+      </template>
+      <!-- 现货合同类型 -->
+      <template #contracttype="{ text }">
+        <a>{{ getContractTypeName(text) }}</a>
+      </template>
+      <!-- 点价类型 -->
+      <template #pricetype="{ text }">
+        <a>{{ getPriceTypeName(text) }}</a>
+      </template>
+      <!-- 出入库类型 -->
+      <template #inouttype="{ text }">
+        <a>{{ InOutTypeName(text) }}</a>
+      </template>
+      <template #buynicknameOrsellusername="{ record }">
+        <a>{{ handleName(record) }}</a>
+      </template>
 
-      </a-table>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="handlePermissionBtn(firstBtn, selectedRow)">
     </contextMenu>
-    <!-- 审核-->
-    <CheckinAudit :selectedRow="selectedRow"
-                  @refresh="getTableData" />
-    <!-- 撤销 -->
-    <CheckinCancel :selectedRow="selectedRow"
-                   @refresh="getTableData" />
-    <!-- 详情 -->
-    <CheckinDetail :selectedRow="selectedRow"
-                   @refresh="getTableData" />
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
 
 import { Filter, CheckinAudit, CheckinCancel, CheckinDetail } from '../../components';
 
@@ -62,6 +61,11 @@ import { getContractTypeName, getPriceTypeName, getApplyStatusName } from '@/com
 import { operateApplyTypeName } from '@/views/manage/finance-review/setup';
 import { InOutTypeName } from '@/views/manage/inventory-review/setup';
 import { Column, ColumnType } from '@/common/setup/table';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { BtnList as BtnListType } from '@/common/components/btnList/interface';
+const Detail = defineAsyncComponent(() => import('../../components/checkinDetail/index.vue'));
+const Audit = defineAsyncComponent(() => import('../../components/checkinAudit/index.vue'));
+const Cancel = defineAsyncComponent(() => import('../../components/checkinCancel/index.vue'));
 
 export default defineComponent({
     name: 'inventory_review_checkin',
@@ -69,70 +73,61 @@ export default defineComponent({
         contextMenu,
         Filter,
         BtnList,
-        CheckinAudit,
-        CheckinCancel,
-        CheckinDetail,
+        [ModalEnum.detail]: Detail,
+        [ModalEnum.inventory_review_checkin_audit]: Audit,
+        [ModalEnum.inventory_review_checkin_cancel]: Cancel,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStockApply>({});
-        // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('inventory_review_checkin', true);
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList({ inouttype: '1,3' });
-        function getTableData() {
-            // 获取列表数据
-            queryTable().then(() => {
-                tableList.value.forEach((el) => {
-                    if (el.applystatus === 1) {
-                        // 1:待审核
-                        Object.assign(el, { btnList: forDataBtn.value });
+        // 获取列表数据
+        const queryTableAction = () => queryTable();
+        const filtrFn = (e: Column, item: ColumnType, filtered: any) => {
+            if (e.columnfield === 'buyusernameOrsellusername') {
+                item.onFilter = (value: string, record: Ermcp3AreaStockApply) => {
+                    const { contracttype, buyusername, sellusername } = record;
+                    if (contracttype === 1) {
+                        // 采购
+                        return sellusername.includes(value);
                     } else {
-                        const item = forDataBtn.value.find((e) => e.lable === '详情');
-                        item && Object.assign(el, { btnList: [item] });
+                        return buyusername.includes(value);
                     }
-                });
-            });
-        }
-        initData(() => {
-            // 获取列表数据
-            getTableData();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_stock_aduit_in', ['contracttype', 'contractno', 'deliverygoodsname'], (e: Column, item: ColumnType, filtered: any) => {
-                if (e.columnfield === 'buynicknameOrsellusername') {
-                    item.onFilter = (value: string, record: Ermcp3AreaStockApply) => {
-                        const { contracttype, buyusername, sellusername } = record;
-                        if (contracttype === 1) {
-                            // 采购
-                            return sellusername.includes(value);
-                        } else {
-                            return buyusername.includes(value);
-                        }
-                    };
-                    item.filteredValue = filtered.buynicknameOrsellusername || null;
+                };
+                item.filteredValue = filtered.buyusernameOrsellusername || null;
+            }
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: EnumRouterName.inventory_review_checkin,
+            tableName: 'table_pcweb_stock_aduit_in',
+            tableFilterKey: ['contracttype', 'contractno', 'deliverygoodsname'],
+            tableFilterCB: filtrFn,
+            isDetail: true,
+        };
+        function handlePermissionBtn(btnList: BtnListType[], item: Ermcp3AreaStockApply) {
+            if (item) {
+                const { applystatus } = item;
+                if (applystatus === 1) {
+                    return btnList;
+                } else {
+                    return btnList.filter((e) => e.code === 'detail');
                 }
-            });
-        });
+            } else {
+                return [];
+            }
+        }
 
         return {
-            columns,
-
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            commonBtn,
-            forDataBtn,
+            ...handleComposeTable<Ermcp3AreaStockApply>(param),
+            handlePermissionBtn,
             loading,
             tableList,
-            updateColumn,
             getApplyStatusName,
             getContractTypeName,
             operateApplyTypeName,
             getPriceTypeName,
             InOutTypeName,
-            getTableData,
             handleName,
         };
     },

+ 87 - 90
src/views/manage/inventory-review/list/checkout/index.vue

@@ -4,55 +4,54 @@
        :loading="loading">
     <Filter @search="updateColumn"
             :inOrOut="'out'">
-      <BtnList :btnList="commonBtn" />
     </Filter>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{ record }">
-          <BtnList :btnList="record.btnList" />
-        </template>
-        <!-- 状态 -->
-        <template #applystatus="{ text }">
-          <a>{{ getApplyStatusName(text) }}</a>
-        </template>
-        <!-- 现货合同类型 -->
-        <template #contracttype="{ text }">
-          <a>{{ getContractTypeName(text) }}</a>
-        </template>
-        <!-- 点价类型 -->
-        <template #pricetype="{ text }">
-          <a>{{ getPriceTypeName(text) }}</a>
-        </template>
-        <!-- 出入库类型 -->
-        <template #inouttype="{ text }">
-          <a>{{ InOutTypeName(text) }}</a>
-        </template>
-        <template #buynicknameOrsellusername="{ record }">
-          <a>{{ handleName(record) }}</a>
-        </template>
-      </a-table>
+    <a-table :columns="columns"
+             class="topTable"
+             :pagination="false"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             rowKey="key"
+             :data-source="tableList">
+      <!-- 额外的展开行 -->
+      <template #expandedRowRender="{ record }">
+        <BtnList :btnList="handlePermissionBtn(firstBtn, record)"
+                 :record="record"
+                 @click="openComponent" />
+      </template>
+      <!-- 状态 -->
+      <template #applystatus="{ text }">
+        <a>{{ getApplyStatusName(text) }}</a>
+      </template>
+      <!-- 现货合同类型 -->
+      <template #contracttype="{ text }">
+        <a>{{ getContractTypeName(text) }}</a>
+      </template>
+      <!-- 点价类型 -->
+      <template #pricetype="{ text }">
+        <a>{{ getPriceTypeName(text) }}</a>
+      </template>
+      <!-- 出入库类型 -->
+      <template #inouttype="{ text }">
+        <a>{{ InOutTypeName(text) }}</a>
+      </template>
+      <template #buynicknameOrsellusername="{ record }">
+        <a>{{ handleName(record) }}</a>
+      </template>
+    </a-table>
+    <!-- 右键 -->
+    <contextMenu :contextMenu="contextMenu"
+                 @cancel="closeContext"
+                 :list="handlePermissionBtn(firstBtn, selectedRow)">
     </contextMenu>
-    <!-- 详情 -->
-    <CheckoutDetail :selectedRow="selectedRow"
-                    @refresh="getTableData" />
-    <!-- 审核 -->
-    <CheckoutAudit :selectedRow="selectedRow"
-                   @refresh="getTableData" />
-    <!-- 撤销 -->
-    <CheckoutCancel :selectedRow="selectedRow"
-                    @refresh="getTableData" />
+    <component :is="componentId"
+               v-if="componentId"
+               :selectedRow="selectedRow"
+               @cancel="closeComponent"></component>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { BtnList, contextMenu, defineAsyncComponent, defineComponent, ModalEnum, handleComposeTable, ComposeTableParam } from '@/common/export/commonTable';
 
 import { CheckoutAudit, CheckoutCancel, CheckoutDetail, Filter } from '../../components';
 
@@ -61,6 +60,11 @@ import { getContractTypeName, getPriceTypeName, getApplyStatusName } from '@/com
 import { operateApplyTypeName } from '@/views/manage/finance-review/setup';
 import { InOutTypeName } from '@/views/manage/inventory-review/setup';
 import { Column, ColumnType } from '@/common/setup/table';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { BtnList as BtnListType } from '@/common/components/btnList/interface';
+const Detail = defineAsyncComponent(() => import('../../components/checkoutDetail/index.vue'));
+const Audit = defineAsyncComponent(() => import('../../components/checkoutAudit/index.vue'));
+const Cancel = defineAsyncComponent(() => import('../../components/checkoutCancel/index.vue'));
 
 export default defineComponent({
     name: 'inventory_review_checkout',
@@ -68,70 +72,63 @@ export default defineComponent({
         contextMenu,
         Filter,
         BtnList,
-        CheckoutDetail,
-        CheckoutAudit,
-        CheckoutCancel,
+        [ModalEnum.detail]: Detail,
+        [ModalEnum.inventory_review_checkout_audit]: Audit,
+        [ModalEnum.inventory_review_checkout_cancel]: Cancel,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStockApply>({});
-        // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('inventory_review_checkout', true);
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList({ inouttype: '2,4' });
-        function getTableData() {
-            // 获取列表数据
-            queryTable().then(() => {
-                tableList.value.forEach((el) => {
-                    if (el.applystatus === 1) {
-                        // 1:待审核
-                        Object.assign(el, { btnList: forDataBtn.value });
+        // 获取列表数据
+        const queryTableAction = () => queryTable();
+        const filtrFn = (e: Column, item: ColumnType, filtered: any) => {
+            if (e.columnfield === 'buyusernameOrsellusername') {
+                item.onFilter = (value: string, record: Ermcp3AreaStockApply) => {
+                    const { contracttype, buyusername, sellusername } = record;
+                    if (contracttype === 1) {
+                        // 采购
+                        return sellusername.includes(value);
                     } else {
-                        const item = forDataBtn.value.find((e) => e.lable === '详情');
-                        item && Object.assign(el, { btnList: [item] });
+                        return buyusername.includes(value);
                     }
-                });
-            });
-        }
-        initData(() => {
-            // 获取列表数据
-            getTableData();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_stock_aduit_out', ['contracttype', 'contractno', 'deliverygoodsname'], (e: Column, item: ColumnType, filtered: any) => {
-                if (e.columnfield === 'buynicknameOrsellusername') {
-                    item.onFilter = (value: string, record: Ermcp3AreaStockApply) => {
-                        const { contracttype, buyusername, sellusername } = record;
-                        if (contracttype === 1) {
-                            // 采购
-                            return sellusername.includes(value);
-                        } else {
-                            return buyusername.includes(value);
-                        }
-                    };
-                    item.filteredValue = filtered.buynicknameOrsellusername || null;
+                };
+                item.filteredValue = filtered.buyusernameOrsellusername || null;
+            }
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: EnumRouterName.inventory_review_checkout,
+            tableName: 'table_pcweb_stock_aduit_out',
+            tableFilterKey: ['contracttype', 'contractno', 'deliverygoodsname'],
+            tableFilterCB: filtrFn,
+            isDetail: true,
+        };
+        function handlePermissionBtn(btnList: BtnListType[], item: Ermcp3AreaStockApply) {
+            if (item) {
+                const { applystatus } = item;
+                if (applystatus === 1) {
+                    return btnList;
+                } else {
+                    return btnList.filter((e) => e.code === 'detail');
                 }
-            });
-        });
+            } else {
+                return [];
+            }
+        }
 
         return {
-            columns,
+            ...handleComposeTable<Ermcp3AreaStockApply>(param),
+            handlePermissionBtn,
             handleName,
-            expandedRowKeys,
-            selectedRow,
-            Rowclick,
-            commonBtn,
-            forDataBtn,
+
             loading,
             tableList,
-            updateColumn,
             getApplyStatusName,
             getContractTypeName,
             operateApplyTypeName,
             getPriceTypeName,
             InOutTypeName,
-            getTableData,
         };
     },
 });