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" /> <el-input @blur="ChangeShop(row)" v-model="row.productCode" />
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-popover <el-popover
:visible="visible"
v-model="row.popoverVisible" v-model="row.popoverVisible"
placement="bottom" placement="bottom"
trigger="click" trigger="click"
@ -785,8 +784,9 @@ export default {
filePaths.push(file.filePath); filePaths.push(file.filePath);
} }
self.fileLists = filePaths; self.fileLists = filePaths;
console.log(self.fileLists, "self.fileLists");
let params = self.searchForm; let params = self.searchForm;
params.fileList = self.fileLists;
params.billItemList = billItemList; params.billItemList = billItemList;
console.log(params, "params"); console.log(params, "params");
self.loading = true; self.loading = true;
@ -1026,33 +1026,6 @@ export default {
} }
return sums; 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 }) { getSummary({ columns, data }) {
let sums = []; let sums = [];
let totalPrice = 0; let totalPrice = 0;

View File

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

View File

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

View File

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

View File

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

View File

@ -2,67 +2,173 @@
<div class="product bgset set-main"> <div class="product bgset set-main">
<!--搜索表单--> <!--搜索表单-->
<div class="common-seach-wrap"> <div class="common-seach-wrap">
<el-form size="small" :inline="true" :model="searchForm" class="demo-form-inline"> <el-form
size="small"
:inline="true"
:model="searchForm"
class="demo-form-inline"
>
<el-form-item label="供应商"> <el-form-item label="供应商">
<el-select v-model="searchForm.supplierId" placeholder="请选择" class="form_content_width"> <el-select
<el-option v-for="(item, index) in suppliers" :key="index" :label="item.supplierName" v-model="searchForm.supplierId"
:value="item.supplierId" /> placeholder="请选择"
class="form_content_width"
>
<el-option
v-for="(item, index) in suppliers"
:key="index"
:label="item.supplierName"
:value="item.supplierId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="仓库"> <el-form-item label="仓库">
<el-select v-model="searchForm.depotId" placeholder="请选择" class="form_content_width"> <el-select
<el-option v-for="(item, index) in depots" :key="index" :label="item.name" v-model="searchForm.depotId"
:value="item.depotId" /> placeholder="请选择"
class="form_content_width"
>
<el-option
v-for="(item, index) in depots"
:key="index"
:label="item.name"
:value="item.depotId"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="单据编号"> <el-form-item label="单据编号">
<el-input size="small" v-model="searchForm.codeNum" placeholder="请填写单据编号" <el-input
class="form_content_width"></el-input> size="small"
v-model="searchForm.codeNum"
placeholder="请填写单据编号"
class="form_content_width"
></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="onSubmit">查询</el-button> <el-button size="small" type="primary" @click="onSubmit"
>查询</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="common-level-rail d-b-c"> <div class="common-level-rail d-b-c">
<div class="d-s-c flex-1"> <div class="d-s-c flex-1">
<el-button size="small" type="primary" @click="addClick" <el-button
v-auth="'/product/base/unit/add'">新增采购订单</el-button><el-button size="small" icon="Document-add" size="small"
@click="" v-auth="'/product/base/unit/delete'">快速导入</el-button><el-button size="small" icon="Download" type="primary"
@click="" v-auth="'/product/base/unit/setStatus'">导出</el-button><el-button size="small" icon="Printer" @click="addClick"
@click="printClick()" v-auth="'/product/base/unit/setStatus'">打印采购单</el-button> v-auth="'/product/base/unit/add'"
>新增采购订单</el-button
><el-button
size="small"
icon="Document-add"
@click=""
v-auth="'/product/base/unit/delete'"
>快速导入</el-button
><el-button
size="small"
icon="Download"
@click=""
v-auth="'/product/base/unit/setStatus'"
>导出</el-button
><el-button
size="small"
icon="Printer"
@click="printClick()"
v-auth="'/product/base/unit/setStatus'"
>打印采购单</el-button
>
</div> </div>
<!-- 分页 --> <!-- 分页 -->
<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" background <el-pagination
:page-sizes="[20, 50, 100]" :current-page="curPage" :page-size="pageSize" small
layout="total, prev, next, jumper,sizes" :total="totalDataNumber"> @size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
:page-sizes="[20, 50, 100]"
:current-page="curPage"
:page-size="pageSize"
layout="total, prev, next, jumper,sizes"
:total="totalDataNumber"
>
</el-pagination> </el-pagination>
</div> </div>
<!--表格--> <!--表格-->
<el-table class="flex-1" size="small" :data="tableData" border style="width: 100%" <el-table
@selection-change="handleSelectionChange" @row-click="handleRowClick" v-loading="loading" class="flex-1"
show-summary :summary-method="getSummarys"> size="small"
:data="tableData"
border
style="width: 100%"
@selection-change="handleSelectionChange"
@row-click="handleRowClicks"
@row-dblclick="handleRowClick"
v-loading="loading"
show-summary
:summary-method="getSummarys"
>
<el-table-column type="selection" width="54"></el-table-column> <el-table-column type="selection" width="54"></el-table-column>
<el-table-column prop="billId" label="ID" width="42"></el-table-column> <el-table-column prop="billId" label="ID" width="42"></el-table-column>
<el-table-column label="操作" width="240"> <el-table-column label="操作" width="240">
<template #default="scope"> <template #default="scope">
<el-button @click="detailClick(scope.row)" type="text" size="small">详情</el-button> <el-button @click="detailClick(scope.row)" type="text" size="small"
<el-button v-if="scope.row.auditStatus == 10" @click="editClick(scope.row)" type="text" >详情</el-button
size="small">修改</el-button> >
<el-button v-if="scope.row.auditStatus == 10" @click="delClick(scope.row)" type="text" <el-button
size="small">关闭</el-button> v-if="scope.row.auditStatus == 10"
<el-button v-if="scope.row.auditStatus == 10" @click="authClick(scope.row)" type="text" @click="editClick(scope.row)"
size="small">审核</el-button> type="text"
<el-button @click="logisticsClick(scope.row)" type="text" size="small"> size="small"
>修改</el-button
>
<el-button
v-if="scope.row.auditStatus == 10"
@click="delClick(scope.row)"
type="text"
size="small"
>关闭</el-button
>
<el-button
v-if="scope.row.auditStatus == 10"
@click="authClick(scope.row)"
type="text"
size="small"
>审核</el-button
>
<el-button
@click="logisticsClick(scope.row)"
type="text"
size="small"
>
物流单号 物流单号
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="businessTime" label="业务日期" width="140"></el-table-column> <el-table-column
<el-table-column prop="codeNum" label="单据编号" width="150"></el-table-column> prop="businessTime"
<el-table-column prop="supplierName" label="供应商" width="100"></el-table-column> label="业务日期"
<el-table-column prop="salesId" label="业务员" width="100"></el-table-column> width="140"
<el-table-column prop="depotName" label="收货仓库" width="100"></el-table-column> ></el-table-column>
<el-table-column
prop="codeNum"
label="单据编号"
width="150"
></el-table-column>
<el-table-column
prop="supplierName"
label="供应商"
width="100"
></el-table-column>
<el-table-column
prop="salesId"
label="业务员"
width="100"
></el-table-column>
<el-table-column
prop="depotName"
label="收货仓库"
width="100"
></el-table-column>
<el-table-column prop="typeName" label="单据类型名称" width="100"> <el-table-column prop="typeName" label="单据类型名称" width="100">
<template #default="scope"> <template #default="scope">
<el-text effect="plain" type="primary" size="small">{{ <el-text effect="plain" type="primary" size="small">{{
@ -72,70 +178,150 @@
</el-table-column> </el-table-column>
<el-table-column prop="auditStatus" label="审核状态" width="100"> <el-table-column prop="auditStatus" label="审核状态" width="100">
<template #default="scope"> <template #default="scope">
<el-text effect="plain" type="warning" size="small" <el-text
v-if="scope.row.auditStatus == 10">待审核</el-text> effect="plain"
<el-text effect="plain" type="success" size="small" type="warning"
v-if="scope.row.auditStatus == 20">通过</el-text> size="small"
<el-text effect="plain" type="danger" size="small" v-if="scope.row.auditStatus == 10"
v-if="scope.row.auditStatus == 30">拒绝</el-text> >待审核</el-text
>
<el-text
effect="plain"
type="success"
size="small"
v-if="scope.row.auditStatus == 20"
>通过</el-text
>
<el-text
effect="plain"
type="danger"
size="small"
v-if="scope.row.auditStatus == 30"
>拒绝</el-text
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="stateText" label="状态" width="80"> <el-table-column prop="stateText" label="状态" width="80">
<template #default="scope"> <template #default="scope">
<el-text effect="plain" type="danger" size="small" v-if="scope.row.purchaseStatus == 10">{{ <el-text
scope.row.stateText == "待审核" effect="plain"
? "待审核" type="danger"
: scope.row.stateText size="small"
}}</el-text> v-if="scope.row.purchaseStatus == 10"
<el-text effect="plain" type="danger" size="small" v-if="scope.row.purchaseStatus == 0">{{ >{{
scope.row.stateText == "未到货" scope.row.stateText == "待审核" ? "待审核" : scope.row.stateText
? "未到货" }}</el-text
: scope.row.stateText >
}}</el-text> <el-text
<el-text effect="plain" type="success" size="small" effect="plain"
v-if="scope.row.purchaseStatus == 1">完成</el-text> type="danger"
<el-text effect="plain" type="info" size="small" v-if="scope.row.purchaseStatus == 2">{{ size="small"
v-if="scope.row.purchaseStatus == 0"
>{{
scope.row.stateText == "未到货" ? "未到货" : scope.row.stateText
}}</el-text
>
<el-text
effect="plain"
type="success"
size="small"
v-if="scope.row.purchaseStatus == 1"
>完成</el-text
>
<el-text
effect="plain"
type="info"
size="small"
v-if="scope.row.purchaseStatus == 2"
>{{
scope.row.stateText == "部分到货" scope.row.stateText == "部分到货"
? "部分到货" ? "部分到货"
: scope.row.stateText : scope.row.stateText
}}</el-text><el-text effect="plain" type="warning" size="small" v-if="scope.row.purchaseStatus == 3">{{ }}</el-text
scope.row.stateText == "已关闭" ><el-text
? "已关闭" effect="plain"
: scope.row.stateText type="warning"
}}</el-text> size="small"
v-if="scope.row.purchaseStatus == 3"
>{{
scope.row.stateText == "已关闭" ? "已关闭" : scope.row.stateText
}}</el-text
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="totalPrice" label="商品总额" width="100"></el-table-column> <el-table-column
<el-table-column prop="purchaseMoney" label="采购运费" width="100"></el-table-column> prop="totalPrice"
label="商品总额"
width="100"
></el-table-column>
<el-table-column
prop="purchaseMoney"
label="采购运费"
width="100"
></el-table-column>
<el-table-column prop="otherMoney" label="其他费用"></el-table-column> <el-table-column prop="otherMoney" label="其他费用"></el-table-column>
<el-table-column prop="deposit" label="预付金额"></el-table-column> <el-table-column prop="deposit" label="预付金额"></el-table-column>
<el-table-column prop="expressNo" label="物流单号"></el-table-column> <el-table-column prop="expressNo" label="物流单号"></el-table-column>
<el-table-column prop="systemRemark" label="备注"></el-table-column> <el-table-column prop="systemRemark" label="备注"></el-table-column>
<el-table-column prop="creatorName" label="创建人"></el-table-column> <el-table-column prop="creatorName" label="创建人"></el-table-column>
<el-table-column prop="createTime" width="150" label="创建时间"></el-table-column> <el-table-column
<el-table-column prop="updateTime" label="最后修改时间" width="150"></el-table-column> prop="createTime"
width="150"
label="创建时间"
></el-table-column>
<el-table-column
prop="updateTime"
label="最后修改时间"
width="150"
></el-table-column>
</el-table> </el-table>
<Add v-if="open_add" :open_add="open_add" :addForm="addForm" @closeDialog="closeDialogFunc($event, 'add')"></Add> <Add
<Edit v-if="open_edit" :open_edit="open_edit" :editForm="categoryModel" :addForm="addForm" :openDetail="openDetail" v-if="open_add"
@closeDialog="closeDialogFunc($event, 'edit')"></Edit> :open_add="open_add"
:addForm="addForm"
@closeDialog="closeDialogFunc($event, 'add')"
></Add>
<Edit
v-if="open_edit"
:open_edit="open_edit"
:editForm="categoryModel"
:addForm="addForm"
:openDetail="openDetail"
@closeDialog="closeDialogFunc($event, 'edit')"
></Edit>
<!--打印--> <!--打印-->
<Print open_title="xxx公司" v-if="open_print" :open_print="open_print" :printData="printData" :addForm="addForm" <Print
@closeDialog="closeDialogFunc($event, 'print')"></Print> open_title="xxx公司"
<Logictic v-if="open_logistic" :open_logistic="open_logistic" :editForm="categoryModel" v-if="open_print"
@closeDialog="closeDialogFunc($event, 'logistic')"></Logictic> :open_print="open_print"
<Detail v-if="open_detail" :open_detail="open_detail" :editForm="filteredBillItems" :addForm="addressForm" :printData="printData"
@closeDialog="closeDialogFunc($event, 'detail')"></Detail> :addForm="addForm"
@closeDialog="closeDialogFunc($event, 'print')"
></Print>
<Logictic
v-if="open_logistic"
:open_logistic="open_logistic"
:editForm="categoryModel"
@closeDialog="closeDialogFunc($event, 'logistic')"
></Logictic>
<Detail
v-if="open_detail"
:open_detail="open_detail"
:editForm="filteredBillItems"
:addForm="addressForm"
@closeDialog="closeDialogFunc($event, 'detail')"
></Detail>
</div> </div>
</template> </template>
<script> <script>
import PurchaseApi from "@/api/purchase.js"; import PurchaseApi from "@/api/purchase.js";
import Add from "./add.vue"; import Add from "./add.vue";
import Edit from "./edit.vue"; import Edit from "./edit.vue";
import Print from "./part/Print.vue"; import Print from "./part/Print.vue";
import Logictic from "./logictic.vue"; import Logictic from "./logictic.vue";
import Detail from "./part/detail.vue"; import Detail from "./part/detail.vue";
export default { export default {
components: { components: {
Add, Add,
Print, Print,
@ -173,7 +359,8 @@
depotId: "", depotId: "",
}, },
/*评价等级*/ /*评价等级*/
commentList: [{ commentList: [
{
name: "好评", name: "好评",
val: 10, val: 10,
}, },
@ -210,6 +397,14 @@
}, },
}, },
methods: { methods: {
handleRowClicks() {
ElNotification({
type: "info",
title: "提示",
message: "双击列表行查看详情",
duration: 1000,
});
},
handleRowClick(row) { handleRowClick(row) {
this.selectedBillId = row.billId; this.selectedBillId = row.billId;
if ( if (
@ -236,10 +431,7 @@
this.addForm = this.otherData; this.addForm = this.otherData;
this.open_print = true; this.open_print = true;
}, },
getSummarys({ getSummarys({ columns, data }) {
columns,
data
}) {
let sums = []; let sums = [];
// '' // ''
sums.push("总计"); sums.push("总计");
@ -259,10 +451,7 @@
return sums; return sums;
}, },
getSummary({ getSummary({ columns, data }) {
columns,
data
}) {
let sums = []; let sums = [];
// '' // ''
sums.push("合计"); sums.push("合计");
@ -413,7 +602,8 @@
// //
self.loading = true; self.loading = true;
self.open_auth = false; self.open_auth = false;
PurchaseApi.orderAudit({ PurchaseApi.orderAudit(
{
billId: row.billId, billId: row.billId,
auditStatus: 20, auditStatus: 20,
refuseReason: "", // refuseReason: "", //
@ -446,13 +636,12 @@
inputErrorMessage: "拒绝原因不能为空", inputErrorMessage: "拒绝原因不能为空",
roundButton: true, roundButton: true,
}) })
.then(({ .then(({ value }) => {
value
}) => {
// //
if (value) { if (value) {
self.loading = true; self.loading = true;
PurchaseApi.orderAudit({ PurchaseApi.orderAudit(
{
billId: row.billId, billId: row.billId,
auditStatus: 30, auditStatus: 30,
refuseReason: value, // refuseReason: value, //
@ -489,13 +678,12 @@
inputErrorMessage: "关闭原因不能为空", inputErrorMessage: "关闭原因不能为空",
roundButton: true, roundButton: true,
}) })
.then(({ .then(({ value }) => {
value
}) => {
if (value) { if (value) {
self.loading = true; self.loading = true;
self.open_delete = false; self.open_delete = false;
PurchaseApi.orderClose({ PurchaseApi.orderClose(
{
billId: row.billId, billId: row.billId,
closeReason: value, // closeReason: value, //
}, },
@ -540,7 +728,8 @@
.then(() => { .then(() => {
const ids = this.selectedRows.map((row) => row.id).join(","); const ids = this.selectedRows.map((row) => row.id).join(",");
self.loading = true; self.loading = true;
PorductApi.unitSetStatus({ PorductApi.unitSetStatus(
{
ids: ids, ids: ids,
state: state, state: state,
}, },
@ -582,16 +771,16 @@
// self.getData(); // self.getData();
}, },
}, },
}; };
</script> </script>
<style scoped> <style scoped>
::v-deep .el-table__footer-wrapper { ::v-deep .el-table__footer-wrapper {
background-color: red !important; background-color: red !important;
/* 设置合计行的背景色为红色 */ /* 设置合计行的背景色为红色 */
color: white !important; color: white !important;
/* 设置合计行文字颜色为白色 */ /* 设置合计行文字颜色为白色 */
font-weight: bold !important; font-weight: bold !important;
/* 设置合计行文字加粗 */ /* 设置合计行文字加粗 */
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

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