|
|
@@ -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,
|
|
|
};
|
|
|
},
|
|
|
});
|