projects/mescc/dy #50

Merged
juzi merged 2 commits from projects/mescc/dy into projects/mescc/develop 2024-06-19 16:07:15 +08:00
6 changed files with 391 additions and 312 deletions
Showing only changes of commit 2d5bd161f3 - Show all commits

View File

@ -1,7 +1,7 @@
###
# @Author: zhp
# @Date: 2024-04-28 13:42:51
# @LastEditTime: 2024-06-17 09:01:32
# @LastEditTime: 2024-06-19 16:04:10
# @LastEditors: DY
# @Description:
###
@ -14,6 +14,7 @@ VUE_APP_TITLE = 发电玻璃智能管控平台
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://192.168.1.70:30307'
VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com'
# VUE_APP_BASE_API = 'http://192.168.1.56:48080'
# 郭
# VUE_APP_BASE_API = 'http://192.168.1.61:48080'
# sara

View File

@ -1,7 +1,7 @@
/*
* @Author: zhp
* @Date: 2024-05-07 08:54:59
* @LastEditTime: 2024-06-03 08:52:02
* @LastEditTime: 2024-06-19 15:22:10
* @LastEditors: DY
* @Description:
*/
@ -10,23 +10,33 @@ import request from '@/utils/request'
// 查询生产数据管理分页
export function getProduceDataPage(data) {
return request({
url: 'ip/prod-output/prodOutputDataPage',
url: '/ip/proddata/page',
method: 'post',
data: data
})
}
export function getProduceDataDetail(id){
// 查询图数据
export function getproddata(data) {
return request({
url: '/ip/prod-output/get?id=' + id,
method: 'get'
url: '/ip/proddata/list',
method: 'post',
data: data
})
}
export function getProduceDataDetail(data){
return request({
url: '/ip/proddata/get',
method: 'post',
data: data
})
}
// 导出生产数据
export function exportOutPutExcel(data) {
return request({
url: '/ip/prod-output/output-export-excel',
url: '/ip/proddata/export-excel',
method: 'post',
data: data,
responseType: 'blob'

View File

@ -143,6 +143,8 @@ export const tyjxfactoryList =[
// 暂时只有瑞昌邯郸数据
export const factoryList =['瑞昌中建材光电材料有限公司', '邯郸中建材光电材料有限公司']
export const factoryListabbr =['瑞昌', '邯郸']
export const factoryArray =[
{
name: '瑞昌中建材光电材料有限公司',

View File

@ -1,12 +1,12 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-06-07 10:28:51
* @LastEditTime: 2024-06-18 14:41:07
* @LastEditors: DY
* @Description:
-->
<template>
<el-drawer class="drawer" :visible.sync="visible" size="60%" @closed="$emit('destroy')">
<el-drawer class="drawer" :visible.sync="visible" size="65%" @closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{ '碲化镉工厂生产数据详情' }}
</small-title>
@ -14,167 +14,169 @@
<el-row :gutter="24">
<el-col :span="8">
<p class="title">工厂名称</p>
<p class="text">{{ dataForm.factory }}</p>
<p class="text">{{ factoryList[dataForm.factory] }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间维度</p>
<p class="text">{{ date }}</p>
<p class="text">{{ ['日', '周', '月', '年'][date] }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间</p>
<p class="text">{{ dataForm.reportDate?.length > 0 ? dataForm.reportDate[0] + '年' + dataForm.reportDate[1] + '月' + dataForm.reportDate[2] + '日' : '' }}</p>
<p class="text">{{ dataForm.datestr }}</p>
</el-col>
</el-row>
<el-divider></el-divider>
<div v-if="glass === 0">
<small-title style=" margin: 0;padding: 26px 32px 24px;margin-bottom: 22px;" :no-padding="false">
{{ '芯片' }}
</small-title>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">芯片产量()</p>
<p class="text">{{ }}</p>
<p class="text">{{ dataForm.chipYieldSum }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片良率(%)</p>
<p class="text">{{ dataForm.yieldRate }}</p>
<p class="text">{{ dataForm.chipYieldRate }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片BOM</p>
<p class="text">{{ dataForm.bom }}</p>
<p class="text">{{ dataForm.chipBom }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片总功率(MW)</p>
<p class="text">{{ dataForm.totalPower }}</p>
<p class="text">{{ dataForm.chipTotalPower }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">FTO投入量()</p>
<p class="text">{{ dataForm.chipInput }}</p>
<p class="text">{{ dataForm.ftoInput }}</p>
</el-col>
<el-col :span="6">
<p class="title">CSS稼动率(%)</p>
<p class="text">{{ dataForm.marriageRate }}</p>
<p class="text">{{ dataForm.chipCssMarriageRate }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片段OEE</p>
<p class="text">{{ dataForm.oee }}</p>
<p class="text">{{ dataForm.chipOee }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片平均功率(W)</p>
<p class="text">{{ dataForm.averagePower }}</p>
<p class="text">{{ dataForm.chipAveragePower }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">芯片人均产量(/)</p>
<p class="text">{{ dataForm.annualAverageProduction }}</p>
<p class="text">{{ dataForm.chipAnnualAverageProduction }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片产能利用率(%)</p>
<p class="text">{{ dataForm.capacityUtilizationRate }}</p>
<p class="text">{{ dataForm.chipCapacityUtilizationRate }}</p>
</el-col>
</el-row>
</div>
<div v-if="glass === 1">
<small-title style=" margin: 0;padding: 26px 32px 24px;margin-bottom: 22px;" :no-padding="false">
{{ '标准组件' }}
</small-title>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">封装BOM</p>
<!-- 没参数 -->
<!-- <p class="text">{{ dataForm.bom }}</p> -->
<p class="text">{{ dataForm.componentBom }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装线OEE(%)</p>
<!-- <p class="text">{{ dataForm.code }}</p> -->
<p class="text">{{ dataForm.componentOee }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件良率(%)</p>
<!-- <p class="text">{{ dataForm.productName }}</p> -->
<p class="text">{{ dataForm.componentYieldRate }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件产量()</p>
<!-- <p class="text">{{ dataForm.productName }}</p> -->
<p class="text">{{ dataForm.componentYield }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">标准组件总功率(MW)</p>
<p class="text">{{ }}</p>
<p class="text">{{ dataForm.componentTotalPower }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装产能利用率(%)</p>
<!-- <p class="text">{{ dataForm.code }}</p> -->
<p class="text">{{ dataForm.componentCapacityUtilizationRate }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件人均产量</p>
<!-- <p class="text">{{ dataForm.productName }}</p> -->
<p class="title">标准组件人均产量(/)</p>
<p class="text">{{ dataForm.componentAnnualAverageProduction }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件平均功率</p>
<!-- <p class="text">{{ dataForm.productName }}</p> -->
<p class="title">标准组件平均功率(W)</p>
<p class="text">{{ dataForm.componentAveragePower }}</p>
</el-col>
</el-row>
</div>
<div v-if="glass === 2">
<small-title style=" margin: 0;padding: 26px 32px 24px;margin-bottom: 22px;" :no-padding="false">
{{ 'BIPV产品' }}
</small-title>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">产品产量</p>
<p class="text">{{ }}</p>
<p class="title">产品产量()</p>
<p class="text">{{ dataForm.bipvProductOutput }}</p>
</el-col>
<el-col :span="6">
<p class="title">人均产量</p>
<p class="text">{{ dataForm.code }}</p>
<p class="title">人均产量(/)</p>
<p class="text">{{ dataForm.bipvAnnualAverageProduction }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
<p class="title">芯片使用量()</p>
<p class="text">{{ dataForm.bipvChipUsage }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
<p class="title">芯片利用率(%)</p>
<p class="text">{{ dataForm.bipvChipUtilizationRate }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ }}</p>
<p class="title">内部材料成本(/)</p>
<p class="text">{{ dataForm.bipvInsideMaterialCost }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="title">OEM及委外材料成本(/)</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ dataForm.productName }}</p>
<p class="title">综合材料成本(/)</p>
<p class="text">{{ dataForm.bipvComprehensiveMaterialCost }}</p>
</el-col>
</el-row>
</div>
<div v-if="glass === 4">
<!-- 铜铟镓硒待完成 -->
</div>
</div>
</el-drawer>
</template>
<script>
// import basicAdd from './basic-add';
import {
getProduceDataDetail
} from "@/api/produceData";
import { getProduceDataDetail } from "@/api/produceData";
// import { getList, } from "@/api/base/qualityScrapType";
import SmallTitle from './SmallTitle';
import { factoryList } from "@/utils/constants";
export default {
components: {
SmallTitle,
},
// mixins: [basicAdd],
props: {
date: {
type: Number,
default: 0
}
},
data() {
return {
factoryList,
urlOptions: {
isGetCode: false,
// codeURL: getCode,
@ -198,6 +200,8 @@ export default {
}
],
sectionList: [],
glass: 0,
date: 0,
visible: false,
dataForm: {
id: undefined,
@ -229,11 +233,16 @@ export default {
// this.getCurrentTime()
},
methods: {
init(id) {
init(id, type, glass) {
this.visible = true
console.log('打印', id)
this.glass = glass
this.date = type
console.log('打印', id, glass)
if (id) {
getProduceDataDetail(id).then(res => {
getProduceDataDetail({
id: id,
type: type
}).then(res => {
this.dataForm = res.data
console.log('你好', res.data)
})

View File

@ -1,26 +1,26 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-06-07 09:41:56
* @LastEditTime: 2024-06-19 15:47:17
* @LastEditors: DY
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 200px - 31px)">
<div class="app-container" style="padding: 16px 24px 0; height: auto; flex-grow: 1;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择">
<el-form-item label="时间维度" prop="type">
<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.date === 0 || 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="datetimerange" range-separator=""
start-placeholder="开始日期" value-format="timestamp" format="yyyy-MM-dd" @change="changeDayTime" end-placeholder="结束日期">
start-placeholder="开始日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.date === 1" label="时间范围" prop="reportTime">
<el-form-item v-show="listQuery.type === 1" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
@ -28,26 +28,26 @@
<el-date-picker size="small" clearable v-model="listQuery.end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<span v-if="listQuery.start && listQuery.end" style="margin-left: 10px">
<!-- <span v-if="listQuery.start && listQuery.end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span>
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.date === 2" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="monthrange" value-format="timestamp" range-separator=""
<el-form-item v-show="listQuery.type === 2" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="monthrange" value-format="yyyy-MM-dd" range-separator=""
start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.date === 3" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.start" format="yyyy-MM-dd" value-format="timestamp" type="year"
<el-form-item v-show="listQuery.type === 3" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.start" value-format="yyyy-MM-dd" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker size="small" clearable v-model="listQuery.end" format="yyyy-MM-dd" value-format="timestamp" type="year" placeholder="结束时间"
<el-date-picker size="small" clearable v-model="listQuery.end" value-format="yyyy-MM-dd" type="year" placeholder="结束时间"
@change="getYear">
</el-date-picker>
</el-form-item>
<el-form-item label="工厂名称" prop="factorys">
<el-select size="small" clearable v-model="listQuery.factorys" placeholder="请选择工厂名称" multiple >
<el-form-item label="工厂名称" prop="factory">
<el-select size="small" clearable v-model="listQuery.factory" placeholder="请选择工厂名称" multiple >
<el-option v-for="item in factoryArray" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
@ -58,8 +58,8 @@
</el-option>
</el-select>
</el-form-item> -->
<el-form-item label="玻璃类型" prop="type">
<el-select size="small" clearable v-model="listQuery.type" multiple placeholder="请选择玻璃类型">
<el-form-item label="玻璃类型" prop="glass">
<el-select size="small" clearable v-model="listQuery.glass" multiple placeholder="请选择玻璃类型">
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
@ -82,19 +82,19 @@
</div>
<div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" style="margin-bottom: 0" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size"
:table-data="tableData">
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData" :max-height="tableH">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.size"
:page.sync="listQuery.current"
: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" />
<add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" @destroy="detailOrUpdateVisible = false" />
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
@ -106,8 +106,9 @@
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
import { getProduceDataPage, prodOutputDataList, exportOutPutExcel } from '@/api/produceData';
// import { parseTime } from "@/utils/ruoyi";
import tableHeightMixin from "@/mixins/tableHeightMixin";
import { getProduceDataPage, getproddata, exportOutPutExcel } from '@/api/produceData';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
@ -118,22 +119,22 @@ import { factoryList, factoryArray, factoryArray1 } from "@/utils/constants";
export default {
components: { lineChart, ButtonNav, AddOrUpdate },
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
factoryList,
factoryArray,
factoryArray1,
listQuery: {
size: 20,
current: 1,
factorys: undefined,
pageSize: 20,
pageNo: 1,
factory: undefined,
total: 0,
date: 0,
type:undefined,
type: 0, //
glass: undefined, //
// reportType: 2,
beginTime: undefined,
endTime:undefined,
startDate: undefined,
endDate:undefined,
reportTime: [],
start: undefined,
end: undefined
@ -153,7 +154,7 @@ export default {
].filter((v) => v),
typeList: [
{
name: '芯片',
name: '玻璃芯片',
id: 0,
},
{
@ -164,6 +165,10 @@ export default {
name: 'BIPV产品',
id: 2,
},
// {
// name: '',
// id: 3,
// },
],
formConfig: [
{
@ -197,16 +202,16 @@ export default {
],
tableProps: [
{
prop: 'groupTime',
prop: 'datestr',
label: '日期',
minWidth: 100,
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'factory',
label: '工厂名称',
filter: (val) => factoryList[val],
minWidth: 200,
minWidth: 180,
showOverflowtooltip: true
},
{
@ -215,19 +220,19 @@ export default {
filter: (val) => ['玻璃芯片', '标准组件', 'BIPV', '定制组件'][val]
},
{
prop: 'inputNumber',
prop: 'inputNum',
label: '投入数量',
},
{
prop: 'outputNumber',
prop: 'outputNum',
label: '产出数量',
},
{
prop: 'goodNumber',
prop: 'goodNum',
label: '良品数量',
},
{
prop: 'yieldRate',
prop: 'goodRatio',
label: '良品率%',
filter: (val) => (val * 100) + '%'
},
@ -235,22 +240,23 @@ export default {
tableData: [],
lineData: [],
chart: null,
seriesList: []
seriesList: [],
colorList: ['#2760FF', '#8167F6', '#5B9BFF', '#FFD160']
// proLineList: [],
// all: {}
};
},
computed: {
weekNum() {
return Math.round((this.listQuery.end - this.listQuery.start) / (24 * 60 * 60 * 1000 * 7)) + 1
},
},
// computed: {
// weekNum() {
// return Math.round((this.listQuery.end - this.listQuery.start) / (24 * 60 * 60 * 1000 * 7)) + 1
// },
// },
created() {
const today = new Date()
const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
this.listQuery.beginTime = sevenDaysAgo.getTime()
this.listQuery.endTime = today.getTime()
this.listQuery.reportTime = [this.listQuery.beginTime, this.listQuery.endTime]
this.listQuery.startDate = moment(sevenDaysAgo).format('yyyy-MM-DD')
this.listQuery.endDate = moment(today).format('yyyy-MM-DD')
this.listQuery.reportTime = [this.listQuery.startDate, this.listQuery.endDate]
},
mounted() {
},
@ -259,7 +265,7 @@ export default {
this.detailOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id);
this.$refs.detailOrUpdate.init(val.data.id, this.listQuery.type, val.data.glassType);
});
},
getYear(e) {
@ -273,8 +279,12 @@ export default {
this.listQuery.end = undefined
// console.log();
} else {
this.listQuery.beginTime = this.listQuery.start
this.listQuery.endTime = this.listQuery.end
this.listQuery.startDate = this.listQuery.start
this.listQuery.endDate = this.listQuery.end
}
if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
// console.log(e);
},
@ -292,10 +302,14 @@ export default {
type: 'warning'
});
} else {
this.listQuery.beginTime = this.listQuery.start.getTime() - 24 * 60 * 60 * 1000
this.listQuery.endTime = this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000
this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
}
}
if (!this.listQuery.start && !this.listQuery.end) {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
@ -310,10 +324,12 @@ export default {
});
this.listQuery.reportTime = [];
} else {
this.listQuery.beginTime = this.listQuery.reportTime[0]
this.listQuery.endTime = this.listQuery.reportTime[1]
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
changeTime(value) {
@ -326,114 +342,115 @@ export default {
});
this.listQuery.reportTime = [];
} else {
this.listQuery.beginTime = this.listQuery.reportTime[0]
this.listQuery.endTime = this.listQuery.reportTime[1]
this.listQuery.startDate = this.listQuery.reportTime[0]
this.listQuery.endDate = this.listQuery.reportTime[1]
}
} else {
console.log(this.listQuery.reportTime[0])
this.listQuery.startDate = undefined
this.listQuery.endDate = undefined
}
},
async getDataList() {
const res = await getProduceDataPage(this.listQuery)
await getProduceDataPage(this.listQuery).then(res => {
console.log(res)
if (res.code === 0) {
this.tableData = res.data.records
this.listQuery.total = res.data.total
// if (this.listQuery.total > 0) {
// this.tableData.forEach(item => {
// item.tableTime = item?.reportDate?.length > 0 ? item.reportDate[0] + '-' + item.reportDate[1] + '-' + item.reportDate[2] : '--'
// })
// }
}
})
//
await prodOutputDataList({
current: 1,
size: 99,
beginTime: this.listQuery.beginTime,
endTime: this.listQuery.endTime,
factorys: this.listQuery.factorys,
date: this.listQuery.date,
type: this.listQuery.type
}).then(resp => {
console.log('Aaa', resp.data)
this.lineData = resp?.data || []
if (this.lineData.length > 0) {
this.buildChart(this.lineData)
await getproddata(this.listQuery).then(resp => {
if (resp.data?.length > 0) {
const chartData = Object.groupBy(resp.data, (member) => member.datestr)
this.buildChart(chartData, resp.data)
} else {
this.$refs.lineChart.initChart([], [])
}
})
// this.buildChart(this.tableData)
},
buildChart(list) {
let temp = []
buildChart(data, dataList) {
let xAxisData = []
list.forEach(item => {
temp.push(item.groupTime)
})
this.seriesList = []
// x
xAxisData = Array.from(new Set(temp))
xAxisData = Object.keys(data)
// y
for (const y of this.factoryArray1) {
for (const type of this.typeList) {
const seriesItem = {
name: y.name,
record: type.name,
type: 'bar',
emphasis: {
focus: 'series'
},
data: Array(xAxisData.length).fill(0)
}
list.forEach(data => {
this.factoryArray.forEach(fac => {
let i = 0
while ( i < 3) {
//
const index1 = ['chipYield', 'componentYield', 'bipvProductOutput'][i]
// let oneChart = {}
xAxisData.forEach((x, index) => {
if (x === data.groupTime && y.id === data.factory && type.id === data.glassType) {
seriesItem.data[index] = data.goodNumber
if (this.listQuery.glass.length === 0 || this.listQuery.glass.length === 3) {
let series = {
name: ['玻璃芯片', '标准组件', 'BIPV'][i] + '-' + fac.id,
type: 'bar',
stack: String(fac.id),
data: Array(xAxisData.length).fill(0),
barWidth: 20,
itemStyle: {
color: this.colorList[i]
}
}
dataList.forEach(item => {
if (fac.id === item.factory && item.datestr === x) {
series.data[index] = item[index1]
}
})
this.seriesList.push(series)
} else {
this.listQuery.glass.forEach(gl => {
if (gl === i) {
let series = {
name: ['玻璃芯片', '标准组件', 'BIPV'][i] + '-' + fac.id,
type: 'bar',
stack: String(fac.id),
data: Array(xAxisData.length).fill(0),
barWidth: 20,
itemStyle: {
color: this.colorList[i]
}
}
dataList.forEach(item => {
if (fac.id === item.factory && item.datestr === x) {
series.data[index] = item[index1]
}
})
this.seriesList.push(seriesItem)
this.seriesList.push(series)
}
})
}
console.log('啊啊', this.seriesList)
this.$refs.lineChart.initChart(xAxisData, this.seriesList)
// const chartList = Object.groupBy(list, (item) => item.tableTime)
// this.xAxis = []
// this.seriesList = []
// for (const keyIndex in chartList) {
// // X
// this.xAxis.push(keyIndex)
// }
// // y
// for (const y of this.factoryArray) {
// // y: {name: , id: }
// const seriesItem = {
// name: y.name,
// let series = {
// name: ['', '', 'BIPV'][i] + '-' + fac.id,
// type: 'bar',
// emphasis: {
// focus: 'series'
// },
// data: Array(this.xAxis.length).fill(0)
// stack: String(fac.id),
// data: Array(xAxisData.length).fill(0),
// barWidth: 20,
// itemStyle: {
// color: this.colorList[i]
// }
// for (const a in chartList) {
// for (const z of chartList[a]) {
// this.xAxis.forEach((item, index) => {
// if (z.factory === y.id && a === item) {
// seriesItem.data[index] = z.goodNumber
// }
// dataList.forEach(item => {
// if (fac.id === item.factory && item.datestr === x) {
// series.data[index] = item[index1]
// }
// })
// }
// }
// this.seriesList.push(seriesItem)
// }
// this.$refs.lineChart.initChart(this.xAxis, this.seriesList)
// this.seriesList.push(series)
})
i ++
}
})
console.log('你好', this.seriesList)
this.$refs.lineChart.initChart(xAxisData, this.seriesList)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.current = 1;
this.listQuery.size = 20;
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.getDataList();
break;
case 'export':
@ -448,8 +465,8 @@ export default {
this.$modal.confirm('是否确认导出生产数据?').then(() => {
//
let params = {...this.listQuery};
params.current = 1;
params.size = 999;
params.pageNo = 1;
params.pageSize = 999;
this.exportLoading = true;
return exportOutPutExcel(params);
}).then(response => {

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: DY
* @LastEditTime: 2024-05-30 14:52:05
* @LastEditTime: 2024-06-19 15:13:23
* @Description:
-->
<template>
@ -16,6 +16,8 @@
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
import { factoryListabbr } from "@/utils/constants";
export default {
name: 'OverviewBar',
mixins: [resize],
@ -72,6 +74,11 @@ export default {
},
methods: {
initChart(xAxis, seriesList) {
console.log('2', xAxis, seriesList)
if (xAxis.length === 0) {
this.chart.clear()
}
else {
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
@ -79,28 +86,56 @@ export default {
text: '',
// subtext: 'Fake Data'
},
tooltip: {
trigger: 'axis'
},
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
legend: {
// data: ['1', '2'],
right: '90px',
top: '0%',
icon: 'rect',
itemWidth: 10,
itemHeight: 10,
itemGap: 40,
formatter(name) {
return name.split('-')[0]
},
// toolbox: {
// show: true,
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
data: ['玻璃芯片-0', '标准组件-0', 'BIPV-0']
},
tooltip: {
trigger: 'axis',
formatter: function(params) {
let result = `
<div style="width: 270px; display: flex">
<div style="width: 150px">${params[0].name}</div>
<div style="width: 60px">${factoryListabbr[0]}</div>
<div style="width: 60px">${factoryListabbr[1]}</div>
</div>`
const newArray = params.map(p => {
return {
glass: p.seriesName.split('-')[0], //
factoryName: factoryListabbr[p.seriesName.split('-')[1]], //
value: p.value,
name: p.name,
marker: p.marker
}
})
const analyzeList = Object.groupBy(newArray, (member) => member.glass)
for (let g in analyzeList) {
// date =>
let oneData = `<div style="width: 270px; display: flex">
<div style="width: 150px">${analyzeList[g][0].marker} ${g}</div>`
for (let fac of factoryListabbr) {
let goodNum = 0
for (let ana of analyzeList[g]) {
if (ana.factoryName === fac && ana.value !== 0) {
goodNum = ana.value
}
}
oneData += `<div style="width: 60px">${goodNum}</div>`
}
result = result + oneData + '</div>'
}
return result
}
},
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
calculable: true,
xAxis: [
{
@ -126,9 +161,14 @@ export default {
}
}
}
}
</script>
<style scoped>
.chartTooltipSpan {
width: 50px;
background: #787878;
}
/* .reportChart {
position: absolute;
height: 100%;