排序
This commit is contained in:
@@ -18,6 +18,7 @@ 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.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -32,7 +33,11 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@IocBean
|
||||
@At("/flow/design")
|
||||
@@ -68,7 +73,7 @@ public class FlowDesignController {
|
||||
log.error("初始化AssignmentHandler失败: {}", aClass.getName());
|
||||
}
|
||||
}
|
||||
// 排序 按order
|
||||
// 排序按 order,保证设计器下拉项展示稳定。
|
||||
list.sort(Comparator.comparingInt(o -> o.getInt("order")));
|
||||
ASSIGMENT_HANDLER_LIST = Collections.unmodifiableList(list);
|
||||
}
|
||||
@@ -88,7 +93,7 @@ public class FlowDesignController {
|
||||
log.error("初始化CandidateHandler失败: {}", aClass.getName());
|
||||
}
|
||||
}
|
||||
// 排序 按order
|
||||
// 排序按 order,保证设计器下拉项展示稳定。
|
||||
list.sort(Comparator.comparingInt(o -> o.getInt("order")));
|
||||
CANDIDATE_HANDLER_LIST = Collections.unmodifiableList(list);
|
||||
}
|
||||
@@ -110,14 +115,40 @@ public class FlowDesignController {
|
||||
@ApiOperation("获取流程设计分页列表")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result pageData(PageForm pageForm, String displayName, String name, String category, Boolean deployed) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.*
|
||||
FROM
|
||||
wf_process_design pd
|
||||
LEFT JOIN wf_process_category pc ON pc.id = pd.category
|
||||
$condition
|
||||
""");
|
||||
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("pd.displayName", displayName));
|
||||
cnd.and(Cnd.likeEX("pd.name", name));
|
||||
cnd.andEX("pd.category", "=", category);
|
||||
cnd.andEX("pd.isDeployed", "=", deployed);
|
||||
if ("sortNo".equals(pageForm.getPageOrderName())) {
|
||||
if ("descending".equals(pageForm.getPageOrderBy())) {
|
||||
cnd.desc("pd.sortNo");
|
||||
} else {
|
||||
cnd.asc("pd.sortNo");
|
||||
}
|
||||
} else if ("category".equals(pageForm.getPageOrderName())) {
|
||||
if ("descending".equals(pageForm.getPageOrderBy())) {
|
||||
cnd.desc("pc.name");
|
||||
} else {
|
||||
cnd.asc("pc.name");
|
||||
}
|
||||
} else {
|
||||
// 默认按排序编码升序,编码一致时再按主键兜底。
|
||||
cnd.asc("pd.sortNo");
|
||||
}
|
||||
cnd.asc("pd.id");
|
||||
|
||||
Pagination pagination = processDesignService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = processDesignService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@@ -206,6 +237,17 @@ public class FlowDesignController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("修改流程设计排序编码")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result updateSortNo(@Param("id") Long id, @Param("sortNo") Integer sortNo) {
|
||||
if (id == null || sortNo == null || sortNo < 0) {
|
||||
return Result.error("排序编码必须是非负整数");
|
||||
}
|
||||
processDesignService.update(Chain.make("sortNo", sortNo), Cnd.where(ProcessDesign::getId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计任务参与者处理类")
|
||||
@@ -213,22 +255,20 @@ public class FlowDesignController {
|
||||
return Result.success(ASSIGMENT_HANDLER_LIST);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计任务参与者处理类")
|
||||
@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)) {
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("username", searchKeyword);
|
||||
group.orLike("loginname", searchKeyword);
|
||||
|
||||
@@ -48,11 +48,11 @@ public class ProcessDesign extends BaseModel {
|
||||
@Column
|
||||
private String h5InstanceUrl;
|
||||
|
||||
@Comment("电脑端发起地址")
|
||||
@Comment("电脑端查看地址")
|
||||
@Column
|
||||
private String instanceViewUrl;
|
||||
|
||||
@Comment("手机端发起地址")
|
||||
@Comment("手机端查看地址")
|
||||
@Column
|
||||
private String h5InstanceViewUrl;
|
||||
|
||||
@@ -68,6 +68,11 @@ public class ProcessDesign extends BaseModel {
|
||||
@Column
|
||||
private Integer isDeployed;
|
||||
|
||||
@Comment("排序编码")
|
||||
@Column
|
||||
@Default("0")
|
||||
private Integer sortNo;
|
||||
|
||||
@Comment("备注")
|
||||
@Column
|
||||
private String remark;
|
||||
|
||||
@@ -411,6 +411,25 @@ public class SysMenuController {
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
public Object updateLocation(String id, Integer location) {
|
||||
try {
|
||||
if (StrUtil.isBlank(id) || location == null || location < 0) {
|
||||
return Result.error("排序编码必须是非负整数");
|
||||
}
|
||||
// 单独更新排序编码后同步清理缓存,保证菜单树立即按新顺序生效。
|
||||
sysMenuService.update(Chain.make("location", location), Cnd.where("id", "=", id));
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
|
||||
@@ -46,13 +46,14 @@ public class SysV4ServController {
|
||||
@ApiOperation("获取应用列表")
|
||||
public Result list(@Param("categoryId") String categoryId, @Param("letter") String letter, @Param("keyword") String keyword, HttpServletRequest req) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT t.*,(select picIcon from wf_process_design where name = t.name) as picIcon
|
||||
SELECT t.*, d.picIcon, d.sortNo
|
||||
FROM wf_process_define t
|
||||
INNER JOIN (
|
||||
SELECT name, MAX(id) AS max_id
|
||||
FROM wf_process_define
|
||||
GROUP BY name
|
||||
) sub ON t.name = sub.name AND t.id = sub.max_id
|
||||
LEFT JOIN wf_process_design d ON d.name = t.name
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -61,10 +62,10 @@ public class SysV4ServController {
|
||||
}
|
||||
cnd.andEX("t.category", "=", categoryId);
|
||||
cnd.andEX("t.pinyinName", "=", letter);
|
||||
cnd.asc("d.sortNo");
|
||||
cnd.asc("t.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysMenuService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,27 +43,37 @@ layout("/layouts/platform.html"){
|
||||
<el-table-column type="index" width="50px" label="序号" :index="indexMethod"></el-table-column>
|
||||
<el-table-column prop="displayName" label="流程定义名称"></el-table-column>
|
||||
<el-table-column prop="name" label="流程定义编码"></el-table-column>
|
||||
<el-table-column prop="category" label="流程分类">
|
||||
<el-table-column prop="category" label="流程分类" sortable="custom">
|
||||
<template slot-scope="{row}">
|
||||
{{categoryOptions.find(v=>v.id === row.category)?.name}}
|
||||
{{categoryOptions.find(v => v.id === row.category)?.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isDeployed" label="是否部署">
|
||||
<template slot-scope="{row}">
|
||||
<el-tag size="mini" v-if="row.isDeployed===1" type="success">是</el-tag>
|
||||
<el-tag size="mini" v-else-if="row.isDeployed===0" type="info">否</el-tag>
|
||||
<el-tag size="mini" v-if="row.isDeployed === 1" type="success">是</el-tag>
|
||||
<el-tag size="mini" v-else-if="row.isDeployed === 0" type="info">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序编码" prop="sortNo" width="120" align="center" header-align="center" sortable="custom">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number
|
||||
v-model="row.sortNo"
|
||||
:controls="false"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
size="mini"
|
||||
style="width: 88px"
|
||||
@change="updateSortNo(row)"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="450px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" type="primary" @click="onDesign(row)">设计</el-button>
|
||||
</el-button>
|
||||
<el-button size="mini" type="primary" @click="onEdit(row)">编辑</el-button>
|
||||
<!-- v-if="row.isDeployed===0"-->
|
||||
<el-button type="primary" size="mini" @click="onDeploy(row)">部署
|
||||
</el-button>
|
||||
<el-button type="danger" size="mini" @click="onDelete(row)">删除
|
||||
</el-button>
|
||||
<el-button type="primary" size="mini" @click="onDeploy(row)">部署</el-button>
|
||||
<el-button type="danger" size="mini" @click="onDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -96,10 +106,10 @@ layout("/layouts/platform.html"){
|
||||
<el-input v-model="formData.h5InstanceUrl" placeholder="请输入手机端发起地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="电脑端查看地址" prop="instanceViewUrl">
|
||||
<el-input v-model="formData.instanceViewUrl" placeholder="请输入电脑端发起地址"></el-input>
|
||||
<el-input v-model="formData.instanceViewUrl" placeholder="请输入电脑端查看地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机端查看地址" prop="h5InstanceViewUrl">
|
||||
<el-input v-model="formData.h5InstanceViewUrl" placeholder="请输入手机端发起地址"></el-input>
|
||||
<el-input v-model="formData.h5InstanceViewUrl" placeholder="请输入手机端查看地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="picIcon" label="图片图标">
|
||||
<file-upload
|
||||
@@ -142,7 +152,7 @@ layout("/layouts/platform.html"){
|
||||
categoryOptions: [],
|
||||
designVisible: false,
|
||||
designUrl: null,
|
||||
formData: {},
|
||||
formData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -168,11 +178,9 @@ layout("/layouts/platform.html"){
|
||||
this.iframeLoaded()
|
||||
this.designUrl = "/flow/design/designer?id=" + row.id
|
||||
},
|
||||
|
||||
iframeLoaded() {
|
||||
// iframe监听组件内设计器保存事件
|
||||
// 监听设计器保存结果,关闭弹窗后刷新列表。
|
||||
window.onmessage = (event) => {
|
||||
console.log(event)
|
||||
if (event.data === "success") {
|
||||
this.$message.success("保存成功")
|
||||
this.designVisible = false
|
||||
@@ -182,7 +190,6 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDeploy(row) {
|
||||
this.$confirm("部署会生成新的流程定义版本,确定部署吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -197,9 +204,8 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onRedeploy(row) {
|
||||
this.$confirm("重新部署会覆盖最新版流程定义,确定重新部署吗?", "提示", {
|
||||
this.$confirm("重新部署会覆盖最新版本流程定义,确定重新部署吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
@@ -211,9 +217,8 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onDelete(row) {
|
||||
this.$confirm("您确定要删除吗", "提示", {
|
||||
this.$confirm("您确定要删除吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
@@ -226,10 +231,8 @@ layout("/layouts/platform.html"){
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onView(row) {
|
||||
},
|
||||
|
||||
listCategory() {
|
||||
this.$axios.post("/flow/category/list").then((res) => {
|
||||
if (res.code === 0) {
|
||||
@@ -237,6 +240,22 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
})
|
||||
},
|
||||
updateSortNo(row) {
|
||||
const sortNo = Number(row.sortNo)
|
||||
if (!Number.isInteger(sortNo) || sortNo < 0) {
|
||||
this.$message.error("排序编码必须是非负整数")
|
||||
return
|
||||
}
|
||||
$.post("/flow/design/updateSortNo", {
|
||||
id: row.id,
|
||||
sortNo: sortNo
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
|
||||
@@ -75,6 +75,19 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="排序编码" prop="location" width="120">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number
|
||||
v-model="row.location"
|
||||
:controls="false"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
size="mini"
|
||||
style="width: 88px"
|
||||
@change="updateLocation(row)"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" header-align="center" label="URL" prop="href"></el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="资源类型" prop="type">
|
||||
<template slot-scope="scope">
|
||||
@@ -319,6 +332,26 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
|
||||
updateLocation(row) {
|
||||
const location = Number(row.location)
|
||||
if (!Number.isInteger(location) || location < 0) {
|
||||
this.$message.error("排序编码必须是非负整数")
|
||||
return
|
||||
}
|
||||
$.post("/platform/sys/menu/updateLocation", {
|
||||
id: row.id,
|
||||
location: location
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
if (row.parentId) {
|
||||
this.loadChildByExpandedKeys()
|
||||
} else {
|
||||
this.initTreeTable()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
listModule() {
|
||||
this.$axios.post(loc() + "/listModule", { platform: this.pageForm.platform }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user