projects/mescc/develop #24

Merged
juzi merged 94 commits from projects/mescc/develop into projects/mescc/main 2024-05-31 14:21:24 +08:00
23 changed files with 5792 additions and 7 deletions
Showing only changes of commit a63cfb5820 - Show all commits

View File

@ -45,6 +45,7 @@
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"axios": "^1.6.8", "axios": "^1.6.8",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"code-brick-zj": "^1.1.0",
"core-js": "^3.26.0", "core-js": "^3.26.0",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"echarts": "5.4.0", "echarts": "5.4.0",

View File

@ -1,3 +1,10 @@
<!--
* @Author: zhp
* @Date: 2024-04-12 11:13:06
* @LastEditTime: 2024-04-15 13:52:16
* @LastEditors: zhp
* @Description:
-->
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
@ -35,7 +42,7 @@ export default {
overflow: visible; overflow: visible;
margin: 8px 14px 0px 16px; margin: 8px 14px 0px 16px;
border-radius: 8px; border-radius: 8px;
background-color: #fff; // background-color: #fff;
} }
.fixed-header+.app-main { .fixed-header+.app-main {

View File

@ -1,5 +1,12 @@
import Vue from "vue"; /*
import Element from "element-ui"; * @Author: zhp
* @Date: 2024-04-12 11:13:06
* @LastEditTime: 2024-04-12 16:20:31
* @LastEditors: zhp
* @Description:
*/
import Vue from 'vue'
import Element from 'element-ui'
// 修改如下样式文件,覆盖样式,或者新增样式文件 // 修改如下样式文件,覆盖样式,或者新增样式文件
import "./assets/styles/element-variables.scss"; import "./assets/styles/element-variables.scss";
@ -58,10 +65,10 @@ import DictTag from "@/components/DictTag";
// 头部标签插件 // 头部标签插件
import VueMeta from "vue-meta"; import VueMeta from "vue-meta";
Vue.use(directive); Vue.use(directive)
Vue.use(plugins); Vue.use(plugins)
Vue.use(VueMeta); Vue.use(VueMeta)
Vue.use(CodeBrickZj);
// Form Generator 组件需要使用到 tinymce // Form Generator 组件需要使用到 tinymce
import Tinymce from "@/components/tinymce/index.vue"; import Tinymce from "@/components/tinymce/index.vue";
Vue.component("tinymce", Tinymce); Vue.component("tinymce", Tinymce);

63
src/mixins/resize.js Normal file
View File

@ -0,0 +1,63 @@
/*
* @Author: zhp
* @Date: 2024-04-16 09:31:41
* @LastEditTime: 2024-04-16 09:31:41
* @LastEditors: zhp
* @Description:
*/
import { debounce } from '@/utils'
export default {
data() {
return {
$_sidebarElm: null,
$_resizeHandler: null
}
},
mounted() {
this.initListener()
},
activated() {
if (!this.$_resizeHandler) {
// avoid duplication init
this.initListener()
}
// when keep-alive chart activated, auto resize
this.resize()
},
beforeDestroy() {
this.destroyListener()
},
deactivated() {
this.destroyListener()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler(e) {
if (e.propertyName === 'width') {
this.$_resizeHandler()
}
},
initListener() {
this.$_resizeHandler = debounce(() => {
this.resize()
}, 100)
window.addEventListener('resize', this.$_resizeHandler)
this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
},
destroyListener() {
window.removeEventListener('resize', this.$_resizeHandler)
this.$_resizeHandler = null
this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
},
resize() {
const { chart } = this
chart && chart.resize()
}
}
}

47
src/utils/debounce.js Normal file
View File

@ -0,0 +1,47 @@
/*
* @Author: zhp
* @Date: 2024-04-16 09:32:29
* @LastEditTime: 2024-04-16 09:32:29
* @LastEditors: zhp
* @Description:
*/
/**
* @param {Function} func
* @param {number} wait
* @param {boolean} immediate
* @return {*}
*/
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result
const later = function () {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last)
} else {
timeout = null
// 如果设定为immediate===true因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args)
if (!timeout) context = args = null
}
}
}
return function (...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait)
if (callNow) {
result = func.apply(context, args)
context = args = null
}
return result
}
}

413
src/views/cost/index.vue Normal file
View File

