irc_web/src/views/dictionary/template/components/AddDICOMConfig.vue

130 lines
4.0 KiB
Vue

<template>
<base-model :config="model_cfg">
<template slot="dialog-body">
<el-form
ref="anonymizationFrom"
:model="form"
:rules="rules"
label-width="160px"
size="small"
>
<el-form-item :label="$t('template:anonymization:label:group')" prop="Group">
<el-input v-model="form.Group" />
</el-form-item>
<el-form-item :label="$t('template:anonymization:label:element')" prop="Group">
<el-input v-model="form.Element" />
</el-form-item>
<!-- tag Description -->
<el-form-item :label="$t('template:anonymization:label:tagDescription')" prop="Group">
<el-input v-model="form.TagDescription" />
</el-form-item>
<!-- Tag DescriptionCN -->
<el-form-item :label="$t('template:anonymization:label:tagDescriptionCN')" prop="Group">
<el-input v-model="form.TagDescriptionCN" />
</el-form-item>
<!-- Value Representation -->
<el-form-item :label="$t('template:anonymization:label:valueRepresentation')" prop="Group">
<el-input v-model="form.ValueRepresentation" />
</el-form-item>
<!-- Is Fixed -->
<el-form-item :label="$t('template:anonymization:label:isFixed')">
<el-switch
v-model="form.IsFixed"
:active-value="true"
:inactive-value="false"
/>
</el-form-item>
<el-form-item :label="$t('template:anonymization:label:valueReplace')">
<el-input v-model="form.ReplaceValue" />
</el-form-item>
<el-form-item :label="$t('template:anonymization:label:isEnable')">
<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">{{ $t('common:button:cancel') }}</el-button>
<el-button size="small" type="primary" :loading="btnLoading" @click="handleSave">{{ $t('common:button:save') }}</el-button>
</template>
</base-model>
</template>
<script>
import { addOrUpdateSystemAnonymization } from '@/api/dictionary'
import BaseModel from '@/components/BaseModel'
const formDataDefault = () => {
return {
Group: '',
Element: '',
TagDescription: '',
TagDescriptionCN: '',
ValueRepresentation: '',
ReplaceValue: '',
IsEnable: false,
IsAdd: false,
IsFixed: false
}
}
export default {
name: 'AnonymizationFrom',
components: { BaseModel },
data() {
return {
isEnable: false,
btnLoading: false,
form: {
Group: '',
Element: '',
TagDescription: '',
TagDescriptionCN: '',
ValueRepresentation: '',
ReplaceValue: '',
IsEnable: false,
IsAdd: false
},
rules: {
Group: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }]
},
model_cfg: { visible: false, showClose: true, width: '600px', title: '' }
}
},
mounted() {
// if (Object.keys(this.data).length && this.data.Id) {
// this.form = { ...this.data }
// }
},
methods: {
openDialog(title, data) {
this.model_cfg.visible = true
this.model_cfg.title = title
if (Object.keys(data).length) {
this.form = { ...data }
} else {
this.form = formDataDefault()
}
},
handleSave() {
this.$refs.anonymizationFrom.validate(valid => {
if (valid) {
this.btnLoading = true
addOrUpdateSystemAnonymization(this.form).then(res => {
this.btnLoading = false
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.model_cfg.visible = false
this.$emit('getList')
}).catch(() => {
this.btnLoading = false
})
}
})
},
handleCancle() {
this.model_cfg.visible = false
}
}
}
</script>