add handbookList

jzq 2024-07-12 12:09:09 +08:00
parent 2f01ece7a5
commit 4a10c031a8
10 changed files with 3756 additions and 6 deletions

View File

@ -67,7 +67,8 @@ public class SysOssController extends BaseController {
* *
* @param file * @param file
*/ */
@SaCheckPermission("system:oss:upload") // @SaCheckPermission("system:oss:upload")
// zqjia:这个权限校验打开的话普通用户无法上传文件,导致无法上传指南和申报书
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT) @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
@ -87,7 +88,8 @@ public class SysOssController extends BaseController {
* *
* @param ossId OSSID * @param ossId OSSID
*/ */
@SaCheckPermission("system:oss:download") // @SaCheckPermission("system:oss:download")
// zqjia:这个权限校验打开的话普通用户无法下载文件,导致无法下载指南
@GetMapping("/download/{ossId}") @GetMapping("/download/{ossId}")
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
iSysOssService.download(ossId,response); iSysOssService.download(ossId,response);

View File

@ -59,6 +59,16 @@ public class WfProcessController extends BaseController {
return processService.selectPageOwnProcessList(processQuery, pageQuery); return processService.selectPageOwnProcessList(processQuery, pageQuery);
} }
/**
* handbook
*/
// zqjia: 这个地方的权限还没弄明白
@SaCheckPermission("workflow:process:handbookList")
@GetMapping(value = "/handbookList")
public TableDataInfo<WfTaskVo> handbookList(ProcessQuery processQuery, PageQuery pageQuery) {
return processService.selectPageHandbookList(processQuery, pageQuery);
}
/** /**
* *
*/ */
@ -184,8 +194,8 @@ public class WfProcessController extends BaseController {
* @param definitionId id * @param definitionId id
* @param deployId id * @param deployId id
*/ */
@GetMapping("/getProcessForm")
@SaCheckPermission("workflow:process:start") @SaCheckPermission("workflow:process:start")
@GetMapping("/getProcessForm")
public R<?> getForm(@RequestParam(value = "definitionId") String definitionId, public R<?> getForm(@RequestParam(value = "definitionId") String definitionId,
@RequestParam(value = "deployId") String deployId, @RequestParam(value = "deployId") String deployId,
@RequestParam(value = "procInsId", required = false) String procInsId) { @RequestParam(value = "procInsId", required = false) String procInsId) {
@ -203,7 +213,6 @@ public class WfProcessController extends BaseController {
public R<Void> start(@PathVariable(value = "processDefId") String processDefId, @RequestBody Map<String, Object> variables) { public R<Void> start(@PathVariable(value = "processDefId") String processDefId, @RequestBody Map<String, Object> variables) {
processService.startProcessByDefId(processDefId, variables); processService.startProcessByDefId(processDefId, variables);
return R.ok("流程启动成功"); return R.ok("流程启动成功");
} }
/** /**

View File

@ -35,6 +35,8 @@ public interface IWfProcessService {
*/ */
TableDataInfo<WfTaskVo> selectPageOwnProcessList(ProcessQuery processQuery, PageQuery pageQuery); TableDataInfo<WfTaskVo> selectPageOwnProcessList(ProcessQuery processQuery, PageQuery pageQuery);
TableDataInfo<WfTaskVo> selectPageHandbookList(ProcessQuery processQuery, PageQuery pageQuery);
/** /**
* *
*/ */

View File

@ -213,6 +213,67 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
return TableDataInfo.build(page); return TableDataInfo.build(page);
} }
public TableDataInfo<WfTaskVo> selectPageHandbookList(ProcessQuery processQuery, PageQuery pageQuery) {
Page<WfTaskVo> page = new Page<>();
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
.orderByProcessInstanceStartTime()
.desc();
// 构建搜索条件
ProcessUtils.buildProcessSearch(historicProcessInstanceQuery, processQuery);
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery
.listPage(offset, pageQuery.getPageSize());
page.setTotal(historicProcessInstanceQuery.count());
List<WfTaskVo> taskVoList = new ArrayList<>();
for (HistoricProcessInstance hisIns : historicProcessInstances) {
WfTaskVo taskVo = new WfTaskVo();
// 获取流程状态
HistoricVariableInstance processStatusVariable = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(hisIns.getId())
.variableName(ProcessConstants.PROCESS_STATUS_KEY)
.singleResult();
String processStatus = null;
if (ObjectUtil.isNotNull(processStatusVariable)) {
processStatus = Convert.toStr(processStatusVariable.getValue());
}
// 兼容旧流程
if (processStatus == null) {
processStatus = ObjectUtil.isNull(hisIns.getEndTime()) ? ProcessStatus.RUNNING.getStatus() : ProcessStatus.COMPLETED.getStatus();
}
// zqjia:只返回完成的指南
if (!"completed".equals(processStatus)) {
continue;
}
taskVo.setProcessStatus(processStatus);
taskVo.setCreateTime(hisIns.getStartTime());
taskVo.setFinishTime(hisIns.getEndTime());
taskVo.setProcInsId(hisIns.getId());
// 计算耗时
if (Objects.nonNull(hisIns.getEndTime())) {
taskVo.setDuration(DateUtils.getDatePoor(hisIns.getEndTime(), hisIns.getStartTime()));
} else {
taskVo.setDuration(DateUtils.getDatePoor(DateUtils.getNowDate(), hisIns.getStartTime()));
}
// 流程部署实例信息
Deployment deployment = repositoryService.createDeploymentQuery()
.deploymentId(hisIns.getDeploymentId()).singleResult();
taskVo.setDeployId(hisIns.getDeploymentId());
taskVo.setProcDefId(hisIns.getProcessDefinitionId());
taskVo.setProcDefName(hisIns.getProcessDefinitionName());
taskVo.setProcDefVersion(hisIns.getProcessDefinitionVersion());
taskVo.setCategory(deployment.getCategory());
// 当前所处流程
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).includeIdentityLinks().list();
if (CollUtil.isNotEmpty(taskList)) {
taskVo.setTaskName(taskList.stream().map(Task::getName).filter(StringUtils::isNotEmpty).collect(Collectors.joining(",")));
}
taskVoList.add(taskVo);
}
page.setRecords(taskVoList);
return TableDataInfo.build(page);
}
@Override @Override
public List<WfTaskVo> selectOwnProcessList(ProcessQuery processQuery) { public List<WfTaskVo> selectOwnProcessList(ProcessQuery processQuery) {
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery() HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()

View File

@ -60,6 +60,14 @@ export function listOwnProcess(query) {
}) })
} }
export function listHandbook(query) {
return request({
url: '/workflow/process/handbookList',
method: 'get',
params: query
})
}
// 我待办的流程 // 我待办的流程
export function listTodoProcess(query) { export function listTodoProcess(query) {
return request({ return request({

View File

@ -0,0 +1,418 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="流程标识" prop="processKey">
<el-input
v-model="queryParams.processKey"
placeholder="请输入流程标识"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="流程名称" prop="processName">
<el-input
v-model="queryParams.processName"
placeholder="请输入流程名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="流程分类" prop="category">
<el-select v-model="queryParams.category" clearable placeholder="请选择" size="small">
<el-option
v-for="item in categoryOptions"
:key="item.categoryId"
:label="item.categoryName"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="提交时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
v-hasPermi="['workflow:process:ownExport']"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- <el-table v-loading="loading" :data="handbookList" @selection-change="handleSelectionChange">-->
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/>-->
<!-- <el-table-column label="指南名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>-->
<!-- <el-table-column label="流程类别" align="center" prop="category" :formatter="categoryFormat" />-->
<!-- <el-table-column label="流程版本" align="center" width="80px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="当前节点" align="center" prop="taskName"/>-->
<!-- <el-table-column label="提交时间" align="center" prop="createTime" width="180"/>-->
<!-- <el-table-column label="流程状态" align="center" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.wf_process_status" :value="scope.row.processStatus"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="耗时" align="center" prop="duration" width="180"/>-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- type="text"-->
<!-- size="mini"-->
<!-- icon="el-icon-tickets"-->
<!-- @click="handleFlowRecord(scope.row)"-->
<!-- v-hasPermi="['workflow:process:query']"-->
<!-- >详情</el-button>-->
<!-- <el-button-->
<!-- type="text"-->
<!-- size="mini"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-if="scope.row.finishTime"-->
<!-- v-hasPermi="['workflow:process:remove']"-->
<!-- >删除</el-button>-->
<!-- <el-button-->
<!-- type="text"-->
<!-- size="mini"-->
<!-- icon="el-icon-circle-close"-->
<!-- @click="handleStop(scope.row)"-->
<!-- v-hasPermi="['workflow:process:cancel']"-->
<!-- >取消</el-button>-->
<!-- <el-button-->
<!-- type="text"-->
<!-- size="mini"-->
<!-- icon="el-icon-refresh-right"-->
<!-- v-hasPermi="['workflow:process:start']"-->
<!-- @click="handleAgain(scope.row)"-->
<!-- >重新发起</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<el-table v-loading="loading" :data="showList" @selection-change="handleSelectionChange">
<el-table-column label="指南名称" align="center">
<template slot-scope="scope">
{{ scope.row[0] }}
</template>
</el-table-column>
<el-table-column label="指南类别" align="center">
<template slot-scope="scope">
{{ scope.row[1] }}
</template>
</el-table-column>
<el-table-column label="指南级别" align="center">
<template slot-scope="scope">
{{ scope.row[2] }}
</template>
</el-table-column>
<el-table-column label="截至日期" align="center">
<template slot-scope="scope">
{{ scope.row[3] }}
</template>
</el-table-column>
<el-table-column label="指南文件" align="center">
<template slot-scope="scope">
<el-button class="file" @click="handbookDownload(scope.row[5])">{{ scope.row[4] }}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {stopProcess, delProcess, listHandbook, detailProcess} from '@/api/workflow/process';
import { listAllCategory } from '@/api/workflow/category';
import Parser from '@/utils/generator/parser'
import {getToken} from "@/utils/auth";
// import {deepClone} from "@/utils";
export default {
name: "Own",
dicts: ['wf_process_status'],
components: {
Parser,
},
data() {
return {
//
loading: true,
processLoading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
categoryOptions: [],
processTotal:0,
//
handbookList: [],
//
title: "",
//
open: false,
src: "",
definitionList:[],
//
dateRange: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
processKey: undefined,
processName: undefined,
category: "004"
},
//
form: {},
//
rules: {
},
processFormList: [], //
showList: [],
};
},
created() {
this.getCategoryList();
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.getList()
})
},
methods: {
//
handbookDownload(ossId) {
this.$download.oss(ossId)
},
//
getProcessDetails(procInsId, taskId) {
const params = {procInsId: procInsId, taskId: taskId}
detailProcess(params).then(res => {
const data = res.data;
const formList = data.processFormList;
formList.forEach(form => {
var dataShow = [];
const fields = form.fields;
// zqjia:fields
for (var i = 0; i < fields.length; i++) {
const tmp = fields[i];
const slot = tmp.__slot__;
const config = tmp.__config__;
if (i === 4 && config.defaultValue) {
tmp['file-list'] = config.defaultValue;
tmp['headers'] = {
Authorization: "Bearer " + getToken(),
}
// tmp['on-success'] = (res, file, fileList) => {
// if (res.code === 200 && fileList) {
// config.defaultValue = fileList;
// fileList.forEach(val =>{
// val.url = val.response.data.url;
// val.ossId = val.response.data.ossId;
// })
// }
// };
// zqjia:ossId
dataShow.push(config.defaultValue[0].name);
dataShow.push(config.defaultValue[0].ossId);
}
else {
if (slot !== undefined && slot.options !== undefined) {
dataShow.push(slot.options[config.defaultValue - 1].label);
}
else {
dataShow.push(config.defaultValue);
}
}
}
this.showList.push(dataShow);
});
// zqjia:
this.processFormList.push(data.processFormList);
})
},
/** 查询流程分类列表 */
getCategoryList() {
listAllCategory().then(response => this.categoryOptions = response.data)
},
/** 查询流程定义列表 */
getList() {
this.loading = true;
listHandbook(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.handbookList = response.rows;
this.total = response.total;
this.loading = false;
this.handbookList.forEach(handbook => {
this.getProcessDetails(handbook.procInsId, undefined);
});
});
// console.log(this.showList);
console.log(this.processFormList);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
category: null,
key: null,
tenantId: null,
deployTime: null,
derivedFrom: null,
derivedFromRoot: null,
parentDeploymentId: null,
engineVersion: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.procInsId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
handleAgain(row) {
this.$router.push({
path: '/workflow/process/start/' + row.deployId,
query: {
definitionId: row.procDefId,
procInsId: row.procInsId
}
})
},
/** 取消流程申请 */
handleStop(row){
const params = {
procInsId: row.procInsId
}
stopProcess(params).then( res => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
/** 流程流转记录 */
handleFlowRecord(row) {
this.$router.push({
path: '/workflow/process/detail/' + row.procInsId,
query: {
processed: false
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.procInsId || this.ids;
this.$confirm('是否确认删除流程定义编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delProcess(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
this.download('workflow/process/ownExport', {
...this.queryParams
}, `wf_own_process_${new Date().getTime()}.xlsx`)
},
categoryFormat(row, column) {
return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';
}
}
};
</script>
<style scoped>
.file {
border: none;
background: none;
/* 取消其他默认样式 */
box-shadow: none;
padding: 0;
margin: 0;
}
.file:hover {
background: none; /* 去掉鼠标悬停时的背景 */
/* 如果需要可以添加其他hover效果 */
}
</style>

View File

@ -434,7 +434,7 @@ export default {
} }
this.historyProcNodeList = data.historyProcNodeList; this.historyProcNodeList = data.historyProcNodeList;
this.finishedInfo = data.flowViewer; this.finishedInfo = data.flowViewer;
this.formOpen = true this.formOpen = true;
}) })
}, },
onSelectCopyUsers() { onSelectCopyUsers() {

View File

@ -253,7 +253,6 @@ export default {
procInsId: row.procInsId procInsId: row.procInsId
} }
}) })
console.log(row);
}, },
/** 取消流程申请 */ /** 取消流程申请 */
handleStop(row){ handleStop(row){

File diff suppressed because one or more lines are too long