diff --git a/app/components/Modal.vue b/app/components/Modal.vue index 5d2f7b6..f5c9ab8 100644 --- a/app/components/Modal.vue +++ b/app/components/Modal.vue @@ -22,7 +22,7 @@ class="modal-card-head px-4 py-3" > @@ -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") { diff --git a/app/components/datatable/ScrollBox.vue b/app/components/datatable/ScrollBox.vue index 3045725..c58a85c 100644 --- a/app/components/datatable/ScrollBox.vue +++ b/app/components/datatable/ScrollBox.vue @@ -58,7 +58,7 @@ > - Mở trong tab mớ + Mở trong tab mới { - let field = this.$createField( + const fields = []; + const arr = ["AutoField", "ForeignKey", "FloatField", "IntegerField"]; + this.pagedata2.data.forEach((v) => { + const field = this.$createField( v.name, v.name, arr.findIndex((x) => x == v.datatype) >= 0 ? "number" : "string", @@ -146,13 +146,13 @@ export default { ); fields.push(field); }); - this.$store.commit(this.pagename3, { update: { fields: fields } }); + this.$store.commit(this.pagename3, { update: { fields } }); this.showmodal = { component: "menu/MenuSave", title: "Lưu thiết lập", width: "600px", height: "auto", - vbind: { pagename: this.pagename3, classify: 3 }, + vbind: { pagename: this.pagename3, classify: "data-field" }, }; }, remove(v) { @@ -164,11 +164,11 @@ export default { async insertData() { let copy = this.$copy(this.current); copy.id = undefined; - let rs = await this.$insertrow("importsetting", copy, undefined, this.pagename); + await this.$insertrow("importsetting", copy, undefined, this.pagename); }, async saveData() { if (!this.row) return this.insertData(); - let rs = await this.$updateapi("importsetting", this.current, undefined, this.pagename); + await this.$updateapi("importsetting", this.current, undefined, this.pagename); }, updateFromModel() { let filter = this.$filter(this.pagedata2.data, { diff --git a/app/plugins/02-connection.js b/app/plugins/02-connection.js index 5839a14..d9686bd 100644 --- a/app/plugins/02-connection.js +++ b/app/plugins/02-connection.js @@ -1232,7 +1232,7 @@ export default defineNuxtPlugin((nuxtApp) => { } return rs; } catch (err) { - console.log(err); + console.error(err); return "error"; } }; diff --git a/app/plugins/03-api-loader.js b/app/plugins/03-api-loader.js index 233d671..85f6c73 100644 --- a/app/plugins/03-api-loader.js +++ b/app/plugins/03-api-loader.js @@ -1,6 +1,6 @@ export default defineNuxtPlugin(async (nuxtApp) => { const { $getapi, $readyapi } = nuxtApp; - let connlist = $readyapi([ + const connlist = $readyapi([ "datatype", "common", "filterchoice", @@ -18,6 +18,6 @@ export default defineNuxtPlugin(async (nuxtApp) => { "settingclass", "sex", ]); - let notReadyConns = connlist.filter((v) => !v.ready); + const notReadyConns = connlist.filter((v) => !v.ready); if (notReadyConns.length > 0) await $getapi(notReadyConns); }); diff --git a/app/stores/index.js b/app/stores/index.js index 3552b08..e93be8d 100644 --- a/app/stores/index.js +++ b/app/stores/index.js @@ -9,9 +9,6 @@ export const useStore = defineStore("maindev", { settings: [], showmodal: undefined, snackbar: undefined, - productdocument: undefined, - applicationstatus: undefined, - applicationproduct: undefined, country: undefined, lang: "vi", branch: {},