若依框架使用总结说明
生活随笔
收集整理的這篇文章主要介紹了
若依框架使用总结说明
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
不分離版
1、項目結構
2、若依配置主頁菜單問題
1、在主頁菜單管理中配置頁面路徑,權限;其中路徑對應controller里的請求路徑和頁面存放的位置
2、通常左側菜單欄有多個模塊,一個模塊通常對應一個文件夾,一個文件夾下會有多個頁面,通常路徑名相同的頁面對應主頁面,add對應添加按鈕,edit對應修改按鈕等。
3、頁面如何實現跳轉和關聯
通過表格初始化,在參數中設置url,每一個url對應controller里的路徑,通過同一個controller實現頁面跳轉和關聯。
$(function() {var options = {code: "menuId",parentCode: "parentId",uniqueId: "menuId",expandAll: false,expandFirst: false,url: prefix + "/list",createUrl: prefix + "/add/{id}",updateUrl: prefix + "/edit/{id}",removeUrl: prefix + "/remove/{id}",modalName: "菜單",columns: [{field: 'selectItem', radio: true},{title: '菜單名稱',field: 'menuName',width: '20',widthUnit: '%',formatter: function(value, row, index) {if ($.common.isEmpty(row.icon)) {return row.menuName;} else {return '<i class="' + row.icon + '"></i> <span class="nav-label">' + row.menuName + '</span>';}}},{field: 'orderNum',title: '排序',width: '10',widthUnit: '%',align: "left"},{field: 'url',title: '請求地址',width: '15',widthUnit: '%',align: "left",formatter: function(value, row, index) {return $.table.tooltip(value);}},{title: '類型',field: 'menuType',width: '10',widthUnit: '%',align: "left",formatter: function(value, item, index) {if (item.menuType == 'M') {return '<span class="label label-success">目錄</span>';}else if (item.menuType == 'C') {return '<span class="label label-primary">菜單</span>';}else if (item.menuType == 'F') {return '<span class="label label-warning">按鈕</span>';}}},{field: 'visible',title: '可見',width: '10',widthUnit: '%',align: "left",formatter: function(value, row, index) {if (row.menuType == 'F') {return '-';}return $.table.selectDictLabel(datas, row.visible);}},{field: 'perms',title: '權限標識',width: '15',widthUnit: '%',align: "left",formatter: function(value, row, index) {return $.table.tooltip(value);}},{title: '操作',width: '20',widthUnit: '%',align: "left",formatter: function(value, row, index) {var actions = [];actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>編輯</a> ');actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> ');actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.menuId + '\')"><i class="fa fa-trash"></i>刪除</a>');return actions.join('');}}]};$.treeTable.init(options);});4、頁面表格如何實現顯示
如上代碼,若依封裝了表格的options,通過請求和回調參數,使用column設置表格的列,還可添加相關按鈕
5、使用若依框架上傳下載zip思路
1、若依框架上傳可分為兩步:
1)將文件ajax上傳后執行回調函數
2)使用回調函數異步將數據插入數據庫
2、zip類文件下載也可兩步:
1)使用ajax異步,將文件壓縮至通用下載目錄執行回調函數
2)回調函數再次執行請求,去controller里調用通用下載方法即可
未完待續。。。。。。。。
總結
以上是生活随笔為你收集整理的若依框架使用总结说明的全部內容,希望文章能夠幫你解決所遇到的問題。