@ -0,0 +1,413 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:14:51
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
<search-bar :formConfigs="mainFormConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-row :gutter="24">
<el-col :span="12" v-for="item in dataList" :key="item.id">
<line-chart :id="item.id" class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col>
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart },
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
clearable: true,
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
clearable:true,
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
timeList: [
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
}
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
buttonClick() {
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
changeTime(val) {
if (val) {
// let timeStamp = val.getTime(); //
// this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
} else {
this.listQuery.reportTime = []
}
},
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
changeTime(val) {
if (val) {
// console.log(val)
// console.log(val.setHours(7, 0, 0))
// console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// let time = this.format(val.setHours(7, 0, 0))
this.endTimeStamp = this.format(val.setHours(7, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.startTimeStamp = this.format(val.setHours(7, 0, 1) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// console.log(this.listQuery.reportTime);
this.listQuery.reportTime[0] = this.format(val.setHours(7, 0, 1)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.listQuery.reportTime[1] = this.format(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
console.log(this.listQuery.reportTime);
} else {
this.listQuery.reportTime = []
}
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,233 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-16 14:16:17
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" class="costChart" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
// import resize from './mixins/resize'
export default {
name: 'OverviewBar',
// mixins: [resize],
props: {
id: {
type: String,
default: 'OverviewLine'
},
// className: {
// type: String,
// default: 'epChart'
// },
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '35vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chartData: [
{
name: '产品1',
num: 1112,
yield: 0.97,
},
{
name: '产品2',
num: 1112,
yield: 0.97,
},
{
name: '产品3',
num: 1112,
yield: 0.97,
},
{
name: '产品4',
num: 1112,
yield: 0.97,
},
{
name: '产品5',
num: 1112,
yield: 0.97,
}
],
chart: null,
colors: ['rgba(113, 99, 254, 1)', 'rgba(39, 139, 255, 1)', 'rgba(100, 189, 255, 1)', 'rgba(143, 240, 170, 1)', 'rgba(246, 189, 22, 0.85)'],
}
},
mounted() {
this.initChart()
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
getEqualNewlineString(params, length) {
let text = ''
let count = Math.ceil(params.length / length) //
// length
if (count > 1) {
for (let z = 1; z <= count; z++) {
text += params.substr((z - 1) * length, length)
if (z < count) {
text += '\n'
}
}
} else {
text += params.substr(0, length)
}
return text
},
initChart() {
console.log(1111)
let num = 0
this.chartData && this.chartData.length > 0 && this.chartData.map(i => {
num += i.num
})
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose()
}
this.chart = echarts.init(document.getElementById(this.id))
this.chart.setOption({
color: this.colors,
title: {
text: num,
subtext: '总数/片',
top: '32%',
left: '49%',
textAlign: 'center',
textStyle: {
fontSize: 32,
color: 'rgba(140, 140, 140, 1)',
},
subtextStyle: {
fontSize: 20,
color: '#fff00',
},
},
legend: {
bottom: '2%',
left: 'center',
itemWidth: 12,
itemHeight: 12,
icon: 'roundRect',
textStyle: {
color: 'rgba(140, 140, 140, 1)'
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
itemStyle: {
color: this.colors[index % 4]
}
}))
},
series: [{
name: 'ISRA缺陷检测',
type: 'pie',
// position:outerHeight,
center: ['50%', '40%'],
radius: ['45%', '70%'],
avoidLabelOverlap: true,
label: {
show: true,
normal: {
alignTo: 'labelLine',
margin: 10,
edgeDistance: 10,
lineHeight: 16,
//
// params: data,
formatter: function (params) {
console.log(params);
return;
},
formatter: (params) => {
//
return this.getEqualNewlineString(params.value + " | " + params.percent.toFixed(0) + "%" + "\n" + params.name, 10);
},
textStyle: { //
// color: 'rgba(0, 0, 0, 0.65)',
fontSize: 18
}
}
},
labelLine: {
show: true,
length: 25,
length2: 100,
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
value: item.num,
label: {
color: this.colors[index % 4]
},
itemStyle: {
// color: {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// global: false,
// colorStops: [
// { offset: 0, color: this.colors[index % 4] },
// { offset: 1, color: this.colors[index % 4] + '33' }
// ]
// }
}
}))
}],
tooltip: {
trigger: 'item',
className: "isra-chart-tooltip"
},
})
}
}
}
</script>
<style scoped>
</style>

564
src/views/energy/index.vue Normal file
View File

@ -0,0 +1,564 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:14:31
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
<div style="background: #fff; height: 70px; width:100%">
<ButtonNav :menus="['水', '电', '气']" :button-mode="true" @change="currentMenu = $event">
</ButtonNav>
</div>
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="reportTime">
<el-select clearable v-model="timeSelect" 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="timeSelect === 'day'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="datetimerange" 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="timeSelect === 'week'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker clearable v-model="listQuery.reportTime[1]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<span v-if="listQuery.reportTime[0] && listQuery.reportTime[1]" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span>
</el-form-item>
<el-form-item v-show="timeSelect === 'month'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="monthrange" range-separator=""
start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="timeSelect === 'year'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker 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="factoryId">
<el-select clearable v-model="listQuery.factoryId" placeholder="请选择工厂名称">
<el-option v-for="item in factoryList" :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-button type="primary" size="small" plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="24"> -->
<!-- <el-col :span="12" v-for="item in dataList" :key="item.id"> -->
<line-chart class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
<!-- </el-col> -->
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
import ButtonNav from '@/components/ButtonNav'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart, ButtonNav },
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
date1: undefined,
date2: undefined,
// weekNum: undefined,
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
timeList: [
{
value: 'day',
label: '日'
},
{
value: 'week',
label: '周'
},
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
}
],
timeSelect:'day',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
computed: {
weekNum() {
return Math.round((this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 60 * 60 * 1000 * 7)) + 1
},
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
buttonClick() {
},
getYear(e) {
if (this.listQuery.reportTime[0] && e - this.listQuery.reportTime[0] > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
// console.log();
}
// console.log(e);
},
onValueChange(picker, k) { // k
if (this.listQuery.reportTime[0] && this.listQuery.reportTime[1]) {
console.log(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000)
this.date1 = moment(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
// this.onValueChange() // value
this.date2 = moment(this.listQuery.reportTime[1].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'
});
// this.onValueChange()
}
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (new Date(this.listQuery.reportTime[1]).getTime() - new Date(this.listQuery.reportTime[0]).getTime()) / (24 * 3600 * 1000); if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
}
} else {
}
},
changeTime(value) {
if (this.listQuery.reportTime) {
const timeStamp = this.listQuery.reportTime[1].getMonth(); //
const fullyear = this.listQuery.reportTime[1].getFullYear()
let days = 0
switch (timeStamp) {
case 0:
case 2:
case 4:
case 6:
case 7:
case 9:
case 11:
days = 31
break
case 3:
case 4:
case 8:
case 10:
days = 30
break
case 1:
if ((fullyear % 400 === 0) || (fullyear % 4 === 0 && fullyear % 100 !== 0)) {
days = 29
} else {
days = 28
}
break
}
let startTime = moment(new Date(this.listQuery.reportTime[0]).setDate(1, 0, 0, 0)).format('YYYY-MM-DD HH:mm:ss')
// this.startTimeStamp = this.timeFun(new Date(fullyear, timeStamp, 1, 7, 0, 1).getTime()); //
let endTime = this.timeFun(new Date(fullyear, timeStamp, days).getTime()) + ' 23:59:59'; //
// console.log(endTimeStamp);
// let endTime = moment(this.listQuery.reportTime[1]).month(monthNum - 1).date(1).endOf("month").format("YYYY-MM-DD");
// console.log(endTime);
// console.log(moment(new Date(this.listQuery.reportTime[1]).setDate(31, 23, 59, 59)).format('YYYY-MM-DD HH:mm:ss'))
// console.log(moment(new Date(this.listQuery.reportTime[1]).getTime()).format('YYYY-MM-DD HH:mm:ss'))
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
const numDays = (new Date(endTime).getTime() - new Date(startTime).getTime()) / (24 * 3600 * 1000); if (numDays > 730) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.reportTime[0] = startTime
this.listQuery.reportTime[1] = endTime
}
} else {
console.log(this.listQuery.reportTime[0])
}
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
// changeTime(val) {
// if (val) {
// // let timeStamp = val.getTime(); //
// // this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// // this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// // this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// // this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// } else {
// this.listQuery.reportTime = []
// }
// },
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,170 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-17 10:03:39
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" :class="className" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
export default {
name: 'OverviewBar',
mixins: [resize],
props: {
id: {
type: String,
default: 'reportChart'
},
className: {
type: String,
default: 'reportChart'
},
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '30vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
console.log(1111)
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
title: {
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,
},
// toolbox: {
// show: true,
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
calculable: true,
xAxis: [
{
type: 'category',
// prettier-ignore
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value'
}
],
grid: {
top: '20%',
left: "1%",
right: "3%",
bottom: "1%",
containLabel: true
},
series: [
{
name: '工厂1',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(99, 189, 255, 1)', //线
lineStyle: {
color: 'rgba(99, 189, 255, 1)' //线
}
}
},
data: [
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
],
},
{
name: '工厂2',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(142, 240, 171, 1)', //线
lineStyle: {
color: 'rgba(142, 240, 171, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
},
]
})
}
}
}
</script>
<style scoped>
/* .reportChart {
position: absolute;
height: 100%;
width: 100%;
top: 10px;
} */
</style>

View File

@ -0,0 +1,383 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:14:01
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div ref="parentChartDiv" class="app-container" style="padding: 16px 24px 0;height;auto;flex-grow: 1;">
<!-- <el-alert title="自定义 close-text" type="warning" close-text="知道了">
</el-alert> -->
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="reportTime">
<el-select clearable v-model="timeSelect" 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="timeSelect === 'month'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="monthrange" range-separator=""
start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="timeSelect === 'year'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker 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="factoryId">
<el-select clearable v-model="listQuery.factoryId" placeholder="请选择工厂名称">
<el-option v-for="item in factoryList" :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-button type="primary" size="small" plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<!-- <el-row style="height: 400px;"> -->
<!-- <div style="height: auto;"> -->
<line-chart class="epChart" ref="lineChart" style="width: 100%"></line-chart>
<!-- </div> -->
<!-- </el-row> -->
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart },
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
formConfig: [
{
type: 'title',
label: '环保管理',
},
],
timeList: [
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
typeList: [
{
name: '芯片',
id:0,
},
{
name: '标准组件',
id: 1,
},
{
name: 'BIPV产品',
id: 2,
},
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
},
{
prop: 'datas',
label: '废水(t)',
// subcomponent: row
},
{
prop: 'unit',
label: '废气(m³)',
// subcomponent: row
},
{
prop: 'remark',
label: 'VOC(g/L)',
// subcomponent: row
},
{
prop: 'kg',
label: '固体废弃物-可回收(kg)',
// subcomponent: row
}
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
date:'凯盛玻璃控股成员企业2024生产数据',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
buttonClick() {
},
getYear(e) {
if (this.listQuery.reportTime[0] && e - this.listQuery.reportTime[0] > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
// console.log();
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
const numDays = (new Date(this.listQuery.reportTime[1]).getTime() - new Date(this.listQuery.reportTime[0]).getTime()) / (24 * 3600 * 1000); if (numDays > 730) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
this.createStartDate = '';
this.createEndDate = '';
}
} else {
this.createStartDate = '';
this.createEndDate = '';
}
},
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
// changeTime(val) {
// if (val) {
// // console.log(val)
// // console.log(val.setHours(7, 0, 0))
// // console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// // let time = this.format(val.setHours(7, 0, 0))
// this.endTimeStamp = this.format(val.setHours(7, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.startTimeStamp = this.format(val.setHours(7, 0, 1) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// // console.log(this.listQuery.reportTime);
// this.listQuery.reportTime[0] = this.format(val.setHours(7, 0, 1)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = this.format(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// console.log(this.listQuery.reportTime);
// } else {
// this.listQuery.reportTime = []
// }
// },
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: auto;
overflow: auto;
}
</style>

View File

@ -0,0 +1,211 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-16 15:48:46
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" class="epChart" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
export default {
name: 'OverviewBar',
mixins: [resize],
props: {
id: {
type: String,
default: 'OverviewLine'
},
// className: {
// type: String,
// default: 'epChart'
// },
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '550px'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chart: null
}
},
mounted() {
// this.$nextTick(() => {
// this.initChart()
// })
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
console.log(1111)
this.chart = echarts.init(document.getElementById(this.id))
console.log(document.querySelector(".app-container").style);
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
grid: { top: 60, right: 90, bottom: 10, left: 10, containLabel: true },
legend: {
data: ['废水', '废气', 'VOC'],
right: '90px',
top: '0%',
icon: 'roundRect',
itemGap: 40,
itemWidth: 20,
itemHeight: 2,
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '废水/t',
min: 0,
max: 250,
interval: 50,
axisLabel: {
formatter: '{value}'
}
},
{
type: 'value',
name: '废气/m³',
min: 0,
max: 25,
interval: 5,
axisLabel: {
formatter: '{value}'
}
}
],
series: [
{
name: '废水',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + ' t';
}
},
itemStyle: {
normal: {
color: 'rgba(40, 138, 255, 1)', //线
lineStyle: {
color: 'rgba(40, 138, 255, 1)' //线
}
}
},
data: [
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
]
},
{
name: '废气',
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' m³';
}
},
itemStyle: {
normal: {
color: 'rgba(99, 189, 255, 1)', //线
lineStyle: {
color: 'rgba(99, 189, 255, 1)' //线
}
}
},
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
},
{
name: 'VOC',
type: 'line',
yAxisIndex: 1,
tooltip: {
valueFormatter: function (value) {
return value + ' m³';
}
},
itemStyle: {
normal: {
color: 'rgba(255, 206, 106, 1)', //线
lineStyle: {
color: 'rgba(255, 206, 106, 1)' //线
}
}
},
data: [33.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
]
})
}
}
}
</script>
<style scoped>
/* .epChart {
position: absolute;
height: 100%;
width: 100%;
top: 10px;
} */
</style>

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,365 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-04-17 15:37:39
* @LastEditors: zhp
* @Description:
-->
<template>
<el-drawer class="drawer" :visible.sync="visible" size="50%">
<small-title slot="title" :no-padding="true">
{{ '碲化镉工厂生产数据详情' }}
</small-title>
<div class="detailBox">
<el-row :gutter="24">
<el-col :span="8">
<p class="title">工厂名称</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间维度</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-divider></el-divider>
<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>
</el-col>
<el-col :span="6">
<p class="title">芯片良率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片良率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片总功率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">FTO投入量</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">CSS稼动率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片段OEE</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片平均功率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">芯片人均产量</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片产能利用率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
</el-row>
<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">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装线OEE</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件良率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">标准组件总功率</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装产能利用率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件人均产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件人均产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<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>
</el-col>
<el-col :span="6">
<p class="title">人均产量</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
</div>
</el-drawer>
</template>
<script>
// import basicAdd from './basic-add';
// import {
// createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
// getTeamList, getDetList, getLineList
// } from "@/api/base/qualityScrapLog";
// import { getList, } from "@/api/base/qualityScrapType";
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
// mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
// createURL: createQualityScrapLog,
// updateURL: updateQualityScrapLog,
// infoURL: getQualityScrapLog,
},
lineList: [],
typeList: [],
workOrderList: [],
detList: [],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
sectionList: [],
visible: false,
dataForm: {
id: undefined,
logTime: undefined,
source: 1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId: undefined,
description: undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
// this.getCurrentTime()
},
methods: {
init() {
this.visible = true
},
// getCurrentTime() {
// // new Date().Format("yyyy-MM-dd HH:mm:ss")
// this.dataForm.logTime = new Date()
// // this.dataForm.logTime = year + "-" + month + "-" + day;
// console.log(this.dataForm.logTime);
// },
async getDict() {
// //
// const res = await getList()
// this.typeList = res.data
// getWorkOrderList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getLineList().then((res) => {
// console.log(res);
// // console.log(response);
// this.lineList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getDetList().then((res) => {
// console.log(res);
// // console.log(response);
// this.detList = res.data.map((item) => {
// return {
// name: item.content,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getTeamList().then((res) => {
// console.log(res);
// // console.log(response);
// this.teamList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// },
// async getWorksectionById(lineId) {
// if (lineId) {
// const { code, data } = await this.$axios({
// url: '/base/core-workshop-section/listByParentId',
// method: 'get',
// params: {
// id: lineId,
// },
// });
// if (code == 0) {
// console.log(data)
// this.sectionList = data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// }
// } else {
// this.$axios({
// url: '/base/core-workshop-section/listAll',
// method: 'get',
// // params: {
// // id: lineId,
// // },
// }).then((res) => {
// // console.log(data)
// this.sectionList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// })
// }
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 30px;
}
.detailBox p {
margin: 0;
padding: 0 32px;
}
.detailBox .title {
/* width: 56px; */
/* height: 14px; */
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
line-height: 16px;
text-align: left;
font-style: normal;
text-transform: none;
}
.detailBox .text {
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
padding-bottom: 20px;
}
</style>

View File

@ -0,0 +1,625 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:13:47
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 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="reportTime">
<el-select clearable v-model="timeSelect" 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="timeSelect === 'day'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="datetimerange" 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="timeSelect === 'week'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker clearable v-model="listQuery.reportTime[1]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<span v-if="listQuery.reportTime[0] && listQuery.reportTime[1]" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span>
</el-form-item>
<el-form-item v-show="timeSelect === 'month'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="monthrange" range-separator=""
start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="timeSelect === 'year'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker 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="factoryId">
<el-select clearable v-model="listQuery.factoryId" placeholder="请选择工厂名称">
<el-option v-for="item in factoryList" :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 label="玻璃类型" prop="type">
<el-select clearable 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-button type="primary" size="small" plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="24"> -->
<!-- <el-col :span="12" v-for="item in dataList" :key="item.id"> -->
<line-chart class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
<!-- </el-col> -->
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
</base-table>
</div>
<add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" />
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page'
import AddOrUpdate from './add-or-updata';
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart, ButtonNav, AddOrUpdate },
mixins: [basicPage],
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
detailOrUpdateVisible:false,
date1: undefined,
date2: undefined,
tableBtn: [
{
type: 'detail',
btnName: '详情',
},
// {
// type: 'delete',
// btnName: '',
// },
].filter((v) => v),
typeList: [
{
name: '芯片',
id: 0,
},
{
name: '标准组件',
id: 1,
},
{
name: 'BIPV产品',
id: 2,
},
],
// weekNum: undefined,
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
timeList: [
{
value: 'day',
label: '日'
},
{
value: 'week',
label: '周'
},
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
},
{
prop: 'type',
label: '玻璃类型',
},
{
prop: 'inNum',
label: '投入数量',
},
{
prop: 'putNum',
label: '产出数量',
},
{
prop: 'goodNum',
label: '良品数量',
},
{
prop: 'goodYelid',
label: '良品率%',
},
],
timeSelect:'day',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
computed: {
weekNum() {
return Math.round((this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 60 * 60 * 1000 * 7)) + 1
},
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
otherMethods(val) {
this.detailOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id);
});
},
buttonClick() {
},
getYear(e) {
if (this.listQuery.reportTime[0] && e - this.listQuery.reportTime[0] > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
// console.log();
}
// console.log(e);
},
onValueChange(picker, k) { // k
if (this.listQuery.reportTime[0] && this.listQuery.reportTime[1]) {
console.log(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000)
this.date1 = moment(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
// this.onValueChange() // value
this.date2 = moment(this.listQuery.reportTime[1].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'
});
// this.onValueChange()
}
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (new Date(this.listQuery.reportTime[1]).getTime() - new Date(this.listQuery.reportTime[0]).getTime()) / (24 * 3600 * 1000); if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
}
} else {
}
},
changeTime(value) {
if (this.listQuery.reportTime) {
const timeStamp = this.listQuery.reportTime[1].getMonth(); //
const fullyear = this.listQuery.reportTime[1].getFullYear()
let days = 0
switch (timeStamp) {
case 0:
case 2:
case 4:
case 6:
case 7:
case 9:
case 11:
days = 31
break
case 3:
case 4:
case 8:
case 10:
days = 30
break
case 1:
if ((fullyear % 400 === 0) || (fullyear % 4 === 0 && fullyear % 100 !== 0)) {
days = 29
} else {
days = 28
}
break
}
let startTime = moment(new Date(this.listQuery.reportTime[0]).setDate(1, 0, 0, 0)).format('YYYY-MM-DD HH:mm:ss')
// this.startTimeStamp = this.timeFun(new Date(fullyear, timeStamp, 1, 7, 0, 1).getTime()); //
let endTime = this.timeFun(new Date(fullyear, timeStamp, days).getTime()) + ' 23:59:59'; //
// console.log(endTimeStamp);
// let endTime = moment(this.listQuery.reportTime[1]).month(monthNum - 1).date(1).endOf("month").format("YYYY-MM-DD");
// console.log(endTime);
// console.log(moment(new Date(this.listQuery.reportTime[1]).setDate(31, 23, 59, 59)).format('YYYY-MM-DD HH:mm:ss'))
// console.log(moment(new Date(this.listQuery.reportTime[1]).getTime()).format('YYYY-MM-DD HH:mm:ss'))
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
const numDays = (new Date(endTime).getTime() - new Date(startTime).getTime()) / (24 * 3600 * 1000); if (numDays > 730) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.reportTime[0] = startTime
this.listQuery.reportTime[1] = endTime
}
} else {
console.log(this.listQuery.reportTime[0])
}
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
// changeTime(val) {
// if (val) {
// // let timeStamp = val.getTime(); //
// // this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// // this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// // this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// // this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// } else {
// this.listQuery.reportTime = []
// }
// },
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,170 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-17 10:03:39
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" :class="className" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
export default {
name: 'OverviewBar',
mixins: [resize],
props: {
id: {
type: String,
default: 'reportChart'
},
className: {
type: String,
default: 'reportChart'
},
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '30vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
console.log(1111)
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
title: {
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,
},
// toolbox: {
// show: true,
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
calculable: true,
xAxis: [
{
type: 'category',
// prettier-ignore
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value'
}
],
grid: {
top: '20%',
left: "1%",
right: "3%",
bottom: "1%",
containLabel: true
},
series: [
{
name: '工厂1',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(99, 189, 255, 1)', //线
lineStyle: {
color: 'rgba(99, 189, 255, 1)' //线
}
}
},
data: [
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
],
},
{
name: '工厂2',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(142, 240, 171, 1)', //线
lineStyle: {
color: 'rgba(142, 240, 171, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
},
]
})
}
}
}
</script>
<style scoped>
/* .reportChart {
position: absolute;
height: 100%;
width: 100%;
top: 10px;
} */
</style>

