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
136
| <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>
| <ZTTable
| style="margin-top: 18px; padding: 0 15px;"
| :height="'40vh'"
| :column="columns"
| :table-data="tableData"
| >
| <div slot="action" slot-scope="scope">
| <el-button type="text" @click="showDialog(scope)">查看</el-button>
| </div>
| </ZTTable>
| </template>
| </TableCard>
| <Edit ref="editRef" @submit="getTableData" type="详情" />
| </div>
| </template>
| <script>
| import CardPanel from './components/CardPanel.vue';
| import TableCard from '@/components/caorui/TableCard/index.vue';
| import ZTTable from '@/components/caorui/ZTTable/index.vue';
| import Edit from "../components/Edit.vue"
| import { selectSupplierManagementPage } from "@/assets/api/api";
| import axios from 'axios';
|
| export default {
| components: {CardPanel, TableCard, ZTTable, Edit},
| props: {
| contentsId: {
| type: Number,
| default: 0
| }
| },
| data() {
| return {
| columns: [
| {
| label: "供应商编号",
| prop: "supplierRef"
| },
| {
| label: "供应商名称",
| prop: "supplierRef"
| },
| {
| label: "地址",
| prop: "supplierName"
| },
| {
| 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 axios({
| method: 'get',
| url: `${selectSupplierManagementPage}/${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: 30vh;
| overflow-y: auto;
| }
| </style>
|
|