diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/TherapyCommonController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/TherapyCommonController.java index 8353f35..9cb6080 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/TherapyCommonController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/TherapyCommonController.java @@ -52,7 +52,7 @@ public class TherapyCommonController { @SaCheckLogin public Result unions(Boolean isPermission) { Cnd cnd = Cnd.NEW(); - cnd.asc("unionname"); + cnd.asc("unionCode"); if (Boolean.TRUE.equals(isPermission) && !TherapyContext.hasAnyRoles("sysadmin,A06")) { cnd.and("id", "=", TherapyContext.getUnionId()); } diff --git a/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java b/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java index 390f363..6dbf0a2 100644 --- a/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java +++ b/src/main/java/com/budwk/app/zhgh/staffbenefit/therapyRecuperation/controller/theRapyConfig/TheRapyRecuperationConfigController.java @@ -62,7 +62,13 @@ public class TheRapyRecuperationConfigController { @ViReturn @SaCheckLogin @Aop(TransAop.READ_COMMITTED) - public Object operation(TheRapyRecuperationConfig config, String[] lotDeleteList, String unionLineNumberConfigs) { + public Object operation(TheRapyRecuperationConfig config, String[] lotDeleteList, String unionLineNumberConfigs, String lots) { + if (Strings.isNotBlank(lots)) { + config.setLots(Json.fromJsonAsList(TheRapyRecuperationLot.class, lots)); + } + if (config.getLots() == null) { + config.setLots(new ArrayList<>()); + } // unionLineNumberConfigs 为前端分工会线路数量配置 JSON 数组,返回保存后的配置对象仍由 findOne 接口按实体结构回显。 config.setUnionLineNumberConfigs(Strings.isBlank(unionLineNumberConfigs) ? new ArrayList<>() @@ -76,7 +82,9 @@ public class TheRapyRecuperationConfigController { for (TheRapyRecuperationLot obj : collect) { obj.setConfigId(config.getId()); } - dao.insert(collect); + if (!collect.isEmpty()) { + dao.insert(collect); + } } else { dao.insertWith(config, "lots"); } diff --git a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/basics.js b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/basics.js index 46b436e..5ee7d25 100644 --- a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/basics.js +++ b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/basics.js @@ -105,11 +105,11 @@ const nation = [ '基诺族' ]; -const loc = () => { +function loc() { return location.href.replace(location.search, "").replace(location.hash, "") } -const clone = (obj) => { +function clone(obj) { return JSON.parse(JSON.stringify(obj)) } diff --git a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/compat.js b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/compat.js index 9c7f504..f222b3a 100644 --- a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/compat.js +++ b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/compat.js @@ -1,4 +1,7 @@ const sublime = { + jumpPagePjax(url) { + window.location.href = url; + }, showLoadingbar() { if (!document.getElementById('therapy-loading')) { const bar = document.createElement('div'); @@ -12,6 +15,77 @@ const sublime = { } }; +Vue.prototype.$validateForm = function(form) { + return new Promise(resolve => { + if (!form) { + this.$message.error('表单尚未加载完成'); + resolve(false); + return; + } + const uploading = component => { + if (Array.isArray(component.uploadFiles) && component.uploadFiles.some(file => file.status === 'uploading')) return true; + return (component.$children || []).some(uploading); + }; + if (uploading(form)) { + this.$message.warning('请等待图片或附件上传完成后再提交'); + resolve(false); + return; + } + form.validate((valid, fields) => { + if (!valid) { + const errors = Object.values(fields || {}).flat(); + this.$message.warning(errors.length ? errors[0].message : '请检查必填项和填写格式'); + } + resolve(valid); + }); + }); +}; + +Vue.prototype.$confirmAction = async function(...args) { + try { + return await this.$confirm(...args); + } catch (error) { + if (error === 'cancel' || error === 'close') return false; + throw error; + } +}; + +Vue.prototype.$actionError = function(error) { + if (error === 'cancel' || error === 'close') return; + const message = error && (error.responseJSON && error.responseJSON.msg || error.msg || error.message); + this.$message.error(message || '操作失败,请稍后重试'); +}; + +Vue.prototype.$downloadFile = function(url) { + window.location.href = url; +}; + +Vue.prototype.$importExcel = function(url, files) { + const data = new FormData(); + files.forEach(file => data.append('file', file.raw, file.raw.name)); + return $.ajax({url: url, type: 'POST', data: data, processData: false, contentType: false}); +}; + +Vue.directive('throttle', { + bind(el) { + let lastClick = 0; + el.therapyThrottleHandler = event => { + const now = Date.now(); + if (now - lastClick < 1000) { + event.preventDefault(); + event.stopImmediatePropagation(); + return; + } + lastClick = now; + }; + el.addEventListener('click', el.therapyThrottleHandler, true); + }, + unbind(el) { + el.removeEventListener('click', el.therapyThrottleHandler, true); + delete el.therapyThrottleHandler; + } +}); + $.ajaxSetup({ traditional: true, error(xhr) { diff --git a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/initTableMixins.js b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/initTableMixins.js index 1470857..505681a 100644 --- a/src/main/resources/static/assets/staffbenefit/therapyRecuperation/initTableMixins.js +++ b/src/main/resources/static/assets/staffbenefit/therapyRecuperation/initTableMixins.js @@ -54,7 +54,7 @@ const initTableMixins = { removeFile() } - if (size && !file.size < size) { + if (size && file.size > size) { this.notifyWarning(`文件大小不能超过 ${size / 1024 / 1024}MB!`) removeFile() } @@ -104,7 +104,10 @@ const initTableMixins = { } else { this.$message.error(data.msg); } - }, "json"); + }, "json").always(() => { + sublime.closeLoadingbar(); + this.tableLoading = false; + }); }, notifySuccess(msg) { this.$notify({ diff --git a/src/main/resources/static/components/plugins/sysTextEditor/index.vue b/src/main/resources/static/components/plugins/sysTextEditor/index.vue index 786fa09..fd34415 100644 --- a/src/main/resources/static/components/plugins/sysTextEditor/index.vue +++ b/src/main/resources/static/components/plugins/sysTextEditor/index.vue @@ -280,9 +280,11 @@ module.exports = { if (v.data && v.data.code === 0) { insertImgFn(v.data.data) } else { - this.$message.error("图片上传失败") + _this.$message.error(v.data && v.data.msg || "图片上传失败") } }) + }).catch(() => { + _this.$message.error("图片上传失败,请重试") }) } this.editor.config.pasteFilterStyle = false diff --git a/src/main/resources/static/components/staffbenefit/therapyRecuperation/DrawerUserScope.vue b/src/main/resources/static/components/staffbenefit/therapyRecuperation/DrawerUserScope.vue index a917f70..f43c782 100644 --- a/src/main/resources/static/components/staffbenefit/therapyRecuperation/DrawerUserScope.vue +++ b/src/main/resources/static/components/staffbenefit/therapyRecuperation/DrawerUserScope.vue @@ -1,12 +1,14 @@ diff --git a/src/main/resources/static/components/staffbenefit/therapyRecuperation/XghEnrollInfo.vue b/src/main/resources/static/components/staffbenefit/therapyRecuperation/XghEnrollInfo.vue index 3a07507..209d746 100644 --- a/src/main/resources/static/components/staffbenefit/therapyRecuperation/XghEnrollInfo.vue +++ b/src/main/resources/static/components/staffbenefit/therapyRecuperation/XghEnrollInfo.vue @@ -67,17 +67,17 @@ -