You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
4.3 KiB
136 lines
4.3 KiB
<template>
|
|
<el-dialog
|
|
width="285px"
|
|
:title="!dataForm.id ? buttons.add :buttons.edit"
|
|
:close-on-click-modal="false"
|
|
:visible.sync="visible">
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
|
label-width="80px">
|
|
<el-form-item :label="buttons.paramKey || '参数名'" prop="paramKey">
|
|
<el-input v-model="dataForm.paramKey" style="width: 150px;" placeholder="参数名"></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="buttons.paramValue || '参数值'" prop="paramValue">
|
|
<el-input v-model="dataForm.paramValue" style="width: 150px;" placeholder="参数值"></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="buttons.remark || '备注'" prop="remark">
|
|
<el-input v-model="dataForm.remark" style="width: 150px;" placeholder="备注"></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="buttons.status || '状态'" size="mini" prop="status">
|
|
<el-radio-group v-model="dataForm.status">
|
|
<el-radio :label="0">{{ buttons.disable || '禁用' }}</el-radio>
|
|
<el-radio :label="1">{{ buttons.normal || '正常' }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="dataFormSubmit()">{{ buttons.submit || '确定' }}</el-button>
|
|
<el-button type="primary" @click="visible = false">{{ buttons.close || '关闭' }}</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
searchFunctionButtonList,
|
|
} from "@/api/sysLanguage.js"
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
dataForm: {
|
|
id: 0,
|
|
paramKey: '',
|
|
paramValue: '',
|
|
remark: '',
|
|
status: ''
|
|
},
|
|
dataRule: {
|
|
paramKey: [
|
|
{required: true, message: '参数名不能为空', trigger: 'blur'}
|
|
],
|
|
paramValue: [
|
|
{required: true, message: '参数值不能为空', trigger: 'blur'}
|
|
]
|
|
},
|
|
buttons: {
|
|
close: '关闭',
|
|
submit: '确定',
|
|
add: '添加',
|
|
edit: '编辑',
|
|
delete: '删除',
|
|
paramKey: '参数名',
|
|
paramValue: '参数值',
|
|
remark: '备注',
|
|
disable: '禁用',
|
|
normal: '正常',
|
|
status: '状态'
|
|
},
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取button的词典
|
|
getFunctionButtonList() {
|
|
let queryButton = {
|
|
functionId: this.$route.meta.menuId,
|
|
tableId: '*',
|
|
languageCode: this.$i18n.locale,
|
|
objectType: 'button'
|
|
}
|
|
searchFunctionButtonList(queryButton).then(({data}) => {
|
|
if (data.code == 0 && data.data) {
|
|
this.buttons = data.data
|
|
}
|
|
})
|
|
},
|
|
init(id) {
|
|
this.dataForm.id = id || 0
|
|
this.visible = true
|
|
this.$nextTick(() => {
|
|
this.$refs['dataForm'].resetFields()
|
|
if (this.dataForm.id) {
|
|
this.$http({
|
|
url: this.$http.adornUrl(`/sys/config/info/${this.dataForm.id}`),
|
|
method: 'get',
|
|
params: this.$http.adornParams()
|
|
}).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.dataForm.paramKey = data.config.paramKey
|
|
this.dataForm.paramValue = data.config.paramValue
|
|
this.dataForm.remark = data.config.remark
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 表单提交
|
|
dataFormSubmit() {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
if (valid) {
|
|
this.$http({
|
|
url: this.$http.adornUrl(`/sys/config/${!this.dataForm.id ? 'save' : 'update'}`),
|
|
method: 'post',
|
|
data: this.$http.adornData({
|
|
'id': this.dataForm.id || undefined,
|
|
'paramKey': this.dataForm.paramKey,
|
|
'paramValue': this.dataForm.paramValue,
|
|
'remark': this.dataForm.remark,
|
|
'status': this.dataForm.status
|
|
})
|
|
}).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.$message.success('操作成功')
|
|
this.visible = false
|
|
this.$emit('refreshDataList')
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}, created() {
|
|
this.getFunctionButtonList()
|
|
}
|
|
}
|
|
</script>
|