Commit 6fedc741 by ym

role

1 parent 76eeab67
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" /> <link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %> <% } %>
<!-- <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder"></script> -->
<title>微前端子应用:博客</title> <title>微前端子应用:博客</title>
</head> </head>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
</template> </template>
<script> <script>
import AMap from "AMap";
let map, placeSearch; let map, placeSearch;
export default { export default {
name: "map", name: "map",
...@@ -35,7 +36,7 @@ export default { ...@@ -35,7 +36,7 @@ export default {
resizeEnable: true, resizeEnable: true,
zoom: 10, zoom: 10,
}); });
AMap.service(["AMap.PlaceSearch"], function () { AMap.plugin(["AMap.PlaceSearch"], function () {
//构造地点查询类 //构造地点查询类
placeSearch = new AMap.PlaceSearch({ placeSearch = new AMap.PlaceSearch({
citylimit: false, //是否强制限制在设置的城市内搜索 citylimit: false, //是否强制限制在设置的城市内搜索
...@@ -45,8 +46,8 @@ export default { ...@@ -45,8 +46,8 @@ export default {
}); });
}); });
// 添加列表点选监听事件 // 添加列表点选监听事件
AMap.event.addListener(map, "click", this.getAddress); map.on("click", this.getAddress);
AMap.event.addListener(placeSearch, "selectChanged", this.getAddress); placeSearch.on("markerClick", this.getAddress);
}, },
getAddress(e) { getAddress(e) {
let self = this; let self = this;
...@@ -54,8 +55,7 @@ export default { ...@@ -54,8 +55,7 @@ export default {
if (e.type == "click") { if (e.type == "click") {
lnglat = e.lnglat lnglat = e.lnglat
} else { } else {
console.log(e.selected.data.location) let { lng, lat } = e.data.entr_location;
let { lng, lat } = e.selected.data.location;
lnglat = [lng, lat]; lnglat = [lng, lat];
} }
AMap.plugin("AMap.Geocoder", () => { AMap.plugin("AMap.Geocoder", () => {
...@@ -89,11 +89,6 @@ export default { ...@@ -89,11 +89,6 @@ export default {
.map-box { .map-box {
position: relative; position: relative;
width: 100%; width: 100%;
/deep/ {
.el-dialog__body {
padding: 20px 10px;
}
}
} }
#container { #container {
position: absolute; position: absolute;
......
...@@ -12,16 +12,16 @@ import apis from './api' ...@@ -12,16 +12,16 @@ import apis from './api'
import './public-path' import './public-path'
// import 'glsx-components/dist/glsx-components.css' // import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup' import { start } from '@/setup'
import VueAMap from "vue-amap"; // import VueAMap from "vue-amap";
import filters from './utils/filters' //新增过滤器 import filters from './utils/filters' //新增过滤器
Vue.use(VueAMap); // Vue.use(VueAMap);
// 初始化vue-amap // // 初始化vue-amap
VueAMap.initAMapApiLoader({ // VueAMap.initAMapApiLoader({
key: "bd290dc27d0945959280753215ddda71", // 这里写你申请的高德地图的key // key: "bd290dc27d0945959280753215ddda71", // 这里写你申请的高德地图的key
plugin: ["AMap.Autocomplete", "AMap.Geocoder", "AMap.Geolocation"], // plugin: ["AMap.Autocomplete", "AMap.Geocoder", "AMap.Geolocation"],
v: "1.4.15", // v: "1.4.15",
uiVersion: "1.1" // uiVersion: "1.1"
}); // });
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$apis = apis Vue.prototype.$apis = apis
start() start()
......
...@@ -361,6 +361,11 @@ export default { ...@@ -361,6 +361,11 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.base-info { .base-info {
/deep/ {
.el-dialog__body {
padding: 20px 10px;
}
}
.account-body-form { .account-body-form {
width: 80%; width: 80%;
margin: 20px auto; margin: 20px auto;
......
<template> <template>
<div class="account-body scrm-box-f" v-loading="loading"> <div class="account-body scrm-box-f" v-loading="loading" v-if="tabMenu.length > 0">
<!-- <div class="account-title">{{ title }}</div> --> <!-- <div class="account-title">{{ title }}</div> -->
<el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik"> <el-tabs v-if="tabMenu.length != 0" v-model="tabName" type="card" @tab-click="handleClik">
<el-tab-pane :label="item.accounttypeName" :name="item.accounttypeId" v-for="(item, index) in tabMenu" :key="index"></el-tab-pane> <el-tab-pane :label="item.accounttypeName" :name="item.accounttypeId" v-for="(item, index) in tabMenu" :key="index"></el-tab-pane>
...@@ -52,6 +52,7 @@ export default { ...@@ -52,6 +52,7 @@ export default {
loading: false, loading: false,
treeHeight: 450, treeHeight: 450,
tabMenu: [], tabMenu: [],
tabMenu_r: [],
tabMenu_x: [], tabMenu_x: [],
tabMenu_s: [], tabMenu_s: [],
accountList: [], accountList: [],
...@@ -87,10 +88,14 @@ export default { ...@@ -87,10 +88,14 @@ export default {
productClick(productId) { productClick(productId) {
this.productTab = productId this.productTab = productId
}, },
findMenuFunTree(arr) {
let tabMenu = util.deepClone(this.tabMenu_r)
this.tabMenu = tabMenu.filter(item=>arr.includes(item.accounttypeId))
},
// 获取当前的所有权限 // 获取当前的所有权限
async findMenuFunTreeByMerId(params, arr) { async findMenuFunTreeByMerId(params) {
let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params) let tabMenu = await this.$apis.store.findMenuFunTreeByMerId(params)
this.tabMenu = tabMenu tabMenu = tabMenu
.map(item => { .map(item => {
return { return {
productsArr: [], productsArr: [],
...@@ -99,19 +104,18 @@ export default { ...@@ -99,19 +104,18 @@ export default {
accounttypeId: item.accounttypeId accounttypeId: item.accounttypeId
} }
}) })
.filter(i => arr.includes(i.accounttypeId)) this.tabMenu_r = util.deepClone(tabMenu)
this.$nextTick(() => { this.$nextTick(() => {
this.addStyle() this.addStyle()
}) })
console.log(this.tabMenu)
this.accountTypes = tabMenu.map(item => { this.accountTypes = tabMenu.map(item => {
return { return {
products: null, products: null,
accounttypeId: item.accounttypeId accounttypeId: item.accounttypeId
} }
}) })
this.tabName = this.tabMenu[0].accounttypeId this.tabName = this.tabMenu_r[0].accounttypeId
return this.tabMenu return this.tabMenu_r
}, },
// 获取当前的所有权限 // 获取当前的所有权限
async accountTypeSearchRequest(params, status) { async accountTypeSearchRequest(params, status) {
......
<template> <template>
<div class="role-create-page"> <div class="role-panel">
<div class="role-create-page scrm-box-f">
<div class="top_title_widget"> <div class="top_title_widget">
<span class="title">{{ pageName }}</span> <span class="title">{{ pageName }}</span>
</div> </div>
...@@ -14,10 +15,10 @@ ...@@ -14,10 +15,10 @@
<el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input> <el-input size="small" disabled style="width: 40%" v-model="ruleForm.merchantName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色名称" prop="roleName"> <el-form-item label="角色名称" prop="roleName">
<el-input size="small" style="width: 40%" v-model="ruleForm.roleName"></el-input> <el-input size="small" style="width: 40%" v-model="ruleForm.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色说明" prop="roleDesc"> <el-form-item label="角色说明" prop="roleDesc">
<el-input size="small" style="width: 40%" v-model="ruleForm.roleDesc"></el-input> <el-input size="small" style="width: 40%" v-model="ruleForm.roleDesc" placeholder="请输入角色说明"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色权限" prop="roleRoot"> <el-form-item label="角色权限" prop="roleRoot">
<div class="custom_element"> <div class="custom_element">
...@@ -29,8 +30,10 @@ ...@@ -29,8 +30,10 @@
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<SelectProduct ref="productFrom" :roleType="true" title=""></SelectProduct> </div>
</div> </div>
<div class="scrm-box-f" style="margin-top: 10px">
<SelectProduct ref="productFrom" :roleType="true" title="角色权限"></SelectProduct>
<div style="height: 84px"></div> <div style="height: 84px"></div>
<div <div
class="fixed_bottom" class="fixed_bottom"
...@@ -46,17 +49,20 @@ ...@@ -46,17 +49,20 @@
<el-button type="primary" @click="toBack">取消</el-button> <el-button type="primary" @click="toBack">取消</el-button>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
import AutoButton from '../../components/auto-button/index.vue' import AutoButton from '../../components/auto-button/index.vue'
import SelectProduct from '../account/components/selectProduct.vue' import SelectProduct from './components/selectProduct.vue'
export default { export default {
name: '', name: '',
components: { components: {
AutoButton, AutoButton,
SelectProduct SelectProduct
}, },
data() { data() {
return { return {
ruleForm: { ruleForm: {
...@@ -66,8 +72,7 @@ export default { ...@@ -66,8 +72,7 @@ export default {
}, },
rules: { rules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }], roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }], merchantId: [{ required: true, message: '请选择所属商户', trigger: 'change' }]
roleRoot: [{ required: true, message: '请选择角色权限', trigger: 'change' }]
}, },
rootList: [], rootList: [],
curRootIndex: 0, curRootIndex: 0,
...@@ -82,25 +87,7 @@ export default { ...@@ -82,25 +87,7 @@ export default {
accountLevel: 1 accountLevel: 1
} }
}, },
created() {
let id = Number(this.$route.params.id)
if (!id) {
this.pageName = '新增角色'
this.pageType = 'create'
this.getMerchantName()
} else {
this.pageName = '修改角色'
this.pageType = 'edit'
this.getRoleData(id)
this.editId = id
}
const { session } = this.$globalState
this.accountLevel = session.accountLevel
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
},
methods: { methods: {
// 获取角色信息 // 获取角色信息
getRoleData(id) { getRoleData(id) {
...@@ -149,9 +136,9 @@ export default { ...@@ -149,9 +136,9 @@ export default {
}, },
// 选择商户----获取权限 // 选择商户----获取权限
async selectMerchant(id) { async selectMerchant(id) {
let res = await this.$refs.productFrom.accountTypeSearchRequest({ id }, 'create') let res = await this.$refs.productFrom.findMenuFunTreeByMerId({ id })
this.accountList = res.map(item => { this.accountList = res.map(item => {
item.select = true item.select = false
return item return item
}) })
}, },
...@@ -167,6 +154,11 @@ export default { ...@@ -167,6 +154,11 @@ export default {
}) })
this.rootList = arr this.rootList = arr
} }
let accounttypeId = [];
this.rootList.forEach(item=>{
accounttypeId.push(item.accounttypeId)
})
this.$refs.productFrom.findMenuFunTree(accounttypeId)
}, },
// 确定按钮---处理参数---提交数据---创建为0---草稿为1 // 确定按钮---处理参数---提交数据---创建为0---草稿为1
...@@ -233,9 +225,31 @@ export default { ...@@ -233,9 +225,31 @@ export default {
toBack() { toBack() {
this.$router.push('/role/index') this.$router.push('/role/index')
} }
},
created() {
let id = Number(this.$route.params.id)
if (!id) {
this.pageName = '新增角色'
this.pageType = 'create'
this.getMerchantName()
} else {
this.pageName = '修改角色'
this.pageType = 'edit'
this.getRoleData(id)
this.editId = id
}
const { session } = this.$globalState
this.accountLevel = session.accountLevel
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.role-create-page { .role-create-page {
height: 100%; height: 100%;
...@@ -284,4 +298,4 @@ export default { ...@@ -284,4 +298,4 @@ export default {
margin-right: 15px; margin-right: 15px;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<script> <script>
export default { export default {
name: '', name: '',
data() { data() {
return { return {
searchForm: { searchForm: {
...@@ -82,11 +83,13 @@ export default { ...@@ -82,11 +83,13 @@ export default {
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createdTime' prop: 'createdTime',
width: '160px'
}, },
{ {
label: '更新时间', label: '更新时间',
prop: 'updatedTime', prop: 'updatedTime',
width: '160px',
formatter: val => { formatter: val => {
if (!val.updatedTime) { if (!val.updatedTime) {
return '--' return '--'
...@@ -104,18 +107,7 @@ export default { ...@@ -104,18 +107,7 @@ export default {
list: [] list: []
} }
}, },
created() {
const { session } = this.$globalState
let accountLevel = session.accountLevel
if (accountLevel != 4) {
this.tableParams.tableColumns.splice(2, 0, { label: '所属商户名', prop: 'merchantName' })
this.getMerchantName()
}
this.accountLevel = accountLevel
},
mounted() {
this.getTableData()
},
methods: { methods: {
// 获取表格数据 // 获取表格数据
getTableData() { getTableData() {
...@@ -197,15 +189,26 @@ export default { ...@@ -197,15 +189,26 @@ export default {
}) })
}) })
.catch(() => { .catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
}) })
} }
},
created() {
const { session } = this.$globalState
let accountLevel = session.accountLevel
if (accountLevel != 4) {
this.tableParams.tableColumns.splice(2, 0, { label: '所属商户名', prop: 'merchantName' })
this.getMerchantName()
}
this.accountLevel = accountLevel
},
mounted() {
this.getTableData()
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.role-home-page { .role-home-page {
box-sizing: border-box; box-sizing: border-box;
...@@ -249,4 +252,4 @@ export default { ...@@ -249,4 +252,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,8 @@ const cdn = { ...@@ -13,7 +13,8 @@ const cdn = {
`${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`,
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`,
`${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js` `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`,
'https://webapi.amap.com/maps?v=2.0&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder'
] ]
} }
module.exports = { module.exports = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!