李旭东
2023-12-08 7efc6ed86025b610cab109a2e9f83362740d8ed4
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<template>
  <div class="main">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">项目名称:</span>
        <el-select v-model="search.proId" placeholder="请选择项目名称" clearable @change="changeSizes">
            <el-option
                v-for="item in optionsProject"
                :key="item.proId"
                :label="item.proName"
                :value="item.proId">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">钢筋笼编号:</span>
        <el-input v-model="search.produceNumber" :size="size" clearable placeholder="请输入钢筋笼编号"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">制作人:</span>
        <el-input v-model="search.realName" :size="size" clearable placeholder="请输入制作人"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">生产班组:</span>
        <el-select v-model="search.groupId" placeholder="请选择生产班组" clearable filterable>
            <el-option
                v-for="item in optionsDeparts"
                :key="item.groupId"
                :label="item.groupName"
                :value="item.groupId">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">质量标注:</span>
        <el-select v-model="search.isQualified" placeholder="请选择质量标注" clearable>
            <el-option label="未质检" value="0"></el-option>
            <el-option label="合格" value="1"></el-option>
            <el-option label="不合格" value="2"></el-option>
            <el-option label="报废" value="3"></el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">是否入模:</span>
        <el-select v-model="search.isModel" placeholder="请选择是否入模" clearable>
            <el-option label="已入模" value="1"></el-option>
            <el-option label="未入模" value="2"></el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">配筋:</span>
        <el-select v-model="search.reinforcementId" placeholder="请选择配筋" clearable>
            <el-option
                v-for="item in optionsReins"
                :key="item.hasSteel"
                :label="item.has"
                :value="item.hasSteel">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">块号:</span>
        <el-select v-model="search.blockNum" placeholder="请选择块号" clearable>
            <el-option
                v-for="item in optionsBlocks"
                :key="item.blockNum"
                :label="item.blockName"
                :value="item.blockNum">
            </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">打印时间:</span>
        <el-date-picker
            v-model="search.time"
            type="datetimerange"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00','23:59:59']"
            range-separator="-"
            start-placeholder="起始时间"
            end-placeholder="结束时间">
        </el-date-picker>
      </div>
      <div class="header_item">
        <span class="header_label">质检时间:</span>
        <el-date-picker
            v-model="search.times"
            type="datetimerange"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00','23:59:59']"
            range-separator="-"
            start-placeholder="起始时间"
            end-placeholder="结束时间">
        </el-date-picker>
      </div>
      <div class="header_item">
        <el-button :size="size" icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportProp">导出Excel</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="dataList"
        height="100%"
        :cell-style="cellStyle">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="produceNumber" label="钢筋笼编号" align="center" width="180" ></el-table-column>
        <el-table-column prop="proName" label="项目名称" align="center" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column prop="sizeName" label="尺寸" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="reinforcementName" label="配筋" align="center"></el-table-column>
        <el-table-column prop="blockName" label="块号" align="center"></el-table-column>
        <el-table-column prop="groupName" label="生产班组" align="center"></el-table-column>
        <el-table-column prop="printTime" label="打印时间" align="center" width="150"></el-table-column>
        <el-table-column prop="realName" label="制作人" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="qualityUserName" label="质检人" align="center"></el-table-column>
        <el-table-column prop="qualityTime" label="质检时间" align="center" width="150"></el-table-column>
        <el-table-column prop="isQualified" label="质量标注" align="center">
            <template #default="{row}">
                <div :class="{'isStand':row.isQualified===2&&row.isModel ===1}">{{row.isQualified===1?'合格':row.isQualified===0?'未质检':row.isQualified===2?'不合格':row.isQualified===3?'报废':''}}</div>
            </template>
        </el-table-column>
        <el-table-column prop="isModel" label="是否入模" align="center">
            <template #default="{row}">
                <div :class="{'isStand':row.isQualified===2&&row.isModel ===1}">{{row.isModel===1?'已入模':row.isModel===2?'未入模':''}}</div>
            </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="200">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('question')&&row.isQualified===2 || row.isQualified===3" @click="updateQuestion(row)">存在问题</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('trace')" @click="traceInfo(row)">质量追溯</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle ? '存在问题' : '质量追溯'"
      :close-on-click-modal="false"
      :visible.sync="asyncVisible"
      width="58%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form" v-if="asyncTitle">
        <el-form-item label="质检结果:" prop="checkResult">
          <span style="color:red">{{ruleForm.checkResult ==='1'?'合格':ruleForm.checkResult ==='2'?'不合格':ruleForm.checkResult ==='3'?'报废':''}}</span>
        </el-form-item>
        <el-form-item label="存在问题:" prop="checkFaildReason">
          <el-input v-model="ruleForm.checkFaildReason" :size="size" type="textarea" :rows="3" :disabled="true" clearable placeholder="请输入盾构单位"></el-input>
        </el-form-item>
        <el-form-item label="图片:" v-if="showPhone">
          <el-image
              style="width:50px;height:50px; cursor: pointer;"
              :src="phoneList[0]"
              :preview-src-list="phoneList"
              fit="contain">
              <div slot="error" class="image-slot">
                <img src="https://szpipe.thhy-tj.com/group1/M00/00/03/bx5d1GRlfmCAEmAPAAAFoOEW2dU397.png" style="width:50px;height:50px">
              </div>
          </el-image>
        </el-form-item>
        <el-form-item label="问题处理结果:" prop="execResult">
          <el-input v-model="ruleForm.execResult" :size="size" type="textarea" :rows="3" clearable placeholder="请输入问题处理结果"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="remark">
          <el-input 
            v-model="ruleForm.remark" 
            :size="size" 
            type="textarea" 
            :rows="3" 
            clearable 
            placeholder="请输入备注"
            maxlength="200"
            show-word-limit></el-input>
        </el-form-item>
      </el-form>
      <div v-if="!asyncTitle">
        <div class="reins_info">钢筋笼信息</div>
        <div class="reins_info_content">
            <div class="reins_info_items">
                <div class="reins_info_titles">钢筋笼编号</div>  
                <div class="reins_info_datas">{{rebarInfos.produceNumber}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">项目</div>  
                <div class="reins_info_datas">{{rebarInfos.proName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">尺寸</div>  
                <div class="reins_info_datas">{{rebarInfos.sizeName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">配筋</div>  
                <div class="reins_info_datas">{{rebarInfos.reinforcementName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">块号</div>  
                <div class="reins_info_datas">{{rebarInfos.blockName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">制作人</div>  
                <div class="reins_info_datas">{{rebarInfos.realName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">质检人</div>  
                <div class="reins_info_datas">{{rebarInfos.qualityUserName}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">质检时间</div>  
                <div class="reins_info_datas">{{rebarInfos.qualityTime}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">质检结果</div>  
                <div class="reins_info_datas">{{rebarInfos.isQualified===1?'合格':rebarInfos.isQualified===2?'不合格':rebarInfos.isQualified===3?'报废':''}}</div>  
            </div>
            <div class="reins_info_items">
                <div class="reins_info_titles">打印日期</div>  
                <div class="reins_info_datas">{{rebarInfos.printTime}}</div>  
            </div>
        </div>
      </div>
      <div slot="footer" v-if="asyncTitle && execFlag!==1">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
  
</template>
 
<script>
import { buttonPinia } from '../../pinia/index';
import { throttle, changeSize,downFiles } from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法
  export default {
    data() {
      return {
        size: changeSize(), // 组件尺寸
        pageNum: 1,
        pageSize: 10,
        steelProduceNum:null,
        showPhone:false,//是否展示报废图片
        phoneList:[],//展示图片族
        search:{},//查询条件
        execFlag:null,//是否提交过存在问题
        total: 0,
        loading: false,
        dataList: [], //钢筋笼生产信息列表  is_qualified:是否合格 1合格2 不合格   is_model:是否入模  1入模2未入模
        optionsDeparts:[],//生产班组
        optionsReins:[],//配筋
        optionsBlocks:[],//块号
        asyncTitle: true, // 对话框title 新增:true  修改:false
        asyncVisible: false, // 添加 修改对话框
        optionsProject:[],//项目名称
        rebarInfos:null,//质量追溯列表
        ruleForm: {}, // 按钮表单
        rules: {
          segmentName: [{
            required: true,
            message: '请输入标段名称',
            trigger: 'blur'
          }],
          shieldEnp: [{
            required: true,
            message: '请输入盾构单位',
            trigger: 'blur'
          }],
          station: [{
            required: true,
            message: '请输入站点',
            trigger: 'blur'
          }],
          proId: [{
            required: true,
            message: '请选择项目名称',
            trigger: 'change'
          }],
          segmentAdmin: [{
            required: true,
            message: '请选择需求负责人',
            trigger: 'change'
          }],
        },
      }
    },
    watch: {
      asyncVisible(bol) {
        if(!bol) {
          this.ruleForm = {};
          this.$refs.ruleForm.resetFields();
        }
      }
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
      that.searchButtonInfo(true);
      that.getAllDeparts()
      that.getAllProjects()
    },
    methods: {
      //获得所有项目名称
     getAllProjects(){
        let obj = {
            pageNum: 1,
            pageSize: 100000000
        }
        this.$api.Engineer.searchProjects(obj).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsProject = res.data.list
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
     },
    cellStyle({row,column}){
      if(row.isQualified===2&& row.isModel===1 &&column.property =="isQualified"&&column.property =="isModel"){
        return {
          'color':'red'
        }
      }
    },
    //通过选择项目选择尺寸
     changeSizes(val){
      this.$api.Reinforce.searchProjectBears({proId:val,pageNum: 1,
          pageSize:1000000}).then(res=>{
        if(res.statusMsg === 'ok'){
            this.optionsReins = res.data.hasDtos
            this.optionsBlocks = res.data.blokDtos
        }else{
            this.$message.warning(res.statusMsg)
        }
      })
     },
      //获取生产班组
      getAllDeparts(){
        this.$api.Personnerl.GETDEPARTMENTDATA({}).then(res=>{
            if(res.statusMsg === 'ok'){
                res.data.forEach(item=>{
                  this.optionsDeparts.push(...item.groups)
                })
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 查询按钮列表信息
      searchButtonInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        let params = Object.assign({},this.search,{
          pageNum: this.pageNum,
          pageSize: this.pageSize
        })
        params.strTime = this.search.time&&this.search.time[0]
        params.endTime = this.search.time&&this.search.time[1]
        params.strTimes = this.search.times&&this.search.times[0]
        params.endTimes = this.search.times&&this.search.times[1]
        delete params.time
        delete params.times
        this.loading = true;
        this.$api.Reinforce.searchReinforcement(params).then((res) => {
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }
          this.loading = false;
        })
      },
      // 转圈圈
      functionLoading() {
        this.loadingView = this.$loading({
          lock: true,
          text: '请稍后...',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
      },
      // 导出按钮信息
      exportProp() {
        this.functionLoading();
        let params  = Object.assign({},this.search)
        params.strTime = this.search.time&&this.search.time[0]
        params.endTime = this.search.time&&this.search.time[1]
        params.strTimes = this.search.times&&this.search.times[0]
        params.endTimes = this.search.times&&this.search.times[1]
        delete params.time
        delete params.times
        this.$api.Reinforce.exportDatas(params).then(res => {
            downFiles(res, '钢筋笼生产信息', 'xls')
            this.loadingView.close()
        })
        .catch(() => {
          this.loadingView.close();
        })
      },
      // 存在问题按钮
      updateQuestion(row) {
        this.steelProduceNum = row.produceNumber
        this.asyncTitle = true;
        this.asyncVisible = true;
        this.$api.Reinforce.searchQuessions({steelProduceId: row.steelProduceId,steelProduceNum:row.produceNumber}).then(res=>{
            if(res.statusMsg === 'ok'){
              this.execFlag = res.data[0].execFlag
              if(res.data[0].checkResult==='3'){
                this.$set(this.ruleForm,'checkFaildReason',res.data[0].remark)
                this.$set(this.ruleForm,'checkResult',res.data[0].checkResult)
                res.data[0].checkFile.map(item=>{
                    this.phoneList.push(`https://szpipe.thhy-tj.com/${item}`)
                })
                this.showPhone = true
              }else{
                this.showPhone = false
                // this.ruleForm = res.data[0]
                if(res.data[0].checkDtos === null){
                  // this.$set(this.ruleForm,'checkFaildReason',' '+res.data[0].remark)
                }else{
                  let arr =""
                  let arr1 = ""
                  let hmark = res.data[0].remark
                  res.data[0].checkDtos.map(names=>{
                    arr+=names.reasonName+","
                    return arr
                  })
                  arr1 = arr.lastIndexOf(',')
                  arr = arr.substring(0,arr1)
                  this.$set(this.ruleForm,'checkFaildReason',arr+'。'+hmark)
                }
              }
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 质量追溯按钮
      traceInfo(row) {
        this.asyncTitle = false;
        this.asyncVisible = true;
        this.$api.Reinforce.detailsReinforcement({steelProduceId:row.steelProduceId}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.rebarInfos = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 提交存在问题按钮
      submitInsert: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.segmentList = this.needBlocks
            params.steelProduceNum=this.steelProduceNum
            this.$api.Reinforce.submitQuessions(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('提交成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交修改按钮信息
      submitUpdate: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.segmentList = this.needBlocks
            this.$api.Engineer.updateSegment(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('添加成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },      
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchButtonInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchButtonInfo();
      }
    }
  }
</script>
 
<style lang="scss" scoped>
@import '../../style/layout-main.scss';
.reins_info{
    color: #fff;
    font-size: 16px;
    position: relative;
    padding:0px 0px 10px 10px;
    border-bottom: 1px solid #0D5274;
    &::before{
        content: '';
        width: 2px;
        height: 18px;
        background-color: #18F6F8;
        position: absolute;
        left: 2px;
        top: 3px;
    }
}
.reins_info_content{
    display: flex;
    margin: 20px 0px;
    padding-right: 10px;
    overflow: auto;
    .reins_info_items{
        border-top: 1px solid #1CB7E0;
        flex: none;
        .reins_info_titles{
            border-left: 1px solid #1CB7E0;
            border-right: 1px solid #1CB7E0;
            border-bottom: 1px solid #1CB7E0;
            text-align: center;
            padding: 10px;
            background-color: #082F57;
            color: #0DEAF8;
        }
        .reins_info_datas{
            height: 40px;
            border-left: 1px solid #1CB7E0;
            border-right: 1px solid #1CB7E0;
            border-bottom: 1px solid #1CB7E0;
            text-align: center;
            padding: 10px;
            background-color: #061C48;
            color: #0DEAF8;
        }
    }
}
 
.isStand{
    color: red;
}
 
//滚动条样式
::-webkit-scrollbar {
    width: 4px; 
    height: 8px;   
}
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    box-shadow: inset 0 0 5px #0DEAF8;
    background: rgba(0,0,0,0.2);
}
::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px transparent;
    border-radius: 0;
    background: transparent;
}
</style>