spring
2025-03-07 ae5a56abad5cade3427d8ccac8588de9ce209ef3
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
<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-row>
    <TableCard title="供应商信息" :showForm="false" style="margin-top: 5px">
      <template v-slot:table>
        <limsTable style="margin-top: 18px; padding: 0 15px" :height="'150px'" :column="columns"
          :table-data="tableData">
          <div slot="action" slot-scope="scope">
            <el-button type="text" @click="showDialog(scope)">查看</el-button>
          </div>
        </limsTable>
      </template>
    </TableCard>
    <Edit ref="editRef" @submit="getTableData" />
  </div>
</template>
<script>
import CardPanel from "./CardPanel.vue";
import TableCard from "@/components/TableCard/index.vue";
import limsTable from "@/components/Table/lims-table.vue";
import Edit from "./Edit.vue";
import {
  selectSupplierManagementByParentId,
} from "@/api/cnas/resourceDemand/externalService/supplierManage/supplierManage.js";
 
export default {
  components: { CardPanel, TableCard, limsTable, Edit },
  props: {
    contentsId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      columns: [
        {
          label: "供应商编号",
          prop: "supplierRef",
        },
        {
          label: "供应商名称",
          prop: "supplierName",
        },
        {
          label: "地址",
          prop: "adress",
        },
        {
          label: "联系人",
          prop: "contacts",
        },
        {
          label: "联系电话",
          prop: "phone",
        },
        {
          label: "传真",
          prop: "fax",
        },
        {
          label: "网址",
          prop: "website",
        },
        {
          label: "邮箱",
          prop: "email",
        },
        {
          label: "上次更新时间",
          prop: "updateTime",
        },
        {
          fixed: "right",
          dataType: "slot",
          slot: "action",
          label: "操作",
        },
      ],
      cardList: [],
      tableData: [],
      isActive: -1,
    };
  },
  watch: {
    contentsId(newVal) {
      if (newVal !== 0) {
        this.getTableData();
      }
    },
  },
  mounted() {
    this.getTableData(this.contentsId);
  },
  methods: {
    // 获取表格数据
    async getTableData() {
      const { code, data } = await selectSupplierManagementByParentId(this.contentsId);
      if (code == 200) {
        this.cardList = data;
      }
    },
    handleCard(data, index) {
      this.isActive = index;
      this.tableData = [data];
    },
    showDialog(row) {
      this.$refs.editRef.openDialog(row);
    },
  },
};
</script>
<style scoped>
.card-box {
  width: 100%;
  padding-left: 5px;
  padding-right: 5px;
  height: 45vh;
  overflow-y: auto;
}
</style>