diff --git a/javascript/common/Utils.js b/javascript/common/Utils.js index 700864e..75aa117 100644 --- a/javascript/common/Utils.js +++ b/javascript/common/Utils.js @@ -135,7 +135,15 @@ window.Utils = { */ getFiledValueByName: function (fieldName, rowIndex) { return WfForm.getFieldValue(Utils.convertNameObjToId(fieldName) + rowIndex ? '_' + rowIndex : '') + }, + + /** + * 通过字段名称修改字段值 + * @param fieldName 字段名称 + * @param value 值 + */ + changeFieldValueByName: function (fieldName, value) { + WfForm.changeFieldValue(Utils.convertNameObjToId(fieldName), {value}) } - } diff --git a/javascript/common/dev.js b/javascript/common/dev.js index 3956a6f..0ceb3ed 100644 --- a/javascript/common/dev.js +++ b/javascript/common/dev.js @@ -134,5 +134,20 @@ WfForm.changeFieldValue = function (fieldMark, valueInfo) { } +/* ******************* 建模表开发依赖 ******************* */ + +const ModeList = {} +ModeList.dataLoadAfter = function (data) { + // 描述:在列表数据加载完,对列表的数据进行二次加工,并渲染。 dataLoadAfter传入dataHandle方法,用来接收并处理数据,dataHandle有两个参数。 + // var dataHandle = function(datas,displayType){ + // //Changes to 'datas' do not directly modify the real database data, but modify the data received at the front end. + // var newDatas = datas; + // if(displayType == 'normal'){ + // console.log(newDatas); + // } + // return newDatas; + // } + // ModeList.dataLoadAfter(dataHandle); +}; diff --git a/javascript/youhong.ai/fentian/ecode/workflow_controller.js b/javascript/youhong.ai/fentian/ecode/workflow_controller.js index 1279b85..3205701 100644 --- a/javascript/youhong.ai/fentian/ecode/workflow_controller.js +++ b/javascript/youhong.ai/fentian/ecode/workflow_controller.js @@ -4,7 +4,6 @@ class ConfigWorkflowTitle { constructor(config) { this.config = config - console.log(config) } @@ -12,17 +11,14 @@ class ConfigWorkflowTitle { * 初始化参数 */ init = () => { - console.log("init") let baseInfo = WfForm.getBaseInfo(); if (baseInfo.workflowid != this.config.workflowId) { return } let filedArr = [] - console.log("jahh") this.config.rules.filter(item => item.type === RulesType.FIELD_VALUE || item.type === RulesType.SELECT_VALUE || item.type === RulesType.RADIO_VALUE).forEach(item => filedArr.push(item.fieldName)) - console.log("bind", filedArr) this.addListenerEvent(filedArr) } diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js index 2eab958..928b1ee 100644 --- a/javascript/youhong.ai/pcn/workflow_code_block.js +++ b/javascript/youhong.ai/pcn/workflow_code_block.js @@ -1,133 +1,232 @@ /* ******************* 保时捷target setting流程提交控制 start ******************* */ -/** - * @author youhong.ai - * @desc 禁止点击提交按钮 - */ -function doNotClickSubmit() { - let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]') - if (submitButton.length === 0) { - submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]') - } - if (submitButton.length === 0) { - submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']") - } - if (submitButton.length !== 0) { - let buttonReact = window.Utils.findReact(submitButton[0]) - let rightBtn = Utils.findReact($(".ant-menu-item.text-elli[ecid='_Route@vmt0lk_Comp@upn4fo_WeaRightMenu@1ok9r0_Item@eu37n0_li@zyccqn']")[0]) - setTimeout(() => { - buttonReact.props.disabled = true +window.workflowCus = Object.assign(window.workflowCus ? window.workflowCus : {}, { + /** + * @author youhong.ai + * @desc 禁止点击提交按钮 + */ + doNotClickSubmit: function () { + let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]') + if (submitButton.length === 0) { + submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]') + } + if (submitButton.length === 0) { + submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']") + } + if (submitButton.length !== 0) { + let buttonReact = window.Utils.findReact(submitButton[0]) + let rightBtn = Utils.findReact($(".ant-menu-item.text-elli[ecid='_Route@vmt0lk_Comp@upn4fo_WeaRightMenu@1ok9r0_Item@eu37n0_li@zyccqn']")[0]) + setTimeout(() => { + buttonReact.props.disabled = true + buttonReact.setState({}) + rightBtn.props.disabled = true + rightBtn.setState({}) + }, 100) + } + }, + + /** + * @author youhong.ai + * @desc 允许点击按钮 + */ + allowClickSubmit: function () { + let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]') + if (submitButton.length === 0) { + submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]') + } + if (submitButton.length === 0) { + submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']") + } + if (submitButton.length !== 0) { + WfForm.controlBtnDisabled(false) + let buttonReact = window.Utils.findReact(submitButton[0]) + buttonReact.props.disabled = false buttonReact.setState({}) - rightBtn.props.disabled = true - rightBtn.setState({}) - }, 100) - } -} + } + }, -/** - * @author youhong.ai - * @desc 允许点击按钮 - */ -function allowClickSubmit() { - let submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="Submit "]') - if (submitButton.length === 0) { - submitButton = $('.ant-btn.ant-btn-primary[ecid="_Route@vmt0lk_Comp@upn4fo_Button@2oxqe7@0_button@xq1ea3"][title="提交"]') - } - if (submitButton.length === 0) { - submitButton = $("#weareqtop_9v5e5i_1670481049632 div.ant-row.wea-new-top-req div.ant-col-xs-18.ant-col-sm-18.ant-col-md-16.ant-col-lg-14 button[title='提交'],[title='Submit '],[title='Submit']") - } - if (submitButton.length !== 0) { - WfForm.controlBtnDisabled(false) - let buttonReact = window.Utils.findReact(submitButton[0]) - buttonReact.props.disabled = false - buttonReact.setState({}) - } -} - -/** - * 监听qzhj字段值改变 - * @author youhong.ai - * @param id 字段id - * @param value 字段值 - * @param obj 字段值对象 - */ -function onQzhjFieldChangeValue(obj, id, value) { - if (value != '100') { - doNotClickSubmit() - } else { - allowClickSubmit() - } -} - -/** - * 检查qzhj字段值 - * @author youhong.ai - * @param fieldId qzhj字段id - */ -function checkOnQzhJfiedlChangeValue(fieldId) { - let value = WfForm.getFieldValue(fieldId); - onQzhjFieldChangeValue(null, null, value) -} - - -/** - * 检查提交按钮是否符合条件 - * @author youhong.ai - * @param fieldId 字段id - * @returns {(function(function()=): void)|*} - */ -function checkClickSubmit(fieldId) { - return (callback = () => { - }) => { - let value = WfForm.getFieldValue(fieldId); - if (value != 100) { - WfForm.showMessage("~`~`7 目标设定的总值必须是100%,请检查并修改后提交。 " + "`~`8 The total value of target setting must be 100%,please check to submit after modification! " + "`~`9 目标设定的总值必须是100%,请检查并修改后提交。`~`~", 2, 5); + /** + * 监听qzhj字段值改变 + * @author youhong.ai + * @param id 字段id + * @param value 字段值 + * @param obj 字段值对象 + */ + onQzhjFieldChangeValue: function (obj, id, value) { + if (value != '100') { + window.workflowCus.doNotClickSubmit() } else { - callback() + window.workflowCus.allowClickSubmit() } - } -} + }, -/** - * 保存按钮触发流程转数据 - * @author youhong.ai - * @param callback 保存后页面跳转前回调 - */ -async function saveTriggerWorkflowToModel() { - let baseInfo = WfForm.getBaseInfo() - if (baseInfo && baseInfo.requestid != '-1') { - let result = await Utils.api({ - url: "/api/aiyh/workflow/target-setting/save-trigger", - type: "POST", - contentType: "application/json", - data: JSON.stringify({requestId: baseInfo.requestid}) - }) - if (result && result.code === 200) { - localStorage.setItem("saveTriggerWorkflowToModel", "false") + /** + * 检查qzhj字段值 + * @author youhong.ai + * @param fieldId qzhj字段id + */ + checkOnQzhJfiedlChangeValue: function (fieldId) { + let value = WfForm.getFieldValue(fieldId); + window.workflowCus.onQzhjFieldChangeValue(null, null, value) + }, + + + /** + * 检查提交按钮是否符合条件 + * @author youhong.ai + * @param fieldId 字段id + * @returns {(function(function()=): void)|*} + */ + checkClickSubmit: function (fieldId) { + return (callback = () => { + }) => { + let value = WfForm.getFieldValue(fieldId); + if (value != 100) { + WfForm.showMessage("~`~`7 目标设定的总值必须是100%,请检查并修改后提交。 " + "`~`8 The total value of target setting must be 100%,please check to submit after modification! " + "`~`9 目标设定的总值必须是100%,请检查并修改后提交。`~`~", 2, 5); + } else { + callback() + } } + }, + + /** + * 保存按钮触发流程转数据 + * @author youhong.ai + */ + saveTriggerWorkflowToModel: async function () { + let baseInfo = WfForm.getBaseInfo() + if (baseInfo && baseInfo.requestid != '-1') { + let result = await Utils.api({ + url: "/api/aiyh/workflow/target-setting/save-trigger", + type: "POST", + contentType: "application/json", + data: JSON.stringify({ + requestId: baseInfo.requestid, + nodeId: baseInfo.nodeid, + isBill: baseInfo.isbill, + formId: baseInfo.formid, + workflowId: baseInfo.workflowid + }) + }) + if (result && result.code === 200) { + localStorage.setItem("saveTriggerWorkflowToModel", "false") + } + } + }, + + + saveAfterCallback: function (callback) { + localStorage.setItem("saveTriggerWorkflowToModel", "true") + callback() } -} +}) -function saveAfterCallback(callback) { - localStorage.setItem("saveTriggerWorkflowToModel", "true") - callback() -} - +/* ******************* 保时捷target setting流程提交控制 end ******************* */ +/* ******************* 保时捷target setting流程提交控制 start ******************* */ $(() => { let qzhjFieldId = WfForm.convertFieldNameToId("qzhj") - checkOnQzhJfiedlChangeValue(qzhjFieldId) - WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, checkClickSubmit(qzhjFieldId)) - WfForm.registerCheckEvent(WfForm.OPER_SAVECOMPLETE, saveAfterCallback) - WfForm.bindFieldChangeEvent(qzhjFieldId, onQzhjFieldChangeValue) + window.workflowCus.checkOnQzhJfiedlChangeValue(qzhjFieldId) + WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, window.workflowCus.checkClickSubmit(qzhjFieldId)) + WfForm.registerCheckEvent(WfForm.OPER_SAVECOMPLETE, window.workflowCus.saveAfterCallback) + WfForm.bindFieldChangeEvent(qzhjFieldId, window.workflowCus.onQzhjFieldChangeValue) let flag = localStorage.getItem("saveTriggerWorkflowToModel") if (flag === "true") { - saveTriggerWorkflowToModel() + window.workflowCus.saveTriggerWorkflowToModel() } }) /* ******************* 保时捷target setting流程提交控制 end ******************* */ +/* ******************* 保时捷个人目标台账查询target setting按钮默认置灰色 ******************* */ +window.workflowCus = Object.assign(window.workflowCus ? window.workflowCus : {}, { + + notAllowedTargetSetting: function () { + window.workflowCus.changeBtnDisabledValue(true) + }, + + changeBtnDisabledValue: function (disable) { + if ($(".ant-btn.ant-btn-primary[ecid='_Route@9uoqid_Com@knmejd_ButtonNew@813let@0_Button@tegwjx_button@xq1ea3']").length === 0) { + return + } + let button = Utils.findReact($(".ant-btn.ant-btn-primary[ecid='_Route@9uoqid_Com@knmejd_ButtonNew@813let@0_Button@tegwjx_button@xq1ea3']")[0]) + if (button) { + button.props.disabled = disable + button.setState({}) + } + }, + + allowedTargetSettingBtnClick: function () { + window.workflowCus.changeBtnDisabledValue(false) + }, + + queryTotalWeight: function () { + Utils.api({ + url: "/api/ayh/target-setting/btn/can-allowed" + }).then(res => { + if (res && res.code === 200) { + if (res.data) { + window.workflowCus.allowedTargetSettingBtnClick() + } else { + window.workflowCus.notAllowedTargetSetting() + } + } + }).catch(error => { + console.log(err) + }) + }, + + reRender: function () { + const dataHandle = function (datas, displayType) { + window.workflowCus.notAllowedTargetSetting() + //Changes to 'datas' do not directly modify the real database data, but modify the data received at the front end. + $(() => { + window.workflowCus.queryTotalWeight() + }) + return datas + + } + ModeList.dataLoadAfter(dataHandle) + } + +}) + +$(() => { + window.workflowCus.notAllowedTargetSetting() + setTimeout(() => { + window.workflowCus.notAllowedTargetSetting() + }, 10) + window.workflowCus.reRender() +}) +/* ******************* 保时捷个人目标台账查询target setting按钮默认置灰色 END ******************* */ +/* ******************* apa流程通过apa分数字段带出level字段 ******************* */ + +window.workflowCus = Object.assign(window.workflowCus ? window.workflowCus : {}, { + getLevelByScore: async function (config) { + let scoreFiled = config.scoreFiled + let score = Utils.getFiledValueByName(scoreFiled); + let result = await Utils.api({ + url: "/api/ayh/workflow/apa/level", + data: { + score + } + }) + if (result && result.code === 200) { + Utils.changeFieldValueByName(config.levelField, result.data) + } + } +}) + +$(() => { + let config = { + scoreFiled: "", + levelField: "" + } + window.workflowCus.getLevelByScore(config) +}) + + +/* ******************* apa流程通过apa分数字段带出level字段eng ******************* */ diff --git a/src/main/java/aiyh/utils/LabelHtmlUtils.java b/src/main/java/aiyh/utils/LabelHtmlUtils.java index a74186d..ed5759b 100644 --- a/src/main/java/aiyh/utils/LabelHtmlUtils.java +++ b/src/main/java/aiyh/utils/LabelHtmlUtils.java @@ -10,9 +10,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * @author EBU7-dev1-ayh - * create 2021/12/13 0013 10:29 - * 多语言工具类 + *
create: 2022-12-12 15:36
+ * + * @author youHong.ai + */ + +@Path("/ayh/target-setting/btn") +public class NotAllowedClickTGSController { + + private final NotAllowedClickTGSService service = new NotAllowedClickTGSService(); + + @Path("/can-allowed") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String canAllowedClickTGSBtn(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + try { + return ApiResult.success(service.canAllowedClickTGSBtn(user)); + } catch (Exception e) { + Util.getLogger().error("get can allowed click target setting button error!\n" + Util.getErrString(e)); + return ApiResult.error("system error!"); + } + + } + +} diff --git a/src/main/java/com/api/youhong/ai/pcn/workflow/doworkflowtomodel/mapper/NotAllowedClickTGSMapper.java b/src/main/java/com/api/youhong/ai/pcn/workflow/doworkflowtomodel/mapper/NotAllowedClickTGSMapper.java new file mode 100644 index 0000000..e5b2594 --- /dev/null +++ b/src/main/java/com/api/youhong/ai/pcn/workflow/doworkflowtomodel/mapper/NotAllowedClickTGSMapper.java @@ -0,0 +1,46 @@ +package com.api.youhong.ai.pcn.workflow.doworkflowtomodel.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.List; + +/** + * + * + *create: 2022-12-12 15:56
+ * + * @author youHong.ai + */ + +@SqlMapper +public interface NotAllowedClickTGSMapper { + + /** + *create: 2022-12-12 15:38
+ * + * @author youHong.ai + */ + +public class NotAllowedClickTGSService { + + + private final NotAllowedClickTGSMapper mapper = Util.getMapper(NotAllowedClickTGSMapper.class); + + /** + *create: 2022-12-12 16:13
+ * + * @author youHong.ai + */ + +public class WorkflowTest extends BaseTest { + + @Test + public void test() { + List