Fixiaobai
2023-10-13 e8308ddac0ba4a1f406e8f63d7e6b6f2541cb770
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
<template>
  <el-dialog
    width="60%"
    title="机料"
    top="5vh"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
  >
    <el-table
      :data="workstationFeedList"
      max-height="330"
      :header-cell-style="{ background: '#f5f7fa' }"
      @selection-change="selectionWorkstationFeedChange"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column label="零件编号" prop="partNo" align="center">
      </el-table-column>
      <el-table-column
        label="零件"
        prop="partName"
        align="center"
        :show-overflow-tooltip="true"
      >
      </el-table-column>
      <el-table-column
        label="IFS批次号"
        prop="ifsBatchNo"
        align="center"
        :show-overflow-tooltip="true"
      >
      </el-table-column>
      <el-table-column label="零件批号" prop="partBatchNo" align="center">
      </el-table-column>
      <el-table-column label="规格型号" prop="specs" align="center">
      </el-table-column>
      <el-table-column
        label="可用数量"
        prop="availableStockQuantity"
        align="center"
      >
      </el-table-column>
      <el-table-column label="库存数量" prop="stockQuantity" align="center">
      </el-table-column>
      <el-table-column label="单位" prop="unit" align="center">
      </el-table-column>
    </el-table>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取 消</el-button>
      <el-button type="primary" @click="saveSelectRow" :disabled="saveDisabled"
        >确 定</el-button
      >
    </div>
  </el-dialog>
</template>
<script>
import { getFeed as getWorkstationFeed } from '@/api/product/personboard'
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    workstationId: {
      type: Number
    }
  },
  data() {
    return {
      innerVisible: false,
      workstationFeedList: [],
      dataListLoading: false,
      multipleSelection: [],
      saveDisabled: false,
      clickSaveArr: []
    }
  },
  methods: {
    saveSelectRow() {
      let canClickFlag = true
      this.clickSaveArr.push(new Date().getTime())
      if (this.clickSaveArr.length > 1) {
        if (
          this.clickSaveArr[this.clickSaveArr.length - 1] -
            this.clickSaveArr[this.clickSaveArr.length - 2] <
          2000
        ) {
          // 小于2秒则认为重复提交
          canClickFlag = false
        }
      }
      if (canClickFlag) {
        this.saveDisabled = true
        this.$emit('handleSelectionChange', this.multipleSelection)
        this.innerVisible = false
        this.saveDisabled = false
      }
    },
    selectionWorkstationFeedChange(val) {
      // 多行选中
      this.multipleSelection = val
    },
    getDataList() {
      this.dataListLoading = true
      var query = {}
      this.workstationFeedList = []
      if (this.workstationId && this.workstationId != null) {
        getWorkstationFeed(query, this.workstationId)
          .then((response) => {
            var data = response.data
            if (data.code == 0) {
              this.workstationFeedList = data.data
            } else {
              this.$message.error('获取投料信息失败')
            }
          })
          .catch((error) => {})
      }
      this.dataListLoading = false
    }
  },
  watch: {
    currshowlist() {
      this.innerVisible = this.currshowlist
      if (this.currshowlist) {
        this.getDataList()
      }
    }
  },
  mounted() {
    this.getDataList()
  }
}
</script>