|
|
@ -1,6 +1,22 @@ |
|
|
|
<template> |
|
|
|
<a-modal v-model:open="visible" :title="title" @ok="handleOk" @cancel="closeModal" width="50%"> |
|
|
|
<a-form ref="formRef" :model="form" layout="vertical"> |
|
|
|
<a-form ref="formRef" :model="form" layout="vertical" :rules="rules"> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="所属项目" name="projectName"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.projectName" |
|
|
|
:options="projectNameOptions" |
|
|
|
placeholder="请选择" |
|
|
|
:fieldNames="{ |
|
|
|
label: 'projectName', |
|
|
|
value: 'projectName', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="合同名称" name="contractName"> |
|
|
@ -8,7 +24,7 @@ |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<!-- <a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="父级合同" name="contractParent"> |
|
|
|
<a-select |
|
|
@ -18,7 +34,7 @@ |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</a-row> --> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="合同编号" name="contractCode"> |
|
|
@ -31,8 +47,13 @@ |
|
|
|
<a-form-item label="合同类别" name="contractType"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.contractType" |
|
|
|
:options="projectNameOptions" |
|
|
|
:options="contractTypeOptions" |
|
|
|
placeholder="请选择" |
|
|
|
:fieldNames="{ |
|
|
|
label: 'typeName', |
|
|
|
value: 'id', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
@ -40,8 +61,13 @@ |
|
|
|
<a-form-item label="所属区域" name="district"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.district" |
|
|
|
:options="projectNameOptions" |
|
|
|
:options="districtOptions" |
|
|
|
placeholder="请选择" |
|
|
|
:fieldNames="{ |
|
|
|
label: 'districtName', |
|
|
|
value: 'districtName', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
@ -75,8 +101,13 @@ |
|
|
|
<a-form-item label="甲方单位" name="partyA"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.partyA" |
|
|
|
:options="projectNameOptions" |
|
|
|
:options="partyAOptions" |
|
|
|
placeholder="请选择" |
|
|
|
:fieldNames="{ |
|
|
|
label: 'partyName', |
|
|
|
value: 'partyName', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
@ -91,8 +122,13 @@ |
|
|
|
<a-form-item label="乙方单位" name="partyB"> |
|
|
|
<a-select |
|
|
|
v-model:value="form.partyB" |
|
|
|
:options="projectNameOptions" |
|
|
|
:options="partyBOptions" |
|
|
|
placeholder="请选择" |
|
|
|
:fieldNames="{ |
|
|
|
label: 'partyName', |
|
|
|
value: 'partyName', |
|
|
|
options: 'options', |
|
|
|
}" |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
@ -136,7 +172,15 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { reactive, ref } from 'vue'; |
|
|
|
import { getInfo, add, update } from './api'; |
|
|
|
import { |
|
|
|
getInfo, |
|
|
|
add, |
|
|
|
update, |
|
|
|
getPartyInfo, |
|
|
|
getDistrictInfo, |
|
|
|
getProjectInfo, |
|
|
|
getContractType, |
|
|
|
} from './api'; |
|
|
|
import { message } from 'ant-design-vue'; |
|
|
|
|
|
|
|
export default { |
|
|
@ -146,38 +190,42 @@ |
|
|
|
const visible = ref(false); |
|
|
|
const filelists = ref([]); |
|
|
|
let form = reactive({ |
|
|
|
projectName: null, |
|
|
|
contractName: '', |
|
|
|
contractCode: '', |
|
|
|
contractParent: '', |
|
|
|
contractType: '', |
|
|
|
district: '', |
|
|
|
// contractParent: '', |
|
|
|
contractType: null, |
|
|
|
district: null, |
|
|
|
contractPrice: '', |
|
|
|
signDate: '', |
|
|
|
contractDuration: [], |
|
|
|
partyA: '', |
|
|
|
partyA: null, |
|
|
|
partyAPerson: '', |
|
|
|
partyB: '', |
|
|
|
partyB: null, |
|
|
|
partyBPerson: '', |
|
|
|
contractContent: '', |
|
|
|
remark: '', |
|
|
|
attachment: [], |
|
|
|
attachment: null, |
|
|
|
id: null, |
|
|
|
}); |
|
|
|
//下拉框 |
|
|
|
const projectNameOptions = [ |
|
|
|
{ |
|
|
|
value: '1', |
|
|
|
label: 'a', |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: '2', |
|
|
|
label: 'b', |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: '3', |
|
|
|
label: 'c', |
|
|
|
}, |
|
|
|
]; |
|
|
|
const projectNameOptions = ref([]); |
|
|
|
const contractTypeOptions = ref([]); |
|
|
|
const partyAOptions = ref([]); |
|
|
|
const districtOptions = ref([]); |
|
|
|
const partyBOptions = ref([]); |
|
|
|
const getOptions = async () => { |
|
|
|
const res1 = await getPartyInfo(); |
|
|
|
partyAOptions.value = res1.rows.filter((item) => item.partyType == '甲方'); |
|
|
|
partyBOptions.value = res1.rows.filter((item) => item.partyType == '乙方'); |
|
|
|
const res2 = await getDistrictInfo(); |
|
|
|
districtOptions.value = res2; |
|
|
|
const res3 = await getProjectInfo(); |
|
|
|
projectNameOptions.value = res3; |
|
|
|
const res4 = await getContractType(); |
|
|
|
contractTypeOptions.value = res4.rows; |
|
|
|
}; |
|
|
|
getOptions(); |
|
|
|
const showModal = async (type, id) => { |
|
|
|
visible.value = true; |
|
|
|
if (type == 1) { |
|
|
@ -189,7 +237,6 @@ |
|
|
|
form[i] = data[i]; |
|
|
|
} |
|
|
|
form.contractDuration = [data.startDate, data.endDate]; |
|
|
|
form.attachment = data.attachment ? data.attachment : []; |
|
|
|
} |
|
|
|
}; |
|
|
|
const beforeUpload = async (file) => { |
|
|
@ -201,6 +248,22 @@ |
|
|
|
filelists.value = fileList; |
|
|
|
console.log(fileList); |
|
|
|
}; |
|
|
|
const rules = { |
|
|
|
projectName: [{ required: true, message: '请选择' }], |
|
|
|
contractName: [{ required: true, message: '请输入' }], |
|
|
|
contractCode: [{ required: true, message: '请输入' }], |
|
|
|
contractType: [{ required: true, message: '请选择' }], |
|
|
|
district: [{ required: true, message: '请选择' }], |
|
|
|
contractPrice: [{ required: true, message: '请输入' }], |
|
|
|
signDate: [{ required: true, message: '请选择' }], |
|
|
|
contractDuration: [{ required: true, message: '请选择' }], |
|
|
|
partyA: [{ required: true, message: '请选择' }], |
|
|
|
partyAPerson: [{ required: true, message: '请输入' }], |
|
|
|
partyB: [{ required: true, message: '请选择' }], |
|
|
|
partyBPerson: [{ required: true, message: '请输入' }], |
|
|
|
contractContent: [{ required: true, message: '请输入' }], |
|
|
|
remark: [{ required: true, message: '请输入' }], |
|
|
|
}; |
|
|
|
const handleOk = () => { |
|
|
|
formRef.value.validate().then((valid) => { |
|
|
|
if (valid) { |
|
|
@ -240,12 +303,17 @@ |
|
|
|
form, |
|
|
|
showModal, |
|
|
|
handleOk, |
|
|
|
projectNameOptions, |
|
|
|
formRef, |
|
|
|
closeModal, |
|
|
|
beforeUpload, |
|
|
|
importChange, |
|
|
|
filelists, |
|
|
|
projectNameOptions, |
|
|
|
contractTypeOptions, |
|
|
|
districtOptions, |
|
|
|
partyAOptions, |
|
|
|
partyBOptions, |
|
|
|
rules, |
|
|
|
}; |
|
|
|
}, |
|
|
|
}; |
|
|
|