更
This commit is contained in:
@@ -1,31 +1,18 @@
|
||||
import request from '@/utils/request'
|
||||
import state from '@/store'
|
||||
import router from '@/router'
|
||||
// 电子看板_线体上下线数量统计_查询
|
||||
export function ANDON_countselect() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: 'ANDON_大屏幕显示',
|
||||
param: 'WorkShopType=A'
|
||||
}
|
||||
})
|
||||
}
|
||||
export function ANDON_opselect(opname) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: 'ANDON_办公室监控_消息通知',
|
||||
param: 'WorkShopType=A' + '&工位号=' + opname + '=string'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function searchTable(check, dateRange0, dateRange1, pageCurrent, pageSize) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: 'ANDON监控_查询',
|
||||
param: `日期_check=${check}&开始时间=${dateRange0}&结束时间=${dateRange1}`,
|
||||
Pagination: pageCurrent + '&' + pageSize
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
44
src/api/ManufacturingCenter/EquipmentMonitoringNew.js
Normal file
44
src/api/ManufacturingCenter/EquipmentMonitoringNew.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
import state from '@/store'
|
||||
import router from '@/router'
|
||||
|
||||
// 初始化工位
|
||||
export function getMachine() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '车间生产管理工艺_加工顺序调整_查询工位及人员'
|
||||
}
|
||||
})
|
||||
}
|
||||
// 获取状态
|
||||
export function searchState() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: 'MES_机加工MES_设备状态查询_初始化'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getData3(num, num1, num2) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '车间生产管理_设备运行情况_查询数据_状态分布图',
|
||||
param: '工位号=' + num + '&开始时间=' + num1 + '&结束时间=' + num2
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export function initArrivalStateContact() {
|
||||
})
|
||||
}
|
||||
// 查询到货情况
|
||||
export function searchArrivalState(num) {
|
||||
export function searchArrivalState(check1, num1, check2, num2, num3, pageCurrent, pageSize) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
@@ -24,8 +24,9 @@ export function searchArrivalState(num) {
|
||||
UserID: state.state.user.id,
|
||||
ModularID: router.currentRoute.path,
|
||||
type: '1',
|
||||
name: '车间管理_到货情况_查询数据_最新',
|
||||
param: `采购合同流水号=${num}`
|
||||
name: '车间管理_到货情况_查询数据_新_成组采购',
|
||||
param: `零件名_check=${check1}&零件名=${num1}&采购时间_check=${check2}&采购开始时间=${num2}&采购结束时间=${num3}`,
|
||||
Pagination: pageCurrent + '&' + pageSize
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -199,8 +199,6 @@ export default {
|
||||
this.spec ? check5 = 1 : check5 = 0
|
||||
this.model ? check6 = 1 : check6 = 0
|
||||
this.inTime ? check7 = 1 : (check7 = 0, this.inTime = '')
|
||||
this.tableData = ''
|
||||
this.total1 = 0
|
||||
searchRecord1(check1, this.projectValue, check2, this.machineValue, check3, this.groupValue, check4, this.name, check5, this.spec, check6, this.model, check7, this.inTime[0], this.inTime[1], this.pageCurrent1, this.pageSize1).then(res => {
|
||||
this.tableData1 = res.data.rows
|
||||
this.total1 = res.data.total
|
||||
|
||||
@@ -200,8 +200,6 @@ export default {
|
||||
this.spec ? check5 = 1 : check5 = 0
|
||||
this.model ? check6 = 1 : check6 = 0
|
||||
this.outTime ? check7 = 1 : (check7 = 0, this.outTime = '')
|
||||
this.tableData = []
|
||||
this.total1 = 0
|
||||
searchRecord(check1, this.projectValue, check2, this.machineValue, check3, this.groupValue, check4, this.name, check5, this.spec, check6, this.model, check7, this.outTime[0], this.outTime[1], this.pageCurrent1, this.pageSize1).then(res => {
|
||||
this.tableData = res.data.rows
|
||||
this.total1 = res.data.total
|
||||
|
||||
@@ -617,7 +617,8 @@ export default {
|
||||
if (row.完成日期 !== '') {
|
||||
return 'CompleteColor'
|
||||
}
|
||||
}, // 重置表单
|
||||
},
|
||||
// 重置表单
|
||||
callOff(formName) {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs[formName].resetFields()
|
||||
|
||||
@@ -1,243 +1,120 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-badge :value="value" class="item" style="margin-bottom: 10px; float: right">
|
||||
<el-button size="small" @click="openWindow">Andon信息</el-button>
|
||||
</el-badge>
|
||||
<el-table :data="tableData" style="width: 100%;" size="mini" height="800" highlight-current-row border stripe>
|
||||
<el-table-column align="center" label="照片" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-popover v-if="scope.row.文件标识 && scope.row.文件标识 !== 'null'" placement="top-start" width="200" trigger="hover">
|
||||
<el-button type="text" style="float:right" @click="deletePhoto(scope.row)">删除</el-button>
|
||||
<el-image :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"/>
|
||||
</div>
|
||||
</el-image>
|
||||
<el-image slot="reference" :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'" style="width:30px;">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"/>
|
||||
</div>
|
||||
</el-image>
|
||||
</el-popover>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工位号">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="openNew(scope.row.工位号)">{{ scope.row.工位号 }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="登陆人">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</span>
|
||||
<span v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="呼叫类型">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
|
||||
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
:disabled="scope.row.文件标识 && scope.row.文件标识 !== 'null'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-picture"
|
||||
@click="handlePicture(scope.row)">上传图片</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
size="small"
|
||||
type="daterange"
|
||||
align="center"
|
||||
style="width: 300px;margin: 5px"
|
||||
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: 10px" @click="total1=0;pageCurrent1=1;pageSize1=50;searchTable()">查询</el-button>
|
||||
</el-card>
|
||||
<el-dialog :visible.sync="dialogVisible" width="60%">
|
||||
<el-table :data="tableDataMassage" style="width: 100%;" size="mini" height="500" highlight-current-row border>
|
||||
<el-table-column align="center" label="工位号">
|
||||
<el-card>
|
||||
<el-table v-loading="loading" :data="tableData" :row-class-name="tableRowClassName" style="width: 100%;" size="mini" height="700" highlight-current-row border>
|
||||
<el-table-column align="center" label="报警工位">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text">{{ scope.row.工位号 }}</el-button>
|
||||
{{ scope.row.工位号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="登陆人">
|
||||
<el-table-column align="center" label="报警人">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</el-tag>
|
||||
<el-tag v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </el-tag>
|
||||
{{ scope.row.呼叫人 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="呼叫类型">
|
||||
<el-table-column align="center" label="报警类型">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
|
||||
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
|
||||
{{ scope.row.编号描述 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="报警内容">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.安东明细描述 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="报警时间">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.呼叫时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="复位时间">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.解除时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="处理时长">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.处理时长 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="dialogFormVisible" title="上传图片" center style="height: 800px" width="30%">
|
||||
<el-upload
|
||||
id="invoiceScan"
|
||||
ref="upload"
|
||||
:multiple="true"
|
||||
:auto-upload="false"
|
||||
:on-success="uploadSuccess"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="warningExceed"
|
||||
:limit="limit"
|
||||
:action="upload+'?num='+ OPId"
|
||||
list-type="picture-card">
|
||||
<i class="el-icon-plus"/>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible=false">取消</el-button>
|
||||
<el-button type="primary" style="width: 70px" @click="submitPerson()">确定</el-button>
|
||||
<div class="block" style="margin-top: 10px;">
|
||||
<el-pagination
|
||||
:current-page="pageCurrent1"
|
||||
:page-sizes="[50, 100, 150, 200]"
|
||||
:page-size="pageSize1"
|
||||
:total="total1"
|
||||
style="display:inline-block;width:50%"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange1"
|
||||
@current-change="handleCurrentChange1"/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ANDON_countselect } from '@/api/ManufacturingCenter/AntonMonitoring'
|
||||
import { wsuri, name1, uploadOP } from '@/utils/request'
|
||||
import { readFile } from '@/utils/request'
|
||||
import request from '@/utils/request'
|
||||
import { searchTable } from '@/api/ManufacturingCenter/AntonMonitoring'
|
||||
import { getNowShotTime } from '@/utils/tool'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
readFile: readFile,
|
||||
limit: 9999,
|
||||
dateRange: [],
|
||||
tableData: [],
|
||||
timer_ANDON: '',
|
||||
andonMsg: '',
|
||||
Name: '',
|
||||
upload: uploadOP,
|
||||
dialogFormVisible: false,
|
||||
OPId: '',
|
||||
massage: [],
|
||||
dialogVisible: false,
|
||||
tableDataMassage: [],
|
||||
value: 0
|
||||
loading: false,
|
||||
total1: 0,
|
||||
pageCurrent1: 1,
|
||||
pageSize1: 50
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.ANDON_countselect()
|
||||
this.timer_ANDON = setInterval(this.search(), 60 * 1000 * 5) // ANDON看板 5 分钟一刷新
|
||||
},
|
||||
created() {
|
||||
this.initWebpack()
|
||||
this.dateRange[0] = getNowShotTime()
|
||||
this.dateRange[1] = getNowShotTime()
|
||||
this.searchTable()
|
||||
},
|
||||
methods: {
|
||||
deletePhoto(row) {
|
||||
this.$confirm('此操作将永久删除该图片, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '4',
|
||||
name: `delete from 设备管理_设备监控_图片 where 工位 = '${row.工位号}'`
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('删除成功')
|
||||
this.ANDON_countselect()
|
||||
} else {
|
||||
this.$message.error('删除失败')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '取消删除'
|
||||
})
|
||||
searchTable() {
|
||||
this.loading = true
|
||||
this.tableData = []
|
||||
var check1
|
||||
this.dateRange ? check1 = 1 : (check1 = 0, this.dateRange = '')
|
||||
searchTable(check1, this.dateRange[0], this.dateRange[1], this.pageCurrent1, this.pageSize1).then(response => {
|
||||
this.tableData = response.data.rows
|
||||
this.total1 = response.data.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
openNew(val) {
|
||||
window.open(`http://192.168.1.231:8008/#/EquipmentConditionAnalysis?opname=${val}`, '_blank')
|
||||
},
|
||||
ANDON_countselect() {
|
||||
ANDON_countselect().then(response => {
|
||||
this.tableData = response.data
|
||||
})
|
||||
},
|
||||
// 初始化websocket
|
||||
initWebpack() {
|
||||
this.websock = new WebSocket(wsuri)// 这里面的this都指向vue
|
||||
this.websock.onopen = this.websocketopen
|
||||
this.websock.onmessage = this.websocketonmessage
|
||||
this.websock.onclose = this.websocketclose
|
||||
this.websock.onerror = this.websocketerror
|
||||
},
|
||||
// 打开
|
||||
websocketopen() {
|
||||
console.log('WebSocket连接成功')
|
||||
this.websock.send('{<' + name1 + '>}')
|
||||
},
|
||||
// 数据接收
|
||||
websocketonmessage(msg) {
|
||||
console.log(msg)
|
||||
this.andonMsg = msg.data.split('|')[3]
|
||||
this.Name = msg.data.split('|')[2]
|
||||
if (this.andonMsg === '1') {
|
||||
this.search()
|
||||
// 完成日期变色
|
||||
tableRowClassName({ row, rowIndex }) {
|
||||
row.index = rowIndex
|
||||
if (!row.解除时间) {
|
||||
return 'ANDON_Uncomplete'
|
||||
}
|
||||
},
|
||||
// 关闭
|
||||
websocketclose() {
|
||||
console.log('WebSocket关闭')
|
||||
handleSizeChange1(val) {
|
||||
this.pageCurrent1 = 1
|
||||
this.pageSize1 = val
|
||||
this.searchTable()
|
||||
},
|
||||
// 失败
|
||||
websocketerror() {
|
||||
console.log('WebSocket连接失败')
|
||||
},
|
||||
uploadSuccess(res) { // 上传成功回调
|
||||
if (res[0].result === '1') {
|
||||
this.$message.success('增加成功')
|
||||
this.dialogFormVisible = false
|
||||
this.ANDON_countselect()
|
||||
this.$refs.upload.clearFiles()
|
||||
} else {
|
||||
this.$message.error('增加失败')
|
||||
}
|
||||
},
|
||||
beforeUpload(file) { // 上传前检测
|
||||
const isJPG = /^image\/.*/.test(file.type)
|
||||
if (!isJPG) {
|
||||
this.$message.error('只能上传图片。。')
|
||||
}
|
||||
return isJPG
|
||||
},
|
||||
warningExceed() {
|
||||
this.$message.error('仅可上传五张照片')
|
||||
},
|
||||
handlePicture(row) {
|
||||
this.dialogFormVisible = true
|
||||
this.OPId = row.工位号
|
||||
},
|
||||
submitPerson() {
|
||||
this.$refs.upload.submit()
|
||||
},
|
||||
search() {
|
||||
this.tableDataMassage = []
|
||||
ANDON_countselect().then(response => {
|
||||
this.tableData = response.data
|
||||
return response.data
|
||||
}).then(data => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].呼叫备注 !== null) {
|
||||
this.tableDataMassage.push(data[i])
|
||||
handleCurrentChange1(val) {
|
||||
this.pageCurrent1 = val
|
||||
this.searchTable()
|
||||
}
|
||||
}
|
||||
this.value = this.tableDataMassage.length
|
||||
})
|
||||
},
|
||||
openWindow() {
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -249,3 +126,8 @@ export default {
|
||||
margin-right: 2px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.ANDON_Uncomplete{
|
||||
background: #9bd7fc !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -146,7 +146,6 @@ export default {
|
||||
this.dateRange ? check2 = 1 : (check2 = 0, this.dateRange = '')
|
||||
this.personValue ? check3 = 1 : check3 = 0
|
||||
searchTable1(this.radio, check1, this.billNames, check2, this.dateRange[0], this.dateRange[1], check3, this.personValue, this.pageCurrent1, this.pageSize1).then(response => {
|
||||
console.log(response.data)
|
||||
this.loading1 = false
|
||||
this.tableData1 = response.data.rows
|
||||
this.total1 = response.data.total
|
||||
|
||||
230
src/views/ManufacturingCenter/EquipmentMonitoringNew/index.vue
Normal file
230
src/views/ManufacturingCenter/EquipmentMonitoringNew/index.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<span>工位号:</span>
|
||||
<el-select v-model="MachineValue" filterable size="small" style="width:160px;margin-bottom:10px" 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="margin-left: 10px">时间段:</span>
|
||||
<el-date-picker
|
||||
v-model="date1"
|
||||
style="width:160px;margin:10px;"
|
||||
size="small"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
format="yyyy-MM-dd"
|
||||
placeholder="选择日期"/>
|
||||
<span>~</span>
|
||||
<el-date-picker
|
||||
v-model="date2"
|
||||
style="width:160px;margin:10px;"
|
||||
size="small"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
format="yyyy-MM-dd"
|
||||
placeholder="选择日期"/>
|
||||
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchData()">查询</el-button>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<div id="myChart" style="width: 100%; height: 520px; margin: auto"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMachine, searchState, getData3 } from '@/api/ManufacturingCenter/EquipmentMonitoringNew'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
date1: '20191201',
|
||||
date2: '20191204',
|
||||
MachineValue: '',
|
||||
Machine: [],
|
||||
colors: [],
|
||||
state: [],
|
||||
table1: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
this.MachineValue = ''
|
||||
this.Machine = []
|
||||
getMachine().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() {
|
||||
if (this.date1 === null || this.date2 === null) {
|
||||
this.$message.warning('请选择开始时间或结束时间')
|
||||
} else {
|
||||
searchState().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.colors.push(response.data[i].颜色)
|
||||
this.state.push(response.data[i].状态)
|
||||
}
|
||||
})
|
||||
getData3(this.MachineValue, this.date1, this.date2).then(response => {
|
||||
this.table1 = response.data
|
||||
}).then(() => {
|
||||
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 myChart = _this.$echarts.init(document.getElementById('myChart'))
|
||||
myChart.clear()
|
||||
myChart.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: 'left',
|
||||
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 * 2,
|
||||
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 = 10 // 柱体宽度
|
||||
|
||||
return {
|
||||
type: 'rect', // 表示这个图形元素是矩形。还可以是 'circle', 'sector', 'polygon' 等等。
|
||||
shape: _this.$echarts.graphic.clipRectByRect({ // 矩形的位置和大小。
|
||||
x: start[0],
|
||||
y: start[1] - height / 1,
|
||||
width: end[0] - start[0],
|
||||
height: height * 2
|
||||
}, { // 当前坐标系的包围盒。
|
||||
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>
|
||||
@@ -1,19 +1,32 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable @change="searchTable">
|
||||
<el-option
|
||||
v-for="item in contractNum"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
<div style="float: left">{{ item.label }}</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!--<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable @change="searchTable">-->
|
||||
<!--<el-option-->
|
||||
<!--v-for="item in contractNum"-->
|
||||
<!--:key="item.value"-->
|
||||
<!--:label="item.label"-->
|
||||
<!--:value="item.value">-->
|
||||
<!--<div style="float: left">{{ item.label }}</div>-->
|
||||
<!--</el-option>-->
|
||||
<!--</el-select>-->
|
||||
<el-input v-model="billNames" clearable filterable size="small" placeholder="合同号零件名称图号或型号" style="width: 200px;margin: 5px"/>
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
size="small"
|
||||
type="daterange"
|
||||
align="center"
|
||||
style="width: 300px"
|
||||
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: 10px" @click="total1=0;pageCurrent1=1;pageSize1=50;searchTable()">查询</el-button>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-table v-loading="" :data="tableData" stripe border style="width: 980px;margin-top: 10px" height="600px" size="mini">
|
||||
<el-table v-loading="loading1" :data="tableData" stripe border style="width: 980px;margin-top: 10px" height="600px" size="mini">
|
||||
<el-table-column label="采购合同编号" align="center" width="140">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.采购合同编号 }}
|
||||
@@ -55,6 +68,17 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="block" style="margin-top: 10px;">
|
||||
<el-pagination
|
||||
:current-page="pageCurrent1"
|
||||
:page-sizes="[50, 100, 150, 200]"
|
||||
:page-size="pageSize1"
|
||||
:total="total1"
|
||||
style="display:inline-block;width:50%"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange1"
|
||||
@current-change="handleCurrentChange1"/>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -64,16 +88,17 @@ import { initArrivalStateContact, searchArrivalState } from '@/api/WorkshopProcu
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: '', // 项目总价查询
|
||||
data() {
|
||||
return {
|
||||
check1: 0,
|
||||
contractNumValue: '',
|
||||
billNames: '',
|
||||
dateRange: '', // 日期
|
||||
contractNumValue: '', // 已屏蔽下拉框
|
||||
contractNum: [],
|
||||
supplierName: '',
|
||||
tableData: [],
|
||||
arrival: [],
|
||||
judge: []
|
||||
total1: 0,
|
||||
pageCurrent1: 1,
|
||||
pageSize1: 50,
|
||||
loading1: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -85,7 +110,7 @@ export default {
|
||||
])
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
// this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
@@ -99,34 +124,35 @@ export default {
|
||||
})
|
||||
},
|
||||
searchTable() {
|
||||
searchArrivalState(this.contractNumValue).then(response => {
|
||||
this.loading1 = true
|
||||
var check1, check2
|
||||
this.billNames ? check1 = 1 : check1 = 0
|
||||
this.dateRange ? check2 = 1 : (check2 = 0, this.dateRange = '')
|
||||
searchArrivalState(check1, this.billNames, check2, this.dateRange[0], this.dateRange[1], this.pageCurrent1, this.pageSize1).then(response => {
|
||||
console.log(response.data)
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (response.data[i].物料型号 === '' || response.data[i].物料型号 === null) {
|
||||
response.data[i].物料型号 = response.data[i].零件图号
|
||||
for (let i = 0; i < response.data.rows.length; i++) {
|
||||
if (!response.data.rows[i].物料型号) {
|
||||
response.data.rows[i].物料型号 = response.data.rows[i].零件图号
|
||||
}
|
||||
}
|
||||
this.tableData = response.data
|
||||
this.tableData = response.data.rows
|
||||
this.total1 = response.data.total
|
||||
this.loading1 = false
|
||||
})
|
||||
},
|
||||
handleSizeChange1(val) {
|
||||
this.pageCurrent1 = 1
|
||||
this.pageSize1 = val
|
||||
this.searchTable()
|
||||
},
|
||||
handleCurrentChange1(val) {
|
||||
this.pageCurrent1 = val
|
||||
this.searchTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-select{
|
||||
width:200px
|
||||
}
|
||||
.el-input{
|
||||
width:200px
|
||||
}
|
||||
span{
|
||||
margin: 10px 0 10px 10px;
|
||||
}
|
||||
.searchForm .el-form-item{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.el-tag{
|
||||
margin: 0
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user