licp
2025-01-06 efad6058c9c9ee6ba754dc9cc61c8d744cd199b8
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<style scoped>
    .title {
        height: 60px;
        line-height: 60px;
    }
 
    .search {
        background-color: #fff;
        height: 80px;
        display: flex;
        align-items: center;
    }
 
    .search_thing {
        width: 350px;
        display: flex;
        align-items: center;
    }
 
    .search_label {
        width: 110px;
        font-size: 14px;
        text-align: right;
    }
 
    .search_input {
        width: calc(100% - 110px);
    }
 
    .table {
        margin-top: 10px;
        background-color: #fff;
        width: calc(100% - 40px);
        height: calc(100% - 60px - 80px - 10px - 40px);
        padding: 20px;
    }
  >>>.cell{
    display: flex;
    align-items: center;
  }
  .page {
        width: 100%;
        height: 30px;
        text-align: right;
        margin-bottom: 10px;
    }
</style>
 
<template>
    <div class="role_manage">
    <div>
            <el-row class="title">
                <el-col :span="12" style="padding-left: 20px;text-align: left;">样品缺陷指数</el-col>
            </el-row>
        </div>
        <div class="search">
            <div class="search_thing">
                <div class="search_label">检验项目:</div>
                <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                        v-model="entity.inspectionItems" @keyup.enter.native="refreshTable()"></el-input></div>
            </div>
            <div class="search_thing">
                <div class="search_label">委托编号:</div>
                <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                        v-model="entity.orderNumber" @keyup.enter.native="refreshTable()"></el-input></div>
            </div>
            <div class="search_thing" style="padding-left: 30px;">
                <el-button size="small" @click="refresh()">重 置</el-button>
                <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
            </div>
        </div>
        <div class="table">
      <el-table
        :data="tableData"
        style="width: 100%;margin-bottom: 10px;height: calc(100% - 40px);"
        height="calc(100% - 40px)"
        row-key="id"
        v-loading="loading"
        border
        default-expand-all
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
        <el-table-column
          prop="inspection_item"
          label="检验项目"
          sortable
          min-width="180">
          <template slot-scope="scope">
            <p>
              <el-tag style="margin-right: 10px;height: 24px;border-radius: 10px;line-height: 24px;border: 0;" :type="scope.row.level==2?'success':''">{{ '0' + scope.row.level }}</el-tag>
              <span>{{ scope.row.inspection_item }}</span>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          prop="entrust_code"
          label="委托编号"
          sortable
          min-width="180">
        </el-table-column>
        <el-table-column
          prop="name"
          label="检验人"
          min-width="180">
        </el-table-column>
        <el-table-column
          prop="create_time"
          label="检验时间"
          min-width="180">
        </el-table-column>
      </el-table>
      <div class="page">
        <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page="page.current"
          :page-sizes="[10, 20, 30, 50, 100]" :page-size="page.size" layout="total, sizes, prev, pager, next, jumper"
          :total="total" >
        </el-pagination>
      </div>
        </div>
    </div>
</template>
 
<script>
    export default {
        data() {
            return {
                entity: {
          orderNumber:null,
          inspectionItems:null,
        },
        tableData: [],
        page:{
          current:1,
          size:20,
        },
        total:0,
        loading:false,
            }
        },
        mounted() {
            // this.getPower()
      this.refreshTable()
        },
        methods: {
      refreshTable(){
        this.loading = true
        this.$axios.post(this.$api.insOrder.selectSampleDefects, {
                    ...this.page,
                    ...this.entity
                }).then(res => {
          this.loading = false
                    if (res.code === 201) {
                        this.loading = false
                        return
                    }
          this.total = res.data.total;
          this.tableData = res.data.records.map(item=>{
            item.level = 1;
            item.inspection_item = item.sample
            item.children = item.children.map(m=>{
              m.id = Math.random(10000)
              m.level = 2;
              return m
            })
            return item
          });
        })
      },
      refresh(){
        this.entity = {
          orderNumber:null,
          inspectionItems:null,
        },
        this.page.current = 1;
        this.refreshTable();
      },
      sizeChange(val){
        this.page.size = val
        this.refreshTable()
      },
      currentChange(val){
        this.page.current = val
        this.refreshTable()
      },
            // 权限分配
            getPower(radio) {
                let power = JSON.parse(sessionStorage.getItem('power'));
                let up = false
                let del = false
                let add = false
                for (var i = 0; i < power.length; i++) {
                    if (power[i].menuMethod == 'upParameter') {
                        up = true
                    }
                    if (power[i].menuMethod == 'delParameter') {
                        del = true
                    }
                    if (power[i].menuMethod == 'addParameter') {
                        add = true
                    }
                }
                if (!del) {
                    this.componentData.do.splice(1, 1)
                }
                if (!up) {
                    this.componentData.do.splice(0, 1)
                }
                this.addPower = add
            }
        }
    }
</script>