update 企标稽查所有流程调整

This commit is contained in:
danshihao
2023-11-24 14:26:23 +08:00
parent 0c12db10d9
commit d76cafba17
11 changed files with 1076 additions and 356 deletions
@@ -1,5 +1,5 @@
<template>
<internal-detail-page :title="pageTitle" :content-padding="0">
<internal-detail-page :title="pageTitle" :content-padding="0" :loading="loading">
<!-- 标题右侧tab -->
<template v-slot:titleRightCustom>
<div class="table-operator-tab">
@@ -27,7 +27,7 @@
@change="event => event.target.value = event.target.value.trim()"
:disabled="disabled || processDisabled"
:maxLength="50"
v-decorator="['processName', validatorRules.processName]" />
v-decorator="['prcName', validatorRules.processName]" />
</a-form-item>
</a-col>
<a-col :span="12">
@@ -36,8 +36,8 @@
<a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')"
style="width: 100%"
:disabled="disabled || processDisabled"
value-format="YYYY-MM-DD"
v-decorator="['expirationDate']" />
value-format="YYYY-MM-DD hh:mm:ss"
v-decorator="['dueTime']" />
</a-form-item>
</a-col>
<a-col :span="24">
@@ -47,7 +47,7 @@
:maxLength="500"
:rows="4"
:disabled="disabled || processDisabled"
v-decorator="['processExplain']" />
v-decorator="['prcMes']" />
</a-form-item>
</a-col>
</a-row>
@@ -56,7 +56,7 @@
<!-- 业务基本信息 -->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<!-- 流程表格 -->
<inspection-process-table :current-node="currentNode" />
<inspection-process-table ref="inspectionProcessTable" :current-node="currentNode" :project-id="projectId"/>
<!-- 流程审批信息 -->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
@@ -66,86 +66,56 @@
<a-textarea :placeholder="$t('pleaseEnter') + $t('remarks')"
:maxLength="500"
:rows="4"
v-decorator="['remarks', validatorRules.remarks]" />
v-decorator="['commitText', validatorRules.remarks]" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['file']" return-id />
<j-upload v-decorator="['commitFile']" return-id />
</a-form-item>
</a-form>
</div>
<!-- 人员信息 -->
<div v-if="switchValue === 'user'" class="detail-page-scroll-content p-0">
<process-detail-list :url="url">
<personnel-info slot="personnelInfo" :data="personnelInfoData" :currentNode="currentNode"></personnel-info>
<div v-show="switchValue === 'user'" class="detail-page-scroll-content p-0">
<process-detail-list>
<template #personnelInfo>
<personnel-info ref="personnelInfo" :data="personnelInfoData" :current-node="currentNodeName" />
</template>
</process-detail-list>
</div>
<div class="detail-page-bottom-operate-box">
<a-button type="primary" :loading="loading" @click="handleSave" ghost><i class="iconfont icon-save" />{{ $t('preservation') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!--转办-->
<a-button v-if="1 & btn" type="primary" :loading="loading" @click="handleTurnTo" ghost icon="arrow-up">{{ $t('turnTo') }}</a-button>
<!--保存-->
<a-button v-if="2 & btn" type="primary" :loading="loading" @click="handleSave" ghost><i class="iconfont icon-save" />{{ $t('preservation') }}</a-button>
<!--提交-->
<a-button v-if="4 & btn" type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
<!--同意-->
<a-button v-if="8 & btn" type="primary" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!--驳回-->
<a-button v-if="16 & btn" type="primary" :loading="loading" @click="handleReject" icon="close-circle">{{ $t('reject') }}</a-button>
</div>
<!--转办选人-->
<user-select-modal ref="userSelectModal" check-required @change="continueTurnTo" />
</internal-detail-page>
</template>
<script>
import '@assets/less/common.less'
import InternalDetailPage from '@comp/InternalDetailPage'
import ProcessDetailList from '@comp/ProcessDetailList'
import PersonnelInfo from '@comp/PersonnelInfo'
import ProcessDetailList from '@comp/ProcessDetailList'
import InspectionProcessTable
from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable'
// 标准立项的人员信息
const approvalPersonalInfo = [ // 人员信息的数据
{
id: 1,
nodeName: '稽查负责人发起计划',
nodeRoleName: '稽查负责人',
canChoose: false,
userList: `系统管理员`
},
{
id: 2,
nodeName: '负责人主管级领导审批',
nodeRoleName: '负责人主管级领导',
canChoose: true,
chooseType: 'checkbox',
// chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
id: 3,
nodeName: '稽查负责人上传稽查报告和整改计划',
nodeRoleName: '稽查负责人',
canChoose: false,
chooseType: 'checkbox',
// chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
id: 4,
nodeName: '负责人主管级领导审批',
nodeRoleName: '负责人主管级领导',
canChoose: false,
chooseType: 'radio',
// chooseSource: 'contactManage',
fieldName: 'contactUser'
},
{
id: 5,
nodeName: '相关人员会签',
nodeRoleName: '相关人员',
canChoose: true,
chooseType: 'checkbox',
// chooseSource: 'contactManage',
fieldName: 'contactUser'
}
]
import UserSelectModal from '@comp/selection/UserSelectModal'
import { EsInspectionProcess, ProcessKey } from '@/enums/commonEnums'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
import { getInspectPlanDetail, getInspectPlanProjectId } from '@api/workCenter'
export default {
name: 'EnterpriseStandardInspectionProcess',
components: { InspectionProcessTable, PersonnelInfo, ProcessDetailList, InternalDetailPage },
components: { UserSelectModal, InspectionProcessTable, PersonnelInfo, ProcessDetailList, InternalDetailPage },
mixins: [WorkCenterMixin],
data () {
return {
loading: false,
@@ -167,8 +137,14 @@ export default {
xs: { span: 24 },
sm: { span: 22 }
},
currentNode: '5',
personnelInfoData: [], // 人员信息数据
// 当前流程信息
EsInspectionProcess,
info: {},
currentNode: '',
currentNodeName: '',
// 项目id
projectId: '',
btn: 0,
validatorRules: {
// 流程名称
processName: {
@@ -185,10 +161,10 @@ export default {
validateTrigger: 'blur'
}
},
// 流程表单
processInfoForm: this.$form.createForm(this),
// 流程审批信息表单
approvalInfoForm: this.$form.createForm(this),
// 是否会签
isCountersign: null,
url: {
list: '' // 人员信息右侧表的分页查询接口
}
@@ -196,41 +172,294 @@ export default {
},
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title
return this.$t('flowCenter') + this.$route.meta.title + '' + this.nodeTitle + ''
},
// 节点标题
nodeTitle () {
return this.$route.query.taskName || EsInspectionProcess.initiate.text
},
processDisabled () {
return +this.currentNode > 1
return this.currentNode !== EsInspectionProcess.initiate.value
}
},
created () {
const { projectId, nodeId, taskName } = this.$route.query
// 发起、草稿进来没有nodeId,就默认发起节点
this.currentNode = nodeId || EsInspectionProcess.initiate.value
this.currentNodeName = taskName || EsInspectionProcess.initiate.text
this.projectId = projectId
this.btn = EsInspectionProcess.propertyOfValue('btn', this.currentNode)
// 查询人员信息
this.getPersonInfoStructure(ProcessKey.ES_INSPECTION_PROCESS.value, () => {
this.initPersonInfoData(this.currentNode === EsInspectionProcess.initiate.value)
})
// 如果是待办进来,就获取详情数据
if (this.$route.query.projectId) {
this.loadPage()
return
}
// 如果是新建进来,就获取项目id
this.getProjectId()
},
methods: {
switchChange (value) {
this.switchValue = value
/**
* 获取项目id
*/
getProjectId () {
this.loading = true
// 否则就是创建一个新的流程
getInspectPlanProjectId().then(res => {
if (res) {
this.projectId = res + ''
}
}).finally(() => {
this.loading = false
})
},
handleSave () {
// if (this.loading) return
/**
* 获取页面详情
*/
loadPage () {
const { projectId, taskId } = this.$route.query
this.btn = EsInspectionProcess.propertyOfValue('btn', this.currentNode)
this.loading = true
getInspectPlanDetail({
projectId,
taskId
}).then(res => {
if (res.success) {
const data = res.result || {}
const processAll = data.processAll || {}
const map = data.map || {}
const processApprovalRecord = data.processApprovalRecord || {}
this.info = data
// 页面回显
this.processInfoForm && this.processInfoForm.setFieldsValue({
prcName: processAll.prcName,
dueTime: processAll.dueTime,
prcMes: processAll.prcMes
})
this.countersignForm && this.countersignForm.setFieldsValue({
pass: this.convertPass(map.pass)
})
this.approvalInfoForm && this.approvalInfoForm.setFieldsValue({
commitText: processApprovalRecord.commitText,
commitFile: processApprovalRecord.commitFile
})
}
}).finally(() => {
this.loading = false
})
},
// 获取人员信息
getPersonInfo (isValidate = true) {
let personnelObj = {}
const funName = isValidate ? 'getDataObjVerify' : 'getDataObj'
// 节点1:所有的人员信息
if (this.currentNode === EsInspectionProcess.initiate.value) {
// 人员信息的数据, 处理成对象
personnelObj = this.$refs.personnelInfo[funName]()
if (!personnelObj) {
return false
}
// List拆成数组
for (const key in personnelObj) {
if (personnelObj[key] && key.includes('List')) {
personnelObj[key] = personnelObj[key].split(',')
}
}
// 通过表格中的所属部门人员获取稽查征求意见对象
const userList = this.$refs.inspectionPlanTable.dataSource.map(item => item.objectOfConsultation.split(',')).flat(Infinity)
personnelObj.opinionFillList = Array.from(new Set(userList))
}
return personnelObj
},
// 获取页面参数
async getPageParams (isValidate = true) {
if (this.$refs.inspectionPlanTable.dataSource.length === 0) {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
throw new Error('base')
}
const params = {}
// 收集所有表单信息
let formDataList = []
if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm)
} else {
formDataList = [
this.processInfoForm.getFieldsValue(),
this.approvalInfoForm.getFieldsValue()
]
}
// 收集人员信息
const getPersonInfo = this.getPersonInfo(isValidate)
if (!getPersonInfo) {
throw new Error('user')
}
// 开始处理信息
// 流程信息
params.processAll = Object.assign({}, this.info.processAll, formDataList[0], {
projectId: this.projectId,
taskId: this.$route.query.taskId
})
// 处理其他参数
params.map = Object.assign({}, getPersonInfo)
// 流程审批信息
params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, formDataList[1], {
projectId: this.projectId
})
return params
},
/**
* 转办弹框
*/
handleTurnTo () {
this.$refs.userSelectModal.open()
},
/**
* 转办
*/
continueTurnTo (userId) {
if (this.loading) return
this.loading = true
const params = {
taskId: this.$route.query.taskId,
userId
}
Promise.resolve(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 保存
*/
handleSave () {
if (this.loading) return
this.loading = true
this.getPageParams(false).then(res => {
console.log(res)
return Promise.resolve(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
console.log(err)
}).finally(() => {
this.loading = false
})
},
/**
* 提交
*/
handleSubmit () {
if (this.loading) return
this.currentNode = +this.currentNode + 1 + ''
this.loading = true
let fn
switch (this.currentNode) {
case EsInspectionProcess.initiate.value:
fn = Promise.resolve
break
default:
fn = Promise.resolve
break
}
this.getPageParams().then(res => {
console.log(res)
return fn && fn(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
this.switchChange(err.message)
}).finally(() => {
this.loading = false
})
},
/**
* 同意
*/
handleAgree () {
if (this.loading) return
this.currentNode = +this.currentNode + 1 + ''
this.loading = true
this.getPageParams().then(res => {
res.map.pass = true
return Promise.resolve(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
this.switchChange(err.message)
}).finally(() => {
this.loading = false
})
},
// 是否会签改变
changeIsCountersign (val) {
if (val === '1') {
this.isCountersign = true
} else if (val === '2') {
this.isCountersign = false
} else {
this.isCountersign = null
/**
* 驳回
*/
handleReject () {
if (this.loading) return
this.loading = true
this.getPageParams().then(res => {
res.map.pass = false
return Promise.resolve(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
this.switchChange(err.message)
}).finally(() => {
this.loading = false
})
},
/**
* 验证所有表单
* @param formList - 多个需要校验的表单实例
*/
validateFormList (...formList) {
const promiseList = []
for (const form of formList) {
promiseList.push(
new Promise((resolve, reject) => {
form.validateFields((err, val) => {
if (!err) {
resolve(val)
} else {
reject(err)
}
})
})
)
}
return Promise.all(promiseList).catch(() => {
throw new Error('base')
})
}
},
mounted () {
this.personnelInfoData = approvalPersonalInfo
}
}
</script>