up
This commit is contained in:
@@ -8,7 +8,7 @@ web:
|
|||||||
certPublicPath: ""
|
certPublicPath: ""
|
||||||
|
|
||||||
database:
|
database:
|
||||||
type: "sqlite" # mysql or sqlite
|
type: "sqlite" # mysql pg or sqlite
|
||||||
path: "data/database.db" # sqlite path
|
path: "data/database.db" # sqlite path
|
||||||
host: "" # mysql host
|
host: "" # mysql host
|
||||||
port: ""
|
port: ""
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ require (
|
|||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
|
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||||
|
github.com/jackc/pgx/v5 v5.6.0 // indirect
|
||||||
|
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
@@ -48,6 +52,7 @@ require (
|
|||||||
golang.org/x/tools v0.34.0 // indirect
|
golang.org/x/tools v0.34.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.9 // indirect
|
google.golang.org/protobuf v1.36.9 // indirect
|
||||||
gorm.io/driver/mysql v1.6.0 // indirect
|
gorm.io/driver/mysql v1.6.0 // indirect
|
||||||
|
gorm.io/driver/postgres v1.6.0 // indirect
|
||||||
gorm.io/gorm v1.31.0 // indirect
|
gorm.io/gorm v1.31.0 // indirect
|
||||||
modernc.org/libc v1.22.5 // indirect
|
modernc.org/libc v1.22.5 // indirect
|
||||||
modernc.org/mathutil v1.5.0 // indirect
|
modernc.org/mathutil v1.5.0 // indirect
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7Lk
|
|||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||||
|
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||||
|
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||||
|
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||||
|
github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY=
|
||||||
|
github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
||||||
|
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||||
@@ -67,6 +75,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
|||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
@@ -100,6 +109,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
|||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
||||||
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
||||||
|
gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4=
|
||||||
|
gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo=
|
||||||
gorm.io/gorm v1.31.0 h1:0VlycGreVhK7RF/Bwt51Fk8v0xLiiiFdbGDPIZQ7mJY=
|
gorm.io/gorm v1.31.0 h1:0VlycGreVhK7RF/Bwt51Fk8v0xLiiiFdbGDPIZQ7mJY=
|
||||||
gorm.io/gorm v1.31.0/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
|
gorm.io/gorm v1.31.0/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
|
||||||
modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE=
|
modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE=
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/glebarez/sqlite"
|
"github.com/glebarez/sqlite"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
|
"gorm.io/driver/postgres"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -102,7 +103,13 @@ func DatabaseInit() error {
|
|||||||
fmt.Println("mysql")
|
fmt.Println("mysql")
|
||||||
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", DatabaseConfigs["user"].(string), DatabaseConfigs["pass"].(string), DatabaseConfigs["host"].(string), DatabaseConfigs["port"].(string), DatabaseConfigs["name"].(string))
|
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", DatabaseConfigs["user"].(string), DatabaseConfigs["pass"].(string), DatabaseConfigs["host"].(string), DatabaseConfigs["port"].(string), DatabaseConfigs["name"].(string))
|
||||||
DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
||||||
|
} else if DatabaseConfigs["type"].(string) == "pg" {
|
||||||
|
//postgresql init
|
||||||
|
fmt.Println("postgresql")
|
||||||
|
dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Shanghai", DatabaseConfigs["host"].(string), DatabaseConfigs["user"].(string), DatabaseConfigs["pass"].(string), DatabaseConfigs["name"].(string), DatabaseConfigs["port"].(string))
|
||||||
|
DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
panic("数据库连接失败")
|
panic("数据库连接失败")
|
||||||
|
|||||||
@@ -292,6 +292,15 @@ onMounted(() => {
|
|||||||
{{ t("appname.schedule") }}
|
{{ t("appname.schedule") }}
|
||||||
</span>
|
</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<router-link
|
||||||
|
to="/purchase"
|
||||||
|
class="nav-item nav-link"
|
||||||
|
active-class="active"
|
||||||
|
>
|
||||||
|
<span class="nav-link-title">
|
||||||
|
{{ t("appname.purchase") }}
|
||||||
|
</span>
|
||||||
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ms-auto">
|
<div class="ms-auto">
|
||||||
|
|||||||
@@ -4,7 +4,27 @@
|
|||||||
"login": "Login",
|
"login": "Login",
|
||||||
"forgot_password": "Forgot Password",
|
"forgot_password": "Forgot Password",
|
||||||
"register": "Register",
|
"register": "Register",
|
||||||
"schedule":"Schedule"
|
"schedule":"Schedule",
|
||||||
|
"purchase":"Purchase"
|
||||||
|
},
|
||||||
|
"schedule": {
|
||||||
|
"my_schedule":"My Schedule",
|
||||||
|
"add_event":"Add Event",
|
||||||
|
"event_title":"Event Title",
|
||||||
|
"event_date":"Event Date",
|
||||||
|
"event_time":"Event Time",
|
||||||
|
"event_description":"Event Description",
|
||||||
|
"save_event":"Save Event",
|
||||||
|
"no_events":"No events found",
|
||||||
|
"delete_event":"Delete Event",
|
||||||
|
"edit_event":"Edit Event",
|
||||||
|
"tody":"Today",
|
||||||
|
"week":"This Week",
|
||||||
|
"month":"This Month",
|
||||||
|
"previous_month":"Prev Month",
|
||||||
|
"next_month":"Next Month",
|
||||||
|
"previous_year":"Prev Year",
|
||||||
|
"next_year":"Next Year"
|
||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"functionality_not_yet_developed":"Functionality not yet developed",
|
"functionality_not_yet_developed":"Functionality not yet developed",
|
||||||
|
|||||||
@@ -4,7 +4,27 @@
|
|||||||
"login": "登录",
|
"login": "登录",
|
||||||
"forgot_password": "忘记密码",
|
"forgot_password": "忘记密码",
|
||||||
"register": "注册",
|
"register": "注册",
|
||||||
"schedule":"日程"
|
"schedule":"日程",
|
||||||
|
"purchase":"采购"
|
||||||
|
},
|
||||||
|
"schedule": {
|
||||||
|
"my_schedule":"我的日程",
|
||||||
|
"add_event":"添加事件",
|
||||||
|
"event_title":"事件标题",
|
||||||
|
"event_date":"事件日期",
|
||||||
|
"event_time":"事件时间",
|
||||||
|
"event_description":"事件描述",
|
||||||
|
"save_event":"保存事件",
|
||||||
|
"no_events":"没有找到事件",
|
||||||
|
"delete_event":"删除事件",
|
||||||
|
"edit_event":"编辑事件",
|
||||||
|
"tody":"今天",
|
||||||
|
"week":"本周",
|
||||||
|
"month":"本月",
|
||||||
|
"previous_month":"上月",
|
||||||
|
"next_month":"下月",
|
||||||
|
"previous_year":"上年",
|
||||||
|
"next_year":"下年"
|
||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"functionality_not_yet_developed":"功能未开发",
|
"functionality_not_yet_developed":"功能未开发",
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ const router = createRouter({
|
|||||||
name: "schedule",
|
name: "schedule",
|
||||||
component: () => import("../views/scheduleView.vue"),
|
component: () => import("../views/scheduleView.vue"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/purchase",
|
||||||
|
name: "purchase",
|
||||||
|
component: () => import("../views/purchaseView.vue"),
|
||||||
|
}
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">Invoices</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body border-bottom py-3">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="text-secondary">
|
||||||
|
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>
|
||||||
|
entries
|
||||||
|
</div>
|
||||||
|
<div class="ms-auto text-secondary">
|
||||||
|
Search:
|
||||||
|
<div class="ms-2 d-inline-block">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
aria-label="Search invoice"
|
||||||
|
/>
|
||||||
|
</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">物品名称</th>
|
||||||
|
<th class="col-1">用途</th>
|
||||||
|
<th class="w-1">单位</th>
|
||||||
|
<th class="w-1">数量</th>
|
||||||
|
<th class="w-1">单价</th>
|
||||||
|
<th class="w-1">总价</th>
|
||||||
|
<th class="w-1">创建日期</th>
|
||||||
|
<th class="w-1">更新日期</th>
|
||||||
|
<th class="w-1">最新状态</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>
|
||||||
|
</template>
|
||||||
@@ -3,13 +3,16 @@ import FullCalendar from "@fullcalendar/vue3";
|
|||||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||||
import interactionPlugin from "@fullcalendar/interaction"; //拖动插件 需要用npm安装
|
import interactionPlugin from "@fullcalendar/interaction"; //拖动插件 需要用npm安装
|
||||||
import listPlugin from '@fullcalendar/list';
|
import listPlugin from "@fullcalendar/list";
|
||||||
|
|
||||||
import { onMounted, watch, ref } from "vue";
|
import { onMounted, watch, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
|
const calendar = ref(null);
|
||||||
|
|
||||||
|
|
||||||
const calendarOptions = ref({
|
const calendarOptions = ref({
|
||||||
height: "auto",
|
height: "auto",
|
||||||
locale: locale.value,
|
locale: locale.value,
|
||||||
@@ -42,12 +45,54 @@ const calendarOptions = ref({
|
|||||||
|
|
||||||
info.el.style.border = "1px solid #4b4b4b"; // 浅蓝色边框
|
info.el.style.border = "1px solid #4b4b4b"; // 浅蓝色边框
|
||||||
},
|
},
|
||||||
|
headerToolbar: {
|
||||||
|
left: "prevYearCustom,prevMonthCustom,todayCustom,nextMonthCustom,nextYearCustom",
|
||||||
|
center: "title",
|
||||||
|
right: "", //,timeGridWeek,timeGridDay'
|
||||||
|
},
|
||||||
|
|
||||||
|
// 自定义按钮
|
||||||
|
customButtons: {
|
||||||
|
prevYearCustom: {
|
||||||
|
text: t('schedule.previous_year'),
|
||||||
|
click: function () {
|
||||||
|
calendar.value.getApi().prevYear();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nextYearCustom: {
|
||||||
|
text: t('schedule.next_year'),
|
||||||
|
click: function () {
|
||||||
|
calendar.value.getApi().nextYear();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prevMonthCustom: {
|
||||||
|
text: t('schedule.previous_month'),
|
||||||
|
click: function () {
|
||||||
|
calendar.value.getApi().prev();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
nextMonthCustom: {
|
||||||
|
text: t('schedule.next_month'),
|
||||||
|
click: function () {
|
||||||
|
calendar.value.getApi().next();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
todayCustom: {
|
||||||
|
text: t('schedule.month'),
|
||||||
|
click: function () {
|
||||||
|
calendar.value.getApi().today();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
events: [
|
events: [
|
||||||
{ title: "事件 1", start: "2025-11-10" },
|
{ title: "事件 1", start: "2025-11-10" },
|
||||||
{ title: "事件 2", start: "2025-11-15", end: "2024-06-17" },
|
{ title: "事件 2", start: "2025-11-15", end: "2024-06-17" },
|
||||||
{ title: "事件 3", start: "2025-11-20T10:30:00", end: "2024-06-20T12:30:00" },
|
{
|
||||||
|
title: "事件 3",
|
||||||
|
start: "2025-11-20T10:30:00",
|
||||||
|
end: "2024-06-20T12:30:00",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -59,6 +104,13 @@ function functionupdataTitle() {
|
|||||||
watch(locale, () => {
|
watch(locale, () => {
|
||||||
functionupdataTitle();
|
functionupdataTitle();
|
||||||
calendarOptions.value.locale = locale.value;
|
calendarOptions.value.locale = locale.value;
|
||||||
|
|
||||||
|
// 更新自定义按钮文本
|
||||||
|
calendarOptions.value.customButtons.prevYearCustom.text = t('schedule.previous_year');
|
||||||
|
calendarOptions.value.customButtons.nextYearCustom.text = t('schedule.next_year');
|
||||||
|
calendarOptions.value.customButtons.prevMonthCustom.text = t('schedule.previous_month');
|
||||||
|
calendarOptions.value.customButtons.nextMonthCustom.text = t('schedule.next_month');
|
||||||
|
calendarOptions.value.customButtons.todayCustom.text = t('schedule.month');
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -66,5 +118,17 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FullCalendar :options="calendarOptions" />
|
<FullCalendar ref="calendar" :options="calendarOptions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* .fc-prevYearCustom-button {
|
||||||
|
background-color: #4CAF50 !important;
|
||||||
|
color: white !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 5px !important;
|
||||||
|
padding: 8px 16px !important;
|
||||||
|
font-weight: bold !important;
|
||||||
|
} */
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user