bug修改

This commit is contained in:
cookiemy 2024-07-04 14:21:40 +08:00
parent 3e03b110e9
commit 4c820468b7
11 changed files with 1115 additions and 789 deletions

View File

@ -185,7 +185,6 @@
<el-input @blur="ChangeShop(row)" v-model="row.productCode" />
<div style="display: flex; align-items: center">
<el-popover
:visible="visible"
v-model="row.popoverVisible"
placement="bottom"
trigger="click"
@ -785,8 +784,9 @@ export default {
filePaths.push(file.filePath);
}
self.fileLists = filePaths;
console.log(self.fileLists, "self.fileLists");
let params = self.searchForm;
params.fileList = self.fileLists;
params.billItemList = billItemList;
console.log(params, "params");
self.loading = true;
@ -1026,33 +1026,6 @@ export default {
}
return sums;
},
// getSummarys({ columns, data }) {
// let sums = [];
// let totalPrice = 0;
// // ''
// sums.push("");
// columns.forEach((column, index) => {
// if (
// column.property == "purchaseMoney" ||
// column.property == "otherMoney" ||
// column.property == "allPrice"
// ) {
// const values = data.map((item) => Number(item[column.property]));
// const sum = values.reduce((prev, curr) => prev + curr, 0);
// sums[index] = sum; //
// if (column.property === "allPrice") {
// totalPrice = sum; // totalPrice
// }
// } else {
// sums.push(""); //
// }
// });
// this.totalPrices = totalPrice;
// console.log(this.totalPrices, "this.totalPrices");
// localStorage.setItem("totalPriced", this.totalPrices);
// this.searchForm.totalPrice = localStorage.getItem("totalPriced");
// return sums;
// },
getSummary({ columns, data }) {
let sums = [];
let totalPrice = 0;

View File

@ -9,7 +9,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -292,26 +291,35 @@
<el-row :gutter="20" class="mt12">
<el-col :span="24">
<div class="form-item-container">
<label class="form-item-label"
>图片/附件
<el-button size="small" type="primary" icon="UploadFilled"
>点击上传</el-button
></label
>
<label class="form-item-label">图片/附件 </label>
<div class="form-item-content1">
<div class="content-box">
<el-form-item label="">
<div class="content-box-container">
<el-image
style="
width: 48px;
height: 48px;
margin-right: 12px;
"
src="/static/imgs/logo.png"
preview-src-list="[/static/imgs/logo.png]"
<el-form-item label="" :label-width="formLabelWidth">
<div class="draggable-list">
<draggable
class="wrapper"
v-model="searchForm.fileList"
>
</el-image>
<template #item="{ element, index }">
<div class="item">
<img v-img-url="element.filePath" />
<a
href="javascript:void(0);"
class="delete-btn"
@click.stop="deleteImg(index)"
>
<el-icon>
<CloseBold />
</el-icon>
</a>
</div>
</template>
</draggable>
<div class="item img-select" @click="openUpload">
<el-icon>
<Plus />
</el-icon>
</div>
</div>
</el-form-item>
</div>
@ -605,21 +613,39 @@ export default {
this.type = e;
this.isupload = true;
},
deleteImg(index) {
this.searchForm.imageList.splice(index, 1);
},
/*获取图片*/
returnImgsFunc(e) {
if (e != null && e.length > 0) {
for (let img of e) {
if (!this.searchForm.fileList) {
this.searchForm.fileList = [];
console.log(this.searchForm);
if (e != null) {
let imgs = this.searchForm.fileList.concat(e);
this.searchForm.fileList = imgs;
//
for (let i = 0; i < imgs.length; i++) {
if (typeof imageId == "undefined") {
imgs[i].imageId = imgs[i].fileId;
}
this.searchForm.fileList.push({
fileId: img.fileId,
filePath: img.filePath,
});
}
}
this.isupload = false;
console.log(this.searchForm.fileList, "this.searchForm.fileList ");
},
// returnImgsFunc(e) {
// if (e != null && e.length > 0) {
// for (let img of e) {
// if (!this.searchForm.fileList) {
// this.searchForm.fileList = [];
// }
// this.searchForm.fileList.push({
// fileId: img.fileId,
// filePath: img.filePath,
// });
// }
// }
// this.isupload = false;
// },
},
};
</script>

View File

@ -99,7 +99,8 @@
border
style="width: 100%"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
@row-click="handleRowClicks"
@row-dblclick="handleRowClick"
v-loading="loading"
show-summary
:summary-method="getSummarys"
@ -119,35 +120,57 @@
label="提醒"
width="100"
></el-table-column>
<!-- <el-table-column
prop="otherUnit"
label="订单标记"
width="100"
></el-table-column> -->
<!-- <el-table-column
prop="otherUnit"
label="剩余发货时间"
width="100"
></el-table-column> -->
<el-table-column
prop="availableAllNumber"
label="商品总数"
></el-table-column>
<el-table-column prop="fileUrls" label="系统图片">
<el-table-column prop="fileUrls" width="200" label="系统图片">
<template #default="scope">
<el-image
style="width: 50px; height: 50px"
:src="scope.row.fileUrls"
:preview-src-list="[scope.row.fileUrls]"
></el-image>
<el-popover placement="right-start" trigger="hover" width="24">
<template #reference>
<div v-if="scope.row.fileList && scope.row.fileList.length > 0">
<el-avatar
v-for="(file, index) in scope.row.fileList"
:key="index"
shape="square"
style="margin-bottom: 5px; margin-left: 5px"
:size="24"
:src="file"
/>
</div>
<div v-else>
<el-avatar
:size="24"
style="margin-left: 10px"
shape="square"
src="/static/imgs/imagerror.png"
/>
</div>
</template>
<template #default>
<div v-if="scope.row.fileList && scope.row.fileList.length > 0">
<el-avatar
v-for="(file, index) in scope.row.fileList"
:key="index"
:size="100"
style="margin-left: 20px"
shape="square"
:src="file"
/>
</div>
<div v-else>
<el-avatar
:size="24"
style="margin-left: 20px"
shape="square"
src="/static/imgs/imagerror.png"
/>
</div>
</template>
</el-popover>
</template>
</el-table-column>
<!-- <el-table-column prop="codeNum" label="商品概况"></el-table-column> -->
<el-table-column prop="remark" label="系统备注"></el-table-column>
<!-- <el-table-column
prop="codeNum"
label="买家留言/附加信息"
></el-table-column> -->
<el-table-column
prop="depotName"
label="仓库"
@ -484,6 +507,9 @@ export default {
},
},
methods: {
isRootNode(row) {
return row.billItemList;
},
getSelectData() {
SettingApi.regionList().then((res) => {
this.areaData = res.data;
@ -513,7 +539,14 @@ export default {
handleDeliveryChange(row) {
this.getselect(row);
},
handleRowClicks() {
ElNotification({
type: "info",
title: "提示",
message: "双击列表行查看详情",
duration: 1000,
});
},
/*保存备注信息*/
editRemark() {
let self = this;

View File

@ -9,7 +9,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -203,10 +202,10 @@
</el-table-column>
<el-table-column prop="commodityDecimal" label="吊牌价" width="100">
</el-table-column>
<el-table-column prop="unitPrice" label="单价" width="100"
<el-table-column prop="purchaseDecimal" label="单价" width="100"
><template #default="{ row }">
<el-input
v-model="row.unitPrice"
v-model="row.purchaseDecimal"
label="单价"
@blur="handleUnitPriceChange(row)"
/>
@ -504,7 +503,7 @@ export default {
row.discountRate = 100;
}
//
row.discountPrice = (row.unitPrice * row.discountRate) / 100;
row.discountPrice = (row.purchaseDecimal * row.discountRate) / 100;
//
if (row.discountPrice && row.operNumber) {
@ -515,7 +514,7 @@ export default {
},
handleUnitPriceChange(row) {
//
row.discountPrice = (row.unitPrice * row.discountRate) / 100;
row.discountPrice = (row.purchaseDecimal * row.discountRate) / 100;
//
if (row.discountPrice && row.operNumber) {
@ -529,7 +528,9 @@ export default {
localStorage.setItem("costPrice", row.costPrice);
row.operNumber = 1; // 1
// 1
row.unitPrice = row.costPrice || 1;
if (!row.purchaseDecimal) {
row.purchaseDecimal = row.costPrice || 1;
}
row.discountRate = row.discountRate || 100;
row.purchaseCycle = row.purchaseCycle || 0;
//
@ -546,7 +547,7 @@ export default {
}
if (row.materialUnit == row.productUnit.basicUnit) {
row.basicNumber = row.operNumber * 1;
row.unitPrice = row.unitPrice * 1;
row.purchaseDecimal = row.purchaseDecimal * 1;
this.handleUnitPriceChange(row);
} else {
const deputyUnit = row.productUnit.deputyList.find(
@ -554,7 +555,7 @@ export default {
);
if (deputyUnit) {
row.basicNumber = row.operNumber * deputyUnit.ratio;
row.unitPrice = row.unitPrice * deputyUnit.ratio;
row.purchaseDecimal = row.purchaseDecimal * deputyUnit.ratio;
this.handleUnitPriceChange(row);
}
}
@ -689,7 +690,7 @@ export default {
materialUnit: option.materialUnit,
operNumber: option.operNumber,
basicNumber: option.basicNumber,
unitPrice: option.unitPrice,
purchaseDecimal: option.purchaseDecimal,
discountRate: option.discountRate,
discountPrice: option.discountPrice,
allPrice: option.allPrice,

View File

@ -9,7 +9,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -245,13 +244,17 @@
/>
</template>
</el-table-column>
<el-table-column prop="commodityDecimal" label="吊牌价" width="100">
<el-table-column
prop="productExtend.commodityDecimal"
label="吊牌价"
width="100"
>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" width="100"
<el-table-column prop="purchaseDecimal" label="单价" width="100"
><template #default="{ row }">
<el-input
:disabled="openDetail"
v-model="row.unitPrice"
v-model="row.productExtend.purchaseDecimal"
label="单价"
@blur="handleUnitPriceChange(row)"
/>
@ -590,7 +593,8 @@ export default {
row.discountRate = 100;
}
//
row.discountPrice = (row.unitPrice * row.discountRate) / 100;
row.discountPrice =
(row.productExtend.purchaseDecimal * row.discountRate) / 100;
//
if (row.discountPrice && row.operNumber) {
@ -601,7 +605,8 @@ export default {
},
handleUnitPriceChange(row) {
//
row.discountPrice = (row.unitPrice * row.discountRate) / 100;
row.discountPrice =
(row.productExtend.purchaseDecimal * row.discountRate) / 100;
//
if (row.discountPrice && row.operNumber) {
@ -615,7 +620,9 @@ export default {
localStorage.setItem("costPrice", row.costPrice);
row.operNumber = 1; // 1
// 1
row.unitPrice = row.costPrice || 1;
if (!row.productExtend.purchaseDecimal) {
row.productExtend.purchaseDecimal = row.costPrice || 1;
}
row.discountRate = row.discountRate || 10;
//
row.discountPrice = row.costPrice * row.discountRate;
@ -632,7 +639,8 @@ export default {
console.log(row, "row");
if (row.materialUnit == row.productExtend.productUnit.basicUnit) {
row.basicNumber = row.operNumber * 1;
row.unitPrice = row.unitPrice * 1;
row.productExtend.purchaseDecimal =
row.productExtend.purchaseDecimal * 1;
this.handleUnitPriceChange(row);
} else {
if (row.productExtend) {
@ -640,7 +648,8 @@ export default {
(unit) => unit.deputyUnitName === row.materialUnit
);
row.basicNumber = row.operNumber * deputyUnit.ratio;
row.unitPrice = row.unitPrice * deputyUnit.ratio;
row.productExtend.purchaseDecimal =
row.productExtend.purchaseDecimal * deputyUnit.ratio;
this.handleUnitPriceChange(row);
} else {
const deputyUnits = row.productUnit.deputyList.find(
@ -648,7 +657,8 @@ export default {
);
console.log(deputyUnits, "deputyUnit2");
row.basicNumber = row.operNumber * deputyUnits.ratio;
row.unitPrice = row.unitPrice * deputyUnits.ratio;
row.productExtend.purchaseDecimal =
row.productExtend.purchaseDecimal * deputyUnits.ratio;
this.handleUnitPriceChange(row);
}
}
@ -775,7 +785,7 @@ export default {
materialUnit: option.materialUnit,
operNumber: option.operNumber,
basicNumber: option.basicNumber,
unitPrice: option.unitPrice,
purchaseDecimal: option.productExtend.purchaseDecimal,
discountRate: option.discountRate,
discountPrice: option.discountPrice,
allPrice: option.allPrice,

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -118,7 +117,6 @@
style="width: 100%"
:tree-props="{ children: 'billItemList' }"
@select="handleSelect"
@select-all="handleSelectAll"
@selection-change="handleMainListSelectionChange"
v-loading="loading"
>
@ -322,54 +320,85 @@ export default {
}
},
methods: {
cancelAllChildSelection() {
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, false);
});
}
});
},
handleMainListSelectionChange(selection) {
this.selectedItems = selection;
console.log(this.selectedItems, "this.selectedItems ");
if (this.updating) return;
this.updating = true;
this.selectedItems = [...selection];
console.log(selection, "selection");
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
const allChildrenSelected = row.billItemList.every((child) =>
selection.includes(child)
);
if (allChildrenSelected && !selection.includes(row)) {
const anyChildSelected = row.billItemList.some((child) =>
selection.includes(child)
);
if (anyChildSelected && !selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, true);
} else if (!allChildrenSelected && selection.includes(row)) {
if (!this.selectedItems.includes(row)) {
this.selectedItems.push(row);
}
} else if (!anyChildSelected && selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, false);
this.selectedItems = this.selectedItems.filter(
(item) => item.id !== row.id
);
}
}
});
console.log(this.selectedItems, "selectedItems");
this.updating = false;
},
handleSelect(selection, row) {
if (this.updating) return;
this.updating = true;
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, row.isChecked);
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
if (selection.includes(row)) {
row.billItemList.forEach((child) => {
if (!this.selectedItems.includes(child)) {
this.selectedItems.push(child);
}
});
if (!this.selectedItems.includes(row)) {
this.selectedItems.push(row);
}
} else {
this.selectedItems = this.selectedItems.filter(
(item) => !row.billItemList.includes(item) && item.id !== row.id
);
}
} else {
const parentRow = this.findParentRow(this.productData, row);
if (parentRow) {
const allChildrenSelected = parentRow.billItemList.every((child) =>
selection.includes(child)
);
this.$refs.table.toggleRowSelection(parentRow, allChildrenSelected);
const anyChildSelected = parentRow.billItemList.some((child) =>
selection.includes(child)
);
if (allChildrenSelected) {
this.$refs.table.toggleRowSelection(parentRow, true);
if (!this.selectedItems.includes(parentRow)) {
this.selectedItems.push(parentRow);
}
} else if (!anyChildSelected) {
this.$refs.table.toggleRowSelection(parentRow, false);
this.selectedItems = this.selectedItems.filter(
(item) => item.id !== parentRow.id
);
}
}
}
},
handleSelectAll(selection) {
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
}
});
console.log(this.selectedItems, "selectedItems");
this.updating = false;
},
findParentRow(productData, childRow) {
for (let row of productData) {
@ -385,10 +414,6 @@ export default {
}
return null;
},
// handleMainListSelectionChange(val) {
// this.selectedItems = val;
// console.log(this.selectedItems, "this.selectedItems");
// },
isRootNode(row) {
return row.billItemList;
},

View File

@ -9,7 +9,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -26,7 +25,7 @@
class="demo-form-inline"
>
<el-row>
<el-col :span="5">
<el-col :span="4">
<el-form-item label="业务日期">
<el-date-picker
v-model="searchForm.businessTime"
@ -40,7 +39,11 @@
</el-col>
<el-col :span="4">
<el-form-item label="供应商">
<el-select v-model="searchForm.supplierId" placeholder="请选择">
<el-select
style="width: 100px"
v-model="searchForm.supplierId"
placeholder="请选择"
>
<el-option
v-for="(item, index) in supplierList"
:key="index"
@ -51,7 +54,11 @@
></el-col>
<el-col :span="4">
<el-form-item label="仓库">
<el-select v-model="searchForm.depotId" placeholder="请选择">
<el-select
style="width: 100px"
v-model="searchForm.depotId"
placeholder="请选择"
>
<el-option
v-for="(item, index) in depotList"
:key="index"
@ -62,7 +69,11 @@
></el-col>
<el-col :span="4">
<el-form-item label="业务员">
<el-select v-model="searchForm.sales_id" placeholder="请选择">
<el-select
style="width: 100px"
v-model="searchForm.sales_id"
placeholder="请选择"
>
<el-option label="拣选货位" :value="0"></el-option>
<el-option label="存储货位" :value="1"></el-option>
<el-option label="异常货位" :value="2"></el-option>
@ -70,7 +81,11 @@
></el-col>
<el-col :span="4">
<el-form-item label="收货货位">
<el-select v-model="searchForm.sales_id" placeholder="请选择">
<el-select
style="width: 100px"
v-model="searchForm.sales_id"
placeholder="请选择"
>
<el-option label="拣选货位" :value="0"></el-option>
<el-option label="存储货位" :value="1"></el-option>
<el-option label="异常货位" :value="2"></el-option>
@ -118,7 +133,6 @@
style="width: 100%"
:tree-props="{ children: 'billItemList' }"
@select="handleSelect"
@select-all="handleSelectAll"
@selection-change="handleMainListSelectionChange"
v-loading="loading"
>
@ -301,16 +315,9 @@ export default {
supplierList: [],
selectedItems: [],
allData: {},
updating: false,
};
},
watch: {
parentSelected(newValue) {
//
if (!newValue && this.selectedItems.length > 0) {
this.cancelAllChildSelection();
}
},
},
props: ["open_procureAdd", "addForm", "businessType"],
created() {
this.dialogVisible = this.open_procureAdd;
@ -322,54 +329,85 @@ export default {
}
},
methods: {
cancelAllChildSelection() {
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, false);
});
}
});
},
handleMainListSelectionChange(selection) {
this.selectedItems = selection;
console.log(this.selectedItems, "this.selectedItems ");
if (this.updating) return;
this.updating = true;
this.selectedItems = [...selection];
console.log(selection, "selection");
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
const allChildrenSelected = row.billItemList.every((child) =>
selection.includes(child)
);
if (allChildrenSelected && !selection.includes(row)) {
const anyChildSelected = row.billItemList.some((child) =>
selection.includes(child)
);
if (anyChildSelected && !selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, true);
} else if (!allChildrenSelected && selection.includes(row)) {
if (!this.selectedItems.includes(row)) {
this.selectedItems.push(row);
}
} else if (!anyChildSelected && selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, false);
this.selectedItems = this.selectedItems.filter(
(item) => item.id !== row.id
);
}
}
});
console.log(this.selectedItems, "selectedItems");
this.updating = false;
},
handleSelect(selection, row) {
if (this.updating) return;
this.updating = true;
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, row.isChecked);
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
if (selection.includes(row)) {
row.billItemList.forEach((child) => {
if (!this.selectedItems.includes(child)) {
this.selectedItems.push(child);
}
});
if (!this.selectedItems.includes(row)) {
this.selectedItems.push(row);
}
} else {
this.selectedItems = this.selectedItems.filter(
(item) => !row.billItemList.includes(item) && item.id !== row.id
);
}
} else {
const parentRow = this.findParentRow(this.productData, row);
if (parentRow) {
const allChildrenSelected = parentRow.billItemList.every((child) =>
selection.includes(child)
);
this.$refs.table.toggleRowSelection(parentRow, allChildrenSelected);
const anyChildSelected = parentRow.billItemList.some((child) =>
selection.includes(child)
);
if (allChildrenSelected) {
this.$refs.table.toggleRowSelection(parentRow, true);
if (!this.selectedItems.includes(parentRow)) {
this.selectedItems.push(parentRow);
}
} else if (!anyChildSelected) {
this.$refs.table.toggleRowSelection(parentRow, false);
this.selectedItems = this.selectedItems.filter(
(item) => item.id !== parentRow.id
);
}
}
}
},
handleSelectAll(selection) {
this.productData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
}
});
console.log(this.selectedItems, "selectedItems");
this.updating = false;
},
findParentRow(productData, childRow) {
for (let row of productData) {
@ -385,12 +423,8 @@ export default {
}
return null;
},
// handleMainListSelectionChange(val) {
// this.selectedItems = val;
// console.log(this.selectedItems, "this.selectedItems");
// },
isRootNode(row) {
return row.billItemList;
return row.billItemList && row.billItemList.length > 0;
},
deleteImg(index) {
this.searchForm.fileList.splice(index, 1);

View File

@ -139,7 +139,6 @@
ref="table"
:tree-props="{ children: 'billItemList' }"
@select="handleSelect"
@select-all="handleSelectAll"
@selection-change="handleSelectionChange"
v-loading="loading"
>
@ -322,12 +321,12 @@ export default {
};
},
watch: {
parentSelected(newValue) {
//
if (!newValue && this.selectedRows.length > 0) {
this.cancelAllChildSelection();
}
},
// parentSelected(newValue) {
// //
// if (!newValue && this.selectedRows.length > 0) {
// this.cancelAllChildSelection();
// }
// },
},
created() {
/*获取列表*/
@ -390,53 +389,85 @@ export default {
let Params = self.searchForm;
self.getData(Params);
},
cancelAllChildSelection() {
this.tableData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, false);
});
}
});
},
handleSelectionChange(selection) {
this.selectedRows = selection;
if (this.updating) return;
this.updating = true;
this.selectedRows = [...selection];
console.log(selection, "selection");
this.tableData.forEach((row) => {
if (this.isRootNode(row)) {
const allChildrenSelected = row.billItemList.every((child) =>
selection.includes(child)
);
if (allChildrenSelected && !selection.includes(row)) {
const anyChildSelected = row.billItemList.some((child) =>
selection.includes(child)
);
if (anyChildSelected && !selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, true);
} else if (!allChildrenSelected && selection.includes(row)) {
if (!this.selectedRows.includes(row)) {
this.selectedRows.push(row);
}
} else if (!anyChildSelected && selection.includes(row)) {
this.$refs.table.toggleRowSelection(row, false);
this.selectedRows = this.selectedRows.filter(
(item) => item.id !== row.id
);
}
}
});
console.log(this.selectedRows, "selectedRows");
this.updating = false;
},
handleSelect(selection, row) {
if (this.updating) return;
this.updating = true;
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, row.isChecked);
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
if (selection.includes(row)) {
row.billItemList.forEach((child) => {
if (!this.selectedRows.includes(child)) {
this.selectedRows.push(child);
}
});
if (!this.selectedRows.includes(row)) {
this.selectedRows.push(row);
}
} else {
this.selectedRows = this.selectedRows.filter(
(item) => !row.billItemList.includes(item) && item.id !== row.id
);
}
} else {
const parentRow = this.findParentRow(this.tableData, row);
if (parentRow) {
const allChildrenSelected = parentRow.billItemList.every((child) =>
selection.includes(child)
);
this.$refs.table.toggleRowSelection(parentRow, allChildrenSelected);
const anyChildSelected = parentRow.billItemList.some((child) =>
selection.includes(child)
);
if (allChildrenSelected) {
this.$refs.table.toggleRowSelection(parentRow, true);
if (!this.selectedRows.includes(parentRow)) {
this.selectedRows.push(parentRow);
}
} else if (!anyChildSelected) {
this.$refs.table.toggleRowSelection(parentRow, false);
this.selectedRows = this.selectedRows.filter(
(item) => item.id !== parentRow.id
);
}
}
}
},
handleSelectAll(selection) {
this.tableData.forEach((row) => {
if (this.isRootNode(row)) {
row.billItemList.forEach((child) => {
this.$refs.table.toggleRowSelection(child, selection.includes(row));
});
}
});
console.log(this.selectedRows, "selectedRows");
this.updating = false;
},
findParentRow(tableData, childRow) {
for (let row of tableData) {

View File

@ -6,7 +6,6 @@
:show-close="false"
append-to-body
align-center
v-model="dialogVisible"
@close="dialogFormVisible"
:close-on-click-modal="false"
@ -53,6 +52,9 @@
type="password"
></el-input>
</el-form-item>
<el-form-item label="业务员" prop="isSuper">
<el-checkbox v-model="form.isSuper"></el-checkbox>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">

View File

@ -10,7 +10,6 @@
:show-close="false"
append-to-body
align-center
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header d-b-c">
@ -54,6 +53,9 @@
type="password"
></el-input>
</el-form-item>
<el-form-item label="业务员" prop="isSuper">
<el-checkbox v-model="form.isSuper"></el-checkbox>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">