update 法规采购流程

This commit is contained in:
赵霄
2023-11-20 16:21:30 +08:00
parent 813fd009a6
commit 2eee33a077
5 changed files with 331 additions and 45 deletions
@@ -39,7 +39,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-decorator="['processDueDate']"
:disabled="disabled"
:disabled="processInfoDisabled"
style="width: 100%" />
</a-form-item>
</a-col>
@@ -50,7 +50,7 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="500"
type="textarea"
:disabled="disabled"
:disabled="processInfoDisabled"
v-decorator="['processDescription']" />
</a-form-item>
</a-form>
@@ -72,9 +72,13 @@
:dataSource="dataSource"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading"
:operation-list="operationList"
@operationClick="operationClick">
:loading="loading">
<template v-slot:action="{text, record, index}">
<a @click="handleEdit(record, index)">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(index)">{{ $t('delete') }}</a>
</template>
</j-table>
</div>
@@ -112,6 +116,10 @@
<a-button type="primary" :loading="loading" ghost icon="arrow-up" v-if="btnList.includes('return')" @click="handleTurnTo">
{{ $t('turnTo') }}
</a-button>
<!--抄送-->
<a-button type="primary" :loading="loading" ghost icon="arrow-up" v-if="btnList.includes('return')" @click="handleCarbonCopy">
{{ $t('turnTo') }}
</a-button>
<!--保存 发起节点审批节点都存在-->
<a-button type="primary" :loading="loading" ghost v-if="btnList.includes('save')" @click="handleSave">
<i class="iconfont icon-save" />{{ $t('preservation') }}
@@ -131,7 +139,9 @@
</div>
<!--表格新增编辑表单-->
<table-form-modal ref="modalForm" />
<table-form-modal ref="modalForm" @ok="modalFormOk" />
<!--转办选人-->
<user-select-modal ref="userSelectModal" check-required :type="isTransfer ? 'radio' : 'checkbox'" @change="handleSelectedUser" />
</internal-detail-page>
</template>
@@ -143,21 +153,26 @@ import ProcessDetailList from '../../../components/ProcessDetailList'
import { ProcessKey, ProcurementProcessNodes } from '../../../enums/commonEnums'
import JTable from '../../../components/jero/JTable'
import TableFormModal from './modules/TableFormModal'
import {
queryProcurementProcessInfo,
saveProcurementProcess,
initProcurementProcess,
agreeProcurementProcess,
rejectProcurementProcess,
transferProcurementProcess,
carbonCopyProcurementProcess
} from '../../../api/workCenter'
import UserSelection from '../../../components/selection/UserSelection'
import UserSelectModal from '../../../components/selection/UserSelectModal'
export default {
name: 'StandardProcurementProcess',
components: { JTable, ProcessDetailList, PersonnelInfo, InternalDetailPage, TableFormModal },
components: { UserSelectModal, UserSelection, JTable, ProcessDetailList, PersonnelInfo, InternalDetailPage, TableFormModal },
mixins: [WorkCenterMixin],
computed: {
pageTitle () {
return `${this.$t('flowCenter')}${this.$route.meta.title}`
}
},
data () {
return {
loading: false,
btnList: [],
disabled: false,
// 流程信息表单
processInfoForm: this.$form.createForm(this),
processInfo: {},
@@ -211,19 +226,19 @@ export default {
scopedSlots: { customRender: 'action' }
}
],
operationList: [
{ // 编辑
text: this.$t('edit'),
clickEvent: 'handleEdit'
},
{ // 删除
text: this.$t('delete'),
clickEvent: 'handleDelete'
}
],
dataSource: [{ id: 1 }],
dataSource: [],
selectedRowKeys: [],
currentNode: ''
currentNode: '',
isTransfer: true // 是否转办
}
},
computed: {
pageTitle () {
return `${this.$t('flowCenter')}${this.$route.meta.title}`
},
// 流程信息部分禁用
processInfoDisabled () {
return !(this.currentNode === ProcurementProcessNodes.initiate.value && !this.$route.query.processInstanceId)
}
},
created () {
@@ -233,28 +248,209 @@ export default {
this.currentNode = ProcurementProcessNodes.initiate.value
}
this.btnList = ProcurementProcessNodes.propertyOfValue('btn', this.currentNode)
this.getPersonInfoStructure(ProcessKey.LEGAL_PROCUREMENT.value)
this.getPersonInfoStructure(ProcessKey.LEGAL_PROCUREMENT.value, () => {
this.initPersonInfoData(this.currentNode === ProcurementProcessNodes.initiate.value)
})
},
methods: {
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
/**
* 循环操作按钮的操作
* @param operation
* @param record
*/
operationClick (operation, record) {
this[operation.clickEvent](record)
},
handleAdd () {
this.$refs.modalForm.add()
},
batchDel () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectARecord'))
return
}
const data = JSON.parse(JSON.stringify(this.dataSource))
this.dataSource = data.map((tt, index) => {
return this.selectedRowKeys.includes(index) ? null : tt
}).filter(tt => !!tt)
this.selectedRowKeys = []
},
handleEdit (record) {
this.$refs.modalForm.edit(record)
handleEdit (record, index) {
this.$refs.modalForm.edit(record, index)
},
handleDelete (index) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
ok: () => {
this.dataSource.splice(index, 1)
}
})
},
modalFormOk (record, index) {
if (index || index === 0) {
this.$set(this.dataSource, index, record)
} else {
this.dataSource.push(record)
}
},
dealFormData (isSave) {
let flag = true, formData = {}, processInfo = {}, approvalInfo = {}, businessInfo = [], userInfoMap = {}
if (isSave) {
processInfo = Object.assign(this.processInfo, this.processInfoForm.getFieldsValue())
businessInfo = this.dataSource
approvalInfo = Object.assign(this.approvalInfo, this.approvalInfoForm.getFieldsValue())
userInfoMap = this.$refs.personnelInfo.getDataObj()
const params = { ...processInfo, ...businessInfo, ...approvalInfo, ...userInfoMap }
if (!Object.values(params).some(tt => !!tt || (tt && tt.length > 0))) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
flag = false
}
} else {
// 流程信息
this.processInfoForm.validateFields((errors, values) => {
if (!errors) {
processInfo = Object.assign(this.processInfo, values)
} else {
flag = false
}
})
// 业务信息
if (!this.dataSource || this.dataSource.length === 0) {
this.$message.warning(this.$t('workCenter.standardProcurementProcess.addAtLeastOne'))
flag = false
}
businessInfo = this.dataSource
// 审批信息
this.approvalInfoForm.validateFields((errors, values) => {
if (!errors) {
approvalInfo = Object.assign(this.approvalInfo, values)
} else {
flag = false
}
})
// 人员信息
const userInfo = this.$refs.personnelInfo.getDataObjVerify()
userInfoMap = userInfo ? userInfo : flag = false
}
formData = {
basicProcessInfoDTO: processInfo,
basicTaskInfoDTO: approvalInfo,
businessInfoDTO: businessInfo,
userInfoMap
}
return !flag ? flag : formData
},
/**
* 转办
*/
handleTurnTo () {
this.isTransfer = true
this.$refs.userSelectModal.open()
},
/**
* 抄送
*/
handleCarbonCopy () {
this.isTransfer = false
this.$refs.userSelectModal.open()
},
handleSelectedUser (userId) {
const params = {
taskId: this.$route.query.taskId,
userId
}
const func = this.isTransfer ? transferProcurementProcess : carbonCopyProcurementProcess
this.loading = true
func(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 保存
*/
handleSave () {
const formData = this.dealFormData(true)
this.loading = true
saveProcurementProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 提交
*/
handleSubmit () {
const formData = this.dealFormData()
if (!formData) {
return
}
let submitFunc
if (this.currentNode === ProcurementProcessNodes.initiate.value && !this.$route.query.processInstanceId) {
submitFunc = initProcurementProcess
} else {
submitFunc = agreeProcurementProcess
}
this.loading = true
submitFunc(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 同意
*/
handleAgree () {
const formData = this.dealFormData()
if (!formData) {
return
}
this.loading = true
agreeProcurementProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 驳回
*/
handleReject () {
const formData = this.dealFormData()
if (!formData) {
return
}
this.loading = true
rejectProcurementProcess(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
}
}