update 起草组成员信息对接

This commit is contained in:
danshihao
2024-01-08 17:51:48 +08:00
parent 96e9b1275f
commit 8fca138b5c
4 changed files with 69 additions and 633 deletions
@@ -1,6 +1,6 @@
<template>
<div>
<page-header-title :is-level-one="false" :level-two-title="workingGroupProject"></page-header-title>
<page-header-title :is-level-one="false" :level-two-title="draftingGroupProject"></page-header-title>
<a-card :bordered="false">
<div class="part-title">
<div class="part-title-text">起草组信息</div>
@@ -13,18 +13,18 @@
:key="index">
<div class="work-group-detail-item-title">{{ item.title }}</div>
<div class="work-group-detail-item-content work-group-detail-item-filename"
v-if="(item.fieldName === 'chargeNoticeAId' || item.fieldName === 'chargeNoticeBId') && workingGroupDetail[item.fieldName]">
<preview-file :file-id="workingGroupDetail[item.fieldName]"></preview-file>
v-if="(item.fieldName === 'chargeNoticeAId' || item.fieldName === 'chargeNoticeBId') && draftingGroupDetail[item.fieldName]">
<preview-file :file-id="draftingGroupDetail[item.fieldName]"></preview-file>
</div>
<div class="work-group-detail-item-content" v-else>{{ workingGroupDetail[item.fieldName] }}</div>
<div class="work-group-detail-item-content" v-else>{{ draftingGroupDetail[item.fieldName] }}</div>
</div>
<div class="work-group-detail-item">
<div class="work-group-detail-item-title">任务及目标</div>
<div class="work-group-detail-item-content">{{ workingGroupDetail.missionAndObjectives }}</div>
<div class="work-group-detail-item-content">{{ draftingGroupDetail.missionAndObjectives }}</div>
</div>
<div class="work-group-detail-item">
<div class="work-group-detail-item-title">备注</div>
<div class="work-group-detail-item-content">{{ workingGroupDetail.remarks }}</div>
<div class="work-group-detail-item-content">{{ draftingGroupDetail.remarks }}</div>
</div>
</div>
</a-spin>
@@ -146,29 +146,19 @@
<project-detail-modal ref="projectDetail"></project-detail-modal>
<drafting-group-member-unit-module ref="modalForm" @ok="modalFormOk"></drafting-group-member-unit-module>
<drafting-group-member-set-charge-notice ref="setChargeNotic"
@ok="modalFormOk"></drafting-group-member-set-charge-notice>
<email-error-msg-modal ref="emailError"></email-error-msg-modal>
<drafting-group-set-label ref="workGroupSetLabel" @ok="modalFormOk"></drafting-group-set-label>
</div>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JYearDate from '@comp/jero/JYearDate'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import { getWorkingGroupById, dunningReminder } from '@api/incomePaymentsApi'
import {getDraftingGroupById} from '@api/incomePaymentsApi'
import StatusSlot from '../../components/tools/StatusSlot'
import ProjectDetailModal from '../../components/ProjectDetailModal'
import DraftingGroupMemberUnitModule from './modules/DraftingGroupMemberUnitModule'
import DraftingGroupMemberSetChargeNotice from './modules/DraftingGroupMemberSetChargeNotice'
import Vue from 'vue'
import { ACCESS_TOKEN } from '../../store/mutation-types'
import PreviewFile from '../../components/jero/PreviewFile'
import DraftingGroupSetLabel from '@views/draftingGroup/modules/DraftingGroupSetLabel'
import EmailErrorMsgModal from '../projectManagement/modules/EmailErrorMsgModal'
// eslint-disable-next-line no-undef,no-unused-vars
const Base64 = require('js-base64').Base64
@@ -176,15 +166,11 @@ const Base64 = require('js-base64').Base64
export default {
name: 'DraftingGroupMemberUnitMaintenance',
components: {
JYearDate,
PageHeaderTitle,
StatusSlot,
ProjectDetailModal,
DraftingGroupMemberUnitModule,
DraftingGroupMemberSetChargeNotice,
PreviewFile,
EmailErrorMsgModal,
DraftingGroupSetLabel
PreviewFile
},
mixins: [JeroListMixin],
computed: {
@@ -195,16 +181,16 @@ export default {
data() {
return {
disableMixinCreated: true,
workingGroupProject: '',
workingGroupProjectId: '',
draftingGroupProject: '',
draftingGroupProjectId: '',
spinning: false,
detailTitleList: [
{
title: '起草组项目名称',
fieldName: 'workingGroupProject'
fieldName: 'draftingGroupProject'
},{
title: '关联工作组',
fieldName: 'workingGroupProject'
fieldName: 'workingGroupName'
}, {
title: '负责人A',
fieldName: 'principalNameA'
@@ -228,12 +214,12 @@ export default {
sm: { span: 10 }
},
url: {
list: '/project/payWorkingGroupSubitem/list',
delete: '/project/payWorkingGroupSubitem/delete',
deleteBatch: '/project/payWorkingGroupSubitem/deleteBatch',
exportXlsUrl: '/project/payWorkingGroupSubitem/exportXls',
importExcelUrl: '/project/payWorkingGroupSubitem/importExcel',
downTemplateUrl: '/project/payWorkingGroupSubitem/downloadExcelModel'
list: '/drafting/payDraftingGroupSubitem/list',
delete: '/drafting/payDraftingGroupSubitem/delete',
deleteBatch: '/drafting/payDraftingGroupSubitem/deleteBatch',
exportXlsUrl: '/drafting/payDraftingGroupSubitem/exportXls',
importExcelUrl: '/drafting/payDraftingGroupSubitem/importExcel',
downTemplateUrl: '/drafting/payDraftingGroupSubitem/downloadExcelModel'
},
columns: [
{
@@ -334,7 +320,7 @@ export default {
scopedSlots: { customRender: 'action' }
}
],
workingGroupDetail: {},
draftingGroupDetail: {},
chargeNoticeList: [], // 收费通知号选项
importParam: {},
// 给定当年作为来款年份默认查询条件
@@ -357,18 +343,18 @@ export default {
*/
initWorkGroupData() {
this.spinning = true
this.workingGroupProject = this.$route.query.workingGroupProject || ''
this.workingGroupProjectId = this.$route.query.workingGroupProjectId || ''
this.draftingGroupProject = this.$route.query.draftingGroupProject || ''
this.draftingGroupProjectId = this.$route.query.draftingGroupProjectId || ''
this.canOperate = this.$route.query.canOperate === 'true' ? true : false
this.filters.workingGroupId = this.workingGroupProjectId
this.importParam.workGroupId = this.workingGroupProjectId
this.filters.draftingGroupId = this.draftingGroupProjectId
this.importParam.workGroupId = this.draftingGroupProjectId
this.loadData()
let param = {
id: this.workingGroupProjectId
id: this.draftingGroupProjectId
}
getWorkingGroupById(param).then(res => {
getDraftingGroupById(param).then(res => {
if (res.success) {
this.workingGroupDetail = res.result || {}
this.draftingGroupDetail = res.result || {}
}
}).finally(() => {
this.spinning = false
@@ -376,119 +362,17 @@ export default {
},
handleAdd: function () {
this.getChargeNoticeList()
this.$refs.modalForm.workingGroupId = this.workingGroupProjectId
this.$refs.modalForm.chargeNoticeList = this.chargeNoticeList
this.$refs.modalForm.draftingGroupId = this.draftingGroupProjectId
this.$refs.modalForm.add()
this.$refs.modalForm.title = '添加成员'
this.$refs.modalForm.disableSubmit = false
},
handleEdit: function (record) {
this.getChargeNoticeList()
this.$refs.modalForm.workingGroupId = this.workingGroupProjectId
this.$refs.modalForm.chargeNoticeList = this.chargeNoticeList
this.$refs.modalForm.draftingGroupId = this.draftingGroupProjectId
this.$refs.modalForm.edit(record)
this.$refs.modalForm.title = '编辑'
this.$refs.modalForm.disableSubmit = false
},
/**
* 获取收费通知列表
*/
getChargeNoticeList() {
this.chargeNoticeList = []
let chargeNoticeA, chargeNoticeB
// 是否存在收费通知A
if (this.workingGroupDetail.chargeNoticeNoA && this.workingGroupDetail.chargeNoticeNoA !== '') {
chargeNoticeA = {
type: 'chargeNoticeA',
label: `A${ this.workingGroupDetail.chargeNoticeNoA }`,
value: this.workingGroupDetail.chargeNoticeNoA,
key: this.workingGroupDetail.chargeA,
yearCharge: this.workingGroupDetail.yearChargeA,
chargeNoticeId: this.workingGroupDetail.chargeNoticeAId
}
this.chargeNoticeList.push(chargeNoticeA)
}
// 是否存在收费通知B
if (this.workingGroupDetail.chargeNoticeNoB && this.workingGroupDetail.chargeNoticeNoB !== '') {
chargeNoticeB = {
type: 'chargeNoticeB',
label: `B${ this.workingGroupDetail.chargeNoticeNoB }`,
value: this.workingGroupDetail.chargeNoticeNoB,
key: this.workingGroupDetail.chargeB,
yearCharge: this.workingGroupDetail.yearChargeB,
chargeNoticeId: this.workingGroupDetail.chargeNoticeBId
}
this.chargeNoticeList.push(chargeNoticeB)
}
},
/**
* 设置收费通知
*/
setChargeNotic() {
if (!this.workingGroupDetail.chargeNoticeNoA && !this.workingGroupDetail.chargeNoticeNoB) {
this.$message.warn('请先补充该起草组的收费通知信息')
return
}
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请先选择成员')
return
}
// 2022-04-26 变更:不校验来款是否是收费通知
// let param = {
// ids: this.selectedRowKeys.join(','),
// workingGroupId: this.workingGroupProjectId
// }
// 判断选中的成员是否存在来款方式非收费通知的
// getChargeNotice(param).then(res => {
// if (res.success) {
this.getChargeNoticeList()
this.$refs.setChargeNotic.chargeNoticeList = this.chargeNoticeList
this.$refs.setChargeNotic.selectedRowKeys = this.selectedRowKeys
this.$refs.setChargeNotic.handleOpen()
// } else {
// this.$message.warn(res.message)
// }
// })
},
/**
* 催款提醒
*/
setDunningReminder() {
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请先选择成员')
return
}
let param = {
projectIds: this.selectedRowKeys.join(',').toString()
}
const that = this
this.$confirm({
title: '确认催款',
content: '是否向选中的成员发送催款提醒?',
onOk: function () {
that.loading = true
dunningReminder(param).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 是否有邮件发送失败 有就给出提示信息
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
that.$refs.emailError.open()
that.$refs.emailError.msgList = res.result
console.log(that.$refs.emailError.msgList, 'that.$refs.emailError.msgList ')
}
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
},
/**
* 文件预览
* @param file
@@ -502,14 +386,6 @@ export default {
window.open(url)
}
},
// 设置标签
setLabel() {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return
}
this.$refs.workGroupSetLabel.show(this.selectedRowKeys)
}
// 2021 10 11 沟通后去掉了这个功能
// searchReset() {
// this.lastQueryParam = {
@@ -1,202 +0,0 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="收费通知号" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
<a-radio-group
class="charge-notice-no"
v-decorator="['charge']"
@change="handleChargeNoticeChange">
<a-radio v-for="item in chargeNoticeList" :key="item.key" :value="item.key">
<a-tooltip :title="item.label">
{{ item.label }}
</a-tooltip>
</a-radio>
</a-radio-group>
</a-form-item>
<a-row v-if="selectedChargeNotice === 'A'">
<a-col :xl="12" :sm="24">
<a-form-item label="本年应收款A" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入本年应收款A"
v-decorator="['receivableAmount']"
:maxLength='50'
@blur="addZero"
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
</a-col>
<a-col :xl="12" :sm="24">
<a-form-item label="收费通知A" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-upload :multiple="false"
:return-id="true"
bizPath="payment"
:number="1"
v-decorator="['chargeNoticeId']"
:trigger-change="true"></j-upload>
</a-form-item>
</a-col>
</a-row>
<a-row v-if="selectedChargeNotice === 'B'">
<a-col :xl="12" :sm="24">
<a-form-item label="本年应收款B" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入本年应收款B"
v-decorator="['receivableAmount']"
:maxLength='50'
@blur="addZero"
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
</a-col>
<a-col :xl="12" :sm="24">
<a-form-item label="收费通知B" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-upload :multiple="false"
:return-id="true"
:number="1"
bizPath="payment"
v-decorator="['chargeNoticeId']"
:trigger-change="true"></j-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
<email-error-msg-modal ref="emailError"></email-error-msg-modal>
<template slot="footer">
<a-button @click="handleCancel">关闭</a-button>
<a-button @click="handleOk" type="primary" v-preventclick>确定</a-button>
</template>
</j-modal>
</template>
<script>
import pick from 'lodash.pick'
import JUpload from '@/components/jero/JUpload'
import { postAction } from '@/api/manage'
import { addZero } from '../../../utils/util'
// import {msgWarn} from '@comp/_util/MessageClose'
import EmailErrorMsgModal from '@views/projectManagement/modules/EmailErrorMsgModal'
export default {
name: 'DraftingGroupMemberSetChargeNotice',
components: { JUpload, EmailErrorMsgModal },
data() {
return {
title: '设置收费通知',
width: 800,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 }
},
remarksLabelCol: {
xs: { span: 24 },
sm: { span: 3 }
},
remarksWrapperCol: {
xs: { span: 24 },
sm: { span: 21 }
},
selectedRowKeys: null, // 选中项目的id
chargeNoticeList: null, // 收费通知列表
selectedChargeNotice: null, // 选中的收费通知类型
url: {
setCharge: '/project/payWorkingGroupSubitem/setCharge'
}
}
},
methods: {
addZero,
handleOpen() {
this.visible = true
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData)
formData.ids = this.selectedRowKeys.join(',')
postAction(this.url.setCharge, formData).then(res => {
if (res.success) {
this.$message.success(res.message)
// 是否有邮件发送失败 有就给出提示信息
if (Array.isArray(res.result) && res.result.length > 0) {
// msgWarn(this,res.result,0)
that.$refs.emailError.open()
that.$refs.emailError.msgList = res.result
console.log(that.$refs.emailError.msgList, 'that.$refs.emailError.msgList ')
}
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancel() {
this.close()
},
close() {
this.visible = false
this.model = {}
this.form.resetFields()
this.selectedRowKeys = null
this.chargeNoticeList = null
this.selectedChargeNotice = null
},
/**
* 收费通知号变化, 回显本年应收款和文件
*/
handleChargeNoticeChange(e) {
let key = e.target.value
this.pickChargeNoticeType(key)
},
/**
* 匹配显隐
* @param key
*/
pickChargeNoticeType(key) {
this.chargeNoticeList.forEach(item => {
if (item.type === 'chargeNoticeA' && key === 'a') {
this.selectedChargeNotice = 'A'
this.model.receivableAmount = item.yearCharge
this.model.chargeNoticeId = item.chargeNoticeId
this.model.chargeNoticeNo = item.value
} else if (item.type === 'chargeNoticeB' && key === 'b') {
this.selectedChargeNotice = 'B'
this.model.receivableAmount = item.yearCharge
this.model.chargeNoticeId = item.chargeNoticeId
this.model.chargeNoticeNo = item.value
}
})
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'receivableAmount', 'chargeNoticeId'))
})
}
}
}
</script>
<style scoped>
</style>
@@ -12,11 +12,11 @@
<a-form :form="form">
<a-row v-if="defaultChargeWay">
<a-col>
<a-form-item label="工作组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
<a-form-item label="起草组项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
<a-select
placeholder="请选择工作组项目"
placeholder="请选择起草组项目"
show-search
v-decorator="['workingGroupId',validatorRules.workingGroupId]"
v-decorator="['draftingGroupId',validatorRules.draftingGroupId]"
:maxLength='50'
:filter-option="filterOption"
>
@@ -40,18 +40,17 @@
</a-col>
</a-row>
<template
v-if="model.payWorkingGroupSubItemContactsList && model.payWorkingGroupSubItemContactsList.length > 0">
<a-row v-for="(item, index) in model.payWorkingGroupSubItemContactsList" :key="index + ''">
v-if="model.payDraftingGroupSubItemContactsList && model.payDraftingGroupSubItemContactsList.length > 0">
<a-row v-for="(item, index) in model.payDraftingGroupSubItemContactsList" :key="index + ''">
<a-col :xl="12" :sm="24">
<a-form-item :label="`企业联系人${index + 1}`" :labelCol="labelCol" :wrapperCol="wrapperCol">
<select-contacts :selected-company="selectedCompany"
:init-contacts="model.payWorkingGroupSubItemContactsList[index]"
:init-contacts="model.payDraftingGroupSubItemContactsList[index]"
:placeholder="`请选择企业联系人${index + 1}`"
v-decorator="[`payWorkingGroupSubItemContactsList[${index}].contactsId`, {rules: [{ required: index === 0, validator: index === 0 ? validateContactRequired : validateContact }],validateTrigger: 'change'}]"
v-decorator="[`payDraftingGroupSubItemContactsList[${index}].contactsId`, {rules: [{ required: index === 0, validator: index === 0 ? validateContactRequired : validateContact }],validateTrigger: 'change'}]"
:maxLength='50'
:ref="`selectContacts${index}`"
@ok="addContactsOneOk"
@change="value => contactsChange(value, index)"></select-contacts>
@ok="addContactsOneOk"></select-contacts>
</a-form-item>
</a-col>
<a-col :xl="9" :sm="20">
@@ -59,7 +58,7 @@
<a-form-item :label="`备注${index + 1}`" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
:placeholder="`请输入备注${index + 1}`"
v-decorator="[`payWorkingGroupSubItemContactsList[${index}].remarks`]"
v-decorator="[`payDraftingGroupSubItemContactsList[${index}].remarks`]"
:maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}">
</a-input>
@@ -104,7 +103,6 @@
<script>
import pick from 'lodash.pick'
import { httpAction } from '@api/manage'
import JUpload from '@comp/jero/JUpload'
import CompanySelect from '@comp/company/CompanySelect'
import SelectContacts from '@comp/company/SelectContacts'
import { getWorkingGroupListByNotCompany } from '../../../api/incomePaymentsApi'
@@ -112,13 +110,11 @@ import { getWorkingGroupListByNotCompany } from '../../../api/incomePaymentsApi'
import { addZero } from '../../../utils/util'
import { money } from '../../../utils/validate'
import { checkAssociatedProject } from '../../../utils/projectCheck'
import SelectRevenueContract from '../../../components/tools/SelectRevenueContract'
import JDictSelectTag from '@comp/dict/JDictSelectTag'
import { CalcAmountMixin } from '@/mixins/CalcAmountMixin'
export default {
name: 'WorkingGroupMemberUnitModule',
components: { JUpload, CompanySelect, SelectContacts, SelectRevenueContract, JDictSelectTag },
components: { CompanySelect, SelectContacts },
mixins: [CalcAmountMixin],
props: {
// 默认来款方式(收入合同新增工作组项目,来款方式默认为2--合同)
@@ -191,8 +187,8 @@ export default {
sm: { span: 20 }
},
validatorRules: {
workingGroupId: {
rules: [{ required: true, message: '请选择工作组项目' }],
draftingGroupId: {
rules: [{ required: true, message: '请选择起草组项目' }],
validateTrigger: 'change'
},
chargeCompany: {
@@ -242,9 +238,8 @@ export default {
selectedContact2: null, // 编辑时的联系人
selectedContact3: null, // 编辑时的联系人
selectedMailContact: null, // 编辑时的邮寄联系人
chargeNoticeList: [], // 收费通知号list
selectedChargeNotice: null, // 选中的收费通知号
workingGroupId: null,
draftingGroupId: null,
workingGroupList: [],
disabledCompany: false, // 企业是否禁用
isAssociatedContract: false, // 是否关联合同
@@ -252,8 +247,8 @@ export default {
// hasContactTwo: false, // 是否选择联系人2
// hasContactThree: false, // 是否选择联系人3
url: {
add: '/project/payWorkingGroupSubitem/add',
edit: '/project/payWorkingGroupSubitem/edit'
add: '/drafting/payDraftingGroupSubitem/add',
edit: '/drafting/payDraftingGroupSubitem/edit'
},
// 默认的联系人数据
defaultPayWorkingGroupSubItemContact: {
@@ -328,10 +323,10 @@ export default {
this.model.contactsIdTwo = this.model.contactsTemporaryIdTwo || undefined
this.model.contactsIdThree = this.model.contactsTemporaryIdThree || undefined
// 是否存在从收入合同传入的签订联系人id
this.model.mailContactsId = this.signedContactId || this.model.mailContactsTemporaryId || undefined
// 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 => {
this.model.payDraftingGroupSubItemContactsList && this.model.payDraftingGroupSubItemContactsList.forEach(item => {
item.name = item.contactsTemporaryName
})
// this.selectedContact1 = {
@@ -362,16 +357,15 @@ export default {
// }
} else {
// 新增处理默认显示的三个企业联系人
this.model.payWorkingGroupSubItemContactsList = []
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payDraftingGroupSubItemContactsList = []
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
}
this.chargeWayType = record.chargeWay
this.pickChargeNoticeType(record.charge, true)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'mailContactsId', 'chargeWay', 'charge', 'receivableAmount', 'taxRate', 'tax', 'noTaxAmount', 'contractNum', 'receivableAmount', 'chargeNoticeId', 'needInvoice', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payWorkingGroupSubItemContactsList'))
this.form.setFieldsValue(pick(this.model, 'chargeCompany', 'contactsIdOne', 'contactsIdTwo', 'contactsIdThree', 'remarks', 'remarksOne', 'remarksTwo', 'remarksThree', 'payDraftingGroupSubItemContactsList'))
})
},
close() {
@@ -420,13 +414,13 @@ export default {
} else {
httpurl += this.url.edit
}
if (this.workingGroupId) {
values.workingGroupId = this.workingGroupId
if (this.draftingGroupId) {
values.draftingGroupId = this.draftingGroupId
}
// 企业联系人信息中将没有值的去掉
let haveValueContactArr = values.payWorkingGroupSubItemContactsList.filter(tt => tt.contactsId)
let haveValueContactArr = values.payDraftingGroupSubItemContactsList.filter(tt => tt.contactsId)
let obj = {
payWorkingGroupSubItemContactsList: haveValueContactArr
payDraftingGroupSubItemContactsList: haveValueContactArr
}
const formData = Object.assign(this.model, values, obj)
console.log('表单提交数据', formData)
@@ -451,63 +445,6 @@ export default {
handleCancel() {
this.close()
},
/**
* 来款方式变化
* @param e
*/
handlechargeWayChange(e) {
if (e.target.value === 3) {
if (this.chargeNoticeList.length === 0) {
this.chargeWayType = null
this.model.chargeWay = null
this.$message.warn('请先补充该工作组的收费通知信息')
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'chargeWay'))
})
return
}
} else {
// 清空之前选中的收费通知号
this.selectedChargeNotice = null
// 清空未税金额 待确收金额 税额
this.form.resetFields(['tax', 'noTaxAmount', 'receivableAmount'])
}
this.chargeWayType = e.target.value
},
/**
* 收费通知号变化, 回显本年应收款和文件
*/
handleChargeNoticeChange(e) {
let key = e.target.value
this.pickChargeNoticeType(key)
},
/**
* 匹配收费通知显隐
* @param value
*/
pickChargeNoticeType(key, isFirst) {
this.chargeNoticeList.forEach(item => {
if (item.type === 'chargeNoticeA' && key === 'a') {
this.selectedChargeNotice = 'A'
if (!isFirst) {
this.model.receivableAmount = item.yearCharge
this.model.chargeNoticeId = item.chargeNoticeId
}
this.model.chargeNoticeNo = item.value
} else if (item.type === 'chargeNoticeB' && key === 'b') {
this.selectedChargeNotice = 'B'
if (!isFirst) {
this.model.receivableAmount = item.yearCharge
this.model.chargeNoticeId = item.chargeNoticeId
}
this.model.chargeNoticeNo = item.value
}
})
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'receivableAmount', 'chargeNoticeId'))
this.calcAmount()
})
},
/**
* 选中企业变化,将联系人的值清空
* @param value
@@ -522,15 +459,15 @@ export default {
// this.model.contactsIdTwo = undefined
// this.model.contactsIdThree = undefined
// 处理默认显示的三个企业联系人
this.model.payWorkingGroupSubItemContactsList = []
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payWorkingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.mailContactsId = undefined
this.model.payDraftingGroupSubItemContactsList = []
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
this.model.payDraftingGroupSubItemContactsList.push(this.defaultPayWorkingGroupSubItemContact)
// this.model.mailContactsId = undefined
this.selectedMailContact = null
this.model.contractNum = undefined
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'mailContactsId', 'contractNum', 'payWorkingGroupSubItemContactsList'))
this.form.setFieldsValue(pick(this.model, 'contractNum', 'payDraftingGroupSubItemContactsList'))
})
},
/**
@@ -587,7 +524,7 @@ export default {
*/
validateContact(rule, value, callback) {
if (value) {
let contactsList = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
let contactsList = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
let hasValueArr = contactsList.filter(tt => tt.contactsId === value)
if (hasValueArr.length <= 1) {
callback()
@@ -597,74 +534,12 @@ export default {
}
callback()
},
/**
* 企业联系人1、邮寄联系人联动
* @param value
* @param index
*/
contactsChange(value, index) {
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
formData[index].contactsId = value
// 如果没有值,清空对应的备注
if (!value) {
formData[index].remarks = null
} else {
// 如果值和初始值不一致,则清除备注
if (this.model.payWorkingGroupSubItemContactsList[index].contactsId !== value) {
formData[index].remarks = null
}
let mailContact = Object.values(this.form.getFieldValue(['mailContactsId']))[0]
// 邮寄联系人非undefined时赋值
if (!mailContact && index === 0) {
this.model.mailContactsId = value
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'mailContactsId'))
})
}
}
this.$nextTick(() => {
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
this.form.validateFields(['payWorkingGroupSubItemContactsList'])
})
},
/**
* 企业联系人2变化
* @param value
*/
// contactsTwoChange(value) {
// if (!value) {
// this.hasContactTwo = false
// this.form.setFieldsValue({ remarksTwo: null })
// return
// }
// this.hasContactTwo = true
// // 判断联系人是否和原来的一致,不一致则清空备注内容
// if (value !== this.model.contactsTemporaryIdTwo) {
// this.form.setFieldsValue({ remarksTwo: null })
// }
// },
/**
* 企业联系人3变化
* @param value
*/
// contactsThreeChange(value) {
// if (!value) {
// this.hasContactThree = false
// this.form.setFieldsValue({ remarksThree: null })
// return
// }
// this.hasContactThree = true
// // 判断联系人是否和原来的一致,不一致则清空备注内容
// if (value !== this.model.contactsTemporaryIdThree) {
// this.form.setFieldsValue({ remarksThree: null })
// }
// },
/**
* 添加联系人
* @param index
*/
handleAddContact(index) {
if (this.model.payWorkingGroupSubItemContactsList.length >= 10) {
if (this.model.payDraftingGroupSubItemContactsList.length >= 10) {
this.$message.warn('最多添加十个企业联系人')
return
}
@@ -672,12 +547,12 @@ export default {
contactsId: undefined,
remarks: null
}
this.model.payWorkingGroupSubItemContactsList.splice(index + 1, 0, obj)
this.model.payDraftingGroupSubItemContactsList.splice(index + 1, 0, obj)
this.$forceUpdate()
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
let formData = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
formData.splice(index + 1, 0, obj)
this.$nextTick(() => {
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
this.form.setFieldsValue({ payDraftingGroupSubItemContactsList: formData })
})
},
/**
@@ -685,15 +560,15 @@ export default {
* @param index
*/
handleDelContact(index) {
if (this.model.payWorkingGroupSubItemContactsList.length === 1) {
if (this.model.payDraftingGroupSubItemContactsList.length === 1) {
this.$message.warn('最少需要一个企业联系人')
return
}
this.model.payWorkingGroupSubItemContactsList.splice(index, 1)
let formData = this.form.getFieldValue('payWorkingGroupSubItemContactsList')
this.model.payDraftingGroupSubItemContactsList.splice(index, 1)
let formData = this.form.getFieldValue('payDraftingGroupSubItemContactsList')
formData.splice(index, 1)
this.$nextTick(() => {
this.form.setFieldsValue({ payWorkingGroupSubItemContactsList: formData })
this.form.setFieldsValue({ payDraftingGroupSubItemContactsList: formData })
})
},
// 下拉框的搜索
@@ -1,113 +0,0 @@
<!--工作组 设置标签-->
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col :span="24">
<a-form-item label="标签名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入标签名称"
v-decorator="['label',validatorRules.label]"
:maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import { httpAction } from '@api/manage'
export default {
name: 'DraftingGroupSetLabel',
data() {
return {
title: '设置标签',
width: 800,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 14 }
},
validatorRules: {
label: {
rules: [{ required: true, message: '请输入标签名称' }],
validateTrigger: 'blur'
}
},
url: {
setLabel: '/project/payWorkingGroupSubitem/setLabel'
}
}
},
methods: {
show(ids) {
this.form.resetFields()
this.selectedIds = ids
this.visible = true
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpUrl = this.url.setLabel
let method = 'post'
const formData = Object.assign(this.model, values)
formData.subIds = that.selectedIds.join(',')
console.log('表单提交数据', formData)
httpAction(httpUrl, formData, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.close()
},
}
}
</script>
<style scoped>
</style>