This commit is contained in:
Viet An
2026-06-05 20:12:34 +07:00
parent 3254c64f7d
commit 541f99f82a
13 changed files with 47 additions and 83 deletions

View File

@@ -223,7 +223,7 @@ const {
$resetNull,
$findapi,
$insertapi,
$updateapi,
$patchapi,
$remove,
$deleteapi,
$empty,
@@ -315,7 +315,7 @@ async function update() {
data.link = arr1.length === 0 ? null : arr1;
let api = $findapi("useraction");
record = data.id
? await $updateapi("useraction", { data, values: api.params.values })
? await $patchapi("useraction", { data, values: api.params.values })
: await $insertapi("useraction", { data, values: api.params.values });
getValue();
}

View File

@@ -21,7 +21,7 @@
</template>
<script setup>
const emit = defineEmits(["close"]);
const { $store, $getdata, $updateapi, $updatepage } = useNuxtApp();
const { $store, $getdata, $patchapi, $updatepage } = useNuxtApp();
const props = defineProps({
row: Object,
pagename: String,
@@ -31,7 +31,7 @@ let record = await $getdata("application", {
first: true,
});
async function save() {
await $updateapi("application", record);
await $patchapi("application", record);
record = await $getdata("application", {
filter: { id: props.row.id },
first: true,

View File

@@ -119,7 +119,7 @@ export default {
data = this.$copy(this.current);
data.detail = this.detail;
}
let rs = data.id ? await this.$updateapi(this.api, data) : await this.$insertapi(this.api, { data });
let rs = data.id ? await this.$patchapi(this.api, data) : await this.$insertapi(this.api, { data });
if (!rs) return;
this.detail = undefined;
if (this.current) {

View File

@@ -205,7 +205,7 @@ var props = defineProps({
row: Object,
});
const store = useStore();
const { $find, $getdata, $updateapi, $insertapi, $findapi, $getapi, $empty, $errPhone, $resetNull, $snackbar } =
const { $find, $getdata, $patchapi, $insertapi, $findapi, $getapi, $empty, $errPhone, $resetNull, $snackbar } =
useNuxtApp();
const emit = defineEmits(["update", "dataevent"]);
var viewport = store.viewport;
@@ -271,7 +271,7 @@ async function update() {
record.value.updater = store.login.id;
record.update_time = new Date();
let rs = record.value.id
? await $updateapi("company", record.value)
? await $patchapi("company", record.value)
: await $insertapi("company", { data: record.value });
if (rs === "error") return;
if (!record.value.id) $snackbar(`Khách hàng đã được khởi tạo với mã <b>${rs.code}</b>`, "Success");

View File

@@ -120,7 +120,7 @@ const props = defineProps({
data: Object,
focus: Boolean,
});
const { $empty, $copy, $copyToClipboard, $stripHtml, $updateapi, $insertapi, $findIndex, $snackbar } = useNuxtApp();
const { $empty, $copy, $copyToClipboard, $stripHtml, $patchapi, $insertapi, $findIndex, $snackbar } = useNuxtApp();
const radioOption = ref();
const login = { id: 1 };
const errors = ref([]);
@@ -180,7 +180,7 @@ async function saveSetting() {
detail,
update_time: new Date(),
};
result = await $updateapi("usersetting", updatedSetting);
result = await $patchapi("usersetting", updatedSetting);
}
isLoading.value = false;
if (radioSave.value === "new") {

View File

@@ -45,7 +45,7 @@ export default {
if (this.setdeleted) {
let record = await this.$getdata(name, { first: true, filter: { id } });
record.deleted = 1;
result = await this.$updateapi(name, record);
result = await this.$patchapi(name, record);
} else result = await this.$deleteapi(name, id);
if (result === "error") return this.$dialog("Đã xảy ra lỗi, xóa dữ liệu thất bại", "Lỗi", "Error");
this.$snackbar("Dữ liệu đã được xoá khỏi hệ thống", "Success");

View File

@@ -45,7 +45,7 @@ export default {
},
methods: {
async save() {
let rs = await this.$updateapi("file", this.record);
let rs = await this.$patchapi("file", this.record);
},
},
};

View File

@@ -168,7 +168,7 @@ export default {
},
async saveData() {
if (!this.row) return this.insertData();
await this.$updateapi("importsetting", this.current, undefined, this.pagename);
await this.$patchapi("importsetting", this.current, undefined, this.pagename);
},
updateFromModel() {
let filter = this.$filter(this.pagedata2.data, {

View File

@@ -266,7 +266,7 @@ const store = useStore();
const {
$find,
$getdata,
$updateapi,
$patchapi,
$findapi,
$getapi,
$empty,
@@ -361,7 +361,7 @@ async function update() {
record.value.updater = store.login.id;
record.value.updater_time = new Date();
let rs = record.value.id
? await $updateapi("people", record.value)
? await $patchapi("people", record.value)
: await $insertapi("people", { data: record.value, notify: false });
if (rs === "error") return;
if (!record.value.id) $snackbar(`Người liên quan đã được khởi tạo với mã <b>${rs.code}</b>`, "Success");

View File

@@ -160,7 +160,7 @@ export default {
});
let rs0 = await this.$insertapi("gethash", { data: { text: this.password }, notify: false });
user.password = rs0.rows[0];
let rs = await this.$updateapi("user", user, undefined, false);
let rs = await this.$patchapi("user", user, undefined, false);
if (rs !== "error") {
this.currpass = undefined;
this.password = undefined;

View File

@@ -53,7 +53,7 @@ export default {
if (this.checkError()) return this.$snackbar("Mã phê duyệt gồm 4 số từ 0-9");
let user = await this.$getdata("user", { first: true, filter: { id: this.$store.state.login.id } });
user.approval_code = this.code;
await this.$updateapi("user", user);
await this.$patchapi("user", user);
},
checkError() {
if (Object.keys(this.data).length < 4) return true;

View File

@@ -110,7 +110,7 @@ export default {
});
let rs = await this.$insertapi("gethash", { data: { text: this.password } });
user.password = rs.rows[0];
let rs1 = await this.$updateapi("user", user);
let rs1 = await this.$patchapi("user", user);
if (rs1 !== "error") this.$emit("close");
else {
this.$snackbar("Có lỗi xảy ra. Hãy thử lại một lần nữa", "Error");