From 010a1198f332d6f7de1ca926f560e4bb0eec6ffd Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Mon, 21 Nov 2022 23:15:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86---?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=A1=8C=E4=B8=BA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../companyDepartment/companyDepartmentAdd.js | 126 ++++---------- .../companyDepartmentChooseList.js | 10 +- .../companyDepartmentEdit.js | 157 ++++++------------ .../companyDepartmentList.js | 104 +++++------- .../js/companyMation/companyChooseList.js | 2 +- .../companyDepartmentAdd.html | 9 +- .../companyDepartmentChooseList.html | 2 +- .../companyDepartmentEdit.html | 8 +- .../companyDepartmentList.html | 35 +--- .../companydepartmenteditTemplate.tpl | 39 ----- .../tpl/companyMation/companyChooseList.html | 4 +- 11 files changed, 149 insertions(+), 347 deletions(-) delete mode 100644 organization/src/main/resources/template/tpl/companyDepartment/companydepartmenteditTemplate.tpl diff --git a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentAdd.js b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentAdd.js index 55403e41a..936fce666 100644 --- a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentAdd.js +++ b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentAdd.js @@ -5,100 +5,38 @@ layui.config({ window: 'js/winui.window' }).define(['window', 'jquery', 'winui'], function (exports) { winui.renderColor(); - layui.use(['form', 'layedit'], function (form) { - var index = parent.layer.getFrameIndex(window.name); - var $ = layui.$, - form = layui.form, - layedit = layui.layedit; - - layedit.set({ - uploadImage: { - url: reqBasePath + "common003", //接口url - type: 'post', //默认post - data: { - type: '13' - } - } - }); - - var layContent = layedit.build('content', { - tool: [ - 'html' - ,'strong' //加粗 - ,'italic' //斜体 - ,'underline' //下划线 - ,'del' //删除线 - ,'addhr' - ,'|' - ,'removeformat' - ,'fontFomatt' - ,'fontfamily' - ,'fontSize' - ,'colorpicker' - ,'fontBackColor' - ,'face' //表情 - ,'|' //分割线 - ,'left' //左对齐 - ,'center' //居中对齐 - ,'right' //右对齐 - ,'link' //超链接 - ,'unlink' //清除链接 - ,'code' - ,'image' //插入图片 - ,'attachment' - ,'table' - ,'|' - ,'fullScreen' - ,'preview' - ,'|' - ,'help' - ], - uploadFiles: { - url: reqBasePath + "common003", - accept: 'file', - acceptMime: 'file/*', - size: '20480', - data: { - type: '13' - }, - autoInsert: true, //自动插入编辑器设置 - done: function(data) { - } - } - }); - - // 加载公司数据 - initCompany(); - function initCompany(){ - systemCommonUtil.getSysCompanyList(function (json) { - // 加载企业数据 - $("#companyId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json)); - }); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form; + var ue = ueEditorUtil.initEditor('remark'); + + // 加载公司数据 + systemCommonUtil.getSysCompanyList(function (json) { + $("#companyId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), json)); + }); + + matchingLanguage(); + form.render(); + form.on('submit(formAddBean)', function (data) { + if (winui.verifyForm(data.elem)) { + var params = { + name: $("#name").val(), + remark: encodeURIComponent(ue.getContent()), + companyId: isNull($("#companyId").val()) ? '0' : $("#companyId").val(), + pId: '0', + overtimeSettlementType: $("#overtimeSettlementType").val() + }; + + AjaxPostUtil.request({url: reqBasePath + "writeDepartmentMation", params: params, type: 'json', method: "POST", callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); } - - matchingLanguage(); - form.render(); - form.on('submit(formAddBean)', function (data) { - if (winui.verifyForm(data.elem)) { - var params = { - departmentName: $("#departmentName").val(), - departmentDesc: encodeURIComponent(layedit.getContent(layContent)), - companyId: $("#companyId").val(), - overtimeSettlementType: $("#overtimeSettlementType").val() - }; - - AjaxPostUtil.request({url: reqBasePath + "companydepartment002", 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); - }); + return false; + }); + + // 取消 + $("body").on("click", "#cancle", function() { + parent.layer.close(index); }); - }); \ No newline at end of file diff --git a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentChooseList.js b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentChooseList.js index 9b311078a..76da34622 100644 --- a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentChooseList.js +++ b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentChooseList.js @@ -44,12 +44,12 @@ layui.config({ cols: [[ { type: 'checkbox'}, { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, - { field: 'departmentName', title: '部门名称', width: 300 }, + { field: 'name', title: '部门名称', width: 300 }, { field: 'id', title: '部门简介', width: 80, align: 'center', templet: function (d) { - return ''; + return ''; }} ]], - done: function(res, curr, count){ + done: function(json, curr, count){ matchingLanguage(); tableCheckBoxUtil.checkedDefault({ gridId: 'messageTable', @@ -65,14 +65,14 @@ layui.config({ table.on('tool(messageTable)', function (obj) { var data = obj.data; var layEvent = obj.event; - if (layEvent === 'departmentDesc') { //部门简介 + if (layEvent === 'remark') { //部门简介 layer.open({ id: '部门简介', type: 1, title: '部门简介', shade: 0.3, area: ['90vw', '90vh'], - content: data.departmentDesc + content: data.remark }); } }); diff --git a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentEdit.js b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentEdit.js index 9e552d4d4..eecdd08a6 100644 --- a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentEdit.js +++ b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentEdit.js @@ -5,112 +5,59 @@ layui.config({ window: 'js/winui.window' }).define(['window', 'jquery', 'winui'], function (exports) { winui.renderColor(); - layui.use(['form', 'layedit'], function (form) { - var index = parent.layer.getFrameIndex(window.name); - var $ = layui.$, - form = layui.form, - layedit = layui.layedit; + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form; + var ue = null; - var layContent; - - showGrid({ - id: "showForm", - url: reqBasePath + "companydepartment004", - params: {rowId: parent.rowId}, - pagination: false, - template: $("#beanTemplate").html(), - ajaxSendLoadBefore: function(hdb) { - }, - ajaxSendAfter:function (json) { - $("#overtimeSettlementType").val(json.bean.overtimeSettlementType); - - layedit.set({ - uploadImage: { - url: reqBasePath + "common003", //接口url - type: 'post', //默认post - data: { - type: '13' - } - } - }); - - layContent = layedit.build('content', { - tool: [ - 'html' - ,'strong' //加粗 - ,'italic' //斜体 - ,'underline' //下划线 - ,'del' //删除线 - ,'addhr' - ,'|' - ,'removeformat' - ,'fontFomatt' - ,'fontfamily' - ,'fontSize' - ,'colorpicker' - ,'fontBackColor' - ,'face' //表情 - ,'|' //分割线 - ,'left' //左对齐 - ,'center' //居中对齐 - ,'right' //右对齐 - ,'link' //超链接 - ,'unlink' //清除链接 - ,'code' - ,'image' //插入图片 - ,'attachment' - ,'table' - ,'|' - ,'fullScreen' - ,'preview' - ,'|' - ,'help' - ], - uploadFiles: { - url: reqBasePath + "common003", - accept: 'file', - acceptMime: 'file/*', - size: '20480', - data: { - type: '13' - }, - autoInsert: true, //自动插入编辑器设置 - done: function(data) { - } - } - }); - - // 加载公司数据 - systemCommonUtil.getSysCompanyList(function(data) { - $("#companyId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), data)); - $("#companyId").val(json.bean.companyId); - }); + showGrid({ + id: "showForm", + url: reqBasePath + "queryDepartmentMationById", + params: {id: parent.rowId}, + pagination: false, + method: 'GET', + template: $("#beanTemplate").html(), + ajaxSendLoadBefore: function(hdb) { + }, + ajaxSendAfter:function (json) { + $("#overtimeSettlementType").val(json.bean.overtimeSettlementType); + + ue = ueEditorUtil.initEditor('remark'); + ue.addListener("ready", function () { + ue.setContent(json.bean.remark); + }); + + // 加载公司数据 + systemCommonUtil.getSysCompanyList(function(data) { + $("#companyId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), data)); + $("#companyId").val(json.bean.companyId); + }); + + matchingLanguage(); + form.render(); + form.on('submit(formEditBean)', function (data) { + if (winui.verifyForm(data.elem)) { + var params = { + name: $("#name").val(), + remark: encodeURIComponent(ue.getContent()), + companyId: isNull($("#companyId").val()) ? '0' : $("#companyId").val(), + pId: '0', + overtimeSettlementType: $("#overtimeSettlementType").val(), + id: parent.rowId + }; + + AjaxPostUtil.request({url: reqBasePath + "writeDepartmentMation", params: params, type: 'json', method: "POST", callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); + } + return false; + }); + } + }); - matchingLanguage(); - form.render(); - form.on('submit(formEditBean)', function (data) { - if (winui.verifyForm(data.elem)) { - var params = { - departmentName: $("#departmentName").val(), - departmentDesc: encodeURIComponent(layedit.getContent(layContent)), - companyId: $("#companyId").val(), - overtimeSettlementType: $("#overtimeSettlementType").val(), - rowId: parent.rowId - }; - - AjaxPostUtil.request({url: reqBasePath + "companydepartment005", params: params, type: 'json', method: "PUT", callback: function (json) { - parent.layer.close(index); - parent.refreshCode = '0'; - }}); - } - return false; - }); - } - }); - - // 取消 - $("body").on("click", "#cancle", function() { - parent.layer.close(index); - }); + // 取消 + $("body").on("click", "#cancle", function() { + parent.layer.close(index); }); }); \ No newline at end of file diff --git a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentList.js b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentList.js index 86471c9ba..82682ecbf 100644 --- a/organization/src/main/resources/template/js/companyDepartment/companyDepartmentList.js +++ b/organization/src/main/resources/template/js/companyDepartment/companyDepartmentList.js @@ -11,45 +11,41 @@ layui.config({ var $ = layui.$, form = layui.form, table = layui.table; - var selTemplate = getFileContent('tpl/template/select-option-must.tpl'); - authBtn('1552961771842'); - - systemCommonUtil.getSysCompanyList(function (json) { - // 加载企业数据 - $("#companyId").html(getDataUseHandlebars(selTemplate, json)); - // 初始化加载表格 - initLoatTable(); - }); - function initLoatTable(){ - table.render({ - id: 'messageTable', - elem: '#messageTable', - method: 'post', - url: reqBasePath + 'companydepartment001', - where: getTableParams(), - even: true, - page: true, - limits: getLimits(), - limit: getLimit(), - cols: [[ - { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, - { field: 'departmentName', title: '部门名称', width: 180 }, - { field: 'id', title: '部门简介', width: 80, align: 'center', templet: function (d) { - return ''; - }}, - { field: 'overtimeSettlementTypeName', title: '加班结算方式', width: 120 }, - { field: 'jobNum', title: '职位数', width: 120 }, - { field: 'userNum', title: '员工数', 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: 240, toolbar: '#tableBar'} - ]], - done: function(json) { - matchingLanguage(); - } - }); - } + table.render({ + id: 'messageTable', + elem: '#messageTable', + method: 'post', + url: reqBasePath + 'companydepartment001', + where: getTableParams(), + even: true, + page: true, + limits: getLimits(), + limit: getLimit(), + cols: [[ + { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, + { field: 'name', title: '部门名称', width: 180 }, + { field: 'companyName', title: '所属企业', width: 180 }, + { field: 'remark', title: '部门简介', width: 80, align: 'center', templet: function (d) { + return ''; + }}, + { field: 'overtimeSettlementTypeName', title: '加班结算方式', width: 120 }, + { field: 'jobNum', title: '职位数', width: 80 }, + { field: 'userNum', title: '员工数', width: 80 }, + { field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], width: 120 }, + { field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 }, + { field: 'lastUpdateName', title: systemLanguage["com.skyeye.lastUpdateName"][languageType], align: 'left', width: 120 }, + { field: 'lastUpdateTime', title: systemLanguage["com.skyeye.lastUpdateTime"][languageType], align: 'center', width: 150 }, + { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 240, toolbar: '#tableBar' } + ]], + done: function(json) { + matchingLanguage(); + initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入名称", function () { + table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); + }); + } + }); table.on('tool(messageTable)', function (obj) { var data = obj.data; @@ -58,31 +54,23 @@ layui.config({ del(data); } else if (layEvent === 'edit') { //编辑 edit(data); - } else if (layEvent === 'departmentDesc') { //部门简介 + } else if (layEvent === 'remark') { //部门简介 layer.open({ id: '部门简介', type: 1, title: '部门简介', shade: 0.3, area: ['90vw', '90vh'], - content: data.departmentDesc + content: data.remark }); } }); - form.render(); - form.on('submit(formSearch)', function (data) { - if (winui.verifyForm(data.elem)) { - refreshTable(); - } - return false; - }); - // 删除 function del(data) { layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function (index) { layer.close(index); - AjaxPostUtil.request({url: reqBasePath + "companydepartment003", params: {rowId: data.id}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: reqBasePath + "deleteDepartmentMationById", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) { winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000}); loadTable(); }}); @@ -116,25 +104,17 @@ layui.config({ }}); }); - // 刷新数据 + form.render(); $("body").on("click", "#reloadTable", function() { loadTable(); }); - function loadTable() { - table.reloadData("messageTable", {where: getTableParams()}); - } - - function refreshTable(){ - table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); - } + function loadTable() { + table.reloadData("messageTable", {where: getTableParams()}); + } - function getTableParams() { - return { - departmentName: $("#departmentName").val(), - companyId: $("#companyId").val(), - overtimeSettlementType: $("#overtimeSettlementType").val() - } + function getTableParams() { + return $.extend(true, {}, initTableSearchUtil.getSearchValue("messageTable")); } exports('companyDepartmentList', {}); diff --git a/organization/src/main/resources/template/js/companyMation/companyChooseList.js b/organization/src/main/resources/template/js/companyMation/companyChooseList.js index 90d2e704e..d06c14707 100644 --- a/organization/src/main/resources/template/js/companyMation/companyChooseList.js +++ b/organization/src/main/resources/template/js/companyMation/companyChooseList.js @@ -48,7 +48,7 @@ layui.config({ { field: 'departmentNum', title: '部门数', width: 100 }, { field: 'userNum', title: '员工数', width: 100 }, ]], - done: function(res, curr, count){ + done: function(json, curr, count){ matchingLanguage(); tableCheckBoxUtil.checkedDefault({ gridId: 'messageTable', diff --git a/organization/src/main/resources/template/tpl/companyDepartment/companyDepartmentAdd.html b/organization/src/main/resources/template/tpl/companyDepartment/companyDepartmentAdd.html index 191483c81..037cbf424 100644 --- a/organization/src/main/resources/template/tpl/companyDepartment/companyDepartmentAdd.html +++ b/organization/src/main/resources/template/tpl/companyDepartment/companyDepartmentAdd.html @@ -19,7 +19,7 @@