Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
Details
Activity
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
姜雷
dcxy-manage-shell
Commits
aea4165f
Commit
aea4165f
authored
Apr 19, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
Develop See merge request
!13
parents
39eee761
1cea3ae1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
28 deletions
+90
-28
index.js
src/api/base/index.js
+6
-1
AreaSelect.vue
src/components/input/AreaSelect/AreaSelect.vue
+5
-0
areaStore.js
src/components/input/AreaSelect/areaStore.js
+44
-19
mixin.js
src/components/input/AreaSelect/mixin.js
+26
-6
typeMapping.js
src/components/input/AreaSelect/typeMapping.js
+3
-0
Dashboard.js
src/containers/Dashboard/Dashboard.js
+6
-2
No files found.
src/api/base/index.js
View file @
aea4165f
...
...
@@ -8,7 +8,12 @@ export const fetchAreaList = req =>
method
:
'get'
,
...
req
,
});
export
const
fetchAccessAreaList
=
req
=>
fetch
({
url
:
path
+
'/dcxy/baseArea/queryAll'
,
method
:
'get'
,
...
req
,
});
//获取下拉列表
export
const
fetchSelectList
=
req
=>
fetch
({
...
...
src/components/input/AreaSelect/AreaSelect.vue
View file @
aea4165f
...
...
@@ -24,6 +24,11 @@ export default {
value
:
Number
,
},
mixins
:
[
areaMixin
],
computed
:
{
areaList
()
{
return
this
[
`areaList
${
this
.
accessType
}
`
];
},
},
methods
:
{
changeHandle
(
val
)
{
if
(
val
)
{
...
...
src/components/input/AreaSelect/areaStore.js
View file @
aea4165f
import
{
fetchAreaList
}
from
'@/api/base/index'
;
import
{
fetchAreaList
,
fetchAccessAreaList
}
from
'@/api/base/index'
;
import
typeMapping
from
'./typeMapping'
;
const
GET_AREA_LIST
=
'GET_AREA_LIST'
;
const
FETCH_STATE
=
'FETCH_STATE'
;
const
FETCH_END
=
'FETCH_END'
;
const
state
=
()
=>
({
list
:
[],
fetching
:
false
,
});
const
state
=
()
=>
{
let
areaState
=
{};
typeMapping
.
map
(
type
=>
{
areaState
[
`list
${
type
.
value
}
`
]
=
[];
areaState
[
`fetching
${
type
.
value
}
`
]
=
false
;
});
return
areaState
;
};
const
getters
=
{
areaList
:
state
=>
state
.
list
,
const
initGetters
=
()
=>
{
let
getters
=
{};
typeMapping
.
map
(
type
=>
{
getters
[
`areaList
${
type
.
value
}
`
]
=
state
=>
state
[
`list
${
type
.
value
}
`
];
});
return
getters
;
};
const
getters
=
initGetters
();
const
actions
=
{
fetchAreaList
({
state
,
commit
})
{
if
(
state
.
fetching
)
return
;
commit
(
FETCH_STATE
,
true
);
return
fetchAreaList
().
then
(
res
=>
{
const
initAction
=
()
=>
{
let
actions
=
{};
typeMapping
.
map
(
type
=>
{
actions
[
`fetchAreaList
${
type
.
value
}
`
]
=
({
state
,
commit
})
=>
{
if
(
state
[
`fetching
${
type
.
value
}
`
])
return
;
commit
(
FETCH_STATE
,
type
.
value
);
let
fetchHandle
=
null
;
if
(
type
.
value
==
0
)
{
fetchHandle
=
fetchAreaList
;
}
else
{
fetchHandle
=
fetchAccessAreaList
;
}
return
fetchHandle
().
then
(
res
=>
{
const
list
=
res
.
data
;
commit
(
GET_AREA_LIST
,
list
);
commit
(
FETCH_STATE
,
fals
e
);
commit
(
GET_AREA_LIST
,
{
type
:
type
.
value
,
list
}
);
commit
(
FETCH_END
,
type
.
valu
e
);
});
},
};
});
return
actions
;
};
const
actions
=
initAction
();
const
mutations
=
{
[
GET_AREA_LIST
](
state
,
list
)
{
state
.
list
=
list
;
[
GET_AREA_LIST
](
state
,
{
type
,
list
})
{
state
[
`list
${
type
}
`
]
=
list
;
},
[
FETCH_STATE
](
state
,
type
)
{
state
[
`fetching
${
type
}
`
]
=
true
;
},
[
FETCH_
STATE
](
state
,
fetching
)
{
state
.
fetching
=
fetching
;
[
FETCH_
END
](
state
,
type
)
{
state
[
`fetching
${
type
}
`
]
=
false
;
},
};
...
...
src/components/input/AreaSelect/mixin.js
View file @
aea4165f
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
store
from
'./store'
;
import
typeMapping
from
'./typeMapping'
;
const
getterList
=
typeMapping
.
map
(
type
=>
`areaList
${
type
.
value
}
`
);
const
actionsList
=
typeMapping
.
map
(
type
=>
`fetchAreaList
${
type
.
value
}
`
);
export
default
{
props
:
{
accessType
:
{
type
:
Number
,
default
:
1
,
// 0 全部 1 权限
},
},
created
()
{
store
.
install
(
this
.
$store
);
},
mounted
()
{
if
(
!
this
.
areaList
.
length
)
{
this
.
fetchAreaList
();
if
(
this
[
`areaList
${
this
.
accessType
}
`
]
&&
!
this
[
`areaList
${
this
.
accessType
}
`
].
length
)
{
this
[
`fetchAreaList
${
this
.
accessType
}
`
]();
}
// if (!this.areaList.length) {
// this.fetchAreaList();
// }
},
computed
:
{
...
mapGetters
(
'area'
,
[
'areaList'
]
),
...
mapGetters
(
'area'
,
getterList
),
},
methods
:
{
...
mapActions
(
'area'
,
[
'fetchAreaList'
]
),
...
mapActions
(
'area'
,
actionsList
),
getAreaName
(
id
)
{
let
item
=
this
.
areaList
.
find
(
area
=>
area
.
id
===
id
);
let
item
=
this
[
`areaList
${
this
.
accessType
}
`
].
find
(
area
=>
area
.
id
===
id
);
if
(
item
)
{
return
item
.
areaName
;
}
else
{
...
...
@@ -24,7 +42,9 @@ export default {
}
},
getAreaOperatorInfo
(
id
)
{
let
item
=
this
.
areaList
.
find
(
area
=>
area
.
id
===
id
);
let
item
=
this
[
`areaList
${
this
.
accessType
}
`
].
find
(
area
=>
area
.
id
===
id
);
if
(
item
)
{
return
{
rechargeOperateId
:
item
.
rechargeOperateId
,
...
...
src/components/input/AreaSelect/typeMapping.js
0 → 100644
View file @
aea4165f
const
typeMapping
=
[{
value
:
0
,
label
:
'全部'
},
{
value
:
1
,
label
:
'权限'
}];
export
default
typeMapping
;
src/containers/Dashboard/Dashboard.js
View file @
aea4165f
...
...
@@ -159,8 +159,12 @@ const mutations = {
state
.
consume
.
percentList
=
data
.
percentList
;
},
[
GET_EUIPMENT_DATA
]:
(
state
,
data
)
=>
{
state
.
consume
.
consumeHardVos
=
data
.
consumeHardVos
;
state
.
consume
.
consumeAfterVos
=
data
.
consumeAfterVos
;
state
.
consume
.
consumeHardVos
=
data
.
consumeHardVos
?
data
.
consumeHardVos
:
[];
state
.
consume
.
consumeAfterVos
=
data
.
consumeAfterVos
?
data
.
consumeAfterVos
:
[];
},
[
GET_REPORT_DATA
]:
(
state
,
data
)
=>
{
state
.
report
.
year
=
data
.
year
;
...
...
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