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
<template>
  <el-dialog
    width="1200px"
    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="workstationName"
        align="center"
      />
      <el-table-column
        label="工作站类型"
        prop="workstationType"
        align="center"
      />
      <el-table-column label="班次编号" prop="dutyNo" align="center" />
      <el-table-column label="班次" prop="shiftName" align="center" />
      <el-table-column label="班组" prop="crewName" align="center" />
      <el-table-column label="班次开始时间" prop="startTime" align="center" />
      <el-table-column label="班次结束时间" prop="endTime" 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 { getUnsubmitWorkstation, batchSubmit } from '@/api/product/dutyrecord'
import { mapGetters } from 'vuex'
 
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    paramObj: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      ids: [],
      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) {
        const customerOrderIds = []
        this.multipleSelection.forEach((item) => {
          customerOrderIds.push(item.id)
        })
        batchSubmit(customerOrderIds).then((res) => {
          this.$emit('listenToWorkStationSaveEvent')
        })
 
        this.innerVisible = false
      } else {
        this.$message.warning('请选择班次')
      }
    },
    // 获取数据列表
    getData() {
      getUnsubmitWorkstation(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>