|
|
|
|
@ -116,6 +116,46 @@
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="合同属地" prop="contractTerritorialFlag">
|
|
|
|
|
<div style="display: flex; align-items: center; width: 100%; gap: 12px">
|
|
|
|
|
<el-radio-group v-model="form.contractTerritorialFlag" :disabled="isFormDisabled">
|
|
|
|
|
<el-radio v-for="dict in contract_territorial_flag" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
<el-select
|
|
|
|
|
v-if="form.contractTerritorialFlag === '2'"
|
|
|
|
|
v-model="form.contractTerritorialCountry"
|
|
|
|
|
placeholder="请选择国家/地区"
|
|
|
|
|
:disabled="isFormDisabled"
|
|
|
|
|
filterable
|
|
|
|
|
clearable
|
|
|
|
|
style="flex: 1"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="dict in country_region" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="结算币种" prop="settlementCurrency">
|
|
|
|
|
<el-select v-model="form.settlementCurrency" placeholder="请选择结算币种" :disabled="isFormDisabled" clearable>
|
|
|
|
|
<el-option v-for="dict in currency_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- <el-col :span="12">
|
|
|
|
|
<el-form-item label="对人民币汇率" prop="rmbExchangeRate">
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="form.rmbExchangeRate"
|
|
|
|
|
:min="0"
|
|
|
|
|
:precision="6"
|
|
|
|
|
:step="0.0001"
|
|
|
|
|
:disabled="isFormDisabled"
|
|
|
|
|
placeholder="请输入对人民币汇率"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col> -->
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="付款账户" prop="paymentAccountId">
|
|
|
|
|
<el-select v-model="form.paymentAccountId" placeholder="请选择付款账户" :disabled="isFormDisabled"
|
|
|
|
|
@ -291,15 +331,32 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="附件" prop="ossId">
|
|
|
|
|
<!-- <el-button type="primary" plain icon="Upload" @click="handleFile">上传合同附件</el-button>-->
|
|
|
|
|
<FileUpload
|
|
|
|
|
v-model="ossIdString"
|
|
|
|
|
:limit="5"
|
|
|
|
|
:fileSize="20"
|
|
|
|
|
:fileType="['doc', 'docx', 'pdf', 'xls', 'xlsx']"
|
|
|
|
|
:disabled="isFormDisabled"
|
|
|
|
|
:isShowTip="true"
|
|
|
|
|
/>
|
|
|
|
|
<div style="display: flex; width: 100%; gap: 16px; align-items: flex-start">
|
|
|
|
|
<!-- <el-button type="primary" plain icon="Upload" @click="handleFile">上传合同附件</el-button>-->
|
|
|
|
|
<div style="flex: 1; min-width: 0">
|
|
|
|
|
<FileUpload
|
|
|
|
|
v-model="ossIdString"
|
|
|
|
|
:limit="5"
|
|
|
|
|
:fileSize="20"
|
|
|
|
|
:fileType="['doc', 'docx', 'pdf', 'xls', 'xlsx']"
|
|
|
|
|
:disabled="isFormDisabled"
|
|
|
|
|
:isShowTip="true"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="width: 230px; display: flex; flex-direction: column; align-items: flex-start; padding-top: 2px">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-model="form.effectiveCustomerOrderFlag"
|
|
|
|
|
true-value="1"
|
|
|
|
|
false-value="0"
|
|
|
|
|
:disabled="isFormDisabled"
|
|
|
|
|
>
|
|
|
|
|
<span style="font-weight: 600">已生效客户订单</span>
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
<div style="color: #909399; font-size: 12px; line-height: 1.4; margin-top: 4px">
|
|
|
|
|
(无需盖章或签字,即刻生效的客户订单)
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
@ -400,7 +457,7 @@
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" min-width="100" />
|
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="150" v-if="!isFormDisabled">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleEditMaterial(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleEditMaterial(scope.row, scope.$index)">编辑</el-button>
|
|
|
|
|
<el-button link type="danger" icon="Delete" @click="handleDeleteMaterial(scope.row)">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -723,7 +780,10 @@ const {
|
|
|
|
|
contract_status,
|
|
|
|
|
material_flag,
|
|
|
|
|
contract_template_flag,
|
|
|
|
|
is_framework_contract
|
|
|
|
|
is_framework_contract,
|
|
|
|
|
contract_territorial_flag,
|
|
|
|
|
country_region,
|
|
|
|
|
currency_type
|
|
|
|
|
} = toRefs<any>(
|
|
|
|
|
proxy?.useDict(
|
|
|
|
|
'contract_category',
|
|
|
|
|
@ -734,7 +794,10 @@ const {
|
|
|
|
|
'contract_status',
|
|
|
|
|
'material_flag',
|
|
|
|
|
'contract_template_flag',
|
|
|
|
|
'is_framework_contract'
|
|
|
|
|
'is_framework_contract',
|
|
|
|
|
'contract_territorial_flag',
|
|
|
|
|
'country_region',
|
|
|
|
|
'currency_type'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@ -858,6 +921,7 @@ const materialDialog = reactive({
|
|
|
|
|
visible: false,
|
|
|
|
|
title: ''
|
|
|
|
|
});
|
|
|
|
|
const editingMaterialIndex = ref<number | null>(null);
|
|
|
|
|
|
|
|
|
|
// 合同物料表单数据
|
|
|
|
|
const initMaterialFormData: ContractMaterialForm = {
|
|
|
|
|
@ -1011,6 +1075,11 @@ const initFormData: ContractInfoFormEx = {
|
|
|
|
|
businessDirection: undefined,
|
|
|
|
|
contractDeptId: undefined,
|
|
|
|
|
contractDate: undefined,
|
|
|
|
|
contractTerritorialFlag: '1',
|
|
|
|
|
contractTerritorialCountry: undefined,
|
|
|
|
|
settlementCurrency: 'CNY',
|
|
|
|
|
rmbExchangeRate: 1,
|
|
|
|
|
effectiveCustomerOrderFlag: '0',
|
|
|
|
|
totalPrice: 0,
|
|
|
|
|
oneCustomerId: undefined,
|
|
|
|
|
oneRepresent: undefined,
|
|
|
|
|
@ -1058,6 +1127,33 @@ const data = reactive<{ form: ContractInfoFormEx; rules: any }>({
|
|
|
|
|
contractName: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
|
|
|
|
|
businessDirection: [{ required: true, message: '业务方向不能为空', trigger: 'blur' }],
|
|
|
|
|
contractManagerId: [{ required: true, message: '合同负责人不能为空', trigger: 'blur' }],
|
|
|
|
|
contractTerritorialFlag: [{ required: true, message: '合同属地标识不能为空', trigger: 'change' }],
|
|
|
|
|
contractTerritorialCountry: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_rule: any, _value: any, callback: (err?: Error) => void) => {
|
|
|
|
|
if (form.value.contractTerritorialFlag === '2' && !form.value.contractTerritorialCountry) {
|
|
|
|
|
callback(new Error('合同属地标识为“其他”时,国家/地区不能为空'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
},
|
|
|
|
|
trigger: 'change'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
settlementCurrency: [{ required: true, message: '结算币种不能为空', trigger: 'change' }],
|
|
|
|
|
rmbExchangeRate: [{ required: true, message: '对人民币汇率不能为空', trigger: 'blur' }],
|
|
|
|
|
ossId: [
|
|
|
|
|
{
|
|
|
|
|
validator: (_rule: any, _value: any, callback: (err?: Error) => void) => {
|
|
|
|
|
if (form.value.effectiveCustomerOrderFlag === '1' && !form.value.ossId) {
|
|
|
|
|
callback(new Error('已生效客户订单必须上传附件'));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
},
|
|
|
|
|
trigger: 'change'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
contractTemplateFlag: [{ required: true, message: '合同模板标识不能为空', trigger: 'blur' }],
|
|
|
|
|
isFrameworkContract: [{ required: true, message: '请选择关联框架合同', trigger: 'change' }],
|
|
|
|
|
frameworkValidPeriod: [
|
|
|
|
|
@ -1130,6 +1226,30 @@ watch(
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => form.value.contractTerritorialFlag,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
// 合同属地标识为“其他”时,新增物料默认税率为0
|
|
|
|
|
initMaterialFormData.taxRate = newVal === '2' ? 0 : 13;
|
|
|
|
|
if (newVal === '2') {
|
|
|
|
|
materialForm.value.taxRate = 0;
|
|
|
|
|
} else {
|
|
|
|
|
form.value.contractTerritorialCountry = undefined;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => form.value.settlementCurrency,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
if (newVal === 'CNY') {
|
|
|
|
|
form.value.rmbExchangeRate = 1 as any;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 生成合同编号
|
|
|
|
|
const generateContractCode = async () => {
|
|
|
|
|
if (isCodeGenerated.value) return; // 如果已经生成过,直接返回
|
|
|
|
|
@ -1292,14 +1412,16 @@ const submitOss = () => {
|
|
|
|
|
// 新增物料(新增合同时也可添加,不依赖contractId)
|
|
|
|
|
const handleAddMaterial = () => {
|
|
|
|
|
resetMaterialForm();
|
|
|
|
|
editingMaterialIndex.value = null;
|
|
|
|
|
materialForm.value.contractId = form.value.contractId;
|
|
|
|
|
materialDialog.visible = true;
|
|
|
|
|
materialDialog.title = '新增合同物料';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 编辑物料
|
|
|
|
|
const handleEditMaterial = (row: ContractMaterialVO) => {
|
|
|
|
|
const handleEditMaterial = (row: ContractMaterialVO, rowIndex: number) => {
|
|
|
|
|
resetMaterialForm();
|
|
|
|
|
editingMaterialIndex.value = rowIndex;
|
|
|
|
|
materialForm.value = { ...row };
|
|
|
|
|
materialDialog.visible = true;
|
|
|
|
|
materialDialog.title = '编辑合同物料';
|
|
|
|
|
@ -1333,11 +1455,14 @@ const handleDeleteMaterial = async (row: ContractMaterialVO) => {
|
|
|
|
|
const resetMaterialForm = () => {
|
|
|
|
|
materialForm.value = { ...initMaterialFormData };
|
|
|
|
|
materialFormRef.value?.resetFields();
|
|
|
|
|
// 合同属地标识=2 物料税率默认0
|
|
|
|
|
materialForm.value.taxRate = form.value.contractTerritorialFlag === '2' ? 0 : 13;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 取消物料编辑
|
|
|
|
|
const cancelMaterial = () => {
|
|
|
|
|
resetMaterialForm();
|
|
|
|
|
editingMaterialIndex.value = null;
|
|
|
|
|
materialDialog.visible = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1490,7 +1615,11 @@ const submitMaterialForm = () => {
|
|
|
|
|
unitName: unitName
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (materialForm.value.contractMaterialId) {
|
|
|
|
|
const editIndex = editingMaterialIndex.value;
|
|
|
|
|
if (editIndex !== null && editIndex >= 0 && editIndex < (form.value as any).contractMaterialList.length) {
|
|
|
|
|
// 优先按行索引回写,兼容框架合同带出但无主键ID的物料
|
|
|
|
|
(form.value as any).contractMaterialList[editIndex] = materialData;
|
|
|
|
|
} else if (materialForm.value.contractMaterialId) {
|
|
|
|
|
// 编辑模式:更新现有物料
|
|
|
|
|
const index = (form.value as any).contractMaterialList.findIndex(
|
|
|
|
|
(item: any) => item.contractMaterialId === materialForm.value.contractMaterialId
|
|
|
|
|
@ -1511,6 +1640,7 @@ const submitMaterialForm = () => {
|
|
|
|
|
calculateTotalPrice();
|
|
|
|
|
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
editingMaterialIndex.value = null;
|
|
|
|
|
materialDialog.visible = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|