接口测试
This commit is contained in:
parent
56cb6a800a
commit
35b783ca72
|
|
@ -2,15 +2,8 @@ import {
|
|||
WeaTools
|
||||
} from 'ecCom';
|
||||
|
||||
export const saveFieldDefinedInfo = (moduleName,params) => {
|
||||
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
})
|
||||
export const saveQuickSearchInfo = (params) => {
|
||||
return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchInfo`, 'POST', params);
|
||||
}
|
||||
|
||||
export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params);
|
||||
|
|
|
|||
|
|
@ -130,52 +130,65 @@ export default class QuickSearch extends React.Component {
|
|||
}
|
||||
|
||||
addRow = () => {
|
||||
// const { CubeListStore } = this.props;
|
||||
// let { quickSearchData } = CubeListStore;
|
||||
// let datas = quickSearchData.datas;
|
||||
// if(datas.length>=6){
|
||||
// message.error(getLabel('387795',"最多只能添加6项"));
|
||||
// return;
|
||||
// }
|
||||
// let time = new Date().getTime();
|
||||
// let type = quickSearchData.options.length > 0 ? quickSearchData.options[0].type : '2';
|
||||
// let fieldid = quickSearchData.options.length > 0 ? quickSearchData.options[0].key : '';
|
||||
// let customname = quickSearchData.options.length > 0 ? quickSearchData.options[0].showname : '';
|
||||
// let isdetailtable = quickSearchData.options.length > 0 ? quickSearchData.options[0].isdetailtable : '0';
|
||||
// let obj = {
|
||||
// key: "new_" + time,
|
||||
// fieldid: fieldid,
|
||||
// customname: customname,
|
||||
// range: type == '1' ? getLabel('387636', "内容自定义") : getLabel('387637', "字段本身值"),
|
||||
// condition: type == '1' ? getLabel('68', "设置") : '',
|
||||
// orderid: 0,
|
||||
// type: type,
|
||||
// isdetailtable: isdetailtable
|
||||
// }
|
||||
// datas = toJS(datas);
|
||||
// datas.push(obj);
|
||||
// CubeListStore.setQuickSearchData(datas);
|
||||
const { quickSearch } = this.props;
|
||||
let { quickSearchData } = quickSearch;
|
||||
let datas = quickSearchData.datas;
|
||||
if(datas.length>=6){
|
||||
message.error(getLabel('387795',"最多只能添加6项"));
|
||||
return;
|
||||
}
|
||||
let time = new Date().getTime();
|
||||
let type = quickSearchData.options.length > 0 ? quickSearchData.options[0].type : '2';
|
||||
let fieldid = quickSearchData.options.length > 0 ? quickSearchData.options[0].key : '';
|
||||
let customname = quickSearchData.options.length > 0 ? quickSearchData.options[0].showname : '';
|
||||
let isdetailtable = quickSearchData.options.length > 0 ? quickSearchData.options[0].isdetailtable : '0';
|
||||
let obj = {
|
||||
key: "new_" + time,
|
||||
fieldid: fieldid,
|
||||
customname: customname,
|
||||
range: type == '1' ? getLabel('387636', "内容自定义") : getLabel('387637', "字段本身值"),
|
||||
condition: type == '1' ? getLabel('68', "设置") : '',
|
||||
orderid: 0,
|
||||
type: type,
|
||||
isdetailtable: isdetailtable
|
||||
}
|
||||
datas = toJS(datas);
|
||||
datas.push(obj);
|
||||
quickSearch.setQuickSearchData(datas);
|
||||
}
|
||||
|
||||
delRow = () => {
|
||||
// const { CubeListStore } = this.props;
|
||||
// let { qcSelectedRowKeys } = CubeListStore;
|
||||
// if (qcSelectedRowKeys.length <= 0) {
|
||||
// message.error(getLabel(22346, '请选择要删除的信息', 'label'));
|
||||
// return;
|
||||
// }
|
||||
// const that = this;
|
||||
// Modal.confirm({
|
||||
// title: getLabel(83601, '您确认要删除选中的记录吗?'),
|
||||
// onOk() {
|
||||
// let { datas } = CubeListStore.quickSearchData;
|
||||
// datas = toJS(datas);
|
||||
// datas = that.delFromArray(datas, qcSelectedRowKeys);
|
||||
// CubeListStore.qcSelectedRowKeys = [];
|
||||
// CubeListStore.setQuickSearchData(datas);
|
||||
// },
|
||||
// onCancel() {},
|
||||
// });
|
||||
const { quickSearch } = this.props;
|
||||
let { qcSelectedRowKeys } = quickSearch;
|
||||
if (qcSelectedRowKeys.length <= 0) {
|
||||
message.error(getLabel(22346, '请选择要删除的信息', 'label'));
|
||||
return;
|
||||
}
|
||||
const that = this;
|
||||
Modal.confirm({
|
||||
title: getLabel(83601, '您确认要删除选中的记录吗?'),
|
||||
onOk() {
|
||||
let { datas } = quickSearch.quickSearchData;
|
||||
datas = toJS(datas);
|
||||
datas = that.delFromArray(datas, qcSelectedRowKeys);
|
||||
quickSearch.qcSelectedRowKeys = [];
|
||||
quickSearch.setQuickSearchData(datas);
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
delFromArray = (array, selectRowIds) => {
|
||||
for (let i = 0; i < selectRowIds.length; i++) {
|
||||
let key = selectRowIds[i];
|
||||
for (let j = 0; j < array.length; j++) {
|
||||
if (array[j]["key"] == key) {
|
||||
array.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
onSelectChange = (keys, rows) => {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export default class QuickSearchDetail extends React.Component {
|
|||
}
|
||||
|
||||
addRow = () => {
|
||||
// const { CubeListStore } = this.props;
|
||||
// const { quickSearch } = this.props;
|
||||
// let { quickSearchDetailData } = CubeListStore;
|
||||
// let datas = quickSearchDetailData;
|
||||
// let time = new Date().getTime();
|
||||
|
|
|
|||
|
|
@ -62,65 +62,76 @@ export class QuickSearchStore {
|
|||
|
||||
@action("数据获取") getQuickSearchInfo = () => {
|
||||
this.clearQuciSearchData();
|
||||
API.getQuickSearchInfo({ customid: 382 }).then(action(({ status, errorCode, error, setting, datas, options, groupidOptions }) => {
|
||||
if (status == '1') {
|
||||
this.quickSearchData.setting = setting;
|
||||
API.getQuickSearchInfo({ customid: 382 }).then(action(({ code, data, msg }) => {
|
||||
if (code == 200) {
|
||||
this.quickSearchData.setting = data.setting;
|
||||
this.quickSearchData.datas = datas.map(d => {
|
||||
return { ...d, visible: false }
|
||||
});
|
||||
this.quickSearchData.groupidOptions = groupidOptions;
|
||||
this.quickSearchData.options = options;
|
||||
this.quickSearchData.groupidOptions = data.groupidOptions;
|
||||
this.quickSearchData.options = data.options;
|
||||
this.quickSearchForm.updateFields({
|
||||
isquicksearch: setting.isquicksearch,
|
||||
isquicksearch: data.setting.isquicksearch,
|
||||
});
|
||||
} else {
|
||||
message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||||
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@action("保存页面") saveQuickSearchInfo = (params) => {
|
||||
// let datas = this.quickSearchData.datas;
|
||||
// datas.map((data, index) => {
|
||||
// data.orderid = index
|
||||
// });
|
||||
@action("保存页面") saveQuickSearchInfo = () => {
|
||||
let datas = this.quickSearchData.datas;
|
||||
datas.map((data, index) => {
|
||||
data.orderid = index
|
||||
});
|
||||
|
||||
// let formparm = this.quickSearchForm.getFormParams();
|
||||
// if (!this.checkQuickSearchData()) {
|
||||
// message.error(getLabel('387954', "条件字段不能重复"));
|
||||
// return;
|
||||
// }
|
||||
// let id = this.quickSearchData.setting.id;
|
||||
// if (id == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (params) {
|
||||
// formparm = params;
|
||||
// }
|
||||
// API.saveQuickSearchInfo({
|
||||
// id: id,
|
||||
// customid: this.customid,
|
||||
// data: JSON.stringify(datas), ...formparm
|
||||
// }).then(({ status, errorCode, error, setting, datas, options }: any) => {
|
||||
// if (status == '1') {
|
||||
// message.success(getLabel(83551, '保存成功!'));
|
||||
// this.qcSelectedRowKeys = [];
|
||||
// this.getQuickSearchInfo();
|
||||
// } else {
|
||||
// message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||||
// }
|
||||
// });
|
||||
// this.quickSearchData.setting.id = null;
|
||||
let formparm = this.quickSearchForm.getFormParams();
|
||||
if (!this.checkQuickSearchData()) {
|
||||
message.error(getLabel('387954', "条件字段不能重复"));
|
||||
return;
|
||||
}
|
||||
let id = this.quickSearchData.setting.id;
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
API.saveQuickSearchInfo({
|
||||
id: id,
|
||||
customid: this.customid,
|
||||
data: JSON.stringify(datas), ...formparm
|
||||
}).then(({ status, errorCode, error, setting, datas, options }) => {
|
||||
if (status == '1') {
|
||||
message.success(getLabel(83551, '保存成功!'));
|
||||
this.qcSelectedRowKeys = [];
|
||||
this.getQuickSearchInfo();
|
||||
} else {
|
||||
message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`);
|
||||
}
|
||||
});
|
||||
this.quickSearchData.setting.id = null;
|
||||
}
|
||||
|
||||
|
||||
checkQuickSearchData = () => {
|
||||
let map = new Map();
|
||||
let result = true;
|
||||
this.quickSearchData.datas.map(data => {
|
||||
if (map.has(data.fieldid)) {
|
||||
result = false;
|
||||
}
|
||||
map.set(data.fieldid, data.customname);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@action setQuickSearchData = (datas) => {
|
||||
this.quickSearchData.datas = datas;
|
||||
}
|
||||
|
||||
@action setQuickSearchData = (datas) => {
|
||||
this.quickSearchData.datas = datas;
|
||||
}
|
||||
|
||||
/**============================quickdetail===================== */
|
||||
@action("设置") openQuickSearchDetail = (record) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue