允许积分设置负值@陈锐

This commit is contained in:
aixianling
2024-08-08 10:26:08 +08:00
parent 01cd905669
commit bc1504cce5

View File

@@ -27,7 +27,7 @@
<el-input placeholder="请输入三类" size="small" v-model="form.classThree"></el-input>
</el-form-item>
<el-form-item label="分值" prop="integral" style="width: 100%;" :rules="[{required: true, message: '请输入分值', trigger: 'change'}]">
<el-input-number v-model="form.integral" :min="0"></el-input-number>
<el-input-number v-model="form.integral"/>
</el-form-item>
</el-form>
</template>
@@ -41,98 +41,98 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
export default {
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
form: {
classOne: '',
classThree: '',
classTwo: '',
girdId: '',
girdName: '',
integral: ''
},
id: ''
}
},
props: {
instance: Function,
dict: Object,
params: Object
},
data() {
return {
form: {
classOne: '',
classThree: '',
classTwo: '',
girdId: '',
girdName: '',
integral: ''
},
id: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
created() {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
},
methods: {
getInfo (id) {
this.instance.post(`/app/appintegralpublicityinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = {
...res.data,
girdId: [res.data.girdId]
}
methods: {
getInfo(id) {
this.instance.post(`/app/appintegralpublicityinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = {
...res.data,
girdId: [res.data.girdId]
}
})
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.isFlag = true
this.instance.post(`/app/appintegralpublicityinfo/addOrUpdate`, {
...this.form,
girdId: this.form.girdId[0]
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
onUserChange (e) {
if (e.length) {
this.form.girdName = e[0].girdName
} else {
this.form.girdId = []
this.form.girdName = ''
}
})
},
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
this.isFlag = true
this.instance.post(`/app/appintegralpublicityinfo/addOrUpdate`, {
...this.form,
girdId: this.form.girdId[0]
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 600)
}
})
}
})
},
cancel(isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
onUserChange(e) {
if (e.length) {
this.form.girdName = e[0].girdName
} else {
this.form.girdId = []
this.form.girdName = ''
}
}
}
}
</script>
<style scoped lang="scss">
.time-select {
padding: 0 16px;
height: 36px;
.time-select {
padding: 0 16px;
height: 36px;
line-height: 36px;
border: 1px solid #d0d4dc;
border-radius: 4px;
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 36px;
border: 1px solid #d0d4dc;
border-radius: 4px;
display: flex;
justify-content: space-between;
cursor: pointer;
.el-icon-arrow-down {
line-height: 36px;
}
}
}
</style>