|
|
|
|
@ -18,13 +18,7 @@
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="收货确认编号" prop="receivingCode">
|
|
|
|
|
<el-input v-model="form.receivingCode" placeholder="自动生成" disabled>
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button type="primary" @click="generateReceivingCode" :disabled="formDisabled || isCodeGenerated">
|
|
|
|
|
生成编号
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
<el-input v-model="form.receivingCode" placeholder="由系统自动生成" disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -44,7 +38,7 @@
|
|
|
|
|
<el-input v-model="form.projectManagerName" placeholder="自动带出" disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="到货日期" prop="arrivalDate">
|
|
|
|
|
<el-date-picker v-model="form.arrivalDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择到货日期" clearable />
|
|
|
|
|
@ -87,7 +81,6 @@ import { useRoute } from 'vue-router'
|
|
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo'
|
|
|
|
|
import { getProjectReceiving, addProjectReceiving, updateProjectReceiving, submitProjectReceivingAndFlowStart, prepareProjectReceivingByProjectId } from '@/api/oa/erp/projectReceiving'
|
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule'
|
|
|
|
|
import type { ProjectReceivingForm } from '@/api/oa/erp/projectReceiving/types'
|
|
|
|
|
import SubmitVerify from '@/components/Process/submitVerify.vue'
|
|
|
|
|
|
|
|
|
|
@ -122,7 +115,7 @@ const initFormData: ProjectReceivingForm = {
|
|
|
|
|
projectName: undefined,
|
|
|
|
|
managerId: undefined,
|
|
|
|
|
projectManagerName: undefined,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arrivalDate: undefined,
|
|
|
|
|
ossId: undefined,
|
|
|
|
|
chargeId: undefined,
|
|
|
|
|
@ -136,7 +129,6 @@ const initFormData: ProjectReceivingForm = {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const form = ref<ProjectReceivingForm>({ ...initFormData })
|
|
|
|
|
const isCodeGenerated = ref(false)
|
|
|
|
|
|
|
|
|
|
const normalizeFlowStatus = (status?: string) => {
|
|
|
|
|
if (!status) return 'draft'
|
|
|
|
|
@ -204,7 +196,6 @@ const applyLeaderFromManager = () => {
|
|
|
|
|
const res = await getProjectReceiving(routeParams.id as any)
|
|
|
|
|
Object.assign(form.value, res.data)
|
|
|
|
|
selectedProjectId.value = form.value.projectId
|
|
|
|
|
isCodeGenerated.value = !!form.value.receivingCode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
|
@ -225,7 +216,7 @@ const submitForm = (status: string, mode: boolean) => {
|
|
|
|
|
// 参考项目信息:显式设置流程状态为 draft
|
|
|
|
|
form.value.flowStatus = 'draft' as any
|
|
|
|
|
form.value.receivingStatus = '1' // 业务状态:暂存
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (form.value.receivingId) {
|
|
|
|
|
await updateProjectReceiving(form.value)
|
|
|
|
|
} else {
|
|
|
|
|
@ -283,28 +274,6 @@ const formDisabled = computed(() => {
|
|
|
|
|
return pageTypeForButton.value === 'view' || pageTypeForButton.value === 'approval' || byStatus
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const generateReceivingCode = async () => {
|
|
|
|
|
// 仅在可编辑且尚未生成编号时才允许生成
|
|
|
|
|
if (formDisabled.value) return
|
|
|
|
|
if (isCodeGenerated.value) return
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const params = { codeRuleCode: '1009' } as any
|
|
|
|
|
const res = await getRuleGenerateCode(params)
|
|
|
|
|
// 后端将生成的编号放在 msg,与项目/合同/报价保持一致
|
|
|
|
|
form.value.receivingCode = res?.msg as any
|
|
|
|
|
isCodeGenerated.value = !!form.value.receivingCode
|
|
|
|
|
if (form.value.receivingCode) {
|
|
|
|
|
proxy?.$modal.msgSuccess('收货确认编号生成成功')
|
|
|
|
|
} else {
|
|
|
|
|
proxy?.$modal.msgError('收货确认编号生成失败')
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('生成收货确认编号失败:', error)
|
|
|
|
|
proxy?.$modal.msgError('生成收货确认编号失败')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
// 初始化页面模式与任务ID,优先使用 path 中的 :receivingId,其次使用 query.id
|
|
|
|
|
routeParams.id = (route.params.receivingId || route.query.id) as any
|
|
|
|
|
|