From b25e78e9887935e5955f0c5ad798104eca444016 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 08 四月 2025 18:12:09 +0800 Subject: [PATCH] 修改任务实现,流程日志扩展 --- src/api/flowable/todo.js | 8 + src/views/projectProcess/components/EditTask.vue | 195 ++++++++++++++++++++++++++++++++ src/api/projectProcess/projectProcess.js | 9 + src/views/projectProcess/detail/index.vue | 70 ++--------- src/views/projectProcess/components/LogView.vue | 10 + src/views/projectProcess/components/LogTimeLine.vue | 13 ++ 6 files changed, 247 insertions(+), 58 deletions(-) diff --git a/src/api/flowable/todo.js b/src/api/flowable/todo.js index 436efa4..007f685 100644 --- a/src/api/flowable/todo.js +++ b/src/api/flowable/todo.js @@ -131,6 +131,14 @@ params: query }) } +// 褰撳墠鑺傜偣琛ㄥ崟鏁版嵁 +export function currentFlowTaskForm(query) { + return request({ + url: '/flowable/task/current/flowTaskForm', + method: 'get', + params: query + }) +} // 娴佺▼鑺傜偣鏌ョ湅璇︽儏琛ㄥ崟 export function flowTaskFormDetail(processInsId, taskId) { return request({ diff --git a/src/api/projectProcess/projectProcess.js b/src/api/projectProcess/projectProcess.js index 5c0b743..d8bcc16 100644 --- a/src/api/projectProcess/projectProcess.js +++ b/src/api/projectProcess/projectProcess.js @@ -46,6 +46,15 @@ }) } +// 淇敼浠诲姟 +export const editTask = (data) => { + return request({ + url: "/project-process/admin/edit/finish/task", + method: "POST", + data: data + }) +} + // 娴佺▼寰呭姙鍒楄〃 export function getProjectProcessTodo(query) { return request({ diff --git a/src/views/projectProcess/components/EditTask.vue b/src/views/projectProcess/components/EditTask.vue new file mode 100644 index 0000000..8d0f19a --- /dev/null +++ b/src/views/projectProcess/components/EditTask.vue @@ -0,0 +1,195 @@ +<template> + <div> + <el-dialog + :title="'淇敼浠诲姟锛�' + currentTask.beforeNodeName" + :visible.sync="open" + :destroy-on-close="true" + :fullscreen="true" + :before-close="close"> + <el-row> + <el-col :span="16"> + <div v-if="currentTask != null && currentTask.formJsonObj != null"> + <v-form-render :form-data="currentTask.formJsonObj.formJson" ref="form"/> + </div> + </el-col> + <el-col :span="8"> + <div style="padding-left: 40px;min-height: 200px"> + <div style="position: relative"> + <div v-if="currentTask.taskStatus == '宸插畬鎴�'">褰撳墠鐘舵�侊細{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>锛� + <el-button type="primary" size="small" @click="openJump">鏀逛负璺宠繃</el-button> + <el-button type="primary" size="small" @click="openWait">鏀逛负瀹圭己</el-button> + <el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">鍙栨秷鐘舵�佹洿鏀�</el-button> + </div> + <div v-else-if="currentTask.taskStatus == '璺宠繃'">褰撳墠鐘舵�侊細{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>锛� + <el-button type="primary" size="small" @click="openWait">鏀逛负瀹圭己</el-button> + <el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">鍙栨秷鐘舵�佹洿鏀�</el-button> + </div> + <div v-else-if="currentTask.taskStatus == '瀹圭己'">褰撳墠鐘舵�侊細{{currentTask.taskStatus}}<span v-show="editForm.nowStatus">--->{{editForm.nowStatus}}</span>锛� + <el-button type="primary" size="small" @click="openJump">鏀逛负璺宠繃</el-button> + <el-button type="text" size="small" @click="cancelStatus" v-show="editForm.nowStatus">鍙栨秷鐘舵�佹洿鏀�</el-button> + </div> + <el-button style="position: absolute;right: 0px; top: 0px" type="primary" size="small" @click="save">淇� 瀛�</el-button> + </div> + <div style="margin-top: 15px"> + <el-form v-show="showJumpForm" :model="taskJumpForm" :rules="jumpRules" ref="jumpForm" label-position="left"> + <el-form-item label="璺宠繃璇存槑" prop="desc"> + <el-input v-model="taskJumpForm.desc"></el-input> + </el-form-item> + </el-form> + <el-form v-show="showWaitForm" :model="taskWaitForm" :rules="waitRules" ref="waitForm" label-position="left"> + <el-form-item label="瀹圭己璇存槑" prop="desc"> + <el-input v-model="taskWaitForm.desc"></el-input> + </el-form-item> + </el-form> + </div> + </div> + <div> + <log-time-line v-if="currentTask.events && currentTask.events.length > 0" :log-list="currentTask.events"/> + </div> + </el-col> + </el-row> + </el-dialog> + </div> +</template> + +<script> +import {currentFlowTaskForm} from "@/api/flowable/todo"; +import LogTimeLine from "@/views/projectProcess/components/LogTimeLine"; +import {editTask} from "@/api/projectProcess/projectProcess"; + +export default { + name: "EditTask", + components: {LogTimeLine}, + props: { + taskId: { + type: String, + required: true + }, + open: { + type: Boolean, + default: false + } + }, + watch: { + taskId: { + handler(newV) { + if (newV) { + currentFlowTaskForm({taskId: newV}).then(res => { + this.currentTask = res.data + this.editForm.originalStatus = res.data.taskStatus + this.editForm.taskId = newV + this.formJson = this.currentTask.formJsonObj.formJson + this.$nextTick(() => { + this.$refs.form.setFormJson(this.currentTask.formJsonObj.formJson); + this.$refs.form.setFormData(this.currentTask.formJsonObj); + }) + }) + } + } + } + }, + data() { + return { + showJumpForm: false, + showWaitForm: false, + jumpRules: { + desc: [ + { required: true, message: '璇疯緭鍏ヨ烦杩囪鏄�', trigger: 'blur' }, + ] + }, + waitRules: { + desc: [ + { required: true, message: '璇疯緭鍏ュ缂鸿鏄�', trigger: 'blur' }, + ] + }, + currentTask: { + + }, + taskJumpForm: { + desc: '' + }, + taskWaitForm: { + desc: '' + }, + formJson: {}, // 琛ㄥ崟json + formData: {}, // 濉啓鐨勮〃鍗曟暟鎹�, + editForm: { + taskId: '', + variables: null, + originalStatus: '', + nowStatus: '', + taskJumpForm: null, + taskWaitForm: null + } + } + }, + methods: { + cancelStatus() { + this.editForm.nowStatus = '' + this.showWaitForm = false + this.showJumpForm = false + this.editForm.taskWaitForm = {} + this.editForm.taskJumpForm = {} + }, + openJump() { + this.showWaitForm = false + this.editForm.taskWaitForm = {} + this.editForm.nowStatus = '璺宠繃' + this.showJumpForm = true + }, + openWait() { + this.showJumpForm = false + this.editForm.taskJumpForm = {} + this.editForm.nowStatus = '瀹圭己' + this.showWaitForm = true + }, + save() { + this.$refs.form.getFormData().then(formData => { + this.formData = formData + const param = { + formJson: this.formJson, + } + // 澶嶅埗瀵硅薄鐨勫睘鎬у�肩粰鏂扮殑瀵硅薄 + Object.assign(param, formData); + this.editForm.variables = param + if (this.editForm.nowStatus) { + if (this.editForm.nowStatus == '璺宠繃') { + this.$refs['jumpForm'].validate((valid) => { + if (valid) { + this.editForm.taskJumpForm = this.taskJumpForm + editTask(this.editForm).then(res => { + this.$message.success("淇敼鎴愬姛") + this.close() + }) + } + }) + } else if (this.editForm.nowStatus == '瀹圭己') { + this.$refs['waitForm'].validate((valid) => { + if (valid) { + this.editForm.taskWaitForm = this.taskWaitForm + editTask(this.editForm).then(res => { + this.$message.success("淇敼鎴愬姛") + this.close() + }) + } + }) + } + } else { + this.editForm.nowStatus = this.editForm.originalStatus + editTask(this.editForm).then(res => { + this.$message.success("淇敼鎴愬姛") + this.close() + }) + } + }) + }, + close() { + this.$emit("close") + } + } +} +</script> + +<style scoped> + +</style> diff --git a/src/views/projectProcess/components/LogTimeLine.vue b/src/views/projectProcess/components/LogTimeLine.vue index bda6f6b..db01762 100644 --- a/src/views/projectProcess/components/LogTimeLine.vue +++ b/src/views/projectProcess/components/LogTimeLine.vue @@ -93,6 +93,14 @@ <span class="tag">{{log.eventDataObj.content}}</span> </div> </div> + <div class="log" v-else-if="log.eventType === 'EDIT'"> + <div> + <span class="tag name">{{log.nickName}}</span> + <span class="tag db">淇敼</span> + 浜嗕换鍔� + <span class="tag taskName">{{log.taskName}}</span> + </div> + </div> <div class="log" v-else-if="log.eventType === 'TEAM_WORK'"> <div> <span class="tag name">{{log.nickName}}</span> @@ -124,7 +132,7 @@ getColor(log) { if (log.eventType === 'FINISHED') { return "#67C23A" - } else if (log.eventType === 'REJECT') { + } else if (log.eventType === 'REJECT' || log.eventType === 'EDIT') { return "#F56C6C" } else if (log.eventType === 'HANGUP') { return "#409EFF" @@ -148,4 +156,7 @@ .log { color: #606266; } +.tag { + margin: 0 5px; +} </style> diff --git a/src/views/projectProcess/components/LogView.vue b/src/views/projectProcess/components/LogView.vue index 12b2472..70e5322 100644 --- a/src/views/projectProcess/components/LogView.vue +++ b/src/views/projectProcess/components/LogView.vue @@ -104,6 +104,16 @@ <span class="tag">{{log.eventDataObj.content}}</span> </div> </div> + <div class="log" v-else-if="log.eventType === 'EDIT'"> + <div> + <span class="tag name">{{log.nickName}}</span> + 浜� + <span class="tag time">{{log.gmtCreate}}</span> + <span class="tag db">淇敼</span> + 浜嗕换鍔� + <span class="tag taskName">{{log.taskName}}</span> + </div> + </div> <div class="log" v-else-if="log.eventType === 'TEAM_WORK'"> <div> <span class="tag name">{{log.nickName}}</span> diff --git a/src/views/projectProcess/detail/index.vue b/src/views/projectProcess/detail/index.vue index 823ec0d..ca42051 100644 --- a/src/views/projectProcess/detail/index.vue +++ b/src/views/projectProcess/detail/index.vue @@ -88,6 +88,7 @@ <el-button v-if="scope.row.taskStatus !== '鏈紑濮�'" @click="goToProcessDetail(scope.row)" type="text" size="small">鏌ョ湅</el-button> <el-button v-if="showHandle(scope.row)" @click="goToDo(scope.row)" type="text" size="small">鍔炵悊</el-button> <el-button v-if = "scope.row.taskStatus === '寰呭姙'" @click="openSupervise(scope.row)" type="text" size="small">鐫e姙</el-button> + <el-button v-if = "scope.row.taskStatus === '宸插畬鎴�' || scope.row.taskStatus === '璺宠繃' || scope.row.taskStatus === '瀹圭己'" v-hasPermi="['task:edit']" @click="openEditTask(scope.row)" type="text" size="small">淇敼</el-button> </template> </el-table-column> </el-table> @@ -127,62 +128,6 @@ <log-view style="padding: 10px 20px" :log-list="logList"/> </el-drawer> -<!-- <el-dialog--> -<!-- :title="`${this.queryParams.processName}锛氭祦杞褰昤"--> -<!-- :visible.sync="processRecordShow"--> -<!-- :fullscreen="true"--> -<!-- :close-on-click-modal="false"--> -<!-- :destroy-on-close="true"--> -<!-- >--> -<!-- <div>--> -<!-- <log-view :log-list="logList"/>--> -<!--<!– <div class="block">–>--> -<!--<!– <el-timeline>–>--> -<!--<!– <el-timeline-item–>--> -<!--<!– v-for="(item,index ) in flowRecordList"–>--> -<!--<!– :key="index"–>--> -<!--<!– :icon="setIcon(item.finishTime)"–>--> -<!--<!– :color="setColor(item.finishTime)"–>--> -<!--<!– >–>--> -<!--<!– <p style="font-weight: 700">{{item.taskName}}–>--> -<!--<!– <span v-if="item.comment && item.comment.type === '3'" style="color: red">(鎵ц浜嗛┏鍥�)</span>–>--> -<!--<!– <span v-if="item.overtime && item.overtime==='red'" style="color: red">(宸茶秴鏃�)</span>–>--> -<!--<!– <span v-if="item.overtime && item.overtime==='yellow'" style="color: orange">(鍗冲皢瓒呮椂)</span>–>--> -<!--<!– </p>–>--> -<!--<!– <el-card :body-style="{ padding: '10px' }">–>--> -<!--<!– <el-descriptions class="margin-top" :column="1" size="small" border>–>--> -<!--<!– <el-descriptions-item v-if="item.assigneeName" label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-user"></i>鍔炵悊浜�</template>–>--> -<!--<!– {{item.assigneeName}}–>--> -<!--<!– <el-tag type="info" size="mini">{{item.deptName}}</el-tag>–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– <el-descriptions-item v-if="item.candidate" label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-user"></i>鍊欓�夊姙鐞�</template>–>--> -<!--<!– {{item.candidate}}–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– <el-descriptions-item label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-date"></i>鎺ユ敹鏃堕棿</template>–>--> -<!--<!– {{item.createTime}}–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– <el-descriptions-item v-if="item.finishTime" label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-date"></i>澶勭悊鏃堕棿</template>–>--> -<!--<!– {{item.finishTime}}–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– <el-descriptions-item v-if="item.duration" label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-time"></i>鑰楁椂</template>–>--> -<!--<!– {{item.duration}}–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– <el-descriptions-item v-if="item.comment" label-class-name="my-label">–>--> -<!--<!– <template slot="label"><i class="el-icon-tickets"></i>澶勭悊鎰忚</template>–>--> -<!--<!– {{item.comment.comment}}–>--> -<!--<!– </el-descriptions-item>–>--> -<!--<!– </el-descriptions>–>--> -<!--<!– </el-card>–>--> -<!--<!– </el-timeline-item>–>--> -<!--<!– </el-timeline>–>--> -<!--<!– </div>–>--> -<!-- </div>--> -<!-- </el-dialog>--> <el-dialog :visible.sync="superviseShow" width="1000px" title="鐫e姙" append-to-body> <el-form ref="superviseForm" :model="superviseForm" :rules="superviseRules" label-width="80px"> <el-form-item label="鐫e姙鍐呭" prop="content"> @@ -194,6 +139,8 @@ <el-button type="primary" @click="submitSupervise">纭� 瀹�</el-button> </div> </el-dialog> + + <edit-task :task-id="editTaskId" :open="editTaskOpen" @close="editTaskOpen = false; editTaskId = ''"/> </div> </template> @@ -206,6 +153,7 @@ import {flowXmlAndNode} from "@/api/flowable/definition"; import BpmnViewer from '@/components/Process/viewer'; import LogView from "@/views/projectProcess/components/LogView"; +import EditTask from "@/views/projectProcess/components/EditTask"; import {flowRecord} from "@/api/flowable/finished"; import {editProject} from "@/api/projectEngineering/projectInfo"; import {getProjectProcessLog} from "@/api/flowLog/flowLog"; @@ -214,10 +162,13 @@ name: "Detail", components: { BpmnViewer, - LogView + LogView, + EditTask }, data() { return { + editTaskId: '', + editTaskOpen: false, logList: [], // 娴佺▼鏃ュ織 processRecordShow: false, // 娴佽浆璁板綍鏄剧ず flowRecordList: [], // 娴佺▼娴佽浆鏁版嵁 @@ -280,6 +231,11 @@ this.getProjectProcessInfo() }, methods: { + // 鎵撳紑缂栬緫浠诲姟 + openEditTask(row) { + this.editTaskOpen = true + this.editTaskId = row.taskId + }, transEventType(selectTabId) { if (selectTabId == 1) { return "all" -- Gitblit v1.8.0