duqu
This commit is contained in:
@@ -65,6 +65,13 @@ func ApiPurchase(r *gin.RouterGroup) {
|
|||||||
fmt.Println(count)
|
fmt.Println(count)
|
||||||
|
|
||||||
//读取条目
|
//读取条目
|
||||||
|
var getorders []models.TabPurchaseOrder
|
||||||
|
models.DB.Order("created_at DESC").Limit(jsondata.Entries).Find(&getorders)
|
||||||
|
|
||||||
|
ReturnJson(ctx, "apiOK", map[string]interface{}{
|
||||||
|
"all_count": count,
|
||||||
|
"all_orders": getorders,
|
||||||
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ReturnJson(ctx, "jsonErr", nil)
|
ReturnJson(ctx, "jsonErr", nil)
|
||||||
|
|||||||
@@ -1,82 +1,96 @@
|
|||||||
|
|
||||||
export const myfuncs = {
|
export const myfuncs = {
|
||||||
|
themeStorageKey: "tablerTheme",
|
||||||
|
defaultTheme: "light",
|
||||||
|
|
||||||
themeStorageKey:"tablerTheme",
|
test() {
|
||||||
defaultTheme:"light",
|
|
||||||
|
|
||||||
test(){
|
|
||||||
console.log("myfuncs test ok");
|
console.log("myfuncs test ok");
|
||||||
},
|
},
|
||||||
|
|
||||||
//临时保存的数据,浏览器专属
|
//临时保存的数据,浏览器专属
|
||||||
saveT(key,data){
|
saveT(key, data) {
|
||||||
sessionStorage.setItem(key, data)
|
sessionStorage.setItem(key, data);
|
||||||
},
|
},
|
||||||
loadT(key){
|
loadT(key) {
|
||||||
return sessionStorage.getItem(key)
|
return sessionStorage.getItem(key);
|
||||||
},
|
},
|
||||||
deleT(key){
|
deleT(key) {
|
||||||
sessionStorage.removeItem(key)
|
sessionStorage.removeItem(key);
|
||||||
},
|
},
|
||||||
saveJsonT(key,data){
|
saveJsonT(key, data) {
|
||||||
this.saveT(key,JSON.stringify(data))
|
this.saveT(key, JSON.stringify(data));
|
||||||
},
|
},
|
||||||
|
|
||||||
loadJsonT(key){
|
loadJsonT(key) {
|
||||||
const js_data=this.loadT(key)
|
const js_data = this.loadT(key);
|
||||||
if(js_data){
|
if (js_data) {
|
||||||
return JSON.parse(js_data)
|
return JSON.parse(js_data);
|
||||||
}else{
|
} else {
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
save(key, data) {
|
||||||
|
localStorage.setItem(key, data);
|
||||||
|
},
|
||||||
|
load(key) {
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
},
|
||||||
|
dele(key) {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
},
|
||||||
|
|
||||||
|
saveJson(key, data) {
|
||||||
|
this.save(key, JSON.stringify(data));
|
||||||
|
},
|
||||||
|
|
||||||
save(key,data){
|
loadJson(key) {
|
||||||
localStorage.setItem(key, data)
|
const js_data = this.load(key);
|
||||||
},
|
if (js_data) {
|
||||||
load(key){
|
return JSON.parse(js_data);
|
||||||
return localStorage.getItem(key)
|
} else {
|
||||||
},
|
return null;
|
||||||
dele(key){
|
}
|
||||||
localStorage.removeItem(key)
|
},
|
||||||
},
|
|
||||||
|
|
||||||
saveJson(key,data){
|
getThemefromStorge() {
|
||||||
this.save(key,JSON.stringify(data))
|
const storedTheme = this.load(this.themeStorageKey);
|
||||||
},
|
return storedTheme ? storedTheme : this.defaultTheme;
|
||||||
|
},
|
||||||
|
|
||||||
loadJson(key){
|
setTheme(selectedTheme, save) {
|
||||||
const js_data=this.load(key)
|
if (save) {
|
||||||
if(js_data){
|
this.save(this.themeStorageKey, selectedTheme); // 保存到本地存储
|
||||||
return JSON.parse(js_data)
|
}
|
||||||
}else{
|
if (selectedTheme === "dark") {
|
||||||
return null
|
document.body.setAttribute("data-bs-theme", selectedTheme); // 暗色模式
|
||||||
}
|
} else {
|
||||||
|
document.body.removeAttribute("data-bs-theme"); // 亮色模式(移除属性)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
isValidEmail(email) {
|
||||||
|
// 定义邮箱的正则表达式
|
||||||
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||||
|
// 使用正则表达式测试邮箱
|
||||||
|
return emailRegex.test(email);
|
||||||
|
},
|
||||||
|
// 国际化日期格式化函数
|
||||||
|
formatLocalizedDate(dateString, locale = "zh-CN", options = {}) {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
|
||||||
getThemefromStorge() {
|
// 默认配置 - 中文格式
|
||||||
const storedTheme = this.load(this.themeStorageKey);
|
const defaultOptions = {
|
||||||
return storedTheme ? storedTheme : this.defaultTheme;
|
year: "numeric",
|
||||||
},
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit",
|
||||||
|
hour12: false,
|
||||||
|
};
|
||||||
|
|
||||||
setTheme(selectedTheme,save) {
|
const mergedOptions = { ...defaultOptions, ...options };
|
||||||
if(save){
|
const formatter = new Intl.DateTimeFormat(locale, mergedOptions);
|
||||||
this.save(this.themeStorageKey, selectedTheme); // 保存到本地存储
|
return formatter.format(date);
|
||||||
}
|
},
|
||||||
if (selectedTheme === 'dark') {
|
};
|
||||||
document.body.setAttribute("data-bs-theme", selectedTheme); // 暗色模式
|
|
||||||
} else {
|
|
||||||
document.body.removeAttribute("data-bs-theme"); // 亮色模式(移除属性)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
isValidEmail(email) {
|
|
||||||
// 定义邮箱的正则表达式
|
|
||||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
||||||
// 使用正则表达式测试邮箱
|
|
||||||
return emailRegex.test(email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,23 +1,41 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, ref } from "vue";
|
import { onMounted, watch, ref, reactive } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import MyOffcanvas from "@/components/MyOffcanvas.vue";
|
import MyOffcanvas from "@/components/MyOffcanvas.vue";
|
||||||
const mos = ref();
|
const mos = ref();
|
||||||
import { my_network_func } from "@/my_network_func";
|
import { my_network_func } from "@/my_network_func";
|
||||||
|
import { myfuncs } from "@/myfunc";
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
|
const all_orders = ref({});
|
||||||
|
|
||||||
//获取订单列表
|
//获取订单列表
|
||||||
function get_orders() {
|
function get_orders() {
|
||||||
my_network_func.postJson(
|
my_network_func.postJson(
|
||||||
"/purchase/getorders",
|
"/purchase/getorders",
|
||||||
{
|
{
|
||||||
search:"",
|
search: "",
|
||||||
entries: 8,
|
entries: 10,
|
||||||
page:1,
|
page: 1,
|
||||||
},
|
},
|
||||||
(r) => {
|
(r) => {
|
||||||
console.log(r);
|
console.log(r);
|
||||||
|
switch (r.statusCode) {
|
||||||
|
case 200:
|
||||||
|
switch (r.data.err_code) {
|
||||||
|
case 0:
|
||||||
|
all_orders.value = r.data.return.all_orders;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mos.value?.showAlert("danger", t("message.server_error"), 5000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mos.value?.showAlert("danger", t("message.network_err"), 5000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -47,8 +65,8 @@ 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
|
||||||
type="text"
|
type="text"
|
||||||
@@ -58,8 +76,14 @@ watch(locale, () => {
|
|||||||
aria-label="Invoices count"
|
aria-label="Invoices count"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{{ t("purchase.entries") }}
|
{{ t("purchase.entries") }} -->
|
||||||
</div> -->
|
<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") }}
|
||||||
@@ -72,15 +96,7 @@ watch(locale, () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ms-auto text-secondary">
|
<div class="ms-auto text-secondary"></div>
|
||||||
<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">
|
||||||
@@ -115,12 +131,12 @@ watch(locale, () => {
|
|||||||
<path d="M6 15l6 -6l6 6" />
|
<path d="M6 15l6 -6l6 6" />
|
||||||
</svg>
|
</svg>
|
||||||
</th>
|
</th>
|
||||||
<th class="col-5">{{ t("purchase.item_name") }}</th>
|
<th class="col-3">{{ t("purchase.item_name") }}</th>
|
||||||
<th class="col-1">{{ t("purchase.purpose") }}</th>
|
<th class="col-3">{{ t("purchase.purpose") }}</th>
|
||||||
<th class="w-1">{{ t("purchase.unit") }}</th>
|
<!-- <th class="w-1">{{ t("purchase.unit") }}</th> -->
|
||||||
<th class="w-1">{{ t("purchase.quantity") }}</th>
|
<th class="w-1">{{ t("purchase.quantity") }}</th>
|
||||||
<th class="w-1">{{ t("purchase.unit_price") }}</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.total_price") }}</th> -->
|
||||||
<th class="w-1">{{ t("purchase.created_at") }}</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.updated_at") }}</th>
|
||||||
<th class="w-1">{{ t("purchase.status") }}</th>
|
<th class="w-1">{{ t("purchase.status") }}</th>
|
||||||
@@ -128,7 +144,27 @@ watch(locale, () => {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr v-for="value in all_orders">
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
class="form-check-input m-0 align-middle"
|
||||||
|
type="checkbox"
|
||||||
|
aria-label="Select invoice"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="text-muted">{{ value.ID }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ value.Title }}
|
||||||
|
</td>
|
||||||
|
<td>{{ value.Remark }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td>{{myfuncs.formatLocalizedDate(value.CreatedAt,locale) }}</td>
|
||||||
|
<td>{{ myfuncs.formatLocalizedDate(value.UpdatedAt) }}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<!-- <tr>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
class="form-check-input m-0 align-middle"
|
class="form-check-input m-0 align-middle"
|
||||||
@@ -147,7 +183,7 @@ watch(locale, () => {
|
|||||||
<td>2024-06-05</td>
|
<td>2024-06-05</td>
|
||||||
<td><span class="badge bg-success me-1"></span> 已完成</td>
|
<td><span class="badge bg-success me-1"></span> 已完成</td>
|
||||||
<td class="text-end"></td>
|
<td class="text-end"></td>
|
||||||
</tr>
|
</tr> -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user