View File

@ -0,0 +1,66 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,365 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-04-17 15:37:39
* @LastEditors: zhp
* @Description:
-->
<template>
<el-drawer class="drawer" :visible.sync="visible" size="50%">
<small-title slot="title" :no-padding="true">
{{ '碲化镉工厂生产数据详情' }}
</small-title>
<div class="detailBox">
<el-row :gutter="24">
<el-col :span="8">
<p class="title">工厂名称</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间维度</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="8">
<p class="title">时间</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-divider></el-divider>
<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>
</el-col>
<el-col :span="6">
<p class="title">芯片良率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片良率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片总功率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">FTO投入量</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">CSS稼动率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片段OEE</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片平均功率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">芯片人均产量</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片产能利用率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
</el-row>
<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">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装线OEE</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件良率</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">标准组件总功率</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">封装产能利用率</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件人均产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">标准组件人均产量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<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>
</el-col>
<el-col :span="6">
<p class="title">人均产量</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
<el-col :span="6">
<p class="title">芯片使用量</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ dataForm.code }}</p>
</el-col>
<el-col :span="6">
<p class="title">内部材料成本</p>
<p class="text">{{ dataForm.productName }}</p>
</el-col>
</el-row>
</div>
</el-drawer>
</template>
<script>
// import basicAdd from './basic-add';
// import {
// createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
// getTeamList, getDetList, getLineList
// } from "@/api/base/qualityScrapLog";
// import { getList, } from "@/api/base/qualityScrapType";
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
// mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
// createURL: createQualityScrapLog,
// updateURL: updateQualityScrapLog,
// infoURL: getQualityScrapLog,
},
lineList: [],
typeList: [],
workOrderList: [],
detList: [],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
}
],
sectionList: [],
visible: false,
dataForm: {
id: undefined,
logTime: undefined,
source: 1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId: undefined,
description: undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [{ required: true, message: "工单号不能为空", trigger: "change" }],
num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
detId: [{ required: true, message: "报废原因不能为空", trigger: "change" }],
logTime: [{ required: true, message: "报废时间不能为空", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
// this.getCurrentTime()
},
methods: {
init() {
this.visible = true
},
// getCurrentTime() {
// // new Date().Format("yyyy-MM-dd HH:mm:ss")
// this.dataForm.logTime = new Date()
// // this.dataForm.logTime = year + "-" + month + "-" + day;
// console.log(this.dataForm.logTime);
// },
async getDict() {
// //
// const res = await getList()
// this.typeList = res.data
// getWorkOrderList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getLineList().then((res) => {
// console.log(res);
// // console.log(response);
// this.lineList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getDetList().then((res) => {
// console.log(res);
// // console.log(response);
// this.detList = res.data.map((item) => {
// return {
// name: item.content,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getTeamList().then((res) => {
// console.log(res);
// // console.log(response);
// this.teamList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// },
// async getWorksectionById(lineId) {
// if (lineId) {
// const { code, data } = await this.$axios({
// url: '/base/core-workshop-section/listByParentId',
// method: 'get',
// params: {
// id: lineId,
// },
// });
// if (code == 0) {
// console.log(data)
// this.sectionList = data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// }
// } else {
// this.$axios({
// url: '/base/core-workshop-section/listAll',
// method: 'get',
// // params: {
// // id: lineId,
// // },
// }).then((res) => {
// // console.log(data)
// this.sectionList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id,
// };
// });
// })
// }
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 30px;
}
.detailBox p {
margin: 0;
padding: 0 32px;
}
.detailBox .title {
/* width: 56px; */
/* height: 14px; */
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
line-height: 16px;
text-align: left;
font-style: normal;
text-transform: none;
}
.detailBox .text {
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
padding-bottom: 20px;
}
</style>

View File

@ -0,0 +1,631 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:12:20
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
<ButtonNav :menus="['碲化镉工厂', '铜铟镓硒工厂']" :button-mode="true" @change="currentMenu = $event">
</ButtonNav>
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="reportTime">
<el-select clearable v-model="timeSelect" 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="timeSelect === 'day'" label="时间范围" prop="reportTime">
<el-date-picker v-model="listQuery.reportTime" type="datetimerange" 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="timeSelect === 'week'" label="时间范围" prop="reportTime">
<el-date-picker v-model="listQuery.reportTime[0]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker v-model="listQuery.reportTime[1]" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<span v-if="listQuery.reportTime[0] && listQuery.reportTime[1]" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span>
</el-form-item> -->
<el-form-item v-show="timeSelect === 'month'" label="时间范围" prop="reportTime">
<el-date-picker v-model="listQuery.reportTime" type="monthrange" range-separator="" start-placeholder="开始月份"
end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="timeSelect === 'year'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker 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="factoryId">
<el-select v-model="listQuery.factoryId" placeholder="请选择工厂名称" multiple="true" clearable>
<el-option v-for="item in factoryList" :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 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-button type="primary" size="small" plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<!-- <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> -->
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
</base-table>
<add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" @refreshDataList="successSubmit" />
<!-- <el-row :gutter="24"> -->
<!-- <el-col :span="12" v-for="item in dataList" :key="item.id"> -->
<!-- <line-chart class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart> -->
<!-- </el-col> -->
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page'
import AddOrUpdate from './add-or-updata';
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart, ButtonNav, AddOrUpdate },
mixins: [basicPage],
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
detailOrUpdateVisible:false,
date1: undefined,
date2: undefined,
tableBtn: [
{
type: 'detail',
btnName: '详情',
},
// {
// type: 'delete',
// btnName: '',
// },
].filter((v) => v),
typeList: [
{
name: '芯片',
id: 0,
},
{
name: '标准组件',
id: 1,
},
{
name: 'BIPV产品',
id: 2,
},
],
// weekNum: undefined,
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
timeList: [
// {
// value: 'day',
// label: ''
// },
// {
// value: 'week',
// label: ''
// },
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
},
{
name: '测试2',
id: 2
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
},
{
prop: 'type',
label: '玻璃类型',
},
{
prop: 'inNum',
label: '投入数量',
},
{
prop: 'putNum',
label: '产出数量',
},
{
prop: 'goodNum',
label: '良品数量',
},
{
prop: 'goodYelid',
label: '良品率%',
},
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
computed: {
weekNum() {
return Math.round((this.listQuery.reportTime[1] - this.listQuery.reportTime[0]) / (24 * 60 * 60 * 1000 * 7)) + 1
},
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
otherMethods(val) {
this.detailOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id);
});
},
buttonClick() {
},
getYear(e) {
if (this.listQuery.reportTime[0] && e - this.listQuery.reportTime[0] > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
// console.log();
}
// console.log(e);
},
onValueChange(picker, k) { // k
if (this.listQuery.reportTime[0] && this.listQuery.reportTime[1]) {
console.log(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000)
this.date1 = moment(this.listQuery.reportTime[0].getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
// this.onValueChange() // value
this.date2 = moment(this.listQuery.reportTime[1].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'
});
// this.onValueChange()
}
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
console.log(this.listQuery.reportTime[1])
const numDays = (new Date(this.listQuery.reportTime[1]).getTime() - new Date(this.listQuery.reportTime[0]).getTime()) / (24 * 3600 * 1000); if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
}
} else {
}
},
changeTime(value) {
if (this.listQuery.reportTime) {
const timeStamp = this.listQuery.reportTime[1].getMonth(); //
const fullyear = this.listQuery.reportTime[1].getFullYear()
let days = 0
switch (timeStamp) {
case 0:
case 2:
case 4:
case 6:
case 7:
case 9:
case 11:
days = 31
break
case 3:
case 4:
case 8:
case 10:
days = 30
break
case 1:
if ((fullyear % 400 === 0) || (fullyear % 4 === 0 && fullyear % 100 !== 0)) {
days = 29
} else {
days = 28
}
break
}
let startTime = moment(new Date(this.listQuery.reportTime[0]).setDate(1, 0, 0, 0)).format('YYYY-MM-DD HH:mm:ss')
// this.startTimeStamp = this.timeFun(new Date(fullyear, timeStamp, 1, 7, 0, 1).getTime()); //
let endTime = this.timeFun(new Date(fullyear, timeStamp, days).getTime()) + ' 23:59:59'; //
// console.log(endTimeStamp);
// let endTime = moment(this.listQuery.reportTime[1]).month(monthNum - 1).date(1).endOf("month").format("YYYY-MM-DD");
// console.log(endTime);
// console.log(moment(new Date(this.listQuery.reportTime[1]).setDate(31, 23, 59, 59)).format('YYYY-MM-DD HH:mm:ss'))
// console.log(moment(new Date(this.listQuery.reportTime[1]).getTime()).format('YYYY-MM-DD HH:mm:ss'))
// this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
// this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
const numDays = (new Date(endTime).getTime() - new Date(startTime).getTime()) / (24 * 3600 * 1000); if (numDays > 730) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.reportTime[0] = startTime
this.listQuery.reportTime[1] = endTime
}
} else {
console.log(this.listQuery.reportTime[0])
}
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
// changeTime(val) {
// if (val) {
// // let timeStamp = val.getTime(); //
// // this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// // this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// // this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// // this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// } else {
// this.listQuery.reportTime = []
// }
// },
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,170 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-17 10:03:39
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" :class="className" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
export default {
name: 'OverviewBar',
mixins: [resize],
props: {
id: {
type: String,
default: 'reportChart'
},
className: {
type: String,
default: 'reportChart'
},
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '30vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
console.log(1111)
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
title: {
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,
},
// toolbox: {
// show: true,
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
calculable: true,
xAxis: [
{
type: 'category',
// prettier-ignore
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value'
}
],
grid: {
top: '20%',
left: "1%",
right: "3%",
bottom: "1%",
containLabel: true
},
series: [
{
name: '工厂1',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(99, 189, 255, 1)', //线
lineStyle: {
color: 'rgba(99, 189, 255, 1)' //线
}
}
},
data: [
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
],
},
{
name: '工厂2',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(142, 240, 171, 1)', //线
lineStyle: {
color: 'rgba(142, 240, 171, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
},
]
})
}
}
}
</script>
<style scoped>
/* .reportChart {
position: absolute;
height: 100%;
width: 100%;
top: 10px;
} */
</style>

