Skip to content

Commit

Permalink
重置问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
zhh committed May 18, 2018
1 parent dce85e2 commit 3e38bdb
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/views/pms/brand/components/BrandDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('brandFrom')">提交</el-button>
<!--<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>-->
<el-button v-if="!isEdit" @click="resetForm('brandFrom')">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {createBrand, getBrand, updateBrand} from '@/api/brand'
import SingleUpload from '@/components/Upload/singleUpload'
const defaultBrand={
bigPic: '',
brandStory: '',
factoryStatus: 0,
firstLetter: '',
logo: '',
name: '',
showStatus: 0,
sort: 0
};
export default {
name: 'BrandDetail',
components:{SingleUpload},
Expand All @@ -57,16 +66,7 @@
},
data() {
return {
brand: {
bigPic: '',
brandStory: '',
factoryStatus: 0,
firstLetter: '',
logo: '',
name: '',
showStatus: 0,
sort: 0
},
brand:null,
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
Expand All @@ -86,6 +86,8 @@
getBrand(this.$route.query.id).then(response => {
this.brand = response.data;
});
}else{
this.brand = Object.assign({},defaultBrand);
}
},
methods: {
Expand All @@ -110,6 +112,7 @@
} else {
createBrand(this.brand).then(response => {
this.$refs[formName].resetFields();
this.brand = Object.assign({},defaultBrand);
this.$message({
message: '提交成功',
type: 'success',
Expand All @@ -131,6 +134,7 @@
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.brand = Object.assign({},defaultBrand);
}
}
}
Expand Down

0 comments on commit 3e38bdb

Please sign in to comment.