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 getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
export const saveFieldDefinedInfo = (moduleName,params) => { export const saveFieldDefinedInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, { return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
method: 'POST', method: 'POST',
mode: 'cors', mode: 'cors',
headers: { 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) => { export const saveGroupInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, { 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) export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params)

View File

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

View File

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