commit
This commit is contained in:
+50
@@ -14,6 +14,7 @@ import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.sys.models.Sys_union_group;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
@@ -164,6 +165,55 @@ public class MemberApplyController {
|
||||
return Result.success(dao.fetch(MemberApplyRecord.class,id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询申请记录
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("根据 userid 查询是否能申请入会")
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
public Result findOne(String id) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", id));
|
||||
if (user == null) {
|
||||
return Result.error("用户不存在");
|
||||
}
|
||||
|
||||
Dict result = Dict.create();
|
||||
result.set("id", user.getId());
|
||||
result.set("username", user.getUsername());
|
||||
result.set("loginname", user.getLoginname());
|
||||
|
||||
boolean isAlreadyMember = false;
|
||||
if (user.getMember() != null) {
|
||||
isAlreadyMember = Boolean.TRUE.equals(user.getMember());
|
||||
}
|
||||
|
||||
//1、已经是会员无法申请
|
||||
if (isAlreadyMember) {
|
||||
result.set("canApply", false);
|
||||
result.set("msg", "您已是工会会员,无需重复申请");
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
long doingProcessCount = dao.count(ProcessInstance.class,
|
||||
Cnd.where("businessNo", "in",
|
||||
Sqls.create("SELECT id FROM member_apply_record WHERE userId = @userId")
|
||||
.setParam("userId", id)
|
||||
).and("state", "=", 10)
|
||||
);
|
||||
|
||||
//2、已经有申请中的,不能申请
|
||||
if (doingProcessCount > 0) {
|
||||
result.set("canApply", false);
|
||||
result.set("msg", "您有一份入会申请流程正在审批中,请勿重复提交");
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
result.set("canApply", true);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
|
||||
@@ -228,8 +228,12 @@ layout("/layouts/platform.html"){
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="end" class="mt20">
|
||||
<el-button type="primary" plain @click="onSave">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
|
||||
<el-button type="primary" plain @click="onSave" v-if="!taskId"
|
||||
:disabled="!canApply"
|
||||
:title="applyDisableMsg">保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" v-if="!taskId" v-if="!taskId"
|
||||
:disabled="!canApply"
|
||||
:title="applyDisableMsg">提交</el-button>
|
||||
<el-button type="primary" @click="onFinishTask" v-else>提交</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
@@ -248,6 +252,8 @@ layout("/layouts/platform.html"){
|
||||
formData: {
|
||||
families: []
|
||||
},
|
||||
canApply: true,
|
||||
applyDisableMsg: '',
|
||||
formRules: {
|
||||
username: [{ required: false, message: "必填", trigger: ["change", "blur"] }],
|
||||
sex: [{ required: false, message: "必填", trigger: ["change", "blur"] }],
|
||||
@@ -324,6 +330,23 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkApplyPermission() {
|
||||
if (this.id || this.taskId) {
|
||||
this.canApply = true;
|
||||
this.applyDisableMsg = '';
|
||||
return;
|
||||
}
|
||||
this.$axios.post("/platform/member/apply/submit/findOne", { id: this.formData.userId }).then(res => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.canApply = res.data.canApply;
|
||||
this.applyDisableMsg = res.data.msg || '';
|
||||
|
||||
if (!this.canApply) {
|
||||
this.$message.warning(this.applyDisableMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onSave() {
|
||||
this.$confirm("您确定保存吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -458,6 +481,8 @@ layout("/layouts/platform.html"){
|
||||
this.$set(this.formData, "families", families ? families : [])
|
||||
this.$set(this.formData, "personalData", personalData)
|
||||
this.$set(this.formData, "arrivalAtSchoolDate", this.$moment(arrivalAtSchoolDate).format('YYYY-MM-DD'))
|
||||
|
||||
this.checkApplyPermission();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user