{{ $t('turnTo') }}
@@ -107,12 +108,17 @@ import ProcessDetailList from '@comp/ProcessDetailList'
import InspectionProcessTable
from '@views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable'
import UserSelectModal from '@comp/selection/UserSelectModal'
-import { ApprovalOpinions, EsInspectionProcess, ProcessKey } from '@/enums/commonEnums'
+import { ApprovalOpinions, EsInspectionProcess, ProcessKey, ProcessType } from '@/enums/commonEnums'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
import {
approvalInspectProcess,
getInspectProcessDetail,
- getInspectProcessProjectId, rejectInspectProcess, saveInspectProcess, startInspectProcess, transferInspectProcess
+ getInspectProcessProjectId, getLookData,
+ rejectInspectProcess,
+ saveInspectProcess,
+ saveSnapShot,
+ startInspectProcess,
+ transferInspectProcess
} from '@api/workCenter'
const tabList = ['base', 'user']
@@ -124,7 +130,7 @@ export default {
return {
loading: false,
switchValue: 'base',
- disabled: false,
+ disabled: false, // 全部禁用
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
@@ -197,7 +203,8 @@ export default {
}
},
created () {
- const { projectId, nodeId, taskName } = this.$route.query
+ const { projectId, nodeId, taskName, isLook } = this.$route.query
+ this.disabled = isLook === '1'
// 发起、草稿进来没有nodeId,就默认发起节点
this.currentNode = nodeId || EsInspectionProcess.initiate.value
this.currentNodeName = taskName || EsInspectionProcess.initiate.text
@@ -212,6 +219,11 @@ export default {
this.getPersonInfoStructure(this.processKey, () => {
this.initPersonInfoData(this.isInitiate)
})
+ // 快照回显
+ if (this.$route.query.snapshotId) {
+ this.loadSnapshotPage()
+ return
+ }
// 如果是待办或草稿进来,就获取详情数据
if (this.$route.query.projectId) {
this.loadPage()
@@ -381,6 +393,8 @@ export default {
// 保存清空校验
this.approvalInfoForm.validateFields(['commitText'], { force: true }, () => {})
}
+ // 保存一下所有表单收集的数据用于快照回显
+ params.formDataList = formDataList
// 收集人员信息
const personInfo = this.getPersonInfo(isValidate && !flag)
if (!personInfo) {
@@ -410,7 +424,9 @@ export default {
// 人员信息(要重新获取,流程里的信息不能直接用,后端需要多选人员处理成数组了)
personInfo: this.$refs.personnelInfo.getDataObj(),
// 业务表格数据,用于强制撤回后回显
- draftData: params.processEsInspectList
+ draftData: params.processEsInspectList,
+ // 将流程数据保存json,后续进行快照回显
+ prcData: params
})
}
@@ -420,6 +436,61 @@ export default {
}
return params
},
+ /**
+ * 保存快照信息
+ */
+ saveSnapShotInfo (prcParams) {
+ // 没有taskId就不保存
+ if (!this.$route.query.taskId) {
+ return Promise.resolve()
+ }
+ const { processAll = {}, processApprovalRecord = {} } = prcParams
+ const params = Object.assign({}, {
+ taskId: this.$route.query.taskId,
+ pcrType: ProcessType.ES_INSPECTION_PROCESS.value,
+ // 流程信息
+ prcName: processAll.prcName,
+ processDueDate: processAll.dueTime,
+ processDescription: processAll.prcMes,
+ // 流程审批信息
+ handleText: processApprovalRecord.commitText,
+ handleFile: processApprovalRecord.commitFile,
+ // 流程json字符串存储全部信息
+ infoJsonStr: JSON.stringify({
+ // 人员信息
+ personInfo: this.$refs.personnelInfo.getDataObj(),
+ // 流程信息
+ prcData: prcParams
+ })
+ })
+ return saveSnapShot(params)
+ },
+ // 回显快照页面
+ loadSnapshotPage () {
+ const { snapshotId } = this.$route.query
+ if (!snapshotId) {
+ return
+ }
+ this.loading = true
+ getLookData({ snapshotId }).then(res => {
+ const result = res.result || {}
+ const jsonData = JSON.parse(result.infoJsonStr || '{}')
+ const prcData = jsonData.prcData || {}
+ this.info = prcData
+ this.$refs.inspectionProcessTable.setData(prcData.processEsInspectList || [])
+ this.processInfoForm && this.processInfoForm.setFieldsValue({
+ prcName: prcData.processAll.prcName,
+ dueTime: prcData.processAll.dueTime,
+ prcMes: prcData.processAll.prcMes
+ })
+ this.approvalInfoForm && this.approvalInfoForm.setFieldsValue({
+ commitText: prcData.processApprovalRecord.commitText,
+ commitFile: prcData.processApprovalRecord.commitFile
+ })
+ }).finally(() => {
+ this.loading = false
+ })
+ },
/**
* 转办弹框
*/
@@ -526,19 +597,27 @@ export default {
handleAgree (isSubmitBtn) {
if (this.loading) return
this.loading = true
- this.getPageParams().then(res => {
+ this.getPageParams().then(params => {
// 同意和提交一直传true
- res.map.pass = true
+ params.map.pass = true
// 不是提交按钮
if (isSubmitBtn !== true) {
// 没有填写注释,就默认同意
- if (!res.processApprovalRecord.commitText) {
- res.processApprovalRecord.commitText = '同意'
+ if (!params.processApprovalRecord.commitText) {
+ params.processApprovalRecord.commitText = '同意'
}
// 审批意见
- res.processApprovalRecord.commitFlag = ApprovalOpinions.AGREE.value
+ params.processApprovalRecord.commitFlag = ApprovalOpinions.AGREE.value
}
- return approvalInspectProcess(res)
+ console.log(params)
+ // 保存快照,成功了就调接口,失败了就提示
+ return this.saveSnapShotInfo(params).then(res => {
+ if (res.success) {
+ return approvalInspectProcess(params)
+ } else {
+ return res
+ }
+ })
}).then(res => {
if (res.success) {
this.$message.success(res.message)
@@ -577,11 +656,18 @@ export default {
return
}
this.loading = true
- this.getPageParams().then(res => {
- res.map.pass = false
+ this.getPageParams().then(params => {
+ params.map.pass = false
// 审批意见
- res.processApprovalRecord.commitFlag = ApprovalOpinions.REJECT.value
- return rejectInspectProcess(res)
+ params.processApprovalRecord.commitFlag = ApprovalOpinions.REJECT.value
+ // 保存快照,成功了就调接口,失败了就提示
+ return this.saveSnapShotInfo(params).then(res => {
+ if (res.success) {
+ return rejectInspectProcess(params)
+ } else {
+ return res
+ }
+ })
}).then(res => {
if (res.success) {
this.$message.success(res.message)
diff --git a/src/views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable.vue b/src/views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable.vue
index e417483b..10a30146 100644
--- a/src/views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable.vue
+++ b/src/views/workCenter/enterpriseStandardInspectionProcess/modules/InspectionProcessTable.vue
@@ -1,6 +1,6 @@
-
@@ -108,6 +110,12 @@ export default {
components: { UserSelection, InspectionProcessRectificationPlan, InspectionProcessReport, InspectionProcessContent, InspectionProcessTableModal, JTable },
mixins: [JeroListMixin],
props: {
+ // 禁用
+ disabled: {
+ type: Boolean,
+ default: false,
+ required: false
+ },
// 当前节点
currentNode: {
type: String,