From 5a1391169414f04150de9d7aa67d18869349f81d Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Fri, 8 Aug 2025 15:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=AE=A1=E6=89=B9=E5=8F=B0?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=88=B0=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/components.d.ts | 59 --- .../approval/components/ApprovalSearch.vue | 21 +- .../device-management/approval/index.vue | 6 +- .../ProcurementApplicationModal.vue | 340 ++++++++++++++++++ .../device-management/procurement/index.vue | 68 ++++ 5 files changed, 416 insertions(+), 78 deletions(-) create mode 100644 src/views/system-resource/device-management/procurement/components/ProcurementApplicationModal.vue diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 19a4246..7fa6b1b 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -7,66 +7,7 @@ export {} declare module 'vue' { export interface GlobalComponents { - Avatar: typeof import('./../components/Avatar/index.vue')['default'] - Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default'] - CellCopy: typeof import('./../components/CellCopy/index.vue')['default'] - Chart: typeof import('./../components/Chart/index.vue')['default'] - ColumnSetting: typeof import('./../components/GiTable/src/components/ColumnSetting.vue')['default'] - CronForm: typeof import('./../components/GenCron/CronForm/index.vue')['default'] - CronModal: typeof import('./../components/GenCron/CronModal/index.vue')['default'] - DateRangePicker: typeof import('./../components/DateRangePicker/index.vue')['default'] - DayForm: typeof import('./../components/GenCron/CronForm/component/day-form.vue')['default'] - FilePreview: typeof import('./../components/FilePreview/index.vue')['default'] - GiCellAvatar: typeof import('./../components/GiCell/GiCellAvatar.vue')['default'] - GiCellGender: typeof import('./../components/GiCell/GiCellGender.vue')['default'] - GiCellStatus: typeof import('./../components/GiCell/GiCellStatus.vue')['default'] - GiCellTag: typeof import('./../components/GiCell/GiCellTag.vue')['default'] - GiCellTags: typeof import('./../components/GiCell/GiCellTags.vue')['default'] - GiCodeView: typeof import('./../components/GiCodeView/index.vue')['default'] - GiDot: typeof import('./../components/GiDot/index.tsx')['default'] - GiEditTable: typeof import('./../components/GiEditTable/GiEditTable.vue')['default'] - GiFooter: typeof import('./../components/GiFooter/index.vue')['default'] - GiForm: typeof import('./../components/GiForm/src/GiForm.vue')['default'] - GiIconBox: typeof import('./../components/GiIconBox/index.vue')['default'] - GiIconSelector: typeof import('./../components/GiIconSelector/index.vue')['default'] - GiIframe: typeof import('./../components/GiIframe/index.vue')['default'] - GiOption: typeof import('./../components/GiOption/index.vue')['default'] - GiOptionItem: typeof import('./../components/GiOptionItem/index.vue')['default'] - GiPageLayout: typeof import('./../components/GiPageLayout/index.vue')['default'] - GiSpace: typeof import('./../components/GiSpace/index.vue')['default'] - GiSplitButton: typeof import('./../components/GiSplitButton/index.vue')['default'] - GiSplitPane: typeof import('./../components/GiSplitPane/index.vue')['default'] - GiSplitPaneFlexibleBox: typeof import('./../components/GiSplitPane/components/GiSplitPaneFlexibleBox.vue')['default'] - GiSvgIcon: typeof import('./../components/GiSvgIcon/index.vue')['default'] - GiTable: typeof import('./../components/GiTable/src/GiTable.vue')['default'] - GiTag: typeof import('./../components/GiTag/index.tsx')['default'] - GiThemeBtn: typeof import('./../components/GiThemeBtn/index.vue')['default'] - HourForm: typeof import('./../components/GenCron/CronForm/component/hour-form.vue')['default'] - Icon403: typeof import('./../components/icons/Icon403.vue')['default'] - Icon404: typeof import('./../components/icons/Icon404.vue')['default'] - Icon500: typeof import('./../components/icons/Icon500.vue')['default'] - IconBorders: typeof import('./../components/icons/IconBorders.vue')['default'] - IconTableSize: typeof import('./../components/icons/IconTableSize.vue')['default'] - IconTreeAdd: typeof import('./../components/icons/IconTreeAdd.vue')['default'] - IconTreeReduce: typeof import('./../components/icons/IconTreeReduce.vue')['default'] - ImageImport: typeof import('./../components/ImageImport/index.vue')['default'] - ImageImportWizard: typeof import('./../components/ImageImportWizard/index.vue')['default'] - IndustrialImageList: typeof import('./../components/IndustrialImageList/index.vue')['default'] - JsonPretty: typeof import('./../components/JsonPretty/index.vue')['default'] - MinuteForm: typeof import('./../components/GenCron/CronForm/component/minute-form.vue')['default'] - MonthForm: typeof import('./../components/GenCron/CronForm/component/month-form.vue')['default'] - ParentView: typeof import('./../components/ParentView/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] - SecondForm: typeof import('./../components/GenCron/CronForm/component/second-form.vue')['default'] - SplitPanel: typeof import('./../components/SplitPanel/index.vue')['default'] - TextCopy: typeof import('./../components/TextCopy/index.vue')['default'] - TurbineGrid: typeof import('./../components/TurbineGrid/index.vue')['default'] - UserSelect: typeof import('./../components/UserSelect/index.vue')['default'] - Verify: typeof import('./../components/Verify/index.vue')['default'] - VerifyPoints: typeof import('./../components/Verify/Verify/VerifyPoints.vue')['default'] - VerifySlide: typeof import('./../components/Verify/Verify/VerifySlide.vue')['default'] - WeekForm: typeof import('./../components/GenCron/CronForm/component/week-form.vue')['default'] - YearForm: typeof import('./../components/GenCron/CronForm/component/year-form.vue')['default'] } } diff --git a/src/views/system-resource/device-management/approval/components/ApprovalSearch.vue b/src/views/system-resource/device-management/approval/components/ApprovalSearch.vue index e90f809..f22658a 100644 --- a/src/views/system-resource/device-management/approval/components/ApprovalSearch.vue +++ b/src/views/system-resource/device-management/approval/components/ApprovalSearch.vue @@ -129,29 +129,18 @@ const debouncedSearch = debounce(() => { const search = () => { console.log('🔍 ApprovalSearch - 搜索按钮被点击') console.log('🔍 ApprovalSearch - 搜索表单数据:', searchForm) - console.log('🔍 ApprovalSearch - 搜索表单数据类型:', typeof searchForm) - console.log('🔍 ApprovalSearch - 搜索表单的键值对:') - Object.entries(searchForm).forEach(([key, value]) => { - console.log(` ${key}: ${value} (${typeof value})`) - }) - // 构建搜索参数 + // 构建搜索参数 - 参考设备采购功能的实现 const searchParams: EquipmentApprovalListReq = { equipmentName: searchForm.equipmentName || undefined, applicantName: searchForm.applicantName || undefined, - businessType: searchForm.businessType, - approvalStatus: searchForm.approvalStatus, - applyTimeStart: searchForm.applyTimeStart, - applyTimeEnd: searchForm.applyTimeEnd + businessType: searchForm.businessType || undefined, + approvalStatus: searchForm.approvalStatus || undefined, + applyTimeStart: searchForm.applyTimeStart || undefined, + applyTimeEnd: searchForm.applyTimeEnd || undefined, } console.log('🔍 ApprovalSearch - 发送的搜索参数:', searchParams) - console.log('🔍 ApprovalSearch - 发送参数的类型:', typeof searchParams) - console.log('🔍 ApprovalSearch - 发送参数的键值对:') - Object.entries(searchParams).forEach(([key, value]) => { - console.log(` ${key}: ${value} (${typeof value})`) - }) - emit('search', searchParams) } diff --git a/src/views/system-resource/device-management/approval/index.vue b/src/views/system-resource/device-management/approval/index.vue index 858d248..c665c07 100644 --- a/src/views/system-resource/device-management/approval/index.vue +++ b/src/views/system-resource/device-management/approval/index.vue @@ -458,10 +458,10 @@ const loadData = async (searchParams?: EquipmentApprovalListReq) => { loading.value = true try { + // 构建完整的请求参数 - 参考设备采购功能的实现 const params: EquipmentApprovalListReq = { - pageSize: pagination.pageSize || 10, - page: pagination.current || 1, - pageNum: pagination.current || 1, // 添加 pageNum 参数,以防后端期望这个名称 + pageSize: pagination.pageSize, + page: pagination.current, ...(searchParams || {}), } diff --git a/src/views/system-resource/device-management/procurement/components/ProcurementApplicationModal.vue b/src/views/system-resource/device-management/procurement/components/ProcurementApplicationModal.vue new file mode 100644 index 0000000..bad19be --- /dev/null +++ b/src/views/system-resource/device-management/procurement/components/ProcurementApplicationModal.vue @@ -0,0 +1,340 @@ + + + + + diff --git a/src/views/system-resource/device-management/procurement/index.vue b/src/views/system-resource/device-management/procurement/index.vue index d07edab..6dc9934 100644 --- a/src/views/system-resource/device-management/procurement/index.vue +++ b/src/views/system-resource/device-management/procurement/index.vue @@ -175,6 +175,19 @@ 编辑 + + + 申请采购 + + + + {{ getApprovalStatusText(record.approvalStatus) }} + + + + @@ -213,7 +233,9 @@ import { import message from '@arco-design/web-vue/es/message' import ProcurementModal from './components/ProcurementModal.vue' import ProcurementSearch from './components/ProcurementSearch.vue' +import ProcurementApplicationModal from './components/ProcurementApplicationModal.vue' import { equipmentProcurementApi } from '@/apis/equipment/procurement' +import { equipmentApprovalApi } from '@/apis/equipment/approval' import type { EquipmentListReq, EquipmentResp } from '@/apis/equipment/type' defineOptions({ name: 'EquipmentProcurement' }) @@ -243,6 +265,10 @@ const modalVisible = ref(false) const currentProcurement = ref(null) const modalMode = ref<'add' | 'edit' | 'view'>('add') +// 采购申请弹窗控制 +const applicationModalVisible = ref(false) +const currentApplicationData = ref(null) + // 表格选择 const selectedRowKeys = ref([]) const rowSelection = reactive({ @@ -611,6 +637,12 @@ const handleEdit = (record: EquipmentResp) => { modalVisible.value = true } +// 申请采购 +const handleApplyProcurement = (record: EquipmentResp) => { + currentApplicationData.value = { ...record } + applicationModalVisible.value = true +} + // 删除 const handleDelete = async (record: EquipmentResp) => { try { @@ -629,6 +661,12 @@ const handleModalSuccess = () => { loadData(currentSearchParams.value) } +// 采购申请成功回调 +const handleApplicationSuccess = () => { + applicationModalVisible.value = false + loadData(currentSearchParams.value) +} + // 刷新数据 const refreshData = () => { loadData(currentSearchParams.value) @@ -674,6 +712,36 @@ const getTotalAmount = () => { return formatPrice(total) } +// 检查是否可以申请采购 +const canApplyProcurement = (record: EquipmentResp) => { + // 检查是否有审批状态,如果没有或者状态为待申请,则可以申请 + return !record.approvalStatus || record.approvalStatus === 'PENDING_APPLICATION' +} + +// 获取审批状态颜色 +const getApprovalStatusColor = (status: string) => { + const colorMap: Record = { + 'PENDING_APPLICATION': 'blue', + 'PENDING': 'orange', + 'APPROVED': 'green', + 'REJECTED': 'red', + 'WITHDRAWN': 'gray' + } + return colorMap[status] || 'blue' +} + +// 获取审批状态文本 +const getApprovalStatusText = (status: string) => { + const textMap: Record = { + 'PENDING_APPLICATION': '待申请', + 'PENDING': '待审批', + 'APPROVED': '已通过', + 'REJECTED': '已拒绝', + 'WITHDRAWN': '已撤回' + } + return textMap[status] || '未知' +} + onMounted(() => { loadData() })