开票申请卡片批量粘贴编辑事件1
This commit is contained in:
parent
ffdba003e4
commit
68eb002138
|
@ -5,6 +5,7 @@
|
||||||
* @Last Modified by: mzr
|
* @Last Modified by: mzr
|
||||||
* @Last Modified time: 2025-05-07 16:30:44
|
* @Last Modified time: 2025-05-07 16:30:44
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import valueChange from "../common/valueChange";
|
import valueChange from "../common/valueChange";
|
||||||
|
|
||||||
const BATCHITEM = [
|
const BATCHITEM = [
|
||||||
|
@ -22,7 +23,8 @@ const BATCHITEM = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export default async function batchEvents(obj) {
|
export default async function batchEvents(obj) {
|
||||||
console.log(obj);
|
console.log('obj = ', obj);
|
||||||
|
//循环判断单元格是否可编辑,并注册过滤条件
|
||||||
let areaCode = obj.areaCode; //区域编码
|
let areaCode = obj.areaCode; //区域编码
|
||||||
let column = obj.column; //列信息
|
let column = obj.column; //列信息
|
||||||
let newValue = obj.newValue; //变更的行信息
|
let newValue = obj.newValue; //变更的行信息
|
||||||
|
@ -30,84 +32,65 @@ export default async function batchEvents(obj) {
|
||||||
let changedrows = obj.changedrows; //变更的信息,仅包含newValue和OldValue
|
let changedrows = obj.changedrows; //变更的信息,仅包含newValue和OldValue
|
||||||
let currentIndex = obj.currentIndex; //当前行
|
let currentIndex = obj.currentIndex; //当前行
|
||||||
let indexs = [];
|
let indexs = [];
|
||||||
let rows = [];
|
|
||||||
let attrcode = column.attrcode; //列code
|
let attrcode = column.attrcode; //列code
|
||||||
let queryCondition; //统一过滤的过滤条件
|
let queryCondition; //统一过滤的过滤条件
|
||||||
let isManyCondition = null; //是否多个过滤条件
|
let isManyCondition = false; //业务组判断,每行参展过滤条件是否不一样,如果不一样,值为true
|
||||||
let pasteData = obj.pasteData; //粘贴的值
|
let pasteData = obj.pasteData; //粘贴的值
|
||||||
|
// 表格粘贴前的所有行数据
|
||||||
|
let allData = obj.allData;
|
||||||
|
|
||||||
if (!BATCHITEM.includes(attrcode)) {
|
if (!BATCHITEM.includes(attrcode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (attrcode == 'def1') {
|
|
||||||
|
/*if (!isManyCondition) {
|
||||||
|
queryCondition = {def1: records[i].data.def1.value}
|
||||||
|
}*/
|
||||||
|
let rowKey = 'rowid';
|
||||||
for (let i = 0; i < newValue.length; i++) {
|
for (let i = 0; i < newValue.length; i++) {
|
||||||
//如果需求组织没有值就不允许编辑
|
let isExist = false;
|
||||||
if (!(newValue[i].values.pk_reqstoorg && newValue[i].values.pk_reqstoorg.value)) {
|
// 查找真正的index(解决筛选问题)
|
||||||
continue;
|
allData.forEach((item, index) => {
|
||||||
}
|
if (item[rowKey] === newValue[rowKey]) {
|
||||||
queryValue.push(newValue[i]);
|
isExist = true;
|
||||||
indexs[i] = currentIndex + i;
|
if (allData[index].values.pk_org == 'a') {
|
||||||
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;
|
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;
|
|
||||||
|
|
||||||
//执行业务的批量编辑后事件
|
if (allData[index].values.pk_org == 'b') {//若该单元可编辑
|
||||||
// valueChange.call(props, moduleId, key, newValue);
|
queryValue[i] = newValue[i]; //则保留
|
||||||
valueChange.call(props, moduleId, key, null, changedrows, index);
|
indexs.push(index);
|
||||||
/*let data = createBodyAfterEventData4BatchMore(
|
|
||||||
props,
|
//若为参照
|
||||||
PAGECODE.cardcode,
|
if (column.itemtype === 'refer' && isManyCondition) {
|
||||||
PAGECODE.cardhead,
|
//如果每个单元格的过滤条件不一致,则给每个单元格注册过滤条件
|
||||||
[PAGECODE.cardbody, PAGECODE.card_fee],
|
queryValue[i].queryCondition = {pk_org: records[i].data.def1.value}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// allData中没有找到,说明应该是新增的行
|
||||||
|
if (isExist) {
|
||||||
|
// 因为可以粘贴超过当前页面显示数据的行数,则会增行,如果该行还有其他的数据展示,需要业务组来处理,塞到queryValue中
|
||||||
|
// 比如 queryValue[i].values.行号={value:10}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//调用平台方法,更新数据
|
||||||
|
this.props.cardTable.updateAfterBatchChange({
|
||||||
areaCode,
|
areaCode,
|
||||||
attrcode,
|
attrcode,
|
||||||
|
queryValue,
|
||||||
changedrows,
|
changedrows,
|
||||||
indexs
|
column,
|
||||||
);
|
pasteData,
|
||||||
ajax({
|
indexs, //过滤后的index的数组例如:[0,1,2,3,5]
|
||||||
url: '/nccloud/pu/poordercard/cardbodyafterevent.do', //卡片表体编辑后事件
|
queryCondition, //如果是参照且参照过滤条件唯一就传,不一致就是前面说的,放到queryValue里
|
||||||
data: data,
|
isManyCondition,// true,代表有多个参照过滤条件,false表示只有一个
|
||||||
async: false,
|
}).then((res) => {
|
||||||
success: (res) => {
|
//res里的数据,暂时有props,changedrows,indexs
|
||||||
if (res.formulamsg && res.formulamsg instanceof Array && res.formulamsg.length > 0) {
|
//执行业务的批量编辑后事件
|
||||||
props.dealFormulamsg(
|
// afterEvent(this.props, areaCode, attrcode, queryValue, changerows);
|
||||||
res.formulamsg, //参数一:返回的公式对象
|
valueChange.call(this, areaCode, attrcode, newValue);
|
||||||
{
|
|
||||||
[PAGECODE.head_payment]: 'cardTable',
|
|
||||||
[PAGECODE.cardbody]: 'cardTable'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
processExtBillCardBodyEditResult4Batch(props, PAGECODE.cardbody, res.data, indexs);
|
|
||||||
this.forceUpdate();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/*ibwHuagm4SH5+rOVOaqHvq6PFvMIbflRwssh+yGUv2M=*/
|
/*ibwHuagm4SH5+rOVOaqHvq6PFvMIbflRwssh+yGUv2M=*/
|
||||||
import {Component} from "react";
|
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 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';
|
import ApprovalTrans from 'ssccommon/platformcomponents/ApprovalTrans';
|
||||||
const { getCacheById, updateCache } = cardCache;
|
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
import PubMessage from 'ssccommon/utils/pubMessage';
|
import PubMessage from 'ssccommon/utils/pubMessage';
|
||||||
import getBillType from './common/getBillType'
|
import getBillType from './common/getBillType'
|
||||||
|
@ -27,14 +26,9 @@ import SimplifiedUploader from 'ssccommon/platformcomponents/SimplifiedUploader'
|
||||||
import confirmMakeInvoice from './events/confirmMakeInvoice'
|
import confirmMakeInvoice from './events/confirmMakeInvoice'
|
||||||
import SlsmModal from '../common/components/slsmModal'
|
import SlsmModal from '../common/components/slsmModal'
|
||||||
|
|
||||||
import {
|
import {BillBody, BillHead, BillStyle, ButtonGroupListCard, CardTable, Form} from 'ssccommon/components/bill';
|
||||||
BillStyle,
|
|
||||||
BillHead,
|
const {getCacheById, updateCache} = cardCache;
|
||||||
BillBody,
|
|
||||||
Form,
|
|
||||||
CardTable,
|
|
||||||
ButtonGroupListCard
|
|
||||||
} from 'ssccommon/components/bill';
|
|
||||||
|
|
||||||
class InvoiceCard extends Component {
|
class InvoiceCard extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -128,6 +122,13 @@ class InvoiceCard extends Component {
|
||||||
bodyAfterEvent.call(this, ...params)
|
bodyAfterEvent.call(this, ...params)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//批量粘贴编辑事件
|
||||||
|
onBatchChange = (...params) => {
|
||||||
|
console.log('onBatchChange-this:', this);
|
||||||
|
console.log('onBatchChange-params:', params);
|
||||||
|
batchEvents.call(this, ...params)
|
||||||
|
};
|
||||||
|
|
||||||
//标题回退事件
|
//标题回退事件
|
||||||
backBtnClick = (...params) => {
|
backBtnClick = (...params) => {
|
||||||
backBtnClick.call(this, ...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) => {
|
getAssginUser = (value) => {
|
||||||
this.assingUsers = 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() {
|
render() {
|
||||||
let multiLang = this.props.MutiInit.getIntl(presetVar.mutiLangCode);
|
let multiLang = this.props.MutiInit.getIntl(presetVar.mutiLangCode);
|
||||||
|
@ -294,7 +301,9 @@ class InvoiceCard extends Component {
|
||||||
totalItemCode="xmjshj"
|
totalItemCode="xmjshj"
|
||||||
modelSave={this.save}
|
modelSave={this.save}
|
||||||
onAfterEvent={this.bodyAfterEvent}
|
onAfterEvent={this.bodyAfterEvent}
|
||||||
onBeforeEvent={(...params) => { bodyBeforeEvent.call(this, ...params) }}
|
onBeforeEvent={(...params) => {
|
||||||
|
bodyBeforeEvent.call(this, ...params)
|
||||||
|
}}
|
||||||
isAddRow={this.state.cardTableBodyIsAutoAdd}
|
isAddRow={this.state.cardTableBodyIsAutoAdd}
|
||||||
showCheck={true}
|
showCheck={true}
|
||||||
adaptionHeight={true}
|
adaptionHeight={true}
|
||||||
|
@ -312,7 +321,7 @@ class InvoiceCard extends Component {
|
||||||
hideAdd={this.state.hideAdd}
|
hideAdd={this.state.hideAdd}
|
||||||
hideDel={this.state.hideDel}
|
hideDel={this.state.hideDel}
|
||||||
modelDelRow={this.modelDelRow}
|
modelDelRow={this.modelDelRow}
|
||||||
onBatchChange={() => { batchEvents.call(this) }}
|
onBatchChange={this.onBatchChange}
|
||||||
>
|
>
|
||||||
<ButtonGroupListCard
|
<ButtonGroupListCard
|
||||||
areaId={presetVar.cardBodyBtnAreaId}
|
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={() => {
|
changeVisStatus={() => {
|
||||||
this.props.cardTable && this.props.cardTable.refresh(presetVar.bodyAreaId);
|
this.props.cardTable && this.props.cardTable.refresh(presetVar.bodyAreaId);
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue