This commit is contained in:
Viet An
2026-07-04 16:01:35 +07:00
parent 24bd08e719
commit 71e4494004
3 changed files with 38 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<!-- v-if="currentsetting ? currentsetting.user === login.id : false" --> <!-- v-if="currentsetting ? currentsetting.user === login.id : false" -->
<div <div
class="mb-4" class="block"
v-if="currentsetting" v-if="currentsetting"
> >
<span>Đang mở: </span> <span>Đang mở: </span>
@@ -55,9 +55,33 @@
</button> </button>
</div> </div>
</div> </div>
<template v-if="radioSave === 'overwrite'">
<div class="field">
<label class="label">Tên<span class="has-text-danger"> * </span></label>
<div class="control">
<input
class="input"
type="text"
:value="$stripHtml(currentsetting.name, 40)"
disabled
/>
</div>
</div>
<div class="field">
<label class="label"> tả</label>
<p class="control is-expanded">
<textarea
class="textarea"
rows="1"
placeholder="Note"
disabled
></textarea>
</p>
</div>
</template>
<template v-if="radioSave === 'new'"> <template v-if="radioSave === 'new'">
<div class="field"> <div class="field">
<label class="label">Tên thiết lập <span class="has-text-danger"> * </span></label> <label class="label">Tên<span class="has-text-danger"> * </span></label>
<div class="control"> <div class="control">
<!-- ref="name" --> <!-- ref="name" -->
<input <input

View File

@@ -9,6 +9,7 @@
> >
<tbody> <tbody>
<tr <tr
v-if="rows.length"
v-for="(v, i) in rows" v-for="(v, i) in rows"
:key="i" :key="i"
@click="doClick(v, i)" @click="doClick(v, i)"
@@ -28,6 +29,12 @@
</span> </span>
</td> </td>
</tr> </tr>
<p
v-else
class="py-2 has-text-grey has-text-centered is-unselectable"
>
Không giá trị nào.
</p>
</tbody> </tbody>
</table> </table>
<div <div

View File

@@ -271,6 +271,11 @@ export default defineNuxtPlugin(() => {
}; };
const unique = function (arr, keyProps) { const unique = function (arr, keyProps) {
// assume keyProps always has 1 element only
// assume all elements of arr have the same shape
// if keyProps[0] is not a key of arr[0], return []
if (!Object.keys(arr[0]).includes(keyProps[0])) return [];
const kvArray = arr.map((entry) => { const kvArray = arr.map((entry) => {
const key = keyProps.map((k) => entry[k]).join("|"); const key = keyProps.map((k) => entry[k]).join("|");
return [key, entry]; return [key, entry];