2024-09-09 修改了大部分下拉组件为模糊筛选,减轻前端渲染压力

This commit is contained in:
2024-09-09 15:26:17 +08:00
parent fe5d3b70df
commit 563132273c
717 changed files with 107188 additions and 138520 deletions

View File

@@ -0,0 +1,249 @@
<template>
<div>
<el-card style="height: 880px">
<!--<el-checkbox v-model="selectionStatus" style="margin-bottom: 80px; margin-left: 500px;margin-top: 20px" @change="searchData();disAble()">按设备</el-checkbox>-->
<!-- <span></span>-->
<!-- <el-select v-if="trigGer" v-model="MachineValue" filterable size="small" disabled style="width:160px;margin-bottom:90px; margin-top: 20px" placeholder="工位号"/>-->
<el-select v-model="MachineValue" filterable size="small" style="width:160px;margin-bottom:90px; margin-top: 20px;margin-left: 500px" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<span style="font-size: 13px;color: black">查询时间</span>
<span>选择日期</span>
<el-date-picker
v-model="daterange"
size="small"
type="date"
style="width: 160px"
placeholder="选择日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"/>
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px; margin-top: 20px" @click="searchData()">查询</el-button>
<!-- <el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px" @click="equipmentSearch()">总设备查询</el-button>-->
<div id="myChart1" style="width: 1620px; height: 520px; margin: auto"/>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
// date1: '',
// date2: '',
MachineValue: '',
Machine: [],
colors: [],
state: [],
table1: [],
table: [],
OptationValue: '',
Optation: [],
opName: '',
daterange: '',
Xdata: [],
Ydata: [],
Ydata1: [],
kaiji: [],
guanji: [],
gongzuo: [],
num: 0,
trigGer: true,
stationNumber: true,
selectionStatus: false
// checked: true
}
},
// watch: {
// selectionStatus() {
// this.searchData()
// }
// },
created() {
this.fetchData()
// this.getCurrentTime()
// this.searchData()
// this.$nextTick(function() {
// this.fetchData()
// this.getCurrentTime()
// this.searchData()
// })
},
methods: {
fetchData() {
var param = []
var Data = this.CreateData('11', '车间生产管理工艺_加工顺序调整_查询工位及人员', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].设备名称
})
}
})
},
/* getCurrentTime() {
this.dateRange[0] = this.getTime0(-10)
this.dateRange[1] = this.getTime0(0)
},
getTime0(num) {
var date0 = new Date()
var date = new Date(date0.getTime() + num * 24 * 60 * 60 * 1000)
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},*/
/* disAble() {
if (this.selectionStatus === false) {
this.stationNumber = true
} else {
this.stationNumber = false
}
},*/
searchData() {
if (!this.daterange) {
this.$message.warning('请选择日期')
} else {
this.Xdata = []
this.Ydata = []
this.Ydata1 = []
var param = []
param[0] = ['工位号', this.MachineValue]
param[1] = ['开始时间', this.daterange]
var Data = this.CreateData('11', 'MES_电流数据查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Xdata[i] = response.data[i].采集时间
this.Ydata[i] = response.data[i].电流
this.Ydata1[i] = Number(response.data[i].状态代码)
}
}).then(response => {
this.drawLine1()
})
}
},
drawLine1() {
// 基于准备好的dom初始化echarts实例
const myChart1 = this.$echarts.init(document.getElementById('myChart1'))
myChart1.setOption({
title: {
textStyle: {
color: 'black',
fontSize: 16
}
},
tooltip: {
trigger: 'axis'
},
grid: {
top: '20%',
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
legend: {
data: this.Ydata
},
xAxis: {
type: 'category',
data: this.Xdata,
axisLine: { // 设置轴线的配置
lineStyle: { // 轴线的线条颜色
color: 'black'
}
}
},
yAxis: [{
name: '电流值',
type: 'value',
position: 'right',
axisLine: { // 设置轴线的配置
lineStyle: { // 轴线的线条颜色
color: 'black'
}
}
},
{
name: '状态',
type: 'value',
position: 'left',
axisLine: { // 设置轴线的配置
lineStyle: { // 轴线的线条颜色
color: 'black'
}
},
axisLabel: {
formatter: function(value) {
var texts = []
if (value === 1) {
texts.push('关机')
} else if (value === 2) {
texts.push('开机')
} else if (value === 3) {
texts.push('运行')
}
return texts
}
}
}],
series: [{
name: '电流值',
data: this.Ydata,
type: 'line',
itemStyle: { // 折线的样式设置
normal: {
lineStyle: { // 折线线条的设置
color: 'blcak'
}
}
}
}, {
name: '状态',
data: this.Ydata1,
type: 'line',
yAxisIndex: 1,
itemStyle: { // 折线的样式设置
normal: {
lineStyle: { // 折线线条的设置
color: 'red'
}
}
}
}]
// ,
// dataZoom: [
// {
// show: true,
// type: 'inside',
// start: 0,
// end: 100
// }
// ]
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,189 @@
<template>
<div class="app-container">
<el-card>
<div style="margin-top: 7px; margin-bottom: 7px">
<el-select v-model="MachineValue" filterable size="small" style="width:160px" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value"
@change="searchTable()">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<span style="font-size: 13px;color: black">日期</span>
<el-date-picker
v-model="dateRange"
size="small"
type="daterange"
align="center"
style="width: 240px;"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="searchTable()"/>
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>
</div>
<el-table v-loading="loading" :data="tableData" highlight-current-row border stripe size="small" style="width: 1091px" height="750" @sort-change="sortChange">
<el-table-column :width="setColumnWidth('物料编号')" label="工位号" prop="工位" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.工位 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="设备名称" prop="设备" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.设备 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="工作时长" prop="生产H" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.生产h }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="关机时长" prop="关机H" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.关机h }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="报警时长" prop="报警H" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.报警h }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="空闲时长" prop="空闲H" align="center" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.空闲h }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="有用电量" align="center">
<template slot-scope="scope">
{{ scope.row.有功电量 }}
</template>
</el-table-column>
<el-table-column label="无用电量" align="center">
<template slot-scope="scope">
{{ scope.row.无功电量 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
MachineValue: '',
Machine: [],
dateRange: '', // 提交日期
loading: false, // 数据加载
total: 0, // 分页总数
tableData: [],
pageCurrent: 1, // 分页当前页
pageSize: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
},
methods: {
// fetchData() {
// this.getCustomer()
// },
fetchData() {
var param = []
var Data = this.CreateData('11', '车间生产管理工艺_加工顺序调整_查询工位及人员', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].设备名称
})
}
})
},
searchTable() {
let MachineValue_check, dateRange_check
this.MachineValue ? MachineValue_check = 1 : MachineValue_check = 0
this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
var param = []
param[0] = ['排序名称', this.orderName]
param[1] = ['排序方式', this.order]
param[2] = ['开始时间', this.dateRange[0]]
param[3] = ['结束时间', this.dateRange[1]]
param[4] = ['时间_check', dateRange_check]
param[5] = ['工位号_check', MachineValue_check]
param[6] = ['工位号', this.MachineValue]
if (this.dateRange[0] === undefined || this.dateRange[1] === undefined) {
this.$message.error('请选择时间')
} else {
var Data = this.CreateData('11', '设备管理_设备能耗统计_查询数据', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
console.log(this.tableData)
this.total = response.data.total
// console.log(response.data, '刘浩')
})
}
},
// sortChange(column) {
// if (column.prop === '状态') {
// this.orderName = 1
// }
// if (column.order === 'ascending') {
// this.order = 1
// } else if (column.order === 'descending') { this.order = 2 } else {
// this.order = ''
// }
// this.searchTable()
// },
sortChange(column) {
if (column.prop === '生产H') {
this.orderName = 1
} else if (column.prop === '关机H') {
this.orderName = 2
} else if (column.prop === '报警H') {
this.orderName = 3
} else if (column.prop === '空闲H') {
this.orderName = 4
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable1()
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,382 @@
<template>
<div class="app-container">
<el-card style="height: 850px">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-input v-model="equipmentName" placeholder="设备名称" size="small" clearable style="width:200px;margin-left: 0px"/>
<el-input v-model="opName" placeholder="工位" size="small" clearable style="width:200px;margin-left: 0px"/>
<el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 20px" plain @click="pageSize = 20;pageCurrent = 1;searchTable()">查询</el-button>
<el-tooltip effect="dark" content="添加新设备" placement="top">
<el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="ADD()">设备</el-button>
</el-tooltip>
</div>
<div>
<el-table :data="tableData" border size="small" stripe highlight-current-row height="740px" style="width: 1048px">
<el-table-column label="设备名称" prop="设备名称" align="center" width="150px" >
<template slot-scope="scope">
{{ scope.row.设备名称 }}
</template>
</el-table-column>
<el-table-column label="设备型号" rop="设备型号" align="center" width="150px" >
<template slot-scope="scope">
{{ scope.row.设备型号 }}
</template>
</el-table-column>
<el-table-column label="加工工艺" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.加工工艺 }}
</template>
</el-table-column>
<el-table-column label="工位" align="center" width="80px">
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<el-table-column label="工时单价(元/小时)" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.工时单价 }}
</template>
</el-table-column>
<el-table-column label="月设备加工能力" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.月设备加工能力 }}
</template>
</el-table-column>
<el-table-column label="点检类型名称" align="center" width="137px">
<template slot-scope="scope">
{{ scope.row.点检表类型名称 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" style="margin-right:10px" @click="handleEdit(scope.row)"/>
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>
</div>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-card>
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span = "12">
<el-form-item label="设备名称" prop="设备名称" >
<el-input v-model="form.设备名称" placeholder="设备名称" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="设备型号" prop="设备型号" >
<el-input v-model="form.设备型号" placeholder="设备型号" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span = "12">
<el-form-item label="加工工艺" prop="加工工艺" >
<el-select v-model="form.加工工艺" placeholder="加工工艺" filterable size="small" style="width:200px" clearable >
<el-option
v-for="item in process"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="工位号" prop="工位号" >
<el-input v-model="form.工位号" placeholder="工位号" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span = "12">
<el-form-item label="工时单价" prop="工时单价" >
<el-input v-positive="'float'" v-model="form.工时单价" class="工时单价" size="small" style="width:200px" placeholder="工时单价" type="number"/>
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="月设备加工能力" prop="月设备加工能力" >
<el-input v-positive="'float'" v-model="form.月设备加工能力" class="工时单价" size="small" style="width:200px" placeholder="月设备加工能力" type="number"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span = "12">
<el-form-item label="点检类型" prop="点检类型" >
<el-select v-model="form.点检类型" placeholder="选择点检类型" filterable size="small" style="width:200px" clearable >
<el-option
v-for="item in routineCheckType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button v-show="title==='新增设备'" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑设备'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
routineCheckType: [],
dialogFormVisible: false,
title: '',
equipmentValue: '',
equipmentName: '',
opName: '',
process: [],
form: {
设备名称: '',
设备型号: '',
加工工艺: '',
工位号: '',
点检类型: '',
工时单价: '',
月设备加工能力: ''
},
rules: {
设备名称: [{ required: true, message: '请输入设备名称' }],
// 设备型号: [{ required: true, message: '请输入设备型号' }],
// 加工工艺: [{ required: true, message: '请选择加工工艺' }],
工位号: [{ required: true, message: '请输入工位号' }]
},
original: '',
total: 0, // 分页总数
tableData: [], // 设备信息表
pageCurrent: 1, // 分页当前页
pageSize: 20 // 分页每页显示条数
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.searchTable()
this.getProcess()
this.getRoutineCheckType()
},
methods: {
getRoutineCheckType() {
var param = []
var Data = this.CreateData('11', '点检类型_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.routineCheckType.push({
label: response.data[i].点检表类型名称,
value: response.data[i].点检表类型流水号
})
}
})
},
getProcess() {
var param = []
var Data = this.CreateData('11', '工艺名称_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.process.push({
label: response.data[i].工艺名称,
value: response.data[i].工艺编号
})
}
})
},
searchTable() {
let equipmentName_check, opName_check
this.equipmentName ? equipmentName_check = 1 : equipmentName_check = 0
this.opName ? opName_check = 1 : opName_check = 0
var param = []
param[0] = ['设备名称_check', equipmentName_check]
param[1] = ['设备名称', this.equipmentName]
param[2] = ['工位_check', opName_check]
param[3] = ['工位', this.opName]
var Data = this.CreateData('11', '设备管理_设备信息_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
console.log('设备管理查询你', response.data.rows)
})
},
ADD() {
this.title = '新增设备'
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.设备名称 = ''
this.form.设备型号 = ''
this.form.加工工艺 = ''
this.form.工位号 = ''
this.form.月设备加工能力 = ''
this.form.点检类型 = 1
this.form.工时单价 = ''
this.dialogFormVisible = true
},
handleEdit(row) {
this.title = '编辑设备'
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.equipmentValue = row.设备流水号
this.form.设备名称 = row.设备名称
this.form.设备型号 = row.设备型号
this.form.加工工艺 = Number(row.工艺编号)
this.form.工位号 = row.工位号
this.original = row.工位号
this.form.点检类型 = Number(row.点检表类型)
this.form.月设备加工能力 = row.月设备加工能力
this.form.工时单价 = row.工时单价
this.dialogFormVisible = true
},
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
param[0] = ['工位', this.form.工位号]
var Data = this.CreateData('11', '设备管理_设备信息_验证工位号是否重复', param)
this.ExecDatabase(Data).then(response => {
if (Number(response.data[0].Column1) === 0) {
var param = []
param[0] = ['设备名称', this.form.设备名称]
param[1] = ['设备型号', this.form.设备型号]
param[2] = ['加工工艺', this.form.加工工艺]
param[3] = ['工位', this.form.工位号]
param[4] = ['工时单价', this.form.工时单价]
param[5] = ['月设备加工能力', this.form.月设备加工能力]
param[6] = ['点检类型', this.form.点检类型]
var Data = this.CreateData('12', '设备管理_设备信息_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('添加失败')
}
})
} else {
this.$message.warning('工位号重复')
}
})
}
})
},
submitEdit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.form.工位号 === this.original) {
var param = []
param[0] = ['设备名称', this.form.设备名称]
param[1] = ['设备型号', this.form.设备型号]
param[2] = ['加工工艺', this.form.加工工艺]
param[3] = ['工位', this.form.工位号]
param[4] = ['工时单价', this.form.工时单价]
param[5] = ['月设备加工能力', this.form.月设备加工能力]
param[6] = ['设备流水号', this.equipmentValue]
param[7] = ['原工位', this.original]
param[8] = ['点检类型', this.form.点检类型]
var Data = this.CreateData('12', '设备管理_设备信息_编辑', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('编辑失败')
}
})
} else {
var param1 = []
param1[0] = ['工位', this.form.工位号]
var Data1 = this.CreateData('11', '设备管理_设备信息_验证工位号是否重复', param1)
this.ExecDatabase(Data1).then(response => {
if (Number(response.data[0].Column1) === 0) {
var param = []
param[0] = ['设备名称', this.form.设备名称]
param[1] = ['设备型号', this.form.设备型号]
param[2] = ['加工工艺', this.form.加工工艺]
param[3] = ['工位', this.form.工位号]
param[4] = ['工时单价', this.form.工时单价]
param[5] = ['月设备加工能力', this.form.月设备加工能力]
param[6] = ['设备流水号', this.equipmentValue]
param[7] = ['原工位', this.original]
var Data = this.CreateData('12', '设备管理_设备信息_编辑', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('编辑失败')
}
})
} else {
this.$message.warning('工位号重复')
}
})
}
}
})
},
handleDelete(row) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['设备流水号', row.设备流水号]
var Data = this.CreateData('12', '设备管理_设备信息_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.pageCurrent = 1
this.searchTable()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>

View File

@@ -0,0 +1,408 @@
<template>
<div class="app-container">
<el-card style="height: 850px">
<el-col :span="4.5" style="margin: 7px 0">
<el-button type="shengcheng" size="small" icon="el-icon-circle-plus-outline" @click="editType('form')">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-edit-outline" style="margin-left: 10px" @click="editType1('form')">编辑</el-button>
<el-button type="danger" size="small" icon="el-icon-delete" style="margin-left: 10px" @click="deleteCheckType()">删除</el-button>
<el-table v-loading="loading" :data="tableData" height="760" highlight-current-row style="margin-top: 5px;width: 100%;" border element-loading-text="拼命加载中" @row-click="rowClick">
<el-table-column label="维护检点类型" align="center" min-width="200px" fixed="left">
<template slot-scope="scope">
<span>{{ scope.row.点检表类型名称 }}</span>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="8" style="margin: 7px 0 7px 20px">
<el-button type="success" size="small" plain @click="dailyCheck()">日检</el-button>
<el-button type="primary" size="small" plain @click="monthlyCheck()">月检</el-button>
<el-button type="warning" size="small" plain @click="yearlyCheck()">年检</el-button>
<el-button type="shengcheng" size="small" icon="el-icon-circle-plus-outline" @click="addContent()">新增内容</el-button>
<el-table v-loading="loading1" :data="tableData1" :header-cell-style="{background: '#2283D4',color: 'white'}" height="760" highlight-current-row style="margin-top: 5px;width: 100%;" border element-loading-text="拼命加载中">
<el-table-column label="序号" type="index" align="center" width="60px"/>
<el-table-column label="检测内容" align="center" min-width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.保养项目" style="width:97%;margin-right:3px" clearable size="mini" />
</template>
<span v-else>{{ scope.row.保养项目 }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="50px">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="text" size="mini" icon="el-icon-circle-check-outline" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-if="scope.row.edit" class="cancel-btn" size="mini" type="text" @click="cancelEdit(scope.$index, scope.row)">取消</el-button>
<el-button v-else type="text" size="mini" icon="el-icon-edit-outline" @click="scope.row.edit=!scope.row.edit"/>
<el-button v-if="!scope.row.edit" type="text" size="mini" icon="el-icon-delete" @click="detectionContentDeletion(scope.row)"/>
</template>
</el-table-column>
</el-table>
</el-col>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center width="20%">
<el-form ref="form" :model="form" :rules="rules" label-position="left" class="demo-ruleForm" label-width="120px" style="width: 90%;margin: auto">
<el-form-item label="维护检点类型" prop="production">
<el-input v-model="form.production" size="small" style="width: 90%" clearable placeholder="请输入维护检点类型"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff('form')">取消</el-button>
<el-button size="small" type="primary" @click="submit('form')"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title1" :visible.sync="dialogFormVisible1" center width="20%">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" class="demo-ruleForm" label-width="120px" style="width: 90%;margin: auto">
<!-- <el-form-item label="供应商代码" prop="supplierId">-->
<!-- <el-input v-model="form.supplierId" size="small" style="width: 75%" clearable placeholder="请输入供应商代码"/>-->
<!-- </el-form-item>-->
<el-form-item label="维护检点类型" prop="production">
<el-input v-model="form1.production" size="small" style="width: 90%" clearable placeholder="请输入维护检点类型"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff1('form1')">取消</el-button>
<el-button size="small" type="primary" @click="submit1('form1')"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
radio: '0',
title: '',
maintenanceCycle: '',
dialogFormVisible: false,
form: {
production: ''
},
rules: {
production: [{ required: true, message: '请输入维护检点类型', trigger: 'blur' }]
// 这里面写的是表单验证 即 可以规定 输入框不可以为空或者其输入框的输入类型的格式要求
},
title1: '',
dialogFormVisible1: false,
form1: {
production: ''
},
rules1: {
production: [{ required: true, message: '请输入维护检点类型', trigger: 'blur' }]
// 这里面写的是表单验证 即 可以规定 输入框不可以为空或者其输入框的输入类型的格式要求
},
selectRow: '',
selectRow1: '',
loading: false, // 数据加载
loading1: false, // 数据加载
tableData: [], // 合同信息表
tableData1: [], // 合同信息表
pageCurrent: 1, // 分页当前页
pageSize: 100 // 分页每页显示条数
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.searchTable()
},
methods: {
searchTable() {
this.tableData = []
const param = []
const Data = this.CreateData('11', '基础数据_点检类型名称_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableData = response.data
}
this.loading = false
})
},
rowClick(row) {
this.selectRow = row.点检表类型流水号
this.selectRow1 = row.点检表类型名称
console.log('lixina12', this.selectRow1)
this.radio = '1'
this.dailyCheck()
},
addContent() {
if (!this.selectRow) {
this.$message.warning('请先选择点检类型')
return
}
if (!this.maintenanceCycle) {
this.$message.warning('请先选择保养周期')
return
}
const param = []
param[0] = ['点检表类型流水号', this.selectRow]
param[1] = ['保养周期', this.maintenanceCycle]
const Data = this.CreateData('12', '基础数据_保养项目_新增', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('新增成功')
this.testContent()
} else {
this.$message.error('新增失败')
}
})
},
testContent() {
this.tableData1 = []
const param = []
param[0] = ['点检表类型流水号', this.selectRow]
param[1] = ['保养周期', this.maintenanceCycle]
const Data = this.CreateData('11', '基础数据_保养项目_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
// this.tableData1 = response.data
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
// 表示将从数据库中查询到的数据,分别对应填充到表格中
保养项目: response.data[i].保养项目,
保养周期: response.data[i].保养周期,
点检任务编号: response.data[i].点检任务编号,
保养项目_before: response.data[i].保养项目,
edit: false
})
}
}
this.loading = false
})
},
dailyCheck() {
this.maintenanceCycle = 1
this.tableData1 = []
const param = []
param[0] = ['点检表类型流水号', this.selectRow]
const Data = this.CreateData('11', '基础数据_保养项目_日检查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
// 表示将从数据库中查询到的数据,分别对应填充到表格中
保养项目: response.data[i].保养项目,
保养周期: response.data[i].保养周期,
点检任务编号: response.data[i].点检任务编号,
保养项目_before: response.data[i].保养项目,
edit: false
})
}
}
this.loading = false
})
},
monthlyCheck() {
this.maintenanceCycle = 30
this.tableData1 = []
const param = []
param[0] = ['点检表类型流水号', this.selectRow]
const Data = this.CreateData('11', '基础数据_保养项目_月检查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
// 表示将从数据库中查询到的数据,分别对应填充到表格中
保养项目: response.data[i].保养项目,
保养周期: response.data[i].保养周期,
点检任务编号: response.data[i].点检任务编号,
保养项目_before: response.data[i].保养项目,
edit: false
})
}
}
this.loading = false
})
},
yearlyCheck() {
this.maintenanceCycle = 365
this.tableData1 = []
const param = []
param[0] = ['点检表类型流水号', this.selectRow]
const Data = this.CreateData('11', '基础数据_保养项目_年检查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
// 表示将从数据库中查询到的数据,分别对应填充到表格中
保养项目: response.data[i].保养项目,
保养周期: response.data[i].保养周期,
点检任务编号: response.data[i].点检任务编号,
保养项目_before: response.data[i].保养项目,
edit: false
})
}
}
this.loading = false
})
},
cancelEdit(index, row) {
row.edit = false
row.保养项目 = this.tableData1[index].保养项目_before
this.$message('取消修改')
},
// 确定编辑
confirmEdit(row) {
this.tableData1 = []
var param = []
param[0] = ['保养项目', row.保养项目]
param[1] = ['点检任务编号', row.点检任务编号]
if (row.保养项目 === '' || row.保养项目 === null) {
this.$message.error('请输入保养项目')
} else {
var Data = this.CreateData('12', '基础数据_保养项目_编辑', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message({
message: '信息编辑成功',
type: 'success'
})
this.testContent()
} else {
this.$message.error('信息编辑失败')
}
})
}
},
detectionContentDeletion(row) {
this.$confirm('此操作将永久删除该检测内容, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.tableData1 = []
var param = []
param[0] = ['点检任务编号', row.点检任务编号]
var Data = this.CreateData('12', '基础数据_保养项目_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.testContent()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 增加取消
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
// param[0] = ['供应商代码', this.form.supplierId]
param[0] = ['点检表类型名称', this.form.production]
var Data = this.CreateData('12', '基础数据_点检类型名称_新增', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message({
message: '信息增加成功',
type: 'success'
})
this.searchTable()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible = false
} else {
return false
}
})
},
editType(formName) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = '新增维护检点类型'
this.dialogFormVisible = true
},
editType1() {
if (this.selectRow1 !== '' && this.selectRow1 !== null) {
this.title1 = '修改维护检点类型'
this.dialogFormVisible1 = true
this.form1.production = this.selectRow1
} else {
this.$message.error('请点击想要修改的维护检点类型')
}
},
callOff1(formName) {
this.dialogFormVisible1 = false
this.$refs[formName].resetFields()
},
deleteCheckType(row) {
this.$confirm('此操作将永久删除该维护检点类型, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['点检表类型流水号', this.selectRow]
var Data = this.CreateData('12', '基础数据_点检类型名称_删除', param)
this.ExecDatabase(Data).then(response => {
console.log(response.data)
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable()
} else if (response.data[0].结果 === 2) {
this.$message.error('删除失败!请先删除该维护检点类型的检测内容!')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
// param[0] = ['供应商代码', this.form.supplierId]
param[0] = ['点检表类型名称', this.form1.production]
param[1] = ['点检表类型流水号', this.selectRow]
var Data = this.CreateData('12', '基础数据_点检类型名称_修改', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message({
message: '信息修改成功',
type: 'success'
})
this.searchTable()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible1 = false
} else {
return false
}
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>

View File

@@ -0,0 +1,183 @@
<template>
<div class="app-container">
<el-card>
<div style="margin-top: 7px; margin-bottom: 7px">
<span style="font-size: 13px;color: black">日期</span>
<el-date-picker
v-model="dateRange"
size="small"
type="daterange"
align="center"
style="width: 240px;"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="searchTable()"/>
</div>
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
stripe
size="small"
style="width: 771px"
height="748"
@sort-change="sortChange">
<el-table-column
:width="setColumnWidth('物料编号')"
label="工位号"
align="center"
prop="状态"
sortable="custom"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<el-table-column
:width="setColumnWidth('加工设备')"
label="设备名称"
align="center"
sortable="custom"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.设备名称 }}
</template>
</el-table-column>
<el-table-column
:width="setColumnWidth('加工设备')"
label="工作时长"
align="center"
sortable="custom"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.工作时长 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="关机时长" align="center" sortable="custom">
<template slot-scope="scope">
{{ scope.row.关机时长 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="报警时长" align="center" sortable="custom">
<template slot-scope="scope">
{{ scope.row.报警时长 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('加工设备')" label="空闲时长H" sortable="custom" align="center">
<template slot-scope="scope">
{{ scope.row.空闲时长 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
customerNameValue: '', // 买方名称
customerName: [], // 买方名称数组
dateRange: '', // 提交日期
contractStateValue: '', // 合同状态
contractState: [
{
value: 2,
label: '未提交'
}, {
value: 1,
label: '提交'
}
], // 合同状态数组
loading: false, // 数据加载
total: 0, // 分页总数
tableData: [], // 合同信息表
pageCurrent: 1, // 分页当前页
pageSize: 100, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.getCustomer('')
},
getCustomer(query) {
this.customerName = []
var param = []
param[0] = ['客户名称', query]
var Data = this.CreateData('11', '合同管理_客户信息_查询数据_bak', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.customerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
searchTable() {
var param = []
param[0] = ['排序名称', this.orderName]
param[1] = ['排序方式', this.order]
param[2] = ['开始时间', this.dateRange[0]]
param[3] = ['结束时间', this.dateRange[1]]
var Data = this.CreateData('11', '设备管理_设备状态统计_查询数据', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.tableData.push({
工位号: response.data[i].工位号,
设备名称: response.data[i].设备名称,
工作时长: response.data[i].工作时长,
关机时长: response.data[i].关机时长,
报警时长: response.data[i].报警时长,
空闲时长: response.data[i].空闲时长,
edit: false
})
}
this.tableData = response.data.rows
this.total = response.data.total
})
},
sortChange(column) {
if (column.prop === '工位号') {
this.orderName = 1
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') {
this.order = 2
} else {
this.order = ''
}
this.searchTable()
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>

View File

@@ -0,0 +1,423 @@
<template>
<div>
<el-card style="height: 880px">
<!--<el-checkbox v-model="selectionStatus" style="margin-bottom: 80px; margin-left: 500px;margin-top: 20px" @change="searchData();disAble()">按设备</el-checkbox>-->
<!-- <span></span>-->
<!-- <el-select v-if="trigGer" v-model="MachineValue" filterable size="small" disabled style="width:160px;margin-bottom:90px; margin-top: 20px" placeholder="工位号"/>-->
<el-select v-model="MachineValue" filterable size="small" style="width:160px;margin-bottom:90px; margin-top: 20px;margin-left: 500px" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<span style="font-size: 13px;color: black">查询时间</span>
<el-date-picker
v-model="dateRange"
size="small"
type="daterange"
align="center"
style="width: 240px; margin-top: 20px"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px; margin-top: 20px" @click="searchData()">查询</el-button>
<!-- <el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px" @click="equipmentSearch()">总设备查询</el-button>-->
<div id="myChart1" style="width: 1620px; height: 520px; margin: auto"/>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
dateRange: [
],
// date1: '',
// date2: '',
MachineValue: '',
Machine: [],
colors: [],
state: [],
table1: [],
table: [],
num: 0,
trigGer: true,
stationNumber: true,
selectionStatus: false
// checked: true
}
},
watch: {
selectionStatus() {
this.searchData()
}
},
created() {
this.fetchData()
this.getCurrentTime()
this.searchData()
// this.$nextTick(function() {
// this.fetchData()
// this.getCurrentTime()
// this.searchData()
// })
},
methods: {
fetchData() {
var param = []
var Data = this.CreateData('11', '车间生产管理工艺_加工顺序调整_查询工位及人员', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].设备名称
})
}
})
},
getCurrentTime() {
this.dateRange[0] = this.getTime0(-10)
this.dateRange[1] = this.getTime0(0)
},
getTime0(num) {
var date0 = new Date()
var date = new Date(date0.getTime() + num * 24 * 60 * 60 * 1000)
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},
/* disAble() {
if (this.selectionStatus === false) {
this.stationNumber = true
} else {
this.stationNumber = false
}
},*/
searchData() {
if (this.dateRange[0] === null || this.dateRange[1] === null) {
this.$message.warning('请选择开始时间或结束时间')
} else {
console.log('李显523')
console.log(this.dateRange[0], this.dateRange[1])
this.num = ((new Date(this.dateRange[1]) - new Date(this.dateRange[0])) / (1000 * 60 * 60 * 24)) + 1
var param = []
var Data = this.CreateData('11', 'MES_机加工MES_设备状态查询_初始化', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.colors.push(response.data[i].颜色)
this.state.push(response.data[i].状态)
}
})
var param2 = []
param2[0] = ['工位号', this.MachineValue]
param2[1] = ['开始时间', this.dateRange[0]]
param2[2] = ['结束时间', this.dateRange[1]]
var Data2 = this.CreateData('11', '车间生产管理_设备运行情况_查询数据_状态分布图_新', param2)
this.ExecDatabase(Data2).then(response => {
console.log('李显521')
console.log(this.MachineValue)
console.log(this.dateRange[0])
console.log(this.dateRange[1])
this.table1 = response.data
// this.time = true
// this.equipment = false
}).then(() => {
// this.drawLine()
this.drawLine()
})
}
},
drawLine() {
const _this = this
_this.data = []
_this.index = 0
_this.yAxisValue = []
for (let i = 0; i < _this.table1.length; i++) { // 取开始结束时间HH-mm取状态日期yyyy-MM-dd持续时间
_this.fixDate = _this.table1[0].日期.substr(0, 10)
_this.table1[i].开始时间 = _this.fixDate + ' ' + _this.table1[i].开始时间.substr(11, 5)
_this.table1[i].结束时间 = _this.fixDate + ' ' + _this.table1[i].结束时间.substr(11, 5)
_this.table1[i].日期 = _this.table1[i].日期.substr(0, 10)
}
if (_this.table1.length === 1) {
_this.data.push({
itemStyle: { normal: { color: _this.table1[0].颜色 }}, // 条形颜色
name: _this.table1[0].状态,
value: [0, _this.table1[0].开始时间, _this.table1[0].结束时间]
})
} else {
for (let i = 0; i < _this.table1.length; i++) {
if (i < _this.table1.length) {
if (i === 0) {
_this.index = 0
_this.yAxisValue.push(_this.table1[i].日期)
} else if (_this.table1[i].日期 !== _this.table1[i - 1].日期) {
_this.index++ // y轴索引
_this.yAxisValue.push(_this.table1[i].日期)
}
}
_this.data.push({
itemStyle: { normal: { color: _this.table1[i].颜色 }}, // 条形颜色
name: _this.table1[i].状态,
value: [parseInt(_this.index), _this.table1[i].开始时间, _this.table1[i].结束时间]
})
}
}
const myChart1 = _this.$echarts.init(document.getElementById('myChart1'))
myChart1.clear()
myChart1.setOption({
title: {
left: 'center',
text: '设备状态分布图'
},
color: _this.colors,
tooltip: { // 提示框
formatter(params) {
return params.value[1].substr(11, 5) + '~' + params.value[2].substr(11, 5)
} // 数据的值
},
legend: { // 图例
left: 'right',
selectedMode: false // 图例可点击
},
dataZoom: [{
type: 'inside',
start: 0,
end: 100
}, { // X轴可调
xAxisIndex: 0,
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}],
grid: { // 绘图网格
left: '3%',
right: '3%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'time',
interval: 1000 * 60 * 60,
axisLabel: {
formatter(value) {
var date = new Date(value)
return getzf(date.getHours()) + ':' + getzf(date.getMinutes())
function getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num
}
return num
}
}
}
},
yAxis: {
data: _this.yAxisValue
},
series: [
// 用空bar来显示几个图例
{ name: _this.state[0], type: 'bar', data: [] },
{ name: _this.state[1], type: 'bar', data: [] },
{ name: _this.state[2], type: 'bar', data: [] },
{ name: _this.state[3], type: 'bar', data: [] },
{ name: _this.state[4], type: 'bar', data: [] },
{
type: 'custom', renderItem(params, api) { // 开发者自定义的图形元素渲染逻辑,是通过书写 renderItem 函数实现的
var categoryIndex = api.value(0) // 这里使用 api.value(0) 取出当前 dataItem 中第一个维度的数值。
var start = api.coord([api.value(1), categoryIndex]) // 这里使用 api.coord(...) 将数值在当前坐标系中转换成为屏幕上的点的像素值。
var end = api.coord([api.value(2), categoryIndex])
var height = 120 // 柱体宽度
return {
type: 'rect', // 表示这个图形元素是矩形。还可以是 'circle', 'sector', 'polygon' 等等。
shape: _this.$echarts.graphic.clipRectByRect({ // 矩形的位置和大小。
x: start[0],
y: start[1] - height / (_this.num > 4 ? 4 : _this.num),
width: end[0] - start[0],
height: height / (_this.num > 4 ? 4 : _this.num)
}, { // 当前坐标系的包围盒。
x: params.coordSys.x,
y: params.coordSys.y,
width: params.coordSys.width,
height: params.coordSys.height
}),
style: api.style()
}
},
encode: {
x: [1, 2], // data 中『维度1』和『维度2』对应到 X 轴
y: 0 // data 中『维度0』对应到 Y 轴
},
data: _this.data
}
]
})
},
drawLine1() {
const _this = this
_this.data = []
_this.index = 0
// _this.yAxisValue1 = []
_this.yAxisValue = ['OP1370', 'OP1050', 'OP1420', 'OP1380', 'OP1360', 'OP1520', 'OP1390', 'OP1340']
for (let i = 0; i < _this.table1.length; i++) { // 取开始结束时间HH-mm取状态日期yyyy-MM-dd持续时间
_this.fixDate = _this.table1[0].日期.substr(0, 10)
_this.table1[i].开始时间 = _this.fixDate + ' ' + _this.table1[i].开始时间.substr(11, 5)
_this.table1[i].结束时间 = _this.fixDate + ' ' + _this.table1[i].结束时间.substr(11, 5)
_this.table1[i].日期 = _this.table1[i].日期.substr(0, 10)
}
if (_this.table1.length === 1) {
_this.data.push({
itemStyle: { normal: { color: _this.table1[0].颜色 }}, // 条形颜色
name: _this.table1[0].状态,
value: [0, _this.table1[0].开始时间, _this.table1[0].结束时间]
})
} else {
for (let i = 0; i < _this.table1.length; i++) {
if (i < _this.table1.length) {
if (i === 0) {
_this.index = 0
} else if (_this.table1[i].日期 !== _this.table1[i - 1].日期) {
_this.index++ // y轴索引
}
}
_this.data.push({
itemStyle: { normal: { color: _this.table1[i].颜色 }}, // 条形颜色
name: _this.table1[i].状态,
value: [parseInt(_this.index), _this.table1[i].开始时间, _this.table1[i].结束时间]
})
}
}
const myChart1 = _this.$echarts.init(document.getElementById('myChart1'))
myChart1.clear()
myChart1.setOption({
title: {
left: 'center',
text: '设备状态分布图'
},
color: _this.colors,
tooltip: { // 提示框
formatter(params) {
return params.value[1].substr(11, 5) + '~' + params.value[2].substr(11, 5)
} // 数据的值
},
legend: { // 图例
left: 'right',
selectedMode: false // 图例可点击
},
dataZoom: [{
type: 'inside',
start: 0,
end: 100
}, { // X轴可调
xAxisIndex: 0,
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}],
grid: { // 绘图网格
left: '3%',
right: '3%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'time',
interval: 1000 * 60 * 60,
axisLabel: {
formatter(value) {
var date = new Date(value)
return getzf(date.getHours()) + ':' + getzf(date.getMinutes())
function getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num
}
return num
}
}
}
},
yAxis: {
data: _this.yAxisValue
},
series: [
// 用空bar来显示几个图例
{ name: _this.state[0], type: 'bar', data: [] },
{ name: _this.state[1], type: 'bar', data: [] },
{ name: _this.state[2], type: 'bar', data: [] },
{ name: _this.state[3], type: 'bar', data: [] },
{
type: 'custom', renderItem(params, api) { // 开发者自定义的图形元素渲染逻辑,是通过书写 renderItem 函数实现的
var categoryIndex = api.value(0) // 这里使用 api.value(0) 取出当前 dataItem 中第一个维度的数值。
var start = api.coord([api.value(1), categoryIndex]) // 这里使用 api.coord(...) 将数值在当前坐标系中转换成为屏幕上的点的像素值。
var end = api.coord([api.value(2), categoryIndex])
var height = 120 // 柱体宽度
return {
type: 'rect', // 表示这个图形元素是矩形。还可以是 'circle', 'sector', 'polygon' 等等。
shape: _this.$echarts.graphic.clipRectByRect({ // 矩形的位置和大小。
x: start[0],
y: start[1] - height / (_this.num > 4 ? 4 : _this.num),
width: end[0] - start[0],
height: height / (_this.num > 4 ? 4 : _this.num)
}, { // 当前坐标系的包围盒。
x: params.coordSys.x,
y: params.coordSys.y,
width: params.coordSys.width,
height: params.coordSys.height
}),
style: api.style()
}
},
encode: {
x: [1, 2], // data 中『维度1』和『维度2』对应到 X 轴
y: 0 // data 中『维度0』对应到 Y 轴
},
data: _this.data
}
]
})
}
}
}
</script>
<style scoped>
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
<template>
<div class="app-container">
<el-card style="height: 850px">
<el-table :data="tableData" border size="small" stripe highlight-current-row max-height="740px" style="width: 450px">
<el-table-column type="index" align="center" label="序号" width="70px"/>
<el-table-column label="不合格原因" align="center" width="250px" >
<template slot-scope="scope">
{{ scope.row.不合格原因文本 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" style="margin-right:10px" @click="handleEdit(scope.row)"/>
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>
<el-tooltip effect="dark" content="添加新设备" placement="top">
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="ADD()"/>
</el-tooltip>
</el-card>
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="500px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="110px" class="demo-ruleForm">
<el-row>
<el-form-item label="不合格原因" prop="不合格原因" >
<el-input v-model="form.不合格原因" type="textarea" placeholder="不合格原因" size="small" style="width:300px" clearable />
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button v-show="title==='新增'" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
routineCheckType: [],
dialogFormVisible: false,
title: '',
equipmentValue: '',
equipmentName: '',
opName: '',
process: [],
form: {
不合格原因: ''
},
rules: {
不合格原因: [{ required: true, message: '不合格原因' }]
},
original: '',
total: 0, // 分页总数
tableData: [], // 设备信息表
pageCurrent: 1, // 分页当前页
pageSize: 20 // 分页每页显示条数
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.searchTable()
},
methods: {
searchTable() {
var param = []
var Data = this.CreateData('11', '基础数据_不合格原因_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data
})
},
ADD() {
this.title = '新增'
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.不合格原因 = ''
this.dialogFormVisible = true
},
handleEdit(row) {
this.title = '编辑'
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.equipmentValue = row.不合格原因
this.form.不合格原因 = row.不合格原因文本
this.dialogFormVisible = true
},
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
param[0] = ['不合格原因', this.form.不合格原因]
var Data = this.CreateData('12', '基础数据_不合格原因_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('添加失败')
}
})
}
})
},
submitEdit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
param[0] = ['id', this.equipmentValue]
param[1] = ['不合格原因', this.form.不合格原因]
var Data = this.CreateData('12', '基础数据_不合格原因_修改', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('编辑失败')
}
})
}
})
},
handleDelete(row) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var param = []
param[0] = ['id', row.不合格原因]
var Data = this.CreateData('12', '基础数据_不合格原因_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.pageCurrent = 1
this.searchTable()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>

View File

@@ -0,0 +1,325 @@
<template>
<div class="routineCheckDiv">
<el-card class="routineCheckCard">
<el-tabs v-model="PartType" type="border-card" style="height: 850px;padding: 0">
<el-tab-pane label="日点检" name="日点检">
<div class="textDiv">
<el-select v-model="MachineValue" class="selectStation" filterable clearable size="small" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value">
<div class="optionDiv1">{{ item.label }}</div>
<div class="optionDiv2">{{ item.value2 }}</div>
</el-option>
</el-select>
<span class="spanDatetime">查询时间</span>
<el-date-picker
v-model="dateRange"
size="small"
type="month"
align="center"
value-format="yyyy-MM-dd"
format="yyyy-MM"
placeholder="选择月"/>
<el-button class="buttonSeach" type="primary" plain size="small" icon="el-icon-search" @click="searchData()">查询</el-button>
</div>
<el-table :data="tableData" class="tableDate" min-height="100px" highlight-current-row border>
<el-table-column label="项次" align="center" type="index" width="50px"/>
<el-table-column v-for="(item,index) of calenderTableHeader" :key="item.日期" :label="item.日期" :prop="prop[index]" :width="columnWidth(item.日期)" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="item.日期 === '日保养项目'">{{ scope.row[item.日期] }}</span>
<span v-else>{{ scope.row[ 'F' + item.日期] }}</span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="月点检" name="月点检">
<div class="textDiv">
<el-select v-model="MachineValue1" class="selectStation" filterable clearable size="small" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value">
<div class="optionDiv1">{{ item.label }}</div>
<div class="optionDiv2">{{ item.value2 }}</div>
</el-option>
</el-select>
<span class="spanDatetime">查询时间</span>
<el-date-picker
v-model="dateRange1"
size="small"
type="year"
align="center"
value-format="yyyy"
format="yyyy"
placeholder="选择年"/>
<el-button class="buttonSeach" type="primary" plain size="small" icon="el-icon-search" @click="searchData1()">查询</el-button>
</div>
<el-table :data="tableData1" class="tableDate" min-height="100px" style="width: 1162px" highlight-current-row border>
<el-table-column label="项次" align="center" type="index" fixed width="50px"/>
<el-table-column label="月保养项目" fixed align="center">
<template slot-scope="scope">
{{ scope.row.月保养项目 }}
</template>
</el-table-column>
<el-table-column width="80px" label="1" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F1 }}
</template>
</el-table-column>
<el-table-column width="80px" label="2" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F2 }}
</template>
</el-table-column>
<el-table-column width="80px" label="3" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F3 }}
</template>
</el-table-column>
<el-table-column width="80px" label="4" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F4 }}
</template>
</el-table-column>
<el-table-column width="80px" label="5" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F5 }}
</template>
</el-table-column>
<el-table-column width="80px" label="6" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F6 }}
</template>
</el-table-column>
<el-table-column width="80px" label="7" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F7 }}
</template>
</el-table-column>
<el-table-column width="80px" label="8" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F8 }}
</template>
</el-table-column>
<el-table-column width="80px" label="9" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F9 }}
</template>
</el-table-column>
<el-table-column width="80px" label="10" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F10 }}
</template>
</el-table-column>
<el-table-column width="80px" label="11" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F11 }}
</template>
</el-table-column>
<el-table-column width="80px" label="12" fixed align="center">
<template slot-scope="scope">
{{ scope.row.F12 }}
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="年点检" name="年点检">
<div class="textDiv">
<el-select v-model="MachineValue2" class="selectStation" filterable clearable size="small" placeholder="选择工位-设备">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value">
<div class="optionDiv1">{{ item.label }}</div>
<div class="optionDiv2">{{ item.value2 }}</div>
</el-option>
</el-select>
<span class="spanDatetime">查询时间</span>
<el-date-picker
v-model="dateRange2"
size="small"
type="year"
align="center"
value-format="yyyy"
format="yyyy"
placeholder="选择年"/>
<el-button class="buttonSeach" type="primary" plain size="small" icon="el-icon-search" @click="searchData2()">查询</el-button>
</div>
<el-table :data="tableData2" class="tableDate" min-height="100px" style="width: 562px" highlight-current-row border>
<el-table-column label="项次" align="center" type="index" width="50px"/>
<el-table-column label="年保养项目" align="center">
<template slot-scope="scope">
{{ scope.row.年保养项目 }}
</template>
</el-table-column>
<el-table-column width="80px" label="结果" align="center">
<template slot-scope="scope">
{{ scope.row.F1 }}
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
dateRange: '', // 日期
dateRange1: '',
dateRange2: '',
PartType: '日点检',
MachineValue: '', // 工位号
MachineValue1: '',
MachineValue2: '',
Machine: [], // 工位号数组
tableData: [], // 数据
tableData1: [], // 数据
tableData2: [],
// tableWidthCheck: '', //
calenderTableHeader: [],
prop: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
}
},
created() {
this.searchDatetime()
},
mounted() {
this.fetchData()
},
methods: {
// 查询工位信息
fetchData() {
var param = []
var Data = this.CreateData('11', '点检信息_查询工位', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].设备名称
})
}
})
},
// 查询数据
searchData() {
var param = []
param[0] = ['月份', this.dateRange]
param[1] = ['工位号', this.MachineValue]
var Data = this.CreateData('11', '点检日期_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data
})
},
// 查询数据
searchData1() {
var param = []
param[0] = ['年份', this.dateRange1]
param[1] = ['工位号', this.MachineValue1]
var Data = this.CreateData('11', '点检月日期_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData1 = response.data
})
},
// 查询数据
searchData2() {
var param = []
param[0] = ['年份', this.dateRange2]
param[1] = ['工位号', this.MachineValue2]
var Data = this.CreateData('11', '点检年日期_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.tableData2 = response.data
})
},
searchDatetime() {
this.calenderTableHeader = []
var param = []
var Data = this.CreateData('11', '点检日期_查询数据_表头', param)
this.ExecDatabase(Data).then(response => {
this.calenderTableHeader.push({
日期: '日保养项目'
})
for (let i = 0; i < response.data[0].日期; i++) {
this.calenderTableHeader.push({
日期: (i + 1).toString()
})
}
this.searchData()
})
},
// 设置列宽
columnWidth(item) {
let widthStr = ''
switch (item) {
case '日保养项目':
widthStr = '150'
break
default:
widthStr = '80'
}
return widthStr
}
}
}
</script>
<style scoped>
.routineCheckCard{
width: 100%;
height: 840px;
}
.selectStation{
width:160px;
}
.optionDiv1{
float: left
}
.optionDiv2{
float: right; color: #8492a6; font-size: 13px
}
.buttonSeach{
margin-left: 15px;
}
.spanDatetime{
font-size: 13px;
color: black;
}
.textDiv{
margin-top: 7px;
margin-bottom: 7px;
height: 100%;
}
.tableDate{
width: 100%;
}
/deep/ .tableDate{
border: 1px solid black!important;
}
/deep/ .tableDate td{
border: 1px solid black!important;
border-left: 0px!important;
border-top: 0px!important;
}
/deep/ .tableDate th.is-leaf{
border: 1px solid black!important;
border-top: 0px!important;
border-left: 0px!important;
}
</style>