chore: install prettier
This commit is contained in:
@@ -13,18 +13,35 @@ export default defineNuxtPlugin(() => {
|
||||
];
|
||||
const path = paths.find((v) => v.name === mode).url;
|
||||
const apis = [
|
||||
{ name: 'sendemail', url: 'send-email/' },
|
||||
{ name: 'deleteentry', url: 'delete-entry/' },
|
||||
{ name: 'emailpreview', url: 'email-preview/' },
|
||||
{ name: 'workflow', url: 'workflow/execute/' },
|
||||
{ name: 'accountentry', url: 'account-entry/', params: {} },
|
||||
{ name: 'accountmultientry', url: 'account-multi-entry/', params: {} },
|
||||
{ name: 'entryfile', url: 'data/Entry_File/', url_detail: 'data-detail/Entry_File/', params: { values: 'id,file__file,file__name,file__caption,file,file__user__fullname,create_time' } },
|
||||
{ name: 'importsetting', url: 'data/Import_Setting/', url_detail: 'data-detail/Import_Setting/', params: {} },
|
||||
{ name: 'modelfields', url: 'model-fields/', params: {} },
|
||||
{ name: 'readexcel', url: 'read-excel/', params: {} },
|
||||
{ name: 'findkey', url: 'find-key/', params: {} },
|
||||
{ name: 'dealerrights', url: 'data/Biz_Rights/', url_detail: 'data-detail/Biz_Rights/', params: { sort: '-id' } },
|
||||
{ name: "sendemail", url: "send-email/" },
|
||||
{ name: "deleteentry", url: "delete-entry/" },
|
||||
{ name: "emailpreview", url: "email-preview/" },
|
||||
{ name: "workflow", url: "workflow/execute/" },
|
||||
{ name: "accountentry", url: "account-entry/", params: {} },
|
||||
{ name: "accountmultientry", url: "account-multi-entry/", params: {} },
|
||||
{
|
||||
name: "entryfile",
|
||||
url: "data/Entry_File/",
|
||||
url_detail: "data-detail/Entry_File/",
|
||||
params: {
|
||||
values: "id,file__file,file__name,file__caption,file,file__user__fullname,create_time",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "importsetting",
|
||||
url: "data/Import_Setting/",
|
||||
url_detail: "data-detail/Import_Setting/",
|
||||
params: {},
|
||||
},
|
||||
{ name: "modelfields", url: "model-fields/", params: {} },
|
||||
{ name: "readexcel", url: "read-excel/", params: {} },
|
||||
{ name: "findkey", url: "find-key/", params: {} },
|
||||
{
|
||||
name: "dealerrights",
|
||||
url: "data/Biz_Rights/",
|
||||
url_detail: "data-detail/Biz_Rights/",
|
||||
params: { sort: "-id" },
|
||||
},
|
||||
{
|
||||
name: "individual",
|
||||
url: "data/Individual/",
|
||||
@@ -39,8 +56,9 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Transaction_Discount/",
|
||||
url_detail: "data-detail/Transaction_Discount/",
|
||||
params: {
|
||||
values: "id,transaction,discount,discount__code,discount__name,type,type__code,type__name,value,create_time,update_time"
|
||||
}
|
||||
values:
|
||||
"id,transaction,discount,discount__code,discount__name,type,type__code,type__name,value,create_time,update_time",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "organization",
|
||||
@@ -56,8 +74,8 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Co_Ownership/",
|
||||
url_detail: "data-detail/Co_Ownership/",
|
||||
params: {
|
||||
values: 'id,transaction,people,people__code,people__fullname,people__phone,people__legal_code'
|
||||
}
|
||||
values: "id,transaction,people,people__code,people__fullname,people__phone,people__legal_code",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "companytype",
|
||||
@@ -71,18 +89,18 @@ export default defineNuxtPlugin(() => {
|
||||
name: "cart",
|
||||
url: "data/Cart/",
|
||||
url_detail: "data-detail/Cart/",
|
||||
commit: 'cart',
|
||||
commit: "cart",
|
||||
params: {
|
||||
sort: "id",
|
||||
values: "id,code,name,dealer,dealer__code,dealer__name,create_time",
|
||||
distinct_values: {
|
||||
label: {
|
||||
type: "Concat",
|
||||
field: ["code", "name"]
|
||||
}
|
||||
field: ["code", "name"],
|
||||
},
|
||||
},
|
||||
summary: "annotate",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "payment_schedule",
|
||||
@@ -91,7 +109,7 @@ export default defineNuxtPlugin(() => {
|
||||
params: {
|
||||
sort: "-id",
|
||||
values:
|
||||
"batch_date,amount_remain,penalty_remain,penalty_paid,penalty_amount,penalty_reduce,ovd_days,remain_amount,paid_amount,txn_detail__transaction__product__trade_code,txn_detail__status,txn_detail__transaction__product__code,txn_detail__phase__name,txn_detail,id,txn_detail__transaction__customer__fullname,txn_detail__transaction__customer__code,txn_detail__transaction__customer__legal_code,status__name,type__name,code,from_date,txn_detail__transaction__policy__code,to_date,amount,cycle,cycle_days,txn_detail__transaction,type,status,updater,entry,detail,txn_detail__transaction__code,txn_detail__code"
|
||||
"batch_date,amount_remain,penalty_remain,penalty_paid,penalty_amount,penalty_reduce,ovd_days,remain_amount,paid_amount,txn_detail__transaction__product__trade_code,txn_detail__status,txn_detail__transaction__product__code,txn_detail__phase__name,txn_detail,id,txn_detail__transaction__customer__fullname,txn_detail__transaction__customer__code,txn_detail__transaction__customer__legal_code,status__name,type__name,code,from_date,txn_detail__transaction__policy__code,to_date,amount,cycle,cycle_days,txn_detail__transaction,type,status,updater,entry,detail,txn_detail__transaction__code,txn_detail__code",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -109,22 +127,78 @@ export default defineNuxtPlugin(() => {
|
||||
summary: "annotate",
|
||||
},
|
||||
},
|
||||
{ name: 'productnote', url: 'data/Product_Note/', url_detail: 'data-detail/Product_Note/', commit: 'productnote', params: {sort: 'id',values: 'id,detail,user,user__username,user__fullname,create_time,update_time,ref,ref__cart__dealer,ref__trade_code' } },
|
||||
{
|
||||
name:"customernote",
|
||||
{
|
||||
name: "productnote",
|
||||
url: "data/Product_Note/",
|
||||
url_detail: "data-detail/Product_Note/",
|
||||
commit: "productnote",
|
||||
params: {
|
||||
sort: "id",
|
||||
values:
|
||||
"id,detail,user,user__username,user__fullname,create_time,update_time,ref,ref__cart__dealer,ref__trade_code",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "customernote",
|
||||
url: "data/Customer_Note/",
|
||||
url_detail: "data-detail/Customer_Note/",
|
||||
params: {
|
||||
values: 'id,ref,detail,user,create_time,update_time'
|
||||
}
|
||||
values: "id,ref,detail,user,create_time,update_time",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "entrytype",
|
||||
url: "data/Entry_Type/",
|
||||
url_detail: "data-detail/Entry_Type/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "entrycategory",
|
||||
url: "data/Entry_Category/",
|
||||
url_detail: "data-detail/Entry_Category/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "accounttype",
|
||||
url: "data/Account_Type/",
|
||||
url_detail: "data-detail/Account_Type/",
|
||||
params: { sort: "id" },
|
||||
},
|
||||
{
|
||||
name: "internalaccount",
|
||||
url: "data/Internal_Account/",
|
||||
url_detail: "data-detail/Internal_Account/",
|
||||
params: {
|
||||
sort: "branch,currency,type",
|
||||
values:
|
||||
"id,currency,currency__code,currency__name,code,balance,create_time,update_time,type,type__code,type__name,branch,branch__code,branch__name",
|
||||
distinct_values: {
|
||||
label: {
|
||||
type: "Concat",
|
||||
field: ["branch__name", "code", "type__name"],
|
||||
},
|
||||
},
|
||||
summary: "annotate",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "currency",
|
||||
url: "data/Currency/",
|
||||
url_detail: "data-detail/Currency/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "approvestatus",
|
||||
url: "data/Approve_Status/",
|
||||
url_detail: "data-detail/Approve_Status/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "bizrights",
|
||||
url: "data/Biz_Rights/",
|
||||
url_detail: "data-detail/Biz_Rights/",
|
||||
params: { sort: "-id" },
|
||||
},
|
||||
{ name: 'entrytype', url: 'data/Entry_Type/', url_detail: 'data-detail/Entry_Type/', params: {} },
|
||||
{ name: 'entrycategory', url: 'data/Entry_Category/', url_detail: 'data-detail/Entry_Category/', params: {} },
|
||||
{ name: 'accounttype', url: 'data/Account_Type/', url_detail: 'data-detail/Account_Type/', params: { sort: 'id' } },
|
||||
{ name: 'internalaccount', url: 'data/Internal_Account/', url_detail: 'data-detail/Internal_Account/', params: { sort: 'branch,currency,type', values: 'id,currency,currency__code,currency__name,code,balance,create_time,update_time,type,type__code,type__name,branch,branch__code,branch__name', distinct_values: { label: { type: 'Concat', field: ['branch__name', 'code', 'type__name'] } }, summary: 'annotate' } },
|
||||
{ name: "currency", url: "data/Currency/", url_detail: "data-detail/Currency/", params: {} },
|
||||
{ name: "approvestatus", url: "data/Approve_Status/", url_detail: "data-detail/Approve_Status/", params: {} },
|
||||
{ name: 'bizrights', url: 'data/Biz_Rights/', url_detail: 'data-detail/Biz_Rights/', params: { sort: '-id' } },
|
||||
{
|
||||
name: "feetype",
|
||||
url: "data/Fee_Type/",
|
||||
@@ -194,9 +268,24 @@ export default defineNuxtPlugin(() => {
|
||||
values: "id,code,name,create_time",
|
||||
},
|
||||
},
|
||||
{ name: "image", url: "data/Image/", url_detail: "data-detail/Image/", params: {} },
|
||||
{ name: "file", url: "data/File/", url_detail: "data-detail/File/", params: {} },
|
||||
{ name: "filetype", url: "data/File_Type/", url_detail: "data-detail/File_Type/", params: {} },
|
||||
{
|
||||
name: "image",
|
||||
url: "data/Image/",
|
||||
url_detail: "data-detail/Image/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "file",
|
||||
url: "data/File/",
|
||||
url_detail: "data-detail/File/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "filetype",
|
||||
url: "data/File_Type/",
|
||||
url_detail: "data-detail/File_Type/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "news",
|
||||
commit: "updateNews",
|
||||
@@ -216,7 +305,7 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Contract/",
|
||||
url_detail: "data-detail/Contract/",
|
||||
params: {
|
||||
sort: "-id"
|
||||
sort: "-id",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -270,24 +359,64 @@ export default defineNuxtPlugin(() => {
|
||||
values: "id,code,name,en,index,create_time",
|
||||
},
|
||||
},
|
||||
{ name: "paymentmethod", url: "data/Payment_Method/", url_detail: "data-detail/Payment_Method/", params: {} },
|
||||
{ name: "salepolicy", url: "data/Sale_Policy/", url_detail: "data-detail/Sale_Policy/", params: { values: "id,code,name,deposit,method,method__code,method__name,create_time,enable,contract_allocation_percentage,create_time,update_time,index", sort: "index" } },
|
||||
{
|
||||
name: "paymentmethod",
|
||||
url: "data/Payment_Method/",
|
||||
url_detail: "data-detail/Payment_Method/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "salepolicy",
|
||||
url: "data/Sale_Policy/",
|
||||
url_detail: "data-detail/Sale_Policy/",
|
||||
params: {
|
||||
values:
|
||||
"id,code,name,deposit,method,method__code,method__name,create_time,enable,contract_allocation_percentage,create_time,update_time,index",
|
||||
sort: "index",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "paymentplan",
|
||||
url: "data/Payment_Plan/",
|
||||
url_detail: "data-detail/Payment_Plan/",
|
||||
params: {
|
||||
values: "policy__enable,id,policy,policy__code,policy__name,cycle,value,type,days,payment_note,due_note,create_time,update_time",
|
||||
sort: "cycle"
|
||||
values:
|
||||
"policy__enable,id,policy,policy__code,policy__name,cycle,value,type,days,payment_note,due_note,create_time,update_time",
|
||||
sort: "cycle",
|
||||
},
|
||||
},
|
||||
{ name: "request", url: "data/Request/", url_detail: "data-detail/Request/", params: {} },
|
||||
{ name: "register", url: "data/Register/", url_detail: "data-detail/Register/", params: {} },
|
||||
{
|
||||
name: "request",
|
||||
url: "data/Request/",
|
||||
url_detail: "data-detail/Request/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "register",
|
||||
url: "data/Register/",
|
||||
url_detail: "data-detail/Register/",
|
||||
params: {},
|
||||
},
|
||||
{ name: "sendemail", url: "send-email/", path: "etl", params: {} },
|
||||
{ name: "sendemailnow", url: "send-email-now/", path: "etl", params: {} },
|
||||
{ name: "usersession", url: "data/User_Session/", url_detail: "data-detail/User_Session/", params: {} },
|
||||
{ name: "userlog", url: "data/User_Log/", url_detail: "data-detail/User_Log/", params: {} },
|
||||
{ name: "usersetting", url: "data/User_Setting/", url_detail: "data-detail/User_Setting/", params: {} },
|
||||
{
|
||||
name: "usersession",
|
||||
url: "data/User_Session/",
|
||||
url_detail: "data-detail/User_Session/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "userlog",
|
||||
url: "data/User_Log/",
|
||||
url_detail: "data-detail/User_Log/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "usersetting",
|
||||
url: "data/User_Setting/",
|
||||
url_detail: "data-detail/User_Setting/",
|
||||
params: {},
|
||||
},
|
||||
{ name: "account-entry", url: "/account-entry/", params: {} },
|
||||
{
|
||||
name: "valuetype",
|
||||
@@ -295,7 +424,7 @@ export default defineNuxtPlugin(() => {
|
||||
url_detail: "data-detail/Value_Type/",
|
||||
params: {
|
||||
values: "id,code,name,en,index,create_time",
|
||||
sort: "index"
|
||||
sort: "index",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -311,7 +440,7 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Discount_Type/",
|
||||
url_detail: "data-detail/Discount_Type/",
|
||||
params: {
|
||||
values: 'id,code,name,value,type,type__name,method,method__name',
|
||||
values: "id,code,name,value,type,type__name,method,method__name",
|
||||
distinct_values: {
|
||||
label: { type: "Concat", field: ["code", "name", "type__name"] },
|
||||
},
|
||||
@@ -326,14 +455,53 @@ export default defineNuxtPlugin(() => {
|
||||
values:
|
||||
"id,update_time,creator,creator__fullname,country,country__name,country__en,issued_date,issued_place,issued_place__name,code,email,fullname,legal_code,phone,legal_type,legal_type__name,address,contact_address,note,type,type__name,updater,updater__fullname,create_time,update_time",
|
||||
distinct_values: {
|
||||
label: { type: "Concat", field: ["code", "fullname", "phone", "legal_code"] },
|
||||
label: {
|
||||
type: "Concat",
|
||||
field: ["code", "fullname", "phone", "legal_code"],
|
||||
},
|
||||
order: { type: "RowNumber" },
|
||||
image_count: { type: "Count", field: "id", subquery: { model: "Customer_File", column: "ref" } },
|
||||
count_note: { type: "Count", field: "id", subquery: { model: "Customer_Note", column: "ref" } },
|
||||
count_product: { type: "Count", field: "id", subquery: { model: "Product_Booked", column: "transaction__customer" } },
|
||||
sum_product: { type: "Sum", field: "transaction__sale_price", subquery: { model: "Product_Booked", column: "transaction__customer" } },
|
||||
sum_receiver: { type: "Sum", field: "transaction__amount_received", subquery: { model: "Product_Booked", column: "transaction__customer" } },
|
||||
sum_remain: { type: "Sum", field: "transaction__amount_remain", subquery: { model: "Product_Booked", column: "transaction__customer" } }
|
||||
image_count: {
|
||||
type: "Count",
|
||||
field: "id",
|
||||
subquery: { model: "Customer_File", column: "ref" },
|
||||
},
|
||||
count_note: {
|
||||
type: "Count",
|
||||
field: "id",
|
||||
subquery: { model: "Customer_Note", column: "ref" },
|
||||
},
|
||||
count_product: {
|
||||
type: "Count",
|
||||
field: "id",
|
||||
subquery: {
|
||||
model: "Product_Booked",
|
||||
column: "transaction__customer",
|
||||
},
|
||||
},
|
||||
sum_product: {
|
||||
type: "Sum",
|
||||
field: "transaction__sale_price",
|
||||
subquery: {
|
||||
model: "Product_Booked",
|
||||
column: "transaction__customer",
|
||||
},
|
||||
},
|
||||
sum_receiver: {
|
||||
type: "Sum",
|
||||
field: "transaction__amount_received",
|
||||
subquery: {
|
||||
model: "Product_Booked",
|
||||
column: "transaction__customer",
|
||||
},
|
||||
},
|
||||
sum_remain: {
|
||||
type: "Sum",
|
||||
field: "transaction__amount_remain",
|
||||
subquery: {
|
||||
model: "Product_Booked",
|
||||
column: "transaction__customer",
|
||||
},
|
||||
},
|
||||
},
|
||||
summary: "annotate",
|
||||
filter: { deleted: 0 },
|
||||
@@ -346,9 +514,10 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Transaction/",
|
||||
url_detail: "data-detail/Transaction/",
|
||||
params: {
|
||||
sort: '-date',
|
||||
values: "date,txncurrent__detail,txncurrent__detail__status,customer__type,txncurrent,txncurrent__detail__amount,txncurrent__detail__amount_remaining,txncurrent__detail__status__name,product__zone_type__name,product__trade_code,product__cart__dealer,customer__legal_code,customer__legal_type__name,payment_plan,id,code,customer,customer__code,customer__fullname,customer__phone,product,phase,phase__name,phase__code,policy,policy__code,policy__name,origin_price,discount_amount,sale_price,deposit_amount,deposit_received,deposit_remaining,amount_received,amount_remain,create_time,update_time"
|
||||
}
|
||||
sort: "-date",
|
||||
values:
|
||||
"date,txncurrent__detail,txncurrent__detail__status,customer__type,txncurrent,txncurrent__detail__amount,txncurrent__detail__amount_remaining,txncurrent__detail__status__name,product__zone_type__name,product__trade_code,product__cart__dealer,customer__legal_code,customer__legal_type__name,payment_plan,id,code,customer,customer__code,customer__fullname,customer__phone,product,phase,phase__name,phase__code,policy,policy__code,policy__name,origin_price,discount_amount,sale_price,deposit_amount,deposit_received,deposit_remaining,amount_received,amount_remain,create_time,update_time",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "transactionphase",
|
||||
@@ -364,8 +533,8 @@ export default defineNuxtPlugin(() => {
|
||||
url_detail: "data-detail/Phase_Doctype/",
|
||||
params: {
|
||||
values: "id,phase,doctype,doctype__code,doctype__name",
|
||||
sort:"doctype__index"
|
||||
}
|
||||
sort: "doctype__index",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "transactiontype",
|
||||
@@ -381,7 +550,8 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Transaction_Detail/",
|
||||
url_detail: "data-detail/Transaction_Detail/",
|
||||
params: {
|
||||
values: "id,code,date,amount,amount_received,amount_remaining,phase,due_date,transaction,creator,status,approver,approve_time,create_time,update_time",
|
||||
values:
|
||||
"id,code,date,amount,amount_received,amount_remaining,phase,due_date,transaction,creator,status,approver,approve_time,create_time,update_time",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -398,8 +568,7 @@ export default defineNuxtPlugin(() => {
|
||||
commit: "productbooked",
|
||||
url: "data/Product_Booked/",
|
||||
url_detail: "data-detail/Product_Booked/",
|
||||
params: {
|
||||
},
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "product",
|
||||
@@ -411,8 +580,11 @@ export default defineNuxtPlugin(() => {
|
||||
values:
|
||||
"prdbk__transaction__amount_remain,prdbk__transaction,price_excluding_vat,prdbk__transaction__txncurrent__detail__status__name,locked_until,note,cart,cart__name,cart__code,cart__dealer,cart__dealer__code,cart__dealer__name,direction,type,zone_type,dealer,link,type__name,dealer__code,dealer__name,prdbk,prdbk__transaction__customer,prdbk__transaction,prdbk__transaction__policy__code,prdbk__transaction__sale_price,prdbk__transaction__discount_amount,prdbk__transaction__code,prdbk__transaction__customer__code,prdbk__transaction__customer__phone,prdbk__transaction__customer__fullname,prdbk__transaction__customer__legal_code,id,code,trade_code,land_lot_code,zone_code,zone_type__name,lot_area,building_area,total_built_area,number_of_floors,land_lot_size,origin_price,direction__name,villa_model,product_type,template_name,project,project__name,status,status__code,status__name,status__color,status__sale_status,status__sale_status__color,create_time,prdbk__transaction__amount_received",
|
||||
distinct_values: {
|
||||
label: { type: "Concat", field: ["trade_code", "type__name", "land_lot_size", "zone_type__name", "status__name"] },
|
||||
count_note: { type: 'Count', field: 'prdnote' }
|
||||
label: {
|
||||
type: "Concat",
|
||||
field: ["trade_code", "type__name", "land_lot_size", "zone_type__name", "status__name"],
|
||||
},
|
||||
count_note: { type: "Count", field: "prdnote" },
|
||||
},
|
||||
summary: "annotate",
|
||||
},
|
||||
@@ -491,7 +663,9 @@ export default defineNuxtPlugin(() => {
|
||||
sort: "-id",
|
||||
values:
|
||||
"id,auth_method__code,blocked,auth_status__code,username,register_method__code,fullname,type,type__code,type__name,create_time,create_time__date,auth_method,auth_status,register_method,create_time,update_time",
|
||||
distinct_values: { label: { type: "Concat", field: ["username", "fullname"] } },
|
||||
distinct_values: {
|
||||
label: { type: "Concat", field: ["username", "fullname"] },
|
||||
},
|
||||
summary: "annotate",
|
||||
},
|
||||
},
|
||||
@@ -616,8 +790,20 @@ export default defineNuxtPlugin(() => {
|
||||
url_detail: "data-detail/Legal_Type/",
|
||||
params: { page: -1 },
|
||||
},
|
||||
{ name: "sex", commit: "sex", url: "data/Sex/", url_detail: "data-detail/Sex/", params: {} },
|
||||
{ name: "usertype", commit: "UserType", url: "data/User_Type/", url_detail: "data-detail/User_Type/", params: {} },
|
||||
{
|
||||
name: "sex",
|
||||
commit: "sex",
|
||||
url: "data/Sex/",
|
||||
url_detail: "data-detail/Sex/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "usertype",
|
||||
commit: "UserType",
|
||||
url: "data/User_Type/",
|
||||
url_detail: "data-detail/User_Type/",
|
||||
params: {},
|
||||
},
|
||||
|
||||
{
|
||||
name: "executionmethod",
|
||||
@@ -702,8 +888,18 @@ export default defineNuxtPlugin(() => {
|
||||
"id,country,website,email,code,phone,shortname,fullname,address,create_time,update_time,creator,creator__fullname,updater,updater__fullname",
|
||||
},
|
||||
},
|
||||
{ name: "exportlog", url: "data/Export_Log/", url_detail: "data-detail/Export_Log/", params: {} },
|
||||
{ name: "bank", url: "data/Bank/", url_detail: "data-detail/Bank/", params: {} },
|
||||
{
|
||||
name: "exportlog",
|
||||
url: "data/Export_Log/",
|
||||
url_detail: "data-detail/Export_Log/",
|
||||
params: {},
|
||||
},
|
||||
{
|
||||
name: "bank",
|
||||
url: "data/Bank/",
|
||||
url_detail: "data-detail/Bank/",
|
||||
params: {},
|
||||
},
|
||||
{ name: "exportcsv", url: "exportcsv/", params: {} },
|
||||
{
|
||||
name: "internalentry",
|
||||
@@ -750,13 +946,16 @@ export default defineNuxtPlugin(() => {
|
||||
name: "dealer",
|
||||
url: "data/Dealer/",
|
||||
url_detail: "data-detail/Dealer/",
|
||||
params: { values: "id,count_sale,code,name,phone,address,email,create_time,sale_amount,pay_sale,commission_amount,pay_commission,commission_remain,batch_date" },
|
||||
params: {
|
||||
values:
|
||||
"id,count_sale,code,name,phone,address,email,create_time,sale_amount,pay_sale,commission_amount,pay_commission,commission_remain,batch_date",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "layersetting",
|
||||
url: "data/Layer_Setting/",
|
||||
url_detail: "data-detail/Layer_Setting/",
|
||||
params: { values: "id,code,name,detail,user,create_time,update_time" }
|
||||
params: { values: "id,code,name,detail,user,create_time,update_time" },
|
||||
},
|
||||
{
|
||||
name: "grouprights",
|
||||
@@ -764,29 +963,29 @@ export default defineNuxtPlugin(() => {
|
||||
url: "data/Group_Rights/",
|
||||
url_detail: "data-detail/Group_Rights/",
|
||||
params: {
|
||||
values: 'id,setting,setting__vi,setting__code,setting__category,group,group__name,is_edit,create_time',
|
||||
sort: '-id'
|
||||
values: "id,setting,setting__vi,setting__code,setting__category,group,group__name,is_edit,create_time",
|
||||
sort: "-id",
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
name: "discountmethod",
|
||||
commit: "discountmethod",
|
||||
url: "data/Discount_Method/",
|
||||
url_detail: "data-detail/Discount_Method/",
|
||||
params: {sort: '-id'},
|
||||
params: { sort: "-id" },
|
||||
},
|
||||
{
|
||||
name: "emailtemplate",
|
||||
url: "data/Email_Template/",
|
||||
url_detail: "data-detail/Email_Template/",
|
||||
params: { values: "id,name,content,create_time,update_time" }
|
||||
{
|
||||
name: "emailtemplate",
|
||||
url: "data/Email_Template/",
|
||||
url_detail: "data-detail/Email_Template/",
|
||||
params: { values: "id,name,content,create_time,update_time" },
|
||||
},
|
||||
{
|
||||
name: "gift",
|
||||
commit: "gift",
|
||||
url: "data/Gift/",
|
||||
url_detail: "data-detail/Gift/",
|
||||
params: {sort: '-id'},
|
||||
params: { sort: "-id" },
|
||||
},
|
||||
{
|
||||
name: "transactiongift",
|
||||
@@ -869,7 +1068,10 @@ export default defineNuxtPlugin(() => {
|
||||
let found = findapi(name);
|
||||
let curpath = found.path ? paths.find((x) => x.name === found.path).url : path;
|
||||
var rs;
|
||||
if (!Array.isArray(data)) rs = await axios.post(`${curpath}${found.url}`, data, { params: { values: values } });
|
||||
if (!Array.isArray(data))
|
||||
rs = await axios.post(`${curpath}${found.url}`, data, {
|
||||
params: { values: values },
|
||||
});
|
||||
else {
|
||||
let params = { action: "import", values: values };
|
||||
rs = await axios.post(`${curpath}import-data/${found.url.substring(5, found.url.length - 1)}/`, data, {
|
||||
@@ -1051,7 +1253,7 @@ export default defineNuxtPlugin(() => {
|
||||
return;
|
||||
}
|
||||
|
||||
const urlParts = apiConfig.url.split('/').filter(p => p);
|
||||
const urlParts = apiConfig.url.split("/").filter((p) => p);
|
||||
// Capitalize the model name for the backend consumer
|
||||
const modelName = urlParts.length > 1 ? urlParts[1].charAt(0).toUpperCase() + urlParts[1].slice(1) : null;
|
||||
|
||||
@@ -1063,7 +1265,7 @@ export default defineNuxtPlugin(() => {
|
||||
const params = $clone(apiConfig.params) || {};
|
||||
|
||||
// List of parameters that need to be stringified if they are objects
|
||||
const paramsToJSONify = ['filter_or', 'exclude', 'distinct_values', 'calculation', 'final_filter', 'final_exclude'];
|
||||
const paramsToJSONify = ["filter_or", "exclude", "distinct_values", "calculation", "final_filter", "final_exclude"];
|
||||
|
||||
// Apply the filter passed to subscribe function
|
||||
if (filter) {
|
||||
@@ -1072,14 +1274,14 @@ export default defineNuxtPlugin(() => {
|
||||
|
||||
// Stringify other dictionary-like parameters if they exist and are objects
|
||||
for (const key of paramsToJSONify) {
|
||||
if (params[key] && typeof params[key] === 'object' && !Array.isArray(params[key])) {
|
||||
if (params[key] && typeof params[key] === "object" && !Array.isArray(params[key])) {
|
||||
params[key] = JSON.stringify(params[key]);
|
||||
}
|
||||
}
|
||||
|
||||
const payload = {
|
||||
name: modelName,
|
||||
params: params
|
||||
params: params,
|
||||
};
|
||||
|
||||
subscribeToData(payload, callback);
|
||||
@@ -1120,7 +1322,10 @@ export default defineNuxtPlugin(() => {
|
||||
try {
|
||||
var rs;
|
||||
let found = findapi(name);
|
||||
if (!Array.isArray(id)) rs = await $fetch(`${path}${found.url_detail}${id}`, { method: "delete" });
|
||||
if (!Array.isArray(id))
|
||||
rs = await $fetch(`${path}${found.url_detail}${id}`, {
|
||||
method: "delete",
|
||||
});
|
||||
else {
|
||||
let params = { action: "delete" };
|
||||
rs = await $fetch(`${path}import-data/${found.url.substring(5, found.url.length - 1)}/`, id, {
|
||||
@@ -1183,12 +1388,12 @@ export default defineNuxtPlugin(() => {
|
||||
};
|
||||
|
||||
const buildFileUrl = (file) => {
|
||||
if (!file || typeof file !== 'string') {
|
||||
console.error(`Invalid file__file: ${file}`)
|
||||
return;
|
||||
if (!file || typeof file !== "string") {
|
||||
console.error(`Invalid file__file: ${file}`);
|
||||
return;
|
||||
}
|
||||
return `${getpath()}static/files/${encodeURIComponent(file)}`;
|
||||
}
|
||||
};
|
||||
|
||||
const generateDocument = async (params) => {
|
||||
const apiBaseUrl = path;
|
||||
@@ -1215,7 +1420,10 @@ export default defineNuxtPlugin(() => {
|
||||
return { success: true, pdfUrl: pdfUrl, data: response };
|
||||
} else {
|
||||
console.error("generateDocument: Định dạng phản hồi API không hợp lệ.", response);
|
||||
return { success: false, error: "Định dạng phản hồi API không hợp lệ." };
|
||||
return {
|
||||
success: false,
|
||||
error: "Định dạng phản hồi API không hợp lệ.",
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Lỗi khi tạo tài liệu:", error);
|
||||
@@ -1239,14 +1447,17 @@ export default defineNuxtPlugin(() => {
|
||||
return { success: true, data: response };
|
||||
} else {
|
||||
console.error("Định dạng phản hồi API không hợp lệ.", response);
|
||||
return { success: false, error: "Định dạng phản hồi API không hợp lệ." };
|
||||
return {
|
||||
success: false,
|
||||
error: "Định dạng phản hồi API không hợp lệ.",
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Lỗi khi tạo accountEntry:", error);
|
||||
return { success: false, error: error.data?.message || error.message };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {'edit' | 'view'} right
|
||||
* @param {{ code?: string, category?: string }} options
|
||||
@@ -1255,36 +1466,38 @@ export default defineNuxtPlugin(() => {
|
||||
* - If not passed, returns edit rights for current tab & subtab
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const getEditRights = (right = 'edit', { code, category } = {}) => {
|
||||
if (!['edit', 'view'].includes(right)) throw new Error(`right ${right} is not one of ['edit', 'view']`);
|
||||
|
||||
const getEditRights = (right = "edit", { code, category } = {}) => {
|
||||
if (!["edit", "view"].includes(right)) throw new Error(`right ${right} is not one of ['edit', 'view']`);
|
||||
|
||||
const getRight = (rightObj) => {
|
||||
return right === 'edit' ? rightObj && rightObj.is_edit : Boolean(rightObj);
|
||||
}
|
||||
return right === "edit" ? rightObj && rightObj.is_edit : Boolean(rightObj);
|
||||
};
|
||||
|
||||
if (store.rights.length === 0) return true; // full rights
|
||||
|
||||
if (code && category) {
|
||||
// if passed, must pass both
|
||||
const foundRight = store.rights.find(({ setting__category, setting__code }) => setting__category === category && setting__code === code);
|
||||
const foundRight = store.rights.find(
|
||||
({ setting__category, setting__code }) => setting__category === category && setting__code === code,
|
||||
);
|
||||
return getRight(foundRight);
|
||||
} else {
|
||||
const { tab, subtab } = store.tabinfo;
|
||||
let isTabEdit;
|
||||
let isSubTabEdit;
|
||||
|
||||
const tabRight = store.rights.find(rights => rights.setting === tab.id);
|
||||
const tabRight = store.rights.find((rights) => rights.setting === tab.id);
|
||||
isTabEdit = getRight(tabRight);
|
||||
|
||||
if (!subtab) isSubTabEdit = false;
|
||||
else {
|
||||
const subTabRight = store.rights.find(rights => rights.setting === subtab.id);
|
||||
const subTabRight = store.rights.find((rights) => rights.setting === subtab.id);
|
||||
isSubTabEdit = getRight(subTabRight);
|
||||
}
|
||||
|
||||
return isTabEdit || isSubTabEdit;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// --- WebSocket Integration ---
|
||||
let socket = null;
|
||||
@@ -1298,7 +1511,7 @@ export default defineNuxtPlugin(() => {
|
||||
// Use wss for https, ws for http
|
||||
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "wss:";
|
||||
// Construct base URL without http/https protocol
|
||||
const baseUrl = path.replace(/^https?:\/\//, '');
|
||||
const baseUrl = path.replace(/^https?:\/\//, "");
|
||||
const wsUrl = `${wsProtocol}//${baseUrl}ws/data/`;
|
||||
|
||||
socket = new WebSocket(wsUrl);
|
||||
@@ -1311,14 +1524,14 @@ export default defineNuxtPlugin(() => {
|
||||
const response = JSON.parse(event.data);
|
||||
|
||||
// Handle initial subscription responses with specific callbacks
|
||||
if (response.type === 'subscription_response' && response.request_id && requests[response.request_id]) {
|
||||
if (response.type === "subscription_response" && response.request_id && requests[response.request_id]) {
|
||||
const callback = requests[response.request_id];
|
||||
callback(response.data);
|
||||
delete requests[response.request_id]; // Clean up callback after use
|
||||
} else {
|
||||
// For all other messages (like realtime_update), dispatch a global event
|
||||
// This decouples the plugin from the store logic
|
||||
window.dispatchEvent(new CustomEvent('ws_message', { detail: response }));
|
||||
window.dispatchEvent(new CustomEvent("ws_message", { detail: response }));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1351,11 +1564,11 @@ export default defineNuxtPlugin(() => {
|
||||
const request = {
|
||||
action: "subscribe",
|
||||
request_id: requestId,
|
||||
payload: payload
|
||||
payload: payload,
|
||||
};
|
||||
|
||||
socket.send(JSON.stringify(request));
|
||||
console.log('[WebSocket] Sent subscription request:', request);
|
||||
console.log("[WebSocket] Sent subscription request:", request);
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user