生产管理
This commit is contained in:
65
src/views/produce/workOrder/SmallTitle.vue
Normal file
65
src/views/produce/workOrder/SmallTitle.vue
Normal 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>
|
||||
399
src/views/produce/workOrder/add-or-updata.vue
Normal file
399
src/views/produce/workOrder/add-or-updata.vue
Normal file
@@ -0,0 +1,399 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-06 15:15:30
|
||||
* @LastEditTime: 2024-05-31 16:13:22
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer class="drawer" :visible.sync="visible" size="85%" @closed="$emit('destroy')">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
{{ '详情' }}
|
||||
<el-button type="primary" plain size="small" style="float: right" @click="exportDetail">导出</el-button>
|
||||
</small-title>
|
||||
<div ref="detail" class="detailBox">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
<p class="title">工单号</p>
|
||||
<p class="text">{{ dataForm.workOrderNumber }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">订单号</p>
|
||||
<p class="text">{{ dataForm.orderNumber }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">工单类型</p>
|
||||
<p class="text">{{ ['', '芯片订单', '组件类型', 'bipv类型'][dataForm.workOrderType] }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">工单来源</p>
|
||||
<p class="text">{{ ['', '手动', 'ERP'][dataForm.source] }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">工艺流程</p>
|
||||
<p class="text">{{ dataForm.process }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">BOM</p>
|
||||
<p class="text">{{ dataForm.bom }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">工单状态</p>
|
||||
<p class="text">{{ ['未开始', '生产中', '已完成'][dataForm.orderStatus] }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">投入状态</p>
|
||||
<p class="text">{{ dataForm.inStatus }}</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
<p class="title">计划投入量</p>
|
||||
<p class="text">{{ dataForm.plannedInvestment }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">目标产量</p>
|
||||
<p class="text">{{ dataForm.targetProduction }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">实际投入</p>
|
||||
<p class="text">{{ dataForm.actualInvestment }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">实际产出</p>
|
||||
<p class="text">{{ dataForm.actualProduction }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">创建时间</p>
|
||||
<p class="text">{{ parseTime(dataForm.createTime) }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">开始时间</p>
|
||||
<p class="text">{{ dataForm.startDate?.length > 0 ? dataForm.startDate[0] + '-' + dataForm.startDate[1] + '-' + dataForm.startDate[2] : '' }}</p>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<p class="title">完成时间</p>
|
||||
<p class="text">{{ dataForm.endDate?.length > 0 ? dataForm.endDate[0] + '-' + dataForm.endDate[1] + '-' + dataForm.endDate[2] : '' }}</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider></el-divider>
|
||||
<div class="chartDiv">
|
||||
<div ref="bar" :style="{ height: '30vh', width: '40vw' }" />
|
||||
<div ref="pie" :style="{ height: '30vh', width: '40vw' }" />
|
||||
</div>
|
||||
<div class="chartDiv">
|
||||
<div ref="equipmentLine" :style="{ height: '30vh', width: '40vw' }" />
|
||||
<div ref="line" v-show="dataForm.orderStatus === 1" :style="{ height: '30vh', width: '40vw' }" />
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import basicAdd from './basic-add';
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/mixins/resize'
|
||||
import { getWorkOrderDetail, getEqNum, getDailyTrend } from '@/api/produceData/order';
|
||||
import SmallTitle from './SmallTitle';
|
||||
import jsPDF from 'jspdf';
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SmallTitle,
|
||||
},
|
||||
mixins: [resize],
|
||||
props: {
|
||||
date: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lineChart: null,
|
||||
pieChart: null,
|
||||
barChart: null,
|
||||
equipmentLineChart: null,
|
||||
visible: false,
|
||||
dataForm: {}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
mounted() {
|
||||
// this.getCurrentTime()
|
||||
},
|
||||
methods: {
|
||||
exportDetail() {
|
||||
// 导出
|
||||
const pdf = new jsPDF('l', 'pt', 'a4');
|
||||
const options = {
|
||||
scale: 2
|
||||
};
|
||||
const element = this.$refs['detail'];
|
||||
|
||||
html2canvas(element, options).then((canvas) => {
|
||||
const imgData = canvas.toDataURL('image/png');
|
||||
pdf.addImage(imgData, 'PNG', 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight());
|
||||
pdf.save(this.dataForm.workOrderNumber + '详情.pdf');
|
||||
});
|
||||
},
|
||||
init(id) {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.initLineChart()
|
||||
})
|
||||
if (id) {
|
||||
getWorkOrderDetail(id).then(res => {
|
||||
this.dataForm = res.data
|
||||
this.buildChart(this.dataForm)
|
||||
if (this.dataForm.orderStatus === 1) {
|
||||
this.trend()
|
||||
}
|
||||
})
|
||||
getEqNum(id).then(response => {
|
||||
if (response.code === 0) {
|
||||
const xAxisList = Object.keys(response.data)
|
||||
const yAxisList = Object.values(response.data)
|
||||
this.initEqLineChart(xAxisList, yAxisList)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
trend() {
|
||||
// 趋势图
|
||||
getDailyTrend({ factory: this.dataForm.id }).then(trendRes => {
|
||||
if (trendRes?.data.length > 0) {
|
||||
const seriesList = []
|
||||
const dateList = []
|
||||
trendRes.data.forEach(element => {
|
||||
seriesList.push(element.actualProduction)
|
||||
dateList.push(element.recordTime[0] + '-' + element.recordTime[1] + '-' + element.recordTime[2])
|
||||
})
|
||||
this.initLineChart(dateList, seriesList)
|
||||
}
|
||||
})
|
||||
},
|
||||
buildChart(data) {
|
||||
// 生产明细
|
||||
const barList = [data.targetProduction, data.plannedInvestment, data.actualInvestment, data.actualProduction, data.wasteNum, data.reworkNum]
|
||||
this.initChart(barList)
|
||||
// 良品率
|
||||
const pieList = [
|
||||
{ value: data.actualProduction, name: '实际产出' },
|
||||
{ value: data.wasteNum, name: '废品数量' },
|
||||
{ value: data.reworkNum, name: '待再加工数量' }
|
||||
]
|
||||
this.initPieChart(pieList)
|
||||
},
|
||||
initChart(barData) {
|
||||
this.barChart = echarts.init(this.$refs['bar'])
|
||||
this.barChart.setOption({
|
||||
title: {
|
||||
text: '生产明细',
|
||||
left: 'center'
|
||||
// subtext: 'Fake Data'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
|
||||
calculable: true,
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: "1%",
|
||||
right: "3%",
|
||||
bottom: "1%",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['目标产量', '计划投入量', '实际投入', '实际产出', '废品数量', '待再加工数量'],
|
||||
axisLabel: {
|
||||
rotate:45
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: barData,
|
||||
type: 'bar',
|
||||
barWidth: '40%'
|
||||
}
|
||||
]
|
||||
}, true)
|
||||
},
|
||||
initPieChart(pieData) {
|
||||
this.pieChart = echarts.init(this.$refs['pie'])
|
||||
this.pieChart.setOption({
|
||||
title: {
|
||||
text: '产品良率',
|
||||
left: 'center'
|
||||
// subtext: 'Fake Data'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
top: '5%',
|
||||
left: 'right',
|
||||
orient: 'vertical'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['40%', '70%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: false,
|
||||
fontSize: 40,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: pieData
|
||||
}
|
||||
]
|
||||
}, true)
|
||||
},
|
||||
initEqLineChart(xAxisList, yAxisList) {
|
||||
this.equipmentLineChart = echarts.init(this.$refs['equipmentLine'])
|
||||
this.equipmentLineChart.setOption({
|
||||
title: {
|
||||
text: '在制品分布',
|
||||
left: 'center'
|
||||
// subtext: 'Fake Data'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
|
||||
calculable: true,
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: "1%",
|
||||
right: "3%",
|
||||
bottom: "1%",
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xAxisList,
|
||||
axisLabel: {
|
||||
rotate:45,
|
||||
// width: '10%'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yAxisList,
|
||||
type: 'bar',
|
||||
barWidth: '40px'
|
||||
}
|
||||
]
|
||||
}, true)
|
||||
},
|
||||
initLineChart(xAxisList, seriesList) {
|
||||
this.lineChart = echarts.init(this.$refs['line'])
|
||||
this.lineChart.setOption({
|
||||
title: {
|
||||
text: '历史趋势',
|
||||
left: 'center' // 设置标题居中
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xAxisList,
|
||||
axisLabel: {
|
||||
rotate:45
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: seriesList,
|
||||
type: 'line'
|
||||
}
|
||||
]
|
||||
}, 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);
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.chartDiv {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
padding-left: 30px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.detailBox {
|
||||
padding-top: 30px;
|
||||
width: 99%;
|
||||
}
|
||||
</style>
|
||||
320
src/views/produce/workOrder/index.vue
Normal file
320
src/views/produce/workOrder/index.vue
Normal file
@@ -0,0 +1,320 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-15 10:49:13
|
||||
* @LastEditTime: 2024-05-31 17:13:56
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
|
||||
<div class="app-container" style="margin-top: 8px;padding: 16px; height: auto;">
|
||||
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
||||
</div>
|
||||
<div class="app-container" style="margin-top: 8px;flex-grow: 1; height: auto; padding: 16px;">
|
||||
<search-bar :formConfigs="formConfig2" ref="searchBarForm" style="margin-bottom: 0" />
|
||||
<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>
|
||||
<pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList"
|
||||
/>
|
||||
</div>
|
||||
<add-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" :date="listQuery.date" @refreshDataList="successSubmit" @destroy="detailOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { parseTime } from '../../core/mixins/code-filter';
|
||||
import { getWorkOrderPage, exportExcel } from '@/api/produceData/order';
|
||||
// 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 { factoryList, factoryArray } from "@/utils/constants";
|
||||
|
||||
// import FileSaver from 'file-saver'
|
||||
// import * as XLSX from 'xlsx'
|
||||
export default {
|
||||
components: { lineChart, AddOrUpdate },
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
factoryList,
|
||||
factoryArray,
|
||||
listQuery: {
|
||||
pageSize: 20,
|
||||
pageNo: 1,
|
||||
factorys: undefined,
|
||||
total: 0,
|
||||
time: undefined,
|
||||
orderStatus:undefined
|
||||
},
|
||||
detailOrUpdateVisible:false,
|
||||
tableBtn: [
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
},
|
||||
// {
|
||||
// type: 'delete',
|
||||
// btnName: '删除',
|
||||
// },
|
||||
].filter((v) => v),
|
||||
typeList: [
|
||||
{
|
||||
name: '芯片',
|
||||
id: 0,
|
||||
},
|
||||
{
|
||||
name: '标准组件',
|
||||
id: 1,
|
||||
},
|
||||
{
|
||||
name: 'BIPV产品',
|
||||
id: 2,
|
||||
},
|
||||
],
|
||||
formConfig: [
|
||||
{
|
||||
type: "select",
|
||||
label: "工厂名称",
|
||||
selectOptions: factoryArray,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
param: "factory",
|
||||
multiple: true,
|
||||
filterable: true
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "工单状态",
|
||||
selectOptions: [
|
||||
{
|
||||
label: '未开始',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '生产中',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '已完成',
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
labelField: "label",
|
||||
valueField: "value",
|
||||
param: "orderStatus",
|
||||
multiple: true,
|
||||
filterable: true
|
||||
},
|
||||
{
|
||||
type: "datePicker",
|
||||
label: "时间段",
|
||||
dateType: "daterange",
|
||||
format: "yyyy-MM-dd",
|
||||
valueFormat: "yyyy-MM-dd",
|
||||
rangeSeparator: "-",
|
||||
startPlaceholder: "开始日期",
|
||||
endPlaceholder: "结束日期",
|
||||
param: "timeSlot",
|
||||
defaultSelect: [],
|
||||
defaultTime: ["00:00:00", "23:59:59"],
|
||||
width: 250,
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
btnName: "查询",
|
||||
name: "search",
|
||||
color: "primary",
|
||||
},
|
||||
{
|
||||
type: "separate",
|
||||
},
|
||||
{
|
||||
type: "button",
|
||||
btnName: "导出",
|
||||
name: "export",
|
||||
color: "primary",
|
||||
plain: true
|
||||
},
|
||||
],
|
||||
formConfig2: [
|
||||
{
|
||||
type: 'title',
|
||||
label: '工厂信息',
|
||||
},
|
||||
],
|
||||
formConfig1: [
|
||||
{
|
||||
type: 'title',
|
||||
label: '良品数量',
|
||||
},
|
||||
],
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'factory',
|
||||
label: '工厂名称',
|
||||
filter: (val) => factoryList[val],
|
||||
minWidth: 200,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'workOrderNumber',
|
||||
label: '工单号',
|
||||
// filter: (val) => ['玻璃芯片', '标准组件', 'BIPV', '定制组件'][val]
|
||||
},
|
||||
{
|
||||
prop: 'workOrderType',
|
||||
label: '工单类型',
|
||||
filter: (val) => ['', '芯片订单', '组件类型', 'bipv类型'][val],
|
||||
},
|
||||
{
|
||||
prop: 'plannedInvestment',
|
||||
label: '计划投入',
|
||||
},
|
||||
{
|
||||
prop: 'actualInvestment',
|
||||
label: '实际投入',
|
||||
},
|
||||
{
|
||||
prop: 'targetProduction',
|
||||
label: '目标产量',
|
||||
},
|
||||
{
|
||||
prop: 'actualProduction',
|
||||
label: '实际产量',
|
||||
},
|
||||
{
|
||||
prop: 'productionProgress',
|
||||
label: '生产进度',
|
||||
filter: (val) => (val * 100) + '%'
|
||||
},
|
||||
{
|
||||
prop: 'orderStatus',
|
||||
label: '工单状态',
|
||||
filter: (val) => ['未开始', '生产中', '已完成'][val],
|
||||
},
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: '开始时间',
|
||||
minWidth: 100,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'endTime',
|
||||
label: '完成时间',
|
||||
minWidth: 100,
|
||||
showOverflowtooltip: true
|
||||
}
|
||||
],
|
||||
tableData: [],
|
||||
xAxis: [],
|
||||
lineData: {}
|
||||
// proLineList: [],
|
||||
// all: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
const today = new Date()
|
||||
const sevenDaysAgo = new Date(today.getTime() - (7 * 24 * 60 * 60 * 1000))
|
||||
this.listQuery.time = [moment(sevenDaysAgo).format('yyyy-MM-DD'), moment(today).format('yyyy-MM-DD')]
|
||||
this.formConfig[2].defaultSelect = this.listQuery.time
|
||||
},
|
||||
methods: {
|
||||
otherMethods(val) {
|
||||
this.detailOrUpdateVisible = true;
|
||||
// this.addOrEditTitle = "详情";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.detailOrUpdate.init(val.data.id);
|
||||
});
|
||||
},
|
||||
async getDataList() {
|
||||
const res = await getWorkOrderPage(this.listQuery)
|
||||
this.tableData = res.data.list
|
||||
this.listQuery.total = res.data.total
|
||||
if (this.listQuery.total > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
item.startTime = item.startDate ? item.startDate[0] + '-' + item.startDate[1] + '-' + item.startDate[2] : '--'
|
||||
item.endTime = item.endDate ? item.endDate[0] + '-' + item.endDate[1] + '-' + item.endDate[2] : '--'
|
||||
})
|
||||
}
|
||||
},
|
||||
buttonClick(val) {
|
||||
this.listQuery.factorys = val.factory?.length > 0 ? val.factory : undefined
|
||||
this.listQuery.orderStatus = val.orderStatus?.length > 0 ? val.orderStatus : undefined
|
||||
this.listQuery.time = val.timeSlot?.length > 0 ? val.timeSlot : undefined
|
||||
switch (val.btnName) {
|
||||
case 'search':
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 20;
|
||||
if (this.listQuery.time) {
|
||||
this.getDataList();
|
||||
} else {
|
||||
this.$message.warning('请选择时间范围!')
|
||||
}
|
||||
break;
|
||||
case 'export':
|
||||
if (this.listQuery.time) {
|
||||
this.handleExport();
|
||||
} else {
|
||||
this.$message.warning('请选择时间范围!')
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.$modal.confirm('是否确认导出工单数据?').then(() => {
|
||||
// 处理查询参数
|
||||
// let params = {...this.listQuery};
|
||||
// params.current = 1;
|
||||
// params.size = 999;
|
||||
this.exportLoading = true;
|
||||
return exportExcel({
|
||||
factorys: this.listQuery.factorys,
|
||||
orderStatus: this.listQuery.orderStatus,
|
||||
time: this.listQuery.time
|
||||
});
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '工单数据.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<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 0px 0;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 16px 16px 0;
|
||||
height: calc(100vh - 134px);
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
169
src/views/produce/workOrder/lineChart.vue
Normal file
169
src/views/produce/workOrder/lineChart.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2022-01-21 14:43:06
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2024-05-30 09:51:16
|
||||
* @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: 'LineChart',
|
||||
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(xAxis, seriesList) {
|
||||
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: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: "1%",
|
||||
right: "3%",
|
||||
bottom: "1%",
|
||||
containLabel: true
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Email',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name: 'Union Ads',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
name: 'Video Ads',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
name: 'Direct',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
name: 'Search Engine',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
}, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* .reportChart {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 10px;
|
||||
} */
|
||||
</style>
|
||||
Reference in New Issue
Block a user