<template>
|
<a-modal
|
:title="title"
|
:width="1000"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭"
|
>
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form
|
layout="inline"
|
@keyup.enter.native="searchQuery"
|
>
|
<a-row :gutter="24">
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item label="报警代码">
|
<j-input
|
placeholder="请输入报警代码"
|
v-model="queryParam.warnCode"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item label="报警名称">
|
<j-input
|
placeholder="请输入报警名称"
|
v-model="queryParam.warnName"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-button
|
type="primary"
|
@click="searchQuery"
|
icon="search"
|
>查询
|
</a-button>
|
<a-button
|
@click="searchReset"
|
icon="reload"
|
style="margin-left:8px;"
|
>重置
|
</a-button>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="24">
|
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<div style="margin-top:8px;">
|
<a-table
|
ref="table"
|
bordered
|
size="middle"
|
rowKey="warnCode"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="false"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
|
@change="handleTableChange"
|
:customRow="clickThenCheck"
|
>
|
</a-table>
|
</div>
|
</a-form>
|
</a-spin>
|
</a-modal>
|
</template>
|
|
<script>
|
import { getAction } from '@/api/manage'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JInput from '@/components/jeecg/JInput'
|
|
export default {
|
name: 'WarnSelect',
|
mixins: [JeecgListMixin],
|
components: {
|
JInput
|
},
|
data() {
|
return {
|
title: '操作',
|
visible: false,
|
model: {},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 50,
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '报警代码',
|
dataIndex: 'warnCode',
|
align: 'center'
|
},
|
{
|
title: '报警名称',
|
dataIndex: 'warnName',
|
align: 'center'
|
},
|
],
|
url: {
|
list: '/eam/predictiveworkplanwarn/listPredictiveWorkPlanWarn'
|
}
|
}
|
},
|
methods: {
|
|
searchQuery() {
|
this.loadData()
|
},
|
|
list(equipmentId) {
|
this.queryParam.equipmentId = equipmentId
|
this.visible = true
|
this.loadData()
|
},
|
loadData() {
|
let that = this
|
getAction(this.url.list, this.queryParam).then((res) => {
|
if (res.success) {
|
that.dataSource = res.result
|
}
|
})
|
},
|
clickThenCheck(record) {
|
return {
|
on: {
|
click: (e) => {
|
this.selectedRowRecord = record
|
this.onSelectChange(record.id.split(','), [record])
|
}
|
}
|
}
|
},
|
|
onSelectChange(selectedRowKeys, selectedRows) {
|
this.selectedRowKeys = selectedRowKeys
|
this.selectedRowRecord = selectedRows[0]
|
},
|
|
close() {
|
this.queryParam = {}
|
this.$emit('close')
|
this.visible = false
|
this.selectedRowKeys = []
|
},
|
|
handleOk() {
|
const that = this
|
// 触发表单验证
|
if (that.selectedRowKeys.length > 0) {
|
if (that.selectedRowRecord.warnCode != null && that.selectedRowRecord.warnCode != '') {
|
that.$emit('sendWarn', { record: that.selectedRowRecord })
|
that.close()
|
} else {
|
that.$message.error('请选择参数!')
|
}
|
} else {
|
that.$message.error('请选择参数!')
|
}
|
},
|
|
handleCancel() {
|
this.close()
|
}
|
|
}
|
}
|
</script>
|
<style>
|
@import '~@assets/less/common.less';
|
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
|
.fontweightfrozen {
|
font-weight: bold;
|
color: #c9c9c9;
|
}
|
|
.success {
|
color: green;
|
}
|
|
.error {
|
color: red;
|
}
|
</style>
|