|
@@ -121,7 +121,7 @@
|
|
|
:label="'附加' + (index + 1)"
|
|
|
:prop="'attachs.' + index + '.attach_name'"
|
|
|
:rules="rules.attach">
|
|
|
- <el-col :span="8">
|
|
|
+ <el-col :span="6">
|
|
|
<el-select
|
|
|
v-model="attr.attach_name"
|
|
|
filterable
|
|
@@ -138,7 +138,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="10">
|
|
|
<el-select
|
|
|
v-model="attr.attach_content"
|
|
|
multiple
|
|
@@ -155,6 +155,11 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-input type="number"
|
|
|
+ v-model="attr.attach_max_num"
|
|
|
+ placeholder="最多可选数量"></el-input>
|
|
|
+ </el-col>
|
|
|
<el-col :span="3" :offset="1">
|
|
|
<el-button type="warning"
|
|
|
size="small"
|
|
@@ -232,7 +237,9 @@ export default {
|
|
|
const checkAttachContent = (rule, value, callback) => {
|
|
|
const index = rule.field.replace(/\w*\./, '').replace(/\.\w*/, '')
|
|
|
const attachContent = this.form.attachs[index * 1].attach_content
|
|
|
- if ((value && attachContent.length) || (!value && attachContent.length < 1)) {
|
|
|
+ const attachMaxNum = this.form.attachs[index * 1].attach_max_num * 1
|
|
|
+
|
|
|
+ if ((value && attachContent.length && attachMaxNum > 0) || (!value && attachContent.length < 1)) {
|
|
|
callback()
|
|
|
} else {
|
|
|
if (!value) {
|
|
@@ -241,6 +248,9 @@ export default {
|
|
|
if (!attachContent.length) {
|
|
|
callback(new Error('请选择附加明细'))
|
|
|
}
|
|
|
+ if (!attachMaxNum) {
|
|
|
+ callback(new Error('请输入最多可选数量'))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -265,7 +275,8 @@ export default {
|
|
|
attachs: [
|
|
|
{
|
|
|
attach_name: '', // 规格名称
|
|
|
- attach_content: [] // 附加选项(以逗号隔开)
|
|
|
+ attach_content: [], // 附加选项(以逗号隔开)
|
|
|
+ attach_max_num: 1
|
|
|
}
|
|
|
] // 规格
|
|
|
},
|
|
@@ -330,7 +341,8 @@ export default {
|
|
|
addAttach () {
|
|
|
this.form.attachs.push({
|
|
|
attach_name: '',
|
|
|
- attach_content: []
|
|
|
+ attach_content: [],
|
|
|
+ attach_max_num: 1
|
|
|
})
|
|
|
},
|
|
|
setAttachContentOptions (name, arr) {
|