品规管理新增和编辑接口联调

merge-requests/1/head
张鑫 5 years ago
parent 6bd2e4c84c
commit 7f42669c11

@ -106,5 +106,15 @@ export default {
name: '分类列表',
method: 'POST'
},
addCategory: {
url: '/category',
name: '新增分类',
method: 'POST'
},
editCategory: {
url: '/category',
name: '编辑分类',
method: 'PUT'
},
}

@ -86,40 +86,40 @@ export default {
},
methods: {
handleOk() {
// this.confirmLoading = true;
// setTimeout(() => {
// this.form.validateFields((err, values) => {
// console.log(values)
// if (!err) {
// console.log(this.title)
// if(this.type=='add'){
// this.$api.httpApi.addCameraIo({
// data:values
// }).then(res => {
// if(res.code==200){
// this.$emit('sure',false)
// this.$message.success('');
// }
// }).catch(err => {
//
// });
// }else if(this.type=='edit'){
// values.id = this.id
// this.$api.httpApi.editCameraIo({
// data:values
// }).then(res => {
// if(res.code==200){
// this.$emit('sure',false)
// this.$message.success('');
// }
// }).catch(err => {
//
// });
// }
// }
// });
// this.confirmLoading = false;
// }, 500);
this.confirmLoading = true;
setTimeout(() => {
this.form.validateFields((err, values) => {
console.log(values)
if (!err) {
console.log(this.title)
if (this.type == 'add') {
this.$api.httpApi.addCategory({
data: values
}).then(res => {
if (res.code == 200) {
this.$emit('sure', false)
this.$message.success('新增品规成功');
}
}).catch(err => {
});
} else if (this.type == 'edit') {
values.id = this.id
this.$api.httpApi.editCategory({
data: values
}).then(res => {
if (res.code == 200) {
this.$emit('sure', false)
this.$message.success('编辑品规成功');
}
}).catch(err => {
});
}
}
});
this.confirmLoading = false;
}, 500);
},
handleCancel() {
console.log('Clicked cancel button');

Loading…
Cancel
Save