View File

@ -0,0 +1,372 @@
<!--
* @Author: zhp
* @Date: 2024-01-24 15:15:24
* @LastEditTime: 2024-04-17 16:15:23
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0; max-height: 45vh; flex-grow: 1;">
<!-- <div style="position: relative;z-index: 999;"> -->
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="reportTime">
<el-select clearable v-model="timeSelect" 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="timeSelect === 'month'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime" type="monthrange" range-separator=""
start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="timeSelect === 'year'" label="时间范围" prop="reportTime">
<el-date-picker clearable v-model="listQuery.reportTime[0]" value-format="yyyy" type="year"
placeholder="开始时间">
</el-date-picker>
~
<el-date-picker v-model="listQuery.reportTime[1]" value-format="yyyy" type="year" placeholder="结束时间"
@change="getYear">
</el-date-picker>
</el-form-item>
<el-form-item label="工厂名称" prop="factoryId">
<el-select clearable v-model="listQuery.factoryId" placeholder="请选择工厂名称">
<el-option v-for="item in factoryList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="玻璃类型" prop="type">
<el-select clearable 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-button type="primary" size="small" plain @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<!-- </div> -->
<!-- <el-row style="height: 500px;"> -->
<!-- <div> -->
<line-chart class="yearChart" ref="lineChart" style="height: 35vh;width: 100%"></line-chart>
<!-- </div> -->
<!-- </el-row> -->
</div>
<!-- <el-row style="height: 400px;"> -->
<!-- </el-row> -->
<div class="app-container" style="margin-top: 18px; height: unset; flex-grow: 1; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import { report } from 'process';
import lineChart from './lineChart';
import moment from 'moment'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart },
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
// startDatePicker: this.beginDate(),
// endDatePicker: this.processDate(),
yeartsStart: '',
yeartsEnd: '',
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
timeList: [
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
typeList: [
{
name: '芯片',
id:0,
},
{
name: '标准组件',
id: 1,
},
{
name: 'BIPV产品',
id: 2,
},
],
formConfig: [
{
type: 'title',
label: '报表管理',
},
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '科目',
},
{
prop: 'nickName',
label: '类别',
},
{
prop: 'datas',
label: '数值',
// subcomponent: row
},
{
prop: 'unit',
label: '单位',
// subcomponent: row
},
{
prop: 'remark',
label: '备注',
// subcomponent: row
}
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
date:'凯盛玻璃控股成员企业2024生产数据',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
getYear(e) {
if (this.listQuery.reportTime[0] && e - this.listQuery.reportTime[0] > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
// console.log();
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
this.createStartDate = moment(new Date(this.listQuery.reportTime[0]), 'yyyy-MM-dd hh:mm:ss');
this.createEndDate = moment(new Date(this.listQuery.reportTime[1]), 'yyyy-MM-dd hh:mm:ss');
const numDays = (new Date(this.listQuery.reportTime[1]).getTime() - new Date(this.listQuery.reportTime[0]).getTime()) / (24 * 3600 * 1000); if (numDays > 730) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
this.createStartDate = '';
this.createEndDate = '';
}
} else {
this.createStartDate = '';
this.createEndDate = '';
}
},
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
// changeTime(val) {
// if (val) {
// // console.log(val)
// // console.log(val.setHours(7, 0, 0))
// // console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// // let time = this.format(val.setHours(7, 0, 0))
// this.endTimeStamp = this.format(val.setHours(7, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.startTimeStamp = this.format(val.setHours(7, 0, 1) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// // console.log(this.listQuery.reportTime);
// this.listQuery.reportTime[0] = this.format(val.setHours(7, 0, 1)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = this.format(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// console.log(this.listQuery.reportTime);
// } else {
// this.listQuery.reportTime = []
// }
// },
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,200 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-16 09:58:08
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" :class="className" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
import resize from '@/mixins/resize'
export default {
name: 'OverviewBar',
mixins: [resize],
props: {
id: {
type: String,
default: 'reportChart'
},
className: {
type: String,
default: 'reportChart'
},
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '30vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
console.log(1111)
this.chart = echarts.init(document.getElementById(this.id))
console.log(this.$parent);
this.chart.setOption({
title: {
text: '',
// subtext: 'Fake Data'
},
tooltip: {
trigger: 'axis'
},
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
legend: {
data: ['FTO投入', '封装材料成本', '人均产量', '产品产量'],
right: '90px',
top: '0%',
icon: 'rect',
itemWidth: 10,
itemHeight: 10,
itemGap: 40,
},
// toolbox: {
// show: true,
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
// restore: { show: true },
// saveAsImage: { show: true }
// }
// },
calculable: true,
xAxis: [
{
type: 'category',
// prettier-ignore
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value'
}
],
grid: {
top: '20%',
left: "1%",
right: "3%",
bottom: "1%",
containLabel: true
},
series: [
{
name: 'FTO投入',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(99, 189, 255, 1)', //线
lineStyle: {
color: 'rgba(99, 189, 255, 1)' //线
}
}
},
data: [
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
],
},
{
name: '封装材料成本',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(142, 240, 171, 1)', //线
lineStyle: {
color: 'rgba(142, 240, 171, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
},
{
name: '人均产量',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(40, 138, 255, 1)', //线
lineStyle: {
color: 'rgba(40, 138, 255, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
},
{
name: '产品产量',
type: 'bar',
itemStyle: {
normal: {
color: 'rgba(113, 100, 255, 1)', //线
lineStyle: {
color: 'rgba(113, 100, 255, 1)' //线
}
}
},
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
],
}
]
})
}
}
}
</script>
<style scoped>
/* .reportChart {
position: absolute;
height: 100%;
width: 100%;
top: 10px;
} */
</style>

View File

@ -0,0 +1,424 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-04-17 16:15:42
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
<search-bar :formConfigs="mainFormConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-row :gutter="24">
<el-col :span="12" v-for="item in dataList" :key="item.id">
<line-chart :id="item.id" class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col>
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
// import { getGlassPage, exportGlasscExcel } from '@/api/report/glass';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart },
data() {
return {
listQuery: {
pageSize: 10,
pageNo: 1,
factoryId: null,
total: 0,
type: null,
// reportType: 2,
reportTime: []
},
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工厂名称',
placeholder: '请选择工厂名称',
param: 'factoryId',
selectOptions: [],
clearable:true,
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
// {
// // parent: 'dateFilterType',
// //
// type: 'datePicker',
// label: '',
// // dateType: 'datetimerange',
// dateType: 'datetimerange',
// format: 'yyyy-MM-dd HH:mm:ss',
// valueFormat: 'yyyy-MM-ddTHH:mm:ss',
// rangeSeparator: '-',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'recordTime',
// },
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '仓库管理',
},
],
timeList: [
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '工厂名称',
},
{
prop: 'nickName',
label: '玻璃类型',
},
{
prop: 'product',
label: '产品规格',
},
{
prop: 'num',
label: '库存数量',
},
{
prop: 'yeild',
label: '规格占比',
},
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
// this.getDataList()
},
methods: {
buttonClick() {
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
changeTime(val) {
if (val) {
// let timeStamp = val.getTime(); //
// this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
} else {
this.listQuery.reportTime = []
}
},
async getDict() {
this.$refs.lineChart.initChart()
// 线
// const res = await getCorePLList();
// this.proLineList = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
changeTime(val) {
if (val) {
// console.log(val)
// console.log(val.setHours(7, 0, 0))
// console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// let time = this.format(val.setHours(7, 0, 0))
this.endTimeStamp = this.format(val.setHours(7, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.startTimeStamp = this.format(val.setHours(7, 0, 1) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// console.log(this.listQuery.reportTime);
this.listQuery.reportTime[0] = this.format(val.setHours(7, 0, 1)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.listQuery.reportTime[1] = this.format(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
console.log(this.listQuery.reportTime);
} else {
this.listQuery.reportTime = []
}
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -0,0 +1,233 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-16 14:16:17
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" class="costChart" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
// import resize from './mixins/resize'
export default {
name: 'OverviewBar',
// mixins: [resize],
props: {
id: {
type: String,
default: 'OverviewLine'
},
// className: {
// type: String,
// default: 'epChart'
// },
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '35vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chartData: [
{
name: '产品1',
num: 1112,
yield: 0.97,
},
{
name: '产品2',
num: 1112,
yield: 0.97,
},
{
name: '产品3',
num: 1112,
yield: 0.97,
},
{
name: '产品4',
num: 1112,
yield: 0.97,
},
{
name: '产品5',
num: 1112,
yield: 0.97,
}
],
chart: null,
colors: ['rgba(113, 99, 254, 1)', 'rgba(39, 139, 255, 1)', 'rgba(100, 189, 255, 1)', 'rgba(143, 240, 170, 1)', 'rgba(246, 189, 22, 0.85)'],
}
},
mounted() {
this.initChart()
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
getEqualNewlineString(params, length) {
let text = ''
let count = Math.ceil(params.length / length) //
// length
if (count > 1) {
for (let z = 1; z <= count; z++) {
text += params.substr((z - 1) * length, length)
if (z < count) {
text += '\n'
}
}
} else {
text += params.substr(0, length)
}
return text
},
initChart() {
console.log(1111)
let num = 0
this.chartData && this.chartData.length > 0 && this.chartData.map(i => {
num += i.num
})
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose()
}
this.chart = echarts.init(document.getElementById(this.id))
this.chart.setOption({
color: this.colors,
title: {
text: num,
subtext: '总数/片',
top: '32%',
left: '49%',
textAlign: 'center',
textStyle: {
fontSize: 32,
color: 'rgba(140, 140, 140, 1)',
},
subtextStyle: {
fontSize: 20,
color: '#fff00',
},
},
legend: {
bottom: '2%',
left: 'center',
itemWidth: 12,
itemHeight: 12,
icon: 'roundRect',
textStyle: {
color: 'rgba(140, 140, 140, 1)'
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
itemStyle: {
color: this.colors[index % 4]
}
}))
},
series: [{
name: 'ISRA缺陷检测',
type: 'pie',
// position:outerHeight,
center: ['50%', '40%'],
radius: ['45%', '70%'],
avoidLabelOverlap: true,
label: {
show: true,
normal: {
alignTo: 'labelLine',
margin: 10,
edgeDistance: 10,
lineHeight: 16,
//
// params: data,
formatter: function (params) {
console.log(params);
return;
},
formatter: (params) => {
//
return this.getEqualNewlineString(params.value + " | " + params.percent.toFixed(0) + "%" + "\n" + params.name, 10);
},
textStyle: { //
// color: 'rgba(0, 0, 0, 0.65)',
fontSize: 18
}
}
},
labelLine: {
show: true,
length: 25,
length2: 100,
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
value: item.num,
label: {
color: this.colors[index % 4]
},
itemStyle: {
// color: {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// global: false,
// colorStops: [
// { offset: 0, color: this.colors[index % 4] },
// { offset: 1, color: this.colors[index % 4] + '33' }
// ]
// }
}
}))
}],
tooltip: {
trigger: 'item',
className: "isra-chart-tooltip"
},
})
}
}
}
</script>
<style scoped>
</style>