zouyu
2023-11-17 d8ac6057eaad648687699e25a575f3b7b8c1b102
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
<template>
  <el-dialog
    title="退盘"
    :close-on-click-modal="false"
    :visible.sync="visible"
    append-to-body
  >
    <div class="split-task-edit-back-header">
      <div></div>
      <div></div>
    </div>
    <el-table
      class="splitTaskEdit-back-table"
      :data="splitTaskBackEditData"
      style="width: 100%;"
      border
      highlight-current-row
      @row-click="editBackRowClick"
      stripe
      ref="splitTaskBackEditTable"
    >
      <el-table-column align="center" width="55" label="单选">
        <template slot-scope="scope">
          <el-checkbox
            class="edit-back-table-single-checkbox"
            v-model="scope.row.commonChecked"
            disabled
          ></el-checkbox>
        </template>
      </el-table-column>
      <el-table-column
        prop="partBatchNo"
        label="SN号"
        align="center"
        show-overflow-tooltip
      >
      </el-table-column>
    </el-table>
 
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" v-thinclick="`selectEditBackStock`"
        >确 定</el-button
      >
    </span>
  </el-dialog>
</template>
 
<script>
export default {
  props: {
    splitTaskBackEditList: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  components: {},
  data() {
    return {
      visible: false,
      currBackStock: null,
      splitTaskBackEditData: []
    }
  },
  methods: {
    init() {
      this.visible = true
      this.splitTaskBackEditData = []
      this.$nextTick(() => {
        this.splitTaskBackEditList.forEach((item) => {
          this.$set(item, 'commonChecked', false)
          this.splitTaskBackEditData.push(item)
        })
      })
    },
    selectEditBackStock() {
      if (this.currBackStock != null) {
        this.$emit('selectEditBackStock', this.currBackStock)
        this.visible = false
      } else {
        this.$message.error('请先选择库存零件!')
      }
    },
    editBackRowClick(row, column) {
      this.splitTaskBackEditData.forEach((item) => {
        if (row.id !== item.id) {
          item.commonChecked = false
        }
      })
      if (row.commonChecked) {
        row.commonChecked = false
        this.currBackStock = null
        this.$refs.splitTaskBackEditTable.setCurrentRow()
      } else {
        row.commonChecked = true
        this.currBackStock = row
        this.$refs.splitTaskBackEditTable.setCurrentRow(row)
      }
    }
  }
}
</script>
 
<style lang="scss" scoped>
.split-task-edit-back-header {
  margin-top: 10px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.red-but.is-disabled {
  color: #fab6b6;
}
 
.red-but {
  color: red;
}
.splitTaskEdit-back-table >>> .el-table__header th {
  color: #666666;
}
 
.splitTaskEdit-back-table >>> th {
  padding: 3px 0px;
  height: 31px;
}
.splitTaskEdit-back-table >>> td {
  padding: 1px 0 0 0;
}
.edit-back-table-single-checkbox
  >>> .el-checkbox__input.is-disabled.is-checked
  .el-checkbox__inner {
  background-color: #006eff;
  border-color: #006eff;
}
.edit-back-table-single-checkbox
  >>> .el-checkbox__input.is-disabled
  .el-checkbox__inner {
  background-color: #ffffff;
  cursor: pointer;
}
.edit-back-table-single-checkbox >>> .el-checkbox__inner::after {
  border: 1px solid #fff !important;
  border-left: 0 !important;
  border-top: 0 !important;
  cursor: pointer !important;
}
</style>