修改耗材管理-绑定商品绑定耗材提交的数据结构,修改筛选耗材输入id为选择分类
This commit is contained in:
parent
7b679fb415
commit
496389f8bc
|
|
@ -177,64 +177,62 @@
|
|||
<template v-slot="scope">
|
||||
<div>
|
||||
<div
|
||||
style="margin-bottom: 10px"
|
||||
v-for="(haocai, index) in scope.row.haocais"
|
||||
:key="index"
|
||||
>
|
||||
<el-input
|
||||
disabled
|
||||
v-model="haocai.conName"
|
||||
style="width: 130px"
|
||||
placeholder="请选择耗材信息"
|
||||
|
||||
></el-input>
|
||||
style="margin-bottom: 10px"
|
||||
v-for="(haocai, index) in scope.row.haocais"
|
||||
:key="index"
|
||||
>
|
||||
<el-input
|
||||
disabled
|
||||
v-model="haocai.conName"
|
||||
style="width: 130px"
|
||||
placeholder="请选择耗材信息"
|
||||
></el-input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位耗材值" width="180">
|
||||
<template v-slot="scope">
|
||||
<div>
|
||||
<div
|
||||
style="margin-bottom: 10px; display: flex"
|
||||
v-for="(haocai, haocaiIndex) in scope.row.haocais"
|
||||
:key="haocaiIndex"
|
||||
>
|
||||
<el-input
|
||||
v-model="haocai.surplusStock"
|
||||
type="number"
|
||||
placeholder="单位耗材值"
|
||||
@input="handleKeyUp($event, haocaiIndex)"
|
||||
></el-input>
|
||||
<div style="margin-left: 10px">
|
||||
<el-button
|
||||
v-if="scope.row.haocais.length > 1"
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="delGoodsHaocai(scope.row.haocais, haocaiIndex)"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
></el-button>
|
||||
style="margin-bottom: 10px; display: flex"
|
||||
v-for="(haocai, haocaiIndex) in scope.row.haocais"
|
||||
:key="haocaiIndex"
|
||||
>
|
||||
<el-input
|
||||
v-model="haocai.surplusStock"
|
||||
type="number"
|
||||
placeholder="单位耗材值"
|
||||
@input="handleKeyUp($event, haocaiIndex)"
|
||||
></el-input>
|
||||
<div style="margin-left: 10px">
|
||||
<el-button
|
||||
v-if="scope.row.haocais.length > 1"
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="
|
||||
delGoodsHaocai(scope.row.haocais, haocaiIndex)
|
||||
"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="selecthaocai(scope.row)"
|
||||
>去选择耗材信息</el-button
|
||||
>
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="selecthaocai(scope.row)"
|
||||
>去选择耗材信息</el-button
|
||||
>
|
||||
<!-- <el-button type="primary" @click="addGoodsHaocai(scope.row.haocais, haocaiIndex)">
|
||||
增加耗材
|
||||
</el-button> -->
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作">
|
||||
|
|
@ -325,7 +323,20 @@
|
|||
@close="resetHaocaiTable"
|
||||
>
|
||||
<div class="head-container flex">
|
||||
<el-input
|
||||
<el-select
|
||||
v-model="queryinformation.conTypeId"
|
||||
placeholder="请选择耗材分类"
|
||||
style="width: 100%; margin-right: 10px"
|
||||
>
|
||||
<el-option
|
||||
:label="item.conTypeName"
|
||||
:value="item.id"
|
||||
v-for="item in consTypeList"
|
||||
:key="item.conTypeId"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
<!-- <el-input
|
||||
v-model="queryinformation.conTypeId"
|
||||
size="small"
|
||||
clearable
|
||||
|
|
@ -333,7 +344,7 @@
|
|||
style="width: 100%"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="getTableDatainformation"
|
||||
/>
|
||||
/> -->
|
||||
<el-input
|
||||
v-model="queryinformation.conTypeName"
|
||||
size="small"
|
||||
|
|
@ -365,7 +376,7 @@
|
|||
<el-button
|
||||
style="margin-right: 20px"
|
||||
type="primary"
|
||||
@click="getTableDatainformation"
|
||||
@click="haocaiChaxun"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button @click="resetHandleinformation">重置</el-button>
|
||||
|
|
@ -385,12 +396,12 @@
|
|||
></el-table-column>
|
||||
<el-table-column prop="id" label="ID" width="50px" />
|
||||
<el-table-column label="耗材名称" prop="conName" />
|
||||
<el-table-column label="耗材代码" prop="conCode" >
|
||||
<template v-slot="scope">
|
||||
<div class="line-1">
|
||||
{{ scope.row.conCode }}
|
||||
</div>
|
||||
</template>
|
||||
<el-table-column label="耗材代码" prop="conCode">
|
||||
<template v-slot="scope">
|
||||
<div class="line-1">
|
||||
{{ scope.row.conCode }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型名称" prop="conTypeName" />
|
||||
<el-table-column label="单位" prop="conUnit" />
|
||||
|
|
@ -409,7 +420,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="head-container" style="margin-top: 10px;">
|
||||
<div class="head-container" style="margin-top: 10px">
|
||||
<el-pagination
|
||||
:total="tableDatainformation.total"
|
||||
:current-page="tableDatainformation.page + 1"
|
||||
|
|
@ -468,6 +479,7 @@ import dayjs from "dayjs";
|
|||
import shopList from "../components/shopList";
|
||||
import bindHaocai from "./components/specifications_bind_supplies";
|
||||
import { upProSort, tbProduct } from "@/api/shop";
|
||||
import { gettbConsType } from "@/api/consumable";
|
||||
import {
|
||||
getviewConSku,
|
||||
gettbProductSpec,
|
||||
|
|
@ -513,6 +525,7 @@ export default {
|
|||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
consTypeList: [],
|
||||
queryinformation: {
|
||||
conTypeId: "",
|
||||
conTypeName: "",
|
||||
|
|
@ -552,12 +565,26 @@ export default {
|
|||
this.getTableData();
|
||||
this.getTableDatasku();
|
||||
this.getTableDatainformation();
|
||||
this.gettbConsType();
|
||||
this.$nextTick(() => {
|
||||
// this.tableDrag()
|
||||
// this.$refs.shopList.isselectEvent()
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 获取类型
|
||||
async gettbConsType() {
|
||||
try {
|
||||
const res = await gettbConsType({
|
||||
page: 0,
|
||||
size: 100,
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
});
|
||||
this.consTypeList = res.content;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
let index = this.commodityArr.findIndex((v) => v.id === row.id);
|
||||
|
|
@ -586,7 +613,7 @@ export default {
|
|||
haocais.splice(haocaiIndex, 1);
|
||||
},
|
||||
addGoodsHaocai(haocais, haocaiIndex) {
|
||||
haocais.push({...haocaisBasic});
|
||||
haocais.push({ ...haocaisBasic });
|
||||
},
|
||||
//初始化耗材表单选中状态
|
||||
initTableSelected() {
|
||||
|
|
@ -616,32 +643,32 @@ export default {
|
|||
this.informationdialogshow = false;
|
||||
},
|
||||
haocaiConfirm() {
|
||||
let hasEmpty=JSON.stringify(haocaiSelectedMap)=='{}'
|
||||
if(!hasEmpty){
|
||||
let hasEmpty = JSON.stringify(haocaiSelectedMap) == "{}";
|
||||
if (!hasEmpty) {
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
ele.haocais = [];
|
||||
let index = -1;
|
||||
for (let key in haocaiSelectedMap) {
|
||||
const item = haocaiSelectedMap[key];
|
||||
index++;
|
||||
this.$set(ele.haocais, index, {
|
||||
consInfoId: item.id,
|
||||
conInfoId: item.id,
|
||||
conName: item.conName,
|
||||
skuId: ele.skuId,
|
||||
shopId: ele.shopId,
|
||||
});
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
ele.haocais = [];
|
||||
let index = -1;
|
||||
for (let key in haocaiSelectedMap) {
|
||||
const item = haocaiSelectedMap[key];
|
||||
index++;
|
||||
this.$set(ele.haocais, index, {
|
||||
consInfoId: item.id,
|
||||
conInfoId: item.id,
|
||||
conName: item.conName,
|
||||
skuId: ele.skuId,
|
||||
shopId: ele.shopId,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
});
|
||||
} else {
|
||||
//当选中耗材为空,重置耗材
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
ele.haocais = [{...haocaisBasic}];
|
||||
}
|
||||
});
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
ele.haocais = [{ ...haocaisBasic }];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.informationdialogshow = false;
|
||||
|
|
@ -682,7 +709,6 @@ export default {
|
|||
},
|
||||
selectShop(res) {
|
||||
const skuArr = [];
|
||||
|
||||
|
||||
res.forEach((ele) => {
|
||||
ele.skuList.forEach((sku) => {
|
||||
|
|
@ -845,6 +871,10 @@ export default {
|
|||
this.tableDatainformation.page = e - 1;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
haocaiChaxun() {
|
||||
this.tableDatainformation.page = 0;
|
||||
this.getTableDatainformation();
|
||||
},
|
||||
// 获取信息管理
|
||||
async getTableDatainformation() {
|
||||
this.tableDatainformation.loading = true;
|
||||
|
|
@ -868,9 +898,9 @@ export default {
|
|||
},
|
||||
// 耗材信息的信息
|
||||
tableDatainformationtable(item) {
|
||||
haocaiSelectedMap[item.id]=item
|
||||
this.haocaiConfirm()
|
||||
return
|
||||
haocaiSelectedMap[item.id] = item;
|
||||
this.haocaiConfirm();
|
||||
return;
|
||||
this.commodityArr.forEach((ele) => {
|
||||
if (ele.skuId == this.ALLisDistribute.skuId) {
|
||||
console.log(ele.haocais);
|
||||
|
|
@ -950,16 +980,42 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
const newArr = this.commodityArr.map((ele) => {
|
||||
return {
|
||||
...ele,
|
||||
consInfoId: ele.consInfoId,
|
||||
productId: ele.id,
|
||||
skuInfos: ele.haocais,
|
||||
surplusStock: ele.surplusStock,
|
||||
status: ele.status,
|
||||
};
|
||||
});
|
||||
let newArr = [];
|
||||
for (let i of this.commodityArr) {
|
||||
//共享库存
|
||||
console.log(i.haocais)
|
||||
if (i.isDistribute) {
|
||||
for (let k of i.haocais) {
|
||||
newArr.push({
|
||||
consInfoId: k.conInfoId,
|
||||
productId: i.id,
|
||||
surplusStock: k.surplusStock,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 非共享商品 多规格
|
||||
for (let k of i.haocais) {
|
||||
newArr.push({
|
||||
consInfoId: k.conInfoId,
|
||||
productId: i.id,
|
||||
skuInfos:{
|
||||
...k
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// const newArr = this.commodityArr.map((ele) => {
|
||||
// console.log(ele)
|
||||
// return {
|
||||
// consInfoId: ele.consInfoId,
|
||||
// productId: ele.id,
|
||||
// skuInfos: ele.haocais,
|
||||
// surplusStock: ele.surplusStock,
|
||||
// status: ele.status,
|
||||
// };
|
||||
// });
|
||||
await posttbProskuCons(newArr);
|
||||
|
||||
// for(let data of newArr){
|
||||
|
|
@ -1021,10 +1077,11 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
.flex{
|
||||
display: flex;align-content: center;
|
||||
.flex {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
}
|
||||
.head-container .filter-item{
|
||||
.head-container .filter-item {
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue