Compare commits

...

9 Commits

Author SHA1 Message Date
helloDy
7f379f2589 Merge branch 'projects/mescc/develop' into projects/mescc/dy 2024-06-18 08:48:31 +08:00
helloDy
e990680159 bug 2024-06-18 08:47:53 +08:00
d6cb371c68 Merge pull request 'projects/mescc/zhp' (#45) from projects/mescc/zhp into projects/mescc/develop
Some checks are pending
continuous-integration/drone/push Build is pending
Reviewed-on: #45
2024-06-18 08:46:50 +08:00
‘937886381’
731243636f Merge branch 'projects/mescc/develop' into projects/mescc/zhp 2024-06-17 17:00:11 +08:00
‘937886381’
14c782f112 修改 2024-06-17 16:59:41 +08:00
2b3db710c1 Merge pull request 'projects/mescc/zhp' (#44) from projects/mescc/zhp into projects/mescc/develop
Some checks are pending
continuous-integration/drone/push Build is pending
Reviewed-on: #44
2024-06-17 15:36:53 +08:00
‘937886381’
0ef7c9808c Merge branch 'projects/mescc/develop' into projects/mescc/zhp 2024-06-17 15:35:14 +08:00
‘937886381’
f241a35252 修改 2024-06-17 15:34:37 +08:00
e9d17e0f82 Merge pull request 'projects/mescc/dy' (#43) from projects/mescc/dy into projects/mescc/develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #43
2024-06-17 09:19:57 +08:00
18 changed files with 2075 additions and 519 deletions

15
src/api/report/index.js Normal file
View File

@ -0,0 +1,15 @@
/*
* @Author: zhp
* @Date: 2024-06-17 09:41:03
* @LastEditTime: 2024-06-17 09:54:26
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
export function getComprehensiveDataPage(data) {
return request({
url: 'ip/comprehensive/data/get/comprehensive/data',
method: 'get',
params: data
})
}

View File

@ -436,7 +436,10 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu
if (preData && preData[0] != null) { if (preData && preData[0] != null) {
for (const factory of preData) { for (const factory of preData) {
const fId = getPreFactoryId(factory); const fId = getPreFactoryId(factory);
chipInvest.previous[fId] = factory.previousYearInputNumber; if (factory.previousGlassType === 0) {
chipInvest.previous[fId] = factory.previousYearInputNumber
}
// chipInvest.previous[fId] = factory.previousYearInputNumber;
if (![0, 1, 2].includes(factory.previousGlassType)) continue; if (![0, 1, 2].includes(factory.previousGlassType)) continue;
const _t = [chipOutput, stdOutput, bipvOutput][factory.previousGlassType]; const _t = [chipOutput, stdOutput, bipvOutput][factory.previousGlassType];
// if (fId) { // if (fId) {
@ -473,7 +476,7 @@ function splitCurrentAndPrevious(factoryListResponse, targetListResponse, prodOu
const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType]; const _t = [chipOutput, stdOutput, bipvOutput][factory.glassType];
_t.current[fId] = factory.outputNumber; _t.current[fId] = factory.outputNumber;
} }
console.log('chipInvest',chipInvest); console.log('chipInvest',ftoInvest);
return { return {
chipInvest, chipInvest,
// ftoInvest, // ftoInvest,

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-07 13:22:43 * @Date: 2024-05-07 13:22:43
* @LastEditTime: 2024-06-14 10:05:37 * @LastEditTime: 2024-06-17 09:22:17
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -180,30 +180,30 @@ export default {
itemStyle: { itemStyle: {
color: "#f3c000", color: "#f3c000",
}, },
areaStyle: { // areaStyle: {
color: { // color: {
type: "linear", // type: "linear",
x: 0, // x: 0,
y: 0, // y: 0,
x2: 0, // x2: 0,
y2: 1, // y2: 1,
colorStops: [ // colorStops: [
{ // {
offset: 0, // offset: 0,
color: "#f3c000", // 0% // color: "#f3c000", // 0%
}, // },
{ // {
offset: 0.55, // offset: 0.55,
color: "#f3c00033", // color: "#f3c00033",
}, // },
{ // {
offset: 1, // offset: 1,
color: "transparent", // 100% // color: "transparent", // 100%
}, // },
], // ],
global: false, // false // global: false, // false
}, // },
}, // },
data: [], // this.series[0].data, data: [], // this.series[0].data,
}, },
], ],

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-23 15:50:44 * @Date: 2024-05-23 15:50:44
* @LastEditTime: 2024-06-06 15:13:06 * @LastEditTime: 2024-06-17 09:23:39
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -180,30 +180,30 @@ export default {
itemStyle: { itemStyle: {
color: "#f3c000", color: "#f3c000",
}, },
areaStyle: { // areaStyle: {
color: { // color: {
type: "linear", // type: "linear",
x: 0, // x: 0,
y: 0, // y: 0,
x2: 0, // x2: 0,
y2: 1, // y2: 1,
colorStops: [ // colorStops: [
{ // {
offset: 0, // offset: 0,
color: "#f3c000", // 0% // color: "#f3c000", // 0%
}, // },
{ // {
offset: 0.55, // offset: 0.55,
color: "#f3c00033", // color: "#f3c00033",
}, // },
{ // {
offset: 1, // offset: 1,
color: "transparent", // 100% // color: "transparent", // 100%
}, // },
], // ],
global: false, // false // global: false, // false
}, // },
}, // },
data: [], // this.series[0].data, data: [], // this.series[0].data,
}, },
], ],

View File

@ -1,4 +1,5 @@
<template> <template>
<chart-container class="bar-chart-base">
<div class="left-chart-base"> <div class="left-chart-base">
<!-- <div class="legend"> <!-- <div class="legend">
<span v-for="item in legend" :key="item.label" class="legend-item" <span v-for="item in legend" :key="item.label" class="legend-item"
@ -7,13 +8,17 @@
<div id="factoryEnergyChart" style="width: 100%; height: 100%"></div> <div id="factoryEnergyChart" style="width: 100%; height: 100%"></div>
</div> </div>
</chart-container>
</template> </template>
<script> <script>
import { debounce } from "@/utils/debounce"; import { debounce } from "@/utils/debounce";
import * as echarts from "echarts"; import * as echarts from "echarts";
import ChartContainer from "../../components/ChartContainer.vue";
// import CopilotButton from "./chartButton" // import CopilotButton from "./chartButton"
export default { export default {
components: { components: {
ChartContainer
// CopilotButton, // CopilotButton,
}, },
name: "Energy", name: "Energy",
@ -68,7 +73,7 @@ export default {
}, },
}, },
axisLabel: { axisLabel: {
rotate:45, // rotate:45,
color: "rgba(255, 255, 255, 0.7)", color: "rgba(255, 255, 255, 0.7)",
fontSize: 12, fontSize: 12,
}, },

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-29 14:48:06 * @Date: 2024-05-29 14:48:06
* @LastEditTime: 2024-06-07 14:11:01 * @LastEditTime: 2024-06-17 16:40:15
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -54,8 +54,20 @@ export default {
legend() { legend() {
let items = []; let items = [];
var day1 = new Date(); var day1 = new Date();
day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000); var day2 = new Date();
day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000)
day2.setTime(day2.getTime() - 48 * 60 * 60 * 1000)
var yesterday = (day1.getMonth() + 1) + "月" + day1.getDate() var yesterday = (day1.getMonth() + 1) + "月" + day1.getDate()
var dayBeYes = (day2.getMonth() + 1) + "月" + day2.getDate()
//
// var day2 = new Date();
// day2.setTime(day2.getTime());
// var s2 = (day2.getMonth() + 1) + "" + day2.getDate() + '';
// const today = new Date().getDate();
// let yesterday = new Date().getDate() -1;
// const month = new Date().getMonth() + 1;
// const lastMonth = new Date().getMonth() + 1 === 12 ? 1 : new Date().getMonth() + 1 - 1;
// const year = new Date().getFullYear();
// //
// var day2 = new Date(); // var day2 = new Date();
// day2.setTime(day2.getTime()); // day2.setTime(day2.getTime());
@ -67,13 +79,16 @@ export default {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
if (this.period === 1 && this.than === '同比') { if (this.period === 1 && this.than === '同比') {
items = [ items = [
{ label: `${year-1}${month}${today}`, color: "#12f7f1" }, { label: `${year - 1}${yesterday}累计` },
{ label: `${month}${today}`, color: "#58adfa" }, { label: `${yesterday}日累计`, },
// { label: `${month}${today}`, },
]; ];
} else if (this.period ===1 && this.than === '环比') { } else if (this.period === 1 && this.than === '环比') {
items = [ items = [
{ label: `${yesterday}`, color: "#12f7f1" }, { label: `${dayBeYes}日累计` },
{ label: `${month}${today}`, color: "#58adfa" }, { label: `${yesterday}日累计` },
// { label: `${month}${today}`, },
]; ];
} else if (this.period === 2 && this.than === '同比') { } else if (this.period === 2 && this.than === '同比') {
items = [ items = [

View File

@ -41,7 +41,7 @@ export default {
data: [], data: [],
rowNum: 12, rowNum: 12,
waitTime: 3000, waitTime: 3000,
columnWidth: [100], columnWidth: [150],
align: ["center"], align: ["center"],
carousel: "page", carousel: "page",
}, },
@ -104,8 +104,8 @@ export default {
}</span>` }</span>`
); );
arr.push( arr.push(
`<span title=${this.prodOrder[i].inStatus || ""}>${ `<span title=${this.prodOrder[i].orderStatus || ""}>${
this.prodOrder[i].inStatus || "" this.prodOrder[i].orderStatus === 1 ? '未开始' : this.prodOrder[i].orderStatus === 2 ? '进行中' : '已完成' || ""
}</span>` }</span>`
); );
arr.push( arr.push(

View File

@ -89,7 +89,7 @@ export default {
updateThan(val) { updateThan(val) {
console.log(val); console.log(val);
this.than = val; this.than = val;
// this.getMes(); this.getMes()
}, },
updatePeriod(val) { updatePeriod(val) {
this.period = val; this.period = val;

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-05-20 13:32:59 * @Date: 2024-05-20 13:32:59
* @LastEditTime: 2024-06-14 09:44:42 * @LastEditTime: 2024-06-17 16:42:12
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -118,13 +118,13 @@ export default {
items = [ items = [
{ label: `${yesterday}日累计`,}, { label: `${yesterday}日累计`,},
{ label: `${year - 1}${yesterday}累计` }, { label: `${year - 1}${yesterday}累计` },
{ label: `${month}${today}日目标`, }, { label: `${yesterday}日目标`, },
]; ];
} else if (this.period === '日' && this.than === '环比') { } else if (this.period === '日' && this.than === '环比') {
items = [ items = [
{ label: `${yesterday}日累计`}, { label: `${yesterday}日累计`},
{ label: `${dayBeYes}日累计` }, { label: `${dayBeYes}日累计` },
{ label: `${month}${today}日目标`, }, { label: `${yesterday}日目标`, },
]; ];
} else if (this.period === '周' && this.than === '同比') { } else if (this.period === '周' && this.than === '同比') {
items = [ items = [
@ -243,13 +243,13 @@ function calculateItems(period, valueTuple, than) {
items = [ items = [
{ label: `${year - 1}${yesterday}累计`, value: valueTuple[0] }, { label: `${year - 1}${yesterday}累计`, value: valueTuple[0] },
{ label: `${yesterday}累计`, value: valueTuple[1] }, { label: `${yesterday}累计`, value: valueTuple[1] },
{ label: `${month}${today}日目标`, value: valueTuple[2] }, { label: `${yesterday}日目标`, value: valueTuple[2] },
]; ];
} else if (period === '日' && than === '环比') { } else if (period === '日' && than === '环比') {
items = [ items = [
{ label: `${dayBeYes}日累计`, value: valueTuple[0] }, { label: `${dayBeYes}日累计`, value: valueTuple[0] },
{ label: `${yesterday}日累计`, value: valueTuple[1] }, { label: `${yesterday}日累计`, value: valueTuple[1] },
{ label: `${month}${today}日目标`, value: valueTuple[2] }, { label: `${yesterday}日目标`, value: valueTuple[2] },
]; ];
} else if (period === '周' && than === '同比') { } else if (period === '周' && than === '同比') {
items = [ items = [

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-17 16:31:51 * @Date: 2024-04-17 16:31:51
* @LastEditTime: 2024-06-07 14:44:22 * @LastEditTime: 2024-06-17 16:55:04
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -11,7 +11,7 @@
{{ dataForm.id ? '编辑' : '新增' }} {{ dataForm.id ? '编辑' : '新增' }}
</small-title> </small-title>
<div class="detailBox"> <div class="detailBox">
<el-form ref="form" :model="dataForm" label-width="80px" label-position="top"> <el-form ref="form" :model="dataForm" label-width="80px" :rules="dataRule" label-position="top">
<el-row :gutter="24" style="padding: 0 32px;"> <el-row :gutter="24" style="padding: 0 32px;">
<el-col :span="8"> <el-col :span="8">
<el-form-item v-if="ftype === 0" label="工厂名称" prop="factory"> <el-form-item v-if="ftype === 0" label="工厂名称" prop="factory">
@ -29,7 +29,7 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="时间维度" prop="targetType"> <el-form-item label="时间维度" prop="targetType">
<el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable> <el-select v-model="dataForm.targetType" placeholder="请选择时间维度" clearable @change="clearTime">
<!-- <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"> --> <!-- <el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id"> -->
<el-option label="日" :value="0" /> <el-option label="日" :value="0" />
<el-option label="周" :value="1" /> <el-option label="周" :value="1" />
@ -40,19 +40,19 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item v-show="dataForm.targetType === 0 || dataForm.targetType === ''" label="时间" prop="reportTime"> <el-form-item v-show="dataForm.targetType === 0 || dataForm.targetType === ''" label="时间" prop="reportTime">
<el-date-picker v-model="reportTime" value-format="yyyyMMdd" type="date" placeholder="选择日"> <el-date-picker v-model="dataForm.reportTime" value-format="yyyyMMdd" type="date" placeholder="选择日">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="dataForm.targetType === 1" label="时间" prop="week"> <el-form-item v-show="dataForm.targetType === 1" label="时间" prop="reportTime">
<el-date-picker v-model="week" type="week" format="yyyy 第 WW 周" placeholder="选择周"> <el-date-picker v-model="week" type="week" format="yyyy 第 WW 周" placeholder="选择周" @change="setReportTime">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="dataForm.targetType === 2" label="时间" prop="reportTime"> <el-form-item v-show="dataForm.targetType === 2" label="时间" prop="reportTime">
<el-date-picker v-model="reportTime" value-format="yyyyMM" type="month" placeholder="选择月份"> <el-date-picker v-model="dataForm.reportTime" value-format="yyyyMM" type="month" placeholder="选择月份">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="dataForm.targetType === 3" label="时间" prop="reportTime"> <el-form-item v-show="dataForm.targetType === 3" label="时间" prop="reportTime">
<el-date-picker clearable v-model="reportTime" value-format="yyyy" type="year" placeholder="开始时间"> <el-date-picker clearable v-model="dataForm.reportTime" value-format="yyyy" type="year" placeholder="开始时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -265,9 +265,10 @@ export default {
teamList: [], teamList: [],
sectionList: [], sectionList: [],
visible: false, visible: false,
reportTime: undefined, // reportTime: undefined,
week: undefined, week: undefined,
dataForm: { dataForm: {
reportTime: undefined,
factoryType: 0, factoryType: 0,
id: undefined, id: undefined,
factory: undefined, factory: undefined,
@ -303,9 +304,9 @@ export default {
}, },
// materialList: [], // materialList: [],
dataRule: { dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }], factory: [{ required: true, message: "工厂名称不能为空", trigger: "chnage" }],
// workOrderId: [{ required: true, message: "", trigger: "change" }], reportTime: [{ required: true, message: "时间不能为空", trigger: "change" }],
// num: [{ required: true, message: "", trigger: "blur" }], targetType: [{ required: true, message: "时间维度不能为空", trigger: "change" }]
// detId: [{ required: true, message: "", trigger: "change" }], // detId: [{ required: true, message: "", trigger: "change" }],
// logTime: [{ required: true, message: "", trigger: "change" }], // logTime: [{ required: true, message: "", trigger: "change" }],
@ -316,6 +317,13 @@ export default {
// this.getCurrentTime() // this.getCurrentTime()
}, },
methods: { methods: {
setReportTime() {
this.dataForm.reportTime = this.week
},
clearTime() {
this.week = undefined
this.dataForm.reportTime = undefined
},
formClear() { formClear() {
if (this.$refs.dataForm !== undefined) { if (this.$refs.dataForm !== undefined) {
this.$refs.dataForm.resetFields() this.$refs.dataForm.resetFields()
@ -325,16 +333,19 @@ export default {
// this.dataForm.targetTime = undefined // this.dataForm.targetTime = undefined
// }, // },
handleClose() { handleClose() {
this.$refs["form"].validate(valid => {
if (valid) {
// //
if (this.dataForm.targetType === 1) { if (this.dataForm.targetType === 1) {
this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : undefined this.dataForm.targetTime = this.week ? Number(moment(this.week.getTime()).format('YYYYWW')) : ''
} else { } else {
this.dataForm.targetTime = this.reportTime ? Number(this.reportTime) : undefined this.dataForm.targetTime = this.dataForm.reportTime ? Number(this.dataForm.reportTime) : ''
} }
if (this.dataForm.id) { if (this.dataForm.id) {
// //
updateProduceTarget({ updateProduceTarget({
...this.dataForm ...this.dataForm,
reportTime: undefined
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success('修改成功!') this.$message.success('修改成功!')
@ -345,7 +356,8 @@ export default {
} else { } else {
// //
createProduce({ createProduce({
...this.dataForm ...this.dataForm,
reportTime: undefined
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success('新增成功!') this.$message.success('新增成功!')
@ -354,6 +366,8 @@ export default {
} }
}) })
} }
}
})
}, },
init(id) { init(id) {
this.dataForm.id = id || undefined this.dataForm.id = id || undefined
@ -363,7 +377,8 @@ export default {
getProduceTargetDetail(this.dataForm.id).then(res => { getProduceTargetDetail(this.dataForm.id).then(res => {
this.dataForm = res.data this.dataForm = res.data
if (this.dataForm.targetType === 0 || this.dataForm.targetType === 2 || this.dataForm.targetType === 3) { if (this.dataForm.targetType === 0 || this.dataForm.targetType === 2 || this.dataForm.targetType === 3) {
this.reportTime = String(this.dataForm.targetTime) // this.dataForm.reportTime = String(this.dataForm.targetTime)
this.$set(this.dataForm, 'reportTime', String(this.dataForm.targetTime))
} }
if (this.dataForm.targetType === 1) { if (this.dataForm.targetType === 1) {
const date = new Date() const date = new Date()
@ -372,6 +387,7 @@ export default {
date.setDate((Number(String(this.dataForm.targetTime).slice(4)) - 1)* 7 + 1) date.setDate((Number(String(this.dataForm.targetTime).slice(4)) - 1)* 7 + 1)
// console.log('', date, moment(date).format('yyyyWW'), String(this.dataForm.targetTime).slice(4)) // console.log('', date, moment(date).format('yyyyWW'), String(this.dataForm.targetTime).slice(4))
this.week = date this.week = date
this.$set(this.dataForm, 'reportTime', date)
} }
}) })
} }

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-15 10:49:13 * @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-05 16:19:04 * @LastEditTime: 2024-06-17 09:49:15
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -24,7 +24,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="时间维度" prop="date"> <el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择"> <el-select size="small" clearable v-model="listQuery.date" placeholder="请选择" @change="clearTime">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -458,6 +458,13 @@ export default {
this.changeTime() this.changeTime()
}, },
methods: { methods: {
clearTime() {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
this.listQuery.reportTime = []
this.start = undefined
this.end = undefined
},
handleImport() { handleImport() {
this.upload.title = "生产目标导入"; this.upload.title = "生产目标导入";
this.upload.open = true; this.upload.open = true;

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-06 15:15:30 * @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-06-14 10:55:21 * @LastEditTime: 2024-06-17 17:03:17
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -23,7 +23,7 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<p class="title">工单类型</p> <p class="title">工单类型</p>
<p class="text">{{ ['', '芯片单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}</p> <p class="text">{{ ['', '芯片单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}</p>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<p class="title">工单来源</p> <p class="title">工单来源</p>
@ -39,7 +39,7 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<p class="title">工单状态</p> <p class="title">工单状态</p>
<p class="text">{{ ['未开始', '生产中', '已完成'][dataForm.orderStatus] }}</p> <p class="text">{{ ['', '未开始', '生产中', '已完成'][dataForm.orderStatus] }}</p>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<p class="title">投入状态</p> <p class="title">投入状态</p>
@ -83,7 +83,7 @@
</div> </div>
<div class="chartDiv"> <div class="chartDiv">
<div ref="equipmentLine" :style="{ height: '30vh', width: '40vw' }" /> <div ref="equipmentLine" :style="{ height: '30vh', width: '40vw' }" />
<div ref="line" v-show="dataForm.orderStatus === 1" :style="{ height: '30vh', width: '40vw' }" /> <div ref="line" v-show="dataForm.orderStatus === 2" :style="{ height: '30vh', width: '40vw' }" />
</div> </div>
</div> </div>
</el-drawer> </el-drawer>
@ -267,7 +267,7 @@ export default {
this.pieChart = echarts.init(this.$refs['pie']) this.pieChart = echarts.init(this.$refs['pie'])
this.pieChart.setOption({ this.pieChart.setOption({
title: { title: {
text: '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%', text: !isNaN((pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100) ? ( '产品良率 ' + (pieData[0].value / (pieData[0].value + pieData[1].value)).toFixed(4) * 100 + '%') : '产品良率 -',
left: 'center' left: 'center'
// subtext: 'Fake Data' // subtext: 'Fake Data'
}, },

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-15 10:49:13 * @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-14 11:04:04 * @LastEditTime: 2024-06-17 16:32:02
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
@ -88,7 +88,7 @@ export default {
factorys: ['瑞昌中建材', '邯郸中建材', '株洲中建材', '佳木斯中建材', '成都中建材', '凯盛光伏', '蚌埠兴科'], factorys: ['瑞昌中建材', '邯郸中建材', '株洲中建材', '佳木斯中建材', '成都中建材', '凯盛光伏', '蚌埠兴科'],
factoryNum: [0, 0, 0, 0, 0, 0, 0], factoryNum: [0, 0, 0, 0, 0, 0, 0],
inputNum: 0, inputNum: 0,
heightNum: 210, heightNum: 180,
factoryList, factoryList,
factoryArray, factoryArray,
listQuery: { listQuery: {
@ -141,15 +141,15 @@ export default {
selectOptions: [ selectOptions: [
{ {
label: '未开始', label: '未开始',
value: 0
},
{
label: '生产中',
value: 1 value: 1
}, },
{ {
label: '已完成', label: '生产中',
value: 2 value: 2
},
{
label: '已完成',
value: 3
} }
], ],
labelField: "label", labelField: "label",
@ -247,7 +247,7 @@ export default {
prop: 'orderStatus', prop: 'orderStatus',
label: '工单状态', label: '工单状态',
// filter: publicFormatter('workorder_status') // filter: publicFormatter('workorder_status')
filter: (val) => ['未开始', '生产中', '已完成'][val], filter: (val) => ['', '未开始', '生产中', '已完成'][val],
}, },
{ {
prop: 'startTime', prop: 'startTime',
@ -396,7 +396,7 @@ export default {
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
padding: 16px 16px 0; padding: 16px 16px 0;
height: calc(100vh - 80px); height: calc(100vh - 40px);
overflow: auto; overflow: auto;
} }
</style> </style>

View File

@ -1,50 +1,30 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2024-04-15 10:49:13 * @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-07 16:22:57 * @LastEditTime: 2024-06-17 14:01:39
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 35px)"> <div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 35px)">
<!-- <div class="app-container"
style="margin-top: 8px; padding: 0 16px; height: auto; font-size: 20px; text-align: center;">
<p style="margin-bottom: 0">数据概览</p>
<div class="view">
<div v-for="(item, index) in data" :key="index">
<p style="color: rgb(194,128,255)">{{ item }}</p>
<p>{{ index }}</p>
</div>
</div>
</div> -->
<div class="" style="height: auto;"> <div class="" style="height: auto;">
<ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event"> <ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event">
<!-- <template v-slot:tab1>
<div style="margin: 20px; background: #f001;">
Page1: 状态时序图
</div>
</template>
<template v-slot:tab2>
<div style="margin: 20px">
Page2: 产量时序图
</div>
</template> -->
</ButtonNav> </ButtonNav>
</div> </div>
<div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto;"> <div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip"> <el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date"> <el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择"> <el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 1 || listQuery.date === ''" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator="" <el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyyMMdd" @change="changeDayTime" end-placeholder="结束日期"> start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 2" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange"> style="width: 180px" @change="onValueChange">
</el-date-picker> </el-date-picker>
@ -52,21 +32,20 @@
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange"> style="width: 180px" @change="onValueChange">
</el-date-picker> </el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 3" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyyMM" <el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange"
range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime"> value-format="yyyy-MM-DD HH:mm:ss" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 4" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" value-format="yyyy" type="year" placeholder="开始时间"> <el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker> </el-date-picker>
~ ~
<el-date-picker size="small" clearable v-model="end" value-format="yyyy" type="year" placeholder="结束时间" <el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year"
@change="getYear"> placeholder="结束时间" @change="getYear">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type"> <!-- <el-form-item label="玻璃类型" prop="type">
@ -91,26 +70,20 @@
</el-form> </el-form>
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize" <base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData"> :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
</base-table> </base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
</div> </div>
<!-- <add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" :date="listQuery.date"
@refreshDataList="successSubmit" @destroy="detailOrUpdateVisible = false" /> -->
</div> </div>
</template> </template>
<script> <script>
// import { parseTime } from '../../core/mixins/code-filter'; // import { parseTime } from '../../core/mixins/code-filter';
// import { getWorkOrderPage, exportExcel, getOverView } from '@/api/produceData/order'; import { getComprehensiveDataPage } from '@/api/report';
// import { getWorkOrderPage, exportExcel, getOverView } from '@/components/buttonNav' // import { getWorkOrderPage, exportExcel, getOverView } from '@/components/buttonNav'
// import inputTable from './inputTable.vue'; // import inputTable from './inputTable.vue';
// import lineChart from './lineChart'; // import lineChart from './lineChart';
import moment from 'moment' import moment from 'moment'
import ButtonNav from '@/components/ButtonNav' import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page' // import basicPage from '@/mixins/basic-page'
// import AddOrUpdate from './add-or-updata'; // import AddOrUpdate from './add-or-updata';
import { factoryList, factoryArray } from "@/utils/constants"; import { factoryList, factoryArray } from "@/utils/constants";
import { publicFormatter } from "@/utils/dict"; import { publicFormatter } from "@/utils/dict";
@ -119,7 +92,7 @@ import { publicFormatter } from "@/utils/dict";
// import * as XLSX from 'xlsx' // import * as XLSX from 'xlsx'
export default { export default {
components: { ButtonNav }, components: { ButtonNav },
mixins: [basicPage], // mixins: [basicPage],
data() { data() {
return { return {
factoryList, factoryList,
@ -127,30 +100,30 @@ export default {
start: undefined, start: undefined,
end: undefined, end: undefined,
listQuery: { listQuery: {
size: 10, // size: 10,
current: 1, // current: 1,
factorys: null, factory: null,
total: 0, // total: 0,
date: 3, type: 2,
beginTime: undefined, startDate: undefined,
endTime: undefined, endDate: undefined,
reportTime: [] reportTime: []
}, },
timeList: [ timeList: [
{ {
value: 1, value: 0,
label: '日' label: '日'
}, },
{ {
value: 2, value: 1,
label: '周' label: '周'
}, },
{ {
value: 3, value: 2,
label: '月' label: '月'
}, },
{ {
value: 4, value: 3,
label: '年' label: '年'
} }
], ],
@ -201,48 +174,49 @@ export default {
// filter: publicFormatter('workorder_status') // filter: publicFormatter('workorder_status')
// filter: (val) => ['', '', '', 'bipv'][val], // filter: (val) => ['', '', '', 'bipv'][val],
}, },
{ // {
prop: 'plannedInvestment', // prop: 'plannedInvestment',
label: '计划投入', // label: '',
}, // },
{ // {
prop: 'actualInvestment', // prop: 'actualInvestment',
label: '实际投入', // label: '',
}, // },
{ // {
prop: 'targetProduction', // prop: 'targetProduction',
label: '目标产量', // label: '',
}, // },
{ // {
prop: 'actualProduction', // prop: 'actualProduction',
label: '实际产量', // label: '',
}, // },
{ // {
prop: 'productionProgress', // prop: 'productionProgress',
label: '生产进度', // label: '',
filter: (val) => (val * 100) + '%' // filter: (val) => (val * 100) + '%'
}, // },
{ // {
prop: 'orderStatus', // prop: 'orderStatus',
label: '工单状态', // label: '',
filter: publicFormatter('workorder_status') // filter: publicFormatter('workorder_status')
// filter: (val) => ['', '', ''][val], // // filter: (val) => ['', '', ''][val],
}, // },
{ // {
prop: 'startTime', // prop: 'startTime',
label: '开始时间', // label: '',
minWidth: 100, // minWidth: 100,
showOverflowtooltip: true // showOverflowtooltip: true
}, // },
{ // {
prop: 'endTime', // prop: 'endTime',
label: '完成时间', // label: '',
minWidth: 100, // minWidth: 100,
showOverflowtooltip: true // showOverflowtooltip: true
} // }
], ],
tableData: [], tableData: [],
xAxis: [], xAxis: [],
currentMenu:null,
lineData: {}, lineData: {},
data: {} data: {}
// proLineList: [], // proLineList: [],
@ -254,16 +228,17 @@ export default {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1 return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
}, },
}, },
created() { // created() {
const currentMonth = new Date() // const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')] // this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-dd HH:mm:ss'), moment(currentMonth).format('yyyy-MM-dd HH:mm:ss')]
this.changeTime() // this.changeTime()
}, // },
mounted() { mounted() {
this.getOverView() // this.getOverView()
const currentMonth = new Date() const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')] this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')]
this.changeTime() this.changeTime()
this.getDataList()
}, },
methods: { methods: {
getYear(e) { getYear(e) {
@ -284,33 +259,37 @@ export default {
this.start = undefined this.start = undefined
this.end = undefined this.end = undefined
} else { } else {
this.listQuery.beginTime = Number(this.start) this.listQuery.startDate = Number(this.start)
this.listQuery.endTime = Number(this.end) this.listQuery.endDate = Number(this.end)
} }
} }
if (!this.start && !this.end) { if (!this.start && !this.end) {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
// console.log(e); // console.log(e);
}, },
changeTime() { changeTime() {
if (this.listQuery.reportTime) { if (this.listQuery.reportTime) {
const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4)) console.log(this.listQuery.reportTime)
const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4)) let start = new Date(this.listQuery.reportTime[0])
if (years * 12 + months > 24) { let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({ this.$message({
message: '时间范围不能超过24个月', message: '时间范围不能超过24个月',
type: 'warning' type: 'warning'
}); });
this.listQuery.reportTime = []; this.listQuery.reportTime = [];
} else { } else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0]) this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endTime = Number(this.listQuery.reportTime[1]) this.listQuery.endDate = this.listQuery.reportTime[1]
} }
} else { } else {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
onValueChange(picker, k) { // k onValueChange(picker, k) { // k
@ -325,13 +304,15 @@ export default {
type: 'warning' type: 'warning'
}); });
} else { } else {
this.listQuery.beginTime = Number(moment(this.start.getTime()).format('YYYYWW')) this.listQuery.startDate = this.date1
this.listQuery.endTime = Number(moment(this.end.getTime()).format('YYYYWW')) this.listQuery.endDate = this.date2
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
} }
} }
if (!this.start && !this.end) { if (!this.start && !this.end) {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
changeDayTime() { changeDayTime() {
@ -344,12 +325,12 @@ export default {
}); });
this.listQuery.reportTime = []; this.listQuery.reportTime = [];
} else { } else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0]) this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endTime = Number(this.listQuery.reportTime[1]) this.listQuery.endDate = this.listQuery.reportTime[1]
} }
} else { } else {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
getOverView() { getOverView() {
@ -366,26 +347,32 @@ export default {
}); });
}, },
async getDataList() { async getDataList() {
// const res = await getWorkOrderPage(this.listQuery) console.log(this.listQuery);
// this.tableData = res.data.list if (this.listQuery.type == 3) {
// this.listQuery.total = res.data.total this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00'
// if (this.listQuery.total > 0) { this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59'
// this.tableData.forEach(item => { }
// item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--' this.listQuery.factory = this.currentMenu === '邯郸' ? 1 : 2
// item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--' const res = await getComprehensiveDataPage(this.listQuery)
// }) this.tableData = res.data.list
// } this.listQuery.total = res.data.total
if (this.listQuery.total > 0) {
this.tableData.forEach(item => {
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
})
}
}, },
buttonClick(val) { buttonClick(val) {
this.listQuery.factorys = val.factory?.length > 0 ? val.factory : undefined this.listQuery.factorys = val.factory?.length > 0 ? val.factory : undefined
this.listQuery.orderStatus = val.orderStatus?.length > 0 ? val.orderStatus : undefined // this.listQuery.orderStatus = val.orderStatus?.length > 0 ? val.orderStatus : undefined
this.listQuery.time = val.timeSlot?.length > 0 ? val.timeSlot : undefined // this.listQuery.time = val.timeSlot?.length > 0 ? val.timeSlot : undefined
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; // this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20; // this.listQuery.pageSize = 20;
if (this.listQuery.time) { if (this.listQuery.time) {
this.getDataList(); // this.getDataList();
} else { } else {
this.$message.warning('请选择时间范围!') this.$message.warning('请选择时间范围!')
} }

View File

@ -1,36 +1,23 @@
<!--
* @Author: zhp
* @Date: 2024-06-11 08:45:34
* @LastEditTime: 2024-06-11 11:08:27
* @LastEditors: zhp
* @Description:
-->
<template> <template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 35px)"> <div>
<!-- <div class="app-container" <!-- <div class="search"> -->
style="margin-top: 8px; padding: 0 16px; height: auto; font-size: 20px; text-align: center;"> <ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event">
<p style="margin-bottom: 0">数据概览</p> </ButtonNav>
<div class="view"> <!-- </div> -->
<div v-for="(item, index) in data" :key="index"> <div class="containerTop">
<p style="color: rgb(194,128,255)">{{ item }}</p>
<p>{{ index }}</p>
</div>
</div>
</div> -->
<div class="app-container" style="flex: 1;min-height: 40vh;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip"> <el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date"> <el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择"> <el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 1 || listQuery.date === ''" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator="" <el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyyMMdd" @change="changeDayTime" end-placeholder="结束日期"> start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 2" label="时间范围" prop="reportTime"> <el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周" <el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange"> style="width: 180px" @change="onValueChange">
</el-date-picker> </el-date-picker>
@ -42,17 +29,19 @@
{{ date1 }} {{ date2 }} {{ weekNum }} {{ date1 }} {{ date2 }} {{ weekNum }}
</span> --> </span> -->
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 3" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyyMM" <el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange"
range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime"> value-format="yyyy-MM-DD HH:mm:ss" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-show="listQuery.date === 4" label="时间值" prop="reportTime"> <el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" value-format="yyyy" type="year" placeholder="开始时间"> <el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker> </el-date-picker>
~ ~
<el-date-picker size="small" clearable v-model="end" value-format="yyyy" type="year" placeholder="结束时间" <el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year"
@change="getYear"> placeholder="结束时间" @change="getYear">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type"> <!-- <el-form-item label="玻璃类型" prop="type">
@ -75,185 +64,241 @@
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> --> <!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
<line-chart ref="lineChart" style="height: 90%; width: 100%"></line-chart> <!-- <div class="smallTitle">产量转化效率</div> -->
<!-- <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> -->
<bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId"
:chartNum="chartNum" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH" />
</div> </div>
<div class="app-container" style="margin-top: 8px;flex: 1"> <!-- <div class="containerBottom">
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData"> </div> -->
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
</base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getDataList" />
</div>
<!-- <add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" :date="listQuery.date"
@refreshDataList="successSubmit" @destroy="detailOrUpdateVisible = false" /> -->
</div> </div>
</template> </template>
<script> <script>
// import { parseTime } from '../../core/mixins/code-filter'; import bmSearchBar from "./components/bmSearchBar.vue";
// import { getWorkOrderPage, exportExcel, getOverView } from '@/api/produceData/order'; import BmLineBar from "./components/bmLineBar.vue";
// import { getWorkOrderPage, exportExcel, getOverView } from '@/components/buttonNav'
// import inputTable from './inputTable.vue';
// import lineChart from './lineChart';
import moment from 'moment'
import ButtonNav from '@/components/ButtonNav' import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page' import moment from 'moment'
// import AddOrUpdate from './add-or-updata'; const tableProps = [
import { factoryList, factoryArray } from "@/utils/constants"; {
import { publicFormatter } from "@/utils/dict"; prop: "factory",
import lineChart from "./components/lineChart"; label: "玻璃类型",
// filter: (val) => factoryList[val],
// import FileSaver from 'file-saver' minWidth: 200,
// import * as XLSX from 'xlsx' showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
components: { ButtonNav, lineChart }, name: "ChipYieldBM",
mixins: [basicPage],
data() { data() {
return { return {
factoryList, tableProps,
factoryArray,
start: undefined, start: undefined,
end: undefined, end: undefined,
listQuery: { listQuery: {
size: 10, // size: 10,
current: 1, // current: 1,
factorys: null, factory: null,
total: 0, // total: 0,
date: 3, type: 2,
beginTime: undefined, startDate: undefined,
endTime: undefined, endDate: undefined,
reportTime: [] reportTime: []
}, },
timeList: [ timeList: [
{ {
value: 1, value: 0,
label: '日' label: '日'
}, },
{ {
value: 2, value: 1,
label: '周' label: '周'
}, },
{ {
value: 3, value: 2,
label: '月' label: '月'
}, },
{ {
value: 4, value: 3,
label: '年' label: '年'
} }
], ],
detailOrUpdateVisible: false, tableData: [
tableBtn: [ { factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(137) / 2 - 111,
tableH: this.tableHeight(137) / 2 - 70,
legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" },
],
chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"],
yName: "单位/%",
series: [
{ {
type: 'detail', name: "2024年4月目标值",
btnName: '详情', data: [
{ name: "%", value: 85 },
{ name: "%", value: 85 },
{ name: "%", value: 85 },
],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
}, },
// {
// type: 'delete',
// btnName: '',
// },
].filter((v) => v),
typeList: [
{
name: '芯片',
id: 0,
}, },
{ {
name: '标准组件', name: "2023年4月",
id: 1, data: [
{ name: "%", value: 57.5 },
{ name: "%", value: 21.66 },
{ name: "%", value: 18.4 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [-18, -16],
color: "#68C483",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
}, },
{ {
name: 'BIPV产品', name: "2024年4月",
id: 2, data: [
{ name: "%", value: 23.33 },
{ name: "%", value: 7.02 },
{ name: "%", value: 80.2 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
}, },
], ],
tableProps: [
{
prop: 'factory',
label: '玻璃类型',
fixed:true,
// filter: (val) => factoryList[val],
// minWidth: 200,
// showOverflowtooltip: true
}, },
{ chartId: "chipYieldBMChart",
prop: 'workOrderNumber', chartNum: 1,
label: '科目/日期',
fixed: true,
// filter: (val) => ['', '', 'BIPV', ''][val]
},
{
prop: 'workOrderType',
label: '单位',
fixed: true,
// filter: publicFormatter('workorder_status')
// filter: (val) => ['', '', '', 'bipv'][val],
},
{
prop: 'plannedInvestment',
label: '计划投入',
},
{
prop: 'actualInvestment',
label: '实际投入',
},
{
prop: 'targetProduction',
label: '目标产量',
},
{
prop: 'actualProduction',
label: '实际产量',
},
{
prop: 'productionProgress',
label: '生产进度',
filter: (val) => (val * 100) + '%'
},
{
prop: 'orderStatus',
label: '工单状态',
filter: publicFormatter('workorder_status')
// filter: (val) => ['', '', ''][val],
},
{
prop: 'startTime',
label: '开始时间',
minWidth: 100,
showOverflowtooltip: true
},
{
prop: 'endTime',
label: '完成时间',
minWidth: 100,
showOverflowtooltip: true
}
],
tableData: [],
xAxis: [],
lineData: {},
data: {}
// proLineList: [],
// all: {}
}; };
}, },
components: {
bmSearchBar,
BmLineBar,
ButtonNav
},
computed: { computed: {
weekNum() { weekNum() {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1 return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
}, },
isOpen() {
return this.$store.getters.sidebar.opened;
},
},
watch: {
//
isOpen(val) {
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
}, },
created() { created() {
const currentMonth = new Date() this.tableH = this.tableHeight(137) / 2 - 70;
this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')] this.chartHeight = this.tableHeight(137) / 2 - 111;
this.changeTime() window.addEventListener("resize", this._setTableHeight);
},
destroyed() {
window.removeEventListener("resize", this._setTableHeight);
},
activated() {
//
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
}, },
mounted() { mounted() {
this.getOverView() // this.getOverView()
const currentMonth = new Date() const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')] this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')]
this.changeTime() this.changeTime()
this.getDataList()
}, },
methods: { methods: {
getYear(e) { getYear(e) {
@ -274,33 +319,37 @@ export default {
this.start = undefined this.start = undefined
this.end = undefined this.end = undefined
} else { } else {
this.listQuery.beginTime = Number(this.start) this.listQuery.startDate = Number(this.start)
this.listQuery.endTime = Number(this.end) this.listQuery.endDate = Number(this.end)
} }
} }
if (!this.start && !this.end) { if (!this.start && !this.end) {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
// console.log(e); // console.log(e);
}, },
changeTime() { changeTime() {
if (this.listQuery.reportTime) { if (this.listQuery.reportTime) {
const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4)) console.log(this.listQuery.reportTime)
const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4)) let start = new Date(this.listQuery.reportTime[0])
if (years * 12 + months > 24) { let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({ this.$message({
message: '时间范围不能超过24个月', message: '时间范围不能超过24个月',
type: 'warning' type: 'warning'
}); });
this.listQuery.reportTime = []; this.listQuery.reportTime = [];
} else { } else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0]) this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endTime = Number(this.listQuery.reportTime[1]) this.listQuery.endDate = this.listQuery.reportTime[1]
} }
} else { } else {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
onValueChange(picker, k) { // k onValueChange(picker, k) { // k
@ -315,13 +364,15 @@ export default {
type: 'warning' type: 'warning'
}); });
} else { } else {
this.listQuery.beginTime = Number(moment(this.start.getTime()).format('YYYYWW')) this.listQuery.startDate = this.date1
this.listQuery.endTime = Number(moment(this.end.getTime()).format('YYYYWW')) this.listQuery.endDate = this.date2
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
} }
} }
if (!this.start && !this.end) { if (!this.start && !this.end) {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
changeDayTime() { changeDayTime() {
@ -334,12 +385,12 @@ export default {
}); });
this.listQuery.reportTime = []; this.listQuery.reportTime = [];
} else { } else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0]) this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endTime = Number(this.listQuery.reportTime[1]) this.listQuery.endDate = this.listQuery.reportTime[1]
} }
} else { } else {
this.listQuery.beginTime = undefined this.listQuery.startDate = undefined
this.listQuery.endTime = undefined this.listQuery.endDate = undefined
} }
}, },
getOverView() { getOverView() {
@ -356,73 +407,53 @@ export default {
}); });
}, },
async getDataList() { async getDataList() {
// const res = await getWorkOrderPage(this.listQuery) console.log(this.listQuery);
// this.tableData = res.data.list if (this.listQuery.type == 3) {
// this.listQuery.total = res.data.total this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00'
// if (this.listQuery.total > 0) { this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59'
// this.tableData.forEach(item => { }
// item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--' this.listQuery.factory = this.currentMenu === '邯郸' ? 1 : 2
// item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--' const res = await getComprehensiveDataPage(this.listQuery)
// }) this.tableData = res.data.list
// } this.listQuery.total = res.data.total
if (this.listQuery.total > 0) {
this.tableData.forEach(item => {
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
})
}
}, },
buttonClick(val) { _setTableHeight() {
this.listQuery.factorys = val.factory?.length > 0 ? val.factory : undefined this.tableH = this.tableHeight(137) / 2 - 70;
this.listQuery.orderStatus = val.orderStatus?.length > 0 ? val.orderStatus : undefined this.chartHeight = this.tableHeight(137) / 2 - 111;
this.listQuery.time = val.timeSlot?.length > 0 ? val.timeSlot : undefined if (this.$route.name === "ChipYieldBM") {
switch (val.btnName) { this.chartNum++;
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
if (this.listQuery.time) {
this.getDataList();
} else {
this.$message.warning('请选择时间范围!')
} }
break; },
case 'export': getSearch(val) {
if (this.listQuery.time) {
this.handleExport();
} else {
this.$message.warning('请选择时间范围!')
}
break;
default:
console.log(val); console.log(val);
} console.log("=========================");
}, },
/** 导出按钮操作 */
handleExport() { handleExport() {
// this.$modal.confirm('?').then(() => { console.log("导出");
// //
// // let params = {...this.listQuery};
// // params.current = 1;
// // params.size = 999;
// this.exportLoading = true;
// return exportExcel({
// factorys: this.listQuery.factorys,
// orderStatus: this.listQuery.orderStatus,
// time: this.listQuery.time
// });
// }).then(response => {
// this.$download.excel(response, '.xls');
// this.exportLoading = false;
// }).catch(() => { })
}, },
}, },
}; };
</script> </script>
<style scoped> <style lang="scss" scoped>
/* .blueTip { */ .search {
/* padding-bottom: 10px; */ // height: calc((100px));
/* } */ background-color: #fff;
/* .blueTi */ border-radius: 8px;
.view { padding: 16px 16px 0 16px;
display: flex; margin-bottom: 8px;
justify-content: space-around; }
align-items: center; .containerTop{
flex: 1; height: calc((100vh - 170px));
background-color: #fff;
border-radius: 8px;
padding: 16px;
} }
.blueTip::before { .blueTip::before {
@ -435,16 +466,23 @@ export default {
margin-right: 8PX; margin-right: 8PX;
margin-top: 8px; margin-top: 8px;
} }
.containerTop {
margin-top: 8px;
.app-container { .smallTitle {
margin: 0 0px 0; font-size: 16px;
background-color: #fff; color: #000;
border-radius: 4px; margin-bottom: 15px;
padding: 16px 16px 0; }
height: calc(100vh - 134px);
overflow: auto; .smallTitle::before {
} display: inline-block;
.noBack{ width: 4px;
background-color:black; height: 16px;
background: #0b58ff;
content: "";
margin-right: 8px;
vertical-align: -3px;
}
} }
</style> </style>

View File

@ -0,0 +1,490 @@
<template>
<div>
<!-- <div class="search"> -->
<ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event">
</ButtonNav>
<!-- </div> -->
<div class="containerTop">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange"
value-format="yyyy-MM-DD HH:mm:ss" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year"
placeholder="结束时间" @change="getYear">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item>
</el-form>
<!-- <div class="smallTitle">产量转化效率</div> -->
<!-- <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> -->
<bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId"
:chartNum="chartNum" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH" />
</div>
<!-- <div class="containerBottom">
</div> -->
</div>
</template>
<script>
import bmSearchBar from "./components/bmSearchBar.vue";
import BmLineBar from "./components/bmLineBar.vue";
import ButtonNav from '@/components/ButtonNav'
import moment from 'moment'
const tableProps = [
{
prop: "factory",
label: "玻璃类型",
// filter: (val) => factoryList[val],
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default {
name: "ChipYieldBM",
data() {
return {
tableProps,
start: undefined,
end: undefined,
listQuery: {
// size: 10,
// current: 1,
factory: null,
// total: 0,
type: 2,
startDate: undefined,
endDate: undefined,
reportTime: []
},
timeList: [
{
value: 0,
label: '日'
},
{
value: 1,
label: '周'
},
{
value: 2,
label: '月'
},
{
value: 3,
label: '年'
}
],
tableData: [
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(137) / 2 - 111,
tableH: this.tableHeight(137) / 2 - 70,
legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" },
],
chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"],
yName: "单位/%",
series: [
{
name: "2024年4月目标值",
data: [
{ name: "%", value: 85 },
{ name: "%", value: 85 },
{ name: "%", value: 85 },
],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2023年4月",
data: [
{ name: "%", value: 57.5 },
{ name: "%", value: 21.66 },
{ name: "%", value: 18.4 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [-18, -16],
color: "#68C483",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2024年4月",
data: [
{ name: "%", value: 23.33 },
{ name: "%", value: 7.02 },
{ name: "%", value: 80.2 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
],
},
chartId: "chipYieldBMChart",
chartNum: 1,
};
},
components: {
bmSearchBar,
BmLineBar,
ButtonNav
},
computed: {
weekNum() {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
},
isOpen() {
return this.$store.getters.sidebar.opened;
},
},
watch: {
//
isOpen(val) {
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
},
created() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
window.addEventListener("resize", this._setTableHeight);
},
destroyed() {
window.removeEventListener("resize", this._setTableHeight);
},
activated() {
//
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
mounted() {
// this.getOverView()
const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')]
this.changeTime()
this.getDataList()
},
methods: {
getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
this.start = undefined
this.end = undefined
// console.log();
} else {
if (Number(this.end) < Number(this.start)) {
this.$message({
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k
if (this.start && this.end) {
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) {
console.log(numDays)
this.$message({
message: '周范围不能超过24周',
type: 'warning'
});
} else {
this.listQuery.startDate = this.date1
this.listQuery.endDate = this.date2
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
getOverView() {
// getOverView().then(res => {
// this.data = res.data
// console.log('aa', res.data)
// })
},
otherMethods(val) {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
// this.$refs.detailOrUpdate.init(val.data.id);
});
},
async getDataList() {
console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00'
this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59'
}
this.listQuery.factory = this.currentMenu === '邯郸' ? 1 : 2
const res = await getComprehensiveDataPage(this.listQuery)
this.tableData = res.data.list
this.listQuery.total = res.data.total
if (this.listQuery.total > 0) {
this.tableData.forEach(item => {
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
})
}
},
_setTableHeight() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
getSearch(val) {
console.log(val);
console.log("=========================");
},
handleExport() {
console.log("导出");
},
},
};
</script>
<style lang="scss" scoped>
.search {
// height: calc((100px));
background-color: #fff;
border-radius: 8px;
padding: 16px 16px 0 16px;
margin-bottom: 8px;
}
.containerTop {
height: calc((100vh - 170px));
background-color: #fff;
border-radius: 8px;
padding: 16px;
}
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.containerTop {
margin-top: 8px;
.smallTitle {
font-size: 16px;
color: #000;
margin-bottom: 15px;
}
.smallTitle::before {
display: inline-block;
width: 4px;
height: 16px;
background: #0b58ff;
content: "";
margin-right: 8px;
vertical-align: -3px;
}
}
</style>

View File

@ -0,0 +1,490 @@
<template>
<div>
<!-- <div class="search"> -->
<ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event">
</ButtonNav>
<!-- </div> -->
<div class="containerTop">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange"
value-format="yyyy-MM-DD HH:mm:ss" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year"
placeholder="结束时间" @change="getYear">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item>
</el-form>
<!-- <div class="smallTitle">产量转化效率</div> -->
<!-- <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> -->
<bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId"
:chartNum="chartNum" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH" />
</div>
<!-- <div class="containerBottom">
</div> -->
</div>
</template>
<script>
import bmSearchBar from "./components/bmSearchBar.vue";
import BmLineBar from "./components/bmLineBar.vue";
import ButtonNav from '@/components/ButtonNav'
import moment from 'moment'
const tableProps = [
{
prop: "factory",
label: "玻璃类型",
// filter: (val) => factoryList[val],
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default {
name: "ChipYieldBM",
data() {
return {
tableProps,
start: undefined,
end: undefined,
listQuery: {
// size: 10,
// current: 1,
factory: null,
// total: 0,
type: 2,
startDate: undefined,
endDate: undefined,
reportTime: []
},
timeList: [
{
value: 0,
label: '日'
},
{
value: 1,
label: '周'
},
{
value: 2,
label: '月'
},
{
value: 3,
label: '年'
}
],
tableData: [
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(137) / 2 - 111,
tableH: this.tableHeight(137) / 2 - 70,
legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" },
],
chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"],
yName: "单位/%",
series: [
{
name: "2024年4月目标值",
data: [
{ name: "%", value: 85 },
{ name: "%", value: 85 },
{ name: "%", value: 85 },
],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2023年4月",
data: [
{ name: "%", value: 57.5 },
{ name: "%", value: 21.66 },
{ name: "%", value: 18.4 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [-18, -16],
color: "#68C483",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2024年4月",
data: [
{ name: "%", value: 23.33 },
{ name: "%", value: 7.02 },
{ name: "%", value: 80.2 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
],
},
chartId: "chipYieldBMChart",
chartNum: 1,
};
},
components: {
bmSearchBar,
BmLineBar,
ButtonNav
},
computed: {
weekNum() {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
},
isOpen() {
return this.$store.getters.sidebar.opened;
},
},
watch: {
//
isOpen(val) {
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
},
created() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
window.addEventListener("resize", this._setTableHeight);
},
destroyed() {
window.removeEventListener("resize", this._setTableHeight);
},
activated() {
//
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
mounted() {
// this.getOverView()
const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')]
this.changeTime()
this.getDataList()
},
methods: {
getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
this.start = undefined
this.end = undefined
// console.log();
} else {
if (Number(this.end) < Number(this.start)) {
this.$message({
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k
if (this.start && this.end) {
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) {
console.log(numDays)
this.$message({
message: '周范围不能超过24周',
type: 'warning'
});
} else {
this.listQuery.startDate = this.date1
this.listQuery.endDate = this.date2
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
getOverView() {
// getOverView().then(res => {
// this.data = res.data
// console.log('aa', res.data)
// })
},
otherMethods(val) {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
// this.$refs.detailOrUpdate.init(val.data.id);
});
},
async getDataList() {
console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00'
this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59'
}
this.listQuery.factory = this.currentMenu === '邯郸' ? 1 : 2
const res = await getComprehensiveDataPage(this.listQuery)
this.tableData = res.data.list
this.listQuery.total = res.data.total
if (this.listQuery.total > 0) {
this.tableData.forEach(item => {
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
})
}
},
_setTableHeight() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
getSearch(val) {
console.log(val);
console.log("=========================");
},
handleExport() {
console.log("导出");
},
},
};
</script>
<style lang="scss" scoped>
.search {
// height: calc((100px));
background-color: #fff;
border-radius: 8px;
padding: 16px 16px 0 16px;
margin-bottom: 8px;
}
.containerTop {
height: calc((100vh - 170px));
background-color: #fff;
border-radius: 8px;
padding: 16px;
}
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.containerTop {
margin-top: 8px;
.smallTitle {
font-size: 16px;
color: #000;
margin-bottom: 15px;
}
.smallTitle::before {
display: inline-block;
width: 4px;
height: 16px;
background: #0b58ff;
content: "";
margin-right: 8px;
vertical-align: -3px;
}
}
</style>

View File

@ -0,0 +1,490 @@
<template>
<div>
<!-- <div class="search"> -->
<ButtonNav style="padding: 0;" :menus="['邯郸', '瑞昌']" :button-mode="true" @change="currentMenu = $event">
</ButtonNav>
<!-- </div> -->
<div class="containerTop">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.type" placeholder="请选择">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-show="listQuery.type === 0 || listQuery.type === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyy-MM-dd HH:mm:ss" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.type === 2" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange"
value-format="yyyy-MM-DD HH:mm:ss" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份"
@change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.type === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker size="small" clearable v-model="listQuery.reportTime[1]" value-format="yyyy" type="year"
placeholder="结束时间" @change="getYear">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item>
</el-form>
<!-- <div class="smallTitle">产量转化效率</div> -->
<!-- <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> -->
<bm-line-bar :chartHeight="chartHeight" :legendList="legendList" :chartMsg="chartMsg" :chartId="chartId"
:chartNum="chartNum" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH" />
</div>
<!-- <div class="containerBottom">
</div> -->
</div>
</template>
<script>
import bmSearchBar from "./components/bmSearchBar.vue";
import BmLineBar from "./components/bmLineBar.vue";
import ButtonNav from '@/components/ButtonNav'
import moment from 'moment'
const tableProps = [
{
prop: "factory",
label: "玻璃类型",
// filter: (val) => factoryList[val],
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default {
name: "ChipYieldBM",
data() {
return {
tableProps,
start: undefined,
end: undefined,
listQuery: {
// size: 10,
// current: 1,
factory: null,
// total: 0,
type: 2,
startDate: undefined,
endDate: undefined,
reportTime: []
},
timeList: [
{
value: 0,
label: '日'
},
{
value: 1,
label: '周'
},
{
value: 2,
label: '月'
},
{
value: 3,
label: '年'
}
],
tableData: [
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(137) / 2 - 111,
tableH: this.tableHeight(137) / 2 - 70,
legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" },
],
chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"],
yName: "单位/%",
series: [
{
name: "2024年4月目标值",
data: [
{ name: "%", value: 85 },
{ name: "%", value: 85 },
{ name: "%", value: 85 },
],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2023年4月",
data: [
{ name: "%", value: 57.5 },
{ name: "%", value: 21.66 },
{ name: "%", value: 18.4 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [-18, -16],
color: "#68C483",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2024年4月",
data: [
{ name: "%", value: 23.33 },
{ name: "%", value: 7.02 },
{ name: "%", value: 80.2 },
],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
],
},
chartId: "chipYieldBMChart",
chartNum: 1,
};
},
components: {
bmSearchBar,
BmLineBar,
ButtonNav
},
computed: {
weekNum() {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
},
isOpen() {
return this.$store.getters.sidebar.opened;
},
},
watch: {
//
isOpen(val) {
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
},
created() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
window.addEventListener("resize", this._setTableHeight);
},
destroyed() {
window.removeEventListener("resize", this._setTableHeight);
},
activated() {
//
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
mounted() {
// this.getOverView()
const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyy-MM-DD HH:mm:ss'), moment(currentMonth).format('yyyy-MM-DD HH:mm:ss')]
this.changeTime()
this.getDataList()
},
methods: {
getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
this.start = undefined
this.end = undefined
// console.log();
} else {
if (Number(this.end) < Number(this.start)) {
this.$message({
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.startDate = Number(this.start)
this.listQuery.endDate = Number(this.end)
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
console.log(this.listQuery.reportTime)
let start = new Date(this.listQuery.reportTime[0])
let end = new Date(this.listQuery.reportTime[1])
// const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
// const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
// console.log(years);
if ((end - start) > 31104000000) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
onValueChange(picker, k) { // k
if (this.start && this.end) {
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) {
console.log(numDays)
this.$message({
message: '周范围不能超过24周',
type: 'warning'
});
} else {
this.listQuery.startDate = this.date1
this.listQuery.endDate = this.date2
// this.listQuery.startDate = Number(moment(this.start.getTime()).format('YYYYWW'))
// this.listQuery.endDate = Number(moment(this.end.getTime()).format('YYYYWW'))
}
}
if (!this.start && !this.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
getOverView() {
// getOverView().then(res => {
// this.data = res.data
// console.log('aa', res.data)
// })
},
otherMethods(val) {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
// this.$refs.detailOrUpdate.init(val.data.id);
});
},
async getDataList() {
console.log(this.listQuery);
if (this.listQuery.type == 3) {
this.listQuery.startDate = this.listQuery.reportTime[0] + '-01-01 00:00:00'
this.listQuery.endDate = this.listQuery.reportTime[1] + '-12-31 23:59:59'
}
this.listQuery.factory = this.currentMenu === '邯郸' ? 1 : 2
const res = await getComprehensiveDataPage(this.listQuery)
this.tableData = res.data.list
this.listQuery.total = res.data.total
if (this.listQuery.total > 0) {
this.tableData.forEach(item => {
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
})
}
},
_setTableHeight() {
this.tableH = this.tableHeight(137) / 2 - 70;
this.chartHeight = this.tableHeight(137) / 2 - 111;
if (this.$route.name === "ChipYieldBM") {
this.chartNum++;
}
},
getSearch(val) {
console.log(val);
console.log("=========================");
},
handleExport() {
console.log("导出");
},
},
};
</script>
<style lang="scss" scoped>
.search {
// height: calc((100px));
background-color: #fff;
border-radius: 8px;
padding: 16px 16px 0 16px;
margin-bottom: 8px;
}
.containerTop {
height: calc((100vh - 170px));
background-color: #fff;
border-radius: 8px;
padding: 16px;
}
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.containerTop {
margin-top: 8px;
.smallTitle {
font-size: 16px;
color: #000;
margin-bottom: 15px;
}
.smallTitle::before {
display: inline-block;
width: 4px;
height: 16px;
background: #0b58ff;
content: "";
margin-right: 8px;
vertical-align: -3px;
}
}
</style>