spring
2025-03-07 45a54dc30f81bee5dcbac4e63acc5d766d0be536
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
<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: #909399;font-size: 14px;text-align: center;margin-top: 20px;">暂无数据</el-col>
        </el-row>
        <TableCard title="耗材信息" :showForm="false" style="margin-top: 5px">
            <template v-slot:table>
                <limsTable style="margin-top: 18px; padding: 0 15px;" :height="'20vh'" :column="columns"
                    :table-data="tableData">
                </limsTable>
            </template>
        </TableCard>
    </div>
</template>
<script>
import CardPanel from './CardPanel.vue';
import TableCard from './index.vue';
import { procurementSuppliesList } from "@/api/cnas/resourceDemand/externalService/serviceAndSupplyPro/serviceAndSupplyPro"
import limsTable from '@/components/Table/lims-table.vue'
 
export default {
    components: { CardPanel, TableCard, 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>
.card-box {
    width: 100%;
    padding-left: 5px;
    padding-right: 5px;
    height: 30vh;
    overflow-y: auto;
}
</style>