<template>
|
<a-card
|
:bordered='false'
|
class='card-area'
|
>
|
<template slot='title'>
|
<i
|
class='action-jeecg actionsite2'
|
style='font-size: 18px;'
|
/>
|
原因明细
|
</template>
|
<!-- 查询区域 -->
|
<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='故障类型编码'>
|
<a-input
|
placeholder='请输入故障类型编码查询'
|
v-model='queryParam.num'
|
></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md='8'
|
:sm='8'
|
>
|
<a-form-item label='故障类型名称'>
|
<a-input
|
placeholder='请输入故障类型名称查询'
|
v-model='queryParam.name'
|
></a-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'
|
>新增
|
</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>
|
|
<a-table
|
ref='table'
|
bordered
|
size='middle'
|
rowKey='id'
|
:columns='columns'
|
:dataSource='dataSource'
|
:pagination='ipagination'
|
:loading='loading'
|
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps:getCheckboxProps}'
|
@change='handleTableChange'
|
:scroll="{ x: true}"
|
>
|
<template slot="num" slot-scope="text" >
|
<a-tooltip placement="top" :title="text" trigger="hover">
|
<div>
|
<template slot="title"> </template>
|
<p style="cusor:pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 130px;">{{ text }}</p>
|
</div>
|
</a-tooltip>
|
</template>
|
<template slot="name" slot-scope="text" >
|
<a-tooltip placement="top" :title="text" trigger="hover">
|
<div>
|
<template slot="title"> </template>
|
<p style="cusor:pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 130px;">{{ text }}</p>
|
</div>
|
</a-tooltip>
|
</template>
|
<!--状态栏个性展示-->
|
<!-- <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'
|
>
|
<!-- class="table-operation" -->
|
<a
|
href='javascript:;'
|
@click='handleDetail(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 @click='handleEdit(record)'>编辑</a>
|
</a-menu-item>
|
|
<a-menu-item v-if='record.faultTypeList.length==0'>
|
<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-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>
|
<fault-type-model
|
ref='modalForm'
|
@ok='modalFormOk'
|
></fault-type-model>
|
</a-card>
|
</template>
|
|
<script>
|
import { requestPut, deleteAction } from '@/api/manage'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import FaultTypeModel from './FaultTypeModel'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
|
export default {
|
name: 'FaultType2List',
|
mixins: [JeecgListMixin],
|
components: {
|
FaultTypeModel,
|
JInput,
|
JEllipsis
|
},
|
props: {
|
nodeSelected: {
|
type: Object,
|
default: {}
|
}
|
},
|
data() {
|
return {
|
dataSource: [],
|
//默认排序
|
isorter: {
|
column: 'num',
|
order: 'asc'
|
},
|
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
},
|
width: 50
|
},
|
/* {
|
title: '上级故障类型编码',
|
align: 'center',
|
dataIndex: 'parentNum'
|
},
|
{
|
title: '上级故障类型名称',
|
|
align: 'center',
|
dataIndex: 'parentName'
|
}, */
|
{
|
title: '故障类型编码',
|
align: 'center',
|
dataIndex: 'num',
|
scopedSlots: { customRender: 'num' },
|
width: 100,
|
ellipsis: true,
|
// scopedSlots: {
|
// customRender: 'num'
|
// },
|
// sorter: true
|
},
|
{
|
title: '故障类型名称',
|
width: 100,
|
align: 'center',
|
dataIndex: 'name',
|
scopedSlots: {
|
customRender: 'name'
|
},
|
ellipsis: true,
|
sorter: true
|
},
|
{
|
title: '创建人',
|
align: 'center',
|
dataIndex: 'createBy'
|
},
|
{
|
title: '创建时间',
|
align: 'center',
|
dataIndex: 'createTime'
|
},
|
{
|
title: '修改人',
|
align: 'center',
|
dataIndex: 'updateBy'
|
},
|
{
|
title: '修改时间',
|
align: 'center',
|
dataIndex: 'updateTime'
|
},
|
{
|
title: '备注',
|
align: 'center',
|
dataIndex: 'remark'
|
},
|
|
// {
|
// title: '状态',
|
// align: 'center',
|
// dataIndex: 'status',
|
// scopedSlots: {
|
// customRender: 'status',
|
// },
|
// sorter: true,
|
// width: 100,
|
// },
|
{
|
title: '操作',
|
align: 'center',
|
dataIndex: 'action',
|
scopedSlots: {
|
customRender: 'action'
|
},
|
width: 150,
|
fixed: 'right',
|
},
|
],
|
url: {
|
list: '/eam/faultType/list',
|
delete: '/eam/faultType/delete',
|
deleteBatch: '/eam/faultType/deleteBatch',
|
active: '/eam/faultType/active',
|
exportXlsUrl: '/eam/faultType/exportXls'
|
// importExcelUrl: 'base/site/importExcel',
|
},
|
//新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
|
|
alterFlag: "",
|
parentNum: "-1",
|
parentName: "故障类型",
|
}
|
},
|
methods: {
|
|
getCheckboxProps(record) {
|
return ({
|
props: {
|
// disabled: !(record.faultCauseDtlList.length == 0),
|
}
|
})
|
},
|
|
//禁用状态样式
|
tableRowClass(record, index) {
|
if (record.status != '1') {
|
return 'frozenRowClass'
|
}
|
return ''
|
},
|
|
handleActive(id) {
|
let that = this
|
requestPut(that.url.active, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message)
|
that.loadData()
|
} else {
|
that.$message.warning(res.message)
|
}
|
})
|
},
|
handleAdd: function () {
|
this.$refs.modalForm.add({ parentNum: this.parentNum, parentName: this.parentName });
|
this.$refs.modalForm.title = "新增";
|
this.$refs.modalForm.disableSubmit = false;
|
this.$refs.modalForm.parentId = this.nodeSelected.key;
|
},
|
handleDelete: function (id) {
|
if (!this.url.delete) {
|
this.$message.error('请设置url.delete属性!')
|
return
|
}
|
var that = this
|
deleteAction(that.url.delete, { id: id }).then((res) => {
|
if (res.success) {
|
//重新计算分页问题
|
that.reCalculatePage(1)
|
that.$message.success(res.message)
|
that.loadData()
|
that.alterFlag = new Date()
|
} else {
|
that.$message.warning(res.message)
|
}
|
})
|
},
|
|
batchDel: function () {
|
if (!this.url.deleteBatch) {
|
this.$message.error('请设置url.deleteBatch属性!')
|
return
|
}
|
if (this.selectedRowKeys.length <= 0) {
|
this.$message.warning('请选择一条记录!')
|
return
|
} else {
|
var ids = ''
|
for (var a = 0; a < this.selectedRowKeys.length; a++) {
|
ids += this.selectedRowKeys[a] + ','
|
}
|
var that = this
|
this.$confirm({
|
title: '确认删除',
|
content: '是否删除选中数据?',
|
onOk: function () {
|
that.loading = true
|
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
|
if (res.success) {
|
//重新计算分页问题
|
that.reCalculatePage(that.selectedRowKeys.length)
|
that.$message.success(res.message)
|
that.loadData()
|
that.onClearSelected()
|
that.alterFlag = new Date()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.loading = false
|
})
|
}
|
})
|
}
|
},
|
|
searchReset() {
|
this.queryParam = {}
|
this.queryParam.id = this.nodeSelected.key
|
this.loadData(1)
|
}
|
},
|
watch: {
|
alterFlag() {
|
this.$bus.$emit('queryTreeData')
|
},
|
nodeSelected() {
|
this.queryParam = {}
|
this.queryParam.id = this.nodeSelected.key
|
this.parentNum = !this.nodeSelected.rfield1 ? '-1' : this.nodeSelected.rfield1
|
this.parentName = !this.nodeSelected.rfield2 ? '故障原因' : this.nodeSelected.rfield2
|
this.loadData(1)
|
}
|
},
|
created() {
|
this.queryParam = {}
|
this.queryParam.id = this.nodeSelected.key
|
this.loadData(1)
|
}
|
|
|
}
|
</script>
|
<style>
|
@import '~@assets/less/common.less';
|
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
|
.success {
|
color: green;
|
}
|
|
.error {
|
color: red;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
</style>
|