fix:【antd】【erp 系统】tableData.value.findIndex((item) => item.id === row.id) 不正确的问题,使用 seq 比对

This commit is contained in:
YunaiV
2025-10-05 14:38:00 +08:00
parent c6bd38f98d
commit 98d7ed663f
12 changed files with 32 additions and 32 deletions

View File

@@ -65,7 +65,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {

View File

@@ -65,7 +65,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {

View File

@@ -71,7 +71,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -131,7 +131,7 @@ watch(
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpPurchaseInApi.PurchaseInItem) { function handleDelete(row: ErpPurchaseInApi.PurchaseInItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -151,7 +151,7 @@ const handleWarehouseChange = async (row: ErpPurchaseInApi.PurchaseInItem) => {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -67,7 +67,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -142,7 +142,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrderItem) { function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -169,7 +169,7 @@ async function handleProductChange(productId: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -71,7 +71,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -131,7 +131,7 @@ watch(
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpPurchaseReturnApi.PurchaseReturnItem) { function handleDelete(row: ErpPurchaseReturnApi.PurchaseReturnItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -153,7 +153,7 @@ const handleWarehouseChange = async (
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -67,7 +67,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -142,7 +142,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpSaleOrderApi.SaleOrderItem) { function handleDelete(row: ErpSaleOrderApi.SaleOrderItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -169,7 +169,7 @@ async function handleProductChange(productId: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -71,7 +71,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -131,7 +131,7 @@ watch(
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpSaleOutApi.SaleOutItem) { function handleDelete(row: ErpSaleOutApi.SaleOutItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -151,7 +151,7 @@ const handleWarehouseChange = async (row: ErpSaleOutApi.SaleOutItem) => {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -71,7 +71,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -131,7 +131,7 @@ watch(
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpSaleReturnApi.SaleReturnItem) { function handleDelete(row: ErpSaleReturnApi.SaleReturnItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -151,7 +151,7 @@ const handleWarehouseChange = async (row: ErpSaleReturnApi.SaleReturnItem) => {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -55,7 +55,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -106,7 +106,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpStockCheckApi.StockCheckItem) { function handleDelete(row: ErpStockCheckApi.StockCheckItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -164,7 +164,7 @@ function handleActualCountChange(actualCount: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -55,7 +55,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -105,7 +105,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpStockInApi.StockInItem) { function handleDelete(row: ErpStockInApi.StockInItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -150,7 +150,7 @@ async function handleProductChange(productId: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -55,7 +55,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -106,7 +106,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpStockMoveApi.StockMoveItem) { function handleDelete(row: ErpStockMoveApi.StockMoveItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -159,7 +159,7 @@ async function handleProductChange(productId: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {

View File

@@ -55,7 +55,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
autoResize: true, autoResize: true,
border: true, border: true,
rowConfig: { rowConfig: {
keyField: 'row_id', keyField: 'seq',
isHover: true, isHover: true,
}, },
pagerConfig: { pagerConfig: {
@@ -105,7 +105,7 @@ function handleAdd() {
/** 处理删除 */ /** 处理删除 */
function handleDelete(row: ErpStockOutApi.StockOutItem) { function handleDelete(row: ErpStockOutApi.StockOutItem) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index !== -1) { if (index !== -1) {
tableData.value.splice(index, 1); tableData.value.splice(index, 1);
} }
@@ -148,7 +148,7 @@ async function handleProductChange(productId: any, row: any) {
/** 处理行数据变更 */ /** 处理行数据变更 */
function handleRowChange(row: any) { function handleRowChange(row: any) {
const index = tableData.value.findIndex((item) => item.id === row.id); const index = tableData.value.findIndex((item) => item.seq === row.seq);
if (index === -1) { if (index === -1) {
tableData.value.push(row); tableData.value.push(row);
} else { } else {