Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pet-business-web
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
刘怀志
pet-business-web
Commits
a567f555
Commit
a567f555
authored
Sep 25, 2023
by
刘怀志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
67882 药品库存,剂量、销售单位值更新问题(后期优化)
parent
f2188ab4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
index.js
src/components/DictData/index.js
+27
-26
No files found.
src/components/DictData/index.js
View file @
a567f555
...
...
@@ -3,20 +3,20 @@ import store from '@/store'
import
DataDict
from
'@/utils/dict'
import
{
getDicts
as
getDicts
}
from
'@/api/system/dict/data'
function
searchDictByKey
(
dict
,
key
)
{
if
(
key
==
null
&&
key
===
''
)
{
return
null
}
try
{
for
(
let
i
=
0
;
i
<
dict
.
length
;
i
++
)
{
if
(
dict
[
i
].
key
===
key
)
{
return
dict
[
i
].
value
}
}
}
catch
(
e
)
{
return
null
}
}
//
function searchDictByKey(dict, key) {
//
if (key == null && key === '') {
//
return null
//
}
//
try {
//
for (let i = 0; i < dict.length; i++) {
//
if (dict[i].key === key) {
//
return dict[i].value
//
}
//
}
//
} catch (e) {
//
return null
//
}
//
}
function
install
()
{
Vue
.
use
(
DataDict
,
{
...
...
@@ -25,19 +25,20 @@ function install() {
labelField
:
'dictLabel'
,
valueField
:
'dictValue'
,
request
(
dictMeta
)
{
const
storeDict
=
searchDictByKey
(
store
.
getters
.
dict
,
dictMeta
.
type
)
if
(
storeDict
)
{
return
new
Promise
(
resolve
=>
{
resolve
(
storeDict
)
})
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getDicts
(
dictMeta
.
type
).
then
(
res
=>
{
store
.
dispatch
(
'dict/setDict'
,
{
key
:
dictMeta
.
type
,
value
:
res
.
data
})
resolve
(
res
.
data
)
}).
catch
(
error
=>
{
reject
(
error
)
})
// const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
return
new
Promise
((
resolve
,
reject
)
=>
{
getDicts
(
dictMeta
.
type
).
then
(
res
=>
{
store
.
dispatch
(
'dict/setDict'
,
{
key
:
dictMeta
.
type
,
value
:
res
.
data
})
resolve
(
res
.
data
)
}).
catch
(
error
=>
{
reject
(
error
)
})
}
})
// if (storeDict) {
// return new Promise(resolve => { resolve(storeDict) })
// } else {
//
// }
}
}
}
...
...
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