mirror of
https://gitee.com/victor123/jjjerp-java.git
synced 2025-12-07 01:48:21 +08:00
bug修改
This commit is contained in:
parent
3e03b110e9
commit
4c820468b7
@ -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;
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -2,67 +2,173 @@
|
||||
<div class="product bgset set-main">
|
||||
<!--搜索表单-->
|
||||
<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-select v-model="searchForm.supplierId" placeholder="请选择" class="form_content_width">
|
||||
<el-option v-for="(item, index) in suppliers" :key="index" :label="item.supplierName"
|
||||
:value="item.supplierId" />
|
||||
<el-select
|
||||
v-model="searchForm.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-form-item>
|
||||
<el-form-item label="仓库">
|
||||
<el-select v-model="searchForm.depotId" placeholder="请选择" class="form_content_width">
|
||||
<el-option v-for="(item, index) in depots" :key="index" :label="item.name"
|
||||
:value="item.depotId" />
|
||||
<el-select
|
||||
v-model="searchForm.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-form-item>
|
||||
<el-form-item label="单据编号">
|
||||
<el-input size="small" v-model="searchForm.codeNum" placeholder="请填写单据编号"
|
||||
class="form_content_width"></el-input>
|
||||
<el-input
|
||||
size="small"
|
||||
v-model="searchForm.codeNum"
|
||||
placeholder="请填写单据编号"
|
||||
class="form_content_width"
|
||||
></el-input>
|
||||
</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>
|
||||
</div>
|
||||
<div class="common-level-rail d-b-c">
|
||||
<div class="d-s-c flex-1">
|
||||
<el-button size="small" type="primary" @click="addClick"
|
||||
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>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="addClick"
|
||||
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>
|
||||
<!-- 分页 -->
|
||||
<el-pagination small @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
|
||||
small
|
||||
@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>
|
||||
</div>
|
||||
<!--表格-->
|
||||
<el-table class="flex-1" size="small" :data="tableData" border style="width: 100%"
|
||||
@selection-change="handleSelectionChange" @row-click="handleRowClick" v-loading="loading"
|
||||
show-summary :summary-method="getSummarys">
|
||||
<el-table
|
||||
class="flex-1"
|
||||
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 prop="billId" label="ID" width="42"></el-table-column>
|
||||
<el-table-column label="操作" width="240">
|
||||
<template #default="scope">
|
||||
<el-button @click="detailClick(scope.row)" type="text" size="small">详情</el-button>
|
||||
<el-button v-if="scope.row.auditStatus == 10" @click="editClick(scope.row)" type="text"
|
||||
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 @click="detailClick(scope.row)" type="text" size="small"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.auditStatus == 10"
|
||||
@click="editClick(scope.row)"
|
||||
type="text"
|
||||
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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="businessTime" label="业务日期" width="140"></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="businessTime"
|
||||
label="业务日期"
|
||||
width="140"
|
||||
></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">
|
||||
<template #default="scope">
|
||||
<el-text effect="plain" type="primary" size="small">{{
|
||||
@ -72,70 +178,150 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="auditStatus" label="审核状态" width="100">
|
||||
<template #default="scope">
|
||||
<el-text effect="plain" type="warning" size="small"
|
||||
v-if="scope.row.auditStatus == 10">待审核</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>
|
||||
<el-text
|
||||
effect="plain"
|
||||
type="warning"
|
||||
size="small"
|
||||
v-if="scope.row.auditStatus == 10"
|
||||
>待审核</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>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stateText" label="状态" width="80">
|
||||
<template #default="scope">
|
||||
<el-text effect="plain" type="danger" size="small" v-if="scope.row.purchaseStatus == 10">{{
|
||||
scope.row.stateText == "待审核"
|
||||
? "待审核"
|
||||
: scope.row.stateText
|
||||
}}</el-text>
|
||||
<el-text effect="plain" type="danger" 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">{{
|
||||
<el-text
|
||||
effect="plain"
|
||||
type="danger"
|
||||
size="small"
|
||||
v-if="scope.row.purchaseStatus == 10"
|
||||
>{{
|
||||
scope.row.stateText == "待审核" ? "待审核" : scope.row.stateText
|
||||
}}</el-text
|
||||
>
|
||||
<el-text
|
||||
effect="plain"
|
||||
type="danger"
|
||||
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
|
||||
}}</el-text><el-text effect="plain" type="warning" size="small" v-if="scope.row.purchaseStatus == 3">{{
|
||||
scope.row.stateText == "已关闭"
|
||||
? "已关闭"
|
||||
: scope.row.stateText
|
||||
}}</el-text>
|
||||
}}</el-text
|
||||
><el-text
|
||||
effect="plain"
|
||||
type="warning"
|
||||
size="small"
|
||||
v-if="scope.row.purchaseStatus == 3"
|
||||
>{{
|
||||
scope.row.stateText == "已关闭" ? "已关闭" : scope.row.stateText
|
||||
}}</el-text
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="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="deposit" 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="creatorName" label="创建人"></el-table-column>
|
||||
<el-table-column prop="createTime" width="150" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updateTime" label="最后修改时间" width="150"></el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
width="150"
|
||||
label="创建时间"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
label="最后修改时间"
|
||||
width="150"
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
<Add v-if="open_add" :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>
|
||||
<Add
|
||||
v-if="open_add"
|
||||
: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"
|
||||
@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>
|
||||
<Print
|
||||
open_title="xxx公司"
|
||||
v-if="open_print"
|
||||
:open_print="open_print"
|
||||
:printData="printData"
|
||||
: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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PurchaseApi from "@/api/purchase.js";
|
||||
import Add from "./add.vue";
|
||||
import Edit from "./edit.vue";
|
||||
import Print from "./part/Print.vue";
|
||||
import Logictic from "./logictic.vue";
|
||||
import Detail from "./part/detail.vue";
|
||||
export default {
|
||||
import PurchaseApi from "@/api/purchase.js";
|
||||
import Add from "./add.vue";
|
||||
import Edit from "./edit.vue";
|
||||
import Print from "./part/Print.vue";
|
||||
import Logictic from "./logictic.vue";
|
||||
import Detail from "./part/detail.vue";
|
||||
export default {
|
||||
components: {
|
||||
Add,
|
||||
Print,
|
||||
@ -173,7 +359,8 @@
|
||||
depotId: "",
|
||||
},
|
||||
/*评价等级*/
|
||||
commentList: [{
|
||||
commentList: [
|
||||
{
|
||||
name: "好评",
|
||||
val: 10,
|
||||
},
|
||||
@ -210,6 +397,14 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleRowClicks() {
|
||||
ElNotification({
|
||||
type: "info",
|
||||
title: "提示",
|
||||
message: "双击列表行查看详情",
|
||||
duration: 1000,
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.selectedBillId = row.billId;
|
||||
if (
|
||||
@ -236,10 +431,7 @@
|
||||
this.addForm = this.otherData;
|
||||
this.open_print = true;
|
||||
},
|
||||
getSummarys({
|
||||
columns,
|
||||
data
|
||||
}) {
|
||||
getSummarys({ columns, data }) {
|
||||
let sums = [];
|
||||
// 在计算合计值之前创建一个新的数组,并在开头插入 '合计' 字符串
|
||||
sums.push("总计");
|
||||
@ -259,10 +451,7 @@
|
||||
|
||||
return sums;
|
||||
},
|
||||
getSummary({
|
||||
columns,
|
||||
data
|
||||
}) {
|
||||
getSummary({ columns, data }) {
|
||||
let sums = [];
|
||||
// 在计算合计值之前创建一个新的数组,并在开头插入 '合计' 字符串
|
||||
sums.push("合计");
|
||||
@ -413,7 +602,8 @@
|
||||
// 用户选择同意,执行审核操作
|
||||
self.loading = true;
|
||||
self.open_auth = false;
|
||||
PurchaseApi.orderAudit({
|
||||
PurchaseApi.orderAudit(
|
||||
{
|
||||
billId: row.billId,
|
||||
auditStatus: 20,
|
||||
refuseReason: "", // 同意时不需要拒绝原因
|
||||
@ -446,13 +636,12 @@
|
||||
inputErrorMessage: "拒绝原因不能为空",
|
||||
roundButton: true,
|
||||
})
|
||||
.then(({
|
||||
value
|
||||
}) => {
|
||||
.then(({ value }) => {
|
||||
// 用户输入拒绝原因并点击确定
|
||||
if (value) {
|
||||
self.loading = true;
|
||||
PurchaseApi.orderAudit({
|
||||
PurchaseApi.orderAudit(
|
||||
{
|
||||
billId: row.billId,
|
||||
auditStatus: 30,
|
||||
refuseReason: value, // 将输入的拒绝原因传递给接口
|
||||
@ -489,13 +678,12 @@
|
||||
inputErrorMessage: "关闭原因不能为空",
|
||||
roundButton: true,
|
||||
})
|
||||
.then(({
|
||||
value
|
||||
}) => {
|
||||
.then(({ value }) => {
|
||||
if (value) {
|
||||
self.loading = true;
|
||||
self.open_delete = false;
|
||||
PurchaseApi.orderClose({
|
||||
PurchaseApi.orderClose(
|
||||
{
|
||||
billId: row.billId,
|
||||
closeReason: value, // 将输入的关闭原因传递给接口
|
||||
},
|
||||
@ -540,7 +728,8 @@
|
||||
.then(() => {
|
||||
const ids = this.selectedRows.map((row) => row.id).join(",");
|
||||
self.loading = true;
|
||||
PorductApi.unitSetStatus({
|
||||
PorductApi.unitSetStatus(
|
||||
{
|
||||
ids: ids,
|
||||
state: state,
|
||||
},
|
||||
@ -582,16 +771,16 @@
|
||||
// self.getData();
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .el-table__footer-wrapper {
|
||||
::v-deep .el-table__footer-wrapper {
|
||||
background-color: red !important;
|
||||
/* 设置合计行的背景色为红色 */
|
||||
color: white !important;
|
||||
/* 设置合计行文字颜色为白色 */
|
||||
font-weight: bold !important;
|
||||
/* 设置合计行文字加粗 */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -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;
|
||||
},
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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">
|
||||
|
||||
@ -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">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user