2022-12-08 15:32:28 +08:00
/* ******************* 保时捷target setting流程提交控制 start ******************* */
2022-12-13 10:35:10 +08:00
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
2022-12-09 23:10:13 +08:00
buttonReact . setState ( { } )
2022-12-13 10:35:10 +08:00
}
} ,
/ * *
* 监听qzhj字段值改变
* @ author youhong . ai
* @ param id 字段id
* @ param value 字段值
* @ param obj 字段值对象
* /
onQzhjFieldChangeValue : function ( obj , id , value ) {
if ( value != '100' ) {
window . workflowCus . doNotClickSubmit ( )
2022-12-09 23:10:13 +08:00
} else {
2022-12-13 10:35:10 +08:00
window . workflowCus . allowClickSubmit ( )
2022-12-09 23:10:13 +08:00
}
2022-12-13 10:35:10 +08:00
} ,
/ * *
* 检查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 ( )
}
2022-12-09 23:10:13 +08:00
}
2022-12-13 10:35:10 +08:00
} ,
/ * *
* 保存按钮触发流程转数据
* @ 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" )
}
}
} ,
2022-12-09 23:10:13 +08:00
2022-12-13 10:35:10 +08:00
saveAfterCallback : function ( callback ) {
localStorage . setItem ( "saveTriggerWorkflowToModel" , "true" )
callback ( )
}
2022-12-08 15:32:28 +08:00
2022-12-13 10:35:10 +08:00
} )
/* ******************* 保时捷target setting流程提交控制 end ******************* */
2022-12-08 15:32:28 +08:00
2022-12-13 10:35:10 +08:00
/* ******************* 保时捷target setting流程提交控制 start ******************* */
2022-12-08 15:32:28 +08:00
$ ( ( ) => {
let qzhjFieldId = WfForm . convertFieldNameToId ( "qzhj" )
2022-12-13 10:35:10 +08:00
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 )
2022-12-09 23:10:13 +08:00
let flag = localStorage . getItem ( "saveTriggerWorkflowToModel" )
if ( flag === "true" ) {
2022-12-13 10:35:10 +08:00
window . workflowCus . saveTriggerWorkflowToModel ( )
2022-12-09 23:10:13 +08:00
}
2022-12-08 15:32:28 +08:00
} )
/* ******************* 保时捷target setting流程提交控制 end ******************* */
2022-12-13 10:35:10 +08:00
/* ******************* 保时捷个人目标台账查询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 ) ;
2023-02-02 10:26:35 +08:00
if ( score == 0 || score == '' ) {
2022-12-19 19:49:02 +08:00
return
}
2022-12-13 10:35:10 +08:00
let result = await Utils . api ( {
url : "/api/ayh/workflow/apa/level" ,
data : {
score
}
} )
if ( result && result . code === 200 ) {
Utils . changeFieldValueByName ( config . levelField , result . data )
}
}
} )
2022-12-13 15:30:18 +08:00
/* ******************* apa流程通过apa分数字段带出level字段eng ******************* */
2022-12-13 10:35:10 +08:00
2022-12-13 15:30:18 +08:00
/* ******************* apa流程通过apa分数字段带出level字段 ******************* */
2022-12-13 10:35:10 +08:00
$ ( ( ) => {
let config = {
2022-12-19 19:49:02 +08:00
scoreFiled : "apafsptyg" ,
levelField : "level1"
}
try {
2023-02-02 10:26:35 +08:00
setTimeout ( ( ) => {
WfForm . bindFieldChangeEvent ( Utils . convertNameObjToId ( config . scoreFiled ) , ( ) => {
2022-12-19 19:49:02 +08:00
window . workflowCus . getLevelByScore ( config )
} )
window . workflowCus . getLevelByScore ( config )
2023-02-02 10:26:35 +08:00
} , 100 )
} catch ( err ) {
2022-12-19 19:49:02 +08:00
console . log ( err )
2022-12-13 10:35:10 +08:00
}
} )
2022-12-08 15:32:28 +08:00
2022-12-13 10:35:10 +08:00
/* ******************* apa流程通过apa分数字段带出level字段eng ******************* */
2023-02-02 10:26:35 +08:00
/* ******************* apa(employee)流程明细分数控制 ******************* */
function addChangeEventListener ( configItem ) {
let fieldIds = Utils . convertNameToIdUtil ( [ {
fieldName : configItem . selfEvaluationScore ,
table : configItem . table
} , {
fieldName : configItem . leaderScore ,
table : configItem . table
} ] )
WfForm . bindDetailFieldChangeEvent ( fieldIds , ( id , rowIndex , value ) => {
if ( value == '' ) {
return
}
if ( value >= 1 && value <= 5 ) {
if ( value % 0.5 !== 0 ) {
showHint ( id + "_" + rowIndex )
}
} else {
showHint ( id + "_" + rowIndex )
}
} )
}
function showHint ( id ) {
WfForm . showMessage ( ` Evaluate your target completion by selecting a score.
The scores are of 0.5 break - down .
5 - Outstanding
4 - Exceeds Expectations
3 - Meets Expectations
2 - Needs Improvement
1 - Unsatisfactory ` , 2, 10)
setTimeout ( ( ) => {
WfForm . changeFieldValue ( id , { value : "" } )
} , 100 )
}
$ ( ( ) => {
let employeeDetailConfig = [ {
table : 'detail_1' ,
selfEvaluationScore : 'zp' ,
leaderScore : 'ldpf'
} , {
table : 'detail_2' ,
selfEvaluationScore : 'zp' ,
leaderScore : 'ldpf'
} ]
employeeDetailConfig . forEach ( item => {
addChangeEventListener ( item )
} )
} )
/* ******************* apa(employee)流程明细分数控制end ******************* */