开票申请卡片批量粘贴编辑事件1
This commit is contained in:
parent
ffdba003e4
commit
68eb002138
|
@ -5,6 +5,7 @@
|
|||
* @Last Modified by: mzr
|
||||
* @Last Modified time: 2025-05-07 16:30:44
|
||||
*/
|
||||
|
||||
import valueChange from "../common/valueChange";
|
||||
|
||||
const BATCHITEM = [
|
||||
|
@ -22,7 +23,8 @@ const BATCHITEM = [
|
|||
];
|
||||
|
||||
export default async function batchEvents(obj) {
|
||||
console.log(obj);
|
||||
console.log('obj = ', obj);
|
||||
//循环判断单元格是否可编辑,并注册过滤条件
|
||||
let areaCode = obj.areaCode; //区域编码
|
||||
let column = obj.column; //列信息
|
||||
let newValue = obj.newValue; //变更的行信息
|
||||
|
@ -30,84 +32,65 @@ export default async function batchEvents(obj) {
|
|||
let changedrows = obj.changedrows; //变更的信息,仅包含newValue和OldValue
|
||||
let currentIndex = obj.currentIndex; //当前行
|
||||
let indexs = [];
|
||||
let rows = [];
|
||||
let attrcode = column.attrcode; //列code
|
||||
let queryCondition; //统一过滤的过滤条件
|
||||
let isManyCondition = null; //是否多个过滤条件
|
||||
let isManyCondition = false; //业务组判断,每行参展过滤条件是否不一样,如果不一样,值为true
|
||||
let pasteData = obj.pasteData; //粘贴的值
|
||||
// 表格粘贴前的所有行数据
|
||||
let allData = obj.allData;
|
||||
|
||||
if (!BATCHITEM.includes(attrcode)) {
|
||||
return;
|
||||
}
|
||||
if (attrcode == 'def1') {
|
||||
for (let i = 0; i < newValue.length; i++) {
|
||||
//如果需求组织没有值就不允许编辑
|
||||
if (!(newValue[i].values.pk_reqstoorg && newValue[i].values.pk_reqstoorg.value)) {
|
||||
continue;
|
||||
}
|
||||
queryValue.push(newValue[i]);
|
||||
indexs[i] = currentIndex + i;
|
||||
rows[i] = [i];
|
||||
|
||||
queryValue[i].queryCondition = {
|
||||
pk_org: newValue[i].values.pk_reqstoorg.value,
|
||||
// busifuncode: FIELD.STOCKORG,
|
||||
GridRefActionExt: 'nccloud.web.pu.order.ref.RequestWarehouseBodyRefFilter'
|
||||
};
|
||||
}
|
||||
isManyCondition = true;
|
||||
}
|
||||
|
||||
// NCC-231904
|
||||
if (queryValue == null || queryValue.length == 0) {
|
||||
return;
|
||||
}
|
||||
this.props.cardTable
|
||||
.updateAfterBatchChange({
|
||||
areaCode,
|
||||
column,
|
||||
indexs,
|
||||
queryValue,
|
||||
changedrows,
|
||||
pasteData,
|
||||
queryCondition,
|
||||
isManyCondition
|
||||
})
|
||||
.then((res) => {
|
||||
let props = res.props;
|
||||
changedrows = res.changedrows;
|
||||
indexs = res.indexs;
|
||||
|
||||
//执行业务的批量编辑后事件
|
||||
// valueChange.call(props, moduleId, key, newValue);
|
||||
valueChange.call(props, moduleId, key, null, changedrows, index);
|
||||
/*let data = createBodyAfterEventData4BatchMore(
|
||||
props,
|
||||
PAGECODE.cardcode,
|
||||
PAGECODE.cardhead,
|
||||
[PAGECODE.cardbody, PAGECODE.card_fee],
|
||||
areaCode,
|
||||
attrcode,
|
||||
changedrows,
|
||||
indexs
|
||||
);
|
||||
ajax({
|
||||
url: '/nccloud/pu/poordercard/cardbodyafterevent.do', //卡片表体编辑后事件
|
||||
data: data,
|
||||
async: false,
|
||||
success: (res) => {
|
||||
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
|
||||
props.dealFormulamsg(
|
||||
res.formulamsg, //参数一:返回的公式对象
|
||||
{
|
||||
[PAGECODE.head_payment]: 'cardTable',
|
||||
[PAGECODE.cardbody]: 'cardTable'
|
||||
}
|
||||
);
|
||||
}
|
||||
processExtBillCardBodyEditResult4Batch(props, PAGECODE.cardbody, res.data, indexs);
|
||||
this.forceUpdate();
|
||||
/*if (!isManyCondition) {
|
||||
queryCondition = {def1: records[i].data.def1.value}
|
||||
}*/
|
||||
let rowKey = 'rowid';
|
||||
for (let i = 0; i < newValue.length; i++) {
|
||||
let isExist = false;
|
||||
// 查找真正的index(解决筛选问题)
|
||||
allData.forEach((item, index) => {
|
||||
if (item[rowKey] === newValue[rowKey]) {
|
||||
isExist = true;
|
||||
if (allData[index].values.pk_org == 'a') {
|
||||
//若该单元格不可编辑则跳过
|
||||
return;
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
||||
if (allData[index].values.pk_org == 'b') {//若该单元可编辑
|
||||
queryValue[i] = newValue[i]; //则保留
|
||||
indexs.push(index);
|
||||
|
||||
//若为参照
|
||||
if (column.itemtype === 'refer' && isManyCondition) {
|
||||
//如果每个单元格的过滤条件不一致,则给每个单元格注册过滤条件
|
||||
queryValue[i].queryCondition = {pk_org: records[i].data.def1.value}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// allData中没有找到,说明应该是新增的行
|
||||
if (isExist) {
|
||||
// 因为可以粘贴超过当前页面显示数据的行数,则会增行,如果该行还有其他的数据展示,需要业务组来处理,塞到queryValue中
|
||||
// 比如 queryValue[i].values.行号={value:10}
|
||||
}
|
||||
}
|
||||
//调用平台方法,更新数据
|
||||
this.props.cardTable.updateAfterBatchChange({
|
||||
areaCode,
|
||||
attrcode,
|
||||
queryValue,
|
||||
changedrows,
|
||||
column,
|
||||
pasteData,
|
||||
indexs, //过滤后的index的数组例如:[0,1,2,3,5]
|
||||
queryCondition, //如果是参照且参照过滤条件唯一就传,不一致就是前面说的,放到queryValue里
|
||||
isManyCondition,// true,代表有多个参照过滤条件,false表示只有一个
|
||||
}).then((res) => {
|
||||
//res里的数据,暂时有props,changedrows,indexs
|
||||
//执行业务的批量编辑后事件
|
||||
// afterEvent(this.props, areaCode, attrcode, queryValue, changerows);
|
||||
valueChange.call(this, areaCode, attrcode, newValue);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*ibwHuagm4SH5+rOVOaqHvq6PFvMIbflRwssh+yGUv2M=*/
|
||||
import { Component } from "react";
|
||||
import { createPage, getMultiLang, high, promptBox, cardCache, base } from "nc-lightapp-front";
|
||||
import {Component} from "react";
|
||||
import {cardCache, createPage} from "nc-lightapp-front";
|
||||
import ExcelOutput from 'uap/common/components/ExcelOutput';
|
||||
import { setCardTable, setForm } from 'ssccommon/utils/setComponentUsed';
|
||||
import {setCardTable, setForm} from 'ssccommon/utils/setComponentUsed';
|
||||
import ApprovalTrans from 'ssccommon/platformcomponents/ApprovalTrans';
|
||||
const { getCacheById, updateCache } = cardCache;
|
||||
import "./index.less";
|
||||
import PubMessage from 'ssccommon/utils/pubMessage';
|
||||
import getBillType from './common/getBillType'
|
||||
|
@ -24,17 +23,12 @@ import bodyModelDelRow from './events/bodyModelDelRow'
|
|||
import presetVar from './presetVar'
|
||||
import InvoiceComponent from '../../../invoiceComponent/compoundComponent/component'
|
||||
import SimplifiedUploader from 'ssccommon/platformcomponents/SimplifiedUploader';
|
||||
import confirmMakeInvoice from'./events/confirmMakeInvoice'
|
||||
import confirmMakeInvoice from './events/confirmMakeInvoice'
|
||||
import SlsmModal from '../common/components/slsmModal'
|
||||
|
||||
import {
|
||||
BillStyle,
|
||||
BillHead,
|
||||
BillBody,
|
||||
Form,
|
||||
CardTable,
|
||||
ButtonGroupListCard
|
||||
} from 'ssccommon/components/bill';
|
||||
import {BillBody, BillHead, BillStyle, ButtonGroupListCard, CardTable, Form} from 'ssccommon/components/bill';
|
||||
|
||||
const {getCacheById, updateCache} = cardCache;
|
||||
|
||||
class InvoiceCard extends Component {
|
||||
constructor(props) {
|
||||
|
@ -54,14 +48,14 @@ class InvoiceCard extends Component {
|
|||
compositedisplay: '', //控制指派框显示\
|
||||
exportIds: [], // 导出ID列表
|
||||
forceRender: true, // 初始设置不加载数据,控制页面打开流量
|
||||
selectedSLSMValue:'',//税率说明单选值,默认第一个选项
|
||||
showSlsmModal:false,//税率说明弹窗是否显示
|
||||
isShowTips:false,//税率说明单选值为空且点击弹窗中开票
|
||||
hideAdd:false,//侧拉删行按钮显隐
|
||||
hideDel:false,//侧拉删行按钮显隐
|
||||
slsmRadioOptions:[],//税率说明单选枚举值
|
||||
specialInvoiceIsShow:false,//特殊票种表体是否显示
|
||||
cardTableBodyIsAutoAdd:true,//表体行是否自动增行
|
||||
selectedSLSMValue: '',//税率说明单选值,默认第一个选项
|
||||
showSlsmModal: false,//税率说明弹窗是否显示
|
||||
isShowTips: false,//税率说明单选值为空且点击弹窗中开票
|
||||
hideAdd: false,//侧拉删行按钮显隐
|
||||
hideDel: false,//侧拉删行按钮显隐
|
||||
slsmRadioOptions: [],//税率说明单选枚举值
|
||||
specialInvoiceIsShow: false,//特殊票种表体是否显示
|
||||
cardTableBodyIsAutoAdd: true,//表体行是否自动增行
|
||||
};
|
||||
this.billId = '';//上传附件单据id
|
||||
this.pk = '';
|
||||
|
@ -80,10 +74,10 @@ class InvoiceCard extends Component {
|
|||
setCardTable(props, presetVar.bodyAreaId),
|
||||
setForm(props, presetVar.formAreaId),
|
||||
setCardTable(props, presetVar.body2AreaId),
|
||||
initTemplate.call(this, props);
|
||||
this.isHasSpecialInvoiceArea=false;//是否存在特殊票种表体区域
|
||||
initTemplate.call(this, props);
|
||||
this.isHasSpecialInvoiceArea = false;//是否存在特殊票种表体区域
|
||||
// 模板中折扣金额是否可编辑
|
||||
this.zkjeIsDisabled=false;
|
||||
this.zkjeIsDisabled = false;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -128,6 +122,13 @@ class InvoiceCard extends Component {
|
|||
bodyAfterEvent.call(this, ...params)
|
||||
};
|
||||
|
||||
//批量粘贴编辑事件
|
||||
onBatchChange = (...params) => {
|
||||
console.log('onBatchChange-this:', this);
|
||||
console.log('onBatchChange-params:', params);
|
||||
batchEvents.call(this, ...params)
|
||||
};
|
||||
|
||||
//标题回退事件
|
||||
backBtnClick = (...params) => {
|
||||
backBtnClick.call(this, ...params)
|
||||
|
@ -149,7 +150,9 @@ class InvoiceCard extends Component {
|
|||
};
|
||||
|
||||
/** 列表选择事件 */
|
||||
listOnSelected = (...params) => { listOnSelected.call(this, ...params) };
|
||||
listOnSelected = (...params) => {
|
||||
listOnSelected.call(this, ...params)
|
||||
};
|
||||
// 确定指派
|
||||
getAssginUser = (value) => {
|
||||
this.assingUsers = value;
|
||||
|
@ -180,34 +183,38 @@ class InvoiceCard extends Component {
|
|||
//更新cache
|
||||
let cardData = getCacheById(pkBill, presetVar.dataSource);
|
||||
if (cardData) {
|
||||
cardData.head[presetVar.formAreaId].rows[0].values['saga_gtxid'] = { value: data.saga_gtxid }
|
||||
cardData.head[presetVar.formAreaId].rows[0].values['saga_status'] = { value: data.saga_status }
|
||||
cardData.head[presetVar.formAreaId].rows[0].values['saga_gtxid'] = {value: data.saga_gtxid}
|
||||
cardData.head[presetVar.formAreaId].rows[0].values['saga_status'] = {value: data.saga_status}
|
||||
updateCache(presetVar.pkname, pkBill, cardData, presetVar.formAreaId, presetVar.dataSource);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 税率说明弹窗单选切换事件
|
||||
handleRadioChange=(value)=>{
|
||||
handleRadioChange = (value) => {
|
||||
this.setState({
|
||||
selectedSLSMValue:value,
|
||||
isShowTips:value?false:true
|
||||
selectedSLSMValue: value,
|
||||
isShowTips: value ? false : true
|
||||
})
|
||||
}
|
||||
// 关闭税率说明弹窗
|
||||
closeModal=()=>{
|
||||
closeModal = () => {
|
||||
this.setState({
|
||||
selectedSLSMValue:'',
|
||||
showSlsmModal:false,
|
||||
isShowTips:false,
|
||||
slsmRadioOptions:[]//税率说明单选枚举值
|
||||
selectedSLSMValue: '',
|
||||
showSlsmModal: false,
|
||||
isShowTips: false,
|
||||
slsmRadioOptions: []//税率说明单选枚举值
|
||||
})
|
||||
}
|
||||
// 税率说明弹窗确认开票
|
||||
beSureBtnClick=()=>{confirmMakeInvoice.call(this, true)}
|
||||
|
||||
beSureBtnClick = () => {
|
||||
confirmMakeInvoice.call(this, true)
|
||||
}
|
||||
|
||||
// 侧拉删行后回调
|
||||
modelDelRow= ({...params})=> {bodyModelDelRow.call(this,{...params})}
|
||||
modelDelRow = ({...params}) => {
|
||||
bodyModelDelRow.call(this, {...params})
|
||||
}
|
||||
|
||||
render() {
|
||||
let multiLang = this.props.MutiInit.getIntl(presetVar.mutiLangCode);
|
||||
|
@ -218,7 +225,7 @@ class InvoiceCard extends Component {
|
|||
content: '',
|
||||
}
|
||||
};
|
||||
const { socket,modal: {createModal} } = this.props;
|
||||
const {socket, modal: {createModal}} = this.props;
|
||||
return [
|
||||
socket.connectMesg({
|
||||
headBtnAreaCode: presetVar.headBtnAreaId,
|
||||
|
@ -233,7 +240,7 @@ class InvoiceCard extends Component {
|
|||
// serverLocation: "172.16.86.11:8883"
|
||||
}),
|
||||
<BillStyle
|
||||
{...{className:'ssc-bill-card', ...this.props}}
|
||||
{...{className: 'ssc-bill-card', ...this.props}}
|
||||
approveDetail={{
|
||||
billtype: getBillType.call(this),
|
||||
billid: this.props.getUrlParam('pk_bill') == undefined ? this.props.getUrlParam('id') : this.props.getUrlParam('pk_bill'),
|
||||
|
@ -259,19 +266,19 @@ class InvoiceCard extends Component {
|
|||
ref={billHead => this.billHead = billHead}
|
||||
title={this.props.getSearchParam('n')}
|
||||
refreshButtonEvent={this.refresh}
|
||||
pageInfoConfig={this.props.getUrlParam('scene') == 'listTo'||this.props.getUrlParam('scene') == 'bz' ? {
|
||||
pageInfoConfig={this.props.getUrlParam('scene') == 'listTo' || this.props.getUrlParam('scene') == 'bz' ? {
|
||||
show: true,
|
||||
handlePageInfoChange: this.handlePageInfoChange,
|
||||
dataSource: presetVar.dataSource
|
||||
} : {
|
||||
show: false
|
||||
}}
|
||||
back={this.props.getUrlParam('scene') == 'listTo' && this.props.getUrlParam('status') == 'browse'||this.props.getUrlParam('scene') == 'bz' && this.props.getUrlParam('status') == 'browse' ? {
|
||||
show: false
|
||||
}}
|
||||
back={this.props.getUrlParam('scene') == 'listTo' && this.props.getUrlParam('status') == 'browse' || this.props.getUrlParam('scene') == 'bz' && this.props.getUrlParam('status') == 'browse' ? {
|
||||
showBack: this.state.showBack,
|
||||
listPagecode: presetVar.listPagecode
|
||||
} : {
|
||||
showBack: false
|
||||
}}
|
||||
showBack: false
|
||||
}}
|
||||
>
|
||||
<ButtonGroupListCard
|
||||
areaId={presetVar.headBtnAreaId}
|
||||
|
@ -294,25 +301,27 @@ class InvoiceCard extends Component {
|
|||
totalItemCode="xmjshj"
|
||||
modelSave={this.save}
|
||||
onAfterEvent={this.bodyAfterEvent}
|
||||
onBeforeEvent={(...params) => { bodyBeforeEvent.call(this, ...params) }}
|
||||
onBeforeEvent={(...params) => {
|
||||
bodyBeforeEvent.call(this, ...params)
|
||||
}}
|
||||
isAddRow={this.state.cardTableBodyIsAutoAdd}
|
||||
showCheck={true}
|
||||
adaptionHeight={true}
|
||||
onSelected={()=>{
|
||||
this.listOnSelected.call(this,presetVar.bodyAreaId,'cardBodyBtns')
|
||||
onSelected={() => {
|
||||
this.listOnSelected.call(this, presetVar.bodyAreaId, 'cardBodyBtns')
|
||||
}}
|
||||
onSelectedAll={()=>{
|
||||
this.listOnSelected.call(this,presetVar.bodyAreaId,'cardBodyBtns')
|
||||
onSelectedAll={() => {
|
||||
this.listOnSelected.call(this, presetVar.bodyAreaId, 'cardBodyBtns')
|
||||
}}
|
||||
selectedChange={()=>{
|
||||
this.listOnSelected.call(this,presetVar.bodyAreaId,'cardBodyBtns')
|
||||
selectedChange={() => {
|
||||
this.listOnSelected.call(this, presetVar.bodyAreaId, 'cardBodyBtns')
|
||||
}}
|
||||
otherAreaHeight={this.state.pagestatus == 'browse' ? 48 : 0}
|
||||
showToggleAngle={false}
|
||||
hideAdd={this.state.hideAdd}
|
||||
hideDel={this.state.hideDel}
|
||||
modelDelRow={this.modelDelRow}
|
||||
onBatchChange={() => { batchEvents.call(this) }}
|
||||
onBatchChange={this.onBatchChange}
|
||||
>
|
||||
<ButtonGroupListCard
|
||||
areaId={presetVar.cardBodyBtnAreaId}
|
||||
|
@ -320,7 +329,7 @@ class InvoiceCard extends Component {
|
|||
buttonEvent={this.tableHeadBtnClick}
|
||||
/>
|
||||
</CardTable>
|
||||
{this.state.specialInvoiceIsShow&&<CardTable
|
||||
{this.state.specialInvoiceIsShow && <CardTable
|
||||
areaId={presetVar.body2AreaId}
|
||||
// onAfterEvent={this.bodyAfterEvent}
|
||||
// onBeforeEvent={(...params) => { bodyBeforeEvent.call(this, ...params) }}
|
||||
|
@ -328,14 +337,14 @@ class InvoiceCard extends Component {
|
|||
showCheck={true}
|
||||
adaptionHeight={true}
|
||||
otherAreaHeight={this.state.pagestatus == 'browse' ? 48 : 0}
|
||||
onSelected={()=>{
|
||||
this.listOnSelected.call(this,presetVar.body2AreaId,'card2BodyBtns')
|
||||
onSelected={() => {
|
||||
this.listOnSelected.call(this, presetVar.body2AreaId, 'card2BodyBtns')
|
||||
}}
|
||||
onSelectedAll={()=>{
|
||||
this.listOnSelected.call(this,presetVar.body2AreaId,'card2BodyBtns')
|
||||
onSelectedAll={() => {
|
||||
this.listOnSelected.call(this, presetVar.body2AreaId, 'card2BodyBtns')
|
||||
}}
|
||||
selectedChange={()=>{
|
||||
this.listOnSelected.call(this,presetVar.body2AreaId,'card2BodyBtns')
|
||||
selectedChange={() => {
|
||||
this.listOnSelected.call(this, presetVar.body2AreaId, 'card2BodyBtns')
|
||||
}}
|
||||
showToggleAngle={false}
|
||||
>
|
||||
|
@ -358,11 +367,12 @@ class InvoiceCard extends Component {
|
|||
/> : ""}
|
||||
|
||||
{/* 附件组件 */}
|
||||
{this.state.pagestatus == 'browse' && <SimplifiedUploader billId={this.props.getUrlParam('id')} ref={simUp => this.simUp = simUp}
|
||||
changeVisStatus={() => {
|
||||
this.props.cardTable && this.props.cardTable.refresh(presetVar.bodyAreaId);
|
||||
}}
|
||||
/>}
|
||||
{this.state.pagestatus == 'browse' &&
|
||||
<SimplifiedUploader billId={this.props.getUrlParam('id')} ref={simUp => this.simUp = simUp}
|
||||
changeVisStatus={() => {
|
||||
this.props.cardTable && this.props.cardTable.refresh(presetVar.bodyAreaId);
|
||||
}}
|
||||
/>}
|
||||
{/* 导入导出 */}
|
||||
<ExcelOutput
|
||||
{...Object.assign(this.props)}
|
||||
|
@ -375,7 +385,7 @@ class InvoiceCard extends Component {
|
|||
pagecode={presetVar.cardPagecode}
|
||||
/>
|
||||
{/* 税率说明 */}
|
||||
{this.state.showSlsmModal&&<SlsmModal
|
||||
{this.state.showSlsmModal && <SlsmModal
|
||||
multiLang={multiLang}
|
||||
selectedSLSMValue={this.state.selectedSLSMValue}
|
||||
close={this.closeModal}
|
||||
|
|
Loading…
Reference in New Issue