up
This commit is contained in:
@@ -2,6 +2,7 @@ package routers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"ops/models"
|
"ops/models"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -31,6 +32,53 @@ type From_purchase_addorder struct {
|
|||||||
|
|
||||||
func ApiPurchase(r *gin.RouterGroup) {
|
func ApiPurchase(r *gin.RouterGroup) {
|
||||||
|
|
||||||
|
r.POST("/getorders", func(ctx *gin.Context) {
|
||||||
|
isAuth, user, data := AuthenticationAuthority(ctx)
|
||||||
|
if isAuth {
|
||||||
|
fmt.Println(user)
|
||||||
|
// DebugPrintJson(data)
|
||||||
|
|
||||||
|
type From_purchase_getorders struct {
|
||||||
|
Search string
|
||||||
|
Entries int
|
||||||
|
Page int
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsondata From_purchase_getorders
|
||||||
|
if err := mapstructure.Decode(data, &jsondata); err == nil {
|
||||||
|
//fmt.Println(jsondata)
|
||||||
|
|
||||||
|
is_data_ok := true
|
||||||
|
|
||||||
|
if jsondata.Entries <= 0 {
|
||||||
|
is_data_ok = false
|
||||||
|
}
|
||||||
|
if jsondata.Page <= 0 {
|
||||||
|
is_data_ok = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_data_ok {
|
||||||
|
|
||||||
|
//读取有多少条目
|
||||||
|
var count int64
|
||||||
|
models.DB.Model(&models.TabPurchaseOrder{}).Count(&count)
|
||||||
|
fmt.Println(count)
|
||||||
|
|
||||||
|
//读取条目
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ReturnJson(ctx, "jsonErr", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ReturnJson(ctx, "jsonErr", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ReturnJson(ctx, "userCookieError", nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
r.POST("/addorder", func(ctx *gin.Context) {
|
r.POST("/addorder", func(ctx *gin.Context) {
|
||||||
isAuth, user, data := AuthenticationAuthority(ctx)
|
isAuth, user, data := AuthenticationAuthority(ctx)
|
||||||
if isAuth {
|
if isAuth {
|
||||||
@@ -115,7 +163,7 @@ func ApiPurchase(r *gin.RouterGroup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ReturnJson(ctx, "jsonErr", nil)
|
ReturnJson(ctx, "userCookieError", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnJson(ctx, "apiErr", nil)
|
ReturnJson(ctx, "apiErr", nil)
|
||||||
|
|||||||
@@ -1,14 +1,34 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, ref } from "vue";
|
import { onMounted, watch, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import MyOffcanvas from "@/components/MyOffcanvas.vue";
|
||||||
|
const mos = ref();
|
||||||
|
import { my_network_func } from "@/my_network_func";
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
|
//获取订单列表
|
||||||
|
function get_orders() {
|
||||||
|
my_network_func.postJson(
|
||||||
|
"/purchase/getorders",
|
||||||
|
{
|
||||||
|
search:"",
|
||||||
|
entries: 8,
|
||||||
|
page:1,
|
||||||
|
},
|
||||||
|
(r) => {
|
||||||
|
console.log(r);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function functionupdataTitle() {
|
function functionupdataTitle() {
|
||||||
document.title = "Operations." + t("appname.purchase");
|
document.title = "Operations." + t("appname.purchase");
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
functionupdataTitle();
|
functionupdataTitle();
|
||||||
|
|
||||||
|
get_orders();
|
||||||
});
|
});
|
||||||
// 监听语言变化,更新标题
|
// 监听语言变化,更新标题
|
||||||
watch(locale, () => {
|
watch(locale, () => {
|
||||||
@@ -17,6 +37,9 @@ watch(locale, () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="row row-cards">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@@ -24,7 +47,7 @@ watch(locale, () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-body border-bottom py-3">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="text-secondary">
|
<!-- <div class="text-secondary">
|
||||||
{{ t("purchase.show") }}
|
{{ t("purchase.show") }}
|
||||||
<div class="mx-2 d-inline-block">
|
<div class="mx-2 d-inline-block">
|
||||||
<input
|
<input
|
||||||
@@ -36,15 +59,7 @@ watch(locale, () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{{ t("purchase.entries") }}
|
{{ t("purchase.entries") }}
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="ms-auto text-secondary">
|
|
||||||
<router-link to="/purchase/addorder" class="btn btn-info m-1">
|
|
||||||
{{ t("purchase.add_part") }}
|
|
||||||
</router-link>
|
|
||||||
|
|
||||||
<button class="btn m-1">{{ t("purchase.exp_report") }}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ms-auto text-secondary">
|
<div class="ms-auto text-secondary">
|
||||||
{{ t("purchase.search") }}
|
{{ t("purchase.search") }}
|
||||||
@@ -56,10 +71,22 @@ watch(locale, () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="ms-auto text-secondary">
|
||||||
|
<button class="btn m-1">
|
||||||
|
{{ t("purchase.exp_report") }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<router-link to="/purchase/addorder" class="btn btn-info m-1">
|
||||||
|
{{ t("purchase.add_part") }}
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table card-table table-vcenter text-nowrap datatable">
|
<table
|
||||||
|
class="table card-table table-vcenter text-nowrap datatable"
|
||||||
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="w-1">
|
<th class="w-1">
|
||||||
@@ -126,11 +153,17 @@ watch(locale, () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-footer d-flex align-items-center">
|
<div class="card-footer d-flex align-items-center">
|
||||||
<p class="m-0 text-secondary">
|
<p class="m-0 text-secondary">
|
||||||
Showing <span>1</span> to <span>8</span> of <span>16</span> entries
|
Showing <span>1</span> to <span>8</span> of
|
||||||
|
<span>16</span> entries
|
||||||
</p>
|
</p>
|
||||||
<ul class="pagination m-0 ms-auto">
|
<ul class="pagination m-0 ms-auto">
|
||||||
<li class="page-item disabled">
|
<li class="page-item disabled">
|
||||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
<a
|
||||||
|
class="page-link"
|
||||||
|
href="#"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-disabled="true"
|
||||||
|
>
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
|
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -151,7 +184,9 @@ watch(locale, () => {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
||||||
<li class="page-item active"><a class="page-link" href="#">2</a></li>
|
<li class="page-item active">
|
||||||
|
<a class="page-link" href="#">2</a>
|
||||||
|
</li>
|
||||||
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||||
<li class="page-item"><a class="page-link" href="#">4</a></li>
|
<li class="page-item"><a class="page-link" href="#">4</a></li>
|
||||||
<li class="page-item"><a class="page-link" href="#">5</a></li>
|
<li class="page-item"><a class="page-link" href="#">5</a></li>
|
||||||
@@ -180,4 +215,9 @@ watch(locale, () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<MyOffcanvas ref="mos" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user