|
|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
<el-form-item label="合同编号" prop="contractCode" v-if="form.contractFlag === '1'">
|
|
|
|
|
<el-input v-model="form.contractCode" placeholder="请输入合同编号">
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button type="primary" @click="generateContractCode" :disabled="isCodeGenerated">生成合同编号</el-button>
|
|
|
|
|
<el-button type="primary" @click="generateContractCode" :disabled="isCodeGenerated">生成合同编号 </el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -50,7 +50,9 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="部门" prop="contractDeptId">
|
|
|
|
|
<el-input v-model="form.contractDeptId" placeholder="请输入部门" />
|
|
|
|
|
<el-select v-model="form.contractDeptId" placeholder="请选择部门">
|
|
|
|
|
<el-option v-for="item in deptInfoList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -68,38 +70,52 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="付款方式" prop="paymentMethod">
|
|
|
|
|
<el-input v-model="form.paymentMethod" placeholder="请输入付款方式" />
|
|
|
|
|
<el-input v-model="form.paymentMethod" placeholder="(如:3-3-3-1)" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="甲方公司" prop="aCustomerId">
|
|
|
|
|
<el-input v-model="form.aCustomerId" placeholder="请输入甲方公司" />
|
|
|
|
|
<el-form-item label="甲方公司" prop="oneCustomerId">
|
|
|
|
|
<el-select v-model="form.oneCustomerId" placeholder="请选择甲方公司" filterable >
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in customerInfoList"
|
|
|
|
|
:key="item.customerId"
|
|
|
|
|
:label="item.customerName"
|
|
|
|
|
:value="item.customerId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="乙方公司" prop="bCustomerId">
|
|
|
|
|
<el-input v-model="form.bCustomerId" placeholder="请输入乙方公司" />
|
|
|
|
|
<el-form-item label="乙方公司" prop="twoCustomerId">
|
|
|
|
|
<el-select v-model="form.twoCustomerId" placeholder="请选择乙方公司" filterable >
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in customerInfoList"
|
|
|
|
|
:key="item.customerId"
|
|
|
|
|
:label="item.customerName"
|
|
|
|
|
:value="item.customerId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="甲方授权代表" prop="aRepresent">
|
|
|
|
|
<el-input v-model="form.aRepresent" placeholder="请输入甲方授权代表" />
|
|
|
|
|
<el-form-item label="甲方授权代表" prop="oneRepresent">
|
|
|
|
|
<el-input v-model="form.oneRepresent" placeholder="请输入甲方授权代表" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="乙方授权代表" prop="bRepresent">
|
|
|
|
|
<el-input v-model="form.bRepresent" placeholder="请输入乙方授权代表" />
|
|
|
|
|
<el-form-item label="乙方授权代表" prop="twoRepresent">
|
|
|
|
|
<el-input v-model="form.twoRepresent" placeholder="请输入乙方授权代表" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="甲方签字日期" prop="aDate">
|
|
|
|
|
<el-date-picker clearable v-model="form.aDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择甲方签字日期">
|
|
|
|
|
<el-form-item label="甲方签字日期" prop="oneDate">
|
|
|
|
|
<el-date-picker clearable v-model="form.oneDate" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择甲方签字日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="乙方签字日期" prop="bDate">
|
|
|
|
|
<el-date-picker clearable v-model="form.bDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择乙方签字日期">
|
|
|
|
|
<el-form-item label="乙方签字日期" prop="twoDate">
|
|
|
|
|
<el-date-picker clearable v-model="form.twoDate" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择乙方签字日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
@ -200,8 +216,19 @@
|
|
|
|
|
<el-form ref="materialFormRef" :model="materialForm" :rules="materialRules" label-width="120px">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="产品名称" prop="productName">
|
|
|
|
|
<el-input v-model="materialForm.productName" placeholder="计划内请点击右侧图标检索物料">
|
|
|
|
|
<el-form-item label="计划标识" prop="planFlag">
|
|
|
|
|
<el-radio-group v-model="materialForm.planFlag">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in plan_flag"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="物料名称" prop="materialName">
|
|
|
|
|
<el-input v-model="materialForm.materialName" placeholder="计划内请点击右侧图标检索物料">
|
|
|
|
|
<template #suffix>
|
|
|
|
|
<el-icon style="cursor: pointer" @click="openMaterialSelect">
|
|
|
|
|
<Search />
|
|
|
|
|
@ -210,6 +237,11 @@
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="产品名称" prop="productName">
|
|
|
|
|
<el-input v-model="materialForm.productName" placeholder="请输入产品名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="规格描述" prop="specificationDescription">
|
|
|
|
|
<el-input v-model="materialForm.specificationDescription" placeholder="请输入规格描述" />
|
|
|
|
|
@ -320,11 +352,13 @@ import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
|
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule';
|
|
|
|
|
import MaterialSelect from '@/components/MaterialSelect/index.vue';
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
import { listDept } from '@/api/system/dept';
|
|
|
|
|
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const { contract_category, business_direction, active_flag, contract_flag, contract_type, contract_status } = toRefs<any>(
|
|
|
|
|
proxy?.useDict('contract_category', 'business_direction', 'active_flag', 'contract_flag', 'contract_type', 'contract_status')
|
|
|
|
|
const { contract_category, business_direction, active_flag, contract_flag, contract_type, contract_status, plan_flag } = toRefs<any>(
|
|
|
|
|
proxy?.useDict('contract_category', 'business_direction', 'active_flag', 'contract_flag', 'contract_type', 'contract_status', 'plan_flag')
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const buttonLoading = ref(false);
|
|
|
|
|
@ -350,6 +384,21 @@ const getUnitInfoListSelect = async () => {
|
|
|
|
|
unitInfoList.value = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 查询部门信息下拉框结构 */
|
|
|
|
|
const deptInfoList = ref([]);
|
|
|
|
|
const getDeptInfoListSelect = async () => {
|
|
|
|
|
const params = { deptCategory: '03' } as any;
|
|
|
|
|
let res = await listDept(params);
|
|
|
|
|
deptInfoList.value = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 查询客户信息下拉框结构 */
|
|
|
|
|
const customerInfoList = ref([]);
|
|
|
|
|
const getCustomerInfoListSelect = async () => {
|
|
|
|
|
let res = await getCrmCustomerInfoList(null);
|
|
|
|
|
customerInfoList.value = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 合同物料对话框
|
|
|
|
|
const materialDialog = reactive({
|
|
|
|
|
visible: false,
|
|
|
|
|
@ -359,6 +408,7 @@ const materialDialog = reactive({
|
|
|
|
|
// 合同物料表单数据
|
|
|
|
|
const initMaterialFormData: ContractMaterialForm = {
|
|
|
|
|
contractMaterialId: undefined,
|
|
|
|
|
planFlag: '2',
|
|
|
|
|
contractId: undefined,
|
|
|
|
|
productName: undefined,
|
|
|
|
|
specificationDescription: undefined,
|
|
|
|
|
@ -393,14 +443,14 @@ const initFormData: ContractInfoForm = {
|
|
|
|
|
businessDirection: undefined,
|
|
|
|
|
contractDeptId: undefined,
|
|
|
|
|
contractDate: undefined,
|
|
|
|
|
totalPrice: undefined,
|
|
|
|
|
aCustomerId: undefined,
|
|
|
|
|
aRepresent: undefined,
|
|
|
|
|
aDate: undefined,
|
|
|
|
|
bCustomerId: undefined,
|
|
|
|
|
bRepresent: undefined,
|
|
|
|
|
bDate: undefined,
|
|
|
|
|
contractStatus: undefined,
|
|
|
|
|
totalPrice: 0,
|
|
|
|
|
oneCustomerId: undefined,
|
|
|
|
|
oneRepresent: undefined,
|
|
|
|
|
oneDate: undefined,
|
|
|
|
|
twoCustomerId: undefined,
|
|
|
|
|
twoRepresent: undefined,
|
|
|
|
|
twoDate: undefined,
|
|
|
|
|
contractStatus: '1',
|
|
|
|
|
flowStatus: undefined,
|
|
|
|
|
templateId: undefined,
|
|
|
|
|
ossId: undefined,
|
|
|
|
|
@ -408,7 +458,7 @@ const initFormData: ContractInfoForm = {
|
|
|
|
|
signatureAppendix: undefined,
|
|
|
|
|
taxRate: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
activeFlag: undefined,
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
contractMaterialList: []
|
|
|
|
|
} as any;
|
|
|
|
|
|
|
|
|
|
@ -426,14 +476,16 @@ const goBack = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 监听contractFlag变化
|
|
|
|
|
watch(() => form.value.contractFlag, (newVal, oldVal) => {
|
|
|
|
|
if (newVal === '2') {
|
|
|
|
|
// 当选择"无合同"时,清空合同编号并重置生成状态
|
|
|
|
|
form.value.contractCode = undefined;
|
|
|
|
|
isCodeGenerated.value = false;
|
|
|
|
|
watch(
|
|
|
|
|
() => form.value.contractFlag,
|
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
|
if (newVal === '2') {
|
|
|
|
|
// 当选择"无合同"时,清空合同编号并重置生成状态
|
|
|
|
|
form.value.contractCode = undefined;
|
|
|
|
|
isCodeGenerated.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 生成合同编号
|
|
|
|
|
const generateContractCode = async () => {
|
|
|
|
|
@ -471,6 +523,13 @@ const submitForm = () => {
|
|
|
|
|
contractInfoFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
console.log('提交的表单数据:', JSON.stringify(form.value, null, 2));
|
|
|
|
|
console.log('甲方公司ID:', form.value.oneCustomerId);
|
|
|
|
|
console.log('甲方授权代表:', form.value.oneRepresent);
|
|
|
|
|
console.log('甲方签字日期:', form.value.oneDate);
|
|
|
|
|
console.log('乙方公司ID:', form.value.twoCustomerId);
|
|
|
|
|
console.log('乙方授权代表:', form.value.twoRepresent);
|
|
|
|
|
console.log('乙方签字日期:', form.value.twoDate);
|
|
|
|
|
if (form.value.contractId) {
|
|
|
|
|
await updateContractInfo(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
|
} else {
|
|
|
|
|
@ -502,7 +561,7 @@ const getContractMaterialList = async () => {
|
|
|
|
|
// 新增物料(新增合同时也可添加,不依赖contractId)
|
|
|
|
|
const handleAddMaterial = () => {
|
|
|
|
|
resetMaterialForm();
|
|
|
|
|
materialForm.value.contractId = form.value.contractId;
|
|
|
|
|
// materialForm.value.contractId = form.value.contractId;
|
|
|
|
|
materialDialog.visible = true;
|
|
|
|
|
materialDialog.title = '新增合同物料';
|
|
|
|
|
};
|
|
|
|
|
@ -656,5 +715,7 @@ onMounted(async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await getUnitInfoListSelect();
|
|
|
|
|
await getDeptInfoListSelect();
|
|
|
|
|
await getCustomerInfoListSelect();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|