Files
56-DeZhouDaLuJia-DaLuJiaVue2TV/src/views/page/QX_EMS.vue
2026-06-08 17:37:38 +08:00

321 lines
12 KiB
Vue

<template>
<div>
<el-card>
<el-col :span="7">
<div class="show-text">动作节拍设定</div>
<el-input v-model="TagName" clearable style="width: 280px;margin-right: 26px" placeholder="请输入动作名称"/>
<el-button :disabled="loading" icon="el-icon-search" type="primary" @click="searchTable()">查询</el-button>
<el-table
v-loading="loading"
:data="tableData"
:header-row-style= "{fontSize: '18px',fontFamily:'MiSans Demibold',height: '64px',backgroundColor:'#fff'}"
:row-style="{fontSize: '16px',fontFamily:'MiSans Regular',height: '64px'}"
element-loading-text="数据加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
tooltip-effect="dark"
style="width: 100%"
height="875"
border
size="mini"
@row-click="table1RowClick">
<el-table-column type="index" label=" " align="center" width="80"/>
<el-table-column align="center" label="设备动作">
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="节拍(s)" >
<template slot-scope="scope">
<el-input-number v-model="scope.row.节拍" :min="0" :step="1" @change="setBeat(scope.row)"></el-input-number>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="17">
<div class="show-text">零部件寿命预测设定</div>
<el-row>
<el-col :span="16">
<el-table
v-loading="loading"
:data="tableData1"
:header-row-style= "{fontSize: '18px',fontFamily:'MiSans Demibold',height: '64px',backgroundColor:'#fff'}"
:row-style="{fontSize: '16px',fontFamily:'MiSans Regular',height: '64px'}"
element-loading-text="数据加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
tooltip-effect="dark"
style="width: 100%"
height="330"
border
size="mini"
@row-click="table2RowClick">
<el-table-column type="index" label=" " align="center" width="60"/>
<el-table-column align="center" label="部件名称">
<template slot-scope="scope">
{{ scope.row.部件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="额定(H)" width="120">
<template slot-scope="scope">
{{ scope.row.更换时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="已用(H)" width="120">
<template slot-scope="scope">
{{ scope.row.报警时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="上次更换" width="200">
<template slot-scope="scope">
{{ scope.row.上次维修时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="更换/看板展示">
<template slot-scope="scope">
<el-button v-if="scope.row['是否展示']" type="text" icon="el-icon-s-flag" style="color: #00893d"></el-button>
<el-button size="mini" type="warning" @click="updateDeviceInfo(scope.row)">更换</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="8">
<el-row>
<el-table
v-loading="loading"
:data="tableData2"
:header-row-style= "{fontSize: '18px',fontFamily:'MiSans Demibold',height: '64px',backgroundColor:'#fff'}"
:row-style="{fontSize: '16px',fontFamily:'MiSans Regular',height: '64px'}"
element-loading-text="数据加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
tooltip-effect="dark"
style="width: 100%"
height="330"
border
size="mini">
<el-table-column align="center" label="关联动作">
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100">
<template slot-scope="scope">
<el-button type="text" icon="el-icon-delete" @click="UnlinkDeviceTagId(scope.row)" style="color: #ff0000"></el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-col>
</el-row>
<el-row>
<span style="margin-left: 20px">动作</span>
<el-input v-model="TagNameDongZuo" readonly style="width: 280px;margin-right: 26px" placeholder="请选择关联动作"/>
<span>部件</span>
<el-input v-model="TagNameBuJian" readonly style="width: 280px;margin-right: 26px" placeholder="请选择部件"/>
<el-button icon="el-icon-link" type="warning" @click="linkDeviceTagId()">关联</el-button>
</el-row>
</el-col>
</el-card>
<el-dialog :visible.sync="dialogFormVisible1" :append-to-body="true" title="编辑部件信息" center width="440px">
<el-form ref="form" :model="form" label-position="right" label-width="100px">
<el-form-item label="部件名称" prop="部件名称">
<el-input v-model="form.部件名称" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="额定时间(H)" prop="planData">
<el-input-number v-model="form.更换时间" style="width: 240px;border-radius: 4px" :min="0" :step="1" />
</el-form-item>
<el-form-item label="上次更换时间" prop="planData">
<el-date-picker type="datetime" v-model="form.上次维修时间" :clearable="false" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item label="是否展示" prop="planData">
<el-checkbox v-model="form.是否展示"></el-checkbox>
</el-form-item>
<el-row>
<el-form-item >
<el-button style="width: 80px;height: 40px" type="primary" @click="submitAdd1('form')"> </el-button>
<el-button style="width: 80px;height: 40px" @click="callOff1('form')">取消</el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
TagName: '',
TagNameBuJian: '',
TagNameBuJianID: '',
TagNameDongZuo: '',
TagNameDongZuoID: '',
collectionTime: [],
tableDataExcel: [],
loading: false,
tableData: [],
tableData1: [],
tableData2: [],
dialogFormVisible1: false,
form: {
部件代码: '',
部件名称: '',
更换时间: '',
上次维修时间: '',
是否展示: ''
},
total: 0, // 总条数
pageSize: 50, // 每页显示条数
pageList: 1 // 后台获取页
}
},
created() {
this.searchTable()
this.searchTable1()
},
methods: {
// 查询
searchTable() {
this.loading = true
this.tableData = []
var param = []
param[0] = ['动作名称', this.TagName]
var Data = this.CreateData('11', '部件寿命_动作节拍_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableData = response.data
}
this.loading = false
})
},
// 查询
searchTable1() {
this.tableData1 = []
var param = []
var Data = this.CreateData('11', '部件寿命_部件_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableData1 = response.data
}
})
},
// 查询
table2RowClick(row) {
this.TagNameBuJian = row['部件名称']
this.TagNameBuJianID = row['部件代码']
this.tableData2 = []
var param = []
param[0] = ['部件代码', row['部件代码']]
var Data = this.CreateData('11', '部件寿命_部件动作_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableData2 = response.data
}
})
},
table1RowClick(row) {
this.TagNameDongZuo = row['名称']
this.TagNameDongZuoID = row['TagID']
},
// 查询
searchTable2() {
this.tableData1 = []
var param = []
var Data = this.CreateData('11', '部件寿命_部件_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableData1 = response.data
}
})
},
linkDeviceTagId() {
var param = []
if (this.TagNameBuJianID === '' || this.TagNameDongZuoID === '') {
this.$message.warning('请选择部件和关联动作!')
return
}
param[0] = ['部件代码', this.TagNameBuJianID]
param[1] = ['TagID', this.TagNameDongZuoID]
var Data = this.CreateData('11', '部件寿命_部件动作_绑定', param)
this.ExecDatabase(Data).then(response => {
this.$message.success('关联成功!')
this.table2RowClick({
部件名称: this.TagNameBuJian,
部件代码: this.TagNameBuJianID
})
})
},
UnlinkDeviceTagId(row) {
var param = []
param[0] = ['部件代码', row.部件代码]
param[1] = ['TagID', row.tagID]
var Data = this.CreateData('11', '部件寿命_部件动作_解除绑定', param)
this.ExecDatabase(Data).then(response => {
this.$message.success('解除成功!')
this.table2RowClick({
部件名称: this.TagNameBuJian,
部件代码: this.TagNameBuJianID
})
this.TagNameDongZuoID = ''
this.TagNameDongZuo = ''
})
},
setBeat(row) {
var param = []
param[0] = ['节拍', row.节拍]
param[1] = ['TagID', row.TagID]
var Data = this.CreateData('11', '部件寿命_部件动作节拍_设定', param)
this.ExecDatabase(Data).then(response => {
this.$message.success('设定成功!')
})
},
updateDeviceInfo(row) {
this.form.部件代码 = row['部件代码']
this.form.是否展示 = row['是否展示']
this.form.部件名称 = row['部件名称']
this.form.更换时间 = row['更换时间']
this.form.上次维修时间 = row['上次维修时间']
this.dialogFormVisible1 = true
},
submitAdd1() {
var param = []
param[0] = ['部件代码', this.form.部件代码]
param[1] = ['更换时间', this.form.更换时间]
param[2] = ['上次维修时间', this.form.上次维修时间]
param[3] = ['是否展示', this.form.是否展示]
var Data = this.CreateData('12', '部件寿命_部件_更换', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.searchTable1()
this.dialogFormVisible1 = false
} else {
this.$message.error('编辑失败')
}
})
},
callOff1() {},
// 分页
handleSizeChange(val) {
this.pageList = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageList = val
this.searchTable()
}
}
}
</script>
<style>
.show-text {
font-family: "MiSans Regular",serif ;
margin-right: 20px;
font-size: 20px;
color: #595959;
}
</style>