From f79a0a3ef501850749fbe000b6b9be5eb42367c1 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 7 Sep 2022 19:23:30 +0800 Subject: [PATCH] fixed --- pc4mobx/organization/apis/job.js | 3 + pc4mobx/organization/stores/job.js | 104 ++++++++------- pc4mobx/organization/stores/jobextend.js | 163 ++++++++++++----------- 3 files changed, 148 insertions(+), 122 deletions(-) diff --git a/pc4mobx/organization/apis/job.js b/pc4mobx/organization/apis/job.js index 694f9f4..4a5e8ef 100644 --- a/pc4mobx/organization/apis/job.js +++ b/pc4mobx/organization/apis/job.js @@ -78,6 +78,9 @@ export const getJobForm = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/job/getSaveForm', 'GET', params); } +export const getSchemeInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSchemeInfo', 'GET', params); +} export const getJobExtendForm = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/job/getJobBaseForm', 'GET', params); diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js index a66a783..a78751a 100644 --- a/pc4mobx/organization/stores/job.js +++ b/pc4mobx/organization/stores/job.js @@ -306,52 +306,65 @@ export class JobStore { updateConditions(data) { if (data.sequence_id) { if (data.sequence_id.valueObj.length > 0) { - let label = "等级方案" - const index = findIndex(this.condition[1].items, { label }); - const schemeId = data.sequence_id.valueObj[0].scheme_values; - this.condition[1].items[index].browserConditionParam.replaceDatas = [{ name: data.sequence_id.valueObj[0].scheme_ids, id: schemeId }]; - //清空职级并限制范围 - label = "职级" - const index1 = findIndex(this.condition[1].items, { label }); - let currenttime = 1657247378274 - let key = `scheme_id_${currenttime}`; - // Object.defineProperty(this.condition[1].items[index1].browserConditionParam.completeParams, [key], { - // value: schemeId, - // }) - this.condition[1].items[index1].browserConditionParam.completeParams = { - ...this.condition[1].items[index1].browserConditionParam.completeParams, - [key]: schemeId, - currenttime: currenttime - } - this.condition[1].items[index1].browserConditionParam.conditionDataParams = { - ...this.condition[1].items[index1].browserConditionParam.conditionDataParams, - [key]: schemeId, - currenttime: currenttime - } - this.condition[1].items[index1].browserConditionParam.dataParams = { - ...this.condition[1].items[index1].browserConditionParam.dataParams, - [key]: schemeId, - currenttime: currenttime - } - this.condition[1].items[index1].browserConditionParam.destDataParams = { - ...this.condition[1].items[index1].browserConditionParam.destDataParams, - [key]: schemeId, - currenttime: currenttime + const params = { + "sequenceId":data.sequence_id.value } + Api.getSchemeInfo(params).then(res => { + if (res.code === 200) { + let label = "等级方案"; + const index = findIndex(this.condition[1].items, { label }); + const schemeId = res.data.id; + this.condition[1].items[index].browserConditionParam.replaceDatas = [{ name: res.data.name, id: schemeId }]; + //清空职级并限制范围 + label = "职级" + const index1 = findIndex(this.condition[1].items, { label }); + let currenttime = 1657247378274 + let key = `scheme_id_${currenttime}`; + // Object.defineProperty(this.condition[1].items[index1].browserConditionParam.completeParams, [key], { + // value: schemeId, + // }) + this.condition[1].items[index1].browserConditionParam.completeParams = { + ...this.condition[1].items[index1].browserConditionParam.completeParams, + [key]: schemeId, + currenttime: currenttime + } + this.condition[1].items[index1].browserConditionParam.conditionDataParams = { + ...this.condition[1].items[index1].browserConditionParam.conditionDataParams, + [key]: schemeId, + currenttime: currenttime + } + this.condition[1].items[index1].browserConditionParam.dataParams = { + ...this.condition[1].items[index1].browserConditionParam.dataParams, + [key]: schemeId, + currenttime: currenttime + } + this.condition[1].items[index1].browserConditionParam.destDataParams = { + ...this.condition[1].items[index1].browserConditionParam.destDataParams, + [key]: schemeId, + currenttime: currenttime + } + this.form1.updateFields({ + scheme_id: { + value: '' + }, + level_id: { + value: '' + }, + grade_id: { + value: '' + } + }); + this.setCondition(this.condition); + this.form1.initFormFields(this.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }); + } - this.form1.updateFields({ - scheme_id: { - value: '' - }, - level_id: { - value: '' - }, - grade_id: { - value: '' - } - }); } else if (data.grade_id) { - if (data.grade_id.valueObj.length > 0) { //清空职等并限制范围 let label = "职等" const index2 = findIndex(this.condition[1].items, { label }); @@ -394,15 +407,14 @@ export class JobStore { }, error => { message.warning(error.msg); }) - } this.form1.updateFields({ level_id: { value: '' } }); + this.setCondition(this.condition); + this.form1.initFormFields(this.condition); } - this.setCondition(this.condition); - this.form1.initFormFields(this.condition); } diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js index 6d24428..f77b83a 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -130,21 +130,21 @@ export class JobExtendStore { if (res.code === 200) { //默认职级职等范围 let conditions = res.data.result.conditions; - if(this.isEditor == true && this.selectedKey == '0'){ + if (this.isEditor == true && this.selectedKey == '0') { let currenttime = 1657247378274; let key0 = `scheme_id_${currenttime}`; let key1 = `level_id_${currenttime}`; let key2 = `scheme_id_${currenttime}`; let label = "职级" - const index1 = findIndex(conditions[1].items, { label }); + const index1 = findIndex(conditions[1].items, { label }); label = "职等" const index2 = findIndex(conditions[1].items, { label }); let schemeId = conditions[1].items[1].browserConditionParam.replaceDatas.length > 0 && conditions[1].items[1].browserConditionParam.replaceDatas[0].id; let levelIds = res.data.levelIds; - this.rangeLimit(key0,schemeId,index1,currenttime,conditions); - this.rangeLimitLevel(key1,key2,index2,levelIds,currenttime,conditions) + this.rangeLimit(key0, schemeId, index1, currenttime, conditions); + this.rangeLimitLevel(key1, key2, index2, levelIds, currenttime, conditions) } - + res.data.result.conditions && this.form.initFormFields(conditions); res.data.result.conditions && this.setCondition(conditions); this.tableInfo = this.handleTable(res.data.result.tables); @@ -192,63 +192,74 @@ export class JobExtendStore { if (data.sequence_id.valueObj.length > 0) { let label = "岗位序列"; const item = findIndex(this.condition[1].items, { label }); - this.condition[1].items[item].browserConditionParam.replaceDatas = [{ name: data.sequence_id.valueObj[0].sequence_names, id: data.sequence_id.value }]; + this.condition[1].items[item].browserConditionParam.replaceDatas = [{ name: data.sequence_id.valueObj[0].sequence_names || data.sequence_id.valueObj[0].name, id: data.sequence_id.value }]; this.condition[1].items[2].browserConditionParam.replaceDatas = [{ name: "", id: "" }]; this.condition[1].items[3].browserConditionParam.replaceDatas = [{ name: "", id: "" }]; - label = "等级方案" - const index = findIndex(this.condition[1].items, { label }); - const schemeId = data.sequence_id.valueObj[0].scheme_values; - this.condition[1].items[index].browserConditionParam.replaceDatas = [{ name: data.sequence_id.valueObj[0].scheme_ids, id: schemeId }]; - //清空职级并限制范围 - label = "职级" - const index1 = findIndex(this.condition[1].items, { label }); - let currenttime = 1657247378274 - let key = `scheme_id_${currenttime}`; - let condition = this.rangeLimit(key,schemeId,index1,currenttime,this.condition); - this.form.updateFields({ - scheme_id: { - value: schemeId - }, - level_id: { - value: '' - }, - grade_id: { - value: '' - } - }); - this.setCondition(condition); - this.form.initFormFields(condition); - } - } else if (data.grade_id) { - let condition = this.condition; - //清空职等并限制范围 - let label = "职等" - const index2 = findIndex(this.condition[1].items, { label }); - this.condition[1].items[index2].browserConditionParam.replaceDatas = [{ name: "", id: "" }]; - label = "职级"; - const item = findIndex(this.condition[1].items, { label }); - let grade_names = data.grade_id.valueObj.length > 0 ? data.grade_id.valueObj[0].grade_names : ""; - let value = data.grade_id.valueObj.length > 0 ? data.grade_id.value : ""; - this.condition[1].items[item].browserConditionParam.replaceDatas = [{ name: grade_names, id: value }]; - if (data.grade_id.valueObj.length > 0) { - let currenttime = 1657247378274; - let key1 = `level_id_${currenttime}`; - let key2 = `scheme_id_${currenttime}`; - let params = { - id:data.grade_id.value - }; - Api.getLevelId(params).then(res => { + + const params = { + "sequenceId": data.sequence_id.value + } + Api.getSchemeInfo(params).then(res => { if (res.code === 200) { - const levelId = res.data; - condition = this.rangeLimitLevel(key1,key2,index2,levelId,currenttime,this.condition); + label = "等级方案" + const index = findIndex(this.condition[1].items, { label }); + const schemeId = res.data.id; + this.condition[1].items[index].browserConditionParam.replaceDatas = [{ name: res.data.name, id: schemeId }]; + //清空职级并限制范围 + label = "职级" + const index1 = findIndex(this.condition[1].items, { label }); + let currenttime = 1657247378274; + let key = `scheme_id_${currenttime}`; + let condition = this.rangeLimit(key, schemeId, index1, currenttime, this.condition); + this.form.updateFields({ + scheme_id: { + value: schemeId + }, + level_id: { + value: '' + }, + grade_id: { + value: '' + } + }); + this.setCondition(condition); + this.form.initFormFields(condition); } else { message.warning(res.msg); } }, error => { message.warning(error.msg); - }) - + }); + + } + } else if (data.grade_id) { + let condition = this.condition; + //清空职等并限制范围 + let label = "职等" + const index2 = findIndex(this.condition[1].items, { label }); + this.condition[1].items[index2].browserConditionParam.replaceDatas = [{ name: "", id: "" }]; + label = "职级"; + const item = findIndex(this.condition[1].items, { label }); + let grade_names = data.grade_id.valueSpan ? data.grade_id.valueSpan.replace(/<.*?>/g, '') : ""; + let value = data.grade_id.value; + this.condition[1].items[item].browserConditionParam.replaceDatas = [{ name: grade_names, id: value }]; + let currenttime = 1657247378274; + let key1 = `level_id_${currenttime}`; + let key2 = `scheme_id_${currenttime}`; + let params = { + id: data.grade_id.value + }; + Api.getLevelId(params).then(res => { + if (res.code === 200) { + const levelId = res.data; + condition = this.rangeLimitLevel(key1, key2, index2, levelId, currenttime, this.condition); + } else { + message.warning(res.msg); + } + }, error => { + message.warning(error.msg); + }) this.form.updateFields({ level_id: { value: '' @@ -256,35 +267,35 @@ export class JobExtendStore { }); this.setCondition(condition); this.form.initFormFields(condition); - + } } - rangeLimit(key,value,index,currenttime,condition) { + rangeLimit(key, value, index, currenttime, condition) { condition[1].items[index].browserConditionParam.completeParams = { - ...condition[1].items[index].browserConditionParam.completeParams, - [key]: value, - currenttime: currenttime - } - condition[1].items[index].browserConditionParam.conditionDataParams = { - ...condition[1].items[index].browserConditionParam.conditionDataParams, - [key]: value, - currenttime: currenttime - } - condition[1].items[index].browserConditionParam.dataParams = { - ...condition[1].items[index].browserConditionParam.dataParams, - [key]: value, - currenttime: currenttime - } - condition[1].items[index].browserConditionParam.destDataParams = { - ...condition[1].items[index].browserConditionParam.destDataParams, - [key]: value, - currenttime: currenttime - } - return condition; + ...condition[1].items[index].browserConditionParam.completeParams, + [key]: value, + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.conditionDataParams = { + ...condition[1].items[index].browserConditionParam.conditionDataParams, + [key]: value, + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.dataParams = { + ...condition[1].items[index].browserConditionParam.dataParams, + [key]: value, + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.destDataParams = { + ...condition[1].items[index].browserConditionParam.destDataParams, + [key]: value, + currenttime: currenttime + } + return condition; } - rangeLimitLevel(key1,key2,index,value,currenttime,condition) { + rangeLimitLevel(key1, key2, index, value, currenttime, condition) { condition[1].items[index].browserConditionParam.completeParams = { ...condition[1].items[index].browserConditionParam.completeParams, [key1]: value,