花名册整体修复

This commit is contained in:
Chengliang 2024-07-25 18:50:53 +08:00
parent 6034b5d16f
commit 04c7115ce5
7 changed files with 307 additions and 246 deletions

View File

@ -115,6 +115,10 @@ export const saveColumnsCustomTemplate = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/saveColumnsCustomTemplate`, 'POST',params);
}
export const setOverAll = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/hrmresource/customOverall`, 'POST',params);
}
export const getEditTable = () => {
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getCustomTemplate', 'GET');
}

View File

@ -3,7 +3,8 @@ import {
} from 'mobx-react';
import {
WeaDialog,
WeaTableEdit
WeaTableEdit,
WeaTableEditable
} from 'ecCom';
import {
Spin,
@ -44,7 +45,7 @@ export default class NewWeaTableEditDialog extends React.Component {
<WeaTableEdit
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
deleteConfirm
title="模板"
title="提示:当前使用的模板将不再展示"
showCopy={false}
columns={toJS(columns)}
datas={toJS(datas)}

View File

@ -59,12 +59,14 @@ export default class SearchCustomDialog extends React.Component {
SEARCHDIALOG,
searchDialog,
search,
searchTemplateName
searchTemplateName,
loginId
} = store;
const buttons = [
<Button type='primary' onClick={()=> search ? store.saveHrmSearchUserDefine() : store.saveCustomDefine()}>{getLabel(547360,'保存')}</Button>,
<Button type='primary' onClick={()=> this.saveCustomTemplate()}>{getLabel(547548,'存为模板')}</Button>,
<Button type='primary' onClick={()=> store.getEditTable()}>{getLabel(547582,'模板管理')}</Button>
<Button type='primary' onClick={()=> store.getEditTable()}>{getLabel(547582,'模板管理')}</Button>,
loginId == 1 ?<Button type='primary' onClick={()=> store.setOverAll()}>{getLabel(547853,'将当前模板应用所有人')}</Button> : ''
]

View File

@ -79,7 +79,9 @@ export default class Resource extends React.Component {
const {
resource
} = this.props;
resource.getHasRight();
//1.获取快捷搜索内容
resource.getQuickSearchCondition();
let { hash } = window.location;
hash = hash.split("?")[1].split("&");
@ -143,7 +145,7 @@ export default class Resource extends React.Component {
const type = event.node.props.type || '0';
const id = event.node.props.id || '';
let params = {};
form2.resetConditionValue();
form2.resetForm();
resource.setPanelStatus(false)
// resource.tabkey = 'default_3';
resource.nodeType = type;
@ -290,7 +292,7 @@ export default class Resource extends React.Component {
resource
} = this.props;
resource.customization();
resource.openCustomDialog();
}
//存为模板
@ -331,10 +333,10 @@ export default class Resource extends React.Component {
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => {
resource.getTableInfo(); resource.setPanelStatus(false)
resource.selectTreeNodeInfo = {};resource.setPanelStatus(false);resource.getTableInfo();
}}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} type="primary" onClick={() => this.saveTemplate()}>{i18n.button.saveTemplate()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju7`} type="primary" onClick={() => resource.openSearchDialog(true)}>{i18n.button.conditionSet()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju7`} type="primary" onClick={() => resource.openSearchDialog()}>{i18n.button.conditionSet()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju8`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => resource.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
@ -441,7 +443,21 @@ export default class Resource extends React.Component {
isFormInit
} = form2;
arr.push(<Row style={{ marginTop: 20 }}>
<Col offset={1} span={2}><span style={{ "lineHeight": "30px", "color": "red" }}>{getLabel(547655,'模板选择')}</span></Col>
<Col span={6} offset={1}>
<WeaSelect
style={{ width: "100%" }}
options={templates}
value={searchTemplateId}
onChange={v => {
resource.changeSearchTemplate(v)
}}
/>
</Col>
<Col offset={1} span={2}><Button onClick={() => resource.deleteSearchTemplate()}>{getLabel(547656,'删除模板 ')}</Button></Col>
</Row>)
isFormInit && templates.length > 0 && defaultCondition.map((c, i) => {
let _arr = [];
c.items.map((field, index) => {
@ -456,22 +472,9 @@ export default class Resource extends React.Component {
),
})
})
arr.push(<Row style={{ marginTop: 20 }}>
<Col offset={1} span={2}><span style={{ "lineHeight": "30px", "color": "red" }}>{getLabel(547655,'模板选择')}</span></Col>
<Col span={6} offset={1}>
<WeaSelect
style={{ width: "100%" }}
options={templates}
value={searchTemplateId}
onChange={v => {
resource.changeSearchTemplate(v)
}}
/>
</Col>
<Col offset={1} span={2}><Button onClick={() => resource.deleteSearchTemplate()}>{getLabel(547656,'删除模板 ')}</Button></Col>
</Row>)
arr.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@qaih5l@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={_arr} col={2} />)
arr.push(<WeaSearchGroup className='organization-search' ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@qaih5l@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={_arr} col={2} />)
})

View File

@ -824,6 +824,7 @@ this.spinning = false;
}
@action("分组维护") doGroupSetting = () => {
debugger
this.tableEditConfig.groupSetting.datas.length = 0;
let arr = [];
this.tabRecord.map(tabInfo => {

View File

@ -24,6 +24,8 @@ import {
} from '../public/i18n';
import { getSecondPath } from '../util/index'
import { cloneDeep, isEmpty, trim } from 'lodash';
import HrmBaseStore from './baseStore';
const getLabel = WeaLocaleProvider.getLabel;
const toJS = mobx.toJS;
@ -32,7 +34,7 @@ const {
} = WeaTableNew;
export class ResourceStore {
export class ResourceStore extends HrmBaseStore{
@observable tableStore = new TableStore();
@observable topMenu = []
@observable rightMenu = [];
@ -58,6 +60,7 @@ export class ResourceStore {
@observable defaultShowLeft = true;
@observable companysId = 1
@observable hasRight = '';
@observable loginId = '';
@observable selectTreeNodeInfo;
@ -110,6 +113,7 @@ export class ResourceStore {
@action onRadioGroupChangeHandle = params => {
this.radioParams = params;
this.form2.reset();
this.getTableInfo();
}
@ -119,9 +123,10 @@ export class ResourceStore {
let params = {};
if(this.isEmptyObject(this.radioParams)) {
params = {
isQuickSearch:false,
...this.selectTreeNodeInfo,
isQuickSearch:false
}
//高级搜索内容为空
if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...params,
@ -140,7 +145,7 @@ export class ResourceStore {
isQuickSearch:true
}
}
this.form2.resetForm();
//this.form2.resetForm();
Api.getSearchList(params).then(res => {
if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
@ -204,28 +209,7 @@ export class ResourceStore {
}
@action("高级搜索表单") getSearchCondition(key = true) {
this.setScLoadingStatus(true);
this.form2 = new WeaForm();
let params = {};
key ? params = {
templateId: this.searchTemplateId
} : params = {
selectKeys: this.transfer.transferKeys,
}
Api.getAdvanceSearchCondition(params).then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.defaultcondition && this.setDefaultCondition(res.data.defaultcondition);
res.data.defaultcondition && this.form2.initFormFields(res.data.defaultcondition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("快捷搜索") getQuickSearchCondition() {
Api.getQuickSearchCondition().then(res => {
@ -244,8 +228,15 @@ export class ResourceStore {
Api.getHasRight().then(res => {
if (res.code === 200) {
this.setHasRight(res.data.hasRight);
this.loginId = res.data.loginId;
this.customTemplateId = res.data.customTemplateId;
this.searchTemplateId = res.data.searchTemplateId;
res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
res.data.topMenu && this.setTopMenu(res.data.topMenu);
//1.获取高级搜索内容
this.getHSearchTemplate(res.data.searchTemplateId);
//2.获取列定制内容
this.getSearchTemplate(res.data.customTemplateId);
} else {
message.warning(res.msg);
}
@ -279,12 +270,10 @@ export class ResourceStore {
/** ============================================================================================= */
@observable search = true;
@observable searchDialog = {
visible: false,
loading: true
loading: false
}
@observable templates = [];
@ -345,155 +334,33 @@ export class ResourceStore {
if (res.code === 200) {
this.searchDialog.visible = false;
this.getTableInfo();
}else{
message.error(getLabel(547857,'该模板字段内容仅管理员可操作,即将返回默认设置值'));
this.searchDialog.visible = false;
this.getTableInfo();
}
}, error => {
message.warning(error.msg);
})
}
@action("高级搜索模板切换") changeSearchTemplate(v) {
this.searchTemplateId = v;
this.getSearchCondition();
}
@action("常用条件定制") formatTransfer = () => {
const transferDatas = []
const transferKeys = []
const transferOptions = [{
key: "",
showname: ""
}]
this.transfer.transferSelectedKey = '0';
this.transfer.transferleftIptVal = '';
this.transfer.transferRightIptVal = '';
this.searchCondition.forEach((c, idx) => {
transferOptions.push({
key: `${idx}`,
showname: c.title,
})
c.items.forEach((i) => {
transferDatas.push({
id: i.domkey[0],
label: i.label,
title: c.title,
idx: `${idx}`
})
})
})
this.defaultCondition.forEach((c, idx) => {
c.items.forEach((i) => {
transferKeys.push(i.domkey[0]);
})
})
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
this.searchDialog.visible = true;
}
@action("列定制") customization = (v = false) => {
this.openCustomDialog(v);
}
@action("常用条件定制模板切换") getTemplateSelectKeys = v => {
if (!this.search) {
this.customTemplateId = v;
}
@action("将当前模板应用到所有人") setOverAll = () => {
if (this.customTemplateId == '-1') {
return message.error(getLabel(547854,'默认模板不可应用,请选择其它模板'));
}
const params = {
templateId: v,
type: this.search ? 'search' : 'custom'
templateId: this.customTemplateId
}
Api.getTemplateSelectKeys(params).then(res => {
Api.setOverAll(params).then(res => {
if (res.code === 200) {
this.transfer.transferKeys = res.data.split(",");
} else {
message.warning(res.msg);
message.success(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("搜索模板保存") saveTemplate = () => {
if (this.searchTemplateName == '') {
message.error(getLabel(547651,'搜索模板的名称不能为空'));
} else {
const fields = [];
this.defaultCondition.forEach((c, idx) => {
c.items.forEach((i) => {
fields.push(i.domkey[0]);
})
})
const params = {
showname: this.searchTemplateName,
fields: fields.toString()
}
Api.saveSearchTemplate(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
this.searchTemplateId = data.data;
this.templates = [];
this.setPanelStatus(true);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
}
@action("常用定制列模板保存") saveCustomTemplate = () => {
if (this.customTemplateName == '') {
message.error(getLabel(547652,'列定制模板的名称不能为空'));
} else {
const params = {
showname: this.customTemplateName,
fields: this.transfer.transferKeys.toString()
}
Api.saveCustomTemplate(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
this.customTemplateId = data.data;
// this.getSearchTemplate(false);
this.customization();
message.success(data.msg);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
}
@action("搜索模板删除") deleteSearchTemplate = () => {
if (this.searchTemplateId == -1) {
return message.error(getLabel(547653,'默认模板不可删除'));
}
Api.deleteSearchTemplate({ id: this.searchTemplateId }).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.searchTemplateId = '-1';
this.templates = [];
this.setPanelStatus(true);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@ -595,12 +462,17 @@ export class ResourceStore {
this.transfer.transferKeys = v;
}
@action("模板") getSearchTemplate = (bool) => {
/******显示列定制功能 *************/
@action("tab显示列定制点击") openCustomDialog = () => {
this.search = false;
this.searchDialog.visible = true;
}
Api.getSearchTemplate({ type: bool ? 'search' : 'custom',id: bool ? this.searchTemplateId : this.customTemplateId}).then(res => {
@action("列定制模板") getSearchTemplate = (customTemplateId) => {
Api.getSearchTemplate({ type: 'custom',id:customTemplateId}).then(res => {
if (res.code === 200) {
bool ? this.setTemplates(res.data.templates) : this.setCustomTemplates(res.data.templates);
this.setCustomTemplates(res.data.templates);
this.getCustomTransferData();
} else {
message.warning(res.msg);
}
@ -609,38 +481,52 @@ export class ResourceStore {
})
}
@observable relatedData = {
datas: [],
columns: [],
loading: true,
selectedData: {}
};
@observable temlateManageDialog = {
title: getLabel(547582,'模板管理'),
visible: false,
hasScroll: true,
icon: 'icon-coms-hrm',
iconBgcolor: '#217346',
onCancel: () => this.closeTemlateManageDialog(),
style: {
width: 500,
height: 650
},
buttons: [<Button type='primary' onClick={() => this.updateCustomTemplate()}>{getLabel(547360,'保存')}</Button>]
@action("列定制穿梭框内容") getCustomTransferData() {
Api.getCustomTransferData(this.customTemplateId).then(result => {
if (result.code === 200) {
const { transferDatas, transferKeys, transferOptions } = result.data;
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
} else {
message.warning(result.msg);
}
}, error => {
message.warning(error.msg);
})
}
@computed get editTableParams() {
let datas = this.relatedData.datas;
let selectedData = this.relatedData.selectedData.status;
let params = this.arrToJson(toJS(datas), toJS(selectedData), 'status');
params.rownum = datas.length;
return params;
@action("列定制存为模板保存") saveCustomTemplate = () => {
if (this.customTemplateName == '') {
message.error(getLabel(547652,'列定制模板的名称不能为空'));
} else {
const params = {
showname: this.customTemplateName,
fields: this.transfer.transferKeys.toString()
};
Api.saveCustomTemplate(params).then(response => {
return response.json()
}).then(res => {
if (res.code === 200) {
debugger
this.setCustomTemplates(res.data.result.templates);
this.setCustomTemplateId(res.data.result.id);
message.success(res.msg);
} else {
message.warning(res.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
}
@action("列定制模板管理") getEditTable() {
this.searchDialog.visible = false;
this.temlateManageDialog.visible = true;
this.relatedData.loading = true;
this.relatedData.datas = [];
Api.getEditTable().then(result => {
if (result.code === 200) {
const { columns, datas, selectedData } = result.data;
@ -663,16 +549,14 @@ export class ResourceStore {
})
}
@action("保存") updateCustomTemplate() {
@action("列定制模板管理保存") updateCustomTemplate() {
let params = this.editTableParams;
Api.updateCustomTemplate(params).then(res => {
let { code, msg } = res;
if (code === 200) {
message.success(msg || getLabel(30700,'操作成功'));
//返回默认模板
this.customTemplateId = '-1';
this.getEditTable();
this.customization();
this.getSearchTemplate(this.customTemplateId);
} else {
message.error(msg);
}
@ -681,17 +565,101 @@ export class ResourceStore {
});
}
@action("列定制") getCustomTransferData() {
Api.getCustomTransferData(this.customTemplateId).then(result => {
if (result.code === 200) {
const { transferDatas, transferKeys, transferOptions } = result.data;
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
this.searchDialog.visible = true;
this.searchDialog.loading = false;
/******************************************* 高级搜索内容******************************************/
@action("高级搜索模板内容") getHSearchTemplate = (searchTemplateId) => {
Api.getSearchTemplate({ type: 'search',id: searchTemplateId }).then(res => {
if (res.code === 200) {
this.setTemplates(res.data.templates);
this.getSearchCondition();
} else {
message.warning(result.msg);
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
//key为true时根据模板id查找模板内容
@action("高级搜索表单") getSearchCondition(key = true) {
this.setScLoadingStatus(true);
this.form2 = new WeaForm();
let params = {};
key ? params = {
templateId: this.searchTemplateId
} : params = {
selectKeys: this.transfer.transferKeys,
}
Api.getAdvanceSearchCondition(params).then(res => {
if (res.code === 200) {
this.setScLoadingStatus(false);
res.data.conditions && this.setSearchCondition(res.data.conditions);
res.data.defaultcondition && this.setDefaultCondition(res.data.defaultcondition);
res.data.defaultcondition && this.form2.initFormFields(res.data.defaultcondition);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("高级搜索模板切换") changeSearchTemplate(v) {
this.searchTemplateId = v;
this.getSearchCondition();
}
@action("常用条件定制") formatTransfer = () => {
const transferDatas = []
const transferKeys = []
const transferOptions = [{
key: "",
showname: ""
}]
this.transfer.transferSelectedKey = '0';
this.transfer.transferleftIptVal = '';
this.transfer.transferRightIptVal = '';
this.searchCondition.forEach((c, idx) => {
transferOptions.push({
key: `${idx}`,
showname: c.title,
})
c.items.forEach((i) => {
transferDatas.push({
id: i.domkey[0],
label: i.label,
title: c.title,
idx: `${idx}`
})
})
})
this.defaultCondition.forEach((c, idx) => {
c.items.forEach((i) => {
transferKeys.push(i.domkey[0]);
})
})
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
this.searchDialog.visible = true;
}
@action("高级搜索常用条件定制模板切换") getTemplateSelectKeys = v => {
if (!this.search) {
this.customTemplateId = v;
}
const params = {
templateId: v,
type: this.search ? 'search' : 'custom'
}
Api.getTemplateSelectKeys(params).then(res => {
if (res.code === 200) {
this.transfer.transferKeys = res.data.split(",");
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
@ -699,6 +667,88 @@ export class ResourceStore {
}
@action("高级搜索模板保存") saveTemplate = () => {
if (this.searchTemplateName == '') {
message.error(getLabel(547651,'搜索模板的名称不能为空'));
} else {
const fields = [];
this.defaultCondition.forEach((c, idx) => {
c.items.forEach((i) => {
fields.push(i.domkey[0]);
})
})
const params = {
showname: this.searchTemplateName,
fields: fields.toString()
}
Api.saveSearchTemplate(params).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
this.setSearchTemplateId(data.data);
this.getHSearchTemplate(data.data);
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
}
@action("高级搜索模板删除") deleteSearchTemplate = () => {
if (this.searchTemplateId == -1) {
return message.error(getLabel(547653,'默认模板不可删除'));
}
Api.deleteSearchTemplate({ id: this.searchTemplateId }).then(response => {
return response.json()
}).then(data => {
if (data.code === 200) {
message.success(data.msg);
this.setSearchTemplateId('-1');
this.getHSearchTemplate('-1');
} else {
message.warning(data.msg);
}
}).catch(error => {
message.warning(error.msg);
})
}
@observable relatedData = {
datas: [],
columns: [],
loading: true,
selectedData: {}
};
@observable temlateManageDialog = {
title: getLabel(547582,'模板管理'),
visible: false,
hasScroll: true,
icon: 'icon-coms-hrm',
iconBgcolor: '#217346',
onCancel: () => this.closeTemlateManageDialog(),
style: {
width: 600,
height: 450
},
buttons: [<Button type='primary' onClick={() => this.updateCustomTemplate()}>{getLabel(547360,'保存')}</Button>]
}
@computed get editTableParams() {
let datas = this.relatedData.datas;
let selectedData = this.relatedData.selectedData.status;
let params = this.arrToJson(toJS(datas), toJS(selectedData), 'status');
params.rownum = datas.length;
return params;
}
@action updateTransferleftIptVal = (v) => {
@ -720,18 +770,11 @@ export class ResourceStore {
@action openSearchDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = false;
@action("高级搜索显示列定制") openSearchDialog = () => {
this.formatTransfer();
}
@action openCustomDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
this.getCustomTransferData();
}
@action closeSearchDialog = () => {
this.searchDialog.visible = false;
@ -790,23 +833,26 @@ export class ResourceStore {
this.templates = datas;
}
@action setSearchTemplateId(id) {
this.searchTemplateId = id;
}
@action setCustomTemplates(datas) {
this.customTemplates = datas;
}
@action setCustomTemplateId(id) {
this.customTemplateId = id;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
this.search = true;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
this.isPanelShow = bool;
}
arrToJson(arr, rows, rowKey = "isused") {

View File

@ -38,6 +38,10 @@
width: 70px !important;
}
//高级搜索表单内日期样式特殊处理
.organization-search .wea-date-picker {
height:30px !important
}
//集团管理