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
<template>
  <el-dialog
    width="800px"
    title="机台选择"
    top="5vh"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
    class="stock-dialog"
  >
    <el-table
      :data="dataList"
      ref="table"
      max-height="600"
      :header-cell-style="{ background: '#f5f7fa' }"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column label="工作站编号" prop="workstationNo" align="center" />
      <el-table-column label="工作站名称" prop="name" align="center" />
      <el-table-column label="工作站类型" prop="type" align="center" />
      <el-table-column label="备注" prop="remark" align="center" />
    </el-table>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取 消</el-button>
      <el-button type="primary" @click="saveSelectRow">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { fetchList3 } from '@/api/basic/workstation'
import { mapGetters } from 'vuex'
 
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    paramObj: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      multipleSelection: [],
      innerVisible: false,
      dataList: []
    }
  },
  computed: {
    ...mapGetters(['permissions'])
  },
  watch: {
    currshowlist() {
      this.innerVisible = this.currshowlist
      if (this.currshowlist) {
        this.$nextTick(() => {
          this.getData()
        })
      }
    }
  },
  methods: {
    saveSelectRow() {
      if (this.multipleSelection.length) {
        this.$emit('listenToWorkStationMultiEvent', this.multipleSelection)
        this.innerVisible = false
      } else {
        this.$message.warning('请选择机台')
      }
    },
    // 获取数据列表
    getData() {
      fetchList3(this.paramObj).then((res) => {
        this.dataList = res.data.data
        /* this.$nextTick(() => {
          this.dataList.forEach((e) => {
            this.$refs.table.toggleRowSelection(e, true)
          })
        }) */
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    }
  }
}
</script>