【修改】修改水印传参 增加枚举

This commit is contained in:
zhoulingpo
2023-05-05 10:29:27 +08:00
parent aac9bdc84e
commit e0e1a8f1c7
3 changed files with 37 additions and 20 deletions
+26 -18
View File
@@ -1,31 +1,32 @@
<template>
<div class="content-height">
<el-row class="inputForm" v-for="i in formData">
<el-row class="inputForm" >
<el-col :span="6">
<div class="tag-item showLimit">
<label class="tag-title">{{i.configKey}}:</label>
<el-input v-model="i.configValue" placeholder="请输入水印前缀"
<label class="tag-title">水印前缀:</label>
<el-input v-model="formData.markValue" placeholder="请输入水印前缀"
maxlength="100" show-word-limit></el-input>
</div>
</el-col>
<el-col :span="2" align="right" class="tag-btns">
<el-button type="primary" @click="save(i)">保存</el-button>
<el-button type="primary" @click="save('mark',0)">保存</el-button>
</el-col>
</el-row>
</div>
</template>
<script>
import {basMessage} from '@/utils/Enum/enum'
export default {
name: "index",
data(){
return {
formData:[
{
configKey:'水印前缀',
configValue:''
}
]
basMessage,
formData:{
markValue:''
},
row0:{}
}
},
created() {
@@ -36,18 +37,25 @@ export default {
loadMark(){
this.$api.setting.getAllSetting().then(res=>{
if(res.data.length>0){
this.formData=res.data
console.log(res.data.data,"res.data.data")
res.data.forEach( item=>{
switch (item.configKey){
case this.basMessage['mark'].value :
this.formData.markValue=item.configValue
this['row'+this.basMessage['mark'].index] = item
}
})
}else{
this.formData=[{
configKey:'水印前缀',
configValue:''
}]
}
})
},
save(i){
this.$api.setting.saveMarket(i).then(res=>{
save(name,index){
let param={
id: this["row"+index].id ? this["row"+index].id:'',
configValue: this.formData[name+'Value'],
configKey: this.basMessage[name].value
}
this.$api.setting.saveMarket(param).then(res=>{
this.$message.success(res.data)
})
},