gaoluyang
2025-03-07 083bc7004fa08f6eebd3003d421db5045ca78d5f
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<template>
  <div>
    <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="formDia" title="实施"
      width="60%" @close="closeCarryOutDia">
      <el-steps :active="currentStep" align-center finish-status="success">
        <el-step title="实施"></el-step>
        <el-step title="批准"></el-step>
      </el-steps>
      <div style="height: 520px;overflow-y: auto">
        <table border="1" cellspacing="10" class="tables">
          <tr>
            <td class="td-title">
              <p>监控项目:</p>
            </td>
            <td colspan="3">
              <el-input v-if="currentStep === 0" v-model="form.monitorProject" placeholder="请输入内容" size="small">
              </el-input>
              <span v-else class="td-info"> {{ form.monitorProject }}</span>
            </td>
            <td class="td-title">
              <p>监控时间:</p>
            </td>
            <td colspan="3">
              <el-input v-if="currentStep === 0" v-model="form.monitorData" placeholder="请输入内容" size="small">
              </el-input>
              <span v-else class="td-info"> {{ form.monitorData }}</span>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>监控目的:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.monitorPurpose" :rows="3" placeholder="请输入内容"
                  size="small" type="textarea">
                </el-input>
                <span v-else class="td-info2"> {{ form.monitorPurpose }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>监控方法:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.monitorMethod" :rows="4" placeholder="请输入内容"
                  size="small" type="textarea">
                </el-input>
                <span v-else class="td-info2"> {{ form.monitorMethod }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>参加人员:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.participant" :rows="3" placeholder="请输入内容" size="small"
                  type="textarea">
                </el-input>
                <span v-else class="td-info2"> {{ form.participant }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>过程控制:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.processControl" :rows="3" placeholder="请输入内容"
                  size="small" type="textarea">
                </el-input>
                <span v-else class="td-info2"> {{ form.processControl }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>结果评价标准(如何评价):</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.howEvaluate" :rows="3" placeholder="请输入内容" size="small"
                  type="textarea">
                </el-input>
                <span v-else class="td-info2"> {{ form.howEvaluate }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="8">
              <div>
                <p>经费预算:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.budget" placeholder="请输入内容" size="small">
                </el-input>
                <span v-else class="td-info2"> {{ form.budget }}</span>
              </div>
            </td>
          </tr>
          <tr>
            <td colspan="4">
              <div>
                <p>检测部门:</p>
              </div>
              <div>
                <el-input v-if="currentStep === 0" v-model="form.inspectionDepartment" placeholder="请输入内容" size="small">
                </el-input>
                <span v-else class="td-info2"> {{ form.inspectionDepartment }}</span>
              </div>
            </td>
            <td colspan="4">
              <div v-if="currentStep === 0">
                <div>批准人:</div>
                <div>
                  <el-select v-if="currentStep === 0" v-model="form.ratifyUserId" clearable filterable placeholder="请选择"
                    size="small">
                    <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                  <span v-else class="td-info2"> {{ form.ratifyName }}</span>
                </div>
              </div>
              <div>
                <div v-if="currentStep !== 0">
                  <p>批准意见:</p>
                </div>
                <div>
                  <el-input v-if="currentStep === 1" v-model="form.ratifyOpinion" :rows="3" placeholder="请输入内容"
                    size="small" type="textarea">
                  </el-input>
                  <span v-if="currentStep === 2" class="td-info2"> {{ form.ratifyOpinion }}</span>
                  <span v-if="currentStep !== 0" class="td-info3"> {{ '批准人:' + form.ratifyName }}</span>
                </div>
              </div>
            </td>
          </tr>
        </table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeCarryOutDia">取 消</el-button>
        <el-button v-if="currentStep !== 2" :loading="editLoad" type="primary" @click="handleEdit">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>
 
<script>
 
import {
  addQualityMonitorRatify, addQualityMonitorRatifyOpinion,
  getQualityMonitorRatify
} from "@/api/cnas/process/ensureResults/qualityMonitor";
import { selectUserCondition } from "@/api/business/inspectionTask";
 
export default {
  name: 'carryOutDialog',
  // import 引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // 这里存放数据
    return {
      formDia: false,
      currentStep: 0,
      form: {
        monitorProject: '',
        monitorData: '',
        monitorPurpose: '',
        monitorMethod: '',
        participant: '',
        processControl: '',
        howEvaluate: '',
        budget: '',
        inspectionDepartment: '',
        ratifyUserId: '',
        ratifyOpinion: '',
        qualityMonitorDetailsId: '',
        ratifyName: '',
      },
      personList: [],
      editLoad: false,
      isCarryOut: false, // 是否为实施
    };
  },
  // 方法集合
  methods: {
    openDia(row) {
      this.formDia = true
      this.searchInfo(row)
      this.getAuthorizedPerson()
    },
    // 查询监控计划详情实施信息
    searchInfo(row) {
      getQualityMonitorRatify({ qualityMonitorDetailsId: row.qualityMonitorDetailsId }).then(res => {
        // 有detailsRatifyId则说明提交过实施信息
        if (res.data.detailsRatifyId) {
          // 是否结束0:未结束, 1:已结束
          if (res.data.isFinish == 0) {
            this.currentStep = 1
          } else if (res.data.isFinish == 1) {
            this.currentStep = 2
          }
        } else {
          this.currentStep = 0
        }
        this.form = res.data
      }).catch(err => {
        console.log('err---', err);
      })
    },
    // 提交
    handleEdit() {
      if (!this.form.ratifyUserId) {
        this.$message.warning('请选择批准人')
        return
      }
      this.editLoad = true
      if (this.currentStep == 0) {
        this.addInfo()
      } else {
        this.editInfo()
      }
    },
    // 提交实施
    addInfo() {
      addQualityMonitorRatify(this.form).then(res => {
        this.editLoad = false
        this.$message.success('操作成功')
        this.closeCarryOutDia()
      }).catch(err => {
        console.log('err---', err);
        this.editLoad = false
      })
    },
    // 提交批准
    editInfo() {
      addQualityMonitorRatifyOpinion(this.form).then(res => {
        this.editLoad = false
        this.$message.success('操作成功')
        this.closeCarryOutDia()
      }).catch(err => {
        console.log('err---', err);
        this.editLoad = false
      })
    },
    // 关闭弹框
    closeCarryOutDia() {
      this.formDia = false
      this.$emit('closeCarryOutDia')
    },
    getAuthorizedPerson() {
      selectUserCondition({ type: 1 }).then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
            label: a.name,
            value: a.id,
          });
        });
        this.personList = data;
      });
    },
  }
};
</script>
 
<style scoped>
.tables {
  table-layout: fixed;
  width: 100%;
  margin-top: 10px;
}
 
.td-title {
  height: 40px;
  width: 100px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
  padding: 6px;
}
 
.td-info {
  display: inline-block;
  width: 100%;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
}
 
.td-info2 {
  display: inline-block;
  width: 90%;
  text-align: left;
  font-size: 16px;
  word-wrap: break-word;
  white-space: normal;
  margin-left: 20px;
}
 
.tables td {
  height: 40px;
  width: 100px;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
  padding: 6px;
}
 
.td-info3 {
  width: 90%;
  display: inline-block;
  text-align: right;
}
</style>