6
6
<el-form-item label =" 规格名称" prop =" name" >
7
7
<el-input v-model =" queryParams.name" placeholder =" 请输入规格名称" clearable @keyup.enter.native =" handleQuery" />
8
8
</el-form-item >
9
- <el-form-item label =" 开启状态 " prop =" status" >
9
+ <el-form-item label =" 状态 " prop =" status" >
10
10
<el-select v-model =" queryParams.status" placeholder =" 请选择开启状态" clearable size =" small" >
11
11
<el-option v-for =" dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
12
12
:key =" dict.value" :label =" dict.label" :value =" dict.value" />
33
33
34
34
<!-- 列表 -->
35
35
<el-table v-loading =" loading" :data =" list" >
36
- <el-table-column label =" 规格名称 " align =" center" prop =" name " />
37
- <el-table-column label =" 规格名称" align =" center" prop = " propertyValueList " >
36
+ <el-table-column label =" 规格id " align =" center" prop =" id " />
37
+ <el-table-column label =" 规格名称" align =" center" :show-overflow-tooltip = " true " >
38
38
<template slot-scope="scope">
39
- <span >{{formatList(scope.row.propertyValueList)}}</span >
39
+ <router-link :to =" '/property/value/' + scope.row.id" class =" link-type" >
40
+ <span >{{ scope.row.name }}</span >
41
+ </router-link >
40
42
</template >
41
- </el-table-column >
43
+ </el-table-column >
42
44
<el-table-column label =" 开启状态" align =" center" prop =" status" >
43
45
<template slot-scope="scope">
44
46
<dict-tag :type =" DICT_TYPE.COMMON_STATUS" :value =" scope.row.status" />
49
51
<span >{{ parseTime(scope.row.createTime) }}</span >
50
52
</template >
51
53
</el-table-column >
54
+ <el-table-column label =" 备注" align =" center" prop =" left" />
52
55
<el-table-column label =" 操作" align =" center" class-name =" small-padding fixed-width" >
53
56
<template slot-scope="scope">
54
57
<el-button size =" mini" type =" text" icon =" el-icon-edit" @click =" handleUpdate(scope.row)"
65
68
<!-- 对话框(添加 / 修改) -->
66
69
<el-dialog :title =" title" :visible.sync =" open" width =" 500px" append-to-body >
67
70
<el-form ref =" form" :model =" form" :rules =" rules" label-width =" 80px" >
71
+ <el-form-item label =" 规格id" prop =" id" v-if =" form.id != null" >
72
+ <el-input v-model =" form.id" disabled />
73
+ </el-form-item >
68
74
<el-form-item label =" 规格名称" prop =" name" >
69
75
<el-input v-model =" form.name" placeholder =" 请输入规格名称" />
70
76
</el-form-item >
75
81
</el-radio >
76
82
</el-radio-group >
77
83
</el-form-item >
78
- <el-form-item label =" 属性值 " >
79
- <el-button type = " primary " plain icon = " el-icon-plus " size = " mini " @click = " addPropertyValue() " >添加</ el-button >
84
+ <el-form-item label =" 备注 " prop = " remark " >
85
+ <el-input v-model = " form.remark " placeholder = " 备注 " / >
80
86
</el-form-item >
81
- <el-form-item
82
- v-for =" (domain, index) in form.propertyValueList"
83
- :key =" domain.key"
84
- :prop =" 'propertyValueList.' + index + '.name'"
85
- :rules =" {
86
- required: true, message: '属性值不能为空', trigger: 'blur'
87
- }"
88
- >
89
- <el-row >
90
- <el-col :span =" 18" >
91
- <el-input v-model =" domain.name" size =" mini" ></el-input >
92
- </el-col >
93
- <el-col :span =" 6" >
94
- <el-button style =" margin-left : 20px ;" size =" mini" @click.prevent =" removePropertyValue(domain)" >删除</el-button >
95
- </el-col >
96
- </el-row >
97
- </el-form-item >
98
87
</el-form >
99
88
<div slot =" footer" class =" dialog-footer" >
100
89
<el-button type =" primary" @click =" submitForm" >确 定</el-button >
@@ -139,12 +128,17 @@ export default {
139
128
form: {
140
129
name: ' ' ,
141
130
status: ' ' ,
142
- propertyValueList: [{
143
- name: ' '
144
- }],
131
+ remark: " " ,
132
+ id: null ,
145
133
},
146
134
// 表单校验
147
135
rules: {
136
+ name: [
137
+ { required: true , message: " 规格不能为空" , trigger: " blur" }
138
+ ],
139
+ status: [
140
+ { required: true , message: " 状态不能为空" , trigger: " blur" }
141
+ ]
148
142
}
149
143
};
150
144
},
@@ -170,12 +164,10 @@ export default {
170
164
/** 表单重置 */
171
165
reset () {
172
166
this .form = {
173
- id: undefined ,
174
- name: undefined ,
175
- status: undefined ,
176
- propertyValueList: [{
177
- name: ' '
178
- }]
167
+ name: ' ' ,
168
+ status: ' ' ,
169
+ remark: " " ,
170
+ id: null ,
179
171
};
180
172
this .resetForm (" form" );
181
173
},
@@ -253,27 +245,6 @@ export default {
253
245
this .exportLoading = false ;
254
246
}).catch (() => {});
255
247
},
256
- removePropertyValue (item ) {
257
- var index = this .form .propertyValueList .indexOf (item)
258
- if (index !== - 1 ) {
259
- this .form .propertyValueList .splice (index, 1 )
260
- }
261
- },
262
- addPropertyValue () {
263
- this .form .propertyValueList .push ({
264
- name: ' '
265
- });
266
- },
267
- formatList (list ) {
268
- let str = ' '
269
- for (var i = 0 ; i < list .length ; i++ ) {
270
- str += list[i].name ;
271
- if (i != list .length - 1 ){
272
- str+= " /" ;
273
- }
274
- }
275
- return str
276
- }
277
248
}
278
249
};
279
250
</script >
0 commit comments