c
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">Chọn chế độ lưu</label>
|
||||
<div class="control is-expanded fs-14">
|
||||
<div class="control is-expanded is-flex is-gap-0.5 fs-14">
|
||||
<button
|
||||
class="button is-white has-text-inherit"
|
||||
:class="['button', radioSave === 'overwrite' ? 'is-primary is-light' : 'is-white']"
|
||||
v-if="isOverwrite()"
|
||||
@click="changeType('overwrite')"
|
||||
>
|
||||
@@ -29,7 +29,7 @@
|
||||
<span>Ghi đè</span>
|
||||
</button>
|
||||
<button
|
||||
class="button is-white"
|
||||
:class="['button', radioSave === 'new' ? 'is-primary is-light' : 'is-white']"
|
||||
@click="changeType('new')"
|
||||
>
|
||||
<span class="icon">
|
||||
@@ -90,7 +90,7 @@
|
||||
<button
|
||||
ref="saveBtn"
|
||||
:class="['button is-primary', isLoading && 'is-loading']"
|
||||
@click="saveSetting()"
|
||||
@click="saveSetting"
|
||||
>
|
||||
Lưu lại
|
||||
</button>
|
||||
@@ -111,7 +111,7 @@ const props = defineProps({
|
||||
});
|
||||
const { $empty, $copy, $stripHtml, $updateapi, $insertapi, $findIndex, $snackbar } = useNuxtApp();
|
||||
const radioOption = ref();
|
||||
var login = { id: 1 };
|
||||
const login = { id: 1 };
|
||||
const errors = ref([]);
|
||||
const radioType = ref();
|
||||
const radioDefault = 0;
|
||||
@@ -140,17 +140,19 @@ async function saveSetting() {
|
||||
}
|
||||
if (props.option) detail.option = props.option;
|
||||
if (props.data) detail.data = props.data;
|
||||
let data = {
|
||||
|
||||
const data = {
|
||||
// user: login.id,
|
||||
user: undefined,
|
||||
name: name.value,
|
||||
detail,
|
||||
note,
|
||||
note: note.value,
|
||||
type: radioType.value.id,
|
||||
classify: props.classify ? props.classify : store.settingclass.find((v) => v.code === "data-field").id,
|
||||
classify: store.settingclass.find((v) => v.code === props.classify).id,
|
||||
default: radioDefault,
|
||||
update_time: new Date(),
|
||||
};
|
||||
|
||||
let result;
|
||||
isLoading.value = true;
|
||||
if (radioSave.value === "new") {
|
||||
@@ -162,10 +164,12 @@ async function saveSetting() {
|
||||
}
|
||||
result = await $insertapi("usersetting", data);
|
||||
} else {
|
||||
let copy = $copy(currentsetting);
|
||||
copy.detail = detail;
|
||||
copy.update_time = new Date();
|
||||
result = await $updateapi("usersetting", copy);
|
||||
const updatedSetting = {
|
||||
...$copy(currentsetting),
|
||||
detail,
|
||||
update_time: new Date(),
|
||||
};
|
||||
result = await $updateapi("usersetting", updatedSetting);
|
||||
}
|
||||
isLoading.value = false;
|
||||
if (radioSave.value === "new") {
|
||||
|
||||
Reference in New Issue
Block a user