修改customer文件位restful模式 提供示例

This commit is contained in:
pixel
2020-04-10 13:47:52 +08:00
parent 849f0dcf43
commit da8a1c20b6
9 changed files with 53 additions and 45 deletions
+18 -18
View File
@@ -7,10 +7,10 @@ import service from '@/utils/request'
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "删除客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/createExaCustomer [post]
// @Router /customer/customer [post]
export const createExaCustomer = (data) => {
return service({
url: "/customer/createExaCustomer",
url: "/customer/customer",
method: 'post',
data
})
@@ -25,11 +25,11 @@ export const createExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "更新客户信息"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/updateExaCustomer [post]
// @Router /customer/customer [put]
export const updateExaCustomer = (data) => {
return service({
url: "/customer/updateExaCustomer",
method: 'post',
url: "/customer/customer",
method: 'put',
data
})
}
@@ -42,11 +42,11 @@ export const updateExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "创建客户"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/deleteExaCustomer [post]
// @Router /customer/customer [delete]
export const deleteExaCustomer = (data) => {
return service({
url: "/customer/deleteExaCustomer",
method: 'post',
url: "/customer/customer",
method: 'delete',
data
})
}
@@ -59,12 +59,12 @@ export const deleteExaCustomer = (data) => {
// @Produce application/json
// @Param data body dbModel.ExaCustomer true "获取单一客户信息"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/getExaCustomer [post]
export const getExaCustomer = (data) => {
// @Router /customer/customer [get]
export const getExaCustomer = (params) => {
return service({
url: "/customer/getExaCustomer",
method: 'post',
data
url: "/customer/customer",
method: 'get',
params
})
}
@@ -76,11 +76,11 @@ export const getExaCustomer = (data) => {
// @Produce application/json
// @Param data body modelInterface.PageInfo true "获取权限客户列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /customer/createExaCustomer [post]
export const getExaCustomerList = (data) => {
// @Router /customer/customerList [get]
export const getExaCustomerList = (params) => {
return service({
url: "/customer/getExaCustomerList",
method: 'post',
data
url: "/customer/customerList",
method: 'get',
params
})
}
+8 -5
View File
@@ -9,7 +9,6 @@
</div>
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
border
ref="multipleTable"
stripe
@@ -29,10 +28,10 @@
<el-popover
placement="top"
width="160"
v-model="visible">
v-model="scope.row.visible">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteCustomer(scope.row)">确定</el-button>
</div>
<el-button type="text" size="mini" slot="reference">删除</el-button>
@@ -113,7 +112,7 @@ export default {
},
methods:{
async updateCustomer(row){
const res = await getExaCustomer(row)
const res = await getExaCustomer({ID:row.ID})
this.type = "update"
if(res.code == 0){
this.form = res.data.customer
@@ -125,8 +124,12 @@ export default {
},
async deleteCustomer(row){
this.visible = false
const res = await deleteExaCustomer(row)
const res = await deleteExaCustomer({ID:row.ID})
if (res.code == 0){
this.$message({
type:"success",
message:"删除成功"
})
this.getTableData()
}
},
+2
View File
@@ -163,6 +163,8 @@ export default {
const res = await getAuthorityList({ page: 1, pageSize: 999 })
this.authOptions = res.data.list
}
}
</script>
<style scoped lang="scss">