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;
});
var leftmenu = $filter(menu, { category: "topmenu", classify: "left" });
var currentTab = ref(leftmenu.length > 0 ? leftmenu[0] : undefined);
const leftmenu = $filter(menu, { category: "topmenu", classify: "left" });
var currentTab = ref(leftmenu[0]);
var subTab = ref();
var tabConfig = $find(menu, { code: "configuration" });
var avatar = ref();

View File

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

View File

@@ -1,7 +1,7 @@
<template>
<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="buttons is-gap-0.5 m-0 is-align-items-stretch">
<div class="buttons is-gap-0 m-0 is-align-items-stretch">
<button
@click="previousYear"
class="button is-text rounded-full"
@@ -41,7 +41,7 @@
{{ caption || year }}
</button>
</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
class="button is-text rounded-full"
@click="nextMonth"
@@ -68,7 +68,7 @@
</div>
</div>
<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">
<p
v-for="(m, h) in dateOfWeek"
@@ -146,6 +146,7 @@ const { $id, $dayjs, $unique } = useNuxtApp();
const emit = defineEmits(["date"]);
const props = defineProps({
date: String,
mindate: [Date, String],
maxdate: [Date, String],
});
const dates = ref([]);
@@ -247,10 +248,24 @@ function allDaysInMonth(year, month) {
let disabled = false;
if (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;
}
}
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 = {
date,
day,
@@ -278,9 +293,6 @@ watch(
);
</script>
<style scoped>
a {
color: var(--bulma-link-60);
}
.control.has-icons-left .icon,
.control.has-icons-right .icon {
width: 100%;

View File

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