Files
flowable_management/base-vue/src/views/modules/sys/dictDetail-add-or-update.vue

106 lines
3.3 KiB
Vue
Raw Normal View History

2025-02-28 17:30:06 +08:00
<template>
<el-dialog
:title="dataForm.dict_id === null ? '新增字典详情' : '修改字典详情'"
:close-on-click-modal="false"
2025-03-14 17:56:05 +08:00
:visible.sync="visible"
width="500px">
<el-form :model="dataForm" :rules="dataRule" size="mini" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
2025-02-28 17:30:06 +08:00
<el-form-item label="字典标签" prop="label">
<el-input v-model="dataForm.label" placeholder="字典标签"></el-input>
</el-form-item>
<el-form-item label="字典值" prop="value">
<el-input v-model="dataForm.value" placeholder="字典值"></el-input>
</el-form-item>
2025-03-04 13:26:31 +08:00
<el-form-item label="排序" prop="dictSort">
2025-02-28 17:30:06 +08:00
<el-input-number
2025-03-04 13:26:31 +08:00
v-model.number="dataForm.dictSort"
2025-02-28 17:30:06 +08:00
:min="0"
:max="999"
controls-position="right"
/>
</el-form-item>
<el-form-item label="参数1" prop="para1">
<el-input v-model="dataForm.para1" placeholder="参数1"></el-input>
</el-form-item>
<el-form-item label="参数2" prop="para2">
<el-input v-model="dataForm.para2" placeholder="参数2"></el-input>
</el-form-item>
<el-form-item label="参数3" prop="para3">
<el-input v-model="dataForm.para3" placeholder="参数3"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
2025-03-14 17:56:05 +08:00
<el-button size="mini" @click="visible = false">取消</el-button>
<el-button size="mini" type="primary" @click="dataFormSubmit()">确定</el-button>
2025-02-28 17:30:06 +08:00
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
2025-03-04 13:26:31 +08:00
code: null,
2025-02-28 17:30:06 +08:00
label: null,
value: null,
2025-03-04 13:26:31 +08:00
dictSort: null,
2025-02-28 17:30:06 +08:00
para1: null,
para2: null,
2025-03-04 13:26:31 +08:00
para3: null
2025-02-28 17:30:06 +08:00
},
dataRule: {
label: [
{ required: true, message: '字典标签不能为空', trigger: 'blur' }
],
value: [
{ required: true, message: '字典值不能为空', trigger: 'blur' }
],
2025-03-04 13:26:31 +08:00
dictSort: [
2025-02-28 17:30:06 +08:00
{ required: true, message: '排序不能为空', trigger: 'blur', type: 'number' }
]
}
}
},
methods: {
2025-03-04 13:26:31 +08:00
init (row, code) {
2025-02-28 17:30:06 +08:00
this.visible = true
2025-03-04 13:26:31 +08:00
this.dataForm.code = code
2025-02-28 17:30:06 +08:00
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (row) {
2025-03-04 13:26:31 +08:00
this.dataForm = {...row}
2025-02-28 17:30:06 +08:00
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/api/dict/dictDetail'),
method: 'post',
data: this.$http.adornData(this.dataForm)
}).then(({data}) => {
2025-03-18 14:53:52 +08:00
if (data && data.code === 0) {
2025-02-28 17:30:06 +08:00
this.$message({
2025-03-04 13:26:31 +08:00
message: data.msg,
2025-02-28 17:30:06 +08:00
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>