diff --git a/src/api/http/http-api.js b/src/api/http/http-api.js index 9a3cf2d..59be3f4 100644 --- a/src/api/http/http-api.js +++ b/src/api/http/http-api.js @@ -106,5 +106,15 @@ export default { name: '分类列表', method: 'POST' }, + addCategory: { + url: '/category', + name: '新增分类', + method: 'POST' + }, + editCategory: { + url: '/category', + name: '编辑分类', + method: 'PUT' + }, } diff --git a/src/views/productSpecManage/model.vue b/src/views/productSpecManage/model.vue index 98c3e50..9dbcf3c 100644 --- a/src/views/productSpecManage/model.vue +++ b/src/views/productSpecManage/model.vue @@ -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');