licp
2024-12-27 6d0552908bc5c17ab9af74120819ec6d3e5df674
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
<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>
                <ZTTable
                    style="margin-top: 18px; padding: 0 15px;"
                    :height="'20vh'"
                    :column="columns"
                    :table-data="tableData"
                >
                </ZTTable>
            </template>
        </TableCard>
    </div>
</template>
<script>
import CardPanel from '@/components/caorui/6-6/ConsumableOverview/components/CardPanel';
import TableCard from '@/components/caorui/TableCard/index.vue';
import ZTTable from '@/components/caorui/ZTTable/index.vue';
import { procurementSuppliesList } from "@/assets/api/api";
import axios from "axios";
 
export default {
    components: { CardPanel, TableCard, ZTTable },
    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) {
            const { code, data } = await axios({
                method: 'get',
                url: `${procurementSuppliesList}`,
                params: {
                    contentsId: id
                }
            })
            if(code == 200) {
                this.cardList = 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>