供应商价目表批量粘贴
This commit is contained in:
parent
6eea784f7a
commit
e7afc353f4
|
@ -0,0 +1,273 @@
|
||||||
|
/*
|
||||||
|
* @Author: mzr
|
||||||
|
* @PageInfo: 供应商价目表批量粘贴编辑事件
|
||||||
|
* @Date: 2025-06-20
|
||||||
|
* @Last Modified by: mzr
|
||||||
|
* @Last Modified time: 2025-06-20
|
||||||
|
*/
|
||||||
|
import {ajax, base} from 'nc-lightapp-front';
|
||||||
|
import {
|
||||||
|
createGridAfterEventDataBatch4Excel, processGridEditResultBatchByCard
|
||||||
|
} from '../../../../../scmpub/scmpub/pub/tool/afterEditUtil';
|
||||||
|
import {URL, AREA, PAGECODE, PAGEID} from "../../constance";
|
||||||
|
import {RownoUtils} from "../../../../../scmpub/scmpub/pub/tool/editTableTools";
|
||||||
|
import {dateFormat} from "../../../../public";
|
||||||
|
import {getLangByResId} from "../../../../../scmpub/scmpub/pub/tool/multiLangUtil";
|
||||||
|
|
||||||
|
const BATCHITEM = [
|
||||||
|
'pk_supplier_v', // 供应商
|
||||||
|
'pk_supplier', // 供应商
|
||||||
|
'pk_org', // 组织
|
||||||
|
'pk_org_v', // 组织
|
||||||
|
'pk_material', // 物料
|
||||||
|
'pk_bizpsn', // 采购员
|
||||||
|
'pk_dept', // 采购部门
|
||||||
|
'corigcurrencyid', // 币种
|
||||||
|
'ftaxtypeflag', // 扣税类别
|
||||||
|
'vchangerate', // 换算率
|
||||||
|
'castunitid', // 单位
|
||||||
|
'ntaxrate', // 税率
|
||||||
|
'nastorigtaxprice', // 含税单价
|
||||||
|
'nastorigprice', // 无税单价
|
||||||
|
'dvaliddate', // 价格生效日期
|
||||||
|
'dinvaliddate', // 价格失效日期
|
||||||
|
'fpricesrctype', // 价格来源
|
||||||
|
'vbdef15', // 招标项目号
|
||||||
|
'vbdef16', // 比例
|
||||||
|
'vbdef17' // 备注
|
||||||
|
];
|
||||||
|
export default async function batchEvents(obj) {
|
||||||
|
// console.log('batchEvents-obj = ', obj);
|
||||||
|
// console.log('batchEvents-obj-record = ', obj.record);
|
||||||
|
let areaCode = obj.areaCode; //区域编码
|
||||||
|
let column = obj.column; //列信息
|
||||||
|
let newValue = obj.newValue; //变更的行信息
|
||||||
|
let queryValue = [];
|
||||||
|
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 pasteData = obj.pasteData; //粘贴的值
|
||||||
|
// 不在 BATCHITEM 里面的列,直接返回
|
||||||
|
if (!BATCHITEM.includes(attrcode) && !attrcode.startsWith('vbdef')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attrcode == 'pk_material') {
|
||||||
|
// 物料
|
||||||
|
} else if (attrcode == 'corigcurrencyid') {
|
||||||
|
// 币种
|
||||||
|
} else if (attrcode == 'pk_org') {
|
||||||
|
// 采购组织
|
||||||
|
} else if (attrcode == 'ntaxrate') {
|
||||||
|
// 税率
|
||||||
|
}
|
||||||
|
for (let i = 0; i < newValue.length; i++) {
|
||||||
|
queryValue.push(newValue[i]);
|
||||||
|
indexs[i] = currentIndex + i;
|
||||||
|
// rows[i] = [i];
|
||||||
|
}
|
||||||
|
this.props.cardTable
|
||||||
|
.updateAfterBatchChange({
|
||||||
|
areaCode, //区域code
|
||||||
|
column, //对应的列,可直接使用上面获取到的column对象
|
||||||
|
indexs, //满足并需要处理的行(可能存在第一行允许编辑,第二行不允许编辑的场景,所以indexs数组中的行数并不一定与粘贴的行数相等))
|
||||||
|
queryValue, //与indexs对应的行数据数组(包含前过滤条件)
|
||||||
|
changedrows, //变更行的数组(仅有newValue与oldValue)
|
||||||
|
pasteData, //粘贴的具体内容,对于参照类型的列,此字段必传,不然无法翻译
|
||||||
|
queryCondition, //该列统一的前过滤条件,比如物料都是根据表头主组织进行过滤
|
||||||
|
isManyCondition //是否多个过滤条件,如物料都根据表头主组织进行过滤,此参数传false,如表体的部门根据表体的某个组织过滤,此参数传true
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
let props = res.props;
|
||||||
|
changedrows = res.changedrows;
|
||||||
|
indexs = res.indexs || [];
|
||||||
|
// console.log('batchEvents-res:', res);
|
||||||
|
// console.log('batchEvents-indexs:', indexs);
|
||||||
|
//执行业务的批量编辑后事件
|
||||||
|
batchUpdateData(props, areaCode, attrcode, changedrows, indexs, queryValue);
|
||||||
|
/* for (let i = 0; i < changedrows.length; i++) {
|
||||||
|
// let changedrow = changedrows[i];
|
||||||
|
// console.log('batchEvents-changedrow = ', changedrow);
|
||||||
|
postEvent(props, areaCode, attrcode, null, changedrows, null, i);
|
||||||
|
} */
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量编辑后事件
|
||||||
|
function batchUpdateData(props, areaCode, attrcode, changedrows, indexs, queryValue) {
|
||||||
|
/*let rows = props.editTable.getAllRows(areaCode, false);
|
||||||
|
if (changedrows.length > rows.length) {
|
||||||
|
let num = changedrows.length - rows.length;
|
||||||
|
for (let i = 0; i < num; i++) {
|
||||||
|
let _this = this;
|
||||||
|
addRow1(props, _this);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
let data = createGridAfterEventDataBatch4Excel(props, PAGECODE.listPagecode, AREA.listTable,//区域编码
|
||||||
|
areaCode, attrcode, changedrows, indexs, null, queryValue, '');
|
||||||
|
console.log('data = ', data);
|
||||||
|
ajax({
|
||||||
|
url: URL.afterEdit, data: data, async: false, success: (res) => {
|
||||||
|
if (res && res.data && res.data.listTable) {
|
||||||
|
let dataRows = res.data[AREA.listTable].rows;
|
||||||
|
console.log('dataRows = ', dataRows);
|
||||||
|
processResultBatchByCard(props, AREA.listTable, dataRows, indexs)
|
||||||
|
}
|
||||||
|
// props.editTable.setStatus(AREA.listTable, 'edit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function processResultBatchByCard(props, moduleId, rows, indexs) {
|
||||||
|
// debugger;
|
||||||
|
if (rows && rows.length > 0) {
|
||||||
|
let insertArray = [];
|
||||||
|
let updateArray = [];
|
||||||
|
let allRows = props.editTable.getAllRows(moduleId);
|
||||||
|
let i = allRows.length;
|
||||||
|
for (let j = 0; j < rows.length; j++) {
|
||||||
|
let row = rows[j];
|
||||||
|
let obj = {index: indexs[j], data: row};
|
||||||
|
if (indexs[j] < i) {
|
||||||
|
updateArray.push(obj);
|
||||||
|
} else {
|
||||||
|
insertArray.push(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateArray.length > 0) {
|
||||||
|
props.editTable.updateDataByIndexs(moduleId, updateArray);
|
||||||
|
if (insertArray.length > 0) {
|
||||||
|
let updateRow = updateArray[0].data;
|
||||||
|
for (let i = 0; i < insertArray.length; i++) {
|
||||||
|
let row = insertArray[i].data;
|
||||||
|
row.values.norigtaxprice = updateRow.values.norigtaxprice;
|
||||||
|
row.values.ftaxtypeflag = updateRow.values.ftaxtypeflag;
|
||||||
|
row.values.bsc = updateRow.values.bsc;
|
||||||
|
row.values.bsc = updateRow.values.bsc;
|
||||||
|
row.values.ntransportmny = updateRow.values.ntransportmny;
|
||||||
|
row.values.dvaliddate = updateRow.values.dvaliddate;
|
||||||
|
row.values.corigcurrencyid = updateRow.values.corigcurrencyid;
|
||||||
|
row.values.bcanorder = updateRow.values.bcanorder;
|
||||||
|
row.values.tcreatetime = updateRow.values.tcreatetime;
|
||||||
|
row.values.pk_org = updateRow.values.pk_org;
|
||||||
|
row.values.pk_org_v = updateRow.values.pk_org_v;
|
||||||
|
row.values.ninsurance = updateRow.values.ninsurance;
|
||||||
|
row.values.fpricesrctype = updateRow.values.fpricesrctype;
|
||||||
|
row.values.nastorigtaxprice = updateRow.values.nastorigtaxprice;
|
||||||
|
row.values.norigprice = updateRow.values.norigprice;
|
||||||
|
// row.crowno = updateRow.values.crowno;
|
||||||
|
row.values.nastorigprice = updateRow.values.nastorigprice;
|
||||||
|
row.values.nimpost = updateRow.values.nimpost;
|
||||||
|
row.values.ntaxrate = updateRow.values.ntaxrate; //税率
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (insertArray.length > 0) {
|
||||||
|
props.editTable.insertDataByIndexs(moduleId, insertArray, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单个编辑后事件
|
||||||
|
function postEvent(props, moduleId, key, value, changedrows, record, index) {
|
||||||
|
let changedrow = changedrows[index];
|
||||||
|
let event = props.createGridAfterEventData(PAGEID, AREA.listTable, moduleId, key, changedrows);
|
||||||
|
console.log('rows1 = ', event.grid[AREA.listTable].rows);
|
||||||
|
/* event.grid[AREA.listTable].rows = event.grid[AREA.listTable].rows.filter((row) => {
|
||||||
|
return row.rowid == changedrow.rowid;
|
||||||
|
}); */
|
||||||
|
event.grid[AREA.listTable].rows = [changedrow];
|
||||||
|
event.changedrows = [changedrow];
|
||||||
|
console.log('event = ', event);
|
||||||
|
ajax({
|
||||||
|
method: 'POST', url: URL.afterEdit, data: event, async: false, success: (res) => {
|
||||||
|
if (res && res.data && res.data.listTable) {
|
||||||
|
if (index == 0) {
|
||||||
|
props.editTable.updateDataByIndexs(AREA.listTable, [{
|
||||||
|
index: index,
|
||||||
|
data: res.data[AREA.listTable].rows[0]
|
||||||
|
}]);
|
||||||
|
} else if (index > 0) {
|
||||||
|
props.editTable.insertDataByIndexs(AREA.listTable, [{
|
||||||
|
index: index,
|
||||||
|
data: res.data[AREA.listTable].rows[0]
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
props.editTable.setStatus(AREA.listTable, 'edit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function batchUpdateData1(props, areaCode, attrcode, changedrows, indexs, queryValue) {
|
||||||
|
let data = createGridAfterEventDataBatch4Excel(props, PAGECODE.listPagecode, AREA.listTable,//区域编码
|
||||||
|
areaCode, attrcode, changedrows, indexs, null, queryValue, '');
|
||||||
|
// console.log('data = ', data);
|
||||||
|
let rows = data.grid[AREA.listTable].rows;
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
let row = rows[i];
|
||||||
|
let data1 = data;
|
||||||
|
data1.grid[AREA.listTable].rows = [row];
|
||||||
|
data1.changedrows = changedrows.filter((changedrow) => {
|
||||||
|
return changedrow.rowid == row.rowid;
|
||||||
|
});
|
||||||
|
ajax({
|
||||||
|
url: URL.afterEdit, data: data1, async: false, success: (res) => {
|
||||||
|
if (res && res.data && res.data.listTable) {
|
||||||
|
let dataRows = res.data[AREA.listTable].rows;
|
||||||
|
console.log('dataRows = ', dataRows);
|
||||||
|
// processGridEditResultBatchByCard(props, AREA.listTable, dataRows, indexs)
|
||||||
|
if (i == 0) {
|
||||||
|
props.editTable.updateDataByIndexs(AREA.listTable, [{
|
||||||
|
index: i,
|
||||||
|
data: dataRows[0]
|
||||||
|
}]);
|
||||||
|
} else if (i > 0) {
|
||||||
|
props.editTable.insertDataByIndexs(AREA.listTable, [{
|
||||||
|
index: i,
|
||||||
|
data: dataRows[0]
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// props.editTable.setStatus(AREA.listTable, 'edit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function addRow1(props, _this) {
|
||||||
|
let row = props.editTable.getNumberOfRows(AREA.listTable);
|
||||||
|
props.editTable.addRow(AREA.listTable, undefined, true);
|
||||||
|
RownoUtils.setRowNoByIndex(props, AREA.listTable, 'crowno', row);
|
||||||
|
let defaultKey = ['pk_org', 'pk_org_v', 'pk_group', 'corigcurrencyid', 'tcreatetime'];
|
||||||
|
/* defaultKey.forEach((key) => {
|
||||||
|
props.editTable.setValByKeyAndIndex(AREA.listTable, row, key, props.state.defaultVO.values[key]);
|
||||||
|
});*/
|
||||||
|
//设置自制 生效时间 生成时间
|
||||||
|
dateFormat();
|
||||||
|
let time = new Date();
|
||||||
|
|
||||||
|
props.editTable.setValByKeyAndIndex(AREA.listTable, row, 'dvaliddate', {
|
||||||
|
value: time.Format('yyyy-MM-dd') + ' 00:00:00',
|
||||||
|
display: time.Format('yyyy-MM-dd')
|
||||||
|
});
|
||||||
|
props.editTable.setValByKeyAndIndex(AREA.listTable, row, 'tcreatetime', {
|
||||||
|
value: time.Format('yyyy-MM-dd hh:mm:ss'),
|
||||||
|
display: time.Format('yyyy-MM-dd')
|
||||||
|
});
|
||||||
|
props.editTable.setValByKeyAndIndex(AREA.listTable, row, 'ftaxtypeflag', {
|
||||||
|
value: '1',
|
||||||
|
display: getLangByResId(props, '4005SUPPLIERPRICE-000007')
|
||||||
|
}); /* 国际化处理: 应税外加*/
|
||||||
|
props.editTable.setValByKeyAndIndex(AREA.listTable, row, 'fpricesrctype', {
|
||||||
|
value: '3',
|
||||||
|
display: getLangByResId(props, '4005SUPPLIERPRICE-000008')
|
||||||
|
}); /* 国际化处理: 自制*/
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
/*wcAyGzXIuLMPKe72bAn4f72BcH03jamWKj7p/ELKGtY=*/
|
/*wcAyGzXIuLMPKe72bAn4f72BcH03jamWKj7p/ELKGtY=*/
|
||||||
import afterEvent from './afterEvent';
|
import afterEvent from './afterEvent';
|
||||||
import beforeEvent from './beforeEvent';
|
import beforeEvent from './beforeEvent';
|
||||||
|
import batchEvents from './batchEvents';
|
||||||
|
|
||||||
export { afterEvent, beforeEvent };
|
export {afterEvent, beforeEvent, batchEvents};
|
||||||
|
|
||||||
/*wcAyGzXIuLMPKe72bAn4f72BcH03jamWKj7p/ELKGtY=*/
|
/*wcAyGzXIuLMPKe72bAn4f72BcH03jamWKj7p/ELKGtY=*/
|
|
@ -9,7 +9,7 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { createPage, ajax, base, toast, high } from 'nc-lightapp-front';
|
import { createPage, ajax, base, toast, high } from 'nc-lightapp-front';
|
||||||
import { afterEvent, beforeEvent } from './events';
|
import { afterEvent, beforeEvent, batchEvents } from './events';
|
||||||
import { searchBtnClick, buttonClick } from './btnClicks';
|
import { searchBtnClick, buttonClick } from './btnClicks';
|
||||||
import { initTemplate } from './init';
|
import { initTemplate } from './init';
|
||||||
import { URL, AREA, ROOT, BUTTONAREA, ALLBUTTONS, EDITBUTTONS, BROWSEBUTTONS, PAGEID } from '../constance';
|
import { URL, AREA, ROOT, BUTTONAREA, ALLBUTTONS, EDITBUTTONS, BROWSEBUTTONS, PAGEID } from '../constance';
|
||||||
|
@ -20,7 +20,6 @@ import { initLang, getLangByResId } from '../../../../scmpub/scmpub/pub/tool/mul
|
||||||
import { RownoUtils } from '../../../../scmpub/scmpub/pub/tool/editTableTools';
|
import { RownoUtils } from '../../../../scmpub/scmpub/pub/tool/editTableTools';
|
||||||
import { createListTitle } from '../../../../scmpub/scmpub/pub/tool/titleUtil.js';
|
import { createListTitle } from '../../../../scmpub/scmpub/pub/tool/titleUtil.js';
|
||||||
import ExcelOutput from 'uap/common/components/ExcelOutput';
|
import ExcelOutput from 'uap/common/components/ExcelOutput';
|
||||||
import batchEvents from "./events/batchEvents";
|
|
||||||
const { NCDiv } = base;
|
const { NCDiv } = base;
|
||||||
const { Refer } = high;
|
const { Refer } = high;
|
||||||
let { ReferLoader } = Refer;
|
let { ReferLoader } = Refer;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*FySM9m52dyc0CNE1ub/NjqwTZObl3Z33zFvvtgOfkGA=*/
|
/*FySM9m52dyc0CNE1ub/Njssl5RAOO1Y+FpFm185ElhI=*/
|
||||||
/*
|
/*
|
||||||
* @PageInfo: 编辑后工具类
|
* @PageInfo: 编辑后工具类
|
||||||
* @Author: guozhq
|
* @Author: guozhq
|
||||||
|
@ -6,8 +6,7 @@
|
||||||
* @Last Modified by: wangpju
|
* @Last Modified by: wangpju
|
||||||
* @Last Modified time: yyyy-09-Th 06:33:50
|
* @Last Modified time: yyyy-09-Th 06:33:50
|
||||||
*/
|
*/
|
||||||
import { simplifyData, simplifyDataByFields } from './simplifyDataUtil';
|
import {simplifyData, simplifyDataByFields} from './simplifyDataUtil';
|
||||||
import { object } from 'prop-types';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主子表表体编辑后事件结果集处理
|
* 主子表表体编辑后事件结果集处理
|
||||||
|
@ -1078,6 +1077,181 @@ function processExtBillCardHeadEditResult(props, formAreaCode, tableAreaCodes, d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建表格编辑后事件数据结构(批处理)
|
||||||
|
* @param {*} props
|
||||||
|
* @param {*} pageCode 页面编码
|
||||||
|
* @param {*} areaCode 区域编码
|
||||||
|
* @param {*} moduleId
|
||||||
|
* @param {*} key
|
||||||
|
* @param {*} changedrows
|
||||||
|
* @param {*} indexs
|
||||||
|
* @param {*} userobject
|
||||||
|
* @param {*} queryValue
|
||||||
|
* @param {*} addlinekeys
|
||||||
|
*/
|
||||||
|
function createGridAfterEventDataBatch4Excel(
|
||||||
|
props,
|
||||||
|
pageCode,
|
||||||
|
areaCode,
|
||||||
|
moduleId,
|
||||||
|
key,
|
||||||
|
changedrows,
|
||||||
|
indexs,
|
||||||
|
userobject,
|
||||||
|
queryValue,
|
||||||
|
addlinekeys
|
||||||
|
) {
|
||||||
|
let meta = props.meta.getMeta();
|
||||||
|
let rows = props.cardTable.getAllRows(areaCode, false);
|
||||||
|
if (rows.length == 0) {
|
||||||
|
rows = props.editTable.getAllRows(areaCode, false);
|
||||||
|
}
|
||||||
|
// let rows1 = props.cardTable.getAllData(areaCode);
|
||||||
|
// console.log('rows', rows1);
|
||||||
|
let lines = [];
|
||||||
|
let newRows = [];
|
||||||
|
let changerRows = [];
|
||||||
|
let grid = {
|
||||||
|
templetid: meta.pageid,
|
||||||
|
pageid: pageCode,
|
||||||
|
[areaCode]: {
|
||||||
|
areaType: 'table',
|
||||||
|
areacode: areaCode,
|
||||||
|
rows: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let changerowsMap = new Map();
|
||||||
|
changedrows.forEach((value) => {
|
||||||
|
changerowsMap.set(value.rowid, value);
|
||||||
|
});
|
||||||
|
if (addlinekeys.includes(key)) {
|
||||||
|
grid[areaCode].rows = queryValue;
|
||||||
|
for (let i = 0; i < indexs.length; i++) {
|
||||||
|
lines.push(i + '');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < indexs.length; i++) {
|
||||||
|
if (rows[indexs[i]]) {
|
||||||
|
newRows[i] = rows[indexs[i]];
|
||||||
|
lines.push(i + '');
|
||||||
|
if (changerowsMap.has(newRows[i].rowid)) {
|
||||||
|
changerRows.push(changerowsMap.get(newRows[i].rowid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines.forEach((index) => {
|
||||||
|
grid[areaCode].rows.push(newRows[index]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 减少上行流量
|
||||||
|
grid[areaCode] = simplifyData(grid[areaCode]);
|
||||||
|
return {
|
||||||
|
attrcode: key,
|
||||||
|
changedrows: changedrows,
|
||||||
|
grid: grid,
|
||||||
|
index: 0,
|
||||||
|
indexs: lines,
|
||||||
|
userobject: userobject
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建表格编辑后事件数据结构(cardTable处理)
|
||||||
|
* @param {*} props
|
||||||
|
* @param {*} pageCode 页面编码
|
||||||
|
* @param {*} areaCode 区域编码
|
||||||
|
* @param {*} moduleId
|
||||||
|
* @param {*} key
|
||||||
|
* @param {*} changedrows
|
||||||
|
* @param {*} indexs
|
||||||
|
* @param {*} userobject
|
||||||
|
*/
|
||||||
|
function createGridAfterEventDataBatchByCard(
|
||||||
|
props,
|
||||||
|
pageCode,
|
||||||
|
areaCode,
|
||||||
|
moduleId,
|
||||||
|
key,
|
||||||
|
changedrows,
|
||||||
|
indexs,
|
||||||
|
userobject
|
||||||
|
) {
|
||||||
|
let meta = props.meta.getMeta();
|
||||||
|
let rows = props.cardTable.getAllRows(areaCode, false);
|
||||||
|
let lines = [];
|
||||||
|
let newRows = [];
|
||||||
|
let changerRows = [];
|
||||||
|
let grid = {
|
||||||
|
templetid: meta.pageid,
|
||||||
|
pageid: pageCode,
|
||||||
|
[areaCode]: {
|
||||||
|
areaType: 'table',
|
||||||
|
areacode: areaCode,
|
||||||
|
rows: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let changerowsMap = new Map();
|
||||||
|
changedrows.forEach((value) => {
|
||||||
|
changerowsMap.set(value.rowid, value);
|
||||||
|
});
|
||||||
|
for (let i = 0; i < indexs.length; i++) {
|
||||||
|
if (rows[indexs[i]]) {
|
||||||
|
newRows[i] = rows[indexs[i]];
|
||||||
|
lines.push(i + '');
|
||||||
|
if (changerowsMap.has(newRows[i].rowid)) {
|
||||||
|
changerRows.push(changerowsMap.get(newRows[i].rowid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines.forEach((index) => {
|
||||||
|
grid[areaCode].rows.push(newRows[index]);
|
||||||
|
});
|
||||||
|
// 减少上行流量
|
||||||
|
grid[areaCode] = simplifyData(grid[areaCode]);
|
||||||
|
return {
|
||||||
|
attrcode: key,
|
||||||
|
changedrows: changerRows,
|
||||||
|
grid: grid,
|
||||||
|
index: 0,
|
||||||
|
indexs: lines,
|
||||||
|
userobject: userobject
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理表格编辑后事件结果(cardtable处理)
|
||||||
|
* @param {*} props
|
||||||
|
* @param {*} moduleId
|
||||||
|
* @param {*} rows
|
||||||
|
* @param {*} indexs
|
||||||
|
*/
|
||||||
|
function processGridEditResultBatchByCard(props, moduleId, rows, indexs) {
|
||||||
|
// debugger;
|
||||||
|
if (rows && rows.length > 0) {
|
||||||
|
let insertArray = [];
|
||||||
|
let updateArray = [];
|
||||||
|
let allRows = props.editTable.getAllRows(moduleId);
|
||||||
|
let i = allRows.length;
|
||||||
|
for (let j = 0; j < rows.length; j++) {
|
||||||
|
let row = rows[j];
|
||||||
|
let obj = { index: indexs[j], data: row };
|
||||||
|
if (indexs[j] < i) {
|
||||||
|
updateArray.push(obj);
|
||||||
|
} else {
|
||||||
|
insertArray.push(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateArray.length > 0) {
|
||||||
|
props.editTable.updateDataByIndexs(moduleId, updateArray);
|
||||||
|
}
|
||||||
|
if (insertArray.length > 0) {
|
||||||
|
props.editTable.insertDataByIndexs(moduleId, insertArray, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
createGridAfterEventData,
|
createGridAfterEventData,
|
||||||
createBodyAfterEventData,
|
createBodyAfterEventData,
|
||||||
|
@ -1100,7 +1274,10 @@ export {
|
||||||
createBodyAfterEventData4BatchMore,
|
createBodyAfterEventData4BatchMore,
|
||||||
processExtBillCardBodyEditResult4Batch,
|
processExtBillCardBodyEditResult4Batch,
|
||||||
createBodyAfterEventData4BatchHasSon,
|
createBodyAfterEventData4BatchHasSon,
|
||||||
processBillCardBodyEditResultNotAddRowForSO
|
processBillCardBodyEditResultNotAddRowForSO,
|
||||||
|
createGridAfterEventDataBatch4Excel,
|
||||||
|
createGridAfterEventDataBatchByCard,
|
||||||
|
processGridEditResultBatchByCard
|
||||||
};
|
};
|
||||||
|
|
||||||
/*FySM9m52dyc0CNE1ub/NjqwTZObl3Z33zFvvtgOfkGA=*/
|
/*FySM9m52dyc0CNE1ub/Njssl5RAOO1Y+FpFm185ElhI=*/
|
Loading…
Reference in New Issue