From 64853519b76fbdaff0a7c9da353820befea487f4 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Fri, 9 Sep 2022 15:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/js/layui/modules/custom/ajax.js | 36 +- .../assets/js/layui/util/layui-file-upload.js | 460 ++++++++---------- .../assets/js/layui/util/layui-input-tree.js | 106 ++-- 3 files changed, 269 insertions(+), 333 deletions(-) diff --git a/common/src/main/resources/static/assets/js/layui/modules/custom/ajax.js b/common/src/main/resources/static/assets/js/layui/modules/custom/ajax.js index b7090bf4..cb959fce 100644 --- a/common/src/main/resources/static/assets/js/layui/modules/custom/ajax.js +++ b/common/src/main/resources/static/assets/js/layui/modules/custom/ajax.js @@ -15,7 +15,7 @@ layui.define(function (exports) { function objToForm(obj) { let formStr = ''; for (let name in obj) { - if (formStr == undefined || formStr == null || formStr == '') { + if (!formStr) { formStr += name + '=' + obj[name]; } else { formStr += '&' + name + '=' + obj[name]; @@ -92,8 +92,8 @@ layui.define(function (exports) { * @param completeCallback */ function doAjax(url, method, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) { - let ajaxData = (dataObj == undefined || dataObj == null) ? {} : dataObj; - if (methods.POST_METHOD == method || methods.PUT_METHOD == method) { + let ajaxData = (!dataObj) ? {} : dataObj; + if (methods.POST_METHOD === method || methods.PUT_METHOD === method) { ajaxData = JSON.stringify(ajaxData); } else { ajaxData = objToForm(ajaxData); @@ -116,17 +116,17 @@ layui.define(function (exports) { error: function (XMLHttpRequest) { let responseCode = XMLHttpRequest.status; let responseData = JSON.parse(XMLHttpRequest.responseText); - if (errorCallback != undefined && errorCallback != null && typeof (errorCallback) == 'function') { + if (errorCallback && typeof (errorCallback) == 'function') { errorCallback(responseCode, responseData); } }, beforeSend: function (XMLHttpRequest) { - if (beforeCallback != undefined && beforeCallback != null && typeof (beforeCallback) == 'function') { + if (beforeCallback && typeof (beforeCallback) == 'function') { beforeCallback(XMLHttpRequest); } }, complete: function (XMLHttpRequest, status) { - if (completeCallback != undefined && completeCallback != null && typeof (completeCallback) == 'function') { + if (completeCallback && typeof (completeCallback) == 'function') { completeCallback(XMLHttpRequest, status); } } @@ -141,14 +141,14 @@ layui.define(function (exports) { function pathArgsHasSameValue(pathArgArray) { let tempArgIndex = 0; let tempArgs = pathArgArray[tempArgIndex]; - for (let i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) { - if (tempArgs == item) { + for (let i = (tempArgIndex + 1); i < pathArgArray.length; i++) { + let item = pathArgArray[i]; + if (tempArgs === item) { throw new Error('参数' + item + '有重复值!!!'); } - if (i == pathArgArray.length - 1) { + if (i === pathArgArray.length - 1) { tempArgs = pathArgArray[++tempArgIndex]; i = tempArgIndex; - continue; } } } @@ -164,9 +164,10 @@ layui.define(function (exports) { return paramsObj; } let paramsKVs = params.split('&'); - for (let i = 0, item = null; item = paramsKVs[i++];) { + for (let i = 0; i < paramsKVs.length; i++) { + let item = paramsKVs[i]; let kvs = item.split('='); - if (kvs.length == 1) { + if (kvs.length === 1) { paramsObj[kvs[0]] = null; continue; } @@ -194,7 +195,8 @@ layui.define(function (exports) { return path; } pathArgsHasSameValue(pathArgArray); - for (let i = 0, item; item = pathArgArray[i]; i++) { + for (let i = 0; i < pathArgArray.length; i++) { + let item = pathArgArray[i]; path = path.replace(item, pathArgs[i]); } return path; @@ -225,17 +227,17 @@ layui.define(function (exports) { error: function (XMLHttpRequest) { let responseCode = XMLHttpRequest.status; let responseData = JSON.parse(XMLHttpRequest.responseText); - if (errorCallback != undefined && errorCallback != null && typeof (errorCallback) == 'function') { + if (errorCallback && typeof (errorCallback) == 'function') { errorCallback(responseCode, responseData); } }, beforeSend: function (XMLHttpRequest) { - if (beforeCallback != undefined && beforeCallback != null && typeof (beforeCallback) == 'function') { + if (beforeCallback && typeof (beforeCallback) == 'function') { beforeCallback(XMLHttpRequest); } }, complete: function (XMLHttpRequest, status) { - if (completeCallback != undefined && completeCallback != null && typeof (completeCallback) == 'function') { + if (completeCallback && typeof (completeCallback) == 'function') { completeCallback(XMLHttpRequest, status); } } @@ -256,7 +258,7 @@ layui.define(function (exports) { function checkBoxToString(formObj, checkBoxKey) { let value = ''; for (let key in formObj) { - if (key.indexOf(checkBoxKey) != 0) { + if (key.indexOf(checkBoxKey) !== 0) { continue; } if (value !== '') { diff --git a/common/src/main/resources/static/assets/js/layui/util/layui-file-upload.js b/common/src/main/resources/static/assets/js/layui/util/layui-file-upload.js index d381ae71..62581b8d 100644 --- a/common/src/main/resources/static/assets/js/layui/util/layui-file-upload.js +++ b/common/src/main/resources/static/assets/js/layui/util/layui-file-upload.js @@ -2,8 +2,10 @@ function LayuiFileUpload(layui, viewer) { let $ = layui.$; let form = layui.form; let upload = layui.upload; + if (!upload) { + throw new Error('需要引入layui的upload模块'); + } let ajax = top.restAjax || top.ajax; - let dialog = top.dialog; let Viewer = viewer; let viewerObj = {}; let style = ` @@ -31,12 +33,12 @@ function LayuiFileUpload(layui, viewer) { $(document.head).append(style); /** - * 初始化图片上传 + * 获取配置 * @param opt + * @return {{headers: *, fieldName: *, uploadBtnId: string, deleteBtnClass: string, fileBoxId: string, isApp: (*|boolean), id: string, isAppRelease: (*|boolean), maxCount: (number|*), isShow: (*|boolean)}} */ - function initUploadImage(opt) { - let maxCount = opt.maxCount ? parseInt(opt.maxCount) : 9 - maxCount = opt.maxCount < 0 ? 9 : opt.maxCount; + function getOptData(opt) { + let maxCount = !opt.maxCount || opt.maxCount < 0 ? 9 : opt.maxCount; let fieldName = opt.fieldName; let headers = opt.headers; headers = headers ? headers : {}; @@ -44,73 +46,106 @@ function LayuiFileUpload(layui, viewer) { let isAppRelease = opt.isAppRelease; let isShow = opt.isShow; - let id = '#' + fieldName; - let fileBoxId = id + 'FileBox'; - let uploadBtnId = id + 'UploadBtn'; + let id = `#${fieldName}`; + let fileBoxId = `${id}FileBox`; + let uploadBtnId = `${id}UploadBtn`; let deleteBtnClass = `.delete-${fieldName}-btn`; + return { + maxCount: maxCount, + fieldName: fieldName, + headers: headers, + isApp: isApp, + isAppRelease: isAppRelease, + isShow: isShow, + id: id, + fileBoxId: fileBoxId, + uploadBtnId: uploadBtnId, + deleteBtnClass: deleteBtnClass + } + } + + /** + * 渲染 + * @param optData + * @param fileArray + * @param html + */ + function render(optData, fileArray, html) { + $(optData.fileBoxId).empty(); + $(optData.fileBoxId).append(html); + + if (fileArray.length < optData.maxCount) { + $(optData.uploadBtnId).removeClass('layui-btn-disabled'); + $(optData.uploadBtnId).attr('disabled', false); + } else { + $(optData.uploadBtnId).addClass('layui-btn-disabled'); + $(optData.uploadBtnId).attr('disabled', true); + } + } + + /** + * 初始化图片上传 + * @param opt + */ + function initUploadImage(opt) { + let optData = getOptData(opt); function init(callback) { - let fileIds = $(id).val(); - let fileIdArray = fileIds ? fileIds.split(',') : []; + let fileIds = $(optData.id).val(); + let fileArray = fileIds ? fileIds.split(',') : []; let html = ''; - for (let i = 0, fileId; fileId = fileIdArray[i++];) { + for (let i = 0; i < fileArray.length; i++) { + let fileId = fileArray[i]; html += `
- +
`; } - - $(fileBoxId).empty(); - $(fileBoxId).append(html); - - if (fileIdArray.length < maxCount) { - $(uploadBtnId).removeClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', false); - } else { - $(uploadBtnId).addClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', true); - } - + render(optData, fileArray, html); callback ? callback() : ''; } function addClick() { let layerLoadingIndex; let url = 'api/file/v2/upload-image'; - if (isApp) { + if (optData.isApp) { url = 'app/file/v2/upload-image' } - if (isAppRelease) { + if (optData.isAppRelease) { url = 'app/file/v2/upload-image-release' } upload.render({ - elem: uploadBtnId, + elem: optData.uploadBtnId, url: url, accept: 'images', acceptMime: 'image/*', field: 'image', exts: 'jpg|png|gif|bmp|jpeg', - name: fieldName, - headers: headers, + name: optData.fieldName, + headers: optData.headers, before: function (obj) { layerLoadingIndex = layer.msg('上传中...', {icon: 16, time: 0, shade: 0.3}) }, done: function (res, index, upload) { layer.close(layerLoadingIndex); let name = this.name; - let files = $('#' + this.name).val(); + let dom = $(`#${name}`); + let files = dom.val(); + files = files ? files : ''; if (files.length > 0) { files += ','; } files += res.data.fileId; - $('#' + name).val(files); + dom.val(files); init(function () { - viewerObj[name].update(); + if (Viewer) { + viewerObj[name].update(); + } }); }, error: function (index, upload) { @@ -118,40 +153,39 @@ function LayuiFileUpload(layui, viewer) { layer.msg('文件上传失败'); }, progress: function (n, elem, res, index) { - let percent = n + '%' - console.log(percent); - console.log(elem); - console.log(res); - console.log(index); - // element.progress('demo-' + index, n + '%'); } }); - $(document).on('click', deleteBtnClass, function () { + $(document).on('click', optData.deleteBtnClass, function () { let name = this.dataset.name; let id = this.dataset.id; - let files = $('#' + name).val().replace(id, ''); + let dom = $(`#${name}`); + let files = dom.val().replace(id, ''); files = files.replace(/\,+/g, ','); - if (files.charAt(0) == ',') { + if (files.charAt(0) === ',') { files = files.substring(1); } - if (files.charAt(files.length - 1) == ',') { + if (files.charAt(files.length - 1) === ',') { files = files.substring(0, files.length - 1); } - $('#' + name).val(files); + dom.val(files); init(function () { - viewerObj[name].update(); + if (Viewer) { + viewerObj[name].update(); + } }); }); } init(function () { - viewerObj[fieldName] = new Viewer(document.getElementById(fieldName + 'FileBox'), {navbar: false}); + if (Viewer) { + viewerObj[optData.fieldName] = new Viewer(document.getElementById(optData.fieldName + 'FileBox'), {navbar: false}); + } }); - if (!isShow) { + if (!optData.isShow) { addClick(); } else { - $(uploadBtnId).hide(); + $(optData.uploadBtnId).hide(); } } @@ -224,84 +258,64 @@ function LayuiFileUpload(layui, viewer) { * @param opt */ function initUploadFile(opt) { - let maxCount = opt.maxCount ? parseInt(opt.maxCount) : 3 - maxCount = opt.maxCount < 0 ? 3 : opt.maxCount; - let fieldName = opt.fieldName; - let headers = opt.headers; - headers = headers ? headers : {}; - let isApp = opt.isApp; - let isAppRelease = opt.isAppRelease; - let isShow = opt.isShow; - - let id = '#' + fieldName; - let fileBoxId = id + 'FileBox'; - let uploadBtnId = id + 'UploadBtn'; - let deleteBtnClass = '.delete-' + fieldName + '-btn'; + let optData = getOptData(opt); function init() { - let files = $(id).val(); + let files = $(optData.id).val(); let fileArray = files ? files.split(',') : []; let html = ''; if (fileArray.length > 0) { - html += [ - '
', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ].join(''); - for (let i = 0, file; file = fileArray[i++];) { + let trs = ''; + for (let i = 0; i < fileArray.length; i++) { + let file = fileArray[i]; let idNameArray = file.split(':'); let fileId = idNameArray[0]; let fileName = idNameArray[1]; - html += [ - '', - ' ', - ' ', - '', - ].join(''); + trs += ` + + + + + ` } - html += [ - ' ', - '
文件名操作
' + fileName + '', - ' ', - '
${fileName} + +
', - '
' - ].join(''); + html += ` +
+ + + + + + + + + + + + + ${trs} + +
文件名操作
+
+ `; } - $(fileBoxId).empty(); - $(fileBoxId).append(html); - - if (fileArray.length < maxCount) { - $(uploadBtnId).removeClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', false); - } else { - $(uploadBtnId).addClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', true); - } + render(optData, fileArray, html); } function addClick() { let layerLoadingIndex; let url = 'api/file/v2/upload-file'; - if (isApp) { + if (optData.isApp) { url = 'app/file/v2/upload-file' } - if (isAppRelease) { + if (optData.isAppRelease) { url = 'app/file/v2/upload-file-release' } upload.render({ - elem: uploadBtnId, + elem: optData.uploadBtnId, url: url, accept: 'file', acceptMime: [ @@ -319,50 +333,53 @@ function LayuiFileUpload(layui, viewer) { ].join(','), field: 'file', exts: 'pdf|doc|docx|xls|xlsx|ppt|pptx|wps|txt|rar|zip', - name: fieldName, - headers: headers, + name: optData.fieldName, + headers: optData.headers, before: function (obj) { layerLoadingIndex = layer.msg('上传中...', {icon: 16, time: 0, shade: 0.3}) }, done: function (res, index, upload) { layer.close(layerLoadingIndex); let name = this.name; - let files = $('#' + this.name).val(); + let dom = $(`#${name}`); + let files = dom.val(); if (files.length > 0) { files += ','; } files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ','); - $('#' + name).val(files); + dom.val(files); init(); }, error: function (index, upload) { layer.close(layerLoadingIndex); layer.msg('文件上传失败'); }, - progress: function (n, elem, res, index) {} + progress: function (n, elem, res, index) { + } }); - $(document).on('click', deleteBtnClass, function () { + $(document).on('click', optData.deleteBtnClass, function () { let id = this.dataset.id; let name = this.dataset.name; let fieldName = this.dataset.fieldName; - let files = $('#' + fieldName).val().replace(id + ':' + name, ''); + let dom = $(`#${fieldName}`).val(); + let files = dom.val().replace(id + ':' + name, ''); files = files.replace(/\,+/g, ','); - if (files.charAt(0) == ',') { + if (files.charAt(0) === ',') { files = files.substring(1); } - if (files.charAt(files.length - 1) == ',') { + if (files.charAt(files.length - 1) === ',') { files = files.substring(0, files.length - 1); } - $('#' + fieldName).val(files); + dom.val(files); init(); }); } init(); - if (!isShow) { + if (!optData.isShow) { addClick(); } else { - $(uploadBtnId).hide(); + $(optData.uploadBtnId).hide(); } } @@ -436,114 +453,97 @@ function LayuiFileUpload(layui, viewer) { * @param opt */ function initUploadVideo(opt) { - let maxCount = opt.maxCount ? parseInt(opt.maxCount) : 1 - maxCount = opt.maxCount < 0 ? 1 : opt.maxCount; - let fieldName = opt.fieldName; - let headers = opt.headers; - headers = headers ? headers : {}; - let isApp = opt.isApp; - let isAppRelease = opt.isAppRelease; - let isShow = opt.isShow; - - let id = '#' + fieldName; - let fileBoxId = id + 'FileBox'; - let uploadBtnId = id + 'UploadBtn'; - let deleteBtnClass = '.delete-' + fieldName + '-btn'; + let optData = getOptData(opt); function init() { let files = $(id).val(); let fileArray = files ? files.split(',') : []; let html = ''; - for (let i = 0, file; file = fileArray[i++];) { + for (let i = 0; i < fileArray.length; i++) { + let file = fileArray[i]; let idNameArray = file.split(':'); let fileId = idNameArray[0]; let fileName = idNameArray[1]; - html += [ - '
', - ' ', - ' ', - ' ', - ' ', - '
', - ].join(''); + html += ` +
+ + + + +
+ `; } - $(fileBoxId).empty(); - $(fileBoxId).append(html); - - if (fileArray.length < maxCount) { - $(uploadBtnId).removeClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', false); - } else { - $(uploadBtnId).addClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', true); - } + render(optData, fileArray, html) } function addClick() { let layerLoadingIndex; let url = 'api/file/v2/upload-video'; - if (isApp) { + if (optData.isApp) { url = 'app/file/v2/upload-video' } - if (isAppRelease) { + if (optData.isAppRelease) { url = 'app/file/v2/upload-video-release' } upload.render({ - elem: uploadBtnId, + elem: optData.uploadBtnId, url: url, accept: 'video', acceptMime: 'video/mp4', exts: 'mp4', field: 'video', - name: fieldName, - headers: headers, + name: optData.fieldName, + headers: optData.headers, before: function (obj) { layerLoadingIndex = layer.msg('上传中...', {icon: 16, time: 0, shade: 0.3}) }, done: function (res, index, upload) { layer.close(layerLoadingIndex); let name = this.name; - let files = $('#' + this.name).val(); + let dom = $(`#${name}`); + let files = dom.val(); if (files.length > 0) { files += ','; } files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ','); - $('#' + name).val(files); + dom.val(files); init(); }, error: function (index, upload) { layer.close(layerLoadingIndex); layer.msg('文件上传失败'); }, - progress: function (n, elem, res, index) {} + progress: function (n, elem, res, index) { + } }); - $(document).on('click', deleteBtnClass, function () { + $(document).on('click', optData.deleteBtnClass, function () { let name = this.dataset.name; let id = this.dataset.id; let fieldName = this.dataset.fieldName; - let files = $('#' + fieldName).val().replace(id + ':' + name, ''); + let dom = $(`#${fieldName}`); + let files = dom.val().replace(id + ':' + name, ''); files = files.replace(/\,+/g, ','); - if (files.charAt(0) == ',') { + if (files.charAt(0) === ',') { files = files.substring(1); } - if (files.charAt(files.length - 1) == ',') { + if (files.charAt(files.length - 1) === ',') { files = files.substring(0, files.length - 1); } - $('#' + fieldName).val(files); + dom.val(files); init(); }); } init(); - if (!isShow) { + if (!optData.isShow) { addClick(); } else { - $(uploadBtnId).hide(); + $(optData.uploadBtnId).hide(); } } @@ -612,63 +612,43 @@ function LayuiFileUpload(layui, viewer) { } function initUploadAudio(opt) { - let maxCount = opt.maxCount ? parseInt(opt.maxCount) : 1 - maxCount = opt.maxCount < 0 ? 1 : opt.maxCount; - let fieldName = opt.fieldName; - let headers = opt.headers; - headers = headers ? headers : {}; - let isApp = opt.isApp; - let isAppRelease = opt.isAppRelease; - let isShow = opt.isShow; - - let id = '#' + fieldName; - let fileBoxId = id + 'FileBox'; - let uploadBtnId = id + 'UploadBtn'; - let deleteBtnClass = '.delete-' + fieldName + '-btn'; + let optData = getOptData(opt); function init() { let files = $(id).val(); let fileArray = files ? files.split(',') : []; let html = ''; - for (let i = 0, file; file = fileArray[i++];) { + for (let i = 0; i < fileArray.length; i++) { + let file = fileArray[i]; let idNameArray = file.split(':'); let fileId = idNameArray[0]; let fileName = idNameArray[1]; - html += [ - '
', - ' ', - ' ', - ' ', - ' ', - '
', - ].join(''); + html += ` +
+ + + + +
+ `; } - $(fileBoxId).empty(); - $(fileBoxId).append(html); - - if (fileArray.length < maxCount) { - $(uploadBtnId).removeClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', false); - } else { - $(uploadBtnId).addClass('layui-btn-disabled'); - $(uploadBtnId).attr('disabled', true); - } + render(optData, fileArray, html); } function addClick() { let layerLoadingIndex; let url = 'api/file/v2/upload-audio'; - if (isApp) { + if (optData.isApp) { url = 'app/file/v2/upload-audio' } - if (isAppRelease) { + if (optData.isAppRelease) { url = 'app/file/v2/upload-audio-release' } upload.render({ - elem: uploadBtnId, + elem: optData.uploadBtnId, url: url, accept: 'audio', acceptMime: [ @@ -677,51 +657,54 @@ function LayuiFileUpload(layui, viewer) { ], exts: 'wav|mp3', field: 'audio', - name: fieldName, - headers: headers, + name: optData.fieldName, + headers: optData.headers, before: function (obj) { layerLoadingIndex = layer.msg('上传中...', {icon: 16, time: 0, shade: 0.3}) }, done: function (res, index, upload) { layer.close(layerLoadingIndex); let name = this.name; - let files = $('#' + this.name).val(); + let dom = $(`#${name}`); + let files = dom.val(); if (files.length > 0) { files += ','; } files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ','); - $('#' + name).val(files); + dom.val(files); init(); }, error: function (index, upload) { layer.close(layerLoadingIndex); layer.msg('文件上传失败'); }, - progress: function (n, elem, res, index) {} + progress: function (n, elem, res, index) { + } }); - $(document).on('click', deleteBtnClass, function () { + $(document).on('click', optData.deleteBtnClass, function () { let name = this.dataset.name; let id = this.dataset.id; let fieldName = this.dataset.fieldName; - let files = $('#' + fieldName).val().replace(id + ':' + name, ''); + let dom = $(`#${fieldName}`) + let files = dom.val().replace(id + ':' + name, ''); files = files.replace(/\,+/g, ','); - if (files.charAt(0) == ',') { + if (files.charAt(0) === ',') { files = files.substring(1); } - if (files.charAt(files.length - 1) == ',') { + if (files.charAt(files.length - 1) === ',') { files = files.substring(0, files.length - 1); } - $('#' + fieldName).val(files); + dom.val(files); init(); }); } init(); - if (!isShow) { + if (!optData.isShow) { addClick(); } else { - $(uploadBtnId).hide(); + $(optData.uploadBtnId).hide(); } } @@ -789,55 +772,6 @@ function LayuiFileUpload(layui, viewer) { }); } - /** - * 初始化日期 - * @param opt - */ - this.initDate = function (opt) { - laydate.render({ - elem: '#' + opt.id, - type: opt.datetype, - format: opt.dateformat, - value: opt.dateDefaultValue, - min: opt.dataMinValue, - max: opt.dataMaxValue, - trigger: 'click' - }); - } - - /** - * 初始化checkbox数据 - * @param form - * @param checkedData - * @param id - */ - this.initCheckboxData = function (formName, checkedData, id) { - let dataArray = checkedData.split(','); - let obj = {}; - for (let i = 0, data; data = dataArray[i++];) { - obj[id + '[' + data + ']'] = true; - } - form.val(formName, obj); - } - - /** - * 设置复选框值 - * @param formData - * @param id - */ - this.setCheckboxValue = function (formData, id) { - formData.field[id] = ajax.checkBoxToString(formData.field, id); - } - - /** - * 设置开关值 - * @param formData - * @param id - */ - this.setSwitchValue = function (formData, id) { - formData.field[id] = formData.field[id] ? 1 : 0; - } - /** * 清空上传字段 * @param formData diff --git a/common/src/main/resources/static/assets/js/layui/util/layui-input-tree.js b/common/src/main/resources/static/assets/js/layui/util/layui-input-tree.js index a49f3cbe..d5a6761e 100644 --- a/common/src/main/resources/static/assets/js/layui/util/layui-input-tree.js +++ b/common/src/main/resources/static/assets/js/layui/util/layui-input-tree.js @@ -1,11 +1,11 @@ function LayuiInputTree(layui) { - var $ = layui.$; - var layer = layui.layer; - var ztree = layui.ztree; - var restAjax = layui.restajax; - var zIndex = 10000; + let $ = layui.$; + let layer = layui.layer; + let ztree = layui.ztree; + let restAjax = layui.restajax; + let zIndex = 10000; // 样式 - var style = ` + let style = `