update 起草组报名页面完善、工作组和起草组联系人完善(未完成)
This commit is contained in:
@@ -9,14 +9,30 @@
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
|
||||
<a-form :form="form">
|
||||
<a-row v-if="defaultChargeWay">
|
||||
<a-col>
|
||||
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-select
|
||||
placeholder="请选择工作组项目"
|
||||
show-search
|
||||
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
|
||||
:maxLength='50'
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option v-for="item in workingGroupList" :key="item.id" :value="item.id">
|
||||
{{ item.workingGroupProject }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="成员单位" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<company-select placeholder="请选择成员单位"
|
||||
v-decorator="['chargeCompany',validatorRules.chargeCompany]"
|
||||
:disabled="disabledCompany"
|
||||
disabled
|
||||
@change="companyChange"
|
||||
:maxLength='50'>
|
||||
</company-select>
|
||||
@@ -68,6 +84,19 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="备注" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-textarea
|
||||
placeholder="请输入备注"
|
||||
:auto-size="{ minRows: 3, maxRows: 6 }"
|
||||
v-decorator="['remarks']"
|
||||
:maxLength='200'
|
||||
disabled
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
@@ -75,14 +104,62 @@
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {httpAction} from '@api/manage'
|
||||
import SelectContacts from '@comp/company/SelectContacts'
|
||||
import {getAction, postAction} from '@api/manage'
|
||||
import CompanySelect from '@comp/company/CompanySelect'
|
||||
import SelectContacts from '@comp/company/SelectContacts'
|
||||
import { getWorkingGroupListByNotCompany } from '@/api/incomePaymentsApi'
|
||||
import { addZero } from '../../../utils/util'
|
||||
|
||||
export default {
|
||||
name: 'WorkTeamModal',
|
||||
components: {CompanySelect, SelectContacts},
|
||||
data () {
|
||||
components: { CompanySelect, SelectContacts },
|
||||
props: {
|
||||
// 默认来款方式(收入合同新增工作组项目,来款方式默认为2--合同)
|
||||
defaultChargeWay: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
// 收入合同关联时传入的企业信息,不可修改
|
||||
defaultChargeCompany: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
// 是否可以修改来款企业
|
||||
disabledChargeCompany: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
// 收入合同新增项目时带入合同号且不可修改
|
||||
defaultContractNum: {
|
||||
type: String,
|
||||
requirde: false,
|
||||
default: null
|
||||
},
|
||||
// 合同号是否可编辑
|
||||
isContractNumDisabled: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
// 企业的签订联系人id,收入合同新增企业联系人、邮寄联系人默认为签订联系人
|
||||
signedContactId: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: undefined
|
||||
},
|
||||
// 收入合同新增时为1
|
||||
flag: {
|
||||
type: Number,
|
||||
requirded: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '操作',
|
||||
width: 800,
|
||||
@@ -115,10 +192,6 @@ export default {
|
||||
rules: [{ required: true, validator: this.checkCompany }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
taxRate: {
|
||||
rules: [{ required: true, message: '请选择税率' }],
|
||||
validateTrigger: 'change', initialValue: '0.06'
|
||||
},
|
||||
contactsIdOne: {
|
||||
rules: [{ required: true, message: '请选择企业联系人1' }],
|
||||
validateTrigger: 'change'
|
||||
@@ -130,15 +203,29 @@ export default {
|
||||
mailContactsId: {
|
||||
rules: [{ required: true, message: '请选择邮寄联系人' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
chargeWay: {
|
||||
rules: [{ required: true, message: '请选择来款方式' }],
|
||||
validateTrigger: 'change'
|
||||
}
|
||||
},
|
||||
chargeWayType: null,
|
||||
selectedCompany: null, // 当前选中的企业
|
||||
selectedContact1: null, // 编辑时的联系人
|
||||
selectedContact2: null, // 编辑时的联系人
|
||||
selectedContact3: null, // 编辑时的联系人
|
||||
selectedMailContact: null, // 编辑时的邮寄联系人
|
||||
selectedChargeNotice: null, // 选中的收费通知号
|
||||
workingGroupId: null,
|
||||
disabledCompany: true, // 企业是否禁用
|
||||
workingGroupList: [],
|
||||
// hasContactOne: false, // 是否选择联系人1
|
||||
// hasContactTwo: false, // 是否选择联系人2
|
||||
// hasContactThree: false, // 是否选择联系人3
|
||||
url: {
|
||||
info: '',
|
||||
// add: '/project/payWorkingGroupSubitem/add',
|
||||
edit: '/project/payWorkingGroupSubitem/editCompany'
|
||||
},
|
||||
// 默认的联系人数据
|
||||
defaultPayWorkingGroupSubItemContact: {
|
||||
contactsId: undefined,
|
||||
@@ -148,20 +235,70 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
add() {
|
||||
this.edit({})
|
||||
},
|
||||
edit(record) {
|
||||
console.log(record)
|
||||
// 回显选中的企业
|
||||
record.chargeCompany = {
|
||||
id: record.chargeCompanyId,
|
||||
companyName: record.chargeCompanyTemporaryName
|
||||
// 判断默认来款用途是否为合同(收入合同新增)
|
||||
if (this.defaultChargeWay) {
|
||||
this.loadWorkingGroupList()
|
||||
this.chargeWayType = 2
|
||||
}
|
||||
// 判断是否存在默认合同号(收入合同新增)
|
||||
if (this.defaultContractNum && this.defaultContractNum !== '') {
|
||||
this.model.contractNum = this.defaultContractNum
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'contractNum'))
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取工作组列表
|
||||
*/
|
||||
loadWorkingGroupList() {
|
||||
let param = {
|
||||
companyId: this.defaultChargeCompany.id
|
||||
}
|
||||
getWorkingGroupListByNotCompany(param).then(res => {
|
||||
if (res.success) {
|
||||
this.workingGroupList = res.result
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
async edit(record) {
|
||||
// this.confirmLoading = true
|
||||
// this.visible = true
|
||||
// const res = await getAction(this.url.info, {
|
||||
// id: record.id,
|
||||
// draftingGroupId: record.draftingGroupId
|
||||
// })
|
||||
// this.confirmLoading = false
|
||||
// record = res.result || record
|
||||
// 存在默认选中企业时显示默认企业
|
||||
if (this.defaultChargeCompany.hasOwnProperty.call(this.defaultChargeCompany, 'id')) {
|
||||
record.chargeCompany = {
|
||||
id: this.defaultChargeCompany.id,
|
||||
companyName: this.defaultChargeCompany.companyName
|
||||
}
|
||||
} else {
|
||||
record.chargeCompany = {
|
||||
id: record.chargeCompanyId,
|
||||
companyName: record.chargeCompanyTemporaryName
|
||||
}
|
||||
}
|
||||
// 回显选中的企业
|
||||
this.selectedCompany = record.chargeCompany
|
||||
this.companyChange(this.selectedCompany)
|
||||
this.form.resetFields()
|
||||
record.contractNum = record.contractNum || undefined
|
||||
this.model = Object.assign({}, JSON.parse(JSON.stringify(record)))
|
||||
// 是否存在从收入合同传入的签订联系人id
|
||||
this.model.contactsIdOne = this.signedContactId || this.model.contactsTemporaryIdOne || undefined
|
||||
this.model.contactsIdTwo = this.model.contactsTemporaryIdTwo || undefined
|
||||
this.model.contactsIdThree = this.model.contactsTemporaryIdThree || undefined
|
||||
// 是否存在从收入合同传入的签订联系人id
|
||||
this.model.mailContactsId = this.signedContactId || this.model.mailContactsTemporaryId || undefined
|
||||
if (this.model.id) {
|
||||
// 传给组件的init-contact值,需要id和name两个属性
|
||||
this.model.payWorkingGroupSubItemContactsList && this.model.payWorkingGroupSubItemContactsList.forEach(item => {
|
||||
@@ -178,13 +315,15 @@ export default {
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
}
|
||||
this.chargeWayType = record.chargeWay
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId'))
|
||||
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId', 'chargeWay', 'charge', 'receivableAmount', 'taxRate', 'tax', 'noTaxAmount', 'estimatedArrivalDate', 'contractNum', 'receivableAmount', 'chargeNoticeId', 'needInvoice', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payWorkingGroupSubItemContactsList'))
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
this.chargeWayType = null
|
||||
this.selectedCompany = null
|
||||
// 清除选中联系人信息
|
||||
this.selectedContact1 = null
|
||||
@@ -193,7 +332,7 @@ export default {
|
||||
this.selectedMailContact = null
|
||||
// 清除企业、来款方式、合同号的限制
|
||||
this.isAssociatedContract = false
|
||||
// this.disabledCompany = false
|
||||
this.disabledCompany = false
|
||||
// 清除联系人备注信息
|
||||
// this.hasContactOne = false
|
||||
// this.hasContactTwo = false
|
||||
@@ -206,16 +345,21 @@ export default {
|
||||
if (this.confirmLoading) {
|
||||
return
|
||||
}
|
||||
// this.confirmLoading = true
|
||||
this.confirmLoading = true
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
// that.confirmLoading = true
|
||||
that.confirmLoading = true
|
||||
// 收入合同新建项目手动赋值
|
||||
if (this.defaultChargeWay === 2) {
|
||||
values.chargeWay = 2
|
||||
}
|
||||
if (this.flag === 1) {
|
||||
values.flag = this.flag
|
||||
}
|
||||
values.chargeCompanyTemporaryName = values.chargeCompany.companyName
|
||||
values.chargeCompanyId = values.chargeCompany.id
|
||||
let httpurl = '/project/payWorkingGroupSubitem/editCompany'
|
||||
let method = 'post'
|
||||
if (this.workingGroupId) {
|
||||
values.workingGroupId = this.workingGroupId
|
||||
}
|
||||
@@ -226,8 +370,7 @@ export default {
|
||||
}
|
||||
const formData = Object.assign(this.model, values, obj)
|
||||
console.log('表单提交数据', formData)
|
||||
return
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
postAction(this.url.edit, formData).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message)
|
||||
that.$emit('ok')
|
||||
@@ -248,54 +391,6 @@ export default {
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
validateContactRequired(rule, value, callback) {
|
||||
if (value) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择企业联系人1')
|
||||
},
|
||||
/**
|
||||
* 在新增成功后重新获取联系人列表
|
||||
*/
|
||||
addContactsOneOk() {
|
||||
this.$refs.selectMailContacts.getContactsList()
|
||||
},
|
||||
addMailContactsOk() {
|
||||
this.$refs.selectContacts1.getContactsList()
|
||||
this.$refs.selectContacts2.getContactsList()
|
||||
this.$refs.selectContacts3.getContactsList()
|
||||
},
|
||||
/**
|
||||
* 校验企业联系人是否重复
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
validateContact(rule, value, callback) {
|
||||
if (value) {
|
||||
let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择不同的联系人')
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
/**
|
||||
* 企业必填校验
|
||||
* @param rules
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
checkCompany(rules, value, callback) {
|
||||
if (value.id && value.companyName) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
callback('请选择成员单位')
|
||||
},
|
||||
/**
|
||||
* 选中企业变化,将联系人的值清空
|
||||
* @param value
|
||||
@@ -316,10 +411,59 @@ export default {
|
||||
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
|
||||
this.model.mailContactsId = undefined
|
||||
this.selectedMailContact = null
|
||||
this.model.contractNum = undefined
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'mailContactsId', 'payWorkingGroupSubItemContactsList'))
|
||||
this.form.setFieldsValue(pick(this.model, 'mailContactsId', 'contractNum', 'payWorkingGroupSubItemContactsList'))
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 企业必填校验
|
||||
* @param rules
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
checkCompany(rules, value, callback) {
|
||||
if (value.id && value.companyName) {
|
||||
callback()
|
||||
return
|
||||
}
|
||||
callback('请选择成员单位')
|
||||
},
|
||||
/**
|
||||
* 在新增成功后重新获取联系人列表
|
||||
*/
|
||||
addContactsOneOk() {
|
||||
this.$refs.selectMailContacts.getContactsList()
|
||||
},
|
||||
addMailContactsOk() {
|
||||
this.$refs.selectContacts1.getContactsList()
|
||||
this.$refs.selectContacts2.getContactsList()
|
||||
this.$refs.selectContacts3.getContactsList()
|
||||
},
|
||||
validateContactRequired(rule, value, callback) {
|
||||
if (value) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择企业联系人1')
|
||||
},
|
||||
/**
|
||||
* 校验企业联系人是否重复
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
validateContact(rule, value, callback) {
|
||||
if (value) {
|
||||
let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
|
||||
let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择不同的联系人')
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
/**
|
||||
* 企业联系人1、邮寄联系人联动
|
||||
* @param value
|
||||
|
||||
Reference in New Issue
Block a user