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.
74 lines
1.7 KiB
74 lines
1.7 KiB
<template>
|
|
<div>
|
|
<a-drawer
|
|
:title="drawer.title"
|
|
:width="720"
|
|
:visible="drawer.show"
|
|
:body-style="{ paddingBottom: '80px' }"
|
|
@close="addClose"
|
|
>
|
|
<div class="drawer-content">
|
|
基本信息
|
|
<a-divider></a-divider>
|
|
<a-form-model
|
|
ref="ruleForm"
|
|
:model="form"
|
|
:rules="rules"
|
|
layout="vertical"
|
|
>
|
|
|
|
<a-form-model-item prop="brandName" label="品牌名称">
|
|
<a-input
|
|
v-model="form.brandName"
|
|
placeholder="请输入品牌名称"
|
|
style="width: 50%"
|
|
></a-input>
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</div>
|
|
<div class="drawer-footer">
|
|
<a-button :style="{ marginRight: '8px' }" @click="addClose">
|
|
关闭
|
|
</a-button>
|
|
<a-button type="primary" @click="submit"> 提交 </a-button>
|
|
</div>
|
|
</a-drawer>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
methods: {
|
|
submit() {
|
|
console.log(this.form);
|
|
this.$refs.ruleForm.validate(async (valid) => {
|
|
if (valid) {
|
|
if (this.form.id === null) {
|
|
let res = await Insert(this.form);
|
|
if (res.code === 200) {
|
|
this.$message.success(res.msg);
|
|
this.addClose();
|
|
this.getData();
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
} else {
|
|
console.log(this.form);
|
|
let res = await Update(this.form);
|
|
if (res.code === 200) {
|
|
this.$message.success(res.msg);
|
|
this.addClose();
|
|
this.getData();
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style></style>
|