ncpub-multipage-demo-2005/src/ic/ic/sapplybill/transfer2/btnClicks/serachBljh_btnClick.js

84 lines
2.6 KiB
JavaScript

/*BzB1e9CQ4aOBBkI1TxLpHbDzR4lToqaNhV7dCMXXqXQ=*/
/*
* @Author: raoczh
* @PageInfo: 出库申请-拉单查询按钮处理方法
* @Date: 2018-06-11 19:35:00
* @Last Modified by: lizhbo
* @Last Modified time: 2019-05-20 14:16:05
*/
import { PAGECODE, PAGEAREA, PK, URL, DATASOURCE } from '../const';
import { ajax } from 'nc-lightapp-front';
import transtypeUtils from '../../../../../scmpub/scmpub/pub/tool/transtypeUtils';
import { setDefData } from '../../../../../scmpub/scmpub/pub/cache/cacheDataManager';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import { showSuccessInfo, showWarningInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import { debug } from 'webpack';
export default function clickSerachBtn(cacheSearchData, isRefresh) {
let queryInfo = {};
if (!isRefresh) {
let searchVal = this.props.search.getAllSearchData(PAGEAREA.searchBljh);
if (!searchVal) {
return;
}
queryInfo = this.props.search.getQueryInfo(PAGEAREA.searchBljh, false);
queryInfo.querycondition = searchVal ? searchVal : null;
//缓存查询条件
setDefData(DATASOURCE.refBljhDataSource, PAGEAREA.searchBljh, queryInfo);
} else {
//刷新
if (!cacheSearchData) {
showWarningInfo(null, getLangByResId(this, '4008PUB-000204')); /* 国际化处理: 请先查询数据!*/
return;
}
queryInfo = cacheSearchData;
}
let transtypecode = transtypeUtils.getTranstypeCode.call(this);
queryInfo.userdefObj = { transtype: transtypecode };
let data = {
templetid: this.state.templateid,
queryInfo: queryInfo,
pageCode: PAGECODE.pagecodeBljh //页面编码
};
ajax({
url: URL.searchBljh,
data: data,
success: (res) => {
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
props.dealFormulamsg(
res.formulamsg //参数一:返回的公式对象
);
}
let { success, data } = res;
if (success) {
if (isRefresh) {
showSuccessInfo(getLangByResId(this, '4008PUB-000193')); /* 国际化处理: 刷新成功!*/
}
if (data && data.length > 0) {
if (!isRefresh) {
showSuccessInfo(
null,
getLangByResId(this, '4008PUB-000195', { i: res.data.length })
); /* 国际化处理: 无符合条件数据*/
}
} else {
data = [];
if (!isRefresh) {
showWarningInfo(null, getLangByResId(this, '4008PUB-000202')); /* 国际化处理: 未查询出符合条件的数据!*/
}
}
this.props.transferTable.setTransferTableValue(
PAGEAREA.headBljh,
PAGEAREA.bodyBljh,
data,
PK.headBljh,
PK.bodyBljh
);
}
}
});
}
/*BzB1e9CQ4aOBBkI1TxLpHbDzR4lToqaNhV7dCMXXqXQ=*/