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

58 lines
2.7 KiB
JavaScript
Raw Normal View History

2025-04-09 14:13:40 +08:00
/*YuO8szH0cVixePu/Bt+mG+MUC2/4stDJhhFfyxadCaM=*/
2025-03-09 11:34:19 +08:00
import { ajax, base, spaCache, toast } from 'nc-lightapp-front';
let { setDefData, getDefData } = spaCache;
2025-04-09 14:13:40 +08:00
import { pagecode, searchId, headId, bodyId, billType, dataSource, body_pkname } from '../constants';
2025-03-09 11:34:19 +08:00
import {sortFunction} from '../../../../public/components/pubUtils/billPubUtil'
2025-04-09 14:13:40 +08:00
import { onCheckedChange,getCheckedRowPK,updateCheckedRowsCurrentDealMny,updatePullMoney } from '../../../../public/components/transferTableSelectArea';
2025-03-09 11:34:19 +08:00
//点击查询,获取查询区数据
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")
}
2025-04-09 14:13:40 +08:00
let generType = this.props.search.getSearchValByField(searchId, 'generationType');
let checkedSum=0;
2025-03-09 11:34:19 +08:00
//得到数据渲染到页面
ajax({
url: '/nccloud/arap/arappub/transferquery.do',
data: data,
success: (res) => {
2025-04-09 14:13:40 +08:00
if( generType.value.firstvalue!=this.generationType){
this.generationType = generType.value.firstvalue;
this.props.transferTable.clearAllSelectedData();
}
2025-03-09 11:34:19 +08:00
if (res.data) {
2025-04-09 14:13:40 +08:00
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;
}
2025-03-09 11:34:19 +08:00
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'});/* 国际化处理: 未查询到符合条件的数据*/
}
2025-04-09 14:13:40 +08:00
updatePullMoney.call(this,checkedSum);
// onCheckedChange.call(this, null, null, null, null, {headId, bodyId, body_pkname});
2025-03-09 11:34:19 +08:00
}
})
}
}
2025-04-09 14:13:40 +08:00
/*YuO8szH0cVixePu/Bt+mG+MUC2/4stDJhhFfyxadCaM=*/