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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<template>
<!--
<c-col :span="24">
<el-row>
<el-col :span="spanVal" v-for="(item, idx) in displayIconList" :key="idx" :offset="1">
<el-card :body-style="{ padding: '0px' }" style="height:100%">
<img :src="item.src" class="image">
<div style="padding: 5px;">
<span style="text-align:center;font-size:5px">{{item.name}}</span>
<el-button type="text" class="button" icon="el-icon-delete" @click="DeleteIcon(item.id)"></el-button>
</div>
</el-card>
</el-col>
<el-col :span="spanVal" :offset="1">
<el-card :body-style="{ padding: '0px' }">
<img :src="require('~/assets/add.png')" class="image" @click="AddIcon">
</el-card>
</el-col>
</el-row>
<el-dialog :visible.sync="IconDialog" :title="'单据列表'">
<div style="height:200px">
<el-col :span="14">
<el-col :span="spanVal" v-for="(item, idx) in hideIconList" :key="idx" :offset="1">
<el-card :body-style="{ padding: '0px' }" style="height:100%">
<img :src="item.src" class="image">
<div style="padding: 5px;">
<span style="text-align:center;font-size:5px">{{item.name}}</span>
<el-button type="text" class="button" icon="el-icon-plus" @click="InsertIcon(item.id)"></el-button>
</div>
</el-card>
</el-col>
</el-col>
</div>
</el-dialog>
</c-col>
-->
<c-col :span="24">
<el-row>
<el-col :span="spanVal" v-for="(item, idx) in displayIconList" :key="idx" :offset="1">
<el-card :body-style="{ padding: '0px' }" style="height:100%">
<!-- <img :src="item.src" class="image"> -->
<div class="image_icon" >
<span style="font-size:10px">{{item.name}}</span>
<el-button type="text" class="button" icon="el-icon-delete" @click="DeleteIcon(item.id)"></el-button>
</div>
</el-card>
</el-col>
<el-col :span="spanVal" :offset="1">
<el-card :body-style="{ padding: '0px', border:'1px dashed '}" style="height:100%">
<div class="image_icon" >
<!-- <img :src="require('~/assets/add.png')" class="image" @click="AddIcon"> -->
<!-- <span style="text-align:center;font-size:5px">添加</span> -->
<el-button type="text" class="button" icon="el-icon-plus" @click="AddIcon"></el-button>
</div>
</el-card>
</el-col>
</el-row>
<el-dialog :visible.sync="IconDialog" :title="'单据列表'">
<div style="height:200px">
<el-col :span="14">
<el-col :span="spanVal" v-for="(item, idx) in hideIconList" :key="idx" :offset="1">
<el-card :body-style="{ padding: '0px'}" style="height:100%">
<!-- <img :src="item.src" class="image"> -->
<div class="image_icon" >
<span style="text-align:center;font-size:5px">{{item.name}}</span>
<el-button type="text" class="button" icon="el-icon-plus" @click="InsertIcon(item.id)"></el-button>
</div>
</el-card>
</el-col>
</el-col>
</div>
</el-dialog>
</c-col>
</template>
<script>
import Api from "~/service/Api"
export default {
props: {
IconList: {
type: [Array],
default: () => {
return [];
},
},
spanVal:{
type : [Number],
default: () => {
return 4;
},
}
},
data(){
return {
IconDialog: false,
IconsData:[
{
id:"invoice",
src: require("~/assets/发票1.png"),
name:"发票",
},
{
id:"receipt",
src: require("~/assets/收据1.png"),
name:"货物收据",
},
{
id:"oceanShipping",
src: require("~/assets/海运舱单.png"),
name:"海运提单",
}
],
}
},
computed: {
displayIconList: function(){
const arr = []
for(var i = 0; i < this.IconList.length; i++){
for(var j = 0; j < this.IconsData.length; j++){
if(this.IconsData[j].id == this.IconList[i]){
arr.push(this.IconsData[j]);
continue;
}
}
}
return arr;
},
hideIconList() {
const arr = []
for(var j = 0; j < this.IconsData.length; j++){
if(!this.IconList.includes(this.IconsData[j].id)){
arr.push(this.IconsData[j]);
continue;
}
}
return arr;
}
},
methods: {
DeleteIcon(id){
this.$emit("deleteIcon", id)
},
AddIcon(){
this.IconDialog = true;
},
InsertIcon(id){
this.$emit("insertIcon", id)
}
},
watch:{
},
created:function(){
}
};
</script>
<style>
.icon_card{
display: flex;
justify-content: center;
align-items: center;
}
.image {
width: 10%;
display: block;
}
.image_icon {
padding: 5px;
height:40px;
display: flex;
justify-content: center;
align-items: center;
}
</style>