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
137
138
139
140
141
142
143
<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="sourceType"
            header-align="center"
            align="center"
            label="来源类型">
          </el-table-column>
          <el-table-column
            prop="sourceNo"
            header-align="center"
            align="center"
            label="来源编号">
          </el-table-column>
          <el-table-column
            prop="qtplDesc"
            header-align="center"
            align="center"
            label="模板描述">
          </el-table-column>
          <el-table-column
            prop="partNo"
            header-align="center"
            align="center"
            label="零件号">
          </el-table-column>
          <el-table-column
            prop="partName"
            header-align="center"
            align="center"
            label="零件名称">
          </el-table-column>
          <el-table-column
            prop="partModel"
            header-align="center"
            align="center"
            label="零件型号">
          </el-table-column>
          <el-table-column
            prop="partBatch"
            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 {fetchList} from '@/api/quality/task'
  export default {
    props: {
      currshowlist: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        innerVisible:false,
        currentRow: null,
        listLoading: true,
        tableKey: 0,
        dataList: [],
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0
      }
    },
    methods: {
      saveSelectRow(){
        this.$emit("listenToPartEvent", this.currentRow);
        this.innerVisible = false;
      },
      handleCurrentChange(val) {
        this.currentRow = val;
      },
      getDataList() {
        this.listLoading = true;
        fetchList(Object.assign({
          current: this.pageIndex,
          size: this.pageSize
        })).then(response => {
          this.dataList = response.data.data.records;
          this.totalPage = response.data.data.total;
        });
        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>