淋雨的小丸子 067c8463e1 ♻️ refactor: eslint
2023-06-26 20:01:59 +08:00

72 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<el-dialog
:title="title"
:visible.sync="dialogFormVisible"
width="500px"
@close="close"
>
<el-divider content-position="left">
这里就不具体写了请自行完善
</el-divider>
<el-form ref="form" label-width="80px" :model="form" :rules="rules">
<el-form-item label="name" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="路径" prop="path">
<el-input v-model="form.path" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="save"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { doEdit } from '@/api/menuManagement'
export default {
name: 'MenuManagementEdit',
data() {
return {
form: {},
rules: {
id: [{ required: true, trigger: 'blur', message: '请输入路径' }],
},
title: '',
dialogFormVisible: false,
}
},
created() {},
methods: {
showEdit(row) {
if (!row) {
this.title = '添加'
} else {
this.title = '编辑'
this.form = Object.assign({}, row)
}
this.dialogFormVisible = true
},
close() {
this.$refs['form'].resetFields()
this.form = this.$options.data().form
this.dialogFormVisible = false
},
save() {
this.$refs['form'].validate(async (valid) => {
if (valid) {
const { msg } = await doEdit(this.form)
this.$baseMessage(msg, 'success')
this.$emit('fetch-data')
this.close()
} else {
return false
}
})
},
},
}
</script>