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,167 +37,187 @@ watch(locale, () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12">
|
<div class="page-body">
|
||||||
<div class="card">
|
<div class="container-xl">
|
||||||
<div class="card-header">
|
<div class="row row-cards">
|
||||||
<h3 class="card-title">{{ t("purchase.purchase_list") }}</h3>
|
<div class="col-12">
|
||||||
</div>
|
<div class="card">
|
||||||
<div class="card-body border-bottom py-3">
|
<div class="card-header">
|
||||||
<div class="d-flex">
|
<h3 class="card-title">{{ t("purchase.purchase_list") }}</h3>
|
||||||
<div class="text-secondary">
|
|
||||||
{{ t("purchase.show") }}
|
|
||||||
<div class="mx-2 d-inline-block">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control form-control-sm"
|
|
||||||
value="8"
|
|
||||||
size="3"
|
|
||||||
aria-label="Invoices count"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{{ t("purchase.entries") }}
|
<div class="card-body border-bottom py-3">
|
||||||
</div>
|
<div class="d-flex">
|
||||||
|
<!-- <div class="text-secondary">
|
||||||
|
{{ t("purchase.show") }}
|
||||||
|
<div class="mx-2 d-inline-block">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
value="8"
|
||||||
|
size="3"
|
||||||
|
aria-label="Invoices count"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{{ t("purchase.entries") }}
|
||||||
|
</div> -->
|
||||||
|
|
||||||
<div class="ms-auto text-secondary">
|
<div class="ms-auto text-secondary">
|
||||||
<router-link to="/purchase/addorder" class="btn btn-info m-1">
|
{{ t("purchase.search") }}
|
||||||
{{ t("purchase.add_part") }}
|
<div class="ms-2 d-inline-block mr-2">
|
||||||
</router-link>
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
aria-label="Search invoice"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="btn m-1">{{ t("purchase.exp_report") }}</button>
|
<div class="ms-auto text-secondary">
|
||||||
</div>
|
<button class="btn m-1">
|
||||||
|
{{ t("purchase.exp_report") }}
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="ms-auto text-secondary">
|
<router-link to="/purchase/addorder" class="btn btn-info m-1">
|
||||||
{{ t("purchase.search") }}
|
{{ t("purchase.add_part") }}
|
||||||
<div class="ms-2 d-inline-block mr-2">
|
</router-link>
|
||||||
<input
|
</div>
|
||||||
type="text"
|
</div>
|
||||||
class="form-control form-control-sm"
|
</div>
|
||||||
aria-label="Search invoice"
|
<div class="table-responsive">
|
||||||
/>
|
<table
|
||||||
|
class="table card-table table-vcenter text-nowrap datatable"
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-1">
|
||||||
|
<input
|
||||||
|
class="form-check-input m-0 align-middle"
|
||||||
|
type="checkbox"
|
||||||
|
aria-label="Select all invoices"
|
||||||
|
/>
|
||||||
|
</th>
|
||||||
|
<th class="col-1">
|
||||||
|
No.
|
||||||
|
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-up -->
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="icon icon-sm icon-thick"
|
||||||
|
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="M6 15l6 -6l6 6" />
|
||||||
|
</svg>
|
||||||
|
</th>
|
||||||
|
<th class="col-5">{{ t("purchase.item_name") }}</th>
|
||||||
|
<th class="col-1">{{ t("purchase.purpose") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.unit") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.quantity") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.unit_price") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.total_price") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.created_at") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.updated_at") }}</th>
|
||||||
|
<th class="w-1">{{ t("purchase.status") }}</th>
|
||||||
|
<th class="w-1"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
class="form-check-input m-0 align-middle"
|
||||||
|
type="checkbox"
|
||||||
|
aria-label="Select invoice"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td><span class="text-muted">001</span></td>
|
||||||
|
<td>办公室用纸</td>
|
||||||
|
<td>办公用品</td>
|
||||||
|
<td>包</td>
|
||||||
|
<td>10</td>
|
||||||
|
<td>15.00</td>
|
||||||
|
<td>150.00</td>
|
||||||
|
<td>2024-06-01</td>
|
||||||
|
<td>2024-06-05</td>
|
||||||
|
<td><span class="badge bg-success me-1"></span> 已完成</td>
|
||||||
|
<td class="text-end"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer d-flex align-items-center">
|
||||||
|
<p class="m-0 text-secondary">
|
||||||
|
Showing <span>1</span> to <span>8</span> of
|
||||||
|
<span>16</span> entries
|
||||||
|
</p>
|
||||||
|
<ul class="pagination m-0 ms-auto">
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<a
|
||||||
|
class="page-link"
|
||||||
|
href="#"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-disabled="true"
|
||||||
|
>
|
||||||
|
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
|
||||||
|
<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="M15 6l-6 6l6 6" />
|
||||||
|
</svg>
|
||||||
|
prev
|
||||||
|
</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"><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="#">5</a></li>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="#">
|
||||||
|
next
|
||||||
|
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-right -->
|
||||||
|
<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="M9 6l6 6l-6 6" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table card-table table-vcenter text-nowrap datatable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="w-1">
|
|
||||||
<input
|
|
||||||
class="form-check-input m-0 align-middle"
|
|
||||||
type="checkbox"
|
|
||||||
aria-label="Select all invoices"
|
|
||||||
/>
|
|
||||||
</th>
|
|
||||||
<th class="col-1">
|
|
||||||
No.
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-up -->
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="icon icon-sm icon-thick"
|
|
||||||
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="M6 15l6 -6l6 6" />
|
|
||||||
</svg>
|
|
||||||
</th>
|
|
||||||
<th class="col-5">{{ t("purchase.item_name") }}</th>
|
|
||||||
<th class="col-1">{{ t("purchase.purpose") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.unit") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.quantity") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.unit_price") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.total_price") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.created_at") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.updated_at") }}</th>
|
|
||||||
<th class="w-1">{{ t("purchase.status") }}</th>
|
|
||||||
<th class="w-1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<input
|
|
||||||
class="form-check-input m-0 align-middle"
|
|
||||||
type="checkbox"
|
|
||||||
aria-label="Select invoice"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td><span class="text-muted">001</span></td>
|
|
||||||
<td>办公室用纸</td>
|
|
||||||
<td>办公用品</td>
|
|
||||||
<td>包</td>
|
|
||||||
<td>10</td>
|
|
||||||
<td>15.00</td>
|
|
||||||
<td>150.00</td>
|
|
||||||
<td>2024-06-01</td>
|
|
||||||
<td>2024-06-05</td>
|
|
||||||
<td><span class="badge bg-success me-1"></span> 已完成</td>
|
|
||||||
<td class="text-end"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer d-flex align-items-center">
|
|
||||||
<p class="m-0 text-secondary">
|
|
||||||
Showing <span>1</span> to <span>8</span> of <span>16</span> entries
|
|
||||||
</p>
|
|
||||||
<ul class="pagination m-0 ms-auto">
|
|
||||||
<li class="page-item disabled">
|
|
||||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
|
|
||||||
<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="M15 6l-6 6l6 6" />
|
|
||||||
</svg>
|
|
||||||
prev
|
|
||||||
</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"><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="#">5</a></li>
|
|
||||||
<li class="page-item">
|
|
||||||
<a class="page-link" href="#">
|
|
||||||
next
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-right -->
|
|
||||||
<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="M9 6l6 6l-6 6" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<MyOffcanvas ref="mos" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user