<template>
|
<div class="page">
|
<div class="page-title">
|
<div>
|
<h2>XCB助理派单</h2>
|
<p>显示JCC处长审批完成且未派单的故障,按承修单位一键生成派工单</p>
|
</div>
|
<el-button type="primary" icon="el-icon-s-promotion" :disabled="selection.length === 0" @click="dispatch">一键派单</el-button>
|
</div>
|
|
<div class="toolbar">
|
<el-input v-model="keyword" placeholder="故障编号 / 装备名称 / 工程名称及损坏情况" clearable style="width:320px" @keyup.enter.native="load"></el-input>
|
<el-button type="primary" icon="el-icon-search" @click="load">查询</el-button>
|
<el-button icon="el-icon-refresh" @click="load">刷新</el-button>
|
<div class="spacer"></div>
|
<span class="selection-tip">已选择 {{ selection.length }} 条故障</span>
|
</div>
|
|
<el-alert :closable="false" type="info" show-icon title="一个故障有多个承修单位时,将分别生成派工单;编号从“故障编号/01”开始依次编号。" style="margin-bottom:12px"></el-alert>
|
|
<div class="table-panel">
|
<el-table :data="rows" border stripe height="calc(100vh - 325px)" @selection-change="selection = $event">
|
<el-table-column type="selection" width="46"></el-table-column>
|
<el-table-column prop="faultCode" label="故障编号" width="180" fixed></el-table-column>
|
<el-table-column prop="xNo" label="X号" width="64"></el-table-column>
|
<el-table-column prop="equipmentName" label="装备名称" min-width="210" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="engineeringMajor" label="工程专业" width="100"></el-table-column>
|
<el-table-column prop="parentSystem" label="所属上级系统" min-width="130"></el-table-column>
|
<el-table-column prop="contractorNames" label="承修单位" min-width="210" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="reportUnit" label="上报单位" min-width="120"></el-table-column>
|
<el-table-column prop="reportDate" label="上报时间" width="110"></el-table-column>
|
<el-table-column prop="xcbReviewTime" label="XCB审核时间" width="160">
|
<template slot-scope="{ row }">{{ formatTime(row.xcbReviewTime) }}</template>
|
</el-table-column>
|
<el-table-column prop="teamMajor" label="T队专业" width="100"></el-table-column>
|
<el-table-column prop="owner" label="负责人" width="90"></el-table-column>
|
<el-table-column prop="requestedFinishDate" label="要求完工日期" width="120"></el-table-column>
|
<el-table-column prop="faultImpact" label="故障影响" width="100"></el-table-column>
|
<el-table-column prop="faultNature" label="故障性质" width="90"></el-table-column>
|
<el-table-column prop="engineeringNameDesc" label="工程名称及损坏情况" min-width="220" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="repairRequirement" label="修理技术要求" min-width="200" show-overflow-tooltip></el-table-column>
|
</el-table>
|
</div>
|
|
<el-dialog title="派工单生成结果" :visible.sync="resultVisible" width="760px" append-to-body>
|
<el-table :data="createdOrders" border size="mini" max-height="380">
|
<el-table-column prop="workOrderNo" label="派工单编号" width="160"></el-table-column>
|
<el-table-column prop="faultCode" label="故障编号" width="180"></el-table-column>
|
<el-table-column prop="contractorName" label="承修单位" min-width="180"></el-table-column>
|
<el-table-column prop="equipmentName" label="装备名称" min-width="210" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="completionStatus" label="完工状态" width="100">
|
<template slot-scope="{ row }"><el-tag size="mini" type="info">{{ completionMeta(row.completionStatus).text }}</el-tag></template>
|
</el-table-column>
|
</el-table>
|
<template slot="footer"><el-button type="primary" @click="resultVisible = false">关闭</el-button></template>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import api from '@/api'
|
import { completionStatuses, statusMeta } from '@/utils/dict'
|
export default {
|
name: 'DispatchPage',
|
data() {
|
return { rows: [], selection: [], keyword: '', createdOrders: [], resultVisible: false }
|
},
|
created() { this.load() },
|
methods: {
|
completionMeta(value) { return statusMeta(completionStatuses, value) },
|
formatTime(value) { return value ? String(value).replace('T', ' ').slice(0, 19) : '-' },
|
load() {
|
api.get('/faults/dispatchable', { params: { keyword: this.keyword } }).then(res => { this.rows = res.data || [] })
|
},
|
dispatch() {
|
const names = this.selection.map(item => item.faultCode).join('、')
|
this.$confirm(`确定对 ${names} 一键派单吗?`, '派单确认', { type: 'warning' }).then(() => {
|
return api.post('/faults/dispatch', { faultIds: this.selection.map(item => item.id) })
|
}).then(res => {
|
this.createdOrders = res.data || []
|
this.resultVisible = true
|
this.load()
|
}).catch(() => {})
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.selection-tip { color: #6d7f91; font-size: 13px; }
|
</style>
|