From 787ccc59ba89bacc075562a161ecf02bc76ebadc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 24 七月 2026 17:15:53 +0800
Subject: [PATCH] 银川 1.采购申请添加入库状态查询条件
---
src/views/crm/contract/index.vue | 140 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 127 insertions(+), 13 deletions(-)
diff --git a/src/views/crm/contract/index.vue b/src/views/crm/contract/index.vue
index 374c07c..cd385ed 100644
--- a/src/views/crm/contract/index.vue
+++ b/src/views/crm/contract/index.vue
@@ -5,15 +5,17 @@
import { ref } from 'vue';
import { useRouter } from 'vue-router';
-import { Page, useVbenModal } from '../../../packages/effects/common-ui/src';
-import { downloadFileFromBlobPart } from '../../../packages/utils/src';
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart } from '@vben/utils';
-import { Button, message, Tabs } from 'ant-design-vue';
+import { Button, message, Modal, Select, Tabs, Tag, Tooltip } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deleteContract,
exportContract,
+ generateSaleOrder,
+ getContractApproveProcessList,
getContractPage,
submitContract,
} from '#/api/crm/contract';
@@ -76,18 +78,34 @@
}
}
-/** 鎻愪氦瀹℃牳 */
+/** 鎻愪氦瀹℃壒寮圭獥 */
+const submitModalVisible = ref(false);
+const currentRow = ref<CrmContractApi.Contract>();
+const processList = ref<CrmContractApi.ApproveProcess[]>([]);
+const selectedProcessKey = ref<string>();
+const submitLoading = ref(false);
+
async function handleSubmit(row: CrmContractApi.Contract) {
- const hideLoading = message.loading({
- content: '鎻愪氦瀹℃牳涓�...',
- duration: 0,
- });
+ const res = await getContractApproveProcessList();
+ processList.value = res;
+ currentRow.value = row;
+ selectedProcessKey.value = undefined;
+ submitModalVisible.value = true;
+}
+
+async function confirmSubmit() {
+ if (!selectedProcessKey.value) {
+ message.warning('璇烽�夋嫨瀹℃壒娴佺▼');
+ return;
+ }
+ submitLoading.value = true;
try {
- await submitContract(row.id!);
- message.success('鎻愪氦瀹℃牳鎴愬姛');
+ await submitContract(currentRow.value!.id!, selectedProcessKey.value);
+ message.success('鎻愪氦瀹℃壒鎴愬姛');
+ submitModalVisible.value = false;
handleRefresh();
} finally {
- hideLoading();
+ submitLoading.value = false;
}
}
@@ -117,6 +135,39 @@
name: 'BpmProcessInstanceDetail',
query: { id: row.processInstanceId },
});
+}
+
+/** 鐢熸垚閿�鍞鍗� */
+async function handleGenerateOrder(row: CrmContractApi.Contract) {
+ if (row.auditStatus !== 20) {
+ message.warning('鍙湁宸插鎵圭殑鍚堝悓鎵嶈兘鐢熸垚閿�鍞鍗�');
+ return;
+ }
+ if (row.orderId) {
+ message.warning('璇ュ悎鍚屽凡鐢熸垚閿�鍞鍗�');
+ return;
+ }
+ const hideLoading = message.loading({
+ content: '姝e湪鐢熸垚閿�鍞鍗�...',
+ duration: 0,
+ });
+ try {
+ const orderId = await generateSaleOrder(row.id!);
+ message.success('鐢熸垚閿�鍞鍗曟垚鍔�');
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
+/** 鏌ョ湅閿�鍞鍗� */
+function handleViewOrder(row: CrmContractApi.Contract) {
+ if (row.orderId) {
+ push({
+ name: 'ErpSaleOrder',
+ query: { id: row.orderId },
+ });
+ }
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -152,7 +203,8 @@
</script>
<template>
- <Page auto-content-height><FormModal @success="handleRefresh" />
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
<Grid>
<template #toolbar-actions>
<Tabs class="w-full" @change="handleChangeSceneType">
@@ -186,6 +238,16 @@
{{ row.name }}
</Button>
</template>
+ <template #no="{ row }">
+ <Tooltip v-if="row.auditStatus === 50" title="璇ュ悎鍚屽凡浣滃簾锛岃鍗曞凡澶辨晥">
+ <span class="text-red-500 cursor-pointer" @click="handleDetail(row)">
+ {{ row.no }}
+ </span>
+ </Tooltip>
+ <Button v-else type="link" @click="handleDetail(row)">
+ {{ row.no }}
+ </Button>
+ </template>
<template #customerName="{ row }">
<Button type="link" @click="handleCustomerDetail(row)">
{{ row.customerName }}
@@ -201,6 +263,20 @@
{{ row.signContactName }}
</Button>
</template>
+ <template #auditStatus="{ row }">
+ <Tag v-if="row.auditStatus === 0" color="default">鏈彁浜�</Tag>
+ <Tag v-if="row.auditStatus === 10" color="warning">瀹℃壒涓�</Tag>
+ <Tag v-if="row.auditStatus === 20" color="success">瀹℃牳閫氳繃</Tag>
+ <Tag v-if="row.auditStatus === 30" color="error">瀹℃牳涓嶉�氳繃</Tag>
+ <Tag v-if="row.auditStatus === 40" color="default">宸插彇娑�</Tag>
+ <Tag v-if="row.auditStatus === 50" color="error">宸蹭綔搴�</Tag>
+ </template>
+ <template #orderNo="{ row }">
+ <Button v-if="row.orderId" type="link" @click="handleViewOrder(row)">
+ {{ row.orderNo }}
+ </Button>
+ <span v-else>-</span>
+ </template>
<template #actions="{ row }">
<TableAction
:actions="[
@@ -213,7 +289,7 @@
ifShow: row.auditStatus === 0,
},
{
- label: '鎻愪氦瀹℃牳',
+ label: '鎻愪氦瀹℃壒',
type: 'link',
auth: ['crm:contract:update'],
onClick: handleSubmit.bind(null, row),
@@ -227,6 +303,20 @@
ifShow: row.auditStatus !== 0,
},
{
+ label: '鐢熸垚閿�鍞鍗�',
+ type: 'link',
+ auth: ['crm:contract:update'],
+ onClick: handleGenerateOrder.bind(null, row),
+ ifShow: row.auditStatus === 20 && !row.orderId,
+ },
+ {
+ label: '鏌ョ湅璁㈠崟',
+ type: 'link',
+ auth: ['erp:sale-order:query'],
+ onClick: handleViewOrder.bind(null, row),
+ ifShow: !!row.orderId,
+ },
+ {
label: $t('common.delete'),
type: 'link',
danger: true,
@@ -235,10 +325,34 @@
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
confirm: handleDelete.bind(null, row),
},
+ ifShow: row.auditStatus === 0,
},
]"
/>
</template>
</Grid>
+
+ <!-- 鎻愪氦瀹℃壒寮圭獥 -->
+ <Modal
+ v-model:open="submitModalVisible"
+ title="閫夋嫨瀹℃壒娴佺▼"
+ width="400px"
+ @ok="confirmSubmit"
+ :confirmLoading="submitLoading"
+ >
+ <Select
+ v-model:value="selectedProcessKey"
+ placeholder="璇烽�夋嫨瀹℃壒娴佺▼"
+ class="w-full"
+ >
+ <Select.Option
+ v-for="item in processList"
+ :key="item.key"
+ :value="item.key"
+ >
+ {{ item.name }}
+ </Select.Option>
+ </Select>
+ </Modal>
</Page>
</template>
--
Gitblit v1.9.3