From 07d2ff983209f4a9dc2d13c6e839ae492cb15272 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 22 Aug 2022 16:19:22 +0800 Subject: [PATCH] fixed --- .../components/postionrank/JobLevel.js | 1 - pc4mobx/organization/index.js | 1 + pc4mobx/organization/stores/fieldDefined.js | 4 +- pc4mobx/organization/stores/jobextend.js | 172 +++++++++++------- pc4mobx/organization/stores/newImport.js | 6 +- pc4mobx/organization/stores/rankscheme.js | 2 +- 6 files changed, 115 insertions(+), 71 deletions(-) diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index 0b1a491..bdc99c2 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -51,7 +51,6 @@ export default class JobLevel extends React.Component { } componentDidMount() { - this.init(); } componentWillReceiveProps(nextProps) { diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index aa78e0c..0819a6d 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -1,5 +1,6 @@ import React from "react"; import Route from "react-router/lib/Route"; +import { message } from "antd"; import { WeaLocaleProvider } from "ecCom"; import Home from "./components/Home"; import SimpleOrg from "./components/tree/index"; diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js index 2a1980b..3602dad 100644 --- a/pc4mobx/organization/stores/fieldDefined.js +++ b/pc4mobx/organization/stores/fieldDefined.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-09 10:16:00 - * @LastEditTime: 2022-08-18 13:53:57 + * @LastEditTime: 2022-08-22 15:25:05 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js */ @@ -227,7 +227,7 @@ export class FieldDefinedStore extends HrmBaseStore { key: 'fieldType', useRecord: true, colSpan: 1, - width: "30%", + width: "40%", com: [{ label: '', type: 'CUSTOMFIELD', diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js index c1ba6bc..c64f000 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -128,8 +128,25 @@ export class JobExtendStore { } Api.getJobExtendForm(params).then((res) => { if (res.code === 200) { - res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); - res.data.result.conditions && this.setCondition(res.data.result.conditions); + //默认职级职等范围 + let conditions = res.data.result.conditions; + 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 }); + label = "职等" + const index2 = findIndex(conditions[1].items, { label }); + let schemeId = 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) + } + + res.data.result.conditions && this.form.initFormFields(conditions); + res.data.result.conditions && this.setCondition(conditions); this.tableInfo = this.handleTable(res.data.result.tables); this.getTabInfo(); res.data.result.buttons && this.setButtons(res.data.result.buttons); @@ -173,7 +190,12 @@ export class JobExtendStore { updateConditions(data) { if (data.sequence_id) { if (data.sequence_id.valueObj.length > 0) { - let label = "等级方案" + 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[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 }]; @@ -182,43 +204,33 @@ export class JobExtendStore { const index1 = findIndex(this.condition[1].items, { label }); let currenttime = 1657247378274 let key = `scheme_id_${currenttime}`; - 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.form.updateFields({ - scheme_id: { - value: '' - }, - level_id: { - value: '' - }, - grade_id: { - value: '' - } - }); + 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) { - if (data.grade_id.valueObj.length > 0) { - //清空职等并限制范围 + 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}`; @@ -228,46 +240,78 @@ export class JobExtendStore { Api.getLevelId(params).then(res => { if (res.code === 200) { const levelId = res.data; - this.condition[1].items[index2].browserConditionParam.completeParams = { - ...this.condition[1].items[index2].browserConditionParam.completeParams, - [key1]: levelId, - [key2]: "''", - currenttime: currenttime - } - this.condition[1].items[index2].browserConditionParam.conditionDataParams = { - ...this.condition[1].items[index2].browserConditionParam.conditionDataParams, - [key1]: levelId, - [key2]: "''", - currenttime: currenttime - } - this.condition[1].items[index2].browserConditionParam.dataParams = { - ...this.condition[1].items[index2].browserConditionParam.dataParams, - [key1]: levelId, - [key2]: "''", - currenttime: currenttime - } - this.condition[1].items[index2].browserConditionParam.destDataParams = { - ...this.condition[1].items[index2].browserConditionParam.destDataParams, - [key]: levelId, - [key2]: "''", - currenttime: currenttime - } + 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: '' } }); + this.setCondition(condition); + this.form.initFormFields(condition); + } - this.setCondition(this.condition); - //this.form.initFormFields(this.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; + } + + rangeLimitLevel(key1,key2,index,value,currenttime,condition) { + condition[1].items[index].browserConditionParam.completeParams = { + ...condition[1].items[index].browserConditionParam.completeParams, + [key1]: value, + [key2]: "''", + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.conditionDataParams = { + ...condition[1].items[index].browserConditionParam.conditionDataParams, + [key1]: value, + [key2]: "''", + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.dataParams = { + ...condition[1].items[index].browserConditionParam.dataParams, + [key1]: value, + [key2]: "''", + currenttime: currenttime + } + condition[1].items[index].browserConditionParam.destDataParams = { + ...condition[1].items[index].browserConditionParam.destDataParams, + [key]: value, + [key2]: "''", + currenttime: currenttime + } + + return condition; + } setLoading(val) { diff --git a/pc4mobx/organization/stores/newImport.js b/pc4mobx/organization/stores/newImport.js index 8ff836e..220dd76 100644 --- a/pc4mobx/organization/stores/newImport.js +++ b/pc4mobx/organization/stores/newImport.js @@ -61,7 +61,7 @@ export class newImportStore { "icon": "icon-coms-Department-number", "title": "分部", "linkName": "分部导入", - "url": "/spa/hrm/engine.html#/hrmengine/organization" + "url": "/spa/organization/static/index.html#/main/organization/company" }, { "subTitle": "部门设置", @@ -69,7 +69,7 @@ export class newImportStore { "icon": "icon-coms-Department-number", "title": "部门", "linkName": "部门导入", - "url": "/spa/hrm/engine.html#/hrmengine/organization" + "url": "/spa/organization/static/index.html#/main/organization/department" }, { "subTitle": "岗位设置", @@ -77,7 +77,7 @@ export class newImportStore { "icon": "icon-coms-hrm", "title": "岗位", "linkName": "岗位体系导入", - "url": "/spa/hrm/engine.html#/hrmengine/post" + "url": "/spa/organization/static/index.html#/main/organization/job" }, { "subTitle": "组织维护", diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index 955f10a..f8a18b0 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -85,8 +85,8 @@ export class RankSchemeStore { return response.json() }).then(data => { if (data.code === 200) { - message.success(i18n.message.deleteSuccess()); this.getTableInfo(); + message.success(i18n.message.deleteSuccess()); } else { message.warning(data.msg); }