This commit is contained in:
Viet An
2026-06-18 09:10:36 +07:00
parent b7c82e944d
commit 87397be8bf
18 changed files with 78 additions and 90 deletions

View File

@@ -462,31 +462,31 @@ const getMenu = function () {
};
var selectTab = getMenu()[0];
var datatype = store.datatype;
var current = 1;
var value1 = undefined;
var value2 = undefined;
// var current = 1;
// var value1 = undefined;
// var value2 = undefined;
const moneyunit = store.moneyunit;
const radioType = store.datatype.find((v) => v.code === currentField.format);
var selectUnit = currentField.format === "number" ? moneyunit.find((v) => v.detail === currentField.unit) : undefined;
var bgcolor = undefined;
var radioBGcolor = colorchoice.find((v) => v.code === "none");
var color = undefined;
var radioColor = colorchoice.find((v) => v.code === "none");
var textsize = undefined;
var radioSize = colorchoice.find((v) => v.code === "none");
// var selectUnit = currentField.format === "number" ? moneyunit.find((v) => v.detail === currentField.unit) : undefined;
// var bgcolor = undefined;
// var radioBGcolor = colorchoice.find((v) => v.code === "none");
// var color = undefined;
// var radioColor = colorchoice.find((v) => v.code === "none");
// var textsize = undefined;
// var radioSize = colorchoice.find((v) => v.code === "none");
var minwidth = undefined;
var radioWidth = colorchoice.find((v) => v.code === "none");
var radioMaxWidth = colorchoice.find((v) => v.code === "none");
// var radioWidth = colorchoice.find((v) => v.code === "none");
// var radioMaxWidth = colorchoice.find((v) => v.code === "none");
var maxwidth = undefined;
var selectAlign = undefined;
var radioAlign = colorchoice.find((v) => v.code === "none");
// var selectAlign = undefined;
// var radioAlign = colorchoice.find((v) => v.code === "none");
var radioTemplate = ref(colorchoice.find((v) => v.code === (currentField.template ? "option" : "none"))["code"]);
var selectPlacement = store.placement.find((v) => v.code === "is-right");
var selectScheme = store.colorscheme.find((v) => v.code === "is-primary");
var radioTooltip = store.colorchoice.find((v) => v.code === "none");
var selectField = undefined;
var tags = currentField.tags ? currentField.tags.map((v) => fields.find((x) => x.name === v)) : [];
var formula = currentField.formula ? currentField.formula : undefined;
// var selectPlacement = store.placement.find((v) => v.code === "is-right");
// var selectScheme = store.colorscheme.find((v) => v.code === "is-primary");
// var radioTooltip = store.colorchoice.find((v) => v.code === "none");
// var selectField = undefined;
// var tags = currentField.tags ? currentField.tags.map((v) => fields.find((x) => x.name === v)) : [];
// var formula = currentField.formula ? currentField.formula : undefined;
var decimal = currentField.decimal;
let shortmenu = store.menuchoice.filter((x) =>
currentField.format === "number"

View File

@@ -615,7 +615,7 @@ const checkExpression = function () {
tagsField.forEach((v) => {
let myRegExp = new RegExp(v.name, "g");
val = val.replace(myRegExp, Math.random());
exp = exp.replace(myRegExp, "formatNumber(row['" + v.name + "'])");
exp = exp.replace(myRegExp, "parseNum(row['" + v.name + "'])");
});
try {
let value = $calc(val);

View File

@@ -147,7 +147,7 @@ const {
$empty,
$find,
$getEditRights,
$formatNumber,
$parseNum,
$multiSort,
$remove,
$stripHtml,
@@ -420,8 +420,8 @@ const frontendFilter = function (newVal) {
else {
let text = "";
filter.map((y, k) => {
text += `${k > 0 ? (filter[k - 1].operator === "and" ? " &&" : " ||") : ""} ${$formatNumber(x[name])}
${y.condition === "=" ? "==" : y.condition === "<>" ? "!==" : y.condition} ${$formatNumber(y.value)}`;
text += `${k > 0 ? (filter[k - 1].operator === "and" ? " &&" : " ||") : ""} ${$parseNum(x[name])}
${y.condition === "=" ? "==" : y.condition === "<>" ? "!==" : y.condition} ${$parseNum(y.value)}`;
});
return $calc(text);
}
@@ -541,7 +541,7 @@ const updateData = async function (newVal) {
}
if (newVal.tablesetting) {
tablesetting = newVal.tablesetting;
perPage = $formatNumber(tablesetting.find((v) => v.code == "per-page").detail);
perPage = $parseNum(tablesetting.find((v) => v.code == "per-page").detail);
currentPage = 1;
}
tablesetting = $copy(pagedata.tablesetting || gridsetting);

View File

@@ -238,7 +238,7 @@ export default {
this.tagsField.forEach((v) => {
let myRegExp = new RegExp(v.name, "g");
val = val.replace(myRegExp, Math.random());
exp = exp.replace(myRegExp, "field.formatNumber(row['" + v.name + "'])");
exp = exp.replace(myRegExp, "field.parseNum(row['" + v.name + "'])");
});
try {
let value = this.$calc(val);

View File

@@ -221,8 +221,8 @@ const {
$stripHtml,
$snackbar,
$dayjs,
$formatNumber,
$numtoString,
$parseNum,
$formatNum,
$empty,
$unique,
$multiSort,
@@ -523,9 +523,9 @@ const formatCellValue = (value, field) => {
if (value === undefined || value === null || value === "") return "-";
if (field.format === "number") {
const num = $formatNumber(value);
const num = $parseNum(value);
if (num === undefined) return "-";
return $numtoString(num, "vi-VN", field.decimal || 0, field.decimal || 0);
return $formatNum(num, "vi-VN", field.decimal || 0, field.decimal || 0);
}
if (field.format === "date") {
@@ -596,8 +596,8 @@ const getDataCellStyle = (row, leaf) => {
if (cell && leaf.field) {
if (leaf.field === "paid_amount") {
const amount = $formatNumber(cell.amount) || 0;
const paid = $formatNumber(cell.paid_amount) || 0;
const amount = $parseNum(cell.amount) || 0;
const paid = $parseNum(cell.paid_amount) || 0;
if (paid >= amount) {
style += " background-color: #d4edda;";
} else if (paid > 0) {
@@ -608,8 +608,8 @@ const getDataCellStyle = (row, leaf) => {
}
if (leaf.field === "to_date") {
const dueDate = cell.to_date;
const paid = $formatNumber(cell.paid_amount) || 0;
const amount = $formatNumber(cell.amount) || 0;
const paid = $parseNum(cell.paid_amount) || 0;
const amount = $parseNum(cell.amount) || 0;
if (dueDate && paid < amount) {
const today = new Date();
const due = new Date(dueDate);

View File

@@ -433,7 +433,7 @@ export default {
checkTimeopt() {
if (this.timeopt > 0) {
let obj = this.$find(this.options, {
code: this.$formatNumber(this.timeopt),
code: this.$parseNum(this.timeopt),
});
if (obj) this.current = obj.code;
}
@@ -442,7 +442,7 @@ export default {
if (this.timeopt.disable.indexOf("time") >= 0) this.enableTime = false;
if (this.timeopt.time) {
let obj = this.$find(this.options, {
code: this.$formatNumber(this.timeopt.time),
code: this.$parseNum(this.timeopt.time),
});
if (obj) this.current = obj.code;
}