<template>
|
<a-modal :title="title" :width="1000" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel"
|
cancelText="关闭">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="7" :sm="7">
|
<a-form-item label="统一编码">
|
<a-input placeholder="请输入统一编码" v-model="queryParam.num"/>
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="7" :sm="7">
|
<a-form-item label="设备名称">
|
<a-input placeholder="请输入设备名称" v-model="queryParam.name"/>
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="3" :sm="3">
|
<a-space>
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button @click="searchReset" icon="reload">重置</a-button>
|
</a-space>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<a-table bordered rowKey="id" :scroll="{ y: 300 }" :columns="columns" :customRow="customRow"
|
:dataSource="dataSource" :pagination="ipagination" :loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
|
@change="handleTableChange">
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
</a-modal>
|
</template>
|
|
<script>
|
import { getAction } from '@/api/manage'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { filterObj } from '@/utils/util'
|
|
export default {
|
name: 'EamEquipmentListModal',
|
mixins: [JeecgListMixin],
|
data() {
|
return {
|
title: '选择设备',
|
visible: false,
|
disableMixinCreated: true,
|
columns: [
|
{
|
title: '统一编码',
|
align: 'center',
|
dataIndex: 'num'
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
dataIndex: 'name'
|
},
|
{
|
title: '使用部门',
|
align: 'center',
|
dataIndex: 'useId_dictText'
|
},
|
{
|
title: '中心',
|
align: 'center',
|
dataIndex: 'workCenterId_dictText'
|
},
|
{
|
title: '工区',
|
align: 'center',
|
dataIndex: 'factoryModelId_dictText'
|
},
|
{
|
title: '工段',
|
align: 'center',
|
dataIndex: 'areaId_dictText'
|
},
|
],
|
url: {
|
list: '/eam/equipment/getEquipmentTZList'
|
}
|
}
|
},
|
methods: {
|
openPage() {
|
this.visible = true
|
this.onClearSelected()
|
this.dataSource = []
|
this.loadData(1)
|
},
|
|
getQueryParams() {
|
//获取查询条件
|
let sqp = {}
|
if (this.superQueryParams) {
|
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
|
sqp['superQueryMatchType'] = this.superQueryMatchType
|
}
|
const param = Object.assign(sqp, this.queryParam)
|
param.pageNo = this.ipagination.current
|
param.pageSize = this.ipagination.pageSize
|
|
return filterObj(param)
|
},
|
|
loadData(arg) {
|
if (!this.url.list) {
|
this.$message.error('请设置url.list属性!')
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1
|
}
|
const params = this.getQueryParams()//查询条件
|
|
if (!params) {
|
return false
|
}
|
|
this.loading = true
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records || res.result
|
if (res.result.total) {
|
this.ipagination.total = res.result.total
|
} else {
|
this.ipagination.total = 0
|
}
|
} else {
|
this.$notification.warning({
|
message: '消息',
|
description: res.message
|
})
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
|
customRow(record) {
|
return {
|
style: {
|
cursor: 'pointer'
|
},
|
on: {
|
click: () => {
|
this.onSelectChange([record.id], [record])
|
}
|
}
|
}
|
},
|
|
modalFormOk(val) {
|
// 新增/修改 成功时,重载列表
|
this.loadData()
|
this.selectedRowKeys = [val.id]
|
},
|
searchQuery() {
|
this.loadData()
|
this.onClearSelected()
|
},
|
searchReset() {
|
this.queryParam = {}
|
this.loadData()
|
this.onClearSelected()
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
handleCancel() {
|
this.close()
|
},
|
handleOk() {
|
this.$emit('sendSelectionRows', this.selectionRows[0])
|
this.close()
|
}
|
}
|
}
|
</script>
|