接口测试

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

View File

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