<template>
|
<div>
|
<x-card :bordered="false" v-if="hasPerm('WorkPieceProcess:page')">
|
<div slot="content" class="table-page-search-wrapper">
|
<a-form :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-row :gutter="gutter">
|
<a-col :md="colMd" :sm="colSm">
|
<a-form-item label="设备名称">
|
<a-select
|
show-search
|
option-filter-prop="children"
|
:filter-option="filterOption"
|
:allowClear="true"
|
style="width: 100%"
|
v-model="queryParam.EquipmentID"
|
placeholder="请选择"
|
>
|
<a-select-option v-for="(item, index) in equitypeData" :key="index" :value="item.equipmentId">{{
|
item.equipmentName
|
}}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="colMd" :sm="colSm">
|
<a-form-item label="刀具编号">
|
<a-input v-model="queryParam.KnifeToolID" allow-clear placeholder="请输入刀具编号" />
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="colMd" :sm="colSm">
|
<a-form-item label="是否报警">
|
<a-select
|
v-model="queryParam.isAlert"
|
allow-clear
|
placeholder="请选择是否报警"
|
>
|
<a-select-option :value="1">是</a-select-option>
|
<a-select-option :value="0">否</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="colMd" :sm="colSm">
|
<span class="table-page-search-submitButtons">
|
<a-button type="primary" @click="getData(1)">查询</a-button>
|
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
</x-card>
|
<a-card :bordered="false">
|
<div style="margin-bottom:10px">
|
<a-button
|
type="info"
|
icon="download"
|
@click="KnifeToolDataMonitorToExcel()"
|
>导出Excel</a-button
|
>
|
</div>
|
<a-table
|
ref="table"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="pages"
|
:rowClassName="getRowBackGround"
|
:rowKey="(record) => record.id"
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
>
|
</a-table>
|
</a-card>
|
</div>
|
</template>
|
<script>
|
import { STable, XCard } from '@/components'
|
import { downloadFile } from '@/utils/util'
|
import { getKnifetoolequipmentinfo } from '@/api/modular/main/KnifeToolDataMonitorManage'
|
// 获取设备下拉框数据
|
import { getEquipmentName } from '@/api/modular/main/EquipmentBaseInfoManage'
|
export default {
|
components: {
|
STable,
|
XCard
|
},
|
data() {
|
return {
|
gutter: 36,
|
colMd: 6,
|
colSm: 18,
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 8 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 15 }
|
},
|
advanced: false, // 高级搜索 展开/关闭
|
queryParam: {},
|
columns: [
|
{
|
title: '序号',
|
dataIndex: 'index',
|
key: 'index',
|
align: 'center',
|
customRender: (text, record, index) => `${index + 1}`
|
},
|
{
|
title: '设备编号',
|
align: 'center',
|
sorter: true,
|
dataIndex: 'equipmentID',
|
scopedSlots: { customRender: 'equipmentIDSlots' }
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
sorter: true,
|
dataIndex: 'equipmentName'
|
},
|
{
|
title: '所属工序',
|
align: 'center',
|
sorter: true,
|
dataIndex: 'workingProcedure'
|
},
|
{
|
title: '刀具Id',
|
ellipsis: true,
|
dataIndex: 'knifeToolID'
|
},
|
{
|
title: '工位',
|
ellipsis: true,
|
dataIndex: 'station'
|
},
|
{
|
title: '上刀时间',
|
ellipsis: true,
|
dataIndex: 'changeStartTime'
|
},
|
{
|
title: '计划寿命(件)',
|
ellipsis: true,
|
dataIndex: 'knifeToolLife'
|
},
|
{
|
title: '当前寿命(件)',
|
ellipsis: true,
|
dataIndex: 'currentLife'
|
}
|
],
|
selectedRowKeys: [],
|
selectedRows: [],
|
equitypeData: [],
|
dataSource: [],
|
pages: {
|
current: 1,
|
pageSize: 10,
|
total: 0,
|
showTotal: (total, range) => `${range[0]}-${range[1]}共${total}条`,
|
showSizeChanger: true,
|
pageSizeOptions: ['10', '20', '30', '40'],
|
onChange: this.getData,
|
onShowSizeChange: this.showSizeChange
|
}
|
}
|
},
|
created() {
|
// if (this.hasPerm('EquipmentBaseInfo:edit')) {
|
// this.columns.push({
|
// title: '操作',
|
// width: '150px',
|
// align: 'center',
|
// dataIndex: 'action',
|
// scopedSlots: { customRender: 'action' }
|
// })
|
// }
|
|
this.getEquipmentName()
|
this.getData()
|
},
|
methods: {
|
// 背景行变色
|
getRowBackGround(recordAlarm) {
|
switch (
|
recordAlarm.isAlert // 这里根据条件改变表格背景色
|
) {
|
case true:
|
return 'table-color-alert'
|
}
|
},
|
|
async getData(pageNo) {
|
const params = {}
|
if (pageNo) this.pages.current = pageNo
|
params.pageNo = this.pages.current
|
params.pageSize = this.pages.pageSize
|
Object.assign(params, this.queryParam)
|
if (params.isAlert) { params.isAlert = params.isAlert == 1 }
|
|
try {
|
const { data } = await getKnifetoolequipmentinfo(params)
|
this.dataSource = data.rows
|
this.pages.total = data.totalRows
|
} catch (error) {
|
console.log(error)
|
}
|
},
|
// 表格显示数据条数改变
|
showSizeChange(current, size) {
|
this.pages.pageSize = size
|
this.getData(1)
|
},
|
// 导出数据
|
KnifeToolDataMonitorToExcel() {
|
// this.cardLoading = true
|
// KnifeToolDataMonitorToExcel(this.queryParam)
|
// .then((res) => {
|
// this.cardLoading = false
|
// downloadFile(res)
|
// })
|
// .catch((err) => {
|
// this.cardLoading = false
|
// console.info(err)
|
// this.$message.error('下载错误:获取文件流错误' + err)
|
// })
|
},
|
toggleAdvanced() {
|
this.advanced = !this.advanced
|
},
|
getEquipmentName() {
|
getEquipmentName().then((res) => {
|
this.equitypeData = res.data
|
})
|
},
|
onSelectChange(selectedRowKeys, selectedRows) {
|
this.selectedRowKeys = selectedRowKeys
|
this.selectedRows = selectedRows
|
},
|
// 设备查询框筛选
|
filterOption(input, option) {
|
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
}
|
}
|
}
|
</script>
|
<style lang="less">
|
.table-operator {
|
margin-bottom: 18px;
|
}
|
button {
|
margin-right: 8px;
|
}
|
|
.table-color-alert {
|
// color: #ffffff;
|
background-color: rgb(240, 87, 87);
|
}
|
</style>
|