Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quasar-web-base
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Hải Sơn
quasar-web-base
Commits
5186da20
Commit
5186da20
authored
Nov 05, 2022
by
Nguyễn Đức Thắng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
284fd984
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
83 deletions
+124
-83
functions.ts
src/boot/functions.ts
+22
-1
index.vue
src/components/configSystem/index.vue
+42
-25
AddNewCustomerDialog.ts
.../customer/add-new-customer-dialog/AddNewCustomerDialog.ts
+52
-49
index.ts
src/i18n/vi/index.ts
+8
-8
No files found.
src/boot/functions.ts
View file @
5186da20
...
...
@@ -7,4 +7,25 @@ const isMobilePhone = (str: string) => {
const
phone84
=
/^
[
84
]{2}[
0-9
]{9,11}
$/
;
return
phoneNot84
.
test
(
str
)
||
phone84
.
test
(
str
);
};
export
{
isEmail
,
isMobilePhone
};
const
isUserName
=
(
str
:
string
)
=>
{
const
userName
=
/^
\w
+$/
;
return
userName
.
test
(
str
);
}
const
isHasVietnamese
=
(
str
:
string
)
=>
{
const
vn
=
'àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ'
const
strLower
=
str
.
toLowerCase
()
let
isOK
=
false
for
(
let
i
=
0
;
i
<
strLower
.
length
;
i
++
)
{
if
(
vn
.
indexOf
(
strLower
[
i
])
>=
0
)
{
isOK
=
true
break
}
}
return
isOK
}
export
{
isEmail
,
isMobilePhone
,
isUserName
,
isHasVietnamese
};
src/components/configSystem/index.vue
View file @
5186da20
...
...
@@ -131,7 +131,16 @@
toolbar-toggle-color=
"yellow-8"
toolbar-bg=
"primary"
:spellcheck=
"false"
:definitions=
"
{
upload: {
tip: 'Upload to cloud',
icon: 'cloud_upload',
label: 'Upload',
handler: selectedFile,
},
}"
:toolbar="[
['upload'],
[
{
label: $q.lang.editor.align,
...
...
@@ -149,6 +158,7 @@
'subscript',
'superscript',
],
['token', 'hr', 'link', 'custom_btn'],
['print', 'fullscreen'],
[
...
...
@@ -217,7 +227,9 @@
times_new_roman: 'Times New Roman',
verdana: 'Verdana',
}"
/>
>
</q-editor>
<!--
<q-tabs
v-model=
"tabContent"
dense
...
...
@@ -381,29 +393,30 @@ export default defineComponent({
required
:
true
,
},
isUpdate
:
{
type
:
Boolean
,
default
:
false
},
image
:
{
type
:
String
,
required
:
true
},
namePage
:
{
type
:
String
,
required
:
true
},
url
:
{
type
:
String
,
required
:
true
},
numIndex
:
{
type
:
String
,
required
:
true
},
content
:
{
type
:
String
,
required
:
true
},
nameMenu
:
{
type
:
Array
,
required
:
true
},
nameMenuOptions
:
{
type
:
Array
,
required
:
true
},
languageOptions
:
{
type
:
Array
as
PropType
<
{
namePage
:
string
;
url
:
string
;
content
:
string
;
numIndex
:
number
;
nameMenu
:
[];
language
:
{
id
:
number
;
code
:
string
;
name
:
string
;
};
}[]
>
,
required
:
true
,
},
languageOptions
:
{
type
:
Array
as
PropType
<
{
namePage
:
string
;
url
:
string
;
content
:
string
;
numIndex
:
number
;
nameMenu
:
[];
language
:
{
id
:
number
;
code
:
string
;
name
:
string
;
};
}[]
>
,
required
:
true
,
},
},
setup
()
{
const
namePageRules
=
[
...
...
@@ -416,14 +429,10 @@ export default defineComponent({
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'listConfigSystem.validateMessages.requireUrl'
),
];
// const nameMenuRules = [
// (val?: Array
<
unknown
>
)
=>
// val?.length ||
// i18n.global.t('listConfigSystem.validateMessages.requireNameMenu'),
// ];
// const tabNamePage = ref('vi');
// const tabContent = ref('vi');
return
{
namePageRules
,
urlRules
,
// nameMenuRules,
...
...
@@ -431,6 +440,13 @@ export default defineComponent({
// tabContent,
};
},
methods
:
{
selectedFile
(
file
:
File
)
{
const
upload
=
URL
.
createObjectURL
(
file
);
console
.
log
(
upload
,
'upload'
);
},
},
emits
:
[
'update:isOpened'
,
'update:namePage'
,
...
...
@@ -438,6 +454,7 @@ export default defineComponent({
'update:numIndex'
,
'update:nameMenu'
,
'update:url'
,
'SetAvatar'
,
'click:CloseBtn'
,
'addUpdateConfigSystem'
,
],
...
...
src/components/customer/add-new-customer-dialog/AddNewCustomerDialog.ts
View file @
5186da20
import
{
defineComponent
,
PropType
,
Ref
,
ref
,
watch
}
from
'vue'
;
import
{
i18n
}
from
'src/boot/i18n'
;
import
{
isEmail
}
from
'../../../boot/functions'
;
import
{
isMobilePhone
}
from
'../../../boot/functions'
;
import
{
isMobilePhone
,
isUserName
,
isHasVietnamese
}
from
'../../../boot/functions'
;
import
{
CustomerLevelType
,
CustomerType
}
from
'src/assets/type'
;
export
default
defineComponent
({
...
...
@@ -84,6 +84,8 @@ export default defineComponent({
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
<
30
)
||
i18n
.
global
.
t
(
'customer.validateMessages.lengthUserName'
),
(
val
:
string
)
=>
(
isUserName
(
val
)
||
'vui lòng nhập đúng tên đăng nhập'
),
];
const
passwordRules
=
[
(
val
?:
string
)
=>
...
...
@@ -109,19 +111,19 @@ export default defineComponent({
(
val
&&
val
.
trim
().
length
<=
50
)
||
i18n
.
global
.
t
(
'customer.validateMessages.lengthCustomerName'
),
];
const
businessNameRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requireBusinessName'
),
];
const
taxCodeRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requireTaxCode'
),
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
<=
20
)
||
i18n
.
global
.
t
(
'customer.validateMessages.LengthTaxCode'
),
];
//
const businessNameRules = [
//
(val?: string) =>
//
(val && val.trim().length) ||
//
i18n.global.t('customer.validateMessages.requireBusinessName'),
//
];
//
const taxCodeRules = [
//
(val?: string) =>
//
(val && val.trim().length) ||
//
i18n.global.t('customer.validateMessages.requireTaxCode'),
//
(val?: string) =>
//
(val && val.trim().length <= 20) ||
//
i18n.global.t('customer.validateMessages.LengthTaxCode'),
//
];
const
phoneRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
...
...
@@ -137,48 +139,49 @@ export default defineComponent({
(
val
:
string
)
=>
isEmail
(
val
)
||
i18n
.
global
.
t
(
'customer.validateMessages.isEmail'
),
];
const
addressRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requireAddress'
),
];
const
businessTypeRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requireBusinessType'
),
];
const
levelRules
=
[
(
val
?:
CustomerLevelType
)
=>
val
!==
null
||
i18n
.
global
.
t
(
'customer.validateMessages.requireRatings'
),
];
const
representativeRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requireRepresentative'
),
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
<=
50
)
||
i18n
.
global
.
t
(
'customer.validateMessages.lengthRepresentative'
),
];
const
positionRules
=
[
(
val
?:
string
)
=>
(
val
&&
val
.
trim
().
length
)
||
i18n
.
global
.
t
(
'customer.validateMessages.requiredPosition'
),
];
// const addressRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireAddress'),
// ];
// const businessTypeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireBusinessType'),
// ];
// const levelRules = [
// (val?: CustomerLevelType) =>
// val !== null ||
// i18n.global.t('customer.validateMessages.requireRatings'),
// ];
// const representativeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireRepresentative'),
// (val?: string) =>
// (val && val.trim().length <= 50) ||
// i18n.global.t('customer.validateMessages.lengthRepresentative'),
// ];
// const positionRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requiredPosition'),
// ];
return
{
isPwd
:
ref
(
true
),
userNameRules
,
customerNameRules
,
businessNameRules
,
//
businessNameRules,
passwordRules
,
codeRules
,
taxCodeRules
,
//
taxCodeRules,
emailRules
,
levelRules
,
addressRules
,
businessTypeRules
,
representativeRules
,
positionRules
,
//
levelRules,
//
addressRules,
//
businessTypeRules,
//
representativeRules,
//
positionRules,
phoneRules
,
userName
,
fullName
,
...
...
src/i18n/vi/index.ts
View file @
5186da20
...
...
@@ -333,15 +333,15 @@ export default {
customerName
:
'Họ tên *'
,
password
:
'Mật khẩu *'
,
code
:
'Mã khách hàng *'
,
businessName
:
'Tên doanh nghiệp
*
'
,
taxCode
:
'Mã số thuế
*
'
,
businessName
:
'Tên doanh nghiệp '
,
taxCode
:
'Mã số thuế '
,
email
:
'Email *'
,
ratings
:
'Xếp hạng
*
'
,
address
:
'Địa chỉ
*
'
,
businessType
:
'Loại doanh nghiệp
*
'
,
representative
:
'Người đại diện
*
'
,
position
:
'Chức vụ
*
'
,
phone
:
'Số điện thoại
*
'
,
ratings
:
'Xếp hạng '
,
address
:
'Địa chỉ '
,
businessType
:
'Loại doanh nghiệp '
,
representative
:
'Người đại diện '
,
position
:
'Chức vụ '
,
phone
:
'Số điện thoại '
,
status
:
'Trạng thái'
,
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment