接口测试

This commit is contained in:
Chengliang 2023-08-10 09:34:44 +08:00
parent 35b783ca72
commit 7c6e62c28f
3 changed files with 60 additions and 42 deletions

View File

@ -6,6 +6,10 @@ export const saveQuickSearchInfo = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchInfo`, 'POST', params); return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchInfo`, 'POST', params);
} }
export const saveQuickSearchDetailInfo = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchDetailInfo`, 'POST', params);
}
export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params); export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params);
export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchDetailInfo`, 'GET', params); export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchDetailInfo`, 'GET', params);

View File

@ -48,44 +48,57 @@ export default class QuickSearchDetail extends React.Component {
} }
addRow = () => { addRow = () => {
// const { quickSearch } = this.props; const { quickSearch } = this.props;
// let { quickSearchDetailData } = CubeListStore; let { quickSearchDetailData } = quickSearch;
// let datas = quickSearchDetailData; let datas = quickSearchDetailData;
// let time = new Date().getTime(); let time = new Date().getTime();
// let obj = { let obj = {
// key: "new_" + time, key: "new_" + time,
// customname: '', customname: '',
// orderid: 0, orderid: 0,
// minnum: '', minnum: '',
// maxnum: '', maxnum: '',
// type: CubeListStore.qcData.qcType, type: quickSearch.qcData.qcType,
// fieldid: CubeListStore.qcData.fieldid, fieldid: quickSearch.qcData.fieldid,
// customid: CubeListStore.customid customid: quickSearch.customid
// } }
// datas = toJS(datas); datas = toJS(datas);
// datas.push(obj); datas.push(obj);
// CubeListStore.setQuickSearchDetailData(datas); quickSearch.setQuickSearchDetailData(datas);
} }
delRow = () => { delRow = () => {
// const { CubeListStore } = this.props; const { quickSearch } = this.props;
// let { qcDetailRowKeys } = CubeListStore; let { qcDetailRowKeys } = quickSearch;
// if (qcDetailRowKeys.length <= 0) { if (qcDetailRowKeys.length <= 0) {
// message.error(getLabel(22346, '请选择要删除的信息', 'label')); message.error(getLabel(22346, '请选择要删除的信息', 'label'));
// return; return;
// } }
// const that = this; const that = this;
// Modal.confirm({ Modal.confirm({
// title: getLabel(83601, '您确认要删除选中的记录吗?'), title: getLabel(83601, '您确认要删除选中的记录吗?'),
// onOk() { onOk() {
// let datas = CubeListStore.quickSearchDetailData; let datas = quickSearch.quickSearchDetailData;
// datas = toJS(datas); datas = toJS(datas);
// datas = that.delFromArray(datas, qcDetailRowKeys); datas = that.delFromArray(datas, qcDetailRowKeys);
// CubeListStore.qcDetailRowKeys = []; quickSearch.qcDetailRowKeys = [];
// CubeListStore.setQuickSearchDetailData(datas); quickSearch.setQuickSearchDetailData(datas);
// }, },
// onCancel() { }, 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;
} }
render() { render() {

View File

@ -62,10 +62,10 @@ export class QuickSearchStore {
@action("数据获取") getQuickSearchInfo = () => { @action("数据获取") getQuickSearchInfo = () => {
this.clearQuciSearchData(); this.clearQuciSearchData();
API.getQuickSearchInfo({ customid: 382 }).then(action(({ code, data, msg }) => { API.getQuickSearchInfo().then(action(({ code, data, msg }) => {
if (code == 200) { if (code == 200) {
this.quickSearchData.setting = data.setting; this.quickSearchData.setting = data.setting;
this.quickSearchData.datas = datas.map(d => { this.quickSearchData.datas = data.datas.map(d => {
return { ...d, visible: false } return { ...d, visible: false }
}); });
this.quickSearchData.groupidOptions = data.groupidOptions; this.quickSearchData.groupidOptions = data.groupidOptions;
@ -98,15 +98,14 @@ export class QuickSearchStore {
} }
API.saveQuickSearchInfo({ API.saveQuickSearchInfo({
id: id, id: id,
customid: this.customid,
data: JSON.stringify(datas), ...formparm data: JSON.stringify(datas), ...formparm
}).then(({ status, errorCode, error, setting, datas, options }) => { }).then(({ code, data, msg }) => {
if (status == '1') { if (data == 200) {
message.success(getLabel(83551, '保存成功!')); message.success(getLabel(83551, '保存成功!'));
this.qcSelectedRowKeys = []; this.qcSelectedRowKeys = [];
this.getQuickSearchInfo(); this.getQuickSearchInfo();
} else { } else {
message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
} }
}); });
this.quickSearchData.setting.id = null; this.quickSearchData.setting.id = null;
@ -171,7 +170,9 @@ export class QuickSearchStore {
// }); // });
} }
@action setQuickSearchDetailData = (datas) => {
this.quickSearchDetailData = datas;
}
/**===========================buttons=========================== */ /**===========================buttons=========================== */