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 390 additions and 312 deletions

View File

@ -1,7 +1,7 @@
### ###
# @Author: zhp # @Author: zhp
# @Date: 2024-04-28 13:42:51 # @Date: 2024-04-28 13:42:51
# @LastEditTime: 2024-06-17 09:01:32 # @LastEditTime: 2024-06-19 16:05:46
# @LastEditors: DY # @LastEditors: DY
# @Description: # @Description:
### ###

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2022-01-21 14:43:06 * @Date: 2022-01-21 14:43:06
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-05-30 14:52:05 * @LastEditTime: 2024-06-19 15:13:23
* @Description: * @Description:
--> -->
<template> <template>
@ -16,6 +16,8 @@
import * as echarts from 'echarts' import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize' import resize from '@/mixins/resize'
import { factoryListabbr } from "@/utils/constants";
export default { export default {
name: 'OverviewBar', name: 'OverviewBar',
mixins: [resize], mixins: [resize],
@ -72,35 +74,68 @@ export default {
}, },
methods: { methods: {
initChart(xAxis, seriesList) { initChart(xAxis, seriesList) {
this.chart = echarts.init(document.getElementById(this.id)) console.log('2', xAxis, seriesList)
console.log(this.$parent); if (xAxis.length === 0) {
this.chart.setOption({ this.chart.clear()
}
else {
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
title: { title: {
text: '', text: '',
// subtext: 'Fake Data' // subtext: 'Fake Data'
}, },
tooltip: {
trigger: 'axis'
},
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
legend: { legend: {
// data: ['1', '2'],
right: '90px', right: '90px',
top: '0%', top: '0%',
icon: 'rect', icon: 'rect',
itemWidth: 10, itemWidth: 10,
itemHeight: 10, itemHeight: 10,
itemGap: 40, itemGap: 40,
formatter(name) {
return name.split('-')[0]
},
data: ['玻璃芯片-0', '标准组件-0', 'BIPV-0']
}, },
// toolbox: { tooltip: {
// show: true, trigger: 'axis',
// feature: { formatter: function(params) {
// dataView: { show: true, readOnly: false }, let result = `
// magicType: { show: true, type: ['line', 'bar'] }, <div style="width: 270px; display: flex">
// restore: { show: true }, <div style="width: 150px">${params[0].name}</div>
// saveAsImage: { show: true } <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, calculable: true,
xAxis: [ xAxis: [
{ {
@ -123,12 +158,17 @@ export default {
}, },
series: seriesList series: seriesList
}, true) }, true)
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.chartTooltipSpan {
width: 50px;
background: #787878;
}
/* .reportChart { /* .reportChart {
position: absolute; position: absolute;
height: 100%; height: 100%;