diff --git a/src/api/workCenter.js b/src/api/workCenter.js index cde3b718..0f7329b0 100644 --- a/src/api/workCenter.js +++ b/src/api/workCenter.js @@ -180,6 +180,22 @@ const agreeConsultationProcess = (params) => postAction('/process/fb/processFbSt // 驳回 const rejectConsultationProcess = (params) => postAction('/process/fb/processFbStandardConsultation/reject', params) +/*法规采购流程*/ +// 获取流程信息 +const queryProcurementProcessInfo = (params) => getAction('/process/fb/processFbStandardPurchase/queryProcessInfoVO', params) +// 保存 +const saveProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/saveToDraft', params) +// 发起 +const initProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/startProcess', params) +// 同意 +const agreeProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/agree', params) +// 驳回 +const rejectProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/reject', params) +// 转办 +const transferProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/transfer', params) +// 抄送 +const carbonCopyProcurementProcess = (params) => postAction('/process/fb/processFbStandardPurchase/carbonCopy', params) + export { getProcessNodeList, @@ -270,5 +286,13 @@ export { submitConsultationProcess, transferConsultationProcess, agreeConsultationProcess, - rejectConsultationProcess + rejectConsultationProcess, + + queryProcurementProcessInfo, + saveProcurementProcess, + initProcurementProcess, + agreeProcurementProcess, + rejectProcurementProcess, + transferProcurementProcess, + carbonCopyProcurementProcess } diff --git a/src/common/lang/workCenter/zh.js b/src/common/lang/workCenter/zh.js index ccb9c509..22ebbf9a 100644 --- a/src/common/lang/workCenter/zh.js +++ b/src/common/lang/workCenter/zh.js @@ -350,5 +350,10 @@ module.exports = { meetingName: '会议名称', attendanceDate: '参会日期', relevantData: '相关材料' + }, + // 法规采购流程 + standardProcurementProcess: { + reasonForPurchase: '采购理由', + addAtLeastOne: '请添加至少一条数据' } } diff --git a/src/enums/commonEnums.js b/src/enums/commonEnums.js index c361aad4..da804aee 100644 --- a/src/enums/commonEnums.js +++ b/src/enums/commonEnums.js @@ -269,5 +269,5 @@ export const ProcurementProcessNodes = new EsEnums({ sponsorLeaderApproval: { text: '发起人主管级领导审批', value: 'Activity_1fr1x5i', btn: ['return', 'save', 'agree', 'reject'] }, standardLeaderApproval: { text: '标准化主管级领导审批', value: 'Activity_06jy4oo', btn: ['return', 'save', 'agree', 'reject'] }, standardSuperiorLeaderApproval: { text: '标准化主管级上一级领导审批', value: 'Activity_1u5337a', btn: ['return', 'save', 'agree', 'reject'] }, - regulatoryEngineerConfirmation: { text: '法规工程师确认', value: 'Activity_1q01zfq', btn: ['return', 'save', 'agree', 'reject'] } + regulatoryEngineerConfirmation: { text: '法规工程师确认', value: 'Activity_1q01zfq', btn: ['carbonCopy', 'submit'] } }) \ No newline at end of file diff --git a/src/views/workCenter/standardProcurementProcess/StandardProcurementProcess.vue b/src/views/workCenter/standardProcurementProcess/StandardProcurementProcess.vue index 0b157725..f41b1874 100644 --- a/src/views/workCenter/standardProcurementProcess/StandardProcurementProcess.vue +++ b/src/views/workCenter/standardProcurementProcess/StandardProcurementProcess.vue @@ -39,7 +39,7 @@ format="YYYY-MM-DD" value-format="YYYY-MM-DD" v-decorator="['processDueDate']" - :disabled="disabled" + :disabled="processInfoDisabled" style="width: 100%" /> @@ -50,7 +50,7 @@ @change="event => event.target.value = event.target.value.trim()" :maxLength="500" type="textarea" - :disabled="disabled" + :disabled="processInfoDisabled" v-decorator="['processDescription']" /> @@ -72,9 +72,13 @@ :dataSource="dataSource" :pagination="false" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" - :loading="loading" - :operation-list="operationList" - @operationClick="operationClick"> + :loading="loading"> + + @@ -112,6 +116,10 @@ {{ $t('turnTo') }} + + + {{ $t('turnTo') }} + {{ $t('preservation') }} @@ -131,7 +139,9 @@ - + + + @@ -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 + }) } } } diff --git a/src/views/workCenter/standardProcurementProcess/modules/TableFormModal.vue b/src/views/workCenter/standardProcurementProcess/modules/TableFormModal.vue index c78f09be..37359218 100644 --- a/src/views/workCenter/standardProcurementProcess/modules/TableFormModal.vue +++ b/src/views/workCenter/standardProcurementProcess/modules/TableFormModal.vue @@ -9,13 +9,41 @@ @ok="handleOk" @cancel="handleCancel"> + + + + + + + + + + + + + +