zzw
11 小时以前 145fd1abd1e77e142982da48064b98f1e436dc6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
  <div class="page">
    <div class="page-title">
      <div>
        <h2>{{ pageTitle }}</h2>
        <p>{{ subtitle }}</p>
      </div>
      <el-button type="primary" icon="el-icon-s-check" :disabled="selection.length === 0" @click="openApproval">批量审批</el-button>
    </div>
 
    <div class="toolbar">
      <el-input v-model="keyword" placeholder="故障编号 / 装备名称 / 工程名称及损坏情况" clearable style="width:320px" @keyup.enter.native="load"></el-input>
      <el-button icon="el-icon-search" type="primary" @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>
 
    <div class="table-panel">
      <el-table :data="rows" border stripe height="calc(100vh - 270px)" :header-cell-style="{ textAlign: 'center' }" @selection-change="selection = $event">
        <el-table-column type="selection" width="46"></el-table-column>
        <el-table-column prop="taskStatus" label="任务状态" width="145" fixed>
          <template slot-scope="{ row }"><el-tag size="mini" :type="taskMeta(row.taskStatus).type">{{ taskMeta(row.taskStatus).text }}</el-tag></template>
        </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="parentSystem" label="所属上级系统" min-width="120"></el-table-column>
        <el-table-column prop="engineeringNameDesc" label="工程名称及损坏情况" min-width="210" show-overflow-tooltip></el-table-column>
        <el-table-column prop="repairRequirement" label="修理技术要求" min-width="200" show-overflow-tooltip></el-table-column>
        <el-table-column prop="engineeringMajor" label="工程专业" width="100"></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="reportUnit" label="上报单位" min-width="130"></el-table-column>
        <el-table-column prop="reportDate" label="上报日期" width="110" align="center"></el-table-column>
        <el-table-column prop="faultImpact" label="故障影响" width="100"></el-table-column>
        <el-table-column prop="faultNature" label="故障性质" width="100" align="center"></el-table-column>
        <el-table-column prop="majorFaultDesc" label="重大故障描述" min-width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="是否自修" width="90" align="center">
          <template slot-scope="{ row }">{{ yesNo(row.isSelfRepair) }}</template>
        </el-table-column>
        <el-table-column label="是否涉H" width="90" align="center">
          <template slot-scope="{ row }">{{ yesNo(row.isHRelated) }}</template>
        </el-table-column>
        <el-table-column label="监测项目" width="90" align="center">
          <template slot-scope="{ row }">{{ yesNo(row.isMonitorItem) }}</template>
        </el-table-column>
        <el-table-column prop="monitorValue" label="监测数值" width="110" show-overflow-tooltip></el-table-column>
        <el-table-column prop="requestedFinishDate" label="要求完工日期" width="120" align="center"></el-table-column>
        <el-table-column prop="remark" label="备注" min-width="130" show-overflow-tooltip></el-table-column>
        <el-table-column prop="contractorNames" label="承修单位" min-width="160" show-overflow-tooltip></el-table-column>
      </el-table>
    </div>
 
    <el-dialog :title="pageTitle + '表单'" :visible.sync="dialogVisible" width="620px" append-to-body>
      <el-form label-width="90px">
        <el-form-item label="审批故障">
          <div class="selected-list">{{ selectedCodes }}</div>
        </el-form-item>
        <el-form-item label="审批结果">
          <el-radio-group v-model="form.result">
            <el-radio-button label="PASS">通过</el-radio-button>
            <el-radio-button label="REJECT">不通过</el-radio-button>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="审批意见">
          <el-input v-model="form.opinion" type="textarea" :rows="3" placeholder="请填写审批意见"></el-input>
        </el-form-item>
        <el-alert v-if="form.result === 'REJECT'" :closable="false" type="warning" show-icon title="审批不通过时直接退回XCB助理,任务状态变为“上级打回”。"></el-alert>
      </el-form>
      <template slot="footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" :loading="saving" @click="submit">提交审批</el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script>
import api from '@/api'
import { taskStatuses, statusMeta } from '@/utils/dict'
 
export default {
  name: 'SimpleApproval',
  props: {
    stage: { type: String, required: true }
  },
  data() {
    return { rows: [], selection: [], keyword: '', dialogVisible: false, saving: false, form: { result: 'PASS', opinion: '' } }
  },
  computed: {
    pageTitle() {
      return { CMB: 'CMB领导审批', JCC_ASSISTANT: 'JCC助理审批', JCC_DIRECTOR: 'JCC处长审批' }[this.stage]
    },
    subtitle() {
      return {
        CMB: '对XCB助理审核完成的故障进行批量通过或退回',
        JCC_ASSISTANT: '对CMB领导审批完成的故障进行批量通过或退回',
        JCC_DIRECTOR: '对JCC助理审批完成的故障进行最终审批,通过后进入派单'
      }[this.stage]
    },
    status() {
      return { CMB: 'XCB_REVIEWED', JCC_ASSISTANT: 'CMB_APPROVED', JCC_DIRECTOR: 'JCC_ASSISTANT_APPROVED' }[this.stage]
    },
    selectedCodes() { return this.selection.map(item => item.faultCode).join('、') }
  },
  created() { this.load() },
  methods: {
    taskMeta(value) { return statusMeta(taskStatuses, value) },
    yesNo(value) { return Number(value) === 1 ? '是' : '否' },
    load() {
      api.get('/faults', { params: { status: this.status, keyword: this.keyword } }).then(res => { this.rows = res.data || [] })
    },
    openApproval() {
      this.form = { ids: this.selection.map(item => item.id), stage: this.stage, result: 'PASS', opinion: '' }
      this.dialogVisible = true
    },
    submit() {
      this.saving = true
      api.post('/faults/approve', this.form).then(() => {
        this.$message.success('审批完成')
        this.dialogVisible = false
        this.load()
      }).finally(() => { this.saving = false })
    }
  }
}
</script>
<style scoped>
.selection-tip { color: #6d7f91; font-size: 13px; }
.selected-list { color: #2c5278; font-weight: 600; }
</style>