1、新加功能:建议意见讨论组
2、代表团管理:设置联络人(面向全校)
This commit is contained in:
@@ -457,7 +457,7 @@ public class SysUnionController {
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result listUnion(@Valid String unionId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName,unionName,sex from vw_user $condition");
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName,unionName,sex,mobile from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(View_user::getUnionId, "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
|
||||
+2
-2
@@ -271,8 +271,8 @@ public class TeacherCongressDelegationController {
|
||||
public Result notHeadUser(@Valid String sessionId, @Valid String delegationId, String keyWord) {
|
||||
Sql sql = Sqls.create("select userId,loginName,userName,unitName from teacher_congress_delegate $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("delegationId", "=", delegationId);
|
||||
cnd.and("sessionId", "=", sessionId);
|
||||
cnd.andEX("delegationId", "=", delegationId);
|
||||
cnd.andEX("sessionId", "=", sessionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginName", keyWord);
|
||||
seg.orLike("userName", keyWord);
|
||||
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.models.Teacher_congress_discussion_group;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupInsertParam;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupPageParam;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param.TeacherCongressDiscussionGroupUpdateParam;
|
||||
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.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.POST;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/teacherCongress/discussionGroup")
|
||||
@Ok("json:full")
|
||||
public class TeacherCongressDiscussionGroupController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/teachercongress/discussiongroup/index.html")
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result pageData(@Valid TeacherCongressDiscussionGroupPageParam pageParam) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tcdg.*,
|
||||
tcs.fullName AS sessionName,
|
||||
vu.mobile AS recorderUserMobile,
|
||||
su.username AS createdByName
|
||||
FROM teacher_congress_discussion_group tcdg
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = tcdg.sessionId
|
||||
LEFT JOIN vw_user vu ON vu.id = tcdg.recorderUserId
|
||||
LEFT JOIN sys_user su ON su.id = tcdg.createdBy
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tcdg.delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(pageParam.getSessionId())) {
|
||||
cnd.and("tcdg.sessionId", "=", pageParam.getSessionId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getSearchKeyword())) {
|
||||
if ("name".equals(pageParam.getSearchName())) {
|
||||
cnd.and("tcdg.name", "like", "%" + pageParam.getSearchKeyword() + "%");
|
||||
} else {
|
||||
cnd.and("tcdg.code", "like", "%" + pageParam.getSearchKeyword() + "%");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getRecorderUserName())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("tcdg.recorderUserName", pageParam.getRecorderUserName());
|
||||
seg.orLike("tcdg.recorderUserCode", pageParam.getRecorderUserName());
|
||||
cnd.and(seg);
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageParam.getDelegationCode())) {
|
||||
cnd.and("tcdg.delegationCodes", "like", "%" + pageParam.getDelegationCode() + "%");
|
||||
}
|
||||
if (StrUtil.isBlank(pageParam.getPageOrderName())) {
|
||||
cnd.desc("tcdg.createdAt");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageParam.getPageNumber(), pageParam.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result findOne(@Valid String id) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tcdg.*,
|
||||
tcs.fullName AS sessionName,
|
||||
su.username AS createdByName,
|
||||
vu.id AS recorderUserId,
|
||||
vu.loginname AS recorderUserCode,
|
||||
vu.username AS recorderUserName,
|
||||
vu.mobile AS recorderUserMobile
|
||||
FROM teacher_congress_discussion_group tcdg
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = tcdg.sessionId
|
||||
LEFT JOIN sys_user su ON su.id = tcdg.createdBy
|
||||
LEFT JOIN vw_user vu ON vu.id = tcdg.recorderUserId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tcdg.id", "=", id);
|
||||
cnd.and("tcdg.delFlag", "=", false);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.record());
|
||||
dao.execute(sql);
|
||||
Record record = sql.getObject(Record.class);
|
||||
if (record == null) {
|
||||
return Result.success(null);
|
||||
}
|
||||
record.put("delegationCodeList", parseJsonArray(record.getString("delegationCodes")));
|
||||
record.put("delegationNameList", parseJsonArray(record.getString("delegationNames")));
|
||||
return Result.success(record);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result recorderOptions(String keyword) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", keyword);
|
||||
seg.orLike("loginname", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.asc("loginname");
|
||||
cnd.limit(1, 20);
|
||||
List<View_user> users = dao.query(View_user.class, cnd);
|
||||
return Result.success(users);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
public Result delegationOptions(@Valid String sessionId, String keyword) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
code,
|
||||
name
|
||||
FROM teacher_congress_delegation
|
||||
$condition
|
||||
ORDER BY CAST(code AS UNSIGNED), code ASC
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("sessionId", "=", sessionId);
|
||||
cnd.and("delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("code", keyword);
|
||||
seg.orLike("name", keyword);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.limit(1, 50);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.records());
|
||||
dao.execute(sql);
|
||||
return Result.success(sql.getList(Record.class));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "insert")
|
||||
public Result insert(@Valid TeacherCongressDiscussionGroupInsertParam param) {
|
||||
if (hasSameCode(param.getCode(), param.getSessionId(), null)) {
|
||||
return Result.error("discussion group code already exists");
|
||||
}
|
||||
Teacher_congress_discussion_group discussionGroup = buildEntity(param, new Teacher_congress_discussion_group());
|
||||
dao.insert(discussionGroup);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "update")
|
||||
public Result update(@Valid TeacherCongressDiscussionGroupUpdateParam param) {
|
||||
if (hasSameCode(param.getCode(), param.getSessionId(), param.getId())) {
|
||||
return Result.error("discussion group code already exists");
|
||||
}
|
||||
Teacher_congress_discussion_group discussionGroup = dao.fetch(Teacher_congress_discussion_group.class, param.getId());
|
||||
if (discussionGroup == null) {
|
||||
return Result.error("data not found");
|
||||
}
|
||||
buildEntity(param, discussionGroup);
|
||||
dao.updateIgnoreNull(discussionGroup);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("tc.discussion.group")
|
||||
@SLog(tag = "discussion group", msg = "delete")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(Teacher_congress_discussion_group.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
private boolean hasSameCode(String code, String sessionId, String excludeId) {
|
||||
Cnd cnd = Cnd.where("code", "=", code).and("sessionId", "=", sessionId).and("delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(excludeId)) {
|
||||
cnd.and("id", "<>", excludeId);
|
||||
}
|
||||
return dao.count(Teacher_congress_discussion_group.class, cnd) > 0;
|
||||
}
|
||||
|
||||
private Teacher_congress_discussion_group buildEntity(TeacherCongressDiscussionGroupInsertParam param,
|
||||
Teacher_congress_discussion_group discussionGroup) {
|
||||
discussionGroup.setSessionId(param.getSessionId());
|
||||
discussionGroup.setCode(StrUtil.trim(param.getCode()));
|
||||
discussionGroup.setName(StrUtil.trim(param.getName()));
|
||||
discussionGroup.setRecorderUserId(param.getRecorderUserId());
|
||||
discussionGroup.setRecorderUserCode(StrUtil.trim(param.getRecorderUserCode()));
|
||||
discussionGroup.setRecorderUserName(StrUtil.trim(param.getRecorderUserName()));
|
||||
discussionGroup.setDelegationCodes(param.getDelegationCodes());
|
||||
discussionGroup.setDelegationNames(param.getDelegationNames());
|
||||
return discussionGroup;
|
||||
}
|
||||
|
||||
private List<String> parseJsonArray(String json) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if (StrUtil.isBlank(json)) {
|
||||
return result;
|
||||
}
|
||||
String content = StrUtil.trim(json);
|
||||
if (content.startsWith("[")) {
|
||||
content = content.substring(1);
|
||||
}
|
||||
if (content.endsWith("]")) {
|
||||
content = content.substring(0, content.length() - 1);
|
||||
}
|
||||
if (StrUtil.isBlank(content)) {
|
||||
return result;
|
||||
}
|
||||
for (String item : content.split(",")) {
|
||||
String value = StrUtil.trim(item);
|
||||
value = StrUtil.removePrefix(value, "\"");
|
||||
value = StrUtil.removeSuffix(value, "\"");
|
||||
if (StrUtil.isNotBlank(value)) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.ColDefine;
|
||||
import org.nutz.dao.entity.annotation.ColType;
|
||||
import org.nutz.dao.entity.annotation.Column;
|
||||
import org.nutz.dao.entity.annotation.Comment;
|
||||
import org.nutz.dao.entity.annotation.Name;
|
||||
import org.nutz.dao.entity.annotation.Table;
|
||||
import org.nutz.dao.entity.annotation.TableMeta;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("teacher_congress_discussion_group")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("教代会建议意见讨论组")
|
||||
public class Teacher_congress_discussion_group extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("届次ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String sessionId;
|
||||
|
||||
@Column
|
||||
@Comment("讨论组编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("讨论组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("记录人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String recorderUserId;
|
||||
|
||||
@Column
|
||||
@Comment("记录人工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String recorderUserCode;
|
||||
|
||||
@Column
|
||||
@Comment("记录人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String recorderUserName;
|
||||
|
||||
@Column
|
||||
@Comment("代表团编码JSON")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String delegationCodes;
|
||||
|
||||
@Column
|
||||
@Comment("代表团名称JSON")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String delegationNames;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class TeacherCongressDiscussionGroupInsertParam {
|
||||
|
||||
@NotBlank(message = "届次不能为空")
|
||||
private String sessionId;
|
||||
|
||||
@NotBlank(message = "讨论组编码不能为空")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "讨论组名称不能为空")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "记录人不能为空")
|
||||
private String recorderUserId;
|
||||
|
||||
@NotBlank(message = "记录人工号不能为空")
|
||||
private String recorderUserCode;
|
||||
|
||||
@NotBlank(message = "记录人姓名不能为空")
|
||||
private String recorderUserName;
|
||||
|
||||
@NotBlank(message = "代表团不能为空")
|
||||
private String delegationCodes;
|
||||
|
||||
@NotBlank(message = "代表团不能为空")
|
||||
private String delegationNames;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeacherCongressDiscussionGroupPageParam extends PageForm {
|
||||
|
||||
private String sessionId;
|
||||
|
||||
private String searchName;
|
||||
|
||||
private String recorderUserName;
|
||||
|
||||
private String delegationCode;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.democratic.teachercongress.discussiongroup.param;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeacherCongressDiscussionGroupUpdateParam extends TeacherCongressDiscussionGroupInsertParam {
|
||||
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
}
|
||||
-1
@@ -36,7 +36,6 @@ const HEAD_FORM_TEMPLATE = {
|
||||
<user-select v-model="formData.contactUserId"
|
||||
v-if="headDialogFormVisible"
|
||||
api="/platform/teacherCongress/delegation/notHeadUser"
|
||||
:api_params="{sessionId:formData.sessionId,delegationId:formData.delegationId}"
|
||||
api_input_key_name="keyWord"
|
||||
:option_list="contactOptions"
|
||||
option_value="userId"
|
||||
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
const AU_FORM_TEMPLATE = {
|
||||
template: /*language=HTML*/ `
|
||||
<el-dialog :title="formData.id ? '编辑' : '新增'" :visible.sync="dialogFormVisible" width="760px" :close-on-click-modal="false">
|
||||
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="110px" size="small">
|
||||
<el-form-item label="教代会届次" prop="sessionId">
|
||||
<el-select v-model="formData.sessionId" filterable style="width: 100%" @change="onSessionChange">
|
||||
<el-option v-for="item in sessionOptions" :key="item.id" :label="item.fullName" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="讨论组编码" prop="code">
|
||||
<el-input v-model="formData.code" maxlength="50" placeholder="请输入讨论组编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="讨论组名称" prop="name">
|
||||
<el-input v-model="formData.name" maxlength="100" placeholder="请输入讨论组名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="记录人" prop="recorderUserId">
|
||||
<user-select
|
||||
v-model="formData.recorderUserId"
|
||||
v-if="dialogFormVisible"
|
||||
ref="recorderUserSelect"
|
||||
api="/platform/teacherCongress/discussionGroup/recorderOptions"
|
||||
api_input_key_name="keyword"
|
||||
:option_list="recorderOptions"
|
||||
option_value="id"
|
||||
:option_label_func="(item) => item.username + ' (' + item.loginname + ')'"
|
||||
placeholder="请输入姓名或编码搜索"
|
||||
style="width: 100%"
|
||||
@change="onRecorderChange"
|
||||
></user-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号">
|
||||
<el-input :value="selectedRecorder && selectedRecorder.mobile ? selectedRecorder.mobile : ''" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="代表团" prop="delegationCodes">
|
||||
<el-select
|
||||
v-model="selectedDelegations"
|
||||
value-key="code"
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
placeholder="请输入代表团名称或编码搜索"
|
||||
:remote-method="remoteSearchDelegation"
|
||||
:loading="delegationLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in delegationOptions"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code + ')'"
|
||||
:value="item"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="doSubmit">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
dialogFormVisible: false,
|
||||
delegationLoading: false,
|
||||
formData: {},
|
||||
selectedRecorder: null,
|
||||
selectedDelegations: [],
|
||||
recorderOptions: [],
|
||||
delegationOptions: [],
|
||||
sessionOptions: [],
|
||||
formRules: {
|
||||
sessionId: [{ required: true, message: "教代会届次不能为空", trigger: ["change", "blur"] }],
|
||||
code: [{ required: true, message: "讨论组编码不能为空", trigger: ["change", "blur"] }],
|
||||
name: [{ required: true, message: "讨论组名称不能为空", trigger: ["change", "blur"] }],
|
||||
recorderUserId: [{ required: true, message: "记录人不能为空", trigger: ["change", "blur"] }],
|
||||
delegationCodes: [{ required: true, message: "代表团不能为空", trigger: ["change", "blur"] }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(id, sessionId) {
|
||||
this.dialogFormVisible = true
|
||||
this.formData = {}
|
||||
this.selectedRecorder = null
|
||||
this.selectedDelegations = []
|
||||
this.recorderOptions = []
|
||||
this.delegationOptions = []
|
||||
this.listSession(() => {
|
||||
if (id) {
|
||||
this.loadDetail(id)
|
||||
} else {
|
||||
this.formData = {
|
||||
sessionId: sessionId || "",
|
||||
code: "",
|
||||
name: "",
|
||||
recorderUserId: "",
|
||||
recorderUserCode: "",
|
||||
recorderUserName: "",
|
||||
delegationCodes: "",
|
||||
delegationNames: ""
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formRef && this.$refs.formRef.clearValidate()
|
||||
})
|
||||
if (this.formData.sessionId) {
|
||||
this.remoteSearchDelegation("")
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
loadDetail(id) {
|
||||
this.$axios.post("/platform/teacherCongress/discussionGroup/findOne", { id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
const data = res.data || {}
|
||||
this.formData = {
|
||||
id: data.id || "",
|
||||
sessionId: data.sessionid || "",
|
||||
code: data.code || "",
|
||||
name: data.name || "",
|
||||
recorderUserId: data.recorderuserid || "",
|
||||
recorderUserCode: data.recorderusercode || "",
|
||||
recorderUserName: data.recorderusername || "",
|
||||
delegationCodes: data.delegationcodes || "",
|
||||
delegationNames: data.delegationnames || ""
|
||||
}
|
||||
if (this.formData.sessionid && data.sessionname) {
|
||||
const hasSession = this.sessionOptions.some((item) => item.id === this.formData.sessionid)
|
||||
if (!hasSession) {
|
||||
this.sessionOptions = this.sessionOptions.concat([{
|
||||
id: this.formData.sessionid,
|
||||
fullName: data.sessionname
|
||||
}])
|
||||
}
|
||||
}
|
||||
this.selectedRecorder = {
|
||||
id: this.formData.recorderUserId,
|
||||
loginname: this.formData.recorderUserCode,
|
||||
username: this.formData.recorderUserName,
|
||||
mobile: data.recorderusermobile || ""
|
||||
}
|
||||
this.recorderOptions = this.formData.recorderUserId ? [this.selectedRecorder] : []
|
||||
const codes = Array.isArray(data.delegationCodeList) ? data.delegationCodeList : this.parseJsonArray(this.formData.delegationCodes)
|
||||
const names = Array.isArray(data.delegationNameList) ? data.delegationNameList : this.parseJsonArray(this.formData.delegationNames)
|
||||
this.selectedDelegations = codes.map((code, index) => ({
|
||||
code,
|
||||
name: names[index] || ""
|
||||
}))
|
||||
this.delegationOptions = this.selectedDelegations.slice()
|
||||
if (data.sessionid) {
|
||||
this.remoteSearchDelegation("")
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formRef && this.$refs.formRef.clearValidate()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
listSession(callback) {
|
||||
this.$axios.post("/platform/teacherCongress/common/listOpenSession").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.sessionOptions = res.data || []
|
||||
callback && callback()
|
||||
}
|
||||
})
|
||||
},
|
||||
onSessionChange() {
|
||||
this.selectedDelegations = []
|
||||
this.delegationOptions = []
|
||||
this.formData.delegationCodes = ""
|
||||
this.formData.delegationNames = ""
|
||||
this.remoteSearchDelegation("")
|
||||
},
|
||||
remoteSearchDelegation(keyword) {
|
||||
if (!this.formData.sessionId) {
|
||||
this.delegationOptions = this.selectedDelegations.slice()
|
||||
return
|
||||
}
|
||||
this.delegationLoading = true
|
||||
this.$axios.post("/platform/teacherCongress/discussionGroup/delegationOptions", {
|
||||
sessionId: this.formData.sessionId,
|
||||
keyword
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.delegationOptions = this.mergeOptions(this.selectedDelegations, res.data || [], "code")
|
||||
}
|
||||
}).finally(() => {
|
||||
this.delegationLoading = false
|
||||
})
|
||||
},
|
||||
mergeOptions(current, incoming, key) {
|
||||
const map = new Map()
|
||||
;(incoming || []).concat(current || []).forEach((item) => {
|
||||
if (item && item[key]) {
|
||||
if (!map.has(item[key])) {
|
||||
map.set(item[key], item)
|
||||
}
|
||||
}
|
||||
})
|
||||
return Array.from(map.values())
|
||||
},
|
||||
onRecorderChange(userId) {
|
||||
const componentOptions = this.$refs.recorderUserSelect && this.$refs.recorderUserSelect.options ? this.$refs.recorderUserSelect.options : []
|
||||
this.recorderOptions = this.mergeOptions(this.recorderOptions, componentOptions, "id")
|
||||
const user = this.recorderOptions.find((item) => item.id === userId)
|
||||
this.selectedRecorder = user || null
|
||||
this.formData.recorderUserId = user ? user.id : ""
|
||||
this.formData.recorderUserCode = user ? user.loginname : ""
|
||||
this.formData.recorderUserName = user ? user.username : ""
|
||||
},
|
||||
parseJsonArray(value) {
|
||||
if (!value) {
|
||||
return []
|
||||
}
|
||||
try {
|
||||
const result = JSON.parse(value)
|
||||
return Array.isArray(result) ? result : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
},
|
||||
doSubmit() {
|
||||
this.formData.delegationCodes = JSON.stringify(this.selectedDelegations.map((item) => item.code))
|
||||
this.formData.delegationNames = JSON.stringify(this.selectedDelegations.map((item) => item.name))
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$axios.post(
|
||||
"/platform/teacherCongress/discussionGroup" + (this.formData.id ? "/update" : "/insert"),
|
||||
this.formData
|
||||
).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$message.success(res.msg)
|
||||
this.$emit("refresh")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="教代会届次">
|
||||
<el-select clearable filterable style="width: 100%" v-model="pageForm.sessionId" @change="doSearch">
|
||||
<el-option v-for="item in sessionOptions" :key="item.id" :label="item.fullName" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item>
|
||||
<el-input placeholder="请输入查询内容" v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" style="width: 130px">
|
||||
<el-option label="讨论组编码" value="code"></el-option>
|
||||
<el-option label="讨论组名称" value="name"></el-option>
|
||||
</el-select>
|
||||
<el-button slot="append" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
</el-input>
|
||||
</search-item>
|
||||
<search-item label="记录人">
|
||||
<el-input clearable placeholder="请输入记录人姓名或编码" v-model="pageForm.recorderUserName" @keyup.enter.native="doSearch"></el-input>
|
||||
</search-item>
|
||||
<search-item label="代表团编码">
|
||||
<el-input clearable placeholder="请输入代表团编码" v-model="pageForm.delegationCode" @keyup.enter.native="doSearch"></el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never">
|
||||
<table-tool label="建议意见讨论组">
|
||||
<el-button size="small" type="primary" @click="$refs.auFormRef.onOpen(null, pageForm.sessionId)">
|
||||
<i class="ti-plus"></i>
|
||||
新增
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" @sort-change="pageOrder" header-align="center" style="width: 100%">
|
||||
<el-table-column type="index" :index="indexMethod" label="序号" width="70"></el-table-column>
|
||||
<el-table-column prop="code" label="讨论组编码" min-width="140"></el-table-column>
|
||||
<el-table-column prop="name" label="讨论组名称" min-width="180"></el-table-column>
|
||||
<el-table-column prop="recorderUserName" label="记录人" min-width="140">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.recorderUserName }}<span v-if="row.recorderUserCode">({{ row.recorderUserCode }})</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="recorderUserMobile" label="手机号" width="140"></el-table-column>
|
||||
<el-table-column prop="delegationNames" label="代表团" min-width="260" :show-overflow-tooltip="true">
|
||||
<template slot-scope="{row}">
|
||||
{{ formatDelegations(row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdByName" label="创建人" width="120"></el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="180">
|
||||
<template slot-scope="{row}">
|
||||
{{ formatDate(row.createdAt) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="160" fixed="right">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" type="primary" @click="$refs.auFormRef.onOpen(row.id, row.sessionId)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="doDelete(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<au-form @refresh="pageData" ref="auFormRef"></au-form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--#include("auForm.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"au-form": AU_FORM_TEMPLATE
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sessionOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
listSession() {
|
||||
this.$axios.post("/platform/teacherCongress/common/listOpenSession").then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.sessionOptions = res.data || []
|
||||
if (!this.pageForm.sessionId && this.sessionOptions.length) {
|
||||
this.pageForm.sessionId = this.sessionOptions[0].id
|
||||
this.pageData()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
formatDelegations(row) {
|
||||
const codes = this.parseJsonArray(row.delegationCodes)
|
||||
const names = this.parseJsonArray(row.delegationNames)
|
||||
return codes.map((code, index) => (names[index] || "") + "(" + code + ")").filter((item) => item !== "()").join(", ")
|
||||
},
|
||||
formatDate(value) {
|
||||
if (!value) {
|
||||
return ""
|
||||
}
|
||||
const date = new Date(Number(value))
|
||||
const pad = (num) => String(num).padStart(2, "0")
|
||||
return [
|
||||
date.getFullYear(),
|
||||
pad(date.getMonth() + 1),
|
||||
pad(date.getDate())
|
||||
].join("-") + " " + [pad(date.getHours()), pad(date.getMinutes()), pad(date.getSeconds())].join(":")
|
||||
},
|
||||
parseJsonArray(value) {
|
||||
if (!value) {
|
||||
return []
|
||||
}
|
||||
try {
|
||||
const result = JSON.parse(value)
|
||||
return Array.isArray(result) ? result : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm("确认删除这条记录吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/teacherCongress/discussionGroup/delete", { id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
pageData() {
|
||||
this.$axios.post("/platform/teacherCongress/discussionGroup/pageData", this.pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageForm.searchName = "code"
|
||||
this.listSession()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user