吴羡
昨天 a52ac50ffc5f3b369eb689dd734bfb8a4bb988a4
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
<template>
  <div>
    <el-row class="card-box">
      <el-col :span="4" v-for="(item, index) in cardList" :key="index">
        <CardPanel
          :isActive="isActive"
          :data="item"
          :index="index"
          @handleCard="handleCard"
        />
      </el-col>
      <el-col :span="24" v-if="cardList.length==0" style="color: var(--lims-text-3);font-size: 14px;text-align: center;margin-top: 20px;">暂无数据</el-col>
    </el-row>
    <div class="title">耗材信息</div>
    <limsTable
      style="margin-top: 18px; padding: 0 15px;"
      :height="'20vh'"
      :column="columns"
      :table-data="tableData"
    >
    </limsTable>
  </div>
</template>
<script>
import CardPanel from './CardPanel.vue';
import { procurementSuppliesList } from "@/api/cnas/externalService/serviceAndSupplyPro/serviceAndSupplyPro"
import limsTable from '@/components/Table/lims-table.vue'
 
export default {
    components: { CardPanel, limsTable },
    props: {
        contentsId: {
            type: Number,
            default: 0
        }
    },
    data() {
        return {
            isActive: -1,
            columns: [
                {
                    label: "耗材编号",
                    prop: "itemNumber"
                },
                {
                    label: "耗材名称",
                    prop: "consumablesName"
                },
                {
                    label: "耗材类型",
                    prop: "consumablesType"
                },
                {
                    label: "规格",
                      prop: "specifications"
                },
                {
                    label: "单位",
                    prop: "unit"
                },
                {
                    label: "单价",
                    prop: "referencePrice"
                },
                {
                    label: "当前库存",
                    prop: "currentAmount"
                },
                {
                    label: "负责人",
                    prop: "personInChargeName"
                },
                {
                    label: "上次更新时间",
                    prop: "updateTime"
                }
            ],
            cardList: [],
            tableData: []
        }
    },
    watch: {
        contentsId(newVal, oldVal) {
            this.getTableData(newVal)
        }
    },
    mounted() {
        this.getTableData(this.contentsId)
    },
    methods: {
        handleCard(data, index) {
            this.isActive = index
            this.tableData = [data]
        },
        async getTableData(id) {
          procurementSuppliesList({contentsId: id}).then(res => {
            if(res.code == 200) {
              this.cardList = res.data.records.map(m=>{
                m.logo = m.consumablesIcon
                return m
              })
            }
          })
        }
    }
}
</script>
<style scoped>
.title {
  position: relative;
  font-size: 18px;
  color: var(--lims-text);
  font-weight: 400;
  padding-left: 10px;
  margin-left: 15px;
}
 
.title::before {
  position: absolute;
  left: 0;
  top: 4px;
  content: '';
  width: 4px;
  height: 18px;
  background-color: var(--el-color-primary);
  border-radius: 2px;
}
.card-box {
    width: 100%;
    padding-left: 5px;
    padding-right: 5px;
    height: 30vh;
    overflow-y: auto;
}
</style>