diff --git a/src/main/java/com/budwk/app/flow/controller/FlowDesignController.java b/src/main/java/com/budwk/app/flow/controller/FlowDesignController.java index d0814f1..fe1bc14 100644 --- a/src/main/java/com/budwk/app/flow/controller/FlowDesignController.java +++ b/src/main/java/com/budwk/app/flow/controller/FlowDesignController.java @@ -41,212 +41,212 @@ import java.util.*; @Slf4j public class FlowDesignController { - @Inject - private SysUserService sysUserService; - @Inject - private ProcessDesignService processDesignService; - @Inject - private Dao dao; + @Inject + private SysUserService sysUserService; + @Inject + private ProcessDesignService processDesignService; + @Inject + private Dao dao; - // 获取所有任务参与者处理类 - public static final List ASSIGMENT_HANDLER_LIST; - // 获取所有候选用户处理类 - public static final List CANDIDATE_HANDLER_LIST; + // 获取所有任务参与者处理类 + public static final List ASSIGMENT_HANDLER_LIST; + // 获取所有候选用户处理类 + public static final List CANDIDATE_HANDLER_LIST; - static { - Set> classes = ClassScanner.scanPackageBySuper("com.budwk.app", AssignmentHandler.class); - ArrayList list = new ArrayList<>(classes.size()); - for (Class aClass : classes) { - try { - AssignmentHandler handler = (AssignmentHandler) ReflectUtil.newInstance(aClass); - JSONObject jsonObject = new JSONObject(); - jsonObject.set("value", handler.getClass().getName()); - jsonObject.set("order", handler.getOrder()); - jsonObject.set("name", handler.getMessage()); - list.add(jsonObject); - } catch (Exception e) { - log.error("初始化AssignmentHandler失败: {}", aClass.getName()); - } - } - // 排序 按order - list.sort(Comparator.comparingInt(o -> o.getInt("order"))); - ASSIGMENT_HANDLER_LIST = Collections.unmodifiableList(list); - } + static { + Set> classes = ClassScanner.scanPackageBySuper("com.budwk.app", AssignmentHandler.class); + ArrayList list = new ArrayList<>(classes.size()); + for (Class aClass : classes) { + try { + AssignmentHandler handler = (AssignmentHandler) ReflectUtil.newInstance(aClass); + JSONObject jsonObject = new JSONObject(); + jsonObject.set("value", handler.getClass().getName()); + jsonObject.set("order", handler.getOrder()); + jsonObject.set("name", handler.getMessage()); + list.add(jsonObject); + } catch (Exception e) { + log.error("初始化AssignmentHandler失败: {}", aClass.getName()); + } + } + // 排序 按order + list.sort(Comparator.comparingInt(o -> o.getInt("order"))); + ASSIGMENT_HANDLER_LIST = Collections.unmodifiableList(list); + } - static { - Set> classes = ClassScanner.scanPackageBySuper("com.budwk.app", CandidateHandler.class); - ArrayList list = new ArrayList<>(classes.size()); - for (Class aClass : classes) { - try { - CandidateHandler handler = (CandidateHandler) ReflectUtil.newInstance(aClass); - JSONObject jsonObject = new JSONObject(); - jsonObject.set("value", handler.getClass().getName()); - jsonObject.set("order", handler.getOrder()); - jsonObject.set("name", handler.getMessage()); - list.add(jsonObject); - } catch (Exception e) { - log.error("初始化CandidateHandler失败: {}", aClass.getName()); - } - } - // 排序 按order - list.sort(Comparator.comparingInt(o -> o.getInt("order"))); - CANDIDATE_HANDLER_LIST = Collections.unmodifiableList(list); - } + static { + Set> classes = ClassScanner.scanPackageBySuper("com.budwk.app", CandidateHandler.class); + ArrayList list = new ArrayList<>(classes.size()); + for (Class aClass : classes) { + try { + CandidateHandler handler = (CandidateHandler) ReflectUtil.newInstance(aClass); + JSONObject jsonObject = new JSONObject(); + jsonObject.set("value", handler.getClass().getName()); + jsonObject.set("order", handler.getOrder()); + jsonObject.set("name", handler.getMessage()); + list.add(jsonObject); + } catch (Exception e) { + log.error("初始化CandidateHandler失败: {}", aClass.getName()); + } + } + // 排序 按order + list.sort(Comparator.comparingInt(o -> o.getInt("order"))); + CANDIDATE_HANDLER_LIST = Collections.unmodifiableList(list); + } - @At("") - @Ok("beetl:/platform/flow/design/index.html") - @SaCheckPermission("flow.design") - public void index() { - } + @At("") + @Ok("beetl:/platform/flow/design/index.html") + @SaCheckPermission("flow.design") + public void index() { + } - @At - @Ok("beetl:/platform/flow/design/designer.html") - @SaCheckLogin - public void designer(HttpServletRequest request) { - request.setAttribute("id", request.getParameter("id")); - } + @At + @Ok("beetl:/platform/flow/design/designer.html") + @SaCheckLogin + public void designer(HttpServletRequest request) { + request.setAttribute("id", request.getParameter("id")); + } - @At - @ApiOperation("获取流程设计分页列表") - @SaCheckPermission("flow.design") - public Result pageData(PageForm pageForm, String displayName, String name, String category, Boolean deployed) { - Cnd cnd = Cnd.NEW(); + @At + @ApiOperation("获取流程设计分页列表") + @SaCheckPermission("flow.design") + public Result pageData(PageForm pageForm, String displayName, String name, String category, Boolean deployed) { + Cnd cnd = Cnd.NEW(); - cnd.and(Cnd.likeEX(ProcessDesign::getDisplayName, displayName)); - cnd.and(Cnd.likeEX(ProcessDesign::getName, name)); - cnd.andEX(ProcessDesign::getCategory, "=", category); - cnd.andEX(ProcessDesign::getIsDeployed, "=", deployed); + cnd.and(Cnd.likeEX(ProcessDesign::getDisplayName, displayName)); + cnd.and(Cnd.likeEX(ProcessDesign::getName, name)); + cnd.andEX(ProcessDesign::getCategory, "=", category); + cnd.andEX(ProcessDesign::getIsDeployed, "=", deployed); - Pagination pagination = processDesignService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd); - return Result.success(pagination); - } + Pagination pagination = processDesignService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd); + return Result.success(pagination); + } - @At - @ApiOperation("保存流程设计") - @SaCheckPermission("flow.design") - public Result insert(@Param("design") ProcessDesign processDesign) { - JSONObject jsonObject = new JSONObject(); - jsonObject.set("name", processDesign.getName()); - jsonObject.set("displayName", processDesign.getDisplayName()); - jsonObject.set("category", processDesign.getCategory()); - jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); - jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); - jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); - jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); - jsonObject.set("icon", processDesign.getIcon()); - jsonObject.set("picIcon", processDesign.getPicIcon()); - jsonObject.set("description", processDesign.getDescription()); - processDesign.setContent(jsonObject); - dao.insert(processDesign); - return Result.success(); - } + @At + @ApiOperation("保存流程设计") + @SaCheckPermission("flow.design") + public Result insert(@Param("design") ProcessDesign processDesign) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set("name", processDesign.getName()); + jsonObject.set("displayName", processDesign.getDisplayName()); + jsonObject.set("category", processDesign.getCategory()); + jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); + jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); + jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); + jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); + jsonObject.set("icon", processDesign.getIcon()); + jsonObject.set("picIcon", processDesign.getPicIcon()); + jsonObject.set("description", processDesign.getDescription()); + processDesign.setContent(jsonObject); + dao.insert(processDesign); + return Result.success(); + } - @At - @ApiOperation("修改流程设计") - @SaCheckPermission("flow.design") - public Result update(@Param("design") ProcessDesign processDesign) { - JSONObject jsonObject = processDesign.getContent(); - jsonObject.set("name", processDesign.getName()); - jsonObject.set("displayName", processDesign.getDisplayName()); - jsonObject.set("category", processDesign.getCategory()); - jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); - jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); - jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); - jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); - jsonObject.set("icon", processDesign.getIcon()); - jsonObject.set("picIcon", processDesign.getPicIcon()); - jsonObject.set("description", processDesign.getDescription()); - processDesign.setContent(jsonObject); - processDesignService.update(processDesign); - return Result.success(); - } + @At + @ApiOperation("修改流程设计") + @SaCheckPermission("flow.design") + public Result update(@Param("design") ProcessDesign processDesign) { + JSONObject jsonObject = processDesign.getContent(); + jsonObject.set("name", processDesign.getName()); + jsonObject.set("displayName", processDesign.getDisplayName()); + jsonObject.set("category", processDesign.getCategory()); + jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); + jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); + jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); + jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); + jsonObject.set("icon", processDesign.getIcon()); + jsonObject.set("picIcon", processDesign.getPicIcon()); + jsonObject.set("description", processDesign.getDescription()); + processDesign.setContent(jsonObject); + processDesignService.update(processDesign); + return Result.success(); + } - @At - @ApiOperation("修改流程设计") - @SaCheckPermission("flow.design") - public Result updateContent(@Param("design") ProcessDesign processDesign) { - JSONObject jsonObject = processDesign.getContent(); - jsonObject.set("name", processDesign.getName()); - jsonObject.set("displayName", processDesign.getDisplayName()); - jsonObject.set("category", processDesign.getCategory()); - jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); - jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); - jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); - jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); - jsonObject.set("icon", processDesign.getIcon()); - jsonObject.set("picIcon", processDesign.getPicIcon()); - jsonObject.set("description", processDesign.getDescription()); - processDesign.setContent(jsonObject); - processDesignService.update(processDesign); - return Result.success(); - } + @At("/xiugaiDesign") + @ApiOperation("修改流程设计") + @SaCheckPermission("flow.design") + public Result updateContent(@Param("design") ProcessDesign processDesign) { + JSONObject jsonObject = processDesign.getContent(); + jsonObject.set("name", processDesign.getName()); + jsonObject.set("displayName", processDesign.getDisplayName()); + jsonObject.set("category", processDesign.getCategory()); + jsonObject.set("instanceUrl", processDesign.getInstanceUrl()); + jsonObject.set("h5InstanceUrl", processDesign.getH5InstanceUrl()); + jsonObject.set("instanceViewUrl", processDesign.getInstanceViewUrl()); + jsonObject.set("h5InstanceViewUrl", processDesign.getH5InstanceViewUrl()); + jsonObject.set("icon", processDesign.getIcon()); + jsonObject.set("picIcon", processDesign.getPicIcon()); + jsonObject.set("description", processDesign.getDescription()); + processDesign.setContent(jsonObject); + processDesignService.update(processDesign); + return Result.success(); + } - @At - @ApiOperation("删除流程设计") - @SaCheckPermission("flow.design") - public Result delete(@Param("id") Long id) { - dao.delete(ProcessDesign.class, id); - return Result.success(); - } + @At + @ApiOperation("删除流程设计") + @SaCheckPermission("flow.design") + public Result delete(@Param("id") Long id) { + dao.delete(ProcessDesign.class, id); + return Result.success(); + } - @At - @SaCheckLogin - @ApiOperation("流程设计详情") - public Result detail(@Param("id") Long id) { - ProcessDesign design = dao.fetch(ProcessDesign.class, id); - return Result.success(design); - } + @At + @SaCheckLogin + @ApiOperation("流程设计详情") + public Result detail(@Param("id") Long id) { + ProcessDesign design = dao.fetch(ProcessDesign.class, id); + return Result.success(design); + } - @At - @ApiOperation("发布流程设计") - @Aop(TransAop.READ_COMMITTED) - @SaCheckPermission("flow.design") - public Result deploy(@Param("id") Long id) { - processDesignService.deploy(id); - return Result.success(); - } + @At + @ApiOperation("发布流程设计") + @Aop(TransAop.READ_COMMITTED) + @SaCheckPermission("flow.design") + public Result deploy(@Param("id") Long id) { + processDesignService.deploy(id); + return Result.success(); + } - @At - @SaCheckLogin - @ApiOperation("获取流程设计任务参与者处理类") - public Result assigmentHandlerClass() { - return Result.success(ASSIGMENT_HANDLER_LIST); - } + @At + @SaCheckLogin + @ApiOperation("获取流程设计任务参与者处理类") + public Result assigmentHandlerClass() { + return Result.success(ASSIGMENT_HANDLER_LIST); + } - @At - @SaCheckLogin - @ApiOperation("获取流程设计任务参与者处理类") - public Result candidateHandlerClass() { - return Result.success(CANDIDATE_HANDLER_LIST); - } + @At + @SaCheckLogin + @ApiOperation("获取流程设计任务参与者处理类") + public Result candidateHandlerClass() { + return Result.success(CANDIDATE_HANDLER_LIST); + } - @At - @SaCheckLogin - @ApiOperation("获取流程设计任务参与者分页数据") - public Result assigneePage(Integer pageNumber, Integer pageSize, String searchKeyword, @Param("userIds") String[] userIds) { - Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition"); - Cnd cnd = Cnd.NEW(); - if(StrUtil.isNotBlank(searchKeyword)) { - SqlExpressionGroup group = new SqlExpressionGroup(); - group.orLike("username", searchKeyword); - group.orLike("loginname", searchKeyword); - cnd.and(group); - } - sql.setCondition(cnd); + @At + @SaCheckLogin + @ApiOperation("获取流程设计任务参与者分页数据") + public Result assigneePage(Integer pageNumber, Integer pageSize, String searchKeyword, @Param("userIds") String[] userIds) { + Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition"); + Cnd cnd = Cnd.NEW(); + if (StrUtil.isNotBlank(searchKeyword)) { + SqlExpressionGroup group = new SqlExpressionGroup(); + group.orLike("username", searchKeyword); + group.orLike("loginname", searchKeyword); + cnd.and(group); + } + sql.setCondition(cnd); // cnd.andEX("id", "in", userIds); - Pagination pagination = sysUserService.listPageMap(pageNumber, pageSize, sql); - return Result.success(pagination); - } + Pagination pagination = sysUserService.listPageMap(pageNumber, pageSize, sql); + return Result.success(pagination); + } - @At - @SaCheckLogin - @ApiOperation("获取流程设计任务参与者分页数据回显") - public Result assigneeEcho(@Param("userIds") String[] userIds) { - Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user where id in (@userIds)"); - sql.setParam("userIds", userIds); - List list = sysUserService.listMap(sql); - return Result.success(list); - } + @At + @SaCheckLogin + @ApiOperation("获取流程设计任务参与者分页数据回显") + public Result assigneeEcho(@Param("userIds") String[] userIds) { + Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user where id in (@userIds)"); + sql.setParam("userIds", userIds); + List list = sysUserService.listMap(sql); + return Result.success(list); + } } diff --git a/src/main/resources/views/platform/flow/design/designer.html b/src/main/resources/views/platform/flow/design/designer.html index 86e28ef..67d26ff 100644 --- a/src/main/resources/views/platform/flow/design/designer.html +++ b/src/main/resources/views/platform/flow/design/designer.html @@ -140,7 +140,7 @@ ...this.designerData, content: val.json } - $.post("/flow/design/updateContent", { design: JSON.stringify(design) }).then((res) => { + $.post("/flow/design/xiugaiDesign", { design: JSON.stringify(design) }).then((res) => { if (res.code === 0) { window.parent.postMessage("success") } else { diff --git a/src/main/resources/views/platform/zhgh/staffbenefit/condolence/apply/index.html b/src/main/resources/views/platform/zhgh/staffbenefit/condolence/apply/index.html index bb1cb1a..9c6a399 100644 --- a/src/main/resources/views/platform/zhgh/staffbenefit/condolence/apply/index.html +++ b/src/main/resources/views/platform/zhgh/staffbenefit/condolence/apply/index.html @@ -226,12 +226,17 @@ layout("/layouts/platform.html"){ files: [{required: true, message: "必填", trigger: ["change", "blur"]}], signature: [{required: true, message: "必填", trigger: ["change", "blur"]}] }, - chooseType: {}, payUserOptions: [], helpUserOptions: [], typeOptions: [] } }, + computed: { + // 类型列表和申请详情独立加载,任一数据变化后重新匹配;未匹配时返回空对象,保证附件区域安全渲染。 + chooseType() { + return this.typeOptions.find(o => o.id === this.formData.type) || {} + } + }, methods: { createRemoteMethod(options) { return (keyword) => { @@ -267,10 +272,11 @@ layout("/layouts/platform.html"){ } }, typeChange(id) { - this.chooseType = this.typeOptions.find(o => o.id === id) - if (this.chooseType) { - this.$set(this.formData, "money", this.chooseType.money) - this.$set(this.formData, "way", this.chooseType.way) + // id 为用户选择的慰问类型 ID;仅匹配成功时更新金额和方式,详情回显时保留原申请值。 + const type = this.typeOptions.find(o => o.id === id) + if (type) { + this.$set(this.formData, "money", type.money) + this.$set(this.formData, "way", type.way) } }, onSave() { @@ -335,7 +341,6 @@ layout("/layouts/platform.html"){ this.formData = res.data this.selectQueryUser(this.formData.helpLoginName, this.helpUserOptions) this.selectQueryUser(this.formData.payLoginName, this.payUserOptions) - this.chooseType = this.typeOptions.find(o => o.id === this.formData.type) } }) } else { @@ -352,9 +357,10 @@ layout("/layouts/platform.html"){ } }, queryCondolenceType() { + // 接口无需参数,返回 Result;code 为 0 时 data 为启用类型数组,异常响应按空列表处理。 this.$axios.post("/platform/condolence/type/queryCondolenceType") .then((resp) => { - this.typeOptions = resp.data + this.$set(this, "typeOptions", resp && resp.code === 0 && Array.isArray(resp.data) ? resp.data : []) }) } }, diff --git a/src/main/resources/views/platform/zhghh5/staffbenefit/condolence/apply/index.html b/src/main/resources/views/platform/zhghh5/staffbenefit/condolence/apply/index.html index 26b019a..c24e4ee 100644 --- a/src/main/resources/views/platform/zhghh5/staffbenefit/condolence/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/staffbenefit/condolence/apply/index.html @@ -34,10 +34,10 @@ layout("/layouts/platform_h5.html"){ readonly :rules="[{ required: true }]" placeholder="请点击选择慰问对象" - @click="helpUserSelectShow = true" + @click="openUserSelect('help')" is-link > - + - + - + @@ -163,15 +164,15 @@ layout("/layouts/platform_h5.html"){ clickable is-link readonly - @click="showChildPicker = true" + @click="this.$set(this, 'showChildPicker', true)" > @@ -223,15 +224,15 @@ layout("/layouts/platform_h5.html"){ clickable is-link readonly - @click="showFamilyPicker = true" + @click="this.$set(this, 'showFamilyPicker', true)" > @@ -255,7 +256,7 @@ layout("/layouts/platform_h5.html"){ {{ '(附件说明:' + chooseType.uploadFileDesc + ')' }} - +