From 34ae7010d67e458e01c547f9178df1d9a7510e97 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 17 Apr 2026 16:48:04 +0800 Subject: [PATCH] commit --- .../transact/ProposalMineController.java | 1 + .../transact/ProposalSecondedController.java | 25 +- .../proposal/models/ProposalSecond.java | 11 + .../service/ProposalSecondedService.java | 20 ++ .../impl/ProposalSecondedServiceImpl.java | 146 +++++++++- .../zhgh/democratic/proposal/common/info.js | 39 ++- .../proposal/transact/seconded/index.html | 273 +++++++++++++++--- .../proposal/transact/write/index.html | 45 ++- .../zhghh5/democratic/proposal/common/info.js | 42 ++- .../proposal/transact/seconded/index.html | 219 +++++++++++--- .../proposal/transact/write/index.html | 54 +++- 11 files changed, 764 insertions(+), 111 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalMineController.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalMineController.java index fc560560..75180187 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalMineController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalMineController.java @@ -343,6 +343,7 @@ public class ProposalMineController { seconded.setUnionName(item.getString("unionName")); seconded.setDelegationName(item.getString("delegationName")); seconded.setMobile(item.getString("mobile")); + seconded.setMode(true); seconded.setInviteTime(new Date()); return seconded; }).toList(); diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalSecondedController.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalSecondedController.java index 0d6c7261..68a77300 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalSecondedController.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/controller/transact/ProposalSecondedController.java @@ -1,6 +1,8 @@ package com.budwk.app.zhgh.democratic.proposal.controller.transact; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaMode; +import com.budwk.app.base.annotation.SLog; import com.budwk.app.base.constant.RoleConstant; import com.budwk.app.base.page.Pagination; import com.budwk.app.base.result.Result; @@ -13,16 +15,20 @@ import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam; import com.budwk.app.zhgh.democratic.proposal.service.ProposalSecondedService; import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; +import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; +import org.nutz.mvc.annotation.Param; import javax.validation.Valid; import java.util.List; @@ -50,18 +56,18 @@ public class ProposalSecondedController { @At("") @Ok("beetl:/platform/zhgh/democratic/proposal/transact/seconded/index.html") - @SaCheckPermission("proposal.seconded") + @SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR) public void index() { } @At("/h5") @Ok("beetl:/platform/zhghh5/democratic/proposal/transact/seconded/index.html") - @SaCheckPermission("proposal.seconded") + @SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR) public void h5Index() { } @At - @SaCheckPermission("proposal.seconded") + @SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR) public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) { Sql sql = Sqls.create(""" SELECT @@ -83,6 +89,7 @@ public class ProposalSecondedController { t.finishTime, t.taskParentId, t.variable taskVariable, + ta.actorId taskActorUserId, ta.actorName taskActorName, IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName, IF(rt.id IS NOT NULL, 1, 0) AS canRevoke @@ -122,4 +129,16 @@ public class ProposalSecondedController { return Result.success(pagination); } + @At + @SaCheckPermission(value = {"proposal.seconded", "h5.proposal.seconded"}, mode = SaMode.OR) + @Aop(TransAop.READ_COMMITTED) + @ApiOperation("修改提案附议信息") + @SLog(tag = "提案管理系统-附议提案", msg = "修改提案附议信息") + public Result updateInfo(@Param("proposalId") String proposalId, + @Param("taskActorUserId") String taskActorUserId, + @Param("opinion") String opinion, + @Param("submitType") Integer submitType) { + return proposalSecondedService.updateInviteSecondInfo(proposalId, taskActorUserId, opinion, submitType); + } + } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalSecond.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalSecond.java index 46080d51..3fa71948 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalSecond.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/models/ProposalSecond.java @@ -77,4 +77,15 @@ public class ProposalSecond extends BaseModel { @ColDefine(type = ColType.BOOLEAN) private Boolean isAgree; + @Column + @Comment("附议类型,true表示受邀附议,false表示主动附议") + @ColDefine(type = ColType.BOOLEAN) + @Default("1") + private Boolean mode; + + @Column + @Comment("附议意见") + @ColDefine(type = ColType.VARCHAR, width = 500) + private String opinion; + } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/ProposalSecondedService.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/ProposalSecondedService.java index 2bc7b9ed..d7c86a0c 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/ProposalSecondedService.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/ProposalSecondedService.java @@ -1,9 +1,29 @@ package com.budwk.app.zhgh.democratic.proposal.service; +import com.budwk.app.base.result.Result; import com.budwk.app.base.service.BaseService; import com.budwk.app.zhgh.democratic.proposal.models.ProposalSecond; public interface ProposalSecondedService extends BaseService { + /** + * 保存受邀附议办理结果,并在“受邀附议 + 主动附议”总同意人数达到 2 人时自动推进到团长审核。 + * + * @param proposalId 提案ID + * @param taskActorUserId 受邀附议办理人ID + * @param opinion 附议意见 + * @param submitType 提交类型 + * @return 处理结果 + */ + Result updateInviteSecondInfo(String proposalId, String taskActorUserId, String opinion, Integer submitType); + /** + * 保存主动附议结果,并在“受邀附议 + 主动附议”总同意人数达到 2 人时自动推进到团长审核。 + * + * @param proposalId 提案ID + * @param opinion 附议意见 + * @param submitType 提交类型 + * @return 处理结果 + */ + Result handlePositiveSecond(String proposalId, String opinion, Integer submitType); } diff --git a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/impl/ProposalSecondedServiceImpl.java b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/impl/ProposalSecondedServiceImpl.java index e6d64742..c16d8561 100644 --- a/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/impl/ProposalSecondedServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/democratic/proposal/service/impl/ProposalSecondedServiceImpl.java @@ -1,21 +1,163 @@ package com.budwk.app.zhgh.democratic.proposal.service.impl; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.ObjectUtil; +import com.budwk.app.base.result.Result; import com.budwk.app.base.service.impl.BaseServiceImpl; -import com.budwk.app.web.controllers.open.commons.service.CommonService; +import com.budwk.app.flow.constant.FlowConst; +import com.budwk.app.flow.engine.FlowEngine; +import com.budwk.app.flow.entity.ProcessInstance; +import com.budwk.app.flow.entity.ProcessTask; +import com.budwk.app.flow.enums.ProcessSubmitTypeEnum; +import com.budwk.app.web.commons.auth.utils.SecurityUtil; +import com.budwk.app.sys.views.View_user; +import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo; import com.budwk.app.zhgh.democratic.proposal.models.ProposalSecond; import com.budwk.app.zhgh.democratic.proposal.service.ProposalSecondedService; +import com.budwk.app.zhgh.democratic.teachercongress.delegate.models.Teacher_congress_delegate; +import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation; +import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.dao.Dao; +import org.nutz.dao.Cnd; +import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import java.util.Date; +import java.util.List; + @IocBean(args = {"refer:dao"}) public class ProposalSecondedServiceImpl extends BaseServiceImpl implements ProposalSecondedService { @Inject - private CommonService commonService; + private FlowEngine flowEngine; public ProposalSecondedServiceImpl(Dao dao) { super(dao); } + @Override + @Aop(TransAop.READ_COMMITTED) + public Result updateInviteSecondInfo(String proposalId, String taskActorUserId, String opinion, Integer submitType) { + ProposalSecond proposalSecond = dao().fetch( + ProposalSecond.class, + Cnd.where(ProposalSecond::getProposalId, "=", proposalId) + .and(ProposalSecond::getSeconderId, "=", taskActorUserId) + ); + if (proposalSecond == null) { + return Result.error("未查询到附议记录"); + } + proposalSecond.setIsAgree(ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.AGREE.getCode())); + proposalSecond.setOpinion(opinion); + proposalSecond.setSecondedTime(DateUtil.date()); + dao().update(proposalSecond); + + if (ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.AGREE.getCode())) { + autoAdvanceToDelegationWhenEnoughSeconders(proposalId); + } + return Result.success(); + } + + @Override + @Aop(TransAop.READ_COMMITTED) + public Result handlePositiveSecond(String proposalId, String opinion, Integer submitType) { + ProposalInfo proposalInfo = dao().fetch(ProposalInfo.class, proposalId); + if (proposalInfo == null) { + return Result.error("提案不存在"); + } + + ProposalSecond existsSecond = dao().fetch( + ProposalSecond.class, + Cnd.where(ProposalSecond::getProposalId, "=", proposalId) + .and(ProposalSecond::getSeconderId, "=", SecurityUtil.getUserId()) + ); + if (existsSecond != null) { + if (Boolean.TRUE.equals(existsSecond.getMode()) && existsSecond.getIsAgree() == null) { + return Result.error("您已在受邀附议名单中,请在受邀附议中处理"); + } + return Result.error("您已附议过该提案"); + } + + View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId())); + if (user == null) { + return Result.error("未查询到当前用户信息"); + } + + Teacher_congress_delegate delegate = dao().fetch( + Teacher_congress_delegate.class, + Cnd.where("sessionId", "=", proposalInfo.getSessionId()).and("userId", "=", user.getId()) + ); + if (delegate == null) { + return Result.error("未查询到您的代表信息"); + } + + Teacher_congress_delegation delegation = dao().fetch(Teacher_congress_delegation.class, delegate.getDelegationId()); + if (delegation == null) { + return Result.error("未查询到您所在的代表团信息"); + } + + ProposalSecond seconded = new ProposalSecond(); + seconded.setProposalId(proposalId); + seconded.setSeconderId(user.getId()); + seconded.setUserName(user.getUsername()); + seconded.setLoginName(user.getLoginname()); + seconded.setUnitName(user.getUnitName()); + seconded.setUnionName(user.getUnionName()); + seconded.setDelegationName(delegation.getName()); + seconded.setMobile(user.getMobile()); + seconded.setMode(false); + seconded.setInviteTime(new Date()); + seconded.setOpinion(opinion); + seconded.setSecondedTime(new Date()); + seconded.setIsAgree(ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.AGREE.getCode())); + dao().insert(seconded); + + if (ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.AGREE.getCode())) { + autoAdvanceToDelegationWhenEnoughSeconders(proposalId); + } + return Result.success(); + } + + /** + * 统一按 proposal_second 里的“同意附议”人数判断是否已满足 2 人附议。 + * 一旦满足 2 人,就用系统自动执行一个仍处于办理中的 second 任务来触发流程引擎会签合并, + * 这样 second 节点会自动废弃其余未办任务,并按流程定义流转到 delegation 节点。 + */ + private void autoAdvanceToDelegationWhenEnoughSeconders(String proposalId) { + ProcessInstance processInstance = dao().fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", proposalId)); + if (processInstance == null) { + return; + } + + long agreeCount = dao().count( + ProposalSecond.class, + Cnd.where(ProposalSecond::getProposalId, "=", proposalId) + .and(ProposalSecond::getIsAgree, "=", true) + ); + if (agreeCount < 2) { + return; + } + int mergedCompletedCount = (int) Math.max(agreeCount - 1, 0); + + List doingSecondTasks = flowEngine.processTaskService().getDoingTaskList(processInstance.getId(), new String[]{"second"}); + if (doingSecondTasks.isEmpty()) { + return; + } + + // 当前流程仍停留在 second 会签节点时,把“已同意附议人数”桥接到会签变量里。 + // 这样系统自动完成一个 second 任务后,会签节点会按“累计 2 个同意”直接合并到团长审核。 + String prefix = FlowConst.COUNTERSIGN_VARIABLE_PREFIX + "second_"; + Dict instanceVariable = Dict.create(); + instanceVariable.put(prefix + FlowConst.NR_OF_COMPLETED_INSTANCES, mergedCompletedCount); + instanceVariable.put(prefix + FlowConst.NR_OF_COMPLETED_AGREE_INSTANCES, mergedCompletedCount); + flowEngine.processInstanceService().addVariable(processInstance.getId(), instanceVariable); + + Dict executeArgs = Dict.create(); + executeArgs.put(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.AGREE.getCode()); + executeArgs.put(FlowConst.TASK_FORM_DATA_PREFIX + "opinion", "满足两人附议,系统自动流转至团长审核"); + executeArgs.put(prefix + FlowConst.NR_OF_COMPLETED_INSTANCES, mergedCompletedCount); + executeArgs.put(prefix + FlowConst.NR_OF_COMPLETED_AGREE_INSTANCES, mergedCompletedCount); + flowEngine.executeProcessTask(doingSecondTasks.get(0).getId(), FlowConst.AUTO_ID, executeArgs); + } } diff --git a/src/main/resources/views/platform/zhgh/democratic/proposal/common/info.js b/src/main/resources/views/platform/zhgh/democratic/proposal/common/info.js index 8eedeefa..8dab39ff 100644 --- a/src/main/resources/views/platform/zhgh/democratic/proposal/common/info.js +++ b/src/main/resources/views/platform/zhgh/democratic/proposal/common/info.js @@ -137,8 +137,34 @@ const PROPOSAL_INFO = { + + + + + + + + + + + + + + + + + + 暂无主动附议信息 + @@ -208,7 +234,8 @@ const PROPOSAL_INFO = { viewData: {}, doneTasks: [], row: null, - viewDialogVisible: false + viewDialogVisible: false, + positiveSecondList: [], } }, methods: { @@ -218,6 +245,7 @@ const PROPOSAL_INFO = { this.visible = true this.getInfo() this.getDoneTasks() + this.listPositiveSeconded() }, // 获取申请信息 @@ -246,6 +274,15 @@ const PROPOSAL_INFO = { }) }, + // 获取主动附议信息 + listPositiveSeconded() { + this.$axios.post("/platform/proposal/positiveSeconded/listPositiveSeconded", {bizId: this.row.id}).then((res) => { + if (res.code === 0) { + this.positiveSecondList = res.data + } + }) + }, + }, style: /*language=CSS*/ diff --git a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/seconded/index.html b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/seconded/index.html index b3c6e7a7..3104d159 100644 --- a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/seconded/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/seconded/index.html @@ -2,25 +2,50 @@ layout("/layouts/platform.html"){ #--> -
+
- - + + + + + + + + + + + + + + 受邀附议 + + + + + + 主动附议 + + + + 已附议 @@ -54,10 +79,7 @@ layout("/layouts/platform.html"){ @@ -68,7 +90,7 @@ layout("/layouts/platform.html"){
- {{formData.taskName}} + {{approvalTitle}}
@@ -98,69 +120,236 @@ layout("/layouts/platform.html"){ components: { "proposal-info": PROPOSAL_INFO }, - data() { + data: function () { return { - tableColumns: [ + activeTab: "inviteSeconded", + inviteColumns: [ {label: "提案编号", prop: "code"}, {label: "提案名称", prop: "name", width: "200px"}, {label: "提案人", prop: "createUserName"}, {label: "提案类别", prop: "typeName"}, {label: "代表团", prop: "delegationName"}, - {label: "附议人", prop: "taskActorName"}, {label: "当前节点", prop: "curTaskName"}, {label: "流程状态", prop: "instanceState"} ], + positiveColumns: [ + {label: "提案编号", prop: "code"}, + {label: "提案名称", prop: "name", width: "200px"}, + {label: "提案人", prop: "createUserName"}, + {label: "提案类别", prop: "typeName"}, + {label: "代表团", prop: "delegationName"}, + {label: "当前节点", prop: "taskName"}, + {label: "流程状态", prop: "instanceState"} + ], + tableColumns: [], pageForm: { - approval: false + approval: false, + name: "", + sessionId: null, + createUserKeyword: "", + delegationId: null, + pageNumber: 1, + pageSize: 10, + totalCount: 0, + pageOrderName: "", + pageOrderBy: "" }, showApprovalForm: false, sessionOptions: [], delegationOptions: [], + row: {}, + } + }, + computed: { + approvalTitle: function () { + if (this.activeTab === "inviteSeconded") { + return this.formData.taskName + } + return "主动附议" + }, + searchPlaceholder: function () { + if (this.activeTab === "inviteSeconded") { + return { + session: "所属教代会", + name: "提案名称" + } + } + return { + session: "请选择所属教代会", + name: "请输入提案名称" + } } }, methods: { - openView(row) { + syncTableColumns: function () { + if (this.activeTab === "inviteSeconded") { + this.$set(this, "tableColumns", this.inviteColumns) + } else { + this.$set(this, "tableColumns", this.positiveColumns) + } + }, + + currentPageDataUrl: function () { + if (this.activeTab === "inviteSeconded") { + return "/platform/proposal/seconded/pageData" + } + return "/platform/proposal/positiveSeconded/pageData" + }, + + tabChange: function () { + this.syncTableColumns() + this.$set(this, "tableData", []) + if (this.activeTab !== "positiveSeconded") { + this.$set(this.pageForm, "createUserKeyword", "") + this.$set(this.pageForm, "delegationId", null) + } + this.doSearch() + }, + + doSearch: function () { + this.tableKey = new Date().getTime() + this.$set(this.pageForm, "pageNumber", 1) + this.pageData() + }, + + pageOrder: function (column) { + this.$set(this.pageForm, "pageOrderName", column.prop) + this.$set(this.pageForm, "pageOrderBy", column.order) + this.pageData() + }, + + pageNumberChange: function (val) { + this.$set(this.pageForm, "pageNumber", val) + this.pageData() + }, + + pageSizeChange: function (val) { + this.$set(this.pageForm, "pageSize", val) + this.pageData() + }, + + pageData: function () { + this.tableLoading = true + this.$axios.post(this.currentPageDataUrl(), this.pageForm).then((res) => { + this.tableLoading = false + if (res.code === 0) { + this.$set(this, "tableData", res.data.list) + this.$set(this.pageForm, "totalCount", res.data.totalCount) + } + }) + }, + + showAuditButton: function (row) { + if (this.activeTab === "inviteSeconded") { + return row.taskState === 10 + } + return row.count === 0 + }, + + openView: function (row) { this.$refs.guava.edit(() => { this.showApprovalForm = false this.$refs.proposalInfoRef.onOpen(row) }) }, - openAudit(row) { + + openAudit: async function (row) { + if (this.activeTab === "positiveSeconded") { + var validatePass = await this.validateCanSeconded(row.id) + if (!validatePass) { + return + } + } + this.$set(this, "row", row) this.$refs.guava.edit(() => { - this.showApprovalForm = true - this.formData = { - processTaskId: row.taskId, - taskName: row.curTaskName, - tf_opinion: "同意该提案" + this.$set(this, "showApprovalForm", true) + if (this.activeTab === "inviteSeconded") { + this.$set(this, "formData", { + processTaskId: row.taskId, + sessionId: row.sessionId, + delegationId: row.delegationId, + taskName: row.curTaskName, + tf_opinion: "同意该提案" + }) + } else { + this.$set(this, "formData", { + processTaskId: row.taskId, + taskName: row.curTaskName, + tf_opinion: "同意该提案" + }) } this.$refs.proposalInfoRef.onOpen(row) }) }, - handleTaskAction(val) { - this.$refs.formRef.validate(valid => { + handleTaskAction: function (val) { + this.$refs.formRef.validate((valid) => { if (!valid) return this.$confirm("您确定要提交吗?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(() => { - this.$axios.post("/flow/common/executeTask", { - data: JSON.stringify({ - ...this.formData, - submitType: val - }) - }).then((res) => { - if (res.code === 0) { - this.$refs.guava.index() - this.$message.success(res.msg) - this.doSearch() - } - }) + if (this.activeTab === "inviteSeconded") { + this.handleInviteSeconded(val) + } else { + this.handlePositiveSeconded(val) + } }) }) }, + handleInviteSeconded: function (val) { + this.$axios.post("/flow/common/executeTask", { + data: JSON.stringify({ + ...this.formData, + submitType: val + }) + }).then((res) => { + if (res.code === 0) { + this.updateSecond(val) + this.$refs.guava.index() + this.$message.success(res.msg) + this.doSearch() + } + }) + }, + + updateSecond: function (submitType) { + this.$axios.post("/platform/proposal/seconded/updateInfo", { + proposalId: this.row.id, + taskActorUserId: this.row.taskActorUserId, + opinion: this.formData.tf_opinion, + submitType: submitType, + }) + }, + + handlePositiveSeconded: function (val) { + this.$axios.post("/platform/proposal/positiveSeconded/handle", { + proposalId: this.row.id, + opinion: this.formData.tf_opinion, + submitType: val + }).then((res) => { + if (res.code === 0) { + this.$refs.guava.index() + this.$message.success(res.msg) + this.doSearch() + } + }) + }, + + validateCanSeconded: function (proposalId) { + return this.$axios.post("/platform/proposal/positiveSeconded/validateCanSeconded", { + proposalId: proposalId + }).then((res) => { + if (res.code !== 0) { + this.$message.error(res.msg) + return false + } + return true + }) + }, + onRevoke(row) { this.$confirm("您确定要撤回吗?", "提示", { confirmButtonText: "确定", @@ -176,14 +365,16 @@ layout("/layouts/platform.html"){ }) }, - // 教代会 - async meetingChange(val) { + meetingChange: function () { this.formData.delegationId = null this.formData.committeeId = null + if (this.activeTab === "positiveSeconded") { + this.$set(this.pageForm, "delegationId", null) + this.listDelegation() + } this.doSearch() }, - // 查询开启的教代会 listOpenSession() { this.$axios.post("/platform/proposal/common/listOpenSession").then((res) => { if (res.code === 0) { @@ -195,10 +386,18 @@ layout("/layouts/platform.html"){ } } }) - } + }, + listDelegation() { + this.$axios.post("/platform/proposal/common/listDelegation", {sessionId: this.pageForm.sessionId}).then((res) => { + if (res.code === 0) { + this.delegationOptions = res.data + } + }) + } }, created() { + this.syncTableColumns() this.pageData() this.listOpenSession() } diff --git a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html index b1bd7c24..ce77790a 100644 --- a/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html +++ b/src/main/resources/views/platform/zhgh/democratic/proposal/transact/write/index.html @@ -335,10 +335,11 @@ layout("/layouts/platform.html"){ //教代会change async meetingChange(val) { - this.formData.delegationId = null - this.formData.committeeId = null - this.listDelegation() - this.searchMineDelegation() + this.$set(this.formData, "sessionId", val) + this.$set(this.formData, "source", "") + this.$set(this.formData, "delegationId", null) + this.$set(this.formData, "committeeId", null) + await this.loadSessionRelatedData() // this.delegationOptions = await proposal.getDelegation(val) // this.committeeOptions = await this.getInstitutions(val) }, @@ -367,24 +368,44 @@ layout("/layouts/platform.html"){ this.$axios.post("/platform/proposal/common/listOpenSession").then(async (res) => { if (res.code === 0) { this.sessionOptions = res.data - if (!isModify && this.sessionOptions) { - this.$set(this.formData, "sessionId", this.sessionOptions[0].id) - // 获取代表团 - await this.searchMineDelegation() - // 检查是否在撰写时间内 - this.checkWriteTime() + if (!isModify && this.sessionOptions && this.sessionOptions.length > 0) { + // 默认定位到当前用户在本届次下可用的提案会期,避免提案方式下拉为空。 + let targetSession = this.sessionOptions[0] + for (let i = 0; i < this.sessionOptions.length; i++) { + const session = this.sessionOptions[i] + this.$set(this.formData, "sessionId", session.id) + const hasSource = await this.loadSessionRelatedData() + if (hasSource) { + targetSession = session + break + } + } + this.$set(this.formData, "sessionId", targetSession.id) } - await this.listDelegation() - await this.listSource() + await this.loadSessionRelatedData() } }) }, + // 会期相关数据需要同步刷新,保证提案方式、代表团和撰写时间判断一致。 + async loadSessionRelatedData() { + await this.listDelegation() + await this.searchMineDelegation() + await this.listSource() + this.checkWriteTime() + return this.sourceOptions && this.sourceOptions.length > 0 + }, + //查询自己有权限的撰写方式 listSource() { return this.$axios.post("/platform/proposal/write/listSource", {sessionId: this.formData.sessionId}).then((res) => { if (res.code === 0) { this.sourceOptions = res.data + const sourceExists = this.sourceOptions.some(item => item.code === this.formData.source) + if (!sourceExists) { + const defaultSource = this.sourceOptions.length > 0 ? this.sourceOptions[0].code : "" + this.$set(this.formData, "source", defaultSource) + } } }) }, diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/common/info.js b/src/main/resources/views/platform/zhghh5/democratic/proposal/common/info.js index c0a910f0..e66ea7e4 100644 --- a/src/main/resources/views/platform/zhghh5/democratic/proposal/common/info.js +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/common/info.js @@ -108,17 +108,38 @@ const PROPOSAL_INFO = { {{ task.finishTime }} - + - - - + + + + + + + + + + + + + + + + 暂无主动附议信息 + @@ -179,6 +200,7 @@ const PROPOSAL_INFO = { doneTasks: [], row: null, originalRow: null, // 用于保存原始数据,支持返回功能 + positiveSecondList: [], } }, methods: { @@ -188,6 +210,7 @@ const PROPOSAL_INFO = { this.visible = true this.getInfo() this.getDoneTasks() + this.listPositiveSeconded() }, // 关闭 @@ -236,5 +259,14 @@ const PROPOSAL_INFO = { } }) }, + + // 获取主动附议信息 + listPositiveSeconded() { + this.$axios.post("/platform/proposal/positiveSeconded/listPositiveSeconded", {bizId: this.row.id}).then((res) => { + if (res.code === 0) { + this.positiveSecondList = res.data + } + }) + }, } }; diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/seconded/index.html b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/seconded/index.html index f487421b..e4b019f0 100644 --- a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/seconded/index.html +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/seconded/index.html @@ -14,16 +14,27 @@ layout("/layouts/platform_h5.html"){ > + @change="sessionChange"> + - + + + + + + + - @@ -83,6 +90,7 @@ layout("/layouts/platform_h5.html"){ store, data() { return { + activeTab: "inviteSeconded", pageForm: { pageNumber: 1, pageSize: 10, @@ -90,75 +98,175 @@ layout("/layouts/platform_h5.html"){ name: null, sessionId: null, approvalText: "0", - approval: false + approval: false, + delegationId: null }, sessionOptions: [], + delegationOptions: [ + { + text: "全部代表团", + value: null + } + ], formData: {}, showApprovalForm: false, rules: { approvalSignature: [{required: true, message: "请签字"}] - } + }, + row: {}, } }, components: { "proposal-info": PROPOSAL_INFO }, + computed: { + currentApi() { + if (this.activeTab === "inviteSeconded") { + return "/platform/proposal/seconded/pageData" + } + return "/platform/proposal/positiveSeconded/pageData" + } + }, methods: { onReady() { this.listSession() }, + tabChange(val) { + this.activeTab = val + if (this.activeTab !== "positiveSeconded") { + this.$set(this.pageForm, "delegationId", null) + } + if (this.activeTab === "positiveSeconded" && this.pageForm.sessionId) { + this.listDelegation() + } + this.doSearch() + }, + approvalTabChange(val) { + this.$set(this.pageForm, "approvalText", val) + this.$set(this.pageForm, "approval", val === "1") + this.doSearch() + }, + sessionChange() { + this.$set(this.pageForm, "delegationId", null) + if (this.activeTab === "positiveSeconded" && this.pageForm.sessionId) { + this.listDelegation() + } else { + this.$set(this, "delegationOptions", [ + { + text: "全部代表团", + value: null + } + ]) + } + this.doSearch() + }, + listDelegation() { + if (!this.pageForm.sessionId) { + this.$set(this, "delegationOptions", [ + { + text: "全部代表团", + value: null + } + ]) + return + } + this.$axios.post("/platform/proposal/common/listDelegation", {sessionId: this.pageForm.sessionId}).then((res) => { + if (res.code === 0) { + this.$set(this, "delegationOptions", [ + { + text: "全部代表团", + value: null + } + ].concat(res.data.map((v) => ({text: v.name, value: v.id})))) + } + }) + }, listSession() { this.$axios.post("/platform/proposal/common/listSession").then((res) => { if (res.code === 0) { - this.sessionOptions = [ + this.$set(this, "sessionOptions", [ { text: "全部届次", value: null } - ].concat(res.data.map((v) => ({text: v.fullName, value: v.id}))) + ].concat(res.data.map((v) => ({text: v.fullName, value: v.id})))) if (this.sessionOptions.length > 0) { - this.pageForm.sessionId = this.sessionOptions[0].value + this.$set(this.pageForm, "sessionId", this.sessionOptions[0].value) this.doSearch() } } }) }, + currentTaskName(row) { + if (this.activeTab === "inviteSeconded") { + return row.curTaskName + } + return row.taskName + }, + showApprovalButton(row) { + if (this.activeTab === "inviteSeconded") { + return row.taskState === 10 + } + return row.count === 0 + }, onView(row) { - this.showApprovalForm = false + this.$set(this, "showApprovalForm", false) this.$refs.proposalInfoRef.onOpen(row) }, - onApproval(row) { - this.showApprovalForm = true - this.$refs.proposalInfoRef.onOpen(row) - this.formData = { - processTaskId: row.taskId, - taskName: row.curTaskName, - tf_opinion: "同意该提案" + async onApproval(row) { + if (this.activeTab === "positiveSeconded") { + const validatePass = await this.validateCanSeconded(row.id) + if (!validatePass) { + return + } } + this.$set(this, "row", row) + this.$set(this, "showApprovalForm", true) + this.$refs.proposalInfoRef.onOpen(row) + if (this.activeTab === "inviteSeconded") { + this.$set(this, "formData", { + processTaskId: row.taskId, + sessionId: row.sessionId, + delegationId: row.delegationId, + taskName: row.curTaskName, + tf_opinion: "同意该提案" + }) + } else { + this.$set(this, "formData", { + processTaskId: row.taskId, + taskName: row.curTaskName, + tf_opinion: "同意该提案" + }) + } + }, + + validateCanSeconded(proposalId) { + return this.$axios.post("/platform/proposal/positiveSeconded/validateCanSeconded", { + proposalId: proposalId + }).then((res) => { + if (res.code !== 0) { + this.$toast(res.msg) + return false + } + return true + }) }, async handleTaskAction(val) { try { - await this.$refs.formRef.validate(); + await this.$refs.formRef.validate() this.$dialog.confirm({ title: "提示", message: "您确定要提交吗?" }).then(() => { - this.$axios.post("/flow/common/executeTask", { - data: JSON.stringify({ - ...this.formData, - submitType: val - }) - }).then((res) => { - if (res.code === 0) { - this.$refs.proposalInfoRef.onClose() - this.$toast.success(res.msg) - this.doSearch() - } - }) + if (this.activeTab === "inviteSeconded") { + this.handleInviteSeconded(val) + } else { + this.handlePositiveSeconded(val) + } }).catch(() => { }) @@ -167,6 +275,45 @@ layout("/layouts/platform_h5.html"){ } }, + handleInviteSeconded(val) { + this.$axios.post("/flow/common/executeTask", { + data: JSON.stringify({ + ...this.formData, + submitType: val + }) + }).then((res) => { + if (res.code === 0) { + this.$refs.proposalInfoRef.onClose() + this.$toast.success(res.msg) + this.doSearch() + this.updateSecond(val) + } + }) + }, + + handlePositiveSeconded(val) { + this.$axios.post("/platform/proposal/positiveSeconded/handle", { + proposalId: this.row.id, + opinion: this.formData.tf_opinion, + submitType: val + }).then((res) => { + if (res.code === 0) { + this.$refs.proposalInfoRef.onClose() + this.$toast.success(res.msg) + this.doSearch() + } + }) + }, + + updateSecond(submitType) { + this.$axios.post("/platform/proposal/seconded/updateInfo", { + proposalId: this.row.id, + taskActorUserId: this.row.taskActorUserId, + opinion: this.formData.tf_opinion, + submitType: submitType, + }) + }, + doSearch() { this.$nextTick(() => { this.pageForm.pageNumber = 1 diff --git a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html index b60621c3..f557f4e9 100644 --- a/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html +++ b/src/main/resources/views/platform/zhghh5/democratic/proposal/transact/write/index.html @@ -609,15 +609,14 @@ layout("/layouts/platform_h5.html"){ //教代会change async meetingChange(val) { + this.$set(this.formData, "sessionId", val); + this.$set(this.formData, "source", ""); + this.$set(this.formData, "sourceName", ""); this.formData.delegationId = null; this.formData.committeeId = null; this.formData.delegationName = ''; this.formData.committeeName = ''; - await this.listDelegation(); - await this.searchMineDelegation(); - await this.listSource(); - // 检查是否在撰写时间内 - this.checkWriteTime(); + await this.loadSessionRelatedData(); }, // 获取代表团 @@ -644,28 +643,53 @@ layout("/layouts/platform_h5.html"){ if (res.code === 0) { this.sessionOptions = res.data; if (!isModify && this.sessionOptions && this.sessionOptions.length > 0) { - this.$set(this.formData, "sessionId", this.sessionOptions[0].id); - this.$set(this.formData, "sessionName", this.sessionOptions[0].fullName); - await this.listDelegation(); - await this.listSource(); - // 获取代表团 - await this.searchMineDelegation(); - // 检查是否在撰写时间内 - this.checkWriteTime(); + // 默认定位到当前用户在本届次下可用的提案会期,避免提案方式下拉为空。 + let targetSession = this.sessionOptions[0]; + for (let i = 0; i < this.sessionOptions.length; i++) { + const session = this.sessionOptions[i]; + this.$set(this.formData, "sessionId", session.id); + this.$set(this.formData, "sessionName", session.fullName); + const hasSource = await this.loadSessionRelatedData(); + if (hasSource) { + targetSession = session; + break; + } + } + this.$set(this.formData, "sessionId", targetSession.id); + this.$set(this.formData, "sessionName", targetSession.fullName); } else { - await this.listDelegation(); - await this.listSource(); + await this.loadSessionRelatedData(); this.echoPicker() } + await this.loadSessionRelatedData(); } }); }, + // 会期相关数据需要同步刷新,保证提案方式、代表团和撰写时间判断一致。 + async loadSessionRelatedData() { + await this.listDelegation(); + await this.searchMineDelegation(); + await this.listSource(); + this.checkWriteTime(); + return this.sourceOptions && this.sourceOptions.length > 0; + }, + //查询自己有权限的撰写方式 listSource() { return this.$axios.post("/platform/proposal/write/listSource", {sessionId: this.formData.sessionId}).then((res) => { if (res.code === 0) { this.sourceOptions = res.data; + const source = this.sourceOptions.find(item => item.code === this.formData.source); + if (source) { + this.$set(this.formData, "sourceName", source.name); + } else if (this.sourceOptions.length > 0) { + this.$set(this.formData, "source", this.sourceOptions[0].code); + this.$set(this.formData, "sourceName", this.sourceOptions[0].name); + } else { + this.$set(this.formData, "source", ""); + this.$set(this.formData, "sourceName", ""); + } } }); },