This commit is contained in:
Viet An
2026-05-27 09:17:52 +07:00
parent cc3bb9cfb5
commit 29ff3f2598
4 changed files with 41 additions and 26 deletions

View File

@@ -144,8 +144,8 @@ menu.forEach((topmenu) => {
topmenu.submenu = submenus.length > 0 ? submenus : null; topmenu.submenu = submenus.length > 0 ? submenus : null;
}); });
var leftmenu = $filter(menu, { category: "topmenu", classify: "left" }); const leftmenu = $filter(menu, { category: "topmenu", classify: "left" });
var currentTab = ref(leftmenu.length > 0 ? leftmenu[0] : undefined); var currentTab = ref(leftmenu[0]);
var subTab = ref(); var subTab = ref();
var tabConfig = $find(menu, { code: "configuration" }); var tabConfig = $find(menu, { code: "configuration" });
var avatar = ref(); var avatar = ref();

View File

@@ -25,7 +25,7 @@
> >
<div class="dropdown-content px-2 w-xs"> <div class="dropdown-content px-2 w-xs">
<PickDay <PickDay
v-bind="{ date, maxdate }" v-bind="{ date, mindate, maxdate }"
@date="selectDate" @date="selectDate"
/> />
</div> </div>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="is-flex is-flex-direction-column is-gap-1"> <div class="is-flex is-flex-direction-column is-gap-1">
<div class="is-flex is-gap-1 is-justify-content-space-between h-8"> <div class="is-flex is-gap-1 is-justify-content-space-between h-8">
<div class="buttons is-gap-0.5 m-0 is-align-items-stretch"> <div class="buttons is-gap-0 m-0 is-align-items-stretch">
<button <button
@click="previousYear" @click="previousYear"
class="button is-text rounded-full" class="button is-text rounded-full"
@@ -41,7 +41,7 @@
{{ caption || year }} {{ caption || year }}
</button> </button>
</div> </div>
<div class="buttons is-gap-0.5 m-0 is-align-items-stretch"> <div class="buttons is-gap-0 m-0 is-align-items-stretch">
<button <button
class="button is-text rounded-full" class="button is-text rounded-full"
@click="nextMonth" @click="nextMonth"
@@ -68,7 +68,7 @@
</div> </div>
</div> </div>
<div v-if="type === 'days'"> <div v-if="type === 'days'">
<div class="fixed-grid has-7-cols mb-1 fs-13 has-background-white-bis has-text-grey rounded-sm"> <div class="fixed-grid has-7-cols mb-1 fs-12 font-medium has-background-white-bis has-text-grey rounded-full">
<div class="grid is-gap-0"> <div class="grid is-gap-0">
<p <p
v-for="(m, h) in dateOfWeek" v-for="(m, h) in dateOfWeek"
@@ -146,6 +146,7 @@ const { $id, $dayjs, $unique } = useNuxtApp();
const emit = defineEmits(["date"]); const emit = defineEmits(["date"]);
const props = defineProps({ const props = defineProps({
date: String, date: String,
mindate: [Date, String],
maxdate: [Date, String], maxdate: [Date, String],
}); });
const dates = ref([]); const dates = ref([]);
@@ -247,10 +248,24 @@ function allDaysInMonth(year, month) {
let disabled = false; let disabled = false;
if (props.maxdate) { if (props.maxdate) {
const maxDateObj = $dayjs(props.maxdate); const maxDateObj = $dayjs(props.maxdate);
if (maxDateObj.diff(props.date, "day") >= 0 && maxDateObj.startOf("day").diff(date, "day") < 0) { if (
maxDateObj.startOf("day").diff(props.date, "day") >= 0 &&
maxDateObj.startOf("day").diff(date, "day") < 0
) {
disabled = true; disabled = true;
} }
} }
if (props.mindate) {
const minDateObj = $dayjs(props.mindate);
if (
minDateObj.startOf("day").diff(props.date, "day") < 0 &&
minDateObj.startOf("day").diff(date, "day") >= 0
) {
disabled = true;
}
}
const ele = { const ele = {
date, date,
day, day,
@@ -278,9 +293,6 @@ watch(
); );
</script> </script>
<style scoped> <style scoped>
a {
color: var(--bulma-link-60);
}
.control.has-icons-left .icon, .control.has-icons-left .icon,
.control.has-icons-right .icon { .control.has-icons-right .icon {
width: 100%; width: 100%;

View File

@@ -94,10 +94,11 @@ export default defineNuxtPlugin(() => {
const clone = function (obj) { const clone = function (obj) {
if (obj === null || typeof obj !== "object" || "isActiveClone" in obj) return obj; if (obj === null || typeof obj !== "object" || "isActiveClone" in obj) return obj;
let temp;
if (obj instanceof Date) if (obj instanceof Date)
var temp = new obj.constructor(); //or new Date(obj); temp = new obj.constructor(); //or new Date(obj);
else var temp = obj.constructor(); else temp = obj.constructor();
for (var key in obj) { for (let key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) { if (Object.prototype.hasOwnProperty.call(obj, key)) {
obj["isActiveClone"] = null; obj["isActiveClone"] = null;
temp[key] = clone(obj[key]); temp[key] = clone(obj[key]);
@@ -117,9 +118,9 @@ export default defineNuxtPlugin(() => {
if (html ? html.indexOf("<") < 0 : false) { if (html ? html.indexOf("<") < 0 : false) {
return length ? (html.length > length ? html.substring(0, length) + "..." : html) : html; return length ? (html.length > length ? html.substring(0, length) + "..." : html) : html;
} }
var tmp = document.createElement("DIV"); const tmp = document.createElement("DIV");
tmp.innerHTML = html; tmp.innerHTML = html;
var val = tmp.textContent || tmp.innerText || ""; const val = tmp.textContent || tmp.innerText || "";
return length ? (val.length > length ? val.substring(0, length) + "..." : val) : val; return length ? (val.length > length ? val.substring(0, length) + "..." : val) : val;
}; };
@@ -190,14 +191,15 @@ export default defineNuxtPlugin(() => {
//calculate //calculate
try { try {
let value = this.$calc(val); let value = this.$calc(val);
let result;
if (isNaN(value) || value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY) { if (isNaN(value) || value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY) {
var result = { success: false, value: value }; result = { success: false, value };
} else { } else {
value = value === true || value === false ? value : formatUnit(value, unit, decimal, true, decimal); value = value === true || value === false ? value : formatUnit(value, unit, decimal, true, decimal);
var result = { success: true, value: value }; result = { success: true, value };
} }
} catch (err) { } catch (err) {
var result = { success: false, value: undefined }; result = { success: false, value: undefined };
} }
return result; return result;
}; };
@@ -295,7 +297,7 @@ export default defineNuxtPlugin(() => {
const arrayMove = function (arr, old_index, new_index) { const arrayMove = function (arr, old_index, new_index) {
if (new_index >= arr.length) { if (new_index >= arr.length) {
var k = new_index - arr.length + 1; let k = new_index - arr.length + 1;
while (k--) { while (k--) {
arr.push(undefined); arr.push(undefined);
} }
@@ -423,12 +425,12 @@ export default defineNuxtPlugin(() => {
//======================Export=============================== //======================Export===============================
const exportExcel = async function (data, filename, fields) { const exportExcel = async function (data, filename, fields) {
var _filename = filename + ".xlsx"; const _filename = filename + ".xlsx";
let list = []; const list = [];
data.map((v) => { data.map((v) => {
let ele = {}; const ele = {};
fields.map((x) => { fields.forEach((x) => {
let label = stripHtml(x.label); const label = stripHtml(x.label);
ele[label] = v[x.name]; ele[label] = v[x.name];
}); });
list.push(ele); list.push(ele);
@@ -441,8 +443,8 @@ export default defineNuxtPlugin(() => {
this.SheetNames = []; this.SheetNames = [];
this.Sheets = {}; this.Sheets = {};
} }
var exportBook = new Workbook(); const exportBook = new Workbook();
var worksheet = XLSX.utils.json_to_sheet(list); const worksheet = XLSX.utils.json_to_sheet(list);
exportBook.SheetNames.push("sheet1"); exportBook.SheetNames.push("sheet1");
exportBook.Sheets.sheet1 = worksheet; exportBook.Sheets.sheet1 = worksheet;
XLSX.writeFile(exportBook, _filename); XLSX.writeFile(exportBook, _filename);
@@ -456,6 +458,7 @@ export default defineNuxtPlugin(() => {
filter, filter,
id, id,
empty, empty,
toRawDeep,
copy, copy,
clone, clone,
remove, remove,