开发仓库应用
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"saas/models"
|
"saas/models"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 定义接收JSON数据的结构体
|
// 定义接收JSON数据的结构体
|
||||||
@@ -20,159 +21,147 @@ type Add_item_json struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func V1_warehouses_api(r *gin.RouterGroup) {
|
func V1_warehouses_api(r *gin.RouterGroup) {
|
||||||
var err_code = Error_code["api_ok"]
|
|
||||||
var err_msg string
|
|
||||||
|
|
||||||
r.POST("/create", func(ctx *gin.Context) {
|
r.POST("/create", func(ctx *gin.Context) {
|
||||||
err_msg = "warehouses_api_err"
|
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
//先判断是否已经登录
|
//先判断是否已经登录
|
||||||
//获取中间件处理的结果
|
//获取中间件处理的结果
|
||||||
is_login, _ := ctx.Get("is_login")
|
|
||||||
|
user_info, is_login := ctx.Get("user_info")
|
||||||
if is_login == true {
|
if is_login == true {
|
||||||
user_info, _ := ctx.Get("user_info")
|
|
||||||
|
|
||||||
//转换传进来的数据
|
//转换传进来的数据
|
||||||
var jsonData map[string]interface{}
|
var jsonData map[string]interface{}
|
||||||
if err := ctx.ShouldBindJSON(&jsonData); err == nil {
|
data, is_have_data := ctx.Get("data")
|
||||||
//fmt.Println(jsonData)
|
if is_have_data {
|
||||||
if jsonData["warehouses_name"].(string) != "" {
|
if err := mapstructure.Decode(data, &jsonData); err == nil {
|
||||||
warehouses_data := models.Warehouse{
|
//fmt.Println(jsonData)
|
||||||
Name: jsonData["warehouses_name"].(string),
|
if jsonData["warehouses_name"].(string) != "" {
|
||||||
Info: jsonData["warehouses_info"].(string),
|
warehouses_data := models.Warehouse{
|
||||||
CreatorID: user_info.(*models.User_info).UserID,
|
Name: jsonData["warehouses_name"].(string),
|
||||||
Capacity: 0,
|
Info: jsonData["warehouses_info"].(string),
|
||||||
UsedCapacity: 0,
|
CreatorID: user_info.(*models.User_info).UserID,
|
||||||
Location: "local",
|
Capacity: 0,
|
||||||
}
|
UsedCapacity: 0,
|
||||||
models.DB.Create(&warehouses_data) // 传入指针
|
Location: "local",
|
||||||
//fmt.Println(dberr.Error)
|
}
|
||||||
err_msg = "api_ok"
|
models.DB.Create(&warehouses_data) // 传入指针
|
||||||
err_code = Error_code[err_msg]
|
//fmt.Println(dberr.Error)
|
||||||
|
|
||||||
|
Return_json(ctx, "api_ok", nil)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Return_json(ctx, "warehouses_name_err", nil)
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
err_msg = "warehouses_name_err"
|
Return_json(ctx, "json_error", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err_msg = "json_error"
|
Return_json(ctx, "json_error", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//fmt.Println("no loged")
|
//fmt.Println("no loged")
|
||||||
err_msg = "user_no_sign"
|
Return_json(ctx, "user_no_sign", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
}
|
||||||
"api": "ok",
|
|
||||||
"err_code": err_code,
|
|
||||||
"err_msg": err_msg,
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
r.POST("/add_item", func(ctx *gin.Context) {
|
r.POST("/add_item", func(ctx *gin.Context) {
|
||||||
err_msg = "warehouses_api_err"
|
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
//先判断是否已经登录
|
//先判断是否已经登录
|
||||||
//获取中间件处理的结果
|
//获取中间件处理的结果
|
||||||
is_login, _ := ctx.Get("is_login")
|
user_info_, is_login := ctx.Get("user_info")
|
||||||
|
|
||||||
if is_login == true {
|
if is_login == true {
|
||||||
|
user_info := user_info_.(*models.User_info)
|
||||||
|
|
||||||
//转换传进来的数据
|
data, is_have_data := ctx.Get("data")
|
||||||
var item Add_item_json
|
if is_have_data {
|
||||||
if err := ctx.ShouldBindJSON(&item); err == nil {
|
//转换传进来的数据
|
||||||
//先判断是否有权限
|
var item Add_item_json
|
||||||
|
if err := mapstructure.Decode(data, &item); err == nil {
|
||||||
|
//先判断是否有权限
|
||||||
|
|
||||||
//(还没弄)
|
//(还没弄)
|
||||||
|
|
||||||
//后插入数据
|
//后插入数据
|
||||||
user_info_, _ := ctx.Get("user_info")
|
|
||||||
user_info := user_info_.(*models.User_info)
|
|
||||||
var add_item_temp models.WarehouseItem
|
|
||||||
add_item_temp.CreatedByID = user_info.UserID
|
|
||||||
add_item_temp.WarehouseID = item.WarehouseID
|
|
||||||
add_item_temp.Name = item.Name
|
|
||||||
add_item_temp.SerialNumber = item.SN
|
|
||||||
add_item_temp.Description = item.Info
|
|
||||||
add_item_temp.Destiny = item.Who
|
|
||||||
add_item_temp.Quantity = item.Int
|
|
||||||
add_item_temp.ItemValue = int(item.Consts * 100)
|
|
||||||
//插入一条数据
|
|
||||||
models.DB.Create(&add_item_temp)
|
|
||||||
//更新仓库信息
|
|
||||||
var seach_wh models.Warehouse
|
|
||||||
seach_wh.ID = item.WarehouseID
|
|
||||||
var out_wh models.Warehouse
|
|
||||||
models.DB.Where(&seach_wh).First(&out_wh)
|
|
||||||
out_wh.UsedCapacity += 1
|
|
||||||
models.DB.Where(&seach_wh).Updates(&out_wh)
|
|
||||||
|
|
||||||
err_msg = "api_ok"
|
var add_item_temp models.WarehouseItem
|
||||||
err_code = Error_code[err_msg]
|
add_item_temp.CreatedByID = user_info.UserID
|
||||||
|
add_item_temp.WarehouseID = item.WarehouseID
|
||||||
|
add_item_temp.Name = item.Name
|
||||||
|
add_item_temp.SerialNumber = item.SN
|
||||||
|
add_item_temp.Description = item.Info
|
||||||
|
add_item_temp.Destiny = item.Who
|
||||||
|
add_item_temp.Quantity = item.Int
|
||||||
|
add_item_temp.ItemValue = int(item.Consts * 100)
|
||||||
|
|
||||||
|
fmt.Println(data)
|
||||||
|
// //插入一条数据
|
||||||
|
// models.DB.Create(&add_item_temp)
|
||||||
|
// //更新仓库信息
|
||||||
|
// var seach_wh models.Warehouse
|
||||||
|
// seach_wh.ID = item.WarehouseID
|
||||||
|
// var out_wh models.Warehouse
|
||||||
|
// models.DB.Where(&seach_wh).First(&out_wh)
|
||||||
|
// out_wh.UsedCapacity += 1
|
||||||
|
// models.DB.Where(&seach_wh).Updates(&out_wh)
|
||||||
|
|
||||||
|
Return_json(ctx, "api_ok", nil)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Return_json(ctx, "json_error", nil)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
err_msg = "json_error"
|
Return_json(ctx, "json_error", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//fmt.Println("no loged")
|
//fmt.Println("no loged")
|
||||||
err_msg = "user_no_sign"
|
Return_json(ctx, "user_no_sign", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
}
|
||||||
"api": "ok",
|
|
||||||
"err_code": err_code,
|
|
||||||
"err_msg": err_msg,
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
r.GET("/get_items/:wh_id", func(ctx *gin.Context) {
|
r.GET("/get_items/:wh_id", func(ctx *gin.Context) {
|
||||||
err_msg = "warehouses_api_err"
|
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
var seachf []models.WarehouseItem
|
|
||||||
//先判断是否已经登录
|
|
||||||
//获取中间件处理的结果
|
|
||||||
is_login, _ := ctx.Get("is_login")
|
|
||||||
if is_login == true {
|
|
||||||
id := ctx.Param("wh_id")
|
|
||||||
id_int, err := strconv.ParseInt(id, 10, 0)
|
|
||||||
if err == nil {
|
|
||||||
if id_int > 0 {
|
|
||||||
|
|
||||||
seachf = models.Warehouse_get_items_from_whid(uint(id_int))
|
// var seachf []models.WarehouseItem
|
||||||
//fmt.Println(seachf)
|
// //先判断是否已经登录
|
||||||
|
// //获取中间件处理的结果
|
||||||
|
// is_login, _ := ctx.Get("is_login")
|
||||||
|
// if is_login == true {
|
||||||
|
// id := ctx.Param("wh_id")
|
||||||
|
// id_int, err := strconv.ParseInt(id, 10, 0)
|
||||||
|
// if err == nil {
|
||||||
|
// if id_int > 0 {
|
||||||
|
|
||||||
err_msg = "api_ok"
|
// seachf = models.Warehouse_get_items_from_whid(uint(id_int))
|
||||||
err_code = Error_code[err_msg]
|
// //fmt.Println(seachf)
|
||||||
|
// Return_json(ctx, "api_ok", nil)
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
err_msg = "warehouses_id_err"
|
// Return_json(ctx, "warehouses_id_err", nil)
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
// }
|
||||||
err_msg = "warehouses_id_err"
|
|
||||||
err_code = Error_code[err_msg]
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
//fmt.Println("no loged")
|
// Return_json(ctx, "warehouses_id_err", nil)
|
||||||
err_msg = "user_no_sign"
|
|
||||||
err_code = Error_code[err_msg]
|
// }
|
||||||
}
|
|
||||||
|
// } else {
|
||||||
|
// //fmt.Println("no loged")
|
||||||
|
// Return_json(ctx, "user_no_sign", nil)
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
ctx.JSON(200, map[string]interface{}{
|
|
||||||
"api": "ok",
|
|
||||||
"err_code": err_code,
|
|
||||||
"err_msg": err_msg,
|
|
||||||
"data": seachf,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,11 +165,12 @@
|
|||||||
if (c.statusCode == 200) {
|
if (c.statusCode == 200) {
|
||||||
if (c.data.err_code == 0) {
|
if (c.data.err_code == 0) {
|
||||||
//save_json("cookie", c.data.return.cookie)
|
//save_json("cookie", c.data.return.cookie)
|
||||||
banner_alert('success', "登录成功",950)
|
save_json("user_info", c.data.return.user_info)
|
||||||
save_json("user_info", c.data.return.user_info)
|
banner_alert('success', "登录成功",1000,()=>{
|
||||||
setTimeout(() => {
|
location.href = '/'
|
||||||
location.href = '/'
|
})
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
banner_alert('warning', "账号或密码不正确",3000)
|
banner_alert('warning', "账号或密码不正确",3000)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,10 +228,10 @@
|
|||||||
|
|
||||||
switch (c.data.err_code) {
|
switch (c.data.err_code) {
|
||||||
case 0:
|
case 0:
|
||||||
banner_alert('success', "注册成功", 950)
|
banner_alert('success', "注册成功", 1000,()=>{
|
||||||
setTimeout(() => {
|
|
||||||
location.href = '/sign-in'
|
location.href = '/sign-in'
|
||||||
}, 1000);
|
})
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
banner_alert('warning', "用户名已存在", 1000)
|
banner_alert('warning', "用户名已存在", 1000)
|
||||||
|
|||||||
@@ -87,7 +87,8 @@
|
|||||||
</svg>
|
</svg>
|
||||||
{{.UsedCapacity}}
|
{{.UsedCapacity}}
|
||||||
</div>
|
</div>
|
||||||
<a href="/warehouse/{{.ID}}" class="card-btn"><!-- Download SVG icon from http://tabler-icons.io/i/phone -->
|
<a href="/warehouse/{{.ID}}"
|
||||||
|
class="card-btn"><!-- Download SVG icon from http://tabler-icons.io/i/phone -->
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||||
class="icon icon-tabler icons-tabler-outline icon-tabler-binoculars">
|
class="icon icon-tabler icons-tabler-outline icon-tabler-binoculars">
|
||||||
@@ -136,7 +137,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{{range .page_range}}
|
{{range .page_range}}
|
||||||
<li class="page-item {{.active}}"><a class="page-link" href="{{.page_href}} ">{{.page}} </a></li>
|
<li class="page-item {{.active}}"><a class="page-link" href="{{.page_href}} ">{{.page}} </a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<li class="page-item {{if .disabled_next_page}}disabled{{end}}">
|
<li class="page-item {{if .disabled_next_page}}disabled{{end}}">
|
||||||
@@ -176,18 +177,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="row mb-3 align-items-end">
|
<div class="row mb-3 align-items-end">
|
||||||
<div class="col-auto">
|
|
||||||
<a href="#" class="avatar avatar-upload rounded">
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
|
|
||||||
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
||||||
<path d="M12 5l0 14" />
|
|
||||||
<path d="M5 12l14 0" />
|
|
||||||
</svg>
|
|
||||||
<span class="avatar-upload-text">添加图片</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label class="form-label">仓库名*</label>
|
<label class="form-label">仓库名*</label>
|
||||||
<input type="text" class="form-control" id="wh_name" />
|
<input type="text" class="form-control" id="wh_name" />
|
||||||
@@ -227,42 +217,65 @@
|
|||||||
|
|
||||||
//数据合法,推送
|
//数据合法,推送
|
||||||
if (data_chack) {
|
if (data_chack) {
|
||||||
const url = '/api/v1/warehouses_api/create';
|
|
||||||
const sumt_data = {
|
post_json("/warehouses_api/create", {
|
||||||
warehouses_name: $("#wh_name").val(),
|
warehouses_name: $("#wh_name").val(),
|
||||||
warehouses_info: $("#wh_info").val()
|
warehouses_info: $("#wh_info").val()
|
||||||
|
}, (c) => {
|
||||||
};
|
if (c.statusCode == 200) {
|
||||||
|
if (c.data.err_code == 0) {
|
||||||
try {
|
//save_json("cookie", c.data.return.cookie)
|
||||||
const response = axios.post(url, sumt_data, {
|
banner_alert('success', "添加成功", 1000,()=>{
|
||||||
headers: {
|
location.reload();
|
||||||
'Content-Type': 'application/json'
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
banner_alert('warning', "err:"+c.data.err_msg, 3000)
|
||||||
}
|
}
|
||||||
}).then(response => {
|
|
||||||
console.log('提交成功:', response.data); // 正确打印服务器数据
|
|
||||||
//跳转到主页
|
|
||||||
if (response.data.err_code == 0) {
|
|
||||||
new_warehouses_windows_dom.hide();
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
if (error.response) {
|
|
||||||
// 服务器返回了错误状态码(如 4xx, 5xx)
|
|
||||||
console.error('服务器错误:', error.response.data);
|
|
||||||
} else {
|
} else {
|
||||||
console.error('请求未完成:', error.message);
|
banner_alert('danger', "网络连接错误:" + c.statusCode, 3000)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
})
|
||||||
|
|
||||||
|
new_warehouses_windows_dom.hide();
|
||||||
|
|
||||||
|
|
||||||
|
// const url = '/api/v1/warehouses_api/create';
|
||||||
|
// const sumt_data = {
|
||||||
|
// warehouses_name: $("#wh_name").val(),
|
||||||
|
// warehouses_info: $("#wh_info").val()
|
||||||
|
|
||||||
|
// };
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// const response = axios.post(url, sumt_data, {
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'application/json'
|
||||||
|
// }
|
||||||
|
// }).then(response => {
|
||||||
|
// console.log('提交成功:', response.data); // 正确打印服务器数据
|
||||||
|
// //跳转到主页
|
||||||
|
// if (response.data.err_code == 0) {
|
||||||
|
// new_warehouses_windows_dom.hide();
|
||||||
|
// location.reload();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// });
|
||||||
|
// } catch (error) {
|
||||||
|
// if (error.response) {
|
||||||
|
// // 服务器返回了错误状态码(如 4xx, 5xx)
|
||||||
|
// console.error('服务器错误:', error.response.data);
|
||||||
|
// } else {
|
||||||
|
// console.error('请求未完成:', error.message);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -243,8 +243,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data_chack) {
|
if (data_chack) {
|
||||||
const url = '/api/v1/warehouses_api/add_item';
|
|
||||||
const sumt_data = {
|
post_json("/warehouses_api/add_item", {
|
||||||
warehouse_id: parseInt("{{.warehouse_id}}", 10),
|
warehouse_id: parseInt("{{.warehouse_id}}", 10),
|
||||||
item_name: $("#item_name").val(),
|
item_name: $("#item_name").val(),
|
||||||
item_sn: $("#item_sn").val(),
|
item_sn: $("#item_sn").val(),
|
||||||
@@ -252,31 +252,60 @@
|
|||||||
item_who: $("#item_who").val(),
|
item_who: $("#item_who").val(),
|
||||||
item_int: parseInt($("#item_int").val(), 10),
|
item_int: parseInt($("#item_int").val(), 10),
|
||||||
item_consts: parseFloat($("#item_consts").val()),
|
item_consts: parseFloat($("#item_consts").val()),
|
||||||
|
}, (c) => {
|
||||||
|
if (c.statusCode == 200) {
|
||||||
|
if (c.data.err_code == 0) {
|
||||||
|
//save_json("cookie", c.data.return.cookie)
|
||||||
|
banner_alert('success', "添加成功", 1000, () => {
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
|
||||||
};
|
} else {
|
||||||
|
banner_alert('warning', "err:" + c.data.err_msg, 3000)
|
||||||
try {
|
|
||||||
const response = axios.post(url, sumt_data, {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
}
|
||||||
}).then(response => {
|
|
||||||
console.log('提交成功:', response.data); // 正确打印服务器数据
|
|
||||||
|
|
||||||
if (response.data.err_code == 0) {
|
|
||||||
new_warehouses_item_windows_dom.hide();
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
if (error.response) {
|
|
||||||
// 服务器返回了错误状态码(如 4xx, 5xx)
|
|
||||||
console.error('服务器错误:', error.response.data);
|
|
||||||
} else {
|
} else {
|
||||||
console.error('请求未完成:', error.message);
|
banner_alert('danger', "网络连接错误:" + c.statusCode, 3000)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
})
|
||||||
|
|
||||||
|
new_warehouses_item_windows_dom.hide();
|
||||||
|
|
||||||
|
|
||||||
|
// const url = '/api/v1/warehouses_api/add_item';
|
||||||
|
// const sumt_data = {
|
||||||
|
// warehouse_id: parseInt("{{.warehouse_id}}", 10),
|
||||||
|
// item_name: $("#item_name").val(),
|
||||||
|
// item_sn: $("#item_sn").val(),
|
||||||
|
// item_info: $("#item_info").val(),
|
||||||
|
// item_who: $("#item_who").val(),
|
||||||
|
// item_int: parseInt($("#item_int").val(), 10),
|
||||||
|
// item_consts: parseFloat($("#item_consts").val()),
|
||||||
|
|
||||||
|
// };
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// const response = axios.post(url, sumt_data, {
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'application/json'
|
||||||
|
// }
|
||||||
|
// }).then(response => {
|
||||||
|
// console.log('提交成功:', response.data); // 正确打印服务器数据
|
||||||
|
|
||||||
|
// if (response.data.err_code == 0) {
|
||||||
|
// new_warehouses_item_windows_dom.hide();
|
||||||
|
// location.reload();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// });
|
||||||
|
// } catch (error) {
|
||||||
|
// if (error.response) {
|
||||||
|
// // 服务器返回了错误状态码(如 4xx, 5xx)
|
||||||
|
// console.error('服务器错误:', error.response.data);
|
||||||
|
// } else {
|
||||||
|
// console.error('请求未完成:', error.message);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user