<template>
|
<a-card
|
title=""
|
:bordered="false"
|
>
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form
|
layout="inline"
|
@keyup.enter.native="searchQuery"
|
>
|
<a-row :gutter="24">
|
<a-col
|
:xl="6"
|
:lg="7"
|
:md="8"
|
:sm="24"
|
>
|
<a-form-item label="单据号">
|
<j-input
|
placeholder="请输入单据号"
|
v-model="queryParam.num"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<!-- 按创建时间范围检索 -->
|
<a-col
|
:xl="6"
|
:lg="7"
|
:md="8"
|
:sm="24">
|
<a-form-item label="创建时间">
|
<a-range-picker
|
v-model="ranges"
|
style="width:100%"
|
format="YYYY-MM-DD HH:mm:ss"
|
showTime
|
placeholder="请选择创建时间"
|
@change="changeDate"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:xl="6"
|
:lg="7"
|
:md="8"
|
:sm="24"
|
>
|
<a-form-item label="保养类型">
|
<j-dict-select-tag
|
placeholder="请选择保养类型"
|
v-model="queryParam.type"
|
dictCode="maintenance_type"
|
/>
|
</a-form-item>
|
</a-col>
|
|
|
<a-col
|
:xl="6"
|
:lg="7"
|
:md="8"
|
:sm="24"
|
>
|
<span
|
style="float: left;overflow: hidden;"
|
class="table-page-search-submitButtons"
|
>
|
<a-button
|
type="primary"
|
@click="searchQuery"
|
icon="search"
|
>查询</a-button>
|
<a-button
|
type="primary"
|
@click="searchReset"
|
icon="reload"
|
style="margin-left: 8px"
|
>重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 查询区域-END -->
|
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<a-button
|
@click="handleAdd"
|
type="primary"
|
icon="plus"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
>新增</a-button>
|
</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"
|
size="middle"
|
bordered
|
rowKey="id"
|
class="j-table-force-nowrap"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
|
:customRow="clickThenSelect"
|
@change="handleTableChange"
|
>
|
<!-- :scroll="{x:true}" -->
|
|
<template
|
slot="htmlSlot"
|
slot-scope="text"
|
>
|
<div v-html="text"></div>
|
</template>
|
<template
|
slot="imgSlot"
|
slot-scope="text,record"
|
>
|
<span
|
v-if="!text"
|
style="font-size: 12px;font-style: italic;"
|
>无图片</span>
|
<img
|
v-else
|
:src="getImgView(text)"
|
:preview="record.id"
|
height="25px"
|
alt=""
|
style="max-width:80px;font-size: 12px;font-style: italic;"
|
/>
|
</template>
|
<template
|
slot="fileSlot"
|
slot-scope="text"
|
>
|
<span
|
v-if="!text"
|
style="font-size: 12px;font-style: italic;"
|
>无文件</span>
|
<a-button
|
v-else
|
:ghost="true"
|
type="primary"
|
icon="download"
|
size="small"
|
@click="downloadFile(text)"
|
>
|
下载
|
</a-button>
|
</template>
|
|
<span
|
slot="action"
|
slot-scope="text, record"
|
>
|
<a
|
@click="handleEdit(record)"
|
v-if="record.status==='created'||record.status==='rejected'"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
>编辑</a>
|
<a-divider
|
type="vertical"
|
v-if="record.status==='created'||record.status==='rejected'"
|
/>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
v-if="record.status==='created'||record.status==='rejected'"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
<a-divider
|
type="vertical"
|
v-if="record.status==='created'||record.status==='rejected'"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
/>
|
<a-popconfirm
|
title="提交后不可撤回,确定提交吗?"
|
@confirm="() => handleSubmit(record)"
|
v-if="record.status==='created'||record.status==='rejected'"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
>
|
<a>提交</a>
|
</a-popconfirm>
|
<a-divider
|
type="vertical"
|
v-if="record.status==='created'||record.status==='rejected'"
|
v-has="'MaintenancePlan:add&edit&submit'"
|
/>
|
<a-popconfirm
|
title="通过后不可撤销,确定通过吗?"
|
@confirm="() => handleAudit(record)"
|
v-if="record.status==='submitted'"
|
v-has="'MaintenancePlan:audit&reject'"
|
>
|
<a>通过</a>
|
</a-popconfirm>
|
<a-divider
|
type="vertical"
|
v-if="record.status==='submitted'"
|
v-has="'MaintenancePlan:audit&reject'"
|
/>
|
<a-popconfirm
|
title="确定驳回吗?"
|
@confirm="() => handleReject(record)"
|
v-if="record.status==='submitted'"
|
v-has="'MaintenancePlan:audit&reject'"
|
>
|
<a>驳回</a>
|
</a-popconfirm>
|
<a-divider
|
type="vertical"
|
v-if="record.status==='submitted'"
|
v-has="'MaintenancePlan:audit&reject'"
|
/>
|
<a-popconfirm
|
title="下发后不可撤销,确定下发吗?"
|
@confirm="() => handleDistrbute(record)"
|
v-if="record.status==='passed'"
|
v-has="'MaintenancePlan:distribute'"
|
>
|
<a>下发</a>
|
</a-popconfirm>
|
<span
|
v-if="record.status==='distributed'"
|
style="font-size: 12px;font-style: italic;"
|
>已生成工单</span>
|
</span>
|
|
</a-table>
|
</div>
|
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane
|
tab="保养计划明细"
|
key="1"
|
>
|
<EquipmentMaintenancePlanDetailList
|
:mainId="equipmentMaintenancePlanDetailMainId"
|
:mainStatus="mainStatus"
|
/>
|
</a-tab-pane>
|
</a-tabs>
|
|
<equipmentMaintenancePlan-modal
|
ref="modalForm"
|
@ok="modalFormOk"
|
></equipmentMaintenancePlan-modal>
|
</a-card>
|
</template>
|
|
<script>
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import EquipmentMaintenancePlanModal from './modules/maintenancePlan/EquipmentMaintenancePlanModal'
|
import { getAction } from '@/api/manage'
|
import EquipmentMaintenancePlanDetailList from './EquipmentMaintenancePlanDetailList'
|
import '@/assets/less/TableExpand.less'
|
import { putAction } from '../../api/manage'
|
|
export default {
|
name: "EquipmentMaintenancePlanList",
|
mixins: [JeecgListMixin],
|
components: {
|
EquipmentMaintenancePlanDetailList,
|
EquipmentMaintenancePlanModal
|
},
|
data() {
|
return {
|
description: '保养计划管理页面',
|
ranges:[],
|
// 表头
|
columns: [
|
{
|
title: '计划单号',
|
align: "center",
|
dataIndex: 'num',
|
},
|
{
|
title: '计划单类型',
|
align: "center",
|
dataIndex: 'type_dictText',
|
},
|
{
|
title: '计划单状态',
|
align: "center",
|
dataIndex: 'status_dictText',
|
},
|
{
|
title: '设备数量',
|
align: "center",
|
dataIndex: 'equipNo',
|
},
|
{
|
title: '创建人',
|
align: "center",
|
dataIndex: 'createBy',
|
},
|
{
|
title: '创建时间',
|
align: "center",
|
dataIndex: 'createTime',
|
},
|
// {
|
// title: '修改人',
|
// align: "center",
|
// dataIndex: 'updateBy',
|
// width: 200,
|
// },
|
// {
|
// title: '修改时间',
|
// align: "center",
|
// dataIndex: 'updateTime',
|
// width: 200,
|
// },
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align: "center",
|
scopedSlots: { customRender: 'action' },
|
}
|
// fixed: "right",
|
// width: 200,
|
],
|
url: {
|
list: "/eam/equipmentMaintenancePlan/list",
|
delete: "/eam/equipmentMaintenancePlan/delete",
|
deleteBatch: "/eam/equipmentMaintenancePlan/deleteBatch",
|
exportXlsUrl: "/eam/equipmentMaintenancePlan/exportXls",
|
importExcelUrl: "eam/equipmentMaintenancePlan/importExcel",
|
submit: "eam/equipmentMaintenancePlan/submit",
|
reject: "eam/equipmentMaintenancePlan/reject",
|
distrbute: "eam/equipmentMaintenancePlan/distrbute",
|
audit: "eam/equipmentMaintenancePlan/audit"
|
},
|
dictOptions: {
|
},
|
/* 分页参数 */
|
ipagination: {
|
current: 1,
|
pageSize: 20,
|
pageSizeOptions: ['5', '10', '20', '50'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
selectedMainId: '',
|
superFieldList: [],
|
equipmentMaintenancePlanDetailMainId: '',
|
mainStatus: '',
|
}
|
},
|
created() {
|
this.getSuperFieldList();
|
},
|
computed: {
|
importExcelUrl: function () {
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
}
|
},
|
methods: {
|
initDictConfig() {
|
},
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(","), [record]);
|
}
|
}
|
}
|
},
|
onClearSelected() {
|
this.selectedRowKeys = [];
|
this.selectionRows = [];
|
this.selectedMainId = ''
|
},
|
onSelectChange(selectedRowKeys, selectionRows) {
|
this.selectedMainId = selectedRowKeys[0]
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectionRows;
|
this.equipmentMaintenancePlanDetailMainId = selectionRows[0]['id']
|
this.mainStatus = selectionRows[0]['status']
|
},
|
searchReset() {
|
this.queryParam = {}
|
this.ranges = []
|
this.loadData()
|
},
|
loadData(arg) {
|
if (!this.url.list) {
|
this.$message.error("请设置url.list属性!")
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
this.onClearSelected()
|
var params = this.getQueryParams();//查询条件
|
this.loading = true;
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records;
|
this.ipagination.total = res.result.total;
|
}
|
if (res.code === 510) {
|
this.$message.warning(res.message)
|
}
|
this.loading = false;
|
})
|
},
|
getSuperFieldList() {
|
let fieldList = [];
|
fieldList.push({ type: 'string', value: 'num', text: '计划单号', dictCode: '' })
|
fieldList.push({ type: 'string', value: 'type', text: '计划单类型(数据字典:maintenance_plan_type)', dictCode: '' })
|
fieldList.push({ type: 'string', value: 'status', text: '计划单状态(数据字典:maintenance_plan_type)', dictCode: '' })
|
fieldList.push({ type: 'int', value: 'equipNo', text: '设备数量', dictCode: '' })
|
fieldList.push({ type: 'string', value: 'createBy', text: 'createBy', dictCode: '' })
|
fieldList.push({ type: 'date', value: 'createTime', text: 'createTime' })
|
fieldList.push({ type: 'string', value: 'updateBy', text: 'updateBy', dictCode: '' })
|
fieldList.push({ type: 'date', value: 'updateTime', text: 'updateTime' })
|
this.superFieldList = fieldList
|
},
|
handleSubmit(record) {
|
this.loading = true;
|
putAction(this.url.submit, record).then(res => {
|
if (res.success) {
|
this.$message.success("操作成功");
|
} else {
|
this.$message.success("操作失败");
|
|
}
|
}).finally(res => {
|
this.loadData();
|
})
|
},
|
handleAudit(record) {
|
this.loading = true;
|
putAction(this.url.audit, record).then(res => {
|
if (res.success) {
|
this.$message.success("操作成功");
|
} else {
|
this.$message.success("操作失败");
|
}
|
}).finally(res => {
|
this.loadData();
|
})
|
},
|
handleDistrbute(record) {
|
this.loading = true;
|
putAction(this.url.distrbute, record).then(res => {
|
if (res.success) {
|
this.$message.success("操作成功");
|
} else {
|
this.$message.success("操作失败");
|
}
|
}).finally(res => {
|
this.loadData();
|
})
|
},
|
handleReject(record) {
|
this.loading = true;
|
putAction(this.url.reject, record).then(res => {
|
if (res.success) {
|
this.$message.success("操作成功");
|
} else {
|
this.$message.success("操作失败");
|
}
|
}).finally(res => {
|
this.loadData();
|
})
|
},
|
// 将ranges转化为开始时间和结束时间
|
changeDate() {
|
if (this.ranges.length === 0) {
|
this.queryParam.beginTime = ''
|
this.queryParam.endTime = ''
|
} else {
|
//后端报这个错rejected value ["2024-03-14T06:26:38.692Z"]
|
this.queryParam.beginTime = this.ranges[0].format('YYYY-MM-DD')
|
this.queryParam.endTime = this.ranges[1].format('YYYY-MM-DD')
|
}
|
},
|
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less';
|
</style>
|