|
|
|
@ -35,17 +35,7 @@
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="售后编号" prop="afterSalesCode">
|
|
|
|
<el-form-item label="售后编号" prop="afterSalesCode">
|
|
|
|
<el-input v-model="form.afterSalesCode" placeholder="自动生成售后编号">
|
|
|
|
<el-input v-model="form.afterSalesCode" placeholder="自动生成" disabled />
|
|
|
|
<template #append>
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
@click="generateAfterSalesCode"
|
|
|
|
|
|
|
|
:disabled="isCodeGenerated || routeParams.type === 'view' || routeParams.type === 'approval'"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
生成编号
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
@ -425,7 +415,8 @@ import { getAfterSales, addAfterSales, updateAfterSales, submitAfterSalesAndFlow
|
|
|
|
import { listProjectInfo } from '@/api/oa/erp/projectInfo';
|
|
|
|
import { listProjectInfo } from '@/api/oa/erp/projectInfo';
|
|
|
|
import { listUser } from '@/api/system/user';
|
|
|
|
import { listUser } from '@/api/system/user';
|
|
|
|
import { getErpProjectContractsList } from '@/api/oa/erp/projectContracts';
|
|
|
|
import { getErpProjectContractsList } from '@/api/oa/erp/projectContracts';
|
|
|
|
import { listContractInfo } from '@/api/oa/erp/contractInfo';
|
|
|
|
import { getContractInfo } from '@/api/oa/erp/contractInfo';
|
|
|
|
|
|
|
|
import { getCustomerInfo } from '@/api/oa/crm/customerInfo';
|
|
|
|
import { listCustomerContact } from '@/api/oa/crm/customerContact';
|
|
|
|
import { listCustomerContact } from '@/api/oa/crm/customerContact';
|
|
|
|
import { listUnitInfo } from '@/api/oa/base/unitInfo';
|
|
|
|
import { listUnitInfo } from '@/api/oa/base/unitInfo';
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule';
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule';
|
|
|
|
@ -509,12 +500,12 @@ const data = reactive({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
afterSalesSubject: [{ required: true, message: '售后主题不能为空', trigger: 'blur' }],
|
|
|
|
afterSalesSubject: [{ required: true, message: '售后主题不能为空', trigger: 'blur' }],
|
|
|
|
afterSalesCode: [{ required: true, message: '售后编号不能为空', trigger: 'blur' }],
|
|
|
|
// afterSalesCode: [{ required: true, message: '售后编号不能为空', trigger: 'blur' }],
|
|
|
|
projectCode: [{ required: true, message: '请选择项目', trigger: 'change' }],
|
|
|
|
projectCode: [{ required: true, message: '请选择项目', trigger: 'change' }],
|
|
|
|
projectName: [{ required: true, message: '请选择项目', trigger: 'change' }],
|
|
|
|
projectName: [{ required: true, message: '请选择项目', trigger: 'change' }],
|
|
|
|
afterSalesDate: [{ required: true, message: '请选择日期', trigger: 'change' }],
|
|
|
|
afterSalesDate: [{ required: true, message: '请选择日期', trigger: 'change' }],
|
|
|
|
afterSalesType: [{ required: true, message: '请选择售后类型', trigger: 'change' }],
|
|
|
|
afterSalesType: [{ required: true, message: '请选择售后类型', trigger: 'change' }],
|
|
|
|
stakeholderId: [{ required: true, message: '客户干系人不能为空', trigger: 'change' }],
|
|
|
|
// stakeholderId: [{ required: true, message: '客户干系人不能为空', trigger: 'change' }],
|
|
|
|
handlerId: [{ required: true, message: '售后处理人不能为空', trigger: 'change' }]
|
|
|
|
handlerId: [{ required: true, message: '售后处理人不能为空', trigger: 'change' }]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -698,23 +689,38 @@ function loadContractOptions(projectId: any) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 合同变更联动 -> 客户 -> 联系人
|
|
|
|
// 合同变更联动 -> 客户 -> 联系人
|
|
|
|
function handleContractChange(val: any) {
|
|
|
|
async function handleContractChange(val: any) {
|
|
|
|
form.value.customerName = undefined;
|
|
|
|
form.value.customerName = undefined;
|
|
|
|
form.value.customerId = undefined;
|
|
|
|
form.value.customerId = undefined;
|
|
|
|
contactOptions.value = [];
|
|
|
|
contactOptions.value = [];
|
|
|
|
|
|
|
|
|
|
|
|
if (!val) return;
|
|
|
|
if (!val) return;
|
|
|
|
|
|
|
|
|
|
|
|
listContractInfo({ contractId: val, pageNum: 1, pageSize: 10 } as any).then((res: any) => {
|
|
|
|
try {
|
|
|
|
if (res.rows && res.rows.length > 0) {
|
|
|
|
// 1. 获取合同详情
|
|
|
|
const contract = res.rows[0];
|
|
|
|
const resContract = await getContractInfo(val);
|
|
|
|
|
|
|
|
if (resContract.data) {
|
|
|
|
|
|
|
|
const contract = resContract.data;
|
|
|
|
form.value.customerId = contract.oneCustomerId;
|
|
|
|
form.value.customerId = contract.oneCustomerId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 如果合同详情中有客户名则直接用,否则单独查询客户详情
|
|
|
|
|
|
|
|
if (contract.oneCustomerName) {
|
|
|
|
form.value.customerName = contract.oneCustomerName;
|
|
|
|
form.value.customerName = contract.oneCustomerName;
|
|
|
|
if (contract.oneCustomerId) {
|
|
|
|
} else if (contract.oneCustomerId) {
|
|
|
|
loadContactOptions(contract.oneCustomerId);
|
|
|
|
const resCustomer = await getCustomerInfo(contract.oneCustomerId);
|
|
|
|
|
|
|
|
if (resCustomer.data) {
|
|
|
|
|
|
|
|
form.value.customerName = resCustomer.data.customerName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 加载联系人
|
|
|
|
|
|
|
|
if (form.value.customerId) {
|
|
|
|
|
|
|
|
loadContactOptions(form.value.customerId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error('加载合同关联信息失败:', error);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载客户联系人
|
|
|
|
// 加载客户联系人
|
|
|
|
@ -900,8 +906,18 @@ const getMaterialSummaries = (param: any) => {
|
|
|
|
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
/** 提交按钮 */
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
|
|
|
|
if (status === 'draft') {
|
|
|
|
|
|
|
|
executeSubmit(status, mode);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
afterSalesFormRef.value.validate(async (valid: boolean) => {
|
|
|
|
afterSalesFormRef.value.validate(async (valid: boolean) => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
executeSubmit(status, mode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const executeSubmit = async (status: string, mode: boolean) => {
|
|
|
|
buttonLoading.value = true;
|
|
|
|
buttonLoading.value = true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const submitData: any = { ...form.value };
|
|
|
|
const submitData: any = { ...form.value };
|
|
|
|
@ -952,8 +968,6 @@ const submitForm = (status: string, mode: boolean) => {
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
buttonLoading.value = false;
|
|
|
|
buttonLoading.value = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 审批记录初始化
|
|
|
|
// 审批记录初始化
|
|
|
|
|