<template>
|
<a-card
|
:bordered='false'
|
title='停机原因'
|
>
|
<!-- 查询区域 -->
|
<div class='table-page-search-wrapper'>
|
<a-form
|
layout='inline'
|
@keyup.enter.native='searchQuery'
|
>
|
<a-row :gutter='24'>
|
<a-col
|
:md='8'
|
:sm='8'
|
>
|
<a-form-item label='停机编码'>
|
<j-input
|
placeholder='请输入停机编码'
|
v-model='queryParam.num'
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md='8'
|
:sm='8'
|
>
|
<a-form-item label='停机名称'>
|
<j-input
|
placeholder='请输入停机名称'
|
v-model='queryParam.name'
|
></j-input>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!-- 操作按钮区域 -->
|
<div
|
class='table-operator'
|
style='margin-top: 5px'
|
>
|
<a-button
|
type='primary'
|
@click='searchQuery'
|
icon='search'
|
>查询
|
</a-button>
|
<a-button
|
@click='searchReset'
|
icon='reload'
|
>重置
|
</a-button>
|
<a-button
|
@click='handleAdd'
|
type='primary'
|
icon='plus'
|
:hidden='disabled'
|
>新增
|
</a-button>
|
<a-button
|
type='primary'
|
icon='download'
|
@click="handleExportXls('原因')"
|
>导出
|
</a-button>
|
<a-dropdown v-if='selectedRowKeys.length > 0'>
|
<a-button style='margin-left: 8px'>
|
批量操作
|
<a-icon type='down' />
|
</a-button>
|
<a-menu slot='overlay'>
|
<a-menu-item @click='batchDel'>
|
<a-icon type='delete' />
|
删除
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
ref='table'
|
bordered
|
size='middle'
|
rowKey='id'
|
:columns='columns'
|
:rowClassName='tableRowClass'
|
:dataSource='dataSource'
|
:pagination='ipagination'
|
:loading='loading'
|
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
@change='handleTableChange'
|
:scroll="{ x: 'calc(1200px + 50%)', y: 900 }"
|
>
|
<!--字符串超长截取省略号显示-->
|
<span
|
slot='num'
|
slot-scope='text'
|
style='font-weight: bold'
|
>
|
<j-ellipsis
|
:value='text'
|
:length='15'
|
/>
|
</span>
|
<span
|
slot='name'
|
slot-scope='text'
|
style='font-weight: bold'
|
>
|
<j-ellipsis
|
:value='text'
|
:length='15'
|
/>
|
</span>
|
<span
|
slot='model'
|
slot-scope='text'
|
>
|
<j-ellipsis
|
:value='text'
|
:length='15'
|
/>
|
</span>
|
<!-- <span
|
slot="status"
|
slot-scope="text,record"
|
>
|
<a-badge
|
v-if="record.status==1"
|
status="success"
|
/>
|
<span
|
v-if="record.status==1"
|
class="success"
|
>启用</span>
|
<a-badge
|
v-if="record.status==0"
|
status="error"
|
/>
|
<span
|
v-if="record.status==0"
|
class="error"
|
>禁用</span>
|
</span> -->
|
|
<span
|
slot='action'
|
slot-scope='text, record'
|
>
|
<a @click='handleEdit(record)'>编辑</a>
|
<a-divider type='vertical' />
|
<a-dropdown>
|
<a class='ant-dropdown-link'>
|
更多
|
<a-icon type='down' />
|
</a>
|
<a-menu slot='overlay'>
|
<a-menu-item>
|
<a
|
href='javascript:;'
|
@click='handleDetail(record)'
|
>详情</a>
|
</a-menu-item>
|
|
<a-menu-item>
|
<a-popconfirm
|
title='确定删除吗?'
|
@confirm='() => handleDelete(record.id)'
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<!-- <a-menu-item v-else>
|
<a-popconfirm title="当前信息已被引用,请先删除关联信息后再执行删除操作">
|
<a class="frozenRowClass">删除</a>
|
</a-popconfirm>
|
</a-menu-item> -->
|
|
<!-- <a-menu-item v-if="record.status==1">
|
<a-popconfirm
|
title="确定禁用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>禁用</a>
|
</a-popconfirm>
|
</a-menu-item> -->
|
<!-- <a-menu-item v-if="record.status==0">
|
<a-popconfirm
|
title="确定启用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item> -->
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
<shut-down-cause-model
|
ref='modalForm'
|
@ok='modalFormOk'
|
:nodeSelected='nodeSelected'
|
></shut-down-cause-model>
|
</a-card>
|
</template>
|
|
<script>
|
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import { requestPut } from '@/api/manage'
|
import ShutDownCauseModel from './ShutDownCauseModel'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
|
export default {
|
name: 'ShutdownCauseRight',
|
mixins: [JeecgListMixin],
|
components: {
|
Tooltip,
|
ShutDownCauseModel,
|
JDictSelectTag,
|
JInput,
|
JEllipsis
|
},
|
props: {
|
recordSelect: {}
|
},
|
data() {
|
return {
|
disabled: true,
|
nodeSelected: {},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
},
|
width: 50
|
},
|
{
|
title: '停机编码',
|
align: 'center',
|
dataIndex: 'num'
|
},
|
{
|
title: '停机名称',
|
align: 'center',
|
dataIndex: 'name'
|
|
|
},
|
{
|
title: '停机分类',
|
align: 'center',
|
dataIndex: 'shutdownCategoryNumName'
|
|
},
|
{
|
title: '停机原因',
|
align: 'center',
|
dataIndex: 'shutdownReason'
|
|
// sorter: true,
|
},
|
{
|
title: '创建人',
|
align: 'center',
|
dataIndex: 'createBy'
|
},
|
{
|
title: '创建时间',
|
align: 'center',
|
dataIndex: 'createTime'
|
},
|
{
|
title: '修改人',
|
align: 'center',
|
dataIndex: 'updateBy'
|
},
|
{
|
title: '修改时间',
|
align: 'center',
|
dataIndex: 'updateTime'
|
},
|
{
|
|
title: '操作',
|
dataIndex: 'action',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'action'
|
},
|
width: 150,
|
fixed: 'right'
|
}
|
],
|
url: {
|
list: '/eam/shutdownCause/list',
|
delete: '/eam/shutdownCause/delete',
|
deleteBatch: '/eam/shutdownCause/deleteBatch',
|
exportXlsUrl: '/eam/shutdownCause/exportXls',
|
importExcelUrl: 'eam/shutdownCause/importExcel'
|
}
|
}
|
},
|
|
|
methods: {
|
handleAdd: function() {
|
this.$refs.modalForm.add({ shutdownCategoryNumName: this.shutdownCategoryNumName })
|
this.$refs.modalForm.title = '新增'
|
this.$refs.modalForm.disableSubmit = false
|
this.$refs.modalForm.shutdownCategoryId = this.nodeSelected.key
|
},
|
//禁用状态样式
|
tableRowClass(record, index) {
|
if (record.status != '1') {
|
return 'frozenRowClass'
|
}
|
return ''
|
},
|
searchReset() {
|
if ('-1' != this.nodeSelected.key) {
|
this.disabled = false
|
this.queryParam = []
|
this.queryParam.shutdownCategoryId = this.nodeSelected.key
|
} else {
|
this.disabled = true
|
this.queryParam = []
|
}
|
this.loadData(1)
|
}
|
},
|
watch: {
|
recordSelect(val) {
|
this.nodeSelected = val
|
this.shutdownCategoryNumName = this.nodeSelected.rfield1 + '/' + this.nodeSelected.rfield2
|
if ('-1' != this.nodeSelected.key) {
|
this.disabled = false
|
this.queryParam = []
|
this.queryParam.shutdownCategoryId = this.nodeSelected.key
|
} else {
|
this.disabled = true
|
this.queryParam = []
|
}
|
this.loadData(1)
|
}
|
}
|
|
}
|
</script>
|
|
<style lang='less' scoped>
|
@import '~@assets/less/common.less';
|
|
/deep/ .frozenRowClass {
|
color: #c9c9c9;
|
}
|
|
/deep/ .success {
|
color: green;
|
}
|
|
/deep/ .error {
|
color: red;
|
}
|
|
/deep/ .notShow {
|
display: none;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
</style>
|