|
@@ -40,8 +40,9 @@
|
|
<el-table-column label="领取数量" align="center">
|
|
<el-table-column label="领取数量" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-form-item :prop="`deviceRespList.${scope.$index}.totalNum`"
|
|
<el-form-item :prop="`deviceRespList.${scope.$index}.totalNum`"
|
|
- :rules="{ required: true, trigger: 'change' }">
|
|
|
|
- <el-input-number v-model="scope.row.totalNum" :controls="false" :min="1" placeholder="请输入领取数量" />
|
|
|
|
|
|
+ :rules="[{ type: 'number', required: true, min: num[scope.$index] ? num[scope.$index] : 1, trigger: 'blur' }]">
|
|
|
|
+ <el-input-number v-model="scope.row.totalNum" :controls="false" :min="1" placeholder="请输入领取数量"
|
|
|
|
+ @change="handleChange($event, scope.$index)" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -76,6 +77,8 @@ export default {
|
|
types: [2, 4],
|
|
types: [2, 4],
|
|
// 生效期内禁止修改活动设备
|
|
// 生效期内禁止修改活动设备
|
|
disabledActivity: this.$route.query.activityState == 0 ? true : false,
|
|
disabledActivity: this.$route.query.activityState == 0 ? true : false,
|
|
|
|
+ // 生效期内领取数量禁止下调
|
|
|
|
+ num: [],
|
|
// 只读
|
|
// 只读
|
|
disabled: Boolean(this.$route.query.boolean),
|
|
disabled: Boolean(this.$route.query.boolean),
|
|
// 校验
|
|
// 校验
|
|
@@ -93,13 +96,13 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- // 禁用已关联设备
|
|
|
|
'form.deviceRespList': {
|
|
'form.deviceRespList': {
|
|
handler(val) {
|
|
handler(val) {
|
|
for (let i in this.devOptions) {
|
|
for (let i in this.devOptions) {
|
|
this.devOptions[i].disabled = false
|
|
this.devOptions[i].disabled = false
|
|
}
|
|
}
|
|
- val.map(i => {
|
|
|
|
|
|
+ // 禁用已关联设备
|
|
|
|
+ val.map((i, index) => {
|
|
if (i.deviceId) {
|
|
if (i.deviceId) {
|
|
let index = this.devOptions.findIndex(j => j.value === i.deviceId)
|
|
let index = this.devOptions.findIndex(j => j.value === i.deviceId)
|
|
this.devOptions[index].disabled = true
|
|
this.devOptions[index].disabled = true
|
|
@@ -120,6 +123,9 @@ export default {
|
|
detail(this.$route.query.id).then(res => {
|
|
detail(this.$route.query.id).then(res => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
this.form = res.data
|
|
this.form = res.data
|
|
|
|
+ res.data.deviceRespList.map(i => {
|
|
|
|
+ this.num.push(i.totalNum)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -134,6 +140,13 @@ export default {
|
|
this.form.deviceRespList.push({})
|
|
this.form.deviceRespList.push({})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 已生效的活动 设备数量不能修改的比之前小
|
|
|
|
+ handleChange(e, index) {
|
|
|
|
+ if (this.disabledActivity && this.num[index] > e) {
|
|
|
|
+ this.$message.error('已生效活动,当前领取数量不可减少')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
// 删除
|
|
// 删除
|
|
getDelete(deviceId, index) {
|
|
getDelete(deviceId, index) {
|
|
this.form.deviceRespList.splice(index, 1)
|
|
this.form.deviceRespList.splice(index, 1)
|