Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
02bce3e2
Commit
02bce3e2
authored
Dec 14, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 后端接口更新,前端修复bug
parent
b5810170
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
37 deletions
+60
-37
ContactPersonService.ts
src/db/ContactPersonService.ts
+14
-14
OutletDBService.ts
src/db/OutletDBService.ts
+1
-1
index.ts
src/db/index.ts
+3
-3
displayName.ts
src/utils/displayName.ts
+29
-16
Chat.vue
src/views/Chat/Chat.vue
+12
-2
index.vue
src/views/withMenu/Mine/index.vue
+1
-1
No files found.
src/db/ContactPersonService.ts
View file @
02bce3e2
import
{
iContact2
}
from
'@/service/UserService/types'
import
{
MyAppDatabase
}
from
'./index'
import
{
iContact2
}
from
"@/service/UserService/types"
;
import
{
MyAppDatabase
}
from
"./index"
;
export
default
class
ContactPersonService
{
static
instance
:
ContactPersonService
private
contactPerson
:
Dexie
.
Table
<
iContact2
,
number
>
static
instance
:
ContactPersonService
;
private
contactPerson
:
Dexie
.
Table
<
iContact2
,
string
>
;
static
getInstance
()
{
if
(
!
ContactPersonService
.
instance
)
{
ContactPersonService
.
instance
=
new
ContactPersonService
()
ContactPersonService
.
instance
=
new
ContactPersonService
()
;
}
return
ContactPersonService
.
instance
return
ContactPersonService
.
instance
;
}
constructor
()
{
const
db
=
new
MyAppDatabase
()
this
.
contactPerson
=
db
.
contactPerson
const
db
=
new
MyAppDatabase
()
;
this
.
contactPerson
=
db
.
contactPerson
;
}
save
(
list
:
iContact2
[])
{
return
this
.
contactPerson
.
bulk
Add
(
list
)
return
this
.
contactPerson
.
bulk
Put
(
list
);
}
async
findByList
(
addressList
:
string
[])
{
const
list
=
await
this
.
contactPerson
.
filter
((
i
)
=>
{
return
addressList
.
includes
(
i
.
addr
)
return
addressList
.
includes
(
i
.
addr
)
;
})
.
toArray
()
.
toArray
()
;
const
notFoundList
=
addressList
.
filter
(
(
i
)
=>
list
.
findIndex
((
item
)
=>
item
?.
addr
===
i
)
===
-
1
,
)
(
i
)
=>
list
.
findIndex
((
item
)
=>
item
?.
addr
===
i
)
===
-
1
)
;
return
{
foundList
:
list
,
notFoundList
,
}
}
;
}
}
src/db/OutletDBService.ts
View file @
02bce3e2
...
...
@@ -15,7 +15,7 @@ export default class OutletDBService {
}
add
(
outlet
:
iOutLet
)
{
return
this
.
outlet
.
add
(
outlet
);
return
this
.
outlet
.
put
(
outlet
);
}
update
(
outlet
:
Partial
<
Omit
<
iOutLet
,
"id"
>>
&
Pick
<
iOutLet
,
"posId"
>
)
{
...
...
src/db/index.ts
View file @
02bce3e2
...
...
@@ -26,19 +26,19 @@ export interface iOutLet {
export
class
MyAppDatabase
extends
Dexie
{
chatMessage
:
Dexie
.
Table
<
iChatMessage
,
number
>
;
chatListCard
:
Dexie
.
Table
<
iChatListCard
,
number
>
;
contactPerson
:
Dexie
.
Table
<
iContact2
,
number
>
;
contactPerson
:
Dexie
.
Table
<
iContact2
,
string
>
;
userInfo
:
Dexie
.
Table
<
iUserinfo
,
number
>
;
outlet
:
Dexie
.
Table
<
iOutLet
,
string
>
;
constructor
()
{
super
(
"MyAppDatabase"
);
this
.
version
(
1.
7
).
stores
({
this
.
version
(
1.
8
).
stores
({
chatMessage
:
"++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed"
,
chatListCard
:
"++id, masterId, targetId, unreadMsgCount, content, inChat, isRobootCard,isDeleted"
,
contactPerson
:
"
++id,
addr, bank, phone, user_name, out_let_name"
,
contactPerson
:
"addr, bank, phone, user_name, out_let_name"
,
userInfo
:
"++id, created_at, phone, remark, user_name, uuid, addr"
,
outlet
:
"posId, name, isDeleted"
,
});
...
...
src/utils/displayName.ts
View file @
02bce3e2
...
...
@@ -9,7 +9,8 @@ import { getUserMsg } from "./userMsg";
/* 拿到地址对应的用户昵称 */
export
const
getDisplayNamesFromAddress
=
async
(
addressList
:
string
[]
addressList
:
string
[],
forceFetch
?:
boolean
):
Promise
<
string
[]
>
=>
{
/* 数据库查 有结果拿 没结果网上查且存 */
const
user
=
getUserMsg
();
...
...
@@ -17,16 +18,20 @@ export const getDisplayNamesFromAddress = async (
let
foundList
=
[]
as
any
[];
let
notFoundList
=
[]
as
any
[];
if
(
user
?.
role2
===
eRole
.
user
)
{
const
ret
=
await
ContactPersonService
.
getInstance
().
findByList
(
addressList
);
foundList
=
ret
.
foundList
;
notFoundList
=
ret
.
notFoundList
;
}
else
if
(
user
?.
role2
===
eRole
.
staff
||
user
?.
role2
===
eRole
.
manager
)
{
const
ret
=
await
UserInfoDBService
.
getInstance
().
findByList
(
addressList
);
foundList
=
ret
.
foundList
;
notFoundList
=
ret
.
notFoundList
;
if
(
forceFetch
)
{
notFoundList
=
addressList
;
}
else
{
if
(
user
?.
role2
===
eRole
.
user
)
{
const
ret
=
await
ContactPersonService
.
getInstance
().
findByList
(
addressList
);
foundList
=
ret
.
foundList
;
notFoundList
=
ret
.
notFoundList
;
}
else
if
(
user
?.
role2
===
eRole
.
staff
||
user
?.
role2
===
eRole
.
manager
)
{
const
ret
=
await
UserInfoDBService
.
getInstance
().
findByList
(
addressList
);
foundList
=
ret
.
foundList
;
notFoundList
=
ret
.
notFoundList
;
}
}
const
fullList
=
foundList
as
unknown
as
any
;
...
...
@@ -64,11 +69,14 @@ export const getDisplayNamesFromAddress = async (
};
/* 获取网点名称 indexeddb数据库查,没有,则发起请求查*/
export
const
getDisplayNamesFromOutletId
=
async
(
outletPosId
:
string
[])
=>
{
export
const
getDisplayNamesFromOutletId
=
async
(
outletPosId
:
string
[],
forceFetch
?:
boolean
)
=>
{
const
promiseList
=
outletPosId
.
map
(
async
(
id
)
=>
{
const
outlet
=
await
OutletDBService
.
getInstance
().
get
(
id
);
if
(
!
outlet
)
{
if
(
forceFetch
||
!
outlet
)
{
const
ret
=
await
AddressService
.
getInstance
().
getOutlet
({
pos_id
:
id
,
});
...
...
@@ -88,13 +96,18 @@ export const getDisplayNamesFromOutletId = async (outletPosId: string[]) => {
};
export
const
getDisplayNames
=
async
(
list
:
{
outletPosId
?:
string
;
address
?:
string
}[]
list
:
{
outletPosId
?:
string
;
address
?:
string
}[],
forceFetch
?:
boolean
)
=>
{
const
promiseList
=
list
.
map
((
i
)
=>
{
if
(
i
.
outletPosId
!==
undefined
)
{
return
getDisplayNamesFromOutletId
([
i
.
outletPosId
]).
then
((
ret
)
=>
ret
[
0
]);
return
getDisplayNamesFromOutletId
([
i
.
outletPosId
],
forceFetch
).
then
(
(
ret
)
=>
ret
[
0
]
);
}
else
if
(
i
.
address
!==
undefined
)
{
return
getDisplayNamesFromAddress
([
i
.
address
]).
then
((
ret
)
=>
ret
[
0
]);
return
getDisplayNamesFromAddress
([
i
.
address
],
forceFetch
).
then
(
(
ret
)
=>
ret
[
0
]
);
}
else
return
""
;
});
...
...
src/views/Chat/Chat.vue
View file @
02bce3e2
...
...
@@ -310,15 +310,25 @@ export default defineComponent({
const
initTitle
=
async
()
=>
{
if
(
isChatWithRoboot
.
value
)
{
cons
t
list
=
await
getDisplayNames
([
le
t
list
=
await
getDisplayNames
([
{
outletPosId
:
route
.
query
.
targetId
as
string
},
]);
title
.
value
=
list
[
0
]
as
string
;
list
=
await
getDisplayNames
(
[{
outletPosId
:
route
.
query
.
targetId
as
string
}],
true
);
title
.
value
=
list
[
0
]
as
string
;
}
else
{
cons
t
list
=
await
getDisplayNames
([
le
t
list
=
await
getDisplayNames
([
{
address
:
route
.
query
.
targetId
as
string
},
]);
title
.
value
=
list
[
0
]
as
string
;
list
=
await
getDisplayNames
(
[{
address
:
route
.
query
.
targetId
as
string
}],
true
);
title
.
value
=
list
[
0
]
as
string
;
}
};
...
...
src/views/withMenu/Mine/index.vue
View file @
02bce3e2
...
...
@@ -61,7 +61,7 @@
<Skeleton
:loading=
"state.loading"
:row=
"4"
>
<branch
class=
"mt-3 mx-5"
v-if=
"state.branchinfo || !isUser"
v-if=
"state.branchinfo
.pos_id
|| !isUser"
:name=
"state.branchinfo.name"
:distance=
"state.branchinfo.distance"
:is_normal_work=
"state.branchinfo.is_normal_work"
...
...
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