Merge pull request !40 from reset/feature/cl
This commit is contained in:
reset 2022-06-20 03:09:41 +00:00 committed by Gitee
commit 5bd1d12a76
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 135 additions and 107 deletions

View File

@ -12,7 +12,7 @@ export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs
export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
export const saveFieldDefinedInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
method: 'POST',
mode: 'cors',
headers: {
@ -22,7 +22,16 @@ export const saveFieldDefinedInfo = (moduleName,params) => {
})
}
export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
export const removeFieldDefinedInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const saveGroupInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
@ -83,7 +92,27 @@ export const saveTree = (moduleName,params) => {
})
}
export const changeGroup = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/changeGroup`, 'POST', params)
export const deleteTree = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const changeGroup = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:14:20
* @LastEditTime: 2022-06-16 18:26:17
* @LastEditTime: 2022-06-17 10:59:30
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/baseStore.js
*/
@ -539,8 +539,8 @@ export default class HrmBaseStore {
}
return otherParams;
}
//重新计算列
convertData = (datas, target) => {
let tData = [],
selectedData = this.generateTableSelectedData(target);

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
* @LastEditTime: 2022-06-16 18:34:18
* @LastEditTime: 2022-06-20 11:07:43
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@ -50,7 +50,7 @@ export class FieldDefinedStore extends HrmBaseStore {
//override baseStore.tabConfig
tabDef = {
color: '#000000',
groupId: '',
//groupId: '',
viewCondition: '1',
topButtonDef: [{
comType: 'button',
@ -138,9 +138,14 @@ export class FieldDefinedStore extends HrmBaseStore {
isDropBtn: true
}
]
if (this.selectedTreeNodeInfo != null && this.selectedTreeNodeInfo.viewAttr != 1) {
// if (this.selectedTreeNodeInfo != null && this.selectedTreeNodeInfo.viewAttr != 1) {
// datas.splice(2, 1);
// }
if (this.selectedTreeNodeInfo != null && !this.selectedTreeNodeInfo.addChild) {
datas.splice(2, 1);
}
return datas;
}
dropdownProps = () => ({
@ -202,7 +207,7 @@ export class FieldDefinedStore extends HrmBaseStore {
label: '',
type: 'INPUT',
key: 'fieldname',
viewAttr: '3',
viewAttr: '1',
otherParams: {
length: 25,
regExp: /^[a-zA-Z][a-zA-Z0-9]*$/,
@ -222,7 +227,7 @@ export class FieldDefinedStore extends HrmBaseStore {
key: 'fieldType',
useRecord: true,
colSpan: 1,
width: (this.moduleName === 'resourcefielddefined' && !this.isJobTreeNode) ? "30%" : "40%",
width: "30%",
com: [{
label: '',
type: 'CUSTOMFIELD',
@ -386,13 +391,13 @@ export class FieldDefinedStore extends HrmBaseStore {
getColumns = () => {
let columns = cloneDeep(this.fieldDefColumns())
if (this.moduleName.indexOf('resource') >= 0) {
columns[1].com = [{
label: '',
type: 'TEXT',
key: 'fieldname',
}]
}
// if (this.moduleName.indexOf('resource') >= 0) {
// columns[1].com = [{
// label: '',
// type: 'TEXT',
// key: 'fieldname',
// }]
// }
return columns;
}
@ -464,17 +469,6 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.dialogParams.groupInfoSetting.visible) {
let logType = '';
switch (this.moduleName) {
case 'subcompanyfielddefined':
logType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED_GROUP';
break;
case 'departmentfielddefined':
logType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED_GROUP';
break;
case 'resourcefielddefined':
logType = 'HRM_ENGINE_RESOURCEFIELDDEFINED_GROUP';
break;
}
this.editorDialogRightMenu.push(...this.getBasicMenus(logType));
}
@ -646,7 +640,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
if (tabArr.length > 0) {
this.tabConfig.tabs = [...tabArr];
// this.setTableEditColTitle();
//this.setTableEditColTitle();
this.setActiveTab(this.tabConfig, init ? '1' : !create ? this.tabConfig.activeTabKey : `${tabArr.length}`);
// this.containerInitFinished = {
// ...this.containerInitFinished,
@ -697,9 +691,7 @@ export class FieldDefinedStore extends HrmBaseStore {
params.groupType = this.selectedTreeNodeInfo.key
this.spinning = true;
api.getFieldDefinedInfo(this.moduleName, params).then(response => {
return response.json()
}).then(res => {
api.getFieldDefinedInfo(this.moduleName, params).then(res => {
if (res.code === 200) {
const {
datas,
@ -719,10 +711,9 @@ export class FieldDefinedStore extends HrmBaseStore {
}
this.spinning = false;
this.refreshMainTabComponent = new Date().getTime();
}).catch(error => {
this.spinning = false;
message.warning(error.msg);
})
this.refreshMainTabComponent = new Date().getTime();
}, error => {this.spinning = false;})
}
@ -748,7 +739,13 @@ export class FieldDefinedStore extends HrmBaseStore {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.tabConfig.activeTabKey = '1';
this.getTabInfoByTreeNode();
if(data.data === 0) {
this.getTabInfoByTreeNode();
}else {
this.initResourceData(this.moduleName)
}
} else {
message.warning(data.msg);
}
@ -951,7 +948,8 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
@action saveFieldDefine = () => {
@action("保存按钮") saveFieldDefine = () => {
if (this.spinning)
return;
this.spinning = true;
@ -984,18 +982,21 @@ export class FieldDefinedStore extends HrmBaseStore {
let fieldlabel = d.fieldlabel || '',
fieldname = d.fieldname || '';
if (fieldlabel === '' || (this.moduleName != 'resourcefielddefined' && fieldname === '')) {
if (fieldlabel === '' ) {
return true;
}
labelArr.push(getCurrentLabel(d.fieldlabel));
nameArr.push(d.fieldname);
return false;
})
let checkSame = false;
if (this.moduleName.indexOf('resource') >= 0)
checkSame = uniq(labelArr).length === data.length;
else
checkSame = uniq(labelArr).length === data.length && uniq(nameArr).length === data.length;
let checkSame = true;
//数据库字段名不校验 后端生成
// if (this.moduleName.indexOf('resource') >= 0)
// checkSame = uniq(labelArr).length === data.length;
// else
// checkSame = uniq(labelArr).length === data.length && uniq(nameArr).length === data.length;
if (invalidEmpty) {
this.spinning = false;
return;
@ -1008,7 +1009,7 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.selectedTreeNodeInfo != null)
dataObj.groupType = this.selectedTreeNodeInfo.key;
let params = {
data: JSON.stringify(dataObj)
data: dataObj
}
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key;
@ -1040,20 +1041,20 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action onEdit = (keys, datas, c, dataIndex) => {
if (dataIndex === 'fieldlabel' && this.moduleName != 'resourcefielddefined') {
if (dataIndex === 'fieldlabel') {
const oldRecord = this.tableEditConfig.fieldDef.datas[keys[0]];
if (has(oldRecord, 'com') && has(oldRecord.com, 'fieldname') && oldRecord.com.fieldname.length > 0 && oldRecord.com.fieldname[0].type === 'TEXT') {
return;
}
this.getPinYin({ labelName: getCurrentLabel(datas[0].fieldlabel) }).then(data => {
const { pinyin } = data;
oldRecord.fieldname = pinyin;
const arr = filter(this.tableEditConfig.fieldDef.datas, { fieldname: pinyin });
if (arr.length > 1 && pinyin != '') {
oldRecord.fieldname = pinyin + '1';
}
this.refreshFeildDef = new Date().getTime();
});
// this.getPinYin({ labelName: getCurrentLabel(datas[0].fieldlabel) }).then(data => {
// const { pinyin } = data;
// oldRecord.fieldname = pinyin;
// const arr = filter(this.tableEditConfig.fieldDef.datas, { fieldname: pinyin });
// if (arr.length > 1 && pinyin != '') {
// oldRecord.fieldname = pinyin + '1';
// }
// this.refreshFeildDef = new Date().getTime();
// });
}
}
@action onAdd = (keys, datas) => {
@ -1292,7 +1293,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action("分组维护中删除") onGroupSettingDeleteOpr = (ks, ds, type) => {
debugger
let ids = [];
ds.map(d => {
if (has(d, 'id'))
@ -1437,7 +1438,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
let domid = this.selectedTreeNodeInfo.domid;
t.topButtonDef.push({
let defaultType = domid != '1' && domid != '2' && domid != '3' && domid != '4'
defaultType && t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.doChildInfoSetting,
@ -1445,15 +1449,6 @@ export class FieldDefinedStore extends HrmBaseStore {
icon: this.menuIconCollection.setting
//checkAction: 'childInfoOperability'
});
//非基本类型()
(domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.removeTypeInfo,
label: i18n.button.delete(),
icon: this.menuIconCollection.setting
});
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
@ -1468,7 +1463,6 @@ export class FieldDefinedStore extends HrmBaseStore {
}
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
this.tableEditConfig.fieldDef.columns[2].com[0].options = remove(this.tableEditConfig.fieldDef.columns[1].com[0].options, (v) => v != 'upload');
} else {
@ -1514,7 +1508,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.refreshMainTabComponent = new Date().getTime();
}
} else {
message.error(data.message);
message.error(res.message);
}
})
}
@ -1554,9 +1548,6 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('createChildInfo', true, dialogTitle);
}
@action("编辑子信息保存(f)") doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
@ -1644,6 +1635,7 @@ export class FieldDefinedStore extends HrmBaseStore {
@action("子信息维护") doChildInfoSetting = () => {
this.tableEditConfig.childInfoSetting.datas.length = 0;
let arr = [];
if (!this.selectedTreeNodeInfo.addChild) {
arr.push({
"record": {
@ -1733,48 +1725,56 @@ export class FieldDefinedStore extends HrmBaseStore {
return arr;
}
removeChildInfo = () => {
@action("删除树信息") removeTypeInfo = () => {
this.confirmInfo({
content: i18n.confirm.deleteSelected(),
onOk: () => {
let parentId;
let cloneTree = cloneDeep(this.toJS(this.treeConfig.data));
cloneTree.map(p => {
p.childs && p.childs.map((c, i) => {
if (c.domid === this.selectedTreeNodeInfo.domid) {
parentId = p.domid;
p.childs.splice(i, 1);
}
})
})
// let parentId;
// let cloneTree = cloneDeep(this.toJS(this.treeConfig.data));
// cloneTree.map(p => {
// p.childs && p.childs.map((c, i) => {
// if (c.domid === this.selectedTreeNodeInfo.domid) {
// parentId = p.domid;
// p.childs.splice(i, 1);
// }
// })
// })
// const params = {
// data: JSON.stringify({
// records: this.convertAttr(cloneTree)
// }),
// parentId
// }
const params = {
data: JSON.stringify({
records: this.convertAttr(cloneTree)
}),
parentId
id: this.selectedTreeNodeInfo.domid
}
api.saveTree(params).then(data => {
if (data.status === '1') {
api.deleteTree(this.moduleName, params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.getTree(() => {
this.treeConfig.selectedKeys = ['-1'];
this.treeConfig.selectedKeys = ['1'];
this.selectedTreeNodeInfo = this.treeConfig.data[0];
this.getTabInfoByTreeNode(null, true);
});
// this.treeConfig.selectedKeys = [this.treeConfig.data[0].key];
// this.selectedTreeNodeInfo = this.treeConfig.data[0];
// this.getTabInfoByTreeNode(null, true);
} else
message.error(data.message);
}, error => {
} else {
message.warning(data.msg);
}
}).catch(error => {
message.error(i18n.message.actionError());
});
})
}
});
}
@action("保存子信息维护") doSaveChildInfoSetting = () => {
debugger
this.recordOP(this.editTable['childInfoSetting'], 'valid');
let infoNameArr = [],
infoArr = [];
@ -1814,9 +1814,6 @@ export class FieldDefinedStore extends HrmBaseStore {
})
}
const params = {
// data: JSON.stringify({
// records: this.convertAttr(cloneTree)
// }),
data: JSON.stringify(infoArr),
parentId
}
@ -1848,7 +1845,7 @@ export class FieldDefinedStore extends HrmBaseStore {
break;
default:
const groupid = e.key;
const tabInfo = this.tabConfig.tabs[findIndex(this.tabConfig.tabs, { groupid })];
const tabInfo = this.tabConfig.tabs[findIndex(this.tabConfig.tabs, {groupid })];
let moveFieldConfirm = i18n.confirm.moveFieldConfirm().replace('{params}', tabInfo.title);
this.changeGroup(moveFieldConfirm, groupid);
}
@ -1875,7 +1872,7 @@ export class FieldDefinedStore extends HrmBaseStore {
})
} else {
Object.assign(params, {
ids: ids.join(','),
fieldids: ids.join(','),
groupid
});
}
@ -1890,16 +1887,18 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action doChangeGroup = (params) => {
api.changeGroup(this.moduleName, params).then(data => {
if (data.status === '1') {
api.changeGroup(this.moduleName, params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.moveSuccess());
// if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
// else
// this.initData();
} else
message.error(data.message);
}, error => { message.error(i18n.message.actionError()); });
} else {
message.warning(data.msg);
}
}).catch(error => {
message.error(i18n.message.actionError());
})
}
@observable encryptDialogVisible = false;