开票申请卡片批量粘贴编辑事件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') {
|
||||
|
||||
/*if (!isManyCondition) {
|
||||
queryCondition = {def1: records[i].data.def1.value}
|
||||
}*/
|
||||
let rowKey = 'rowid';
|
||||
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) {
|
||||
let isExist = false;
|
||||
// 查找真正的index(解决筛选问题)
|
||||
allData.forEach((item, index) => {
|
||||
if (item[rowKey] === newValue[rowKey]) {
|
||||
isExist = true;
|
||||
if (allData[index].values.pk_org == 'a') {
|
||||
//若该单元格不可编辑则跳过
|
||||
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],
|
||||
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,
|
||||
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();
|
||||
}
|
||||
});*/
|
||||
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 {cardCache, createPage} from "nc-lightapp-front";
|
||||
import ExcelOutput from 'uap/common/components/ExcelOutput';
|
||||
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'
|
||||
|
@ -27,14 +26,9 @@ import SimplifiedUploader from 'ssccommon/platformcomponents/SimplifiedUploader'
|
|||
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) {
|
||||
|
@ -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;
|
||||
|
@ -204,10 +207,14 @@ class InvoiceCard extends Component {
|
|||
})
|
||||
}
|
||||
// 税率说明弹窗确认开票
|
||||
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);
|
||||
|
@ -294,7 +301,9 @@ 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}
|
||||
|
@ -312,7 +321,7 @@ class InvoiceCard extends Component {
|
|||
hideAdd={this.state.hideAdd}
|
||||
hideDel={this.state.hideDel}
|
||||
modelDelRow={this.modelDelRow}
|
||||
onBatchChange={() => { batchEvents.call(this) }}
|
||||
onBatchChange={this.onBatchChange}
|
||||
>
|
||||
<ButtonGroupListCard
|
||||
areaId={presetVar.cardBodyBtnAreaId}
|
||||
|
@ -358,7 +367,8 @@ class InvoiceCard extends Component {
|
|||
/> : ""}
|
||||
|
||||
{/* 附件组件 */}
|
||||
{this.state.pagestatus == 'browse' && <SimplifiedUploader billId={this.props.getUrlParam('id')} ref={simUp => this.simUp = simUp}
|
||||
{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);
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue