王震
2023-10-25 2e73213025061f966df1aca2e290bb48b148155b
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
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
<template>
  <div style="height: 100%">
    <div class="page-header">
      <div class="header-left">
        <a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
        <h2>编辑-产品结构</h2>
      </div>
      <div class="btn-group header-right">
        <el-button title="保存" :disabled="isSubmit" v-thinclick="`save`"
          >保存</el-button
        >
      </div>
    </div>
    <div class="page-main">
      <div class="single-structure-basic">
        <el-form
          :inline="true"
          :model="dataForm"
          :rules="dataRule"
          ref="dataForm"
          label-width="80px"
          class="l-mes"
        >
          <el-row>
            <el-col :span="24">
              <el-form-item label="零件号" prop="partNo">
                <el-input
                  v-model="dataForm.partNo"
                  placeholder="请选择零件"
                  @blur="checkPartNo()"
                >
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    @click="openPartDialog()"
                  ></el-button>
                </el-input>
              </el-form-item>
              <el-form-item label="零件名称" prop="partName">
                <el-input
                  v-model="dataForm.partName"
                  placeholder="零件名称"
                  :readonly="true"
                >
                </el-input>
              </el-form-item>
              <el-form-item label="结构类型" prop="bomTypeDb">
                <el-select
                  v-model="dataForm.bomTypeDb"
                  placeholder="请选择结构类型"
                  style="width:100%"
                >
                  <el-option
                    v-for="(item, index) in bomTypeDbOptions"
                    :label="item.label"
                    :value="item.value"
                    :key="index"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <!-- <el-form-item label="替代" prop="alternativeNo">
                <el-input v-model="dataForm.alternativeNo"></el-input>
              </el-form-item>
              <el-form-item label="替代描述" prop="alternativeDesc">
                <el-input
                  type="textarea"
                  :autosize="{ minRows: 1, maxRows: 3 }"
                  v-model="dataForm.alternativeDesc"
                ></el-input>
              </el-form-item> -->
              <el-form-item label="版本号" prop="version">
                <el-input v-model="dataForm.version" disabled></el-input>
              </el-form-item>
              <el-form-item label="备注" prop="remark">
                <el-input
                  type="textarea"
                  :autosize="{ minRows: 1, maxRows: 3 }"
                  v-model="dataForm.remark"
                ></el-input>
              </el-form-item>
              <!-- <el-form-item label="已同步至IFS" prop="ifsSync">
                <span
                  style="width: 146px;display: inline-block;font-size:12px;font-weight:bold;"
                  >{{ dataForm.ifsSync ? '是' : '否' }}</span
                >
              </el-form-item> -->
              <el-form-item label="默认结构" prop="master">
                <el-checkbox v-model="dataForm.master"></el-checkbox>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div class="single-structure-detail">
        <el-card class="single-structure-card" shadow="never" style="">
          <div slot="header" class="clearfix">
            <div style="float: left; ">
              <span>子节点</span
              ><span style="color:red;"
                >(所有子节点保存之后,才可进行拖拽排序!)</span
              >
            </div>
            <div style="float: right; margin-right: 20px">
              <el-button
                type="text"
                size="medium"
                class="blue-but"
                @click="addNode()"
                >添加
              </el-button>
            </div>
          </div>
          <el-table
            id="structureComponentTable"
            ref="nodeTable"
            :data="nodeList"
            :default-sort="{ prop: 'lineItemNo' }"
            height="650"
            :header-cell-style="{ color: '#999' }"
            :row-class-name="structureComponentRowClass"
          >
            <el-table-column
              prop="lineItemNo"
              label="行项号"
              align="center"
              width="70"
            >
            </el-table-column>
            <el-table-column
              label="消耗工序"
              prop="operationName"
              align="center"
            >
              <template scope="scope">
                <el-input
                  v-model="scope.row.operationName"
                  placeholder="请选择消耗工序"
                  v-if="scope.row.isUpdate"
                >
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    @click="openOperateDialog(scope.row)"
                  ></el-button>
                </el-input>
                <template v-if="!scope.row.isUpdate">{{
                  scope.row.operationName
                }}</template>
              </template>
            </el-table-column>
            <el-table-column label="零件号" prop="partNo" align="center">
              <template scope="scope">
                <el-input
                  :class="customClass[scope.$index]"
                  v-model="scope.row.partNo"
                  placeholder="请选择零件"
                  v-if="scope.row.isUpdate"
                  @blur="verifyPartNo(scope.row, scope.$index)"
                  @focus="clearClass(scope.$index)"
                >
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    @click="openPartDialog(scope.row, scope.$index)"
                  ></el-button>
                </el-input>
                <template v-if="!scope.row.isUpdate">{{
                  scope.row.partNo
                }}</template>
              </template>
            </el-table-column>
            <el-table-column
              label="零件名称"
              prop="partName"
              align="center"
              :show-overflow-tooltip="true"
            >
            </el-table-column>
            <el-table-column label="数量" prop="qpa" align="center">
              <template slot-scope="scope">
                <el-input
                  size="small"
                  v-model="scope.row.qpa"
                  placeholder="请填写数量"
                  v-show="scope.row.isUpdate"
                  onkeyup="this.value=this.value.match(/\d+\.?\d{0,8}/);this.dispatchEvent(new Event('input'))"
                ></el-input>
                <span v-show="!scope.row.isUpdate">{{ scope.row.qpa }}</span>
              </template>
            </el-table-column>
 
            <el-table-column label="单位" prop="unit" align="center">
            </el-table-column>
            <!-- <el-table-column label="盘数(盘)" prop="discNum" align="center">
              <template slot-scope="scope">
                <el-input
                  size="small"
                  v-model="scope.row.discNum"
                  placeholder="请填写盘数"
                  v-show="scope.row.isUpdate"
                ></el-input>
                <span v-show="!scope.row.isUpdate">{{
                  scope.row.discNum
                }}</span>
              </template>
            </el-table-column>
            <el-table-column label="图号" prop="drawingNumber" align="center">
            </el-table-column> -->
            <el-table-column align="center" label="操作" width="85px">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  size="small"
                  class="blue-but"
                  v-if="!scope.row.isUpdate"
                  @click="editNode(scope.$index, scope.row)"
                  >编辑</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  class="blue-but"
                  v-if="scope.row.isUpdate"
                  :loading="nodeSaveLoading"
                  @click="addOrUpdateNode(scope.$index, scope.row)"
                  >保存</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  class="red-but"
                  @click="delNode(scope.$index, scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </div>
    </div>
    <partDialog
      :currshowlist.sync="showPart"
      :parentSelectedObj="editNodePart"
      :parentSelectedIndex="editIndex"
      @listenToPartEvent="selectPart"
    />
    <operationDialog
      :currshowlist.sync="showOperate"
      @listenToOperationEvent="selectOperate"
    />
  </div>
</template>
<script>
import {
  addObj,
  putObj,
  getObj,
  addComponent,
  putComponent,
  delComponent,
  batchComponent
} from '@/api/technology/structure'
import { findByNo } from '@/api/basic/part'
import partDialog from '@/views/common/part.vue'
import operationDialog from '@/views/common/operation.vue'
import { remote } from '@/api/admin/dict'
export default {
  components: {
    partDialog,
    operationDialog
  },
  data() {
    return {
      customClass: [],
      showPart: false,
      editNodePart: null,
      editIndex: null,
      dataForm: {
        id: null,
        partNo: null,
        partId: null,
        partName: null,
        remark: null,
        bomTypeDb: 'M',
        alternativeNo: '*',
        alternativeDesc: null,
        version: null,
        master: false,
        ifsSync: false
      },
      nodeList: [],
      dataRule: {
        partNo: [
          { required: true, message: '零件号不能为空', trigger: 'blur' }
        ],
        version: [
          { required: true, message: '版本号不能为空', trigger: 'blur' }
        ],
        bomTypeDb: [
          { required: true, message: '结构类型不能为空', trigger: 'blur' }
        ],
        alternativeNo: [
          { required: true, message: '替代不能为空', trigger: 'blur' }
        ]
      },
      showOperate: false,
      currRow: null,
      isSubmit: false,
      nodeSaveLoading: false,
      bomTypeDbOptions: []
    }
  },
  computed: {
    editable: function() {
      if (!this.dataForm.id) {
        return true
      }
      return false
    }
  },
  mounted() {
    window.addEventListener(
      'hashchange',
      () => {
        const currentPath = window.location.hash.slice(1)
        if (this.$route.path !== currentPath) {
          this.$router.push(currentPath)
        }
      },
      false
    )
    this.rowDrop()
  },
  created() {
    const formId = this.$route.params.id
    this.init(formId)
    this.getBomTypeDbOptions()
  },
  methods: {
    // 查询结构类型字典
    getBomTypeDbOptions() {
      remote('bom_type_db').then((response) => {
        if (response.data.code === 0) {
          this.bomTypeDbOptions = response.data.data
        } else {
          this.bomTypeDbOptions = []
        }
      })
    },
    init(id) {
      this.dataForm.id = id || 0
      this.$nextTick(() => {
        var formId = this.dataForm.id
        this.initAllData()
        if (formId) {
          getObj(formId).then((response) => {
            const resCode = response.data.code
            const resData = response.data.data
            if (resCode === 0) {
              this.dataForm.id = resData.id
              this.dataForm.partNo = resData.partNo
              this.dataForm.partId = resData.partId
              this.dataForm.partName = resData.partName
              this.dataForm.remark = resData.remark
              this.dataForm.version = resData.version
              this.dataForm.master = resData.master
              this.dataForm.bomTypeDb = resData.bomTypeDb
              this.dataForm.alternativeNo = resData.alternativeNo
              this.dataForm.alternativeDesc = resData.alternativeDesc
              this.dataForm.ifsSync = resData.ifsSync
              const components = resData.components
              if (components != null && components.length > 0) {
                let node
                for (let i = 0; i < components.length; i++) {
                  node = {}
                  node.id = components[i].id
                  node.partId = components[i].partId
                  node.partNo = components[i].partNo
                  node.partName = components[i].partName
                  node.qpa = components[i].qpa
                  node.unit = components[i].unit
                  node.drawingNumber = components[i].drawingNumber
                  node.structureId = components[i].structureId
                  node.operationId = components[i].operationId
                  node.operationNo = components[i].operationNo
                  node.operationName = components[i].operationName
                  node.discNum = components[i].discNum
                  node.lineItemNo = components[i].lineItemNo
                  node.color = components[i].color
                  node.planningMethod = components[i].planningMethod
                  node.isUpdate = false
                  this.nodeList.push(node)
                }
              }
            }
          })
        }
      })
    },
    initAllData() {
      this.dataForm.id = null
      this.dataForm.partNo = null
      this.dataForm.partId = null
      this.dataForm.partName = null
      this.dataForm.remark = null
      this.dataForm.version = null
      this.dataForm.master = false
      this.dataForm.bomTypeDb = 'M'
      this.dataForm.alternativeNo = '*'
      this.dataForm.alternativeDesc = null
      this.dataForm.ifsSync = false
      this.showPart = false
      this.nodeList = []
      this.showOperate = false
      this.currRow = null
    },
    save() {
      this.isSubmit = true
      this.$refs.dataForm.validate((valid) => {
        if (valid) {
          if (this.dataForm.id) {
            putObj(this.dataForm)
              .then((response) => {
                var data = response.data
                if (data.code === 0) {
                  this.$message.success('保存成功')
                } else {
                  this.$message.error('保存失败')
                }
                this.isSubmit = false
              })
              .catch(() => {
                this.isSubmit = false
              })
          } else {
            addObj(this.dataForm)
              .then((response) => {
                var data = response.data
                if (data.code === 0) {
                  this.dataForm.id = data.data
                  this.$message.success('保存成功')
                } else {
                  this.$message.error('保存失败')
                }
                this.isSubmit = false
              })
              .catch(() => {
                this.isSubmit = false
              })
          }
        } else {
          this.isSubmit = false
        }
      })
    },
    openPartDialog(nodePart, index) {
      this.showPart = true
      this.editNodePart = nodePart
      this.editIndex = index
    },
    openOperateDialog(row) {
      this.showOperate = true
      this.currRow = row
    },
    selectPart(param, nodePart, index) {
      if (nodePart) {
        if (param) {
          this.$set(nodePart, 'partId', param.id)
          this.$set(nodePart, 'partName', param.partName)
          this.$set(nodePart, 'partNo', param.partNo)
          this.$set(nodePart, 'unit', param.unit)
          this.$set(nodePart, 'drawingNumber', param.drawingNumber)
          this.$set(nodePart, 'planningMethod', param.planningMethod)
          console.info(index)
          this.clearClass(index)
        }
      } else {
        if (typeof param !== 'undefined') {
          this.dataForm.partId = param.id
          this.dataForm.partName = param.partName
          this.dataForm.partNo = param.partNo
          this.dataForm.version = param.engChgLevel
        }
      }
    },
    selectOperate(operate) {
      const _that = this
      if (operate) {
        this.$set(_that.currRow, 'operationId', operate.id)
        this.$set(_that.currRow, 'operationName', operate.name)
        this.$set(_that.currRow, 'operationNo', operate.operationNo)
      }
    },
    rowDrop() {
      const that = this
      const tbody = document.querySelector(
        '#structureComponentTable .el-table__body-wrapper tbody'
      )
      Sortable.create(tbody, {
        draggable: '.draggable-sort-row',
        // 结束拖拽
        onEnd({ newIndex, oldIndex }) {
          if (newIndex > oldIndex) {
            // 下移
            that.nodeList
              .filter((e) => e.lineItemNo === oldIndex + 1)
              .forEach((e) => {
                e.lineItemNo = 'x'
              })
            that.nodeList
              .filter(
                (e) =>
                  e.lineItemNo > oldIndex + 1 && e.lineItemNo <= newIndex + 1
              )
              .forEach((e) => {
                e.lineItemNo = e.lineItemNo - 1
              })
            that.nodeList
              .filter((e) => e.lineItemNo === 'x')
              .forEach((e) => {
                e.lineItemNo = newIndex + 1
              })
          } else if (oldIndex > newIndex) {
            // 上移
            that.nodeList
              .filter((e) => e.lineItemNo === oldIndex + 1)
              .forEach((e) => (e.lineItemNo = 'x'))
            that.nodeList
              .filter(
                (e) =>
                  e.lineItemNo < oldIndex + 1 && e.lineItemNo >= newIndex + 1
              )
              .forEach((e) => (e.lineItemNo = e.lineItemNo + 1))
            that.nodeList
              .filter((e) => e.lineItemNo === 'x')
              .forEach((e) => (e.lineItemNo = newIndex + 1))
          }
 
          const componentList = []
          that.nodeList.forEach((e) => {
            componentList.push({ id: e.id, lineItemNo: e.lineItemNo })
          })
          // 保存拖拽结果
          that.batchUpdateNodeComponent(componentList)
        }
      })
    },
    addNode() {
      if (this.dataForm.id != null) {
        const templateNodeList = this.nodeList
        this.nodeList = []
        this.$nextTick(() => {
          this.nodeList = templateNodeList
          const newIndex = this.nodeList.length + 1
          this.nodeList.push(
            Object.assign({
              id: null,
              partId: 0,
              partNo: '',
              partName: '',
              qpa: '',
              unit: '',
              drawingNumber: '',
              structureId: this.dataForm.id,
              isUpdate: true,
              operationId: 0,
              operationNo: '',
              operationName: '',
              discNum: '',
              color: null,
              planningMethod: null,
              lineItemNo: newIndex
            })
          )
        })
      } else {
        this.$message.warning('请先保存主表信息')
      }
    },
    editNode(index, row) {
      row.isUpdate = true
    },
    addOrUpdateNode(index, row) {
      this.nodeSaveLoading = true
      if (row.partId && row.qpa) {
        // if (row.operationId) {
        if (row.id != null) {
          // 修改
          putComponent(row)
            .then((response) => {
              if (response.data.code === 0) {
                row.isUpdate = false
                this.$message.success('修改成功')
              } else {
                this.$message.error('修改失败')
              }
              this.nodeSaveLoading = false
            })
            .catch((error) => {
              this.nodeSaveLoading = false
              console.log(error)
            })
        } else {
          // 新增
          addComponent(row)
            .then((response) => {
              if (response.data.code === 0) {
                row.id = response.data.data
                row.isUpdate = false
                this.$message.success('添加成功')
              } else {
                this.$message.error('添加失败')
              }
              this.nodeSaveLoading = false
            })
            .catch((error) => {
              this.nodeSaveLoading = false
              console.log(error)
            })
        }
        // } else {
        //   this.$message.warning('工序不能为空')
        // }
      } else {
        this.nodeSaveLoading = false
        this.$message.warning('零件和数量不能为空')
      }
    },
    delNode(index, row) {
      this.$confirm('是否确认删除零件号为' + row.partNo, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        closeOnClickModal: false,
        type: 'warning'
      }).then(() => {
        if (row.id) {
          delComponent(row.id).then((response) => {
            if (response.data.code === 0) {
              this.nodeList.splice(
                this.nodeList.findIndex(
                  (item) => item.lineItemNo === row.lineItemNo
                ),
                1
              )
              const newNodelist = this.nodeList
              this.nodeList = []
              this.$nextTick(() => {
                this.nodeList = newNodelist
                const needChangeNodeList = []
                this.nodeList
                  .filter((e) => e.lineItemNo >= row.lineItemNo)
                  .forEach((e) => {
                    e.lineItemNo = e.lineItemNo - 1
                    needChangeNodeList.push(e)
                  })
                this.$message.success('删除成功')
                // 找出nodeList中id不等于空的,进行顺序更新
                const componentList = []
                if (needChangeNodeList.length > 0) {
                  needChangeNodeList.forEach((e) => {
                    if (e.id != null) {
                      componentList.push({ id: e.id, lineItemNo: e.lineItemNo })
                    }
                  })
                }
                if (componentList.length > 0) {
                  this.batchUpdateNodeComponent(componentList)
                }
              })
            } else {
              this.$message.error('删除失败')
            }
          })
        } else {
          this.nodeList.splice(
            this.nodeList.findIndex(
              (item) => item.lineItemNo === row.lineItemNo
            ),
            1
          )
          const newNodelist = this.nodeList
          this.nodeList = []
          this.$nextTick(() => {
            this.nodeList = newNodelist
            const needChangeNodeList = []
            this.nodeList
              .filter((e) => e.lineItemNo >= row.lineItemNo)
              .forEach((e) => {
                e.lineItemNo = e.lineItemNo - 1
                needChangeNodeList.push(e)
              })
            this.$message.success('删除成功')
            // 找出nodeList中id不等于空的,进行顺序更新
            const componentList = []
            if (needChangeNodeList.length > 0) {
              needChangeNodeList.forEach((e) => {
                if (e.id != null) {
                  componentList.push({ id: e.id, lineItemNo: e.lineItemNo })
                }
              })
            }
            if (componentList.length > 0) {
              this.batchUpdateNodeComponent(componentList)
            }
          })
        }
      })
    },
    verifyPartNo(row, index) {
      if (row.partNo) {
        findByNo(Object.assign({ partNo: row.partNo })).then((response) => {
          const part = response.data.data
          if (response.data.data) {
            this.$set(row, 'partId', part.id)
            this.$set(row, 'partName', part.partName)
            this.$set(row, 'unit', part.unit)
            this.$set(row, 'drawingNumber', part.drawingNumber)
          } else {
            this.$set(this.customClass, index, 'el-input__red')
            this.$message.warning('零件号不存在')
          }
        })
      }
    },
    clearClass(index) {
      this.$set(this.customClass, index, '')
    },
    checkPartNo() {
      if (this.dataForm.partNo) {
        findByNo(Object.assign({ partNo: this.dataForm.partNo })).then(
          (response) => {
            const part = response.data.data
            if (response.data.data) {
              this.dataForm.partId = part.id
              this.dataForm.partName = part.partName
              this.dataForm.version = part.version
            } else {
              this.dataForm.partNo = null
              this.dataForm.partId = null
              this.dataForm.partName = null
              this.dataForm.version = null
              this.$message.warning('零件号不存在')
            }
          }
        )
      }
    },
    // 批量更新子节点
    batchUpdateNodeComponent(componentList) {
      batchComponent(componentList).then((response) => {})
    },
    // 判断是否禁用行拖拽排序,只有所有行都进行save之后,才能进行排序。
    structureComponentRowClass() {
      if (this.nodeList.length > 0) {
        let forbidFlag = false
        this.nodeList.forEach((e) => {
          if (e.id == null) {
            forbidFlag = true
          }
        })
        if (forbidFlag) {
          return ''
        } else {
          return 'draggable-sort-row'
        }
      } else {
        return ''
      }
    }
  }
}
</script>
<style>
.single-structure-basic {
  background-color: #fff;
  height: 100px;
  display: flex;
  padding: 20px 30px;
  border: 1px solid #ddd;
  box-sizing: border-box;
}
.single-structure-detail {
  overflow: hidden;
  width: 100%;
  height: 760px;
  padding: 10px 20px;
  display: flex;
  border: 1px solid #ddd;
  background-color: #fff;
  margin-top: 10px;
  box-sizing: border-box;
}
.single-structure-card {
  width: 100%;
  border: 0px;
}
.single-structure-card .el-card__header {
  border-bottom: 0px;
}
.single-structure-card .el-card__body {
  padding-top: 0px;
}
.blue-but.is-disabled {
  color: #aacfff;
}
 
.blue-but {
  color: #006eff;
}
.red-but.is-disabled {
  color: #fab6b6;
}
 
.red-but {
  color: red;
}
 
.el-input__red {
  border: 1px solid red;
}
</style>