<template>
|
<a-card :bordered="false">
|
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="4" :sm="4">
|
<a-form-item label="车间">
|
<a-select v-model="queryParam.productionId" placeholder="请选择车间">
|
<a-select-option v-for="item in workshopTreeData" :key="item.id">
|
{{ item.productionName }}
|
</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="4" :sm="4">
|
<a-form-item label="设备类名称">
|
<a-input placeholder="请输入设备类名称" v-model="queryParam.deviceManagementName"></a-input>
|
</a-form-item>
|
</a-col>
|
|
<a-col :md="4" :sm="4">
|
<a-space>
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
|
</a-space>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!-- 操作按钮区域 -->
|
<div class="table-operator" style="border-top: 5px">
|
<a-button @click="handleAdd" type="primary" icon="plus">添加设备类</a-button>
|
<!-- <a-button type="primary" icon="download" @click="handleExportXls('设备类信息')">导出</a-button>-->
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
<a-menu slot="overlay" @click="handleMenuClick">
|
<a-menu-item key="1">
|
<a-icon type="delete" @click="batchDel"/>
|
删除
|
</a-menu-item>
|
</a-menu>
|
<a-button style="margin-left: 8px">
|
批量操作
|
<a-icon type="down"/>
|
</a-button>
|
</a-dropdown>
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
<i class="anticon anticon-info-circle ant-alert-icon"></i>已选择 <a style="font-weight: 600">{{
|
selectedRowKeys.length
|
}}</a>项
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
</div>
|
|
<a-table
|
ref="table"
|
bordered
|
size="middle"
|
rowKey="id"
|
:scroll="{y:465}"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
@change="handleTableChange">
|
<template slot="action" slot-scope="text, record">
|
<a @click="handleEdit(record)">编辑</a>
|
|
<a-divider type="vertical"/>
|
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</template>
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
<DeviceCustomTypeManagementModal ref="modalForm" :workshopTreeData="workshopTreeData" @ok="loadData"/>
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import dncApi from '@/api/dnc'
|
import DeviceCustomTypeManagementModal
|
from '@views/dnc/base/modules/DeviceCustomTypeManagement/DeviceCustomTypeManagementModal.vue'
|
|
export default {
|
name: 'DeviceCustomTypeManagement',
|
mixins: [JeecgListMixin],
|
components: {
|
DeviceCustomTypeManagementModal
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 60,
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '车间',
|
align: 'center',
|
width: 200,
|
dataIndex: 'productionId_dictText'
|
},
|
{
|
title: '设备类',
|
align: 'center',
|
width: 200,
|
dataIndex: 'deviceManagementCode'
|
},
|
{
|
title: '设备类名称',
|
align: 'center',
|
width: 200,
|
dataIndex: 'deviceManagementName'
|
},
|
{
|
title: '设备组编号',
|
align: 'center',
|
dataIndex: 'equipmentIds',
|
width: 400,
|
ellipsis: true
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' },
|
align: 'center',
|
width: 80
|
}
|
],
|
url: {
|
list: '/nc/deviceManagement/query',
|
delete: '/nc/deviceManagement/delete',
|
deleteBatch: '/nc/deviceManagement/deleteBatch'
|
},
|
workshopTreeData: []
|
}
|
},
|
created() {
|
this.getWorkshopListByApi()
|
},
|
methods: {
|
// 调用接口获取查询区域车间树列表
|
getWorkshopListByApi() {
|
dncApi.getHasPermissionWorkshopTreeApi()
|
.then(res => {
|
if (res.success) {
|
this.workshopTreeData = res.result
|
}
|
})
|
},
|
|
handleAdd: function() {
|
this.$refs.modalForm.add()
|
this.$refs.modalForm.title = '新增'
|
this.$refs.modalForm.disabledEdit = false
|
},
|
|
handleEdit: function(record) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disabledEdit = true
|
},
|
|
handleMenuClick(e) {
|
if (e.key == 1) {
|
this.batchDel()
|
}
|
}
|
}
|
}
|
</script>
|