layout.vue
8.07 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<style scoped>
.layout {
background: #f5f7f9;
position: relative;
overflow: visible;
min-height: 500px;
}
.layout-logo {
width: 100px;
height: 30px;
background: #5b6270;
border-radius: 3px;
float: left;
position: relative;
top: 15px;
left: 20px;
}
.layout-nav {
width: 420px;
margin: 0 auto;
margin-right: 20px;
}
.layout-footer-center {
text-align: center;
}
.title {
text-align: center;
color: white;
font-size: 28px;
}
</style>
<template>
<div class="layout">
<Layout>
<Header>
<Menu mode="horizontal" theme="dark" active-name="1">
<div class="title">YOHO!人工智能平台</div>
</Menu>
</Header>
<Content :style="{padding: '0 50px'}">
<Breadcrumb :style="{margin: '20px 0'}">
<BreadcrumbItem>首页</BreadcrumbItem>
<BreadcrumbItem>标注</BreadcrumbItem>
</Breadcrumb>
<Card>
<div>
<Form ref="from" inline :label-width="70">
<FormItem label="品类">
<SelectCategory v-model="sortList"></SelectCategory>
</FormItem>
<FormItem label="skn">
<Input type="text" placeholder="skn" v-model="searchItem.productSkn">
</Input>
</FormItem>
<FormItem label="开始skn">
<Input type="text" placeholder="skn" v-model="searchItem.startSkn">
</Input>
</FormItem>
<FormItem label="结束skn">
<Input type="text" placeholder="skn" v-model="searchItem.endSkn">
</Input>
</FormItem>
<FormItem label="来源">
<Select v-model="searchItem.source">
<Option :value="0">全部</Option>
<Option :value="1">有货</Option>
<Option :value="2">天猫</Option>
</Select>
</FormItem>
<Button type="primary" @click="onClickForSearch">搜索</Button>
<Button type="error" @click="onClickForClear">清除</Button>
</Form>
</div>
<Table :columns="columns" :data="list"></Table>
<Page :total="pager.rows" :current="pager.page" :page-size="pager.size" @on-change="onPageChange" style="margin-top:20px;text-align: right;"></Page>
</Card>
</Content>
<Footer class="layout-footer-center">2011-2018 © YOHO</Footer>
</Layout>
<BackTop ref="backtop"></BackTop>
</div>
</template>
<script>
import ApiService from 'service/api'
import ProductImage from './components/product-image'
import CheckImage from './components/check-image'
import SelectCategory from './components/select-category'
export default {
data () {
return {
columns: [
{
title: 'skn',
width: 100,
render: (h, {row}) => {
return (
<span>{row.product.productSkn}</span>
)
}
},
{
title: '商品',
width: 180,
render: (h, {row}) => {
return h(ProductImage, {
props: {
src: row.product.url,
}
})
}
},
{
title: '相似图',
key: 'imgs',
render: (h, {row}) => {
let self = this
return h(CheckImage, {
props: {
list: row.imageList,
},
on: {
'on-change': self.onClickForOne
}
})
}
},
{
title: '操作',
width: 150,
render: (h, {row}) => {
return (
<div>
<i-button onClick={() => this.onClickForAll(row)}>全部通过</i-button>
</div>
)
}
}
],
list: [],
searchItem: {
productSkn: '',
startSkn: '',
endSkn: '',
source: 0,
maxSortId: 0,
middleSortId: 0
},
sortList: [],
pager: {
rows : 0,
size : 10,
page: 1
}
}
},
created() {
this.api = new ApiService()
this.getList()
},
methods: {
onPageChange(page) {
this.pager.page = page
this.getList()
},
onClickForSearch() {
this.getList()
},
onClickForClear() {
this.searchItem.productSkn = ''
this.searchItem.startSkn = ''
this.searchItem.endSkn = ''
this.searchItem.source = 0
this.sortList = []
},
onClickForAll(row) {
let imageList = row.imageList.map(r => r.imageId)
let product = {
imageId: imageList,
isMark: 1,
productId: row.product.productId
}
this.api.confirmAll(product).then((result) => {
row.imageList.forEach(i => {
i.isMark = 1
})
this.$Message.info('更新成功')
}).catch(() => {
this.$Message.error('更新失败')
})
},
onClickForOne() {
},
getList() {
const msg = this.$Message.loading({
content: '查询中......',
duration: 0
});
this.api.list(Object.assign({}, this.searchItem, this.pager)).then((result) => {
this.list = result.boList
this.pager.page = result.page
this.pager.rows = result.rows
this.pager.size = result.size
this.$nextTick(() =>{
this.$refs.backtop.back()
})
msg()
}).catch(() => {
msg()
this.$Message.error('查询失败')
})
},
},
components: {
ProductImage,
CheckImage,
SelectCategory
},
watch: {
sortList: {
handler(newVal){
this.searchItem.maxSortId = newVal[0] && newVal[0].value || ''
this.searchItem.midSortId = newVal[1] && newVal[1].value || ''
},
deep: true
}
}
}
</script>