spring
2025-04-07 6816ee4cbdaa253c2cd452e0e582a351860ffbe7
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
<template>
  <div>
    <!-- 检验项分配 -->
    <el-dialog :visible.sync="issuedDialog" title="分配检验项" top="5vh" width="80%" :loading="tableLoading">
      <el-table :data="tableData" style="width: 100%" height="70vh">
        <el-table-column label="样品编号" prop="sampleCode" width="160px">
        </el-table-column>
        <el-table-column label="样品名称" prop="sample">
        </el-table-column>
        <el-table-column label="样品型号" prop="model" width="190px">
        </el-table-column>
        <el-table-column label="检验项分类" prop="inspectionItemClass">
        </el-table-column>
        <el-table-column label="检验项" prop="inspectionItem">
        </el-table-column>
        <el-table-column label="检验子项" prop="inspectionItemSubclass">
        </el-table-column>
        <el-table-column label="分配人员" prop="checkUserId">
          <template slot-scope="scope">
            <el-select v-model="scope.row.checkUserId" clearable filterable placeholder="请选择" size="small"
              style="width: 100%;">
              <el-option v-for="(item, i) in personList" :key="i + 'gbnm.'" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="试验室" prop="sonLaboratory">
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="issuedDialog = false">取 消</el-button>
        <el-button :loading="submitLoading" type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
 
<script>
import { selectSampleAndProductByOrderId, batchUpdateInsProductCheckUser } from "@/api/business/rawMaterialOrder";
import { selectUserCondition } from "@/api/performance/class";
export default {
  data() {
    return {
      issuedDialog: false,
      tableData: [],
      tableLoading: false,
      submitLoading: false,
      personList: []
    }
  },
  mounted() {
 
  },
  methods: {
    init(row) {
      this.issuedDialog = true;
      this.getList(row.id)
      this.getAuthorizedPerson()
    },
    getList(id) {
      this.tableLoading = true
      selectSampleAndProductByOrderId({ page: -1, size: -1, id }).then(res => {
        this.tableLoading = false
        if (res.code === 200) {
          this.tableData = res.data.records
        }
      }).catch(err => {
        this.tableLoading = false
      })
    },
    // 获取指派人员下拉列表
    getAuthorizedPerson() {
      selectUserCondition({ type: 1 }).then(res => {
        let data = []
        res.data.forEach(a => {
          data.push({
            label: a.name,
            value: a.id
          })
        })
        this.personList = data
      })
    },
    submit() {
      this.submitLoading = true;
      batchUpdateInsProductCheckUser({ insProductDtoList: this.tableData }).then(res => {
        this.submitLoading = false;
        if (res.code == 200) {
          this.$message.success('分配成功')
          this.issuedDialog = false
        }
      }).catch(err => {
        this.submitLoading = false;
      })
    }
  }
}
</script>
 
<style></style>