|
@@ -1,123 +1,22 @@
|
|
<script>
|
|
<script>
|
|
|
|
+import menuList from "@/data/json/menuList.json"
|
|
|
|
+import ssoList from "@/data/json/ssoList.json"
|
|
import Function from "@/components/dashboard/commonFuncManage/function.vue";
|
|
import Function from "@/components/dashboard/commonFuncManage/function.vue";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- commonFunctions: [
|
|
|
|
- {
|
|
|
|
- name: '智慧餐厅',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '智慧餐厅2',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅3',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅4',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅5',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅6',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅7',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },{
|
|
|
|
- name: '智慧餐厅8',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- functions: [
|
|
|
|
- {
|
|
|
|
- name: '智慧停车',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '智慧停车2',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '智慧停车3',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '智慧停车4',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '智慧停车5',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- type: 'route'
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- ssoList: [
|
|
|
|
- {
|
|
|
|
- name: '系统1',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- isSSO: true,
|
|
|
|
- type: 'url'
|
|
|
|
- },{
|
|
|
|
- name: '系统2',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- isSSO: true,
|
|
|
|
- type: 'url'
|
|
|
|
- },{
|
|
|
|
- name: '系统3',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- isSSO: true,
|
|
|
|
- type: 'url'
|
|
|
|
- },{
|
|
|
|
- name: '系统4',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- isSSO: true,
|
|
|
|
- type: 'url'
|
|
|
|
- },{
|
|
|
|
- name: '系统5',
|
|
|
|
- icon: '@/assets/images/function/iocRestaurant.png',
|
|
|
|
- url: '',
|
|
|
|
- isSSO: true,
|
|
|
|
- type: 'url'
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
|
|
+ menuList,
|
|
|
|
+ ssoList,
|
|
|
|
+ customFunction: [],
|
|
|
|
+ functions: [],
|
|
|
|
+ ssoSystems: [],
|
|
show: false,
|
|
show: false,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
visible: Boolean,
|
|
visible: Boolean,
|
|
|
|
+ commonFunction: Array,
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
Function
|
|
Function
|
|
@@ -128,65 +27,74 @@ export default {
|
|
},
|
|
},
|
|
"visible": function (val) {
|
|
"visible": function (val) {
|
|
this.show = val
|
|
this.show = val
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- emits: ['update:visible'],
|
|
|
|
|
|
+ emits: ['update:visible', 'update:commonFunction'],
|
|
setup(props, context) {
|
|
setup(props, context) {
|
|
const methods = {
|
|
const methods = {
|
|
toggleVisible(flag) {
|
|
toggleVisible(flag) {
|
|
context.emit('update:visible', flag)
|
|
context.emit('update:visible', flag)
|
|
},
|
|
},
|
|
|
|
+ updateFunctions(arr) {
|
|
|
|
+ context.emit('update:commonFunction', arr)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return methods
|
|
return methods
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.show = this.visible;
|
|
this.show = this.visible;
|
|
|
|
+ this.customFunction = JSON.parse(JSON.stringify(this.commonFunction));
|
|
|
|
+ this.getFunctions();
|
|
|
|
+ this.ssoSystems = this.ssoList
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getFunctions() {
|
|
|
|
+ let names = this.commonFunction.map(i=>{return i.name});
|
|
|
|
+ this.functions = [];
|
|
|
|
+ for (let i = 0; i < this.menuList.length; i++) {
|
|
|
|
+ let menu = this.menuList[i];
|
|
|
|
+ let childMenus = menu.children?menu.children:[];
|
|
|
|
+ childMenus = childMenus.filter(i=>names.indexOf(i.name)<0);
|
|
|
|
+ childMenus.forEach(item => {
|
|
|
|
+ this.functions.push(item)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
handleOk() {
|
|
handleOk() {
|
|
|
|
+ this.$store.menuStore().commonFunction = JSON.parse(JSON.stringify(this.customFunction));
|
|
|
|
+ this.updateFunctions(this.$store.menuStore().commonFunction)
|
|
this.show = false;
|
|
this.show = false;
|
|
},
|
|
},
|
|
handleCancel() {
|
|
handleCancel() {
|
|
this.show = false
|
|
this.show = false
|
|
},
|
|
},
|
|
- plusFunction(item, isSSO) {
|
|
|
|
- if (!item || item == '') {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (this.commonFunctions.length>=8) {
|
|
|
|
|
|
+ plusFunction(item) {
|
|
|
|
+ if (this.customFunction.length>=8) {
|
|
this.$message.warning('功能位已满,请先移除功能后重试')
|
|
this.$message.warning('功能位已满,请先移除功能后重试')
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- let obj;
|
|
|
|
- let index = this.functions.findIndex(i=>i.name==item)
|
|
|
|
- if (!index || index>=0) {
|
|
|
|
- index = this.ssoList.findIndex(i=>i.name==item)
|
|
|
|
- if (index && index>=0) {
|
|
|
|
- obj = this.ssoList[index];
|
|
|
|
- this.ssoList.splice(index, 1)
|
|
|
|
|
|
+ if (item.isSso) {
|
|
|
|
+ let index = this.ssoSystems.findIndex(i=>i.name==item.name)
|
|
|
|
+ if (index) {
|
|
|
|
+ this.ssoSystems.splice(index, 1)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- obj = this.functions[index];
|
|
|
|
- this.functions.splice(index, 1)
|
|
|
|
- }
|
|
|
|
- if (obj) {
|
|
|
|
- this.commonFunctions.push(obj)
|
|
|
|
|
|
+ let index = this.functions.findIndex(i=>i.name==item.name)
|
|
|
|
+ if (index) {
|
|
|
|
+ this.functions.splice(index, 1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ this.customFunction.push(item)
|
|
},
|
|
},
|
|
- minusFunction(item, isSSO) {
|
|
|
|
- if (!item || item == '') {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- let obj;
|
|
|
|
- let index = this.commonFunctions.findIndex(i=>i.name==item)
|
|
|
|
- if (index && index>=0) {
|
|
|
|
- obj = this.commonFunctions[index]
|
|
|
|
- this.commonFunctions.splice(index, 1)
|
|
|
|
- }
|
|
|
|
- if (isSSO) {
|
|
|
|
- this.ssoList.push(obj)
|
|
|
|
- } else {
|
|
|
|
- this.functions.push(obj)
|
|
|
|
|
|
+ minusFunction(item) {
|
|
|
|
+ let index = this.customFunction.findIndex(i => i.name==item.name);
|
|
|
|
+ if (index) {
|
|
|
|
+ this.customFunction.splice(index, 1);
|
|
|
|
+ if (item.isSso) {
|
|
|
|
+ this.ssoSystems.push(item);
|
|
|
|
+ } else {
|
|
|
|
+ this.functions.push(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|
|
@@ -215,8 +123,8 @@ export default {
|
|
<div class="funcManage-body">
|
|
<div class="funcManage-body">
|
|
<a-row :gutter="16">
|
|
<a-row :gutter="16">
|
|
<transition-group name="common-function">
|
|
<transition-group name="common-function">
|
|
- <a-col :span="6" v-for="(item,index) in commonFunctions" :key="item.name" style="margin-bottom: 12px">
|
|
|
|
- <Function :minus-function="minusFunction" :title="item.name" :type="-1" :icon="require('@/assets/images/function/iocRestaurant.png')"></Function>
|
|
|
|
|
|
+ <a-col :span="6" v-for="(item,index) in customFunction" :key="item.name" style="margin-bottom: 12px">
|
|
|
|
+ <Function :minus-function="minusFunction" :item="item" :type="-1"></Function>
|
|
</a-col>
|
|
</a-col>
|
|
</transition-group>
|
|
</transition-group>
|
|
</a-row>
|
|
</a-row>
|
|
@@ -230,7 +138,7 @@ export default {
|
|
<a-row :gutter="16">
|
|
<a-row :gutter="16">
|
|
<transition-group name="common-function">
|
|
<transition-group name="common-function">
|
|
<a-col :span="6" v-for="(item,index) in functions" :key="item.name" style="margin-bottom: 12px">
|
|
<a-col :span="6" v-for="(item,index) in functions" :key="item.name" style="margin-bottom: 12px">
|
|
- <Function :plus-function="plusFunction" :title="item.name" :type="1"></Function>
|
|
|
|
|
|
+ <Function :plus-function="plusFunction" :item="item" :type="1"></Function>
|
|
</a-col>
|
|
</a-col>
|
|
</transition-group>
|
|
</transition-group>
|
|
</a-row>
|
|
</a-row>
|
|
@@ -242,8 +150,8 @@ export default {
|
|
<div class="funcManage-body">
|
|
<div class="funcManage-body">
|
|
<a-row :gutter="16">
|
|
<a-row :gutter="16">
|
|
<transition-group name="common-function">
|
|
<transition-group name="common-function">
|
|
- <a-col :span="6" v-for="(item, index) in ssoList" :key="item.name" style="margin-bottom: 12px">
|
|
|
|
- <Function :plus-function="plusFunction" :title="item.name" :type="1"></Function>
|
|
|
|
|
|
+ <a-col :span="6" v-for="(item, index) in ssoSystems" :key="item.name" style="margin-bottom: 12px">
|
|
|
|
+ <Function :plus-function="plusFunction" :item="item" :type="1"></Function>
|
|
</a-col>
|
|
</a-col>
|
|
</transition-group>
|
|
</transition-group>
|
|
</a-row>
|
|
</a-row>
|