Fixiaobai
2023-11-15 5ff704af11fc13dd48a48e133652faf1e13d178d
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
<template>
  <el-dialog
    width="60%"
    title="工艺工序"
    :visible.sync="innerVisible"  append-to-body  @close="$emit('update:currshowlist', false)"  :show="currshowlist" >
    <div class="app-container">
      <div class="avue-crud">
        <el-table
          v-loading="listLoading"
          :key="tableKey"
          :data="dataList"
          border
          highlight-current-row
          style="width: 100%;"
          @current-change="handleCurrentChange">
          <el-table-column
            prop="operationNo"
            header-align="center"
            align="center"
            label="工序编号">
          </el-table-column>
          <el-table-column
            prop="operationName"
            header-align="center"
            align="center"
            label="工序名称">
          </el-table-column>
        </el-table>
      </div>
      <!--<div class="avue-crud__pagination">
        <el-pagination
          @size-change="sizeChangeHandle"
          @current-change="currentChangeHandle"
          :current-page="pageIndex"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          :total="totalPage"
          background
          layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
      </div>-->
    </div>
    <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 {getObj} from '@/api/technology/routing'
  export default {
    props: {
      currshowlist: {
        type: Boolean,
        default: false
      },
      queryParam: {
        type: Object,
        default: () => {
          return {}
        },
        required: true
      }
    },
    data() {
      return {
        innerVisible:false,
        currentRow: null,
        listLoading: true,
        tableKey: 0,
        dataList: [],
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0
      }
    },
    methods: {
      saveSelectRow(){
        this.$emit("listenToRoutingOperateEvent", this.currentRow);
        this.innerVisible = false;
      },
      handleCurrentChange(val) {
        this.currentRow = val;
      },
      getDataList() {
        if (this.queryParam.routingId!=null) {
          this.listLoading = true;
          getObj(this.queryParam.routingId).then(response => {
            this.dataList = response.data.data.operations;
          });
          this.listLoading = false;
        }
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val;
        this.pageIndex = 1;
        this.getDataList();
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val;
        this.getDataList();
      }
    },
    watch: {
      currshowlist() {
        this.innerVisible = this.currshowlist;
        if(this.currshowlist){
          this.getDataList();
        }
      }
    },
    mounted() {
      this.getDataList();
    }
  }
</script>