fix:销售统计格式类比采购统计
This commit is contained in:
parent
ff19bedf76
commit
b5472e8c52
|
@ -2,8 +2,9 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select v-model="queryType" clearable @change="queryTypeChange">
|
<el-select v-model="queryType" @change="queryTypeChange">
|
||||||
<el-option v-for="item in typeOptions"
|
<el-option
|
||||||
|
v-for="item in typeOptions"
|
||||||
:key="item"
|
:key="item"
|
||||||
:label="item"
|
:label="item"
|
||||||
:value="item"
|
:value="item"
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
type="month"
|
type="month"
|
||||||
placeholder="查询月期"
|
placeholder="查询月期"
|
||||||
value-format="YYYY-MM"
|
value-format="YYYY-MM"
|
||||||
style="width:100%"
|
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -25,41 +25,86 @@
|
||||||
type="year"
|
type="year"
|
||||||
placeholder="查询年份"
|
placeholder="查询年份"
|
||||||
value-format="YYYY"
|
value-format="YYYY"
|
||||||
style="width:100%"
|
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleQuery"
|
||||||
|
></el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main id="elMain">
|
<el-main id="elMain">
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="15">
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
<el-card shadow="never" style="margin-bottom: 8px">
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>棒管交付数</h2>
|
<h2>产品交付统计</h2>
|
||||||
<!-- <el-select v-model="product" clearable @change="productChange">
|
<el-select
|
||||||
<el-option v-for="item in inmData"
|
v-model="materialSale"
|
||||||
|
clearable
|
||||||
|
@change="materialSaleChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in inmData"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.material_.name"
|
:label="item.material_.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select> -->
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
<div
|
||||||
<!-- <scEcharts height="300px" :option="option1"></scEcharts> -->
|
id="bachart1"
|
||||||
|
style="width: 100%; height: 300px"
|
||||||
|
></div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
<el-card
|
||||||
<el-button @click="handleExport('ZJ')" class="tables" type="primary">导出</el-button>
|
shadow="never"
|
||||||
<el-table :data="tableData1" id="exportDivZJ" :height="tableHeight">
|
style="
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 20px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
@click="handleExport('1')"
|
||||||
|
class="tables"
|
||||||
|
type="primary"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="tableData1"
|
||||||
|
id="exportDiv1"
|
||||||
|
:height="tableHeight"
|
||||||
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column
|
||||||
|
label="年份"
|
||||||
|
prop="年"
|
||||||
|
width="80"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="queryType == '月'"
|
||||||
|
width="50"
|
||||||
|
label="周"
|
||||||
|
prop="周"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-else
|
||||||
|
width="50"
|
||||||
|
label="月份"
|
||||||
|
prop="月"
|
||||||
|
/>
|
||||||
|
<el-table-column label="名称" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="批次" prop="name">
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="count">
|
<el-table-column label="数量" prop="count">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -69,38 +114,56 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
<el-card shadow="never" style="margin-bottom: 8px">
|
||||||
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>管交付数</h2>
|
<h2>交付统计总表</h2>
|
||||||
<!-- <el-select v-model="product" clearable @change="productChange">
|
|
||||||
<el-option v-for="item in outData"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.material_.name"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select> -->
|
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-row>
|
<el-main style="width: 100%; position: relative">
|
||||||
<el-col>
|
<el-button
|
||||||
<div id="bachart2" style="width:100%;height:300px;"></div>
|
@click="handleExport('2')"
|
||||||
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
|
class="tables"
|
||||||
</el-col>
|
type="primary"
|
||||||
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
>导出</el-button
|
||||||
<el-button @click="handleExport('ZB')" class="tables" type="primary">导出</el-button>
|
>
|
||||||
<el-table :data="tableData2" id="exportDivZB" :height="tableHeight">
|
|
||||||
|
<scTable
|
||||||
|
:data="tableData2"
|
||||||
|
id="exportDiv2"
|
||||||
|
:height="rightHeight"
|
||||||
|
hideDo
|
||||||
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column
|
||||||
|
label="年份"
|
||||||
|
prop="年"
|
||||||
|
width="80"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="queryType == '月'"
|
||||||
|
width="50"
|
||||||
|
label="周"
|
||||||
|
prop="周"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-else
|
||||||
|
width="50"
|
||||||
|
label="月份"
|
||||||
|
prop="月"
|
||||||
|
/>
|
||||||
|
<el-table-column label="名称" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="批次" prop="name">
|
<el-table-column label="规格" prop="规格">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="count">
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-card>
|
</el-table-column>
|
||||||
</el-row>
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -110,107 +173,75 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import T from '@/components/scEcharts/echarts-theme-T.js';
|
import T from "@/components/scEcharts/echarts-theme-T.js";
|
||||||
echarts.registerTheme('T', T);
|
echarts.registerTheme("T", T);
|
||||||
import scEcharts from '@/components/scEcharts';
|
|
||||||
function deepCopy(obj) {
|
function deepCopy(obj) {
|
||||||
return JSON.parse(JSON.stringify(obj));
|
return JSON.parse(JSON.stringify(obj));
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'chart',
|
name: "chart",
|
||||||
components: {
|
|
||||||
scEcharts
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryType:'月',
|
queryType: "月",
|
||||||
queryDate:'',
|
queryDate: "",
|
||||||
start_date:'',
|
start_date: "",
|
||||||
end_date:'',
|
end_date: "",
|
||||||
currentYear:'',
|
currentYear: "",
|
||||||
currentMonth:'',
|
currentMonth: "",
|
||||||
xAxisOrigin: [],
|
xAxisOrigin: [],
|
||||||
xAxisData: [],
|
xAxisData: [],
|
||||||
typeOptions:['月','年'],
|
typeOptions: ["月", "年"],
|
||||||
basicOption: {
|
basicOption: {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: "transparent",
|
||||||
title: {
|
title: {
|
||||||
text: '',
|
text: "",
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: '80px'
|
top: "80px",
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis'
|
trigger: "axis",
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: "category",
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: "value",
|
||||||
},
|
},
|
||||||
lenged: [],
|
lenged: [],
|
||||||
series: [{
|
series: [
|
||||||
|
{
|
||||||
data: [0, 0, 0, 0, 0, 0, 0],
|
data: [0, 0, 0, 0, 0, 0, 0],
|
||||||
stack: 'Ad',
|
stack: "Ad",
|
||||||
type: 'bar',
|
type: "bar",
|
||||||
barWidth: '15px',
|
barWidth: "15px",
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
// option1: {
|
|
||||||
// grid: {
|
|
||||||
// top: '80px'
|
|
||||||
// },
|
|
||||||
// tooltip: {
|
|
||||||
// trigger: 'axis'
|
|
||||||
// },
|
|
||||||
// xAxis: {
|
|
||||||
// type: 'category',
|
|
||||||
// data:xAxisData
|
|
||||||
// },
|
|
||||||
// yAxis: {
|
|
||||||
// type: 'value'
|
|
||||||
// },
|
|
||||||
// series: [{
|
|
||||||
// data: [120, 200, 150, 80, 70, 110, 130],
|
|
||||||
// type: 'bar',
|
|
||||||
// barWidth: '15px',
|
|
||||||
// }]
|
|
||||||
// },
|
|
||||||
// option2: {
|
|
||||||
// grid: {
|
|
||||||
// top: '80px'
|
|
||||||
// },
|
|
||||||
// tooltip: {
|
|
||||||
// trigger: 'axis'
|
|
||||||
// },
|
|
||||||
// xAxis: {
|
|
||||||
// type: 'category',
|
|
||||||
// data: xAxisData
|
|
||||||
// },
|
|
||||||
// yAxis: {
|
|
||||||
// type: 'value'
|
|
||||||
// },
|
|
||||||
// series: [{
|
|
||||||
// data: [120, 200, 150, 80, 70, 110, 130],
|
|
||||||
// type: 'bar',
|
|
||||||
// barWidth: '15px',
|
|
||||||
// }]
|
|
||||||
// },
|
|
||||||
tableHeight:0,
|
|
||||||
tableData:[
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-1',count:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-2',count:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-3',count:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-4',count:200},
|
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
materialSale: "",
|
||||||
|
saleOption: [],
|
||||||
|
tableHeight: 0,
|
||||||
|
rightHeight: 0,
|
||||||
tableData1: [],
|
tableData1: [],
|
||||||
tableData2: [],
|
tableData2: [],
|
||||||
firstWeekNum: 1,
|
firstWeekNum: 1,
|
||||||
endWeekNum: 4,
|
endWeekNum: 4,
|
||||||
monthList:['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
monthList: [
|
||||||
}
|
"一月",
|
||||||
|
"二月",
|
||||||
|
"三月",
|
||||||
|
"四月",
|
||||||
|
"五月",
|
||||||
|
"六月",
|
||||||
|
"七月",
|
||||||
|
"八月",
|
||||||
|
"九月",
|
||||||
|
"十月",
|
||||||
|
"十一月",
|
||||||
|
"十二月",
|
||||||
|
],
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -220,148 +251,201 @@
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
that.currentYear = year;
|
that.currentYear = year;
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
that.start_date =year+'-'+month+'-01';
|
that.start_date = year + "-" + month + "-01";
|
||||||
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
that.end_date =
|
||||||
|
year + "-" + month + "-" + new Date(year, month, 0).getDate();
|
||||||
let month1 = month;
|
let month1 = month;
|
||||||
if(month1<10){month1='0'+month1}
|
if (month1 < 10) {
|
||||||
that.queryDate = year+'-'+month1;
|
month1 = "0" + month1;
|
||||||
|
}
|
||||||
|
that.queryDate = year + "-" + month1;
|
||||||
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
|
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
|
||||||
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
|
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
|
||||||
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
that.xAxisOrigin.push('第'+i+'周');
|
that.xAxisOrigin.push("第" + i + "周");
|
||||||
}
|
}
|
||||||
that.xAxisData = that.xAxisOrigin;
|
that.xAxisData = that.xAxisOrigin;
|
||||||
let height= document.getElementById('elMain').clientHeight-140;
|
let height = document.getElementById("elMain").clientHeight;
|
||||||
let chartheight= document.getElementById('bachart1').clientHeight;
|
let chartheight = document.getElementById("bachart1").clientHeight;
|
||||||
that.tableHeight = height-chartheight;
|
that.tableHeight = height - 140 - chartheight;
|
||||||
this.getTableData();
|
that.rightHeight = height - 115;
|
||||||
// this.getTableData2();
|
that.getTable();
|
||||||
|
that.setChart("bachart1", that.basicOption);
|
||||||
|
this.getSaleOption();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChart(name, option = null) {
|
setChart(name, option = null) {
|
||||||
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
||||||
var myChart = echarts.getInstanceByDom(document.getElementById(name));
|
var myChart = echarts.getInstanceByDom(
|
||||||
|
document.getElementById(name)
|
||||||
|
);
|
||||||
if (myChart == undefined) {
|
if (myChart == undefined) {
|
||||||
myChart = echarts.init(document.getElementById(name), 'T');
|
myChart = echarts.init(document.getElementById(name), "T");
|
||||||
}
|
}
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
option = Object.assign({}, this.basicOption)
|
option = Object.assign({}, this.basicOption);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
myChart.setOption(option);
|
myChart.setOption(option);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}, 500)
|
}, 500);
|
||||||
},
|
},
|
||||||
queryTypeChange(value) {
|
queryTypeChange(value) {
|
||||||
console.log(value)
|
console.log(value);
|
||||||
this.queryDate = '';
|
this.queryDate = "";
|
||||||
},
|
},
|
||||||
getWeekOfYear(date) {
|
getWeekOfYear(date) {
|
||||||
var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // 创建目标日期对象
|
var target = new Date(
|
||||||
|
date.getFullYear(),
|
||||||
|
date.getMonth(),
|
||||||
|
date.getDate()
|
||||||
|
); // 创建目标日期对象
|
||||||
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
||||||
if (target.getTime() == firstDayOfYear.getTime()) {
|
if (target.getTime() == firstDayOfYear.getTime()) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000);
|
return Math.ceil(
|
||||||
|
(target -
|
||||||
|
firstDayOfYear +
|
||||||
|
8 * (firstDayOfYear.getTimezoneOffset() / 480)) /
|
||||||
|
604800000
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// 计算两者之间相隔的周数并返回结果
|
// 计算两者之间相隔的周数并返回结果
|
||||||
},
|
},
|
||||||
getTableData(){
|
materialSaleChange() {
|
||||||
|
this.getSaleData();
|
||||||
|
},
|
||||||
|
//交付物料选项
|
||||||
|
getSaleOption() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let option1 = deepCopy(that.basicOption);
|
let obj = {};
|
||||||
let option2 = deepCopy(that.basicOption);
|
obj.page = 0;
|
||||||
option1.xAxis.data = that.xAxisData;
|
obj.type__in = "10";
|
||||||
option2.xAxis.data = that.xAxisData;
|
that.$API.mtm.material.list.req(obj).then((res) => {
|
||||||
let exec = that.queryType=='月'?'saleOutWeek':'saleOutMonth';
|
that.saleOption = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//交付物料
|
||||||
|
getSaleData() {
|
||||||
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: that.start_date, end_date: that.end_date,mio_type:'sale_out',material_id:'' },
|
query: {
|
||||||
|
start_date: that.start_date,
|
||||||
|
end_date: that.end_date,
|
||||||
|
mio_type: "sale_out",
|
||||||
|
material_id: that.materialSale,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
// console.log('交付数:',res);
|
console.log("getSaleData", res);
|
||||||
if(res.length>0){
|
option.series.data = [];
|
||||||
let data1 = [],data2 = [],seriesData1=[],seriesData2=[];
|
if (res.data2.ds0) {
|
||||||
for(let i=0;i<res.length;i++){
|
let data = res.data2.ds0;
|
||||||
if(res[i].物料名.indexOf('棒')){
|
that.tableData1 = data;
|
||||||
data1.push(res[i]);
|
if (data.length > 0) {
|
||||||
}else if(res[i].物料名.indexOf('管')){
|
let seriesData = [];
|
||||||
data2.push(res[i]);
|
data.forEach((item) => {
|
||||||
}
|
if (that.queryType == "月") {
|
||||||
}
|
let index = item.周 - that.firstWeekNum;
|
||||||
that.tableData1 = data1;
|
seriesData[index] = item.数量;
|
||||||
that.tableData2 = data2;
|
|
||||||
data1.forEach(item1=>{
|
|
||||||
let index =0;
|
|
||||||
if(that.queryType=='月'){
|
|
||||||
index = item1.月-1;
|
|
||||||
} else {
|
} else {
|
||||||
index = item1.周-that.firstWeekNum;
|
let index = item.月 - 1;
|
||||||
|
seriesData[index] = item.数量;
|
||||||
}
|
}
|
||||||
seriesData1[index]=item1.交付数;
|
});
|
||||||
})
|
option.series.data = seriesData;
|
||||||
data2.forEach(item2=>{
|
|
||||||
let index2 =0;
|
|
||||||
if(that.queryType=='月'){
|
|
||||||
index2 = item2.月-1;
|
|
||||||
}else{
|
|
||||||
index2 = item2.周-that.firstWeekNum;
|
|
||||||
}
|
}
|
||||||
seriesData2[index2]=item2.交付数;
|
|
||||||
})
|
|
||||||
option1.seriesData1 = seriesData1;
|
|
||||||
option2.seriesData2 = seriesData2;
|
|
||||||
that.setChart("bachart1", option1);
|
|
||||||
that.setChart("bachart2", option2);
|
|
||||||
}else{
|
|
||||||
that.setChart("bachart1", option1);
|
|
||||||
that.setChart("bachart2", option2);
|
|
||||||
}
|
}
|
||||||
})
|
that.setChart("bachart1", option);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getTable() {
|
||||||
|
let that = this;
|
||||||
|
let obj = {
|
||||||
|
query: {
|
||||||
|
start_date: that.start_date,
|
||||||
|
end_date: that.end_date,
|
||||||
|
mio_type: "sale_out",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
that.tableData2 = [];
|
||||||
|
if (res.data2.ds0) {
|
||||||
|
let data = res.data2.ds0;
|
||||||
|
that.tableData2 = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if(this.queryType=='月'){
|
if (this.queryType == "月") {
|
||||||
if(this.queryDate!==''&&this.queryDate!==null){
|
if (this.queryDate !== "" && this.queryDate !== null) {
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date = this.queryDate + "-01";
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split("-");
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date =
|
||||||
this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date));
|
this.queryDate +
|
||||||
this.endWeekNum = this.getWeekOfYear(new Date(this.end_date));
|
"-" +
|
||||||
|
new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
this.firstWeekNum = this.getWeekOfYear(
|
||||||
|
new Date(this.start_date)
|
||||||
|
);
|
||||||
|
this.endWeekNum = this.getWeekOfYear(
|
||||||
|
new Date(this.end_date)
|
||||||
|
);
|
||||||
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
||||||
let xAxisData = [];
|
let xAxisData = [];
|
||||||
for (let i = 1; i <= duration; i++) {
|
for (let i = 1; i <= duration; i++) {
|
||||||
xAxisData.push('第'+i+'周');
|
xAxisData.push("第" + i + "周");
|
||||||
}
|
}
|
||||||
that.xAxisData = xAxisData;
|
that.xAxisData = xAxisData;
|
||||||
} else {
|
} else {
|
||||||
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
this.start_date =
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
this.currentYear + "-" + this.currentMonth + "-01";
|
||||||
|
this.end_date =
|
||||||
|
this.currentYear +
|
||||||
|
"-" +
|
||||||
|
this.currentMonth +
|
||||||
|
"-" +
|
||||||
|
new Date(
|
||||||
|
this.currentYear,
|
||||||
|
this.currentMonth,
|
||||||
|
0
|
||||||
|
).getDate();
|
||||||
let date = new Date(this.start_date);
|
let date = new Date(this.start_date);
|
||||||
this.firstWeekNum = this.getWeekOfYear(date);
|
this.firstWeekNum = this.getWeekOfYear(date);
|
||||||
this.xAxisData = this.xAxisOrigin;
|
this.xAxisData = this.xAxisOrigin;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(this.queryDate!==''&&this.queryDate!==null){
|
if (this.queryDate !== "" && this.queryDate !== null) {
|
||||||
this.start_date = this.queryDate+'-01-01';
|
this.start_date = this.queryDate + "-01-01";
|
||||||
this.end_date = this.queryDate+'-12-31';
|
this.end_date = this.queryDate + "-12-31";
|
||||||
} else {
|
} else {
|
||||||
this.start_date = this.currentYear+'-01-01';
|
this.start_date = this.currentYear + "-01-01";
|
||||||
this.end_date = this.currentYear+'-12-31';
|
this.end_date = this.currentYear + "-12-31";
|
||||||
}
|
}
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
this.getTableData();
|
that.getTable();
|
||||||
|
if (that.materialSale !== "" && that.materialSale !== null) {
|
||||||
|
that.getSaleData();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = '#exportDiv' + val;
|
let id = "#exportDiv" + val;
|
||||||
let name = val == 'ZJ' ? '棒交付统计' : '管交付统计';
|
let name = val == "1" ? "交付统计" : "交付统计总表";
|
||||||
this.$XLSX(id, name);
|
this.$XLSX(id, name);
|
||||||
this.exportLoading = false;
|
this.exportLoading = false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -84,18 +84,28 @@
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column
|
||||||
<template #default="scope">
|
label="年份"
|
||||||
<span>{{ scope.row.年 }}-</span>
|
prop="年"
|
||||||
<span v-if="scope.row.周">{{
|
width="80"
|
||||||
scope.row.周
|
/>
|
||||||
}}</span>
|
<el-table-column
|
||||||
<span v-if="scope.row.月">{{
|
v-if="queryType == '月'"
|
||||||
scope.row.月
|
width="50"
|
||||||
}}</span>
|
label="周"
|
||||||
</template>
|
prop="周"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-else
|
||||||
|
width="50"
|
||||||
|
label="月份"
|
||||||
|
prop="月"
|
||||||
|
/>
|
||||||
|
<el-table-column label="名称" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="名称" prop="物料">
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="数量">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -127,14 +137,20 @@
|
||||||
hideDo
|
hideDo
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="年份" prop="年" />
|
<el-table-column
|
||||||
|
label="年份"
|
||||||
|
prop="年"
|
||||||
|
width="80"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-if="queryType == '月'"
|
v-if="queryType == '月'"
|
||||||
|
width="50"
|
||||||
label="周"
|
label="周"
|
||||||
prop="周"
|
prop="周"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-else
|
v-else
|
||||||
|
width="50"
|
||||||
label="月份"
|
label="月份"
|
||||||
prop="月"
|
prop="月"
|
||||||
/>
|
/>
|
||||||
|
@ -343,10 +359,11 @@ export default {
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log("getInmData", res);
|
console.log("getInmData", res);
|
||||||
|
option.series.data = [];
|
||||||
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData1 = data;
|
that.tableData1 = data;
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
option.series.data = [];
|
|
||||||
let seriesData = [];
|
let seriesData = [];
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
if (that.queryType == "月") {
|
if (that.queryType == "月") {
|
||||||
|
@ -358,10 +375,9 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
option.series.data = seriesData;
|
option.series.data = seriesData;
|
||||||
that.setChart("bachart1", option);
|
|
||||||
} else {
|
|
||||||
that.setChart("bachart1", option);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
that.setChart("bachart1", option);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTable() {
|
getTable() {
|
||||||
|
@ -375,11 +391,10 @@ export default {
|
||||||
};
|
};
|
||||||
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
that.tableData2 = [];
|
||||||
if (res.data2.ds0) {
|
if (res.data2.ds0) {
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData2 = data;
|
that.tableData2 = data;
|
||||||
} else {
|
|
||||||
that.tableData2 = [];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue