update 工作组、起草组批量新增成员单位完善
This commit is contained in:
@@ -157,6 +157,8 @@ const memberCopy = (params) => getAction('', params)
|
||||
|
||||
// 工作组成员维护-调账
|
||||
const workingGroupEditAccount = (param) => getAction('/project/payWorkingGroupSubitem/editAccount', param)
|
||||
// 获取所有起草组项目
|
||||
const getAllDraftProjects = (params) => getAction('/drafting/payDraftingGroup/listAll', params)
|
||||
|
||||
export {
|
||||
getWorkingGroupById,
|
||||
@@ -239,5 +241,6 @@ export {
|
||||
memberDrawTicket,
|
||||
memberCopy,
|
||||
|
||||
workingGroupEditAccount
|
||||
workingGroupEditAccount,
|
||||
getAllDraftProjects
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<div class="table-operator">
|
||||
<a-button type="primary" icon="plus" @click="handleAdd" v-has="'draftingGroup:add'">新增</a-button>
|
||||
<a-button type="danger" icon="delete" @click="batchDel" v-has="'draftingGroup:batchDel'">批量删除</a-button>
|
||||
<a-button type="primary" icon="plus" @click="handleBatchAddMemberUnit" v-has="'draftingGroupMember:batchAdd'">批量新增成员单位</a-button>
|
||||
|
||||
</div>
|
||||
<!-- /操作按钮区域-end-->
|
||||
@@ -112,6 +113,8 @@
|
||||
<!-- /table表格区域-->
|
||||
<drafting-group-module ref="modalForm" @ok="modalFormOk"></drafting-group-module>
|
||||
</a-card>
|
||||
<!-- 批量新增成员信息 -->
|
||||
<drafting-group-member-unit-module ref="draftingGroupMemberUnitModule" @ok="modalFormOk" isBatchAdd/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -124,10 +127,11 @@ import IconDraftingGruop from '@/assets/imgs/icon/icon_drafting_group.png'
|
||||
import {copyDraftingGroup, getWorkingGroupList} from '../../api/incomePaymentsApi'
|
||||
import { getAction } from '../../api/manage'
|
||||
import DraftingGroupModule from './modules/DraftingGroupModule'
|
||||
import DraftingGroupMemberUnitModule from '@views/draftingGroup/modules/DraftingGroupMemberUnitModule'
|
||||
|
||||
export default {
|
||||
name: 'DraftingGroupManagement',
|
||||
components: { JYearDate, DraftingGroupModule, SelectPrincipal, PageHeaderTitle },
|
||||
components: {DraftingGroupMemberUnitModule, JYearDate, DraftingGroupModule, SelectPrincipal, PageHeaderTitle },
|
||||
mixins: [JeroListMixin],
|
||||
data() {
|
||||
return {
|
||||
@@ -194,6 +198,12 @@ export default {
|
||||
this.loadWorkingGroupList()
|
||||
},
|
||||
methods: {
|
||||
// 批量新增成员信息
|
||||
handleBatchAddMemberUnit () {
|
||||
this.$refs.draftingGroupMemberUnitModule.add()
|
||||
this.$refs.draftingGroupMemberUnitModule.title = '批量新增成员单位'
|
||||
this.$refs.draftingGroupMemberUnitModule.disableSubmit = false
|
||||
},
|
||||
// 获取工作组下拉列表
|
||||
loadWorkingGroupList () {
|
||||
getWorkingGroupList().then(res => {
|
||||
|
||||
@@ -10,23 +10,31 @@
|
||||
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="['draftingGroupId',validatorRules.draftingGroupId]"
|
||||
: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>
|
||||
<!-- 批量添加时显示) -->
|
||||
<template v-if="isBatchAdd && model.draftingGroupIdList && model.draftingGroupIdList.length > 0">
|
||||
<a-row v-for="(_, index) in model.draftingGroupIdList" :key="index + ''">
|
||||
<a-col :xl="21" :sm="20">
|
||||
<a-form-item :label="`起草组${index + 1}`" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-select
|
||||
:placeholder="`请选择起草组项目${index + 1}`"
|
||||
show-search
|
||||
v-decorator="[`draftingGroupIdList[${index}]`, {rules: [{ required: index === 0, validator: index === 0 ? validateDraftingGroupRequired : validateDraftingGroup }],validateTrigger: 'change'}]"
|
||||
:maxLength='50'
|
||||
allowClear
|
||||
:filter-option="filterOption"
|
||||
>
|
||||
<a-select-option v-for="item in draftingGroupList" :key="item.id" :value="item.id">
|
||||
{{ item.draftingGroupProject }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="3" :sm="4">
|
||||
<a-button type="link" class="contact-btn" @click="handleAddDraftGroup(index)">添加</a-button>
|
||||
<a-button type="link" class="contact-btn del-btn" @click="handleDelDraftGroup(index)">删除</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="成员单位" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
@@ -104,7 +112,7 @@ import pick from 'lodash.pick'
|
||||
import { httpAction } from '@api/manage'
|
||||
import CompanySelect from '@comp/company/CompanySelect'
|
||||
import SelectContacts from '@comp/company/SelectContacts'
|
||||
import { getWorkingGroupListByNotCompany } from '../../../api/incomePaymentsApi'
|
||||
import {getAllDraftProjects, getWorkingGroupListByNotCompany} from '../../../api/incomePaymentsApi'
|
||||
// import { isRepeat } from '../../../utils/util'
|
||||
import { addZero } from '../../../utils/util'
|
||||
import { money } from '../../../utils/validate'
|
||||
@@ -159,6 +167,12 @@ export default {
|
||||
type: Number,
|
||||
requirded: false,
|
||||
default: null
|
||||
},
|
||||
// 是否批量添加
|
||||
isBatchAdd: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -239,7 +253,7 @@ export default {
|
||||
selectedMailContact: null, // 编辑时的邮寄联系人
|
||||
selectedChargeNotice: null, // 选中的收费通知号
|
||||
draftingGroupId: null,
|
||||
workingGroupList: [],
|
||||
draftingGroupList: [],
|
||||
disabledCompany: false, // 企业是否禁用
|
||||
isAssociatedContract: false, // 是否关联合同
|
||||
// hasContactOne: false, // 是否选择联系人1
|
||||
@@ -247,7 +261,8 @@ export default {
|
||||
// hasContactThree: false, // 是否选择联系人3
|
||||
url: {
|
||||
add: '/drafting/payDraftingGroupSubitem/add',
|
||||
edit: '/drafting/payDraftingGroupSubitem/edit'
|
||||
edit: '/drafting/payDraftingGroupSubitem/edit',
|
||||
batchAdd: '/drafting/payDraftingGroupSubitem/batchAdd'
|
||||
},
|
||||
// 默认的联系人数据
|
||||
defaultPayWorkingGroupSubItemContact: {
|
||||
@@ -260,7 +275,15 @@ export default {
|
||||
methods: {
|
||||
addZero,
|
||||
add() {
|
||||
this.edit({})
|
||||
const obj = {}
|
||||
// 判断是否批量添加(工作组管理-批量新增成员单位)
|
||||
if (this.isBatchAdd) {
|
||||
// 获取当前年的工作组列表
|
||||
this.loadCurrentYearDraftingGroupList()
|
||||
// 默认一个起草组
|
||||
obj.draftingGroupIdList = [undefined]
|
||||
}
|
||||
this.edit(obj)
|
||||
// 判断默认来款用途是否为合同(收入合同新增)
|
||||
if (this.defaultChargeWay) {
|
||||
this.loadWorkingGroupList()
|
||||
@@ -274,6 +297,20 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取当前年起草组列表
|
||||
*/
|
||||
loadCurrentYearDraftingGroupList() {
|
||||
getAllDraftProjects({
|
||||
year: new Date().getFullYear()
|
||||
}).then(res => {
|
||||
if (res.success) {
|
||||
this.draftingGroupList = res.result
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取工作组列表
|
||||
*/
|
||||
@@ -409,12 +446,19 @@ export default {
|
||||
let httpurl = ''
|
||||
let method = 'post'
|
||||
if (!this.model.id) {
|
||||
httpurl += this.url.add
|
||||
// 如果是批量添加,调用批量添加的接口
|
||||
httpurl += this.isBatchAdd ? this.url.batchAdd : this.url.add
|
||||
// 通过添加成员来的,默认状态为通过
|
||||
values.checkResult = 2
|
||||
} else {
|
||||
httpurl += this.url.edit
|
||||
}
|
||||
// 批量添加
|
||||
if (Array.isArray(values.draftingGroupIdList)) {
|
||||
// 过滤空
|
||||
values.draftingGroupIdList = values.draftingGroupIdList.filter(item => !!item)
|
||||
values.draftingGroupIds = values.draftingGroupIdList.join(',')
|
||||
}
|
||||
if (this.draftingGroupId) {
|
||||
values.draftingGroupId = this.draftingGroupId
|
||||
}
|
||||
@@ -535,6 +579,59 @@ export default {
|
||||
}
|
||||
callback()
|
||||
},
|
||||
validateDraftingGroupRequired(rule, value, callback) {
|
||||
if (value) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择起草组1')
|
||||
},
|
||||
/**
|
||||
* 校验工作组是否重复
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
validateDraftingGroup(rule, value, callback) {
|
||||
if (value) {
|
||||
let draftingGroupIdList = this.form.getFieldValue('draftingGroupIdList')
|
||||
let hasValueArr = draftingGroupIdList.filter(id => id === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
}
|
||||
callback('请选择不同的起草组')
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
/**
|
||||
* 添加起草组
|
||||
* @param index
|
||||
*/
|
||||
handleAddDraftGroup (index) {
|
||||
this.model.draftingGroupIdList.splice(index + 1, 0, undefined)
|
||||
this.$forceUpdate()
|
||||
let formData = this.form.getFieldValue('draftingGroupIdList')
|
||||
formData.splice(index + 1, 0, undefined)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ draftingGroupIdList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 删除起草组
|
||||
* @param index
|
||||
*/
|
||||
handleDelDraftGroup (index) {
|
||||
if (this.model.draftingGroupIdList.length === 1) {
|
||||
this.$message.warn('最少需要一个起草组')
|
||||
return
|
||||
}
|
||||
this.model.draftingGroupIdList.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('draftingGroupIdList')
|
||||
formData.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ draftingGroupIdList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 添加联系人
|
||||
* @param index
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
<!-- 批量添加时显示) -->
|
||||
<template v-if="isBatchAdd && model.workingGroupIds && model.workingGroupIds.length > 0">
|
||||
<a-row v-for="(_, index) in model.workingGroupIds" :key="index + ''">
|
||||
<template v-if="isBatchAdd && model.workingGroupIdList && model.workingGroupIdList.length > 0">
|
||||
<a-row v-for="(_, index) in model.workingGroupIdList" :key="index + ''">
|
||||
<a-col :xl="21" :sm="20">
|
||||
<a-form-item :label="`工作组${index + 1}`" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-select
|
||||
:placeholder="`请选择工作组项目${index + 1}`"
|
||||
show-search
|
||||
v-decorator="[`workingGroupIds[${index}]`, {rules: [{ required: index === 0, validator: index === 0 ? validateWorkingGroupRequired : validateWorkingGroup }],validateTrigger: 'change'}]"
|
||||
v-decorator="[`workingGroupIdList[${index}]`, {rules: [{ required: index === 0, validator: index === 0 ? validateWorkingGroupRequired : validateWorkingGroup }],validateTrigger: 'change'}]"
|
||||
:maxLength='50'
|
||||
allowClear
|
||||
:filter-option="filterOption"
|
||||
@@ -604,7 +604,7 @@ export default {
|
||||
// 获取当前年的工作组列表
|
||||
this.loadCurrentYearWorkingGroupList()
|
||||
// 默认一个工作组
|
||||
obj.workingGroupIds = [{}]
|
||||
obj.workingGroupIdList = [undefined]
|
||||
}
|
||||
this.edit(obj)
|
||||
// 判断默认来款用途是否为合同(收入合同新增)
|
||||
@@ -779,8 +779,10 @@ export default {
|
||||
values.workingGroupId = this.workingGroupId
|
||||
}
|
||||
// 批量添加
|
||||
if (Array.isArray(values.workingGroupIds)) {
|
||||
values.workingGroupIds = values.workingGroupIds.join(',')
|
||||
if (Array.isArray(values.workingGroupIdList)) {
|
||||
// 过滤空
|
||||
values.workingGroupIdList = values.workingGroupIdList.filter(item => !!item)
|
||||
values.workingGroupIds = values.workingGroupIdList.join(',')
|
||||
}
|
||||
// 企业联系人信息中将没有值的去掉
|
||||
let haveValueContactArr = values.payWorkingGroupSubItemContactsList.filter(tt => tt.contactsId)
|
||||
@@ -970,8 +972,8 @@ export default {
|
||||
*/
|
||||
validateWorkingGroup(rule, value, callback) {
|
||||
if (value) {
|
||||
let workingGroupIds = this.form.getFieldValue('workingGroupIds')
|
||||
let hasValueArr = workingGroupIds.filter(id => id === value)
|
||||
let workingGroupIdList = this.form.getFieldValue('workingGroupIdList')
|
||||
let hasValueArr = workingGroupIdList.filter(id => id === value)
|
||||
if (hasValueArr.length <= 1) {
|
||||
callback()
|
||||
}
|
||||
@@ -1051,12 +1053,12 @@ export default {
|
||||
* @param index
|
||||
*/
|
||||
handleAddWorkGroup (index) {
|
||||
this.model.workingGroupIds.splice(index + 1, 0, '')
|
||||
this.model.workingGroupIdList.splice(index + 1, 0, undefined)
|
||||
this.$forceUpdate()
|
||||
let formData = this.form.getFieldValue('workingGroupIds')
|
||||
formData.splice(index + 1, 0, '')
|
||||
let formData = this.form.getFieldValue('workingGroupIdList')
|
||||
formData.splice(index + 1, 0, undefined)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ workingGroupIds: formData })
|
||||
this.form.setFieldsValue({ workingGroupIdList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -1064,15 +1066,15 @@ export default {
|
||||
* @param index
|
||||
*/
|
||||
handleDelWorkGroup (index) {
|
||||
if (this.model.workingGroupIds.length === 1) {
|
||||
if (this.model.workingGroupIdList.length === 1) {
|
||||
this.$message.warn('最少需要一个工作组')
|
||||
return
|
||||
}
|
||||
this.model.workingGroupIds.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('workingGroupIds')
|
||||
this.model.workingGroupIdList.splice(index, 1)
|
||||
let formData = this.form.getFieldValue('workingGroupIdList')
|
||||
formData.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({ workingGroupIds: formData })
|
||||
this.form.setFieldsValue({ workingGroupIdList: formData })
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user