update handbook

jzq 2024-07-13 18:09:38 +08:00
parent 4a10c031a8
commit c928773ab3
6 changed files with 157 additions and 134 deletions

View File

@ -17,13 +17,17 @@ import com.ruoyi.workflow.service.IWfCopyService;
import com.ruoyi.workflow.service.IWfProcessService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
*
@ -245,4 +249,15 @@ public class WfProcessController extends BaseController {
public R detail(String procInsId, String taskId) {
return R.ok(processService.queryProcessDetail(procInsId, taskId));
}
@PostMapping("/details")
public TableDataInfo<WfDetailVo> details(@RequestBody List<String> procInsIds) {
List<WfDetailVo> processDetails = new ArrayList<>();
for (int i = 0; i < procInsIds.size(); i++) {
String procInsId = procInsIds.get(i);
WfDetailVo detailVo = processService.queryProcessDetail(procInsId, null);
processDetails.add(detailVo);
}
return TableDataInfo.build(processDetails);
}
}

View File

@ -37,6 +37,11 @@ public class WfDetailVo {
private WfViewerVo flowViewer;
/**
* zqjia: ID
*/
private String procInsId;
/**
*
* @return true:false:

View File

@ -734,6 +734,7 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
detailVo.setHistoryProcNodeList(historyProcNodeList(historicProcIns));
detailVo.setProcessFormList(processFormList(bpmnModel, historicProcIns));
detailVo.setFlowViewer(getFlowViewer(bpmnModel, procInsId));
detailVo.setProcInsId(procInsId);
return detailVo;
}

View File

@ -51,6 +51,14 @@ export function detailProcess(query) {
})
}
export function detailProcesses(arr) {
return request({
url: '/workflow/process/details',
method: 'post',
data: arr
})
}
// 我的发起的流程
export function listOwnProcess(query) {
return request({

View File

@ -21,7 +21,7 @@ import { getProcessForm, startProcess } from '@/api/workflow/process'
import Parser from '@/utils/generator/parser'
export default {
name: 'WorkStart',
name: 'handbookApply',
components: {
Parser
},

View File

@ -68,87 +68,39 @@
@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] }}
{{ scope.row.handbookname }}
</template>
</el-table-column>
<el-table-column label="指南类别" align="center">
<template slot-scope="scope">
{{ scope.row[1] }}
{{ scope.row.handbookclass }}
</template>
</el-table-column>
<el-table-column label="指南级别" align="center">
<template slot-scope="scope">
{{ scope.row[2] }}
{{ scope.row.handbooklevel }}
</template>
</el-table-column>
<el-table-column label="截至日期" align="center">
<template slot-scope="scope">
{{ scope.row[3] }}
{{ scope.row.handbookdate }}
</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>
<el-button class="file" @click="handbookDownload(scope.row.handbookfile)"></el-button>
</template>
</el-table-column>
<el-table-column label="项目申报" align="center">
<template slot-scope="scope">
<el-button class="file" @click="projectApply(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
@ -165,14 +117,21 @@
</template>
<script>
import {stopProcess, delProcess, listHandbook, detailProcess} from '@/api/workflow/process';
import {
stopProcess,
delProcess,
listHandbook,
detailProcess,
detailProcesses,
listProcess
} 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",
name: "handbookQuery",
dicts: ['wf_process_status'],
components: {
Parser,
@ -194,8 +153,6 @@ export default {
total: 0,
categoryOptions: [],
processTotal:0,
//
handbookList: [],
//
title: "",
//
@ -218,73 +175,86 @@ export default {
rules: {
},
processFormList: [], //
//
handbookList: [],
//
showList: [],
};
},
created() {
this.getCategoryList();
},
beforeRouteEnter(to, from, next) {
next(vm => {
vm.getList()
})
async created() {
await this.getList();
await this.getProcessDetails();
},
methods: {
//
handbookDownload(ossId) {
this.$download.oss(ossId)
handbookDownload(handbookfile) {
handbookfile.forEach( file => {
if(file.response.code === 200 && file.ossId) {
this.$download.oss(file.ossId);
}
})
},
projectApply(row) {
let queryParams = {
pageNum: 1,
pageSize: 10,
processKey: undefined,
processName: "项目申报",
category: "002"
};
//
listProcess(queryParams).then(response => {
const apply = response.rows[0];
if(apply) {
this.$router.push({
path: '/workflow/process/start/' + apply.deploymentId,
query: {
definitionId: apply.definitionId,
processName: apply.processName,
}
})
}
});
},
/** 查询流程定义列表 */
getList() {
// zqjia:仿parser.js
return new Promise((resolve,reject)=>{
this.showList = [];
this.loading = true;
listHandbook(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.handbookList = response.rows;
this.total = response.total;
this.loading = false;
resolve();
});
})
},
//
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;
getProcessDetails() {
return new Promise((resolve, reject)=>{
let pId = [];
let tId = [];
this.handbookList.forEach(handbook => {
pId.push(handbook.procInsId);
tId.push(undefined);
})
const params = {procInsIds: pId};
detailProcesses(pId).then(res => {
res.rows.forEach(row => {
let processForm = row.processFormList[0];
let formData = [];
this.initFormData(processForm.fields, formData);
formData["procDefId"] = row.procInsId;
// 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);
this.showList.push(formData);
})
})
})
},
@ -292,19 +262,43 @@ export default {
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);
initFormData(componentList, formData) {
componentList.forEach(cur => {
this.buildOptionMethod(cur)
const config = cur.__config__;
if (cur.__vModel__) {
if(cur.__slot__ && 'options' in cur.__slot__) {
formData[cur.__vModel__] = cur.__slot__.options[config.defaultValue-1].label;
}
else {
formData[cur.__vModel__] = config.defaultValue;
}
}
if (config.children) {
this.initFormData(config.children, formData);
}
})
},
// Option
buildOptionMethod(scheme) {
const config = scheme.__config__;
if (config && config.tag === 'el-cascader') {
if (config.dataType === 'dynamic') {
this.$axios({
method: config.method,
url: config.url
}).then(resp => {
var { data } = resp
scheme[config.dataConsumer] = data[config.dataKey]
});
}
}
},
//