tk2312-web/src/arap/receivablebill/recbill/transfer/btnClick/searchBtnClick.js

58 lines
2.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*YuO8szH0cVixePu/Bt+mG6B82aSbGhMosB18vg69kDk=*/
import { ajax, base, spaCache, toast } from 'nc-lightapp-front';
let { setDefData, getDefData } = spaCache;
import { pagecode, searchId, headId, bodyId, billType, dataSource, body_pkname } from '../constants';
import {sortFunction} from '../../../../public/components/pubUtils/billPubUtil'
import { onCheckedChange,getCheckedRowPK,updateCheckedRowsCurrentDealMny,updatePullMoney } from '../../../../public/components/transferTableSelectArea';
//点击查询,获取查询区数据
export default function () {
let searchVal = this.props.search.getAllSearchData(searchId);
if(searchVal && this.props.getUrlParam('dest_tradetype')){
let data = {
queryInfo: this.props.search.getQueryInfo(searchId),
appcode: this.props.getUrlParam('src_appcode'),
pageId: pagecode,
src_billtype: billType,
dest_tradetype: this.props.getUrlParam('dest_tradetype'),
busitype: getDefData(billType + this.props.getUrlParam('src_tradetype'), "transfer.dataSource")
}
let generType = this.props.search.getSearchValByField(searchId, 'generationType');
let checkedSum=0;
//得到数据渲染到页面
ajax({
url: '/nccloud/arap/arappub/transferquery.do',
data: data,
success: (res) => {
if( generType.value.firstvalue!=this.generationType){
this.generationType = generType.value.firstvalue;
this.props.transferTable.clearAllSelectedData();
}
if (res.data) {
let checkedRowPK=getCheckedRowPK.call(this,{headId, bodyId,body_pkname})||[];
let newdata = res.data.sort(sortFunction('billdate','billno',headId));
if(checkedRowPK&&checkedRowPK.length>0){
let {resultData,pullMoney}=updateCheckedRowsCurrentDealMny.call(this,{checkedRowPK,data:newdata,headId, bodyId,body_pkname});
newdata=resultData;
checkedSum=pullMoney;
}
this.props.transferTable.setTransferTableValue(headId, bodyId, newdata, 'pk_recbill', 'pk_recitem');
/*
* key存储数据的key
* dataSource: 缓存数据命名空间
* data 存储数据
*/
setDefData('searchData', dataSource, res.data);
toast({ color: 'success', content: this.state.json['receivablebill-000031']+res.data.length+this.state.json['receivablebill-000032'] });/* 国际化处理: 查询成功,共,条*/
} else {
this.props.transferTable.setTransferTableValue(headId, bodyId, [], 'pk_recbill', 'pk_recitem');
toast({ content: this.state.json['receivablebill-000063'], color: 'warning'});/* 国际化处理: 未查询到符合条件的数据*/
}
updatePullMoney.call(this,checkedSum);
// onCheckedChange.call(this, null, null, null, null, {headId, bodyId, body_pkname});
}
})
}
}
/*YuO8szH0cVixePu/Bt+mG6B82aSbGhMosB18vg69kDk=*/