V2.0版本开发

This commit is contained in:
Chengliang 2022-12-08 18:06:21 +08:00
parent 55b503dc88
commit 27729bf7c0
13 changed files with 48 additions and 363 deletions

View File

@ -46,14 +46,7 @@ export const getTransferForm = (params) => {
} }
export const add = (params) => { export const add = (params) => {
return fetch('/api/bs/hrmorganization/dept/saveBaseForm', { return WeaTools.callApi('/api/bs/hrmorganization/dept/saveBaseForm', 'POST', params);
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
} }
export const copy = (params) => { export const copy = (params) => {

View File

@ -49,7 +49,7 @@ export default class NewAndEditDialog extends React.Component {
wrapperCol={{ span: `${field.fieldcol}` }}> wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7vxyfr@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange} />} {<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7vxyfr@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange} />}
{field.domkey[0] == 'subcompanycode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'subcompanycode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'dept_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
</WeaFormItem>) </WeaFormItem>)
@ -69,12 +69,6 @@ export default class NewAndEditDialog extends React.Component {
if (moduleName == 'staffScheme' && data.planYear) { if (moduleName == 'staffScheme' && data.planYear) {
bindChangeEnvent(data.planYear.value); bindChangeEnvent(data.planYear.value);
} }
if (moduleName == 'department' && data.parent_comp) {
bindChangeEnvent(data.parent_comp.value);
}
if (moduleName == 'job' && (data.sequence_id || data.grade_id)) {
bindChangeEnvent(data);
}
if (moduleName == 'staff' && data.planId) { if (moduleName == 'staff' && data.planId) {
bindChangeEnvent(data); bindChangeEnvent(data);
} }
@ -110,7 +104,7 @@ export default class NewAndEditDialog extends React.Component {
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@5r6c5a@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange} <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@5r6c5a@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange}
onBlur={this.onBlur} /> onBlur={this.onBlur} />
{field.domkey[0] == 'subcompanycode' && field.viewAttr != 1 && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'subcompanycode' && field.viewAttr != 1 && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'dept_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>} {field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}

View File

@ -30,7 +30,7 @@ export default class AttachToNumberField extends PureComponent {
}; };
this.typeMap = { this.typeMap = {
subcompanycode: "SUBCOMPANY", subcompanycode: "SUBCOMPANY",
dept_no: "DEPARTMENT", departmentcode: "DEPARTMENT",
job_no: "JOBTITLES", job_no: "JOBTITLES",
work_code: "USER" work_code: "USER"
}; };

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-18 16:23:32 * @Date: 2022-05-18 16:23:32
* @LastEditTime: 2022-12-06 16:00:19 * @LastEditTime: 2022-12-08 14:09:12
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/ */
@ -594,8 +594,8 @@ export default class Company extends React.Component {
isFormInit={form1.isFormInit} isFormInit={form1.isFormInit}
loading={dialogLoading} loading={dialogLoading}
isEdit={isEdit} isEdit={isEdit}
height={320} height={340}
conditionLen={1} conditionLen={2}
save={() => this.handleSave()} save={() => this.handleSave()}
onCancel={() => company.setNewVisible(false)} onCancel={() => company.setNewVisible(false)}
saveAndSetting = {() => this.handleSaveAndSetting()} saveAndSetting = {() => this.handleSaveAndSetting()}

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-06-02 09:19:37 * @Date: 2022-06-02 09:19:37
* @LastEditTime: 2022-12-06 10:31:42 * @LastEditTime: 2022-12-08 14:02:45
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js
*/ */
@ -345,12 +345,12 @@ export default class Department extends React.Component {
} = this.props; } = this.props;
let _this = this; let _this = this;
columns.forEach((c, index) => { columns.forEach((c, index) => {
if (c.dataIndex == 'forbiddenTag') { if (c.dataIndex == 'canceled') {
c.render = function (text, record) { c.render = function (text, record) {
return <Switch checked={record.forbiddenTag == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} /> return <Switch checked={record.canceled == "0" ? true : false} onChange={checked => _this.updateForbiddenTag(checked, record.id)} />
} }
}; };
if (c.dataIndex == 'deptName') { if (c.dataIndex == 'departmentMark') {
c.className = "wea-table-indent" c.className = "wea-table-indent"
c.render = function (text, record) { c.render = function (text, record) {
return <a href='javascript:void(0);' onClick={() => { return <a href='javascript:void(0);' onClick={() => {

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-26 14:05:59 * @Date: 2022-05-26 14:05:59
* @LastEditTime: 2022-12-06 10:33:06 * @LastEditTime: 2022-12-08 15:04:50
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
*/ */
@ -343,18 +343,18 @@ export default class Job extends React.Component {
<Menu.Item key="0"> <Menu.Item key="0">
<a href='javascript:void(0);' onClick={() => { _this.view(record.id) }}>查看</a> <a href='javascript:void(0);' onClick={() => { _this.view(record.id) }}>查看</a>
</Menu.Item> </Menu.Item>
<Menu.Item key="1" disabled={record.isUsed === 0 ? false : true} style={record.isUsed === 0 ? {display:'block'} : {display:'none'}}> <Menu.Item key="1">
<a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a> <a href='javascript:void(0);' onClick={() => { _this.doDel(record.id) }}>删除</a>
</Menu.Item> </Menu.Item>
<Menu.Item key="2"> <Menu.Item key="2">
<a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查人员</a> <a href='javascript:void(0);' onClick={() => { _this.select(record.id) }}>联查人员</a>
</Menu.Item> </Menu.Item>
<Menu.Item key="3"> {/* <Menu.Item key="3">
<a href='javascript:void(0);' onClick={() => { _this.merge(record.id) }}>合并</a> <a href='javascript:void(0);' onClick={() => { _this.merge(record.id) }}>合并</a>
</Menu.Item> </Menu.Item>
<Menu.Item key="4"> <Menu.Item key="4">
<a href='javascript:void(0);' onClick={() => { _this.copy(record.id) }}>复制</a> <a href='javascript:void(0);' onClick={() => { _this.copy(record.id) }}>复制</a>
</Menu.Item> </Menu.Item> */}
</Menu> </Menu>
) )
return <Dropdown overlay={menu}> return <Dropdown overlay={menu}>
@ -666,7 +666,6 @@ export default class Job extends React.Component {
onCancel={() => job.setNewVisible(false)} onCancel={() => job.setNewVisible(false)}
saveAndSetting = {() => this.handleSaveAndSetting()} saveAndSetting = {() => this.handleSaveAndSetting()}
moduleName={"job"} moduleName={"job"}
bindChangeEnvent={val => job.updateConditions(val)}
/> />
</div> </div>
) )

View File

@ -104,13 +104,13 @@ export default class newImport extends React.Component {
case 1: case 1:
newImport.importType = 'department'; newImport.importType = 'department';
break; break;
// case 2:
// newImport.importType = 'jobtitle';
// break;
case 2: case 2:
newImport.importType = 'jobtitle';
break;
case 3:
newImport.importType = 'resource'; newImport.importType = 'resource';
break; break;
case 4: case 3:
newImport.importType = 'joblevel'; newImport.importType = 'joblevel';
break; break;
} }

View File

@ -319,7 +319,7 @@ export default class Resource extends React.Component {
reRenderColumns(columns) { reRenderColumns(columns) {
let _this = this; let _this = this;
columns.forEach((c, index) => { columns.forEach((c, index) => {
if (c.dataIndex == 'last_name') { if (c.dataIndex == 'lastname') {
c.render = function (text, record) { c.render = function (text, record) {
return <a href='javascript:void(0);' onClick={() => { return <a href='javascript:void(0);' onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/resourceCard/${record.id}`); window.open(`/spa/organization/static/index.html#/main/organization/resourceCard/${record.id}`);

View File

@ -75,7 +75,7 @@ export class CompanyStore {
if (this.isEmptyObject(this.form.getFormParams())) { if (this.isEmptyObject(this.form.getFormParams())) {
params = { params = {
...params, ...params,
subCompanyName: this.companyName subCompanyDesc: this.companyName
}; };
} else { } else {
params = { params = {
@ -267,7 +267,7 @@ export class CompanyStore {
updateFields(val) { updateFields(val) {
this.form.updateFields({ this.form.updateFields({
subCompanyName: { subCompanyDesc: {
value: val value: val
} }
}); });

View File

@ -45,7 +45,7 @@ export class DepartmentStore {
@observable form1 = new WeaForm(); //新增主表表单 @observable form1 = new WeaForm(); //新增主表表单
@observable form2 = new WeaForm(); //复制表单 @observable form2 = new WeaForm(); //复制表单
@observable departmentName = ''; @observable departmentName = '';
@observable conditionNum = 8; @observable conditionNum = 4;
@observable ids = ''; //选择行id @observable ids = ''; //选择行id
@observable id = ''; //页面跳转参数id @observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true; @observable searchConditionLoading = true;
@ -73,8 +73,7 @@ export class DepartmentStore {
saveAndSetting = false; saveAndSetting = false;
@action @action getTableInfo() {
getTableInfo() {
this.setLoading(true); this.setLoading(true);
let params = { let params = {
...this.selectTreeNodeInfo, ...this.selectTreeNodeInfo,
@ -111,8 +110,7 @@ export class DepartmentStore {
}) })
} }
@action("nodetree事件") @action("nodetree事件") doSearch(params) {
doSearch(params) {
this.selectTreeNodeInfo = params; this.selectTreeNodeInfo = params;
this.setCurrent(1); this.setCurrent(1);
this.setPageSize(10); this.setPageSize(10);
@ -120,8 +118,7 @@ export class DepartmentStore {
this.getTableInfo(); this.getTableInfo();
} }
@action("联查岗位") @action("联查岗位") getPostionTable(id) {
getPostionTable(id) {
let params = { let params = {
parentDept: id parentDept: id
} }
@ -194,7 +191,12 @@ export class DepartmentStore {
getDeptForm() { getDeptForm() {
this.setDialogLoadingStatus(true); this.setDialogLoadingStatus(true);
Api.getDeptForm(this.selectTreeNodeInfo).then(res => { let params = {
...this.selectTreeNodeInfo,
addType:'normal',
viewattr:'2'
}
Api.getDeptForm(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.setDialogLoadingStatus(false); this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition); res.data.condition && this.setCondition(res.data.condition);
@ -264,9 +266,7 @@ export class DepartmentStore {
}; };
this.form1.validateForm().then(f => { this.form1.validateForm().then(f => {
if (f.isValid) { if (f.isValid) {
Api.add(params).then(response => { Api.add(params).then(data => {
return response.json()
}).then(data => {
if (data.code === 200) { if (data.code === 200) {
message.success(data.msg); message.success(data.msg);
this.getTableInfo(); this.getTableInfo();
@ -285,7 +285,7 @@ export class DepartmentStore {
}); });
} }
merge() { @action("合并") merge() {
let params = { let params = {
id: this.ids, id: this.ids,
...this.form1.getFormParams() ...this.form1.getFormParams()
@ -312,7 +312,7 @@ export class DepartmentStore {
}); });
} }
transfer() { @action("转移") transfer() {
let params = { let params = {
id: this.ids, id: this.ids,
...this.form1.getFormParams() ...this.form1.getFormParams()
@ -339,7 +339,7 @@ export class DepartmentStore {
}); });
} }
copy() { @action("复制") copy() {
let params = { let params = {
ids: this.ids, ids: this.ids,
...this.form2.getFormParams() ...this.form2.getFormParams()
@ -374,27 +374,6 @@ export class DepartmentStore {
}) })
} }
key = '';
updateConditions(val) {
this.form1.updateFields({
parent_dept: {
value: ''
}
});
const label = "上级部门"
let index = findIndex(this.condition[0].items, { label });
let currenttime = Date.now();
let key = `parentComp_${currenttime}`;
const lastKey = this.key;
Reflect.deleteProperty(this.condition[0].items[index].browserConditionParam.dataParams, lastKey)
this.key = key;
this.condition[0].items[index].browserConditionParam.dataParams = {
[key]: val,
...this.condition[0].items[index].browserConditionParam.dataParams,
currenttime: currenttime
}
}
updateFields(val) { updateFields(val) {
this.form.updateFields({ this.form.updateFields({

View File

@ -129,7 +129,7 @@ export class DepartmentExtendStore {
if (res.code === 200) { if (res.code === 200) {
res.data.result.conditions && this.form.initFormFields(res.data.result.conditions); res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
res.data.result.conditions && this.setConditions(res.data.result.conditions); res.data.result.conditions && this.setConditions(res.data.result.conditions);
this.tableInfo = this.handleTable(res.data.result.tables); //this.tableInfo = this.handleTable(res.data.result.tables);
this.getTabInfo(); this.getTabInfo();
res.data.result.buttons && this.setButtons(res.data.result.buttons); res.data.result.buttons && this.setButtons(res.data.result.buttons);
res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo); res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
@ -142,10 +142,6 @@ export class DepartmentExtendStore {
}, error => { }, error => {
message.warning(error.msg); message.warning(error.msg);
}) })
} }
handleTable = (datas) => { handleTable = (datas) => {

View File

@ -71,12 +71,11 @@ export class JobStore {
@action initData() { @action initData() {
this.getTableInfo(); this.getTableInfo();
this.getHasRight(); this.getHasRight();
this.getCopyForm(); // this.getCopyForm();
this.getMergeForm(); // this.getMergeForm();
} }
@action @action getTableInfo() {
getTableInfo() {
this.setLoading(true); this.setLoading(true);
let params = { let params = {
...this.selectTreeNodeInfo, ...this.selectTreeNodeInfo,
@ -113,8 +112,7 @@ export class JobStore {
}) })
} }
@action("leftTree事件") @action("leftTree事件") doSearch(params) {
doSearch(params) {
this.selectTreeNodeInfo = params; this.selectTreeNodeInfo = params;
this.setCurrent(1); this.setCurrent(1);
this.setPageSize(10); this.setPageSize(10);
@ -122,8 +120,7 @@ export class JobStore {
this.getTableInfo(); this.getTableInfo();
} }
@action("联查人员") @action("联查人员") getHrmTable(id) {
getHrmTable(id) {
let params = { let params = {
jobId: id jobId: id
} }
@ -139,8 +136,7 @@ export class JobStore {
}) })
} }
//删除 @action("删除") delete() {
delete() {
let params = { let params = {
ids: this.ids ids: this.ids
}; };
@ -209,8 +205,7 @@ export class JobStore {
}) })
} }
@action("复制表单") @action("复制表单") getCopyForm() {
getCopyForm() {
let params = {}; let params = {};
Api.getCopyForm(params).then(res => { Api.getCopyForm(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
@ -223,8 +218,7 @@ export class JobStore {
}) })
} }
@action("合并表单") @action("合并表单") getMergeForm() {
getMergeForm() {
Api.getMergeForm().then(res => { Api.getMergeForm().then(res => {
if (res.code === 200) { if (res.code === 200) {
res.data && this.setMergeCondition(res.data); res.data && this.setMergeCondition(res.data);
@ -303,123 +297,7 @@ export class JobStore {
}) })
} }
updateConditions(data) { @action getHasRight() {
if (data.sequence_id) {
if (data.sequence_id.valueObj.length > 0) {
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);
});
}
} else if (data.grade_id) {
//清空职等并限制范围
let label = "职等"
const index2 = findIndex(this.condition[1].items, { label });
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;
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
}
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
this.form1.updateFields({
level_id: {
value: ''
}
});
this.setCondition(this.condition);
this.form1.initFormFields(this.condition);
}
}
@action
getHasRight() {
Api.getHasRight().then(res => { Api.getHasRight().then(res => {
if (res.code === 200) { if (res.code === 200) {
res.data.rightMenu && this.setRightMenu(res.data.rightMenu); res.data.rightMenu && this.setRightMenu(res.data.rightMenu);

View File

@ -130,25 +130,8 @@ export class JobExtendStore {
} }
Api.getJobExtendForm(params).then((res) => { Api.getJobExtendForm(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
//默认职级职等范围 res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
let conditions = res.data.result.conditions; res.data.result.conditions && this.setCondition(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.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)
}
res.data.result.conditions && this.form.initFormFields(conditions);
res.data.result.conditions && this.setCondition(conditions);
this.tableInfo = this.handleTable(res.data.result.tables); this.tableInfo = this.handleTable(res.data.result.tables);
this.getTabInfo(); this.getTabInfo();
res.data.result.buttons && this.setButtons(res.data.result.buttons); res.data.result.buttons && this.setButtons(res.data.result.buttons);
@ -189,143 +172,6 @@ export class JobExtendStore {
} }
updateConditions(data) {
if (data.sequence_id) {
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 || 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: "" }];
const params = {
"sequenceId": data.sequence_id.value
}
Api.getSchemeInfo(params).then(res => {
if (res.code === 200) {
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: ''
}
});
this.setCondition(condition);
this.form.initFormFields(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) { setLoading(val) {
this.loading = val; this.loading = val;