|
|
@@ -161,10 +161,530 @@ o2.xDesktop.Default = new Class({
|
|
|
|
|
|
this.fireEvent("load");
|
|
|
MWF.require("MWF.xDesktop.shortcut");
|
|
|
+
|
|
|
+
|
|
|
+ var CustomMenuService = new Class({
|
|
|
+ Implements: [Options, Events],
|
|
|
+ options : {
|
|
|
+ tableFlag : ""
|
|
|
+ },
|
|
|
+ initialize : function( options ){
|
|
|
+ this.setOptions( options || {});
|
|
|
+ this.action = new _self.Action("x_query_assemble_surface", {
|
|
|
+ "listPaging" : {
|
|
|
+ "uri" : "/jaxrs/table/list/{tableFlag}/row/{id}/next/{count}",
|
|
|
+ "method": "POST"
|
|
|
+ },
|
|
|
+ "listRowNext" : {
|
|
|
+ "uri" : "/jaxrs/table/list/{tableFlag}/row/{id}/next/{count}",
|
|
|
+ "method": "GET"
|
|
|
+ },
|
|
|
+ "listRowPrev" : {
|
|
|
+ "uri" : "/jaxrs/table/list/{tableFlag}/row/{id}/prev/{count}",
|
|
|
+ "method": "GET"
|
|
|
+ },
|
|
|
+ //通过where 获取表中的数据,格式为jpa jpql语法,o.name='zhangsan'
|
|
|
+ "listRowSelectWhere" : {
|
|
|
+ "uri" : "/jaxrs/table/list/{tableFlag}/row/select/where/{where}",
|
|
|
+ "method": "GET"
|
|
|
+ },
|
|
|
+ "rowGet" : {
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row/{id}", //获取表中某一行数据
|
|
|
+ "method": "GET"
|
|
|
+ },
|
|
|
+ "rowUpdate":{
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row/{id}", //更新指定表中指定行数据.
|
|
|
+ "method": "PUT"
|
|
|
+ },
|
|
|
+ "rowInsert":{
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row", //插入一行
|
|
|
+ "method": "POST"
|
|
|
+ },
|
|
|
+ "rowCountWhere" : {
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row/count/where/{where}", //通过where 统计数量
|
|
|
+ "method": "GET"
|
|
|
+ },
|
|
|
+ "rowDelete" : {
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row/{id}", //更新指定表中指定行数据.
|
|
|
+ "method": "DELETE"
|
|
|
+ },
|
|
|
+ "rowDeleteAll" : {
|
|
|
+ "uri": "/jaxrs/table/{tableFlag}/row/delete/all", //通过where 统计数量
|
|
|
+ "method": "DELETE"
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ listNext : function(rowId, count, callback_success, callback_fail, async){
|
|
|
+ var opt = {
|
|
|
+ "name": "listRowNext",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "id" : rowId,
|
|
|
+ "count" : count || 20
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke( opt );
|
|
|
+ },
|
|
|
+ listPrev : function(rowId, count, callback_success, callback_fail, async){
|
|
|
+ var opt = {
|
|
|
+ "name": "listRowPrev",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "id" : rowId,
|
|
|
+ "count" : count || 20
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ }
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ listByWhere : function(where, callback_success, callback_fail, async){
|
|
|
+ var opt = {
|
|
|
+ "name": "listRowSelectWhere",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "where" : where
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ get : function( rowId, callback_success, callback_fail, async ){
|
|
|
+ var opt = {
|
|
|
+ "name": "rowGet",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "id" : rowId
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ create : function( data, callback_success, callback_fail, async ){
|
|
|
+ data.o2_createPerson = layout.desktop.session.user.distinguishedName;
|
|
|
+ data.o2_createUnit = Utils.getCurrentDepartment();
|
|
|
+ var opt = {
|
|
|
+ "name": "rowInsert",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag
|
|
|
+ },
|
|
|
+ "data" : data,
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ update : function( rowId, data, callback_success, callback_fail, async ){
|
|
|
+ data.o2_updatePerson = layout.desktop.session.user.distinguishedName;
|
|
|
+ var opt = {
|
|
|
+ "name": "rowUpdate",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "id" : rowId
|
|
|
+ },
|
|
|
+ "data" : data,
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ save : function( data, callback_success, callback_fail, async ){
|
|
|
+ var opt = {
|
|
|
+ "name": data.id ? "rowUpdate" : "rowInsert",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag
|
|
|
+ },
|
|
|
+ "data" : data,
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(data.id)opt.parameter.id = data.id;
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ count : function( where, callback_success, callback_fail, async ){
|
|
|
+ var opt = {
|
|
|
+ "name": "rowGet",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "where" : where
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ delete : function( rowId, callback_success, callback_fail, async ){
|
|
|
+ var opt = {
|
|
|
+ "name": "rowDelete",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag,
|
|
|
+ "id" : rowId
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ },
|
|
|
+ deleteAll : function( callback_success, callback_fail, async ){
|
|
|
+ var opt = {
|
|
|
+ "name": "rowDelete",
|
|
|
+ "parameter": {
|
|
|
+ "tableFlag": this.options.tableFlag
|
|
|
+ },
|
|
|
+ "success": function(json){
|
|
|
+ if(callback_success)callback_success(json);
|
|
|
+ }.bind(this),
|
|
|
+ "async" : async
|
|
|
+ };
|
|
|
+ if( callback_fail ){
|
|
|
+ opt.failure = function(xhr, text, error){
|
|
|
+ callback_fail( xhr, text, error );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.action.invoke(opt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ var service = new CustomMenuService({ tableFlag : "customMenu" });
|
|
|
+ Vue.component('SysMenu', {
|
|
|
+ template: `
|
|
|
+ <el-menu-item v-if="isLeaf" :index="menu.id" @click="menuClick(menu.params)">
|
|
|
+ <i :class="menu.icon" v-if="menu.icon"></i
|
|
|
+ ><span slot="title">{{ menu.name }}</span>
|
|
|
+ </el-menu-item>
|
|
|
+ <el-submenu v-else :index="menu.id">
|
|
|
+ <template slot="title">
|
|
|
+ <i :class="menu.icon" v-if="menu.icon"></i>
|
|
|
+ <span slot="title">{{ menu.name }}</span>
|
|
|
+ </template>
|
|
|
+ <sys-menu
|
|
|
+ v-for="item in menu.children"
|
|
|
+ :menu="item"
|
|
|
+ :key="item.id"
|
|
|
+ @menuClick="menuClick"
|
|
|
+ ></sys-menu>
|
|
|
+ </el-submenu>`,
|
|
|
+ props: {
|
|
|
+ menu: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ menuClick(param) {
|
|
|
+ this.$emit("menuClick", param);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isLeaf() {
|
|
|
+ return !(
|
|
|
+ this.menu.children instanceof Array && this.menu.children.length
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ var _self = this;
|
|
|
new Vue({
|
|
|
el: '#app',
|
|
|
data: function () {
|
|
|
- return { visible: false }
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ userMenus: [],
|
|
|
+ menus: [
|
|
|
+ {
|
|
|
+ id: "0",
|
|
|
+ name: "主页",
|
|
|
+ params: [null, "Homepage"],
|
|
|
+ icon: "fas fa-home",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1",
|
|
|
+ name: "组织管理",
|
|
|
+ params: [null, "Org"],
|
|
|
+ icon: "fas fa-sitemap",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "2",
|
|
|
+ name: "公文管理",
|
|
|
+ params: [null, "process.TaskCenter"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "3",
|
|
|
+ name: "公文模版管理",
|
|
|
+ params: "公文模版",
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "4",
|
|
|
+ name: "工作事务处理",
|
|
|
+ icon: "fas fa-calendar-alt",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: "4-1",
|
|
|
+ name: "工作计划",
|
|
|
+ params: [null, "TeamWork"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "4-2",
|
|
|
+ name: "接待管理",
|
|
|
+ params: [null, "Meeting"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "4-3",
|
|
|
+ name: "日常事务",
|
|
|
+ params: [null, "Calendar"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "4-4",
|
|
|
+ name: "会议管理",
|
|
|
+ params: [null, "Meeting"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "5",
|
|
|
+ name: "公共信息服务",
|
|
|
+ icon: "fas fa-file-alt",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: "5-1",
|
|
|
+ name: "内容管理",
|
|
|
+ params: [null, "cms.Column"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "5-2",
|
|
|
+ name: "信息平台",
|
|
|
+ params: [null, "cms.Index"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "6",
|
|
|
+ name: "内务管理",
|
|
|
+ icon: "fas fa-file-alt",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: "6-1",
|
|
|
+ name: "车辆管理",
|
|
|
+ params: "车辆管理",
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "6-2",
|
|
|
+ name: "会议管理",
|
|
|
+ params: [null, "Meeting"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "6-3",
|
|
|
+ name: "资产管理",
|
|
|
+ params: [
|
|
|
+ null,
|
|
|
+ "portal.Portal",
|
|
|
+ {
|
|
|
+ portalId:
|
|
|
+ "4f6c9f1f-432f-4836-9d42-0060b65634fe",
|
|
|
+ appId: "portal.Portal4f6c9f1f-432f-4836-9d42-0060b65634fe",
|
|
|
+ event: null,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "6-4",
|
|
|
+ name: "人事管理",
|
|
|
+ params: [null, "Org", {}, { navi: 3 }],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "6-5",
|
|
|
+ name: "绩效管理",
|
|
|
+ params: "绩效管理",
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "7",
|
|
|
+ name: "资料管理",
|
|
|
+ params: [null, "File"],
|
|
|
+ icon: "fas fa-file",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8",
|
|
|
+ name: "个人事务管理",
|
|
|
+ icon: "fas fa-file-alt",
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ id: "8-1",
|
|
|
+ name: "事务提醒",
|
|
|
+ params: [null, "Calendar"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8-2",
|
|
|
+ name: "通讯录",
|
|
|
+ params: [
|
|
|
+ null,
|
|
|
+ "portal.Portal",
|
|
|
+ {
|
|
|
+ appId: "portal.Portal0e0d08d4-2435-481e-bb1d-25c79c614080",
|
|
|
+ portalId:
|
|
|
+ "0e0d08d4-2435-481e-bb1d-25c79c614080",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8-3",
|
|
|
+ name: "日程安排",
|
|
|
+ params: [null, "Calendar"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8-4",
|
|
|
+ name: "在线学习",
|
|
|
+ params: [null, "File"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8-5",
|
|
|
+ name: "个人资料",
|
|
|
+ params: [null, "Profile"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "8-6",
|
|
|
+ name: "考勤管理",
|
|
|
+ params: [null, "Attendance"],
|
|
|
+ icon: "fas fa-suitcase",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "9",
|
|
|
+ name: "系统管理",
|
|
|
+ params: [null, "Setting"],
|
|
|
+ icon: "fas fa-user-cog",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created: function() {
|
|
|
+ _self.org.listRoleWithPerson(_self.session.user.id, true).then(function(res){
|
|
|
+ let where = res.map(function(i) {
|
|
|
+ return "o.role = '" + i.unique + "'"
|
|
|
+ }).join(' or ');
|
|
|
+ if(!where) {
|
|
|
+ where = "o.role = 'NormalUser'"
|
|
|
+ }
|
|
|
+ service.listByWhere(where, function(res) {
|
|
|
+ let menus = [];
|
|
|
+ if(res.data){
|
|
|
+ res.data.forEach(function(item){
|
|
|
+ if(item.menu){
|
|
|
+ item.menu.split(',').forEach(function(m){
|
|
|
+ if(!menus.includes(m)){
|
|
|
+ menus.push(m);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function filterMenu(data) {
|
|
|
+ let filterd = [];
|
|
|
+ data.forEach(function(item){
|
|
|
+ if(item.children && item.children.length){
|
|
|
+ item.children = filterMenu(item.children);
|
|
|
+ if(item.children.length > 0){
|
|
|
+ filterd.push(item);
|
|
|
+ }
|
|
|
+ } else if(menus.includes(item.id)){
|
|
|
+ filterd.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return filterd;
|
|
|
+ }
|
|
|
+ this.userMenus = filterMenu(this.menus);
|
|
|
+ }.bind(this), null, false);
|
|
|
+ }.bind(this))
|
|
|
},
|
|
|
methods: {
|
|
|
handleOpen(key, keyPath) {
|
|
|
@@ -173,6 +693,13 @@ o2.xDesktop.Default = new Class({
|
|
|
handleClose(key, keyPath) {
|
|
|
console.log(key, keyPath);
|
|
|
},
|
|
|
+ menuClick(e) {
|
|
|
+ if (e instanceof Array) {
|
|
|
+ this.open(e[0], e[1], e[2], e[3]);
|
|
|
+ } else {
|
|
|
+ this.open(e);
|
|
|
+ }
|
|
|
+ },
|
|
|
open(e, appNames, options, statusObj) {
|
|
|
console.log(e, appNames, options, statusObj);
|
|
|
if (e === "车辆管理") {
|