update handbook
This commit is contained in:
		
							parent
							
								
									4a10c031a8
								
							
						
					
					
						commit
						c928773ab3
					
				| @ -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); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -37,6 +37,11 @@ public class WfDetailVo { | ||||
| 
 | ||||
|     private WfViewerVo flowViewer; | ||||
| 
 | ||||
|     /** | ||||
|      * zqjia: 新增字段,流程实例ID,和项目申报关联用 | ||||
|      */ | ||||
|     private String procInsId; | ||||
| 
 | ||||
|     /** | ||||
|      * 是否存在任务表单信息 | ||||
|      * @return true:存在;false:不存在 | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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({ | ||||
|  | ||||
| @ -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 | ||||
|   }, | ||||
|  | ||||
| @ -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] | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     // 取消按钮 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user