chanpin.vue
12.3 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<template>
<div>
<div class="fa-box">
<div class="lik">
<div class="fa-ji">
<div class="ge"></div>
<div class="fa-text">产品管理</div>
</div>
<div class="peiches">
<el-button type="primary" @click="addEidor">添加产品</el-button>
</div>
</div>
<div class="biaoge">
<div class="biao-box">
<div class="fhuo">
<div class="fahuos">
<div class="fas-text">部门ID</div>
<input type="text" placeholder="请输入部门ID" class="fa-input" />
</div>
<div class="fahuos">
<div class="fas-text">产品型号</div>
<input
type="text"
placeholder="请输入产品型号"
class="fa-input"
/>
</div>
<div class="fahuos">
<div class="fas-text">产品编号</div>
<input
type="text"
placeholder="请输入产品编号"
class="fa-input"
v-model="productId"
/>
</div>
<div class="fahuos">
<div class="fas-text">状态</div>
<input
type="text"
placeholder="请输入状态"
class="fa-input"
v-model="telegramStatus"
/>
</div>
</div>
</div>
<div class="zhonlist">
<el-table
:data="tableData"
border
style="width: 100%"
height="100%"
:header-cell-style="{ background: '#F4F4F5', color: '#303133' }"
>
<el-table-column
fixed
prop="productCoding"
label="产品编码"
width="184"
>
</el-table-column>
<el-table-column prop="productName" label="产品名称" width="284">
</el-table-column>
<el-table-column prop="productType" label="产品类型 " width="128">
<template slot-scope="scope">
<span>{{ scope.row.productType == 1 ? "成套" : "标准" }}</span>
</template>
</el-table-column>
<el-table-column prop="breed" label="品种" width="128">
</el-table-column>
<el-table-column prop="productModel" label="产品型号" width="128">
</el-table-column>
<el-table-column prop="size" label="尺寸" width="160">
</el-table-column>
<el-table-column prop="weight" label="重量" width="128">
</el-table-column>
<el-table-column prop="deptId" label="事业部 " width="160">
</el-table-column>
<el-table-column prop="status" label="状态 " width="160">
<template slot-scope="scope">
<span
type="text"
size="small"
:style="{
color:
scope.row.status == 1
? 'rgba(255, 0, 0, 1)'
: 'rgba(0, 204, 0, 1)',
}"
>{{ scope.row.status == 1 ? "停用" : "正常" }}</span
>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="196">
<template slot-scope="scope">
<el-button type="text" size="small" @click="editor(scope.row)"
>编辑</el-button
>
<el-button type="text" size="small">{{
scope.row.status == 1 ? "解禁" : "禁用"
}}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="tiaoshu">
<div class="left-io"></div>
<div class="gon">共{{ total }}条</div>
<div class="kls">
<el-pagination
:page-size="10"
:pager-count="11"
layout="prev, pager, next"
:total="total"
:current-page="pageNum"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
</div>
</div>
<!-- 添加产品 -->
<el-dialog
:title="editorProduct == '' ? '添加产品' : '编辑商品'"
:visible.sync="dialogVisible"
width="55%"
style="margin-top: 10%"
:append-to-body="true"
>
<div class="liebiao">
<div class="fahuo-li">
<div class="a" style="width: 33.3%">
<div class="sd">
<div class="fa-ji">产品型号</div>
<input
type="text"
placeholder="请输入产品型号"
class="input"
v-model="productModel"
/>
</div>
<div class="sd">
<div class="fa-ji">产品名称</div>
<input
type="text"
placeholder="请输入产品名称"
class="input"
v-model="productName"
/>
</div>
<div class="sd">
<div class="fa-ji">品类</div>
<input
type="text"
placeholder="请输入品类"
class="input"
v-model="breed"
/>
</div>
<div class="sd">
<div class="fa-ji">事业部</div>
<input
type="text"
placeholder="请输入事业部"
class="input"
v-model="deptId"
/>
</div>
</div>
<div class="a" style="width: 33.3%">
<div class="sd">
<div class="fa-ji">产品编号</div>
<input
type="text"
placeholder="请输入产品编号"
class="input"
v-model="productCoding"
/>
</div>
<div class="sd">
<div class="fa-ji">尺寸</div>
<input
type="text"
placeholder="请输入尺寸"
class="input"
v-model="size"
/>
</div>
</div>
<div class="a" style="width: 33.3%">
<div class="sd">
<div class="fa-ji">产品类型</div>
<el-select v-model="productType" placeholder="请选择产品类型">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
<div class="sd">
<div class="fa-ji">重量</div>
<input
type="text"
placeholder="请输入重量"
class="input"
v-model="weight"
/>
</div>
</div>
</div>
<div class="queren">
<el-button type="primary" round @click="xinzeng">确认</el-button>
<el-button round @click="dialogVisible = false">取消</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
tableData: [],
options: [{
value: '1',
label: '成套'
}, {
value: '2',
label: '标准'
}],
dialogVisible: false,
dialogImageUrl: "",
productModel: "", //产品型号
breed: "", //品类
deptId: "", //事业部
productId: "", //产品编码
size: "", //尺寸
productType: "", //产品类型
weight: "", //重量
productName: '',
pageSize: 10,
pageNum: 1,
productId: "", //产品编码
telegramStatus: "", //转态
total: null,
editorProduct: '',//获取同行的所有数据
};
},
mounted() {
this.chanpinliet();
},
watch:{
data(dialogVisible,newdialogVisible){
console.log(dialogVisible)
console.log(newdialogVisible)
}
},
methods: {
//新增产品 修改必须还的用这个
xinzeng() {
let that = this;
let params = {
productModel: that.productModel,
breed: that.breed,
deptId: that.deptId,
productCoding: that.productCoding,
size: that.size,
productType: that.productType,
weight: that.weight,
productName: that.productName,
};
if (that.editorProduct == '' || that.editorProduct == null) {
let url = "/api/system/product/add";
that.$axios
.post(url, params)
.then(function (res) {
console.log(res);
that.$message({
message: "添加成功",
type: "success",
});
that.dialogVisible = false
that.tableData.unshift(params)
that.total++
})
.catch(function (err) {
console.log(err);
});
} else {
let url = "/api/system/product/edit";
that.$axios
.put(url, params)
.then(function (res) {
console.log(res);
that.$message({
message: "修改成功",
type: "success",
});
that.dialogVisible = false
that.editorProduct = ''
})
.catch(function (err) {
console.log(err);
});
}
},
//获取产品信息列表
chanpinliet() {
let that = this;
var url = "/api/system/product/list";
let params = {
pageNum: that.pageNum,
pageSize: that.pageSize,
productId: that.productId,
telegramStatus: that.telegramStatus,
};
that.$axios
.post(url, params)
.then(function (res) {
console.log(res);
that.tableData = res.rows;
that.total = res.total
})
.catch(function (err) {
console.log(err);
});
},
//编辑发货申请
handleClick(row) {
console.log(row);
this.dialogVisibleg = false;
this.dialogVisibleyu = true;
},
//上传图片
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//**编辑商品 * */
editor(val) {
console.log(val)
this.$axios("api/system/product/"+val.productId+"").then(res=>{
console.log(res)
val=res.data
}).catch(err=>{
console.log(err)
})
this.editorProduct = val;
this.dialogVisible = true
this.productModel = val.productModel
this.breed = val.breed
this.deptId = val.deptId
this.productCoding = val.productCoding
this.size = val.size
this.productType = val.productType
this.weight = val.weight
this.productName = val.productName
this.productId=val.productId
},
/** 添加商品 * */
addEidor() {
this.editorProduct = '';
this.dialogVisible = true
this.productModel = ''
this.breed = ''
this.deptId = ''
this.productId = ''
this.size = ''
this.productType = ''
this.weight = ''
},
handleCurrentChange(pageNum) {
this.pageNum = pageNum;
this.chanpinliet()
}
},
updated() {
}
};
</script>
<style>
.el-dialog__body {
padding: 5px 20px;
padding-bottom: 68px;
}
.el-dialog__title {
font-size: 22px !important;
color: #000000 !important;
font-weight: 500;
}
.el-upload--picture-card {
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
}
.el-upload-list--picture-card .el-upload-list__item {
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
}
.el-carousel__container {
margin-top: 52px;
height: 629px;
}
/* .el-table /deep/.DisabledSelection .cell .el-checkbox__inner{
margin-left: -30px;
position:relative;
} */
.el-table /deep/.DisabledSelection .cell:before {
content: "全选";
position: absolute;
right: 42px;
}
</style>
<style scoped>
@import "../../css/fa.css";
@import "../../css/pei.css";
</style>