From 207c3dffc0b67ca624de4925ad36b4d30ba14aee Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Tue, 16 Jul 2024 19:46:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/schoolteacher/schoolteacherlist.js | 14 +-- .../js/sysEveUser/resetUserEffectiveDate.js | 95 +++++++++++++++++++ .../template/js/sysEveUser/sysEveUserAdd.js | 73 +++++++++++--- .../template/js/sysEveUser/sysEveUserList.js | 72 ++++++++------ .../js/sysEveUser/sysEveUserPasswordEdit.js | 2 +- .../sysEveUser/resetUserEffectiveDate.html | 47 +++++++++ .../tpl/sysEveUser/sysEveUserAdd.html | 15 ++- .../tpl/sysEveUser/sysEveUserList.html | 7 +- .../template/json/skyeyeClassEnum.json | 1 + 9 files changed, 266 insertions(+), 60 deletions(-) create mode 100644 userauth/src/main/resources/template/js/sysEveUser/resetUserEffectiveDate.js create mode 100644 userauth/src/main/resources/template/tpl/sysEveUser/resetUserEffectiveDate.html diff --git a/school/src/main/resources/template/js/schoolteacher/schoolteacherlist.js b/school/src/main/resources/template/js/schoolteacher/schoolteacherlist.js index c33ad40e0..8cd74d35d 100644 --- a/school/src/main/resources/template/js/schoolteacher/schoolteacherlist.js +++ b/school/src/main/resources/template/js/schoolteacher/schoolteacherlist.js @@ -45,17 +45,9 @@ layui.config({ } }}, { field: 'userIdCard', title: '身份证', align: 'center', width: 160 }, - { field: 'userSex', title: '性别', width: 60, align: 'center', templet: function (d) { - if(d.userSex == '0'){ - return "保密"; - } else if (d.userSex == '1'){ - return "男"; - } else if (d.userSex == '2'){ - return "女"; - } else { - return "参数错误"; - } - }}, + { field: 'userSex', title: '性别', width: 60, rowspan: '2', templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("sexEnum", 'id', d.userSex, 'name'); + }}, { field: 'state', title: '状态', width: 60, align: 'center', templet: function (d) { if(d.state == '1'){ return "在职"; diff --git a/userauth/src/main/resources/template/js/sysEveUser/resetUserEffectiveDate.js b/userauth/src/main/resources/template/js/sysEveUser/resetUserEffectiveDate.js new file mode 100644 index 000000000..c091548d6 --- /dev/null +++ b/userauth/src/main/resources/template/js/sysEveUser/resetUserEffectiveDate.js @@ -0,0 +1,95 @@ + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'jquery', 'winui', 'laydate', 'form'], function (exports) { + winui.renderColor(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form, + laydate = layui.laydate; + var id = GetUrlParam("id"); + + var startTime = laydate.render({ + elem: '#startTime', //指定元素 + format: 'yyyy-MM-dd', + min: minDate(), + theme: 'grid', + done:function(value, date){ + endTime.config.min = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + }; + } + }); + + var endTime = laydate.render({ + elem: '#endTime', //指定元素 + format: 'yyyy-MM-dd', + min: minDate(), + theme: 'grid', + done:function(value, date){ + startTime.config.max = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + } + } + }); + // 设置最小可选的日期 + function minDate(){ + var now = new Date(); + return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate(); + } + + AjaxPostUtil.request({url: reqBasePath + "querySysEveUserById", params: {id: id}, type: 'json', method: "GET", callback: function (json) { + skyeyeClassEnumUtil.showEnumDataListByClassName("userIsTermOfValidity", 'radio', "isTermOfValidity", json.bean.isTermOfValidity, form); + if (json.bean.isTermOfValidity == 1) { + $(".effectiveDate").hide(); + } else if (json.bean.isTermOfValidity == 2) { + $(".effectiveDate").show(); + $("#startTime").val(json.bean.startTime); + $("#endTime").val(json.bean.endTime); + } + }}); + + form.on('radio(isTermOfValidityFilter)', function (data) { + let val = data.value; + if (val == 1) { + $(".effectiveDate").hide(); + } else if (val == 2) { + $(".effectiveDate").show(); + } + }); + + matchingLanguage(); + form.render(); + form.on('submit(resetUserEffectiveDate)', function(data) { + if (winui.verifyForm(data.elem)) { + var params = { + id: id, + isTermOfValidity: dataShowType.getData('isTermOfValidity'), + startTime: $("#startTime").val(), + endTime: $("#endTime").val() + }; + AjaxPostUtil.request({url: reqBasePath + "resetUserEffectiveDate", params: params, type: 'json', method: "POST", callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); + } + return false; + }); + + $("body").on("click", "#cancle", function() { + parent.layer.close(index); + }); +}); \ No newline at end of file diff --git a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserAdd.js b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserAdd.js index 1a8eeda8b..b0b5a3eb6 100644 --- a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserAdd.js +++ b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserAdd.js @@ -8,13 +8,64 @@ layui.config({ version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui', 'tableSelect'], function (exports) { +}).define(['window', 'table', 'jquery', 'winui', 'tableSelect', 'laydate'], function (exports) { winui.renderColor(); layui.use(['form'], function (form) { var index = parent.layer.getFrameIndex(window.name); var $ = layui.$, - tableSelect = layui.tableSelect; - + tableSelect = layui.tableSelect, + laydate = layui.laydate; + + var startTime = laydate.render({ + elem: '#startTime', //指定元素 + format: 'yyyy-MM-dd', + min: minDate(), + theme: 'grid', + done:function(value, date){ + endTime.config.min = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + }; + } + }); + + var endTime = laydate.render({ + elem: '#endTime', //指定元素 + format: 'yyyy-MM-dd', + min: minDate(), + theme: 'grid', + done:function(value, date){ + startTime.config.max = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + } + } + }); + // 设置最小可选的日期 + function minDate(){ + var now = new Date(); + return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate(); + } + skyeyeClassEnumUtil.showEnumDataListByClassName("userIsTermOfValidity", 'radio', "isTermOfValidity", '', form); + + $(".effectiveDate").hide(); + form.on('radio(isTermOfValidityFilter)', function (data) { + let val = data.value; + if (val == 1) { + $(".effectiveDate").hide(); + } else if (val == 2) { + $(".effectiveDate").show(); + } + }); + form.verify({ password : function(value, item) { if(value.length < 6){ @@ -46,17 +97,9 @@ layui.config({ return '' + d.jobNumber + ''; }}, { field: 'userName', title: '员工姓名', width: 100 }, - { field: 'userSex', title: '性别', width: 60, templet: function (d) { - if(d.userSex == '0'){ - return "保密"; - } else if (d.userSex == '1'){ - return "男"; - } else if (d.userSex == '2'){ - return "女"; - } else { - return "参数错误"; - } - }} + { field: 'userSex', title: '性别', width: 60, rowspan: '2', templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("sexEnum", 'id', d.userSex, 'name'); + }}, ]] }, done: function (elem, data) { @@ -88,7 +131,7 @@ layui.config({ staffId: staffId, userCode: $("#userCode").val(), password: $("#password").val(), - isTermOfValidity: $("#isTermOfValidity").val() + isTermOfValidity: dataShowType.getData('isTermOfValidity') } AjaxPostUtil.request({url: reqBasePath + "sysAdd005", params: params, type: 'json', method: "POST", callback: function (json) { parent.layer.close(index); diff --git a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserList.js b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserList.js index 9b8b77889..8880c34d8 100644 --- a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserList.js +++ b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserList.js @@ -23,33 +23,32 @@ layui.config({ limits: getLimits(), limit: getLimit(), cols: [[ - { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers', fixed: 'left' }, - { field: 'userCode', title: '账号', width: 120, fixed: 'left' }, - { field: 'userName', title: '姓名', align: 'left', width: 100, fixed: 'left', templet: function (d) { + { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers', rowspan: '2', fixed: 'left' }, + { field: 'userCode', title: '账号', width: 120, fixed: 'left', rowspan: '2' }, + { field: 'userName', title: '姓名', align: 'left', width: 100, fixed: 'left', rowspan: '2', templet: function (d) { return '' + d.userName + ''; }}, - { field: 'jobNumber', title: '工号', align: 'left', width: 100, fixed: 'left'}, - { field: 'email', title: '邮箱', width: 100 }, - { field: 'sexName', title: '性别', width: 60, templet: function (d) { - if(d.sexName == '0') { - return "保密"; - } else if (d.sexName == '1'){ - return "男"; - } else if (d.sexName == '2'){ - return "女"; - } else { - return "参数错误"; - } + { field: 'jobNumber', title: '工号', align: 'left', width: 100, fixed: 'left', rowspan: '2' }, + { field: 'state', title: '有效期', align: 'center', width: 90, colspan: 3}, + { field: 'email', title: '邮箱', width: 100, rowspan: '2' }, + { field: 'userSex', title: '性别', width: 60, rowspan: '2', templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("sexEnum", 'id', d.userSex, 'name'); }}, - { field: 'companyName', title: '所属公司', width: 150 }, - { field: 'departmentName', title: '所属部门', width: 120}, - { field: 'jobName', title: '担任职位', width: 120}, - { field: 'userLock', title: '是否锁定', align: 'center', width: 90, templet: '#checkboxTpl', unresize: true}, - { field: 'roleName', title: '角色', width: 120}, - { field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 }, - { field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 }, - { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 150, toolbar: '#tableBar'} - ]], + { field: 'companyName', title: '所属公司', rowspan: '2', width: 150 }, + { field: 'departmentName', title: '所属部门', rowspan: '2', width: 120}, + { field: 'jobName', title: '担任职位', rowspan: '2', width: 120}, + { field: 'userLock', title: '是否锁定', rowspan: '2', align: 'center', width: 90, templet: '#checkboxTpl', unresize: true}, + { field: 'roleName', title: '角色', rowspan: '2', width: 120}, + { field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], rowspan: '2', width: 120 }, + { field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], rowspan: '2', align: 'center', width: 150 }, + { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', rowspan: '2', width: 250, toolbar: '#tableBar'} + ], [ + { field: 'isTermOfValidity', title: '类型', align: 'center', width: 100, templet: function (d) { + return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("userIsTermOfValidity", 'id', d.isTermOfValidity, 'name'); + }}, + { field: 'startTime', title: '开始时间', align: 'center', width: 100 }, + { field: 'endTime', title: '结束时间', align: 'center', width: 100 }, + ]], done: function(json) { matchingLanguage(); initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入账号、员工姓名、员工工号", function () { @@ -71,6 +70,8 @@ layui.config({ systemCommonUtil.showPicImg(fileBasePath + data.userPhoto); } else if (layEvent === 'details') { // 员工详情 details(data); + } else if (layEvent === 'resetUserEffectiveDate') { // 重置有效期 + resetUserEffectiveDate(data); } }); @@ -78,7 +79,7 @@ layui.config({ // 监听锁定操作 form.on('checkbox(lockDemo)', function(obj) { - if(obj.elem.checked){ + if (obj.elem.checked) { // 锁定 lock(obj.value); } else { @@ -88,15 +89,15 @@ layui.config({ }); // 锁定 - function lock(id){ - AjaxPostUtil.request({url: reqBasePath + "sys002", params: {rowId: id}, type: 'json', method: "PUT", callback: function (json) { + function lock(id) { + AjaxPostUtil.request({url: reqBasePath + "sys002", params: {id: id}, type: 'json', method: "PUT", callback: function (json) { winui.window.msg("已成功锁定,该账号目前无法登录.", {icon: 1, time: 2000}); }}); } // 解锁 - function unlock(id){ - AjaxPostUtil.request({url: reqBasePath + "sys003", params: {rowId: id}, type: 'json', method: "PUT", callback: function (json) { + function unlock(id) { + AjaxPostUtil.request({url: reqBasePath + "sys003", params: {id: id}, type: 'json', method: "PUT", callback: function (json) { winui.window.msg("账号恢复正常.", {icon: 1, time: 2000}); }}); } @@ -114,6 +115,19 @@ layui.config({ loadTable(); }}); } + + // 重置有效期 + function resetUserEffectiveDate(data) { + _openNewWindows({ + url: "../../tpl/sysEveUser/resetUserEffectiveDate.html?id=" + data.id, + title: "重置有效期", + pageId: "resetUserEffectiveDate", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + loadTable(); + }}); + } // 绑定角色 function bindRole(data) { diff --git a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserPasswordEdit.js b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserPasswordEdit.js index 60b1926c8..514ae9c56 100644 --- a/userauth/src/main/resources/template/js/sysEveUser/sysEveUserPasswordEdit.js +++ b/userauth/src/main/resources/template/js/sysEveUser/sysEveUserPasswordEdit.js @@ -28,7 +28,7 @@ layui.config({ form.on('submit(formEditPwdBean)', function (data) { if (winui.verifyForm(data.elem)) { var params = { - rowId: parent.rowId, + id: parent.rowId, password: $("#password").val(), }; diff --git a/userauth/src/main/resources/template/tpl/sysEveUser/resetUserEffectiveDate.html b/userauth/src/main/resources/template/tpl/sysEveUser/resetUserEffectiveDate.html new file mode 100644 index 000000000..ad43f1fbd --- /dev/null +++ b/userauth/src/main/resources/template/tpl/sysEveUser/resetUserEffectiveDate.html @@ -0,0 +1,47 @@ + + + + + + + + + +
+
+
+ 基础信息
+
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserAdd.html b/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserAdd.html index 0e8a3d872..c78d1e6d8 100644 --- a/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserAdd.html +++ b/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserAdd.html @@ -21,10 +21,21 @@
-
- +
+
+ +
+ +
+
+
+ +
+ +
+
diff --git a/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserList.html b/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserList.html index f002f11bb..37540b2c3 100644 --- a/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserList.html +++ b/userauth/src/main/resources/template/tpl/sysEveUser/sysEveUserList.html @@ -21,12 +21,15 @@
diff --git a/web/src/main/resources/template/json/skyeyeClassEnum.json b/web/src/main/resources/template/json/skyeyeClassEnum.json index 54156f4c1..70ddfaf69 100644 --- a/web/src/main/resources/template/json/skyeyeClassEnum.json +++ b/web/src/main/resources/template/json/skyeyeClassEnum.json @@ -18,6 +18,7 @@ "checkDayType": {"name": "日程插件上的类型(包含日程的)", "className": "skyeye-pro#com.skyeye.common.enumeration.CheckDayType"}, "userStaffType": {"name": "员工类型", "className": "skyeye-pro#com.skyeye.personnel.classenum.UserStaffType"}, "pageOpenType": {"name": "页面布局打开方式", "className": "skyeye-pro#com.skyeye.operate.classenum.PageOpenType"}, + "userIsTermOfValidity": {"name": "用户是否长期有效", "className": "skyeye-pro#com.skyeye.personnel.classenum.UserIsTermOfValidity"}, "menuType": {"name": "APP菜单类型", "className": "skyeye-pro#com.skyeye.menu.classenum.MenuType"}, "urlType": {"name": "APP菜单URL类型", "className": "skyeye-pro#com.skyeye.menu.classenum.UrlType"}, -- GitLab