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
b8fde7aa
Commit
b8fde7aa
authored
Apr 19, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改区域选择添加权限控制
parent
c4da6c71
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
26 deletions
+84
-26
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
No files found.
src/api/base/index.js
View file @
b8fde7aa
...
@@ -8,7 +8,12 @@ export const fetchAreaList = req =>
...
@@ -8,7 +8,12 @@ export const fetchAreaList = req =>
method
:
'get'
,
method
:
'get'
,
...
req
,
...
req
,
});
});
export
const
fetchAccessAreaList
=
req
=>
fetch
({
url
:
path
+
'/dcxy/baseArea/queryAll'
,
method
:
'get'
,
...
req
,
});
//获取下拉列表
//获取下拉列表
export
const
fetchSelectList
=
req
=>
export
const
fetchSelectList
=
req
=>
fetch
({
fetch
({
...
...
src/components/input/AreaSelect/AreaSelect.vue
View file @
b8fde7aa
...
@@ -24,6 +24,11 @@ export default {
...
@@ -24,6 +24,11 @@ export default {
value
:
Number
,
value
:
Number
,
},
},
mixins
:
[
areaMixin
],
mixins
:
[
areaMixin
],
computed
:
{
areaList
()
{
return
this
[
`areaList
${
this
.
accessType
}
`
];
},
},
methods
:
{
methods
:
{
changeHandle
(
val
)
{
changeHandle
(
val
)
{
if
(
val
)
{
if
(
val
)
{
...
...
src/components/input/AreaSelect/areaStore.js
View file @
b8fde7aa
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
GET_AREA_LIST
=
'GET_AREA_LIST'
;
const
FETCH_STATE
=
'FETCH_STATE'
;
const
FETCH_STATE
=
'FETCH_STATE'
;
const
FETCH_END
=
'FETCH_END'
;
const
state
=
()
=>
({
const
state
=
()
=>
{
list
:
[],
let
areaState
=
{};
fetching
:
false
,
typeMapping
.
map
(
type
=>
{
});
areaState
[
`list
${
type
.
value
}
`
]
=
[];
areaState
[
`fetching
${
type
.
value
}
`
]
=
false
;
});
return
areaState
;
};
const
getters
=
{
const
initGetters
=
()
=>
{
areaList
:
state
=>
state
.
list
,
let
getters
=
{};
typeMapping
.
map
(
type
=>
{
getters
[
`areaList
${
type
.
value
}
`
]
=
state
=>
state
[
`list
${
type
.
value
}
`
];
});
return
getters
;
};
};
const
getters
=
initGetters
();
const
actions
=
{
const
initAction
=
()
=>
{
fetchAreaList
({
state
,
commit
})
{
let
actions
=
{};
if
(
state
.
fetching
)
return
;
typeMapping
.
map
(
type
=>
{
commit
(
FETCH_STATE
,
true
);
actions
[
`fetchAreaList
${
type
.
value
}
`
]
=
({
state
,
commit
})
=>
{
return
fetchAreaList
().
then
(
res
=>
{
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
;
const
list
=
res
.
data
;
commit
(
GET_AREA_LIST
,
list
);
commit
(
GET_AREA_LIST
,
{
type
:
type
.
value
,
list
}
);
commit
(
FETCH_STATE
,
fals
e
);
commit
(
FETCH_END
,
type
.
valu
e
);
});
});
},
};
});
return
actions
;
};
};
const
actions
=
initAction
();
const
mutations
=
{
const
mutations
=
{
[
GET_AREA_LIST
](
state
,
list
)
{
[
GET_AREA_LIST
](
state
,
{
type
,
list
})
{
state
.
list
=
list
;
state
[
`list
${
type
}
`
]
=
list
;
},
[
FETCH_STATE
](
state
,
type
)
{
state
[
`fetching
${
type
}
`
]
=
true
;
},
},
[
FETCH_
STATE
](
state
,
fetching
)
{
[
FETCH_
END
](
state
,
type
)
{
state
.
fetching
=
fetching
;
state
[
`fetching
${
type
}
`
]
=
false
;
},
},
};
};
...
...
src/components/input/AreaSelect/mixin.js
View file @
b8fde7aa
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
store
from
'./store'
;
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
{
export
default
{
props
:
{
accessType
:
{
type
:
Number
,
default
:
1
,
// 0 全部 1 权限
},
},
created
()
{
created
()
{
store
.
install
(
this
.
$store
);
store
.
install
(
this
.
$store
);
},
},
mounted
()
{
mounted
()
{
if
(
!
this
.
areaList
.
length
)
{
if
(
this
.
fetchAreaList
();
this
[
`areaList
${
this
.
accessType
}
`
]
&&
!
this
[
`areaList
${
this
.
accessType
}
`
].
length
)
{
this
[
`fetchAreaList
${
this
.
accessType
}
`
]();
}
}
// if (!this.areaList.length) {
// this.fetchAreaList();
// }
},
},
computed
:
{
computed
:
{
...
mapGetters
(
'area'
,
[
'areaList'
]
),
...
mapGetters
(
'area'
,
getterList
),
},
},
methods
:
{
methods
:
{
...
mapActions
(
'area'
,
[
'fetchAreaList'
]
),
...
mapActions
(
'area'
,
actionsList
),
getAreaName
(
id
)
{
getAreaName
(
id
)
{
let
item
=
this
.
areaList
.
find
(
area
=>
area
.
id
===
id
);
let
item
=
this
[
`areaList
${
this
.
accessType
}
`
].
find
(
area
=>
area
.
id
===
id
);
if
(
item
)
{
if
(
item
)
{
return
item
.
areaName
;
return
item
.
areaName
;
}
else
{
}
else
{
...
@@ -24,7 +42,9 @@ export default {
...
@@ -24,7 +42,9 @@ export default {
}
}
},
},
getAreaOperatorInfo
(
id
)
{
getAreaOperatorInfo
(
id
)
{
let
item
=
this
.
areaList
.
find
(
area
=>
area
.
id
===
id
);
let
item
=
this
[
`areaList
${
this
.
accessType
}
`
].
find
(
area
=>
area
.
id
===
id
);
if
(
item
)
{
if
(
item
)
{
return
{
return
{
rechargeOperateId
:
item
.
rechargeOperateId
,
rechargeOperateId
:
item
.
rechargeOperateId
,
...
...
src/components/input/AreaSelect/typeMapping.js
0 → 100644
View file @
b8fde7aa
const
typeMapping
=
[{
value
:
0
,
label
:
'全部'
},
{
value
:
1
,
label
:
'权限'
}];
export
default
typeMapping
;
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