This commit is contained in:
2026-06-09 17:06:35 +08:00
parent 0895d0b897
commit 1da9b94af2
3 changed files with 69 additions and 22 deletions
@@ -78,6 +78,7 @@ public class OpinionMineController {
@SaCheckPermission("opinion.mine") @SaCheckPermission("opinion.mine")
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public Result pageData(@Valid OpinionSearchParam pageForm, String sessionId) { public Result pageData(@Valid OpinionSearchParam pageForm, String sessionId) {
// 当前节点优先取正在办理的任务;没有待办任务时,按流程实例状态显示最终状态,避免已结束流程误显示为待提交。
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
info.*, info.*,
@@ -98,7 +99,17 @@ public class OpinionMineController {
t.finishTime, t.finishTime,
t.taskParentId, t.taskParentId,
t.variable taskVariable, t.variable taskVariable,
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'待提交') curTaskName, CASE
WHEN GROUP_CONCAT(DISTINCT nt.displayName) IS NOT NULL THEN GROUP_CONCAT(DISTINCT nt.displayName)
WHEN ins.id IS NULL THEN '待提交'
WHEN ins.state = 20 THEN '已完成'
WHEN ins.state = 30 THEN '已撤回'
WHEN ins.state = 40 THEN '强行终止'
WHEN ins.state = 45 THEN '已拒绝'
WHEN ins.state = 50 THEN '挂起'
WHEN ins.state = 99 THEN '已废弃'
ELSE '待提交'
END curTaskName,
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke, IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId (select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId
FROM FROM
@@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
@@ -127,8 +128,8 @@ public class OpinionSchoolAuditController {
@ApiOperation("修改意见") @ApiOperation("修改意见")
@SLog(tag = "意见管理系统-校工会审核", msg = "修改意见") @SLog(tag = "意见管理系统-校工会审核", msg = "修改意见")
public Result edit(@Param("info") OpinionInfo opinionInfo) { public Result edit(@Param("info") OpinionInfo opinionInfo) {
// The school-union audit only edits opinion category here, so update the target field explicitly. dao.update(OpinionInfo.class, Chain.make("typeId", opinionInfo.getTypeId()), Cnd.where("id", "=", opinionInfo.getId()));
dao.update(opinionInfo);
ProcessInstance instance = dao.fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", opinionInfo.getId())); ProcessInstance instance = dao.fetch(ProcessInstance.class, Cnd.where(ProcessInstance::getBusinessNo, "=", opinionInfo.getId()));
Dict dict = FlowUtil.variableToDict(instance.getVariable()); Dict dict = FlowUtil.variableToDict(instance.getVariable());
@@ -69,12 +69,14 @@ layout("/layouts/platform.html"){
<el-form :model="formData" ref="formRef" label-width="120px" :rules="formRules" label-suffix=""> <el-form :model="formData" ref="formRef" label-width="120px" :rules="formRules" label-suffix="">
<el-form-item label="审核结果" prop="tf_schoolResult" <el-form-item label="审核结果" prop="tf_schoolResult"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]"> :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-radio-group v-model="formData.tf_schoolResult" size="small"> <el-radio-group v-model="formData.tf_schoolResult" size="small" @change="schoolResultChange">
<el-radio label="YES" border>通过</el-radio> <el-radio label="YES" border>通过</el-radio>
<el-radio label="NO" border>不通过</el-radio> <el-radio label="NO" border>不通过</el-radio>
<el-radio label="ROLLBACK" border>退回发起人修改</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="意见类别" prop="typeId" <el-form-item label="意见类别" prop="typeId"
v-if="isSchoolPass()"
:rules="[{required:true,message:'必填',trigger:['change','blur']}]"> :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<el-select v-model="formData.typeId" clearable filterable style="width: 100%" placeholder="请选择意见类别"> <el-select v-model="formData.typeId" clearable filterable style="width: 100%" placeholder="请选择意见类别">
<el-option <el-option
@@ -87,6 +89,7 @@ layout("/layouts/platform.html"){
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="主办单位" label="主办单位"
v-if="isSchoolPass()"
:rules="[{required:true, message:'必填',trigger:['change','blur']}]" :rules="[{required:true, message:'必填',trigger:['change','blur']}]"
prop="tf_masterUnitId" prop="tf_masterUnitId"
> >
@@ -100,7 +103,7 @@ layout("/layouts/platform.html"){
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="协办单位" prop="tf_slaveUnitIds"> <el-form-item label="协办单位" prop="tf_slaveUnitIds" v-if="isSchoolPass()">
<el-select v-model="formData.tf_slaveUnitIds" filterable clearable multiple <el-select v-model="formData.tf_slaveUnitIds" filterable clearable multiple
style="width: 100%" placeholder="请选择协办单位"> style="width: 100%" placeholder="请选择协办单位">
<el-option <el-option
@@ -119,7 +122,7 @@ layout("/layouts/platform.html"){
</el-form> </el-form>
<el-row type="flex" justify="end"> <el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button> <el-button @click="$refs.guava.index()" size="small">取消</el-button>
<el-button @click="handleTaskAction(1)" size="small" type="primary">提交</el-button> <el-button @click="handleTaskAction" size="small" type="primary">提交</el-button>
</el-row> </el-row>
</div> </div>
</opinion-info> </opinion-info>
@@ -187,6 +190,18 @@ layout("/layouts/platform.html"){
onReady() { onReady() {
this.$refs.basicFormRef.ready(this.row.id, this.row.taskId) this.$refs.basicFormRef.ready(this.row.id, this.row.taskId)
}, },
// 通过时才需要维护意见类别和承办单位;不通过只填写审核意见,避免退回场景强制选择承办单位。
isSchoolPass() {
return this.formData.tf_schoolResult === 'YES'
},
schoolResultChange() {
if (this.isSchoolPass()) {
return
}
this.$nextTick(() => {
this.$refs.formRef && this.$refs.formRef.clearValidate(["typeId", "tf_masterUnitId", "tf_slaveUnitIds"])
})
},
openView(row) { openView(row) {
this.$refs.guava.edit(() => { this.$refs.guava.edit(() => {
this.showApprovalForm = false this.showApprovalForm = false
@@ -210,8 +225,10 @@ layout("/layouts/platform.html"){
}) })
}, },
handleTaskAction(val) { handleTaskAction() {
this.$refs.formRef.validate((valid) => { this.schoolResultChange()
this.$nextTick(() => {
this.$refs.formRef.validate((valid) => {
if (valid) { if (valid) {
this.$confirm("您确定要提交吗?", "提示", { this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@@ -219,24 +236,24 @@ layout("/layouts/platform.html"){
type: "warning" type: "warning"
}).then(() => { }).then(() => {
const loading = createLoading('提交中') const loading = createLoading('提交中')
// The school-union audit can modify opinion type, so persist typeId before completing the workflow task. const submitType = this.formData.tf_schoolResult === 'ROLLBACK' ? 6 : 1
this.$axios.post("/platform/opinion/schoolAudit/edit", { const executeTask = () => {
info: JSON.stringify({ const taskData = submitType === 6 ? {
id: this.formData.id, id: this.formData.id,
typeId: this.formData.typeId processTaskId: this.formData.processTaskId,
}) taskName: this.formData.taskName,
}).then((editRes) => { roleCode: this.formData.roleCode,
if (editRes.code !== 0) { tf_opinion: this.formData.tf_opinion,
loading.close() } : {
return ...this.formData,
tf_masterUnitName: this.formData.tf_masterUnitId ? this.underTakeOptions.find(v => v.id === this.formData.tf_masterUnitId)?.name : null,
tf_slaveUnitNames: this.formData.tf_slaveUnitIds.map(v => this.underTakeOptions.find(v2 => v2.id === v)?.name),
tf_slaveUnitNameStr: this.formData.tf_slaveUnitIds.map(v => this.underTakeOptions.find(v2 => v2.id === v)?.name).join(','),
} }
this.$axios.post("/flow/common/executeTask", { this.$axios.post("/flow/common/executeTask", {
data: JSON.stringify({ data: JSON.stringify({
...this.formData, ...taskData,
submitType: val, submitType: submitType,
tf_masterUnitName: this.formData.tf_masterUnitId ? this.underTakeOptions.find(v => v.id === this.formData.tf_masterUnitId)?.name : null,
tf_slaveUnitNames: this.formData.tf_slaveUnitIds.map(v => this.underTakeOptions.find(v2 => v2.id === v)?.name),
tf_slaveUnitNameStr: this.formData.tf_slaveUnitIds.map(v => this.underTakeOptions.find(v2 => v2.id === v)?.name).join(','),
}) })
}).then((res) => { }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
@@ -247,11 +264,29 @@ layout("/layouts/platform.html"){
}).finally(() => { }).finally(() => {
loading.close() loading.close()
}) })
}
if (submitType === 6 || !this.isSchoolPass()) {
executeTask()
return
}
// 通过审核时校工会可调整意见类别,需要先保存 typeId,再按流程表 YES 分支继续流转。
this.$axios.post("/platform/opinion/schoolAudit/edit", {
info: JSON.stringify({
id: this.formData.id,
typeId: this.formData.typeId
})
}).then((editRes) => {
if (editRes.code === 0) {
executeTask()
return
}
loading.close()
}).catch(() => { }).catch(() => {
loading.close() loading.close()
}) })
}) })
} }
})
}) })
}, },