|
@@ -5,7 +5,10 @@
|
|
|
|
|
|
<el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="formReadOnly"
|
|
|
label-width="135px" @submit.native.prevent>
|
|
|
- <el-divider content-position="left"><i class="el-icon-document"></i> 选择合同</el-divider>
|
|
|
+ <el-divider v-if="commonJS.isNotEmpty(inputForm.contractId) && formReadOnly" content-position="left">
|
|
|
+ <el-link type="primary" :underline="false" icon="el-icon-document" @click="viewContract(inputForm.contractId)">查看合同详情</el-link>
|
|
|
+ </el-divider>
|
|
|
+ <el-divider v-else content-position="left"><i class="el-icon-document"></i> 选择合同</el-divider>
|
|
|
<el-row :gutter="15">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="合同名称" prop="contractName"
|
|
@@ -149,35 +152,54 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+<!-- <el-col :span="12">-->
|
|
|
+<!-- <el-form-item label="项目预计开始时间" prop="planStartDate"-->
|
|
|
+<!-- :rules="[-->
|
|
|
+<!-- {required: true, message:'项目预计开始时间不能为空', trigger:'blur'}-->
|
|
|
+<!-- ]">-->
|
|
|
+<!-- <el-date-picker-->
|
|
|
+<!-- v-model="inputForm.planStartDate"-->
|
|
|
+<!-- type="date"-->
|
|
|
+<!-- value-format="yyyy-MM-dd"-->
|
|
|
+<!-- placeholder="选择项目预计开始时间"-->
|
|
|
+<!-- style="width:100%"-->
|
|
|
+<!-- placement="bottom-start"-->
|
|
|
+<!-- clearable>-->
|
|
|
+<!-- </el-date-picker>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="12">-->
|
|
|
+<!-- <el-form-item label="项目预计结束时间" prop="planEndDate"-->
|
|
|
+<!-- :rules="[-->
|
|
|
+<!-- {required: true, message:'项目预计结束时间不能为空', trigger:'blur'}-->
|
|
|
+<!-- ]">-->
|
|
|
+<!-- <el-date-picker-->
|
|
|
+<!-- v-model="inputForm.planEndDate"-->
|
|
|
+<!-- type="date"-->
|
|
|
+<!-- value-format="yyyy-MM-dd"-->
|
|
|
+<!-- placeholder="选择项目预计结束时间"-->
|
|
|
+<!-- style="width:100%"-->
|
|
|
+<!-- placement="bottom-start"-->
|
|
|
+<!-- clearable>-->
|
|
|
+<!-- </el-date-picker>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="项目预计开始时间" prop="planStartDate"
|
|
|
+ <el-form-item label="项目预计时间" prop="planDate"
|
|
|
:rules="[
|
|
|
- {required: true, message:'项目预计开始时间不能为空', trigger:'blur'}
|
|
|
+ {required: true, message:'项目预计时间不能为空', trigger:'blur'}
|
|
|
]">
|
|
|
<el-date-picker
|
|
|
- v-model="inputForm.planStartDate"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- placeholder="选择项目预计开始时间"
|
|
|
- style="width:100%"
|
|
|
- placement="bottom-start"
|
|
|
- clearable>
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="项目预计结束时间" prop="planEndDate"
|
|
|
- :rules="[
|
|
|
- {required: true, message:'项目预计结束时间不能为空', trigger:'blur'}
|
|
|
- ]">
|
|
|
- <el-date-picker
|
|
|
- v-model="inputForm.planEndDate"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- placeholder="选择项目预计结束时间"
|
|
|
- style="width:100%"
|
|
|
+ style="width: 100%"
|
|
|
placement="bottom-start"
|
|
|
- clearable>
|
|
|
+ format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ v-model="inputForm.planDate"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ @change="forUpdate"
|
|
|
+ end-placeholder="结束日期">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -237,21 +259,21 @@
|
|
|
highlight-current-row
|
|
|
:edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: false}"
|
|
|
>
|
|
|
- <vxe-table-column align="center" field="no" title="客户编号" :edit-render="{}">
|
|
|
- <template v-slot:edit="scope">
|
|
|
- <el-input :readonly="true" v-model="scope.row.no" placeholder="客户编号" clearable></el-input>
|
|
|
- </template>
|
|
|
- </vxe-table-column>
|
|
|
<vxe-table-column align="center" field="name" title="客户名称" :edit-render="{}">
|
|
|
<template v-slot:edit="scope">
|
|
|
<el-input :readonly="true" v-model="scope.row.name" placeholder="客户名称" clearable></el-input>
|
|
|
</template>
|
|
|
</vxe-table-column>
|
|
|
- <vxe-table-column align="center" field="companyLevel" title="层级" :edit-render="{}">
|
|
|
+ <vxe-table-column align="center" field="no" title="客户编号" :edit-render="{}">
|
|
|
<template v-slot:edit="scope">
|
|
|
- <el-input :readonly="true" v-model="scope.row.companyLevel" placeholder="层级" clearable></el-input>
|
|
|
+ <el-input :readonly="true" v-model="scope.row.no" placeholder="客户编号" clearable></el-input>
|
|
|
</template>
|
|
|
</vxe-table-column>
|
|
|
+<!-- <vxe-table-column align="center" field="companyLevel" title="层级" :edit-render="{}">-->
|
|
|
+<!-- <template v-slot:edit="scope">-->
|
|
|
+<!-- <el-input :readonly="true" v-model="scope.row.companyLevel" placeholder="层级" clearable></el-input>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </vxe-table-column>-->
|
|
|
<vxe-table-column align="center" title="操作" width="100">
|
|
|
<template v-slot="scope">
|
|
|
<el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'client')">删除</el-button>
|
|
@@ -272,6 +294,7 @@
|
|
|
<WorkContractChooseCom ref="workContractChooseCom" @getContract="getContract"></WorkContractChooseCom>
|
|
|
<WorkClientChooseForm ref="workClientChooseForm" @getWorkClientChoose="getWorkClientChoose"></WorkClientChooseForm>
|
|
|
<CwProjectBusinessTypeListForm ref="cwProjectBusinessTypeListForm" @getBusinessType="getBusinessType"></CwProjectBusinessTypeListForm>
|
|
|
+ <ContractNameForm ref="contractNameForm"></ContractNameForm>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -285,6 +308,9 @@
|
|
|
import WorkClientChooseForm from '../workClientInfo/WorkClientChooseForm'
|
|
|
import WorkContractChooseCom from './WorkContractChooseCom'
|
|
|
import CwProjectBusinessTypeListForm from '@/views/modules/cw/projectBusinessType/CwProjectBusinessTypeListForm'
|
|
|
+ import ContractNameForm from '../workContract/ContractNameForm'
|
|
|
+ import WorkClientService from '@/api/cw/workClientInfo/WorkClientService'
|
|
|
+ import ContractInfoService from '@/api/cw/workContract/ContractInfoService'
|
|
|
export default {
|
|
|
props: {
|
|
|
businessId: {
|
|
@@ -335,7 +361,8 @@
|
|
|
contractId: '',
|
|
|
businessType: '',
|
|
|
riskLevel: '',
|
|
|
- businessTypeName: ''
|
|
|
+ businessTypeName: '',
|
|
|
+ planDate: []
|
|
|
},
|
|
|
keyWatch: '',
|
|
|
activeName: 'client',
|
|
@@ -345,9 +372,13 @@
|
|
|
},
|
|
|
projectRecordsService: null,
|
|
|
enterpriseSearchService: null,
|
|
|
+ workClientService: null,
|
|
|
+ contractInfoService: null,
|
|
|
created () {
|
|
|
this.enterpriseSearchService = new EnterpriseSearchService()
|
|
|
this.projectRecordsService = new ProjectRecordsService()
|
|
|
+ this.workClientService = new WorkClientService()
|
|
|
+ this.contractInfoService = new ContractInfoService()
|
|
|
},
|
|
|
computed: {
|
|
|
bus: {
|
|
@@ -380,12 +411,16 @@
|
|
|
UserSelect,
|
|
|
WorkClientChooseForm,
|
|
|
WorkContractChooseCom,
|
|
|
- CwProjectBusinessTypeListForm
|
|
|
+ CwProjectBusinessTypeListForm,
|
|
|
+ ContractNameForm
|
|
|
},
|
|
|
methods: {
|
|
|
getKeyWatch (keyWatch) {
|
|
|
this.keyWatch = keyWatch
|
|
|
},
|
|
|
+ forUpdate () {
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
init (method, id) {
|
|
|
this.activeName = 'client'
|
|
|
this.projectRecordsService = new ProjectRecordsService()
|
|
@@ -420,7 +455,8 @@
|
|
|
contractId: '',
|
|
|
businessType: '',
|
|
|
riskLevel: '',
|
|
|
- businessTypeName: ''
|
|
|
+ businessTypeName: '',
|
|
|
+ planDate: []
|
|
|
}
|
|
|
this.inputForm.id = id
|
|
|
this.loading = false
|
|
@@ -467,17 +503,18 @@
|
|
|
this.doSubmit('save', callback)
|
|
|
},
|
|
|
startForm (callback) {
|
|
|
- if (this.commonJS.isNotEmpty(this.inputForm.planEndDate) && this.commonJS.isNotEmpty(this.inputForm.planStartDate)) {
|
|
|
- if (this.moment(this.inputForm.planEndDate).format('YYYY-MM-DD') < this.moment(this.inputForm.planStartDate).format('YYYY-MM-DD') || this.moment(this.inputForm.planEndDate).format('YYYY-MM-DD') === this.moment(this.inputForm.planStartDate).format('YYYY-MM-DD')) {
|
|
|
- this.$message.error('项目预计开始时间要小于项目预计结束时间')
|
|
|
- this.loading = false
|
|
|
- throw new Error('项目预计开始时间要小于项目预计结束时间')
|
|
|
- } else {
|
|
|
- this.doSubmit('start', callback)
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.doSubmit('start', callback)
|
|
|
- }
|
|
|
+ // if (this.commonJS.isNotEmpty(this.inputForm.planEndDate) && this.commonJS.isNotEmpty(this.inputForm.planStartDate)) {
|
|
|
+ // if (this.moment(this.inputForm.planEndDate).format('YYYY-MM-DD') < this.moment(this.inputForm.planStartDate).format('YYYY-MM-DD') || this.moment(this.inputForm.planEndDate).format('YYYY-MM-DD') === this.moment(this.inputForm.planStartDate).format('YYYY-MM-DD')) {
|
|
|
+ // this.$message.error('项目预计开始时间要小于项目预计结束时间')
|
|
|
+ // this.loading = false
|
|
|
+ // throw new Error('项目预计开始时间要小于项目预计结束时间')
|
|
|
+ // } else {
|
|
|
+ // this.doSubmit('start', callback)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.doSubmit('start', callback)
|
|
|
+ // }
|
|
|
+ this.doSubmit('start', callback)
|
|
|
},
|
|
|
async agreeForm (callback) {
|
|
|
await this.projectRecordsService.queryById(this.inputForm.id).then(({data}) => {
|
|
@@ -499,6 +536,13 @@
|
|
|
this.loading = false
|
|
|
return
|
|
|
}
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.planDate)) {
|
|
|
+ this.inputForm.planStartDate = this.inputForm.planDate[0]
|
|
|
+ this.inputForm.planEndDate = this.inputForm.planDate[1]
|
|
|
+ } else {
|
|
|
+ this.inputForm.planStartDate = ''
|
|
|
+ this.inputForm.planEndDate = ''
|
|
|
+ }
|
|
|
this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
|
|
|
this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
|
|
|
this.projectRecordsService.saveForm(this.inputForm).then(({data}) => {
|
|
@@ -520,10 +564,17 @@
|
|
|
this.$refs['inputForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error('“被服务单位”中至少填写一条信息')
|
|
|
+ throw new Error('“被服务单位”中至少填写一条信息')
|
|
|
+ }
|
|
|
if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
this.loading = false
|
|
|
- return
|
|
|
+ throw new Error()
|
|
|
}
|
|
|
+ this.inputForm.planStartDate = this.inputForm.planDate[0]
|
|
|
+ this.inputForm.planEndDate = this.inputForm.planDate[1]
|
|
|
this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
|
|
|
if (this.commonJS.isEmpty(this.inputForm.createDate)) {
|
|
|
this.inputForm.createDate = this.moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
|
|
@@ -594,7 +645,8 @@
|
|
|
contractId: '',
|
|
|
businessType: '',
|
|
|
riskLevel: '',
|
|
|
- businessTypeName: ''
|
|
|
+ businessTypeName: '',
|
|
|
+ planDate: []
|
|
|
}
|
|
|
this.$refs.uploadComponent.clearUpload()
|
|
|
this.$refs.inputForm.resetFields()
|
|
@@ -626,6 +678,7 @@
|
|
|
this.inputForm.cwProjectClientInfoDTOList.splice(rowIndex, 1)
|
|
|
}
|
|
|
},
|
|
|
+ // 打开客户选择组件
|
|
|
openWorkClient () {
|
|
|
this.$refs.workClientChooseForm.init()
|
|
|
},
|
|
@@ -657,13 +710,68 @@
|
|
|
})
|
|
|
},
|
|
|
getContract (row) {
|
|
|
- this.inputForm.contractName = row.contractName
|
|
|
- this.inputForm.contractAmount = row.contractAmount
|
|
|
- this.inputForm.contractNum = row.contractNum
|
|
|
- this.inputForm.payerSubject = row.payerSubject
|
|
|
- this.inputForm.paymentMethod = row.paymentMethod
|
|
|
- this.inputForm.contractId = row.id
|
|
|
+ // 首先删除之前合同与被服务单位的关联(委托方联系人)
|
|
|
+ let _this = this
|
|
|
+ const waitDelClient = function () {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (_this.commonJS.isNotEmpty(_this.inputForm.contractId)) {
|
|
|
+ // 根据合同id查询合同信息
|
|
|
+ _this.contractInfoService.findById(_this.inputForm.contractId).then(({data}) => {
|
|
|
+ if (_this.commonJS.isNotEmpty(data.customerId)) {
|
|
|
+ // 根据合同的委托人联系人id查询客户信息
|
|
|
+ _this.workClientService.queryById(data.customerId).then((client) => {
|
|
|
+ if (_this.commonJS.isNotEmpty(client.data.no)) {
|
|
|
+ // 将被服务单位中与合同委托人联系人相同删除
|
|
|
+ _this.inputForm.cwProjectClientInfoDTOList.forEach((item, index) => {
|
|
|
+ if (item.no === client.data.no) {
|
|
|
+ _this.$refs.clientTable.remove(item)
|
|
|
+ _this.inputForm.cwProjectClientInfoDTOList.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ waitDelClient().then(() => {
|
|
|
+ this.inputForm.contractName = row.contractName
|
|
|
+ this.inputForm.contractAmount = row.contractAmount
|
|
|
+ this.inputForm.contractNum = row.contractNum
|
|
|
+ this.inputForm.payerSubject = row.payerSubject
|
|
|
+ this.inputForm.paymentMethod = row.paymentMethod
|
|
|
+ this.inputForm.contractId = row.id
|
|
|
+ if (this.commonJS.isNotEmpty(row.clientContacts)) {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.cwProjectClientInfoDTOList)) {
|
|
|
+ this.inputForm.cwProjectClientInfoDTOList = []
|
|
|
+ }
|
|
|
+ this.workClientService.queryById(row.clientContacts).then((data) => {
|
|
|
+ if (this.commonJS.isNotEmpty(data.data.id)) {
|
|
|
+ let _data = data.data
|
|
|
+ const waitForEach = function () {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ _this.inputForm.cwProjectClientInfoDTOList.forEach(client => {
|
|
|
+ if (_data.no === client.no) {
|
|
|
+ // _this.$message.error('已存在客户 “' + client.name + '”')
|
|
|
+ throw new Error('已存在客户 “' + client.name + '”')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ waitForEach().then(() => {
|
|
|
+ this.$refs.clientTable.insertAt(data.data)
|
|
|
+ this.inputForm.cwProjectClientInfoDTOList.push(data.data)
|
|
|
+ this.tableKeyClient = Math.random()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
+ // 打开合同选择组件
|
|
|
openContract () {
|
|
|
this.$refs.workContractChooseCom.init()
|
|
|
},
|
|
@@ -671,8 +779,13 @@
|
|
|
this.inputForm.businessType = row.id
|
|
|
this.inputForm.businessTypeName = row.name
|
|
|
},
|
|
|
+ // 打开业务类型选择组件
|
|
|
openBusinessTypeForm () {
|
|
|
this.$refs.cwProjectBusinessTypeListForm.init()
|
|
|
+ },
|
|
|
+ // 查看合同详情
|
|
|
+ viewContract (id) {
|
|
|
+ this.$refs.contractNameForm.init('view', id)
|
|
|
}
|
|
|
}
|
|
|
}
|