irc_web/.svn/pristine/d0/d03e8867d2c071cf89825e8d136...

108 lines
3.0 KiB
Plaintext

<template>
<base-model :config="model_cfg">
<template slot="dialog-body">
<el-form
ref="DictionaryTypeConfigForm"
:model="form"
:rules="rules"
label-width="120px"
size="small"
>
<el-form-item label="Enum Value: " prop="Code">
<el-input v-model="form.Code" />
</el-form-item>
<el-form-item label="Value: " prop="Code">
<el-input v-model="form.ValueCN" />
</el-form-item>
<el-form-item label="Value EN: " prop="Code">
<el-input v-model="form.Value" />
</el-form-item>
<el-form-item label="ChildGroup: " prop="Code">
<el-input v-model="form.ChildGroup" />
</el-form-item>
<el-form-item label="ShowOrder: " prop="Code">
<el-input-number v-model="form.ShowOrder" :min="0" :max="100" />
</el-form-item>
<el-form-item label="Description: " prop="Code">
<el-input v-model="form.Description" />
</el-form-item>
<el-form-item label="Is Enable: ">
<el-switch
v-model="form.IsEnable"
:active-value="true"
:inactive-value="false"
/>
</el-form-item>
</el-form>
</template>
<template slot="dialog-footer">
<el-button :disabled="btnLoading" size="small" type="primary" @click="handleCancle">Cancel</el-button>
<el-button size="small" type="primary" :loading="btnLoading" @click="handleSave">Save</el-button>
</template>
</base-model>
</template>
<script>
import { addOrUpdateBasicDic } from '@/api/dictionary'
import BaseModel from '@/components/BaseModel'
const formDataDefault = () => {
return {
Id: '',
Code: '',
KeyName: '',
Description: '',
Value: '',
ValueCN: '',
ShowOrder: 0,
IsEnable: true,
IsConfig: false
}
}
export default {
name: 'AnonymizationFrom',
components: { BaseModel },
data() {
return {
btnLoading: false,
form: formDataDefault(),
rules: {
},
model_cfg: { visible: false, showClose: true, width: '600px', title: '', appendToBody: true }
}
},
mounted() {
},
methods: {
openDialog(title, data, parent) {
this.model_cfg.visible = true
this.model_cfg.title = title
if (Object.keys(data).length) {
this.form = { ...data }
} else {
this.form = formDataDefault()
}
if (Object.keys(parent).length) {
this.form = Object.assign(this.form, parent)
}
},
handleSave() {
this.$refs.DictionaryTypeConfigForm.validate(valid => {
if (valid) {
this.btnLoading = true
addOrUpdateBasicDic(this.form).then(res => {
this.btnLoading = false
this.$message.success('Saved successfully!')
this.model_cfg.visible = false
this.$emit('getList')
}).catch(() => {
this.btnLoading = false
})
}
})
},
handleCancle() {
this.model_cfg.visible = false
}
}
}
</script>