1.优化首页 2.优化绑定耗材

This commit is contained in:
gyq
2024-10-24 15:38:55 +08:00
parent 2261b0520a
commit f585e2f020
2 changed files with 120 additions and 106 deletions

View File

@@ -220,13 +220,13 @@
<div class="number">{{ productCount }}</div> <div class="number">{{ productCount }}</div>
<div class="product_chart_wrap" ref="productCountChart"></div> <div class="product_chart_wrap" ref="productCountChart"></div>
</div> </div>
<div class="card"> <!-- <div class="card">
<div class="sale_data_header"> <div class="sale_data_header">
<div class="card_title">销售金额</div> <div class="card_title">销售金额</div>
</div> </div>
<div class="number">{{ productSum }}</div> <div class="number">{{ productSum }}</div>
<div class="product_chart_wrap" ref="productSumChart"></div> <div class="product_chart_wrap" ref="productSumChart"></div>
</div> </div> -->
</div> </div>
<div class="table"> <div class="table">
<el-table :data="saleTable" v-loading="saleTableLoading"> <el-table :data="saleTable" v-loading="saleTableLoading">
@@ -336,9 +336,9 @@ export default {
if (this.productCountChart) { if (this.productCountChart) {
this.productCountChart.resize(); this.productCountChart.resize();
} }
if (this.productSumChart) { // if (this.productSumChart) {
this.productSumChart.resize(); // this.productSumChart.resize();
} // }
}, 100); }, 100);
window.addEventListener("resize", this.__resizeHandler); window.addEventListener("resize", this.__resizeHandler);
// this.initCardUserChart(); // this.initCardUserChart();
@@ -679,7 +679,7 @@ export default {
{ {
name: '订单金额', name: '订单金额',
type: "bar", type: "bar",
barWidth: time.length <= 7 ? "30%" : "20%", barWidth: time.length <= 7 ? "50%" : "30%",
data: data.map(item => item.orderAmount), data: data.map(item => item.orderAmount),
}, },
// { // {
@@ -688,12 +688,12 @@ export default {
// barWidth: time.length <= 7 ? "30%" : "20%", // barWidth: time.length <= 7 ? "30%" : "20%",
// data: data.map(item => item.actualAmount), // data: data.map(item => item.actualAmount),
// }, // },
{ // {
name: '优惠金额', // name: '优惠金额',
type: "bar", // type: "bar",
barWidth: time.length <= 7 ? "30%" : "20%", // barWidth: time.length <= 7 ? "30%" : "20%",
data: data.map(item => item.discountAmount), // data: data.map(item => item.discountAmount),
} // }
] ]
}); });
}, },
@@ -754,7 +754,7 @@ export default {
return { return {
orderAmount: item.orderAmount, orderAmount: item.orderAmount,
// actualAmount: item.actualAmount, // actualAmount: item.actualAmount,
discountAmount: item.discountAmount // discountAmount: item.discountAmount
} }
}); });
const time = res.total.map(item => item.tradeDay); const time = res.total.map(item => item.tradeDay);
@@ -840,7 +840,7 @@ export default {
// 初始化销售图标 // 初始化销售图标
initProduceChart(p1, p2) { initProduceChart(p1, p2) {
this.productCountChart = echarts.init(this.$refs.productCountChart); this.productCountChart = echarts.init(this.$refs.productCountChart);
this.productSumChart = echarts.init(this.$refs.productSumChart); // this.productSumChart = echarts.init(this.$refs.productSumChart);
this.productCountChart.setOption({ this.productCountChart.setOption({
tooltip: { tooltip: {
@@ -913,76 +913,76 @@ export default {
] ]
}); });
this.productSumChart.setOption({ // this.productSumChart.setOption({
tooltip: { // tooltip: {
trigger: "axis" // trigger: "axis"
}, // },
grid: { // grid: {
x: 0, // x: 0,
y: 0, // y: 0,
x2: 0, // x2: 0,
y2: 0 // y2: 0
}, // },
xAxis: [ // xAxis: [
{ // {
boundaryGap: false, // boundaryGap: false,
type: "category", // type: "category",
data: p2[0], // data: p2[0],
show: false, // 不显示坐标轴线、坐标轴刻度线和坐标轴上的文字 // show: false, // 不显示坐标轴线、坐标轴刻度线和坐标轴上的文字
axisTick: { // axisTick: {
show: false // 不显示坐标轴刻度线 // show: false // 不显示坐标轴刻度线
}, // },
axisLine: { // axisLine: {
show: false // 不显示坐标轴线 // show: false // 不显示坐标轴线
}, // },
axisLabel: { // axisLabel: {
show: false // 不显示坐标轴上的文字 // show: false // 不显示坐标轴上的文字
}, // },
splitLine: { // splitLine: {
show: false // 不显示网格线 // show: false // 不显示网格线
} // }
} // }
], // ],
color: "#409eff", // color: "#409eff",
yAxis: [ // yAxis: [
{ // {
type: "value", // type: "value",
show: false, // 不显示坐标轴线、坐标轴刻度线和坐标轴上的文字 // show: false, // 不显示坐标轴线、坐标轴刻度线和坐标轴上的文字
axisTick: { // axisTick: {
show: false // 不显示坐标轴刻度线 // show: false // 不显示坐标轴刻度线
}, // },
axisLine: { // axisLine: {
show: false // 不显示坐标轴线 // show: false // 不显示坐标轴线
}, // },
axisLabel: { // axisLabel: {
show: false // 不显示坐标轴上的文字 // show: false // 不显示坐标轴上的文字
}, // },
splitLine: { // splitLine: {
show: false // 不显示网格线 // show: false // 不显示网格线
} // }
} // }
], // ],
series: [ // series: [
{ // {
data: p2[1], // data: p2[1],
type: "line", // type: "line",
symbol: "none", // symbol: "none",
smooth: true, // smooth: true,
areaStyle: { // areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ // {
offset: 0, // offset: 0,
color: "#409eff" // 渐变颜色 // color: "#409eff" // 渐变颜色
}, // },
{ // {
offset: 1, // offset: 1,
color: "#409eff" // 渐变颜色 // color: "#409eff" // 渐变颜色
} // }
]) // ])
} // }
} // }
] // ]
}); // });
}, },
// 日期汇总数据 // 日期汇总数据
async summaryDateGet(res) { async summaryDateGet(res) {

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-dialog width="80%" :visible.sync="dialogVisible" :show-close="false" @close="reset"> <el-dialog top="10vh" :visible.sync="dialogVisible" :show-close="false" @close="reset">
<div class="header_wrap"> <div class="header_wrap">
<div class="title">耗材信息</div> <div class="title">耗材信息</div>
<div class="btn_wrap"> <div class="btn_wrap">
@@ -23,8 +23,7 @@
<template v-slot="scope"> <template v-slot="scope">
<el-select v-model="scope.row.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词" <el-select v-model="scope.row.conInfoId" filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod" :loading="loading" @change="selectionChange($event, scope.row)"> :remote-method="remoteMethod" :loading="loading" @change="selectionChange($event, scope.row)">
<el-option v-for="item in options" :key="item.id" :label="item.conName" <el-option v-for="item in options" :key="item.id" :label="item.conName" :value="item.id">
:value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<div class="tips" v-if="scope.row.stockNumber">库存{{ scope.row.stockNumber }}</div> <div class="tips" v-if="scope.row.stockNumber">库存{{ scope.row.stockNumber }}</div>
@@ -41,13 +40,15 @@
<el-input-number v-model="scope.row.surplusStock" :min="0" /> <el-input-number v-model="scope.row.surplusStock" :min="0" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作" width="100">
<template v-slot="scope"> <template v-slot="scope">
<div class="table_btn_wrap"> <div class="table_btn_wrap">
<div class="btn sub" v-if="scope.$index > 0" @click="tableData.cons.splice(scope.$index, 1)"> <div class="btn sub" v-if="tableData.cons.length > 1"
@click="tableData.cons.splice(scope.$index, 1)">
<i class="el-icon-remove-outline"></i> <i class="el-icon-remove-outline"></i>
</div> </div>
<div class="btn add" @click="createItem(scope.row)"> <div class="btn add" v-if="scope.$index == tableData.cons.length - 1"
@click="createItem(scope.row)">
<i class="el-icon-circle-plus-outline"></i> <i class="el-icon-circle-plus-outline"></i>
</div> </div>
</div> </div>
@@ -55,7 +56,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 绑定到规格 --> <!-- 绑定到规格 -->
<el-table :data="tableData.cons" border v-show="type == 2"> <el-table :data="tableData.cons" border v-show="type == 2" height="500px">
<el-table-column label="序号" type="index" width="100"></el-table-column> <el-table-column label="序号" type="index" width="100"></el-table-column>
<el-table-column label="规格名称" prop="specSnap"></el-table-column> <el-table-column label="规格名称" prop="specSnap"></el-table-column>
<el-table-column label="耗材" width="600"> <el-table-column label="耗材" width="600">
@@ -86,18 +87,20 @@
<el-table-column label="消耗量"> <el-table-column label="消耗量">
<template v-slot="scope"> <template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index"> <div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<el-input-number v-model="item.surplusStock" :min="0" /> <el-input-number v-model="item.surplusStock" :min="1" />
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作" width="100">
<template v-slot="scope"> <template v-slot="scope">
<div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index"> <div class="sku_table_item" v-for="(item, index) in scope.row.consList" :key="index">
<div class="table_btn_wrap t"> <div class="table_btn_wrap t">
<div class="btn sub" v-if="index > 0" @click="scope.row.consList.splice(index, 1)"> <div class="btn sub" v-if="scope.row.consList.length > 1"
@click="scope.row.consList.splice(index, 1)">
<i class="el-icon-remove-outline"></i> <i class="el-icon-remove-outline"></i>
</div> </div>
<div class="btn add" @click="skuCreateItem(scope.$index)"> <div class="btn add" v-if="index == scope.row.consList.length - 1"
@click="skuCreateItem(scope.$index)">
<i class="el-icon-circle-plus-outline"></i> <i class="el-icon-circle-plus-outline"></i>
</div> </div>
</div> </div>
@@ -247,7 +250,7 @@ export default {
item.conInfoId = '' item.conInfoId = ''
item.name = '' item.name = ''
item.conUnit = '' item.conUnit = ''
item.surplusStock = 0 item.surplusStock = 1
item.status = 1 item.status = 1
this.tableData.cons.push(item) this.tableData.cons.push(item)
} else { } else {
@@ -278,7 +281,7 @@ export default {
item.conInfoId = '' item.conInfoId = ''
item.name = '' item.name = ''
item.conUnit = '' item.conUnit = ''
item.surplusStock = 0 item.surplusStock = 1
item.status = 1 item.status = 1
this.tableData.cons.push(item) this.tableData.cons.push(item)
} }
@@ -295,7 +298,7 @@ export default {
item.conInfoId = '' item.conInfoId = ''
item.name = '' item.name = ''
item.conUnit = '' item.conUnit = ''
item.surplusStock = 0 item.surplusStock = 1
item.status = 1 item.status = 1
item.specSnap = val.name item.specSnap = val.name
@@ -315,13 +318,24 @@ export default {
this.tableData.cons.map(val => { this.tableData.cons.map(val => {
this.goodsDetail.conInfos.map(item => { this.goodsDetail.conInfos.map(item => {
if (item.productSkuId == val.productSkuId) { if (item.productSkuId == val.productSkuId) {
val.consList.unshift({ if (val.consList.length == 1 && val.consList[0].conInfoId == '') {
id: item.id, val.consList = []
surplusStock: item.surplusStock, val.consList.push({
conInfoId: item.conInfoId, id: item.id,
name: item.conName, surplusStock: item.surplusStock,
conUnit: item.conUnit conInfoId: item.conInfoId,
}) name: item.conName,
conUnit: item.conUnit
})
} else {
val.consList.push({
id: item.id,
surplusStock: item.surplusStock,
conInfoId: item.conInfoId,
name: item.conName,
conUnit: item.conUnit
})
}
} }
}) })
}) })
@@ -339,7 +353,7 @@ export default {
item.conInfoId = '' item.conInfoId = ''
item.name = '' item.name = ''
item.conUnit = '' item.conUnit = ''
item.surplusStock = 0 item.surplusStock = 1
item.status = 1 item.status = 1
this.tableData.cons.push(item) this.tableData.cons.push(item)