Browse Source

添加界面导航

hy 6 years ago
parent
commit
ce3832016e

+ 23 - 207
app/data/DataList.js

@@ -2,206 +2,28 @@
  * @Description: 
  * @Author: hy
  * @Date: 2019-08-14 17:41:15
- * @LastEditTime: 2019-08-16 15:39:47
+ * @LastEditTime: 2019-08-19 15:50:58
  */
 Ext.define('uas.data.DataList', {
     requires: [
         'uas.data.Init'
     ]
 }, function() {
-    var dataLists = {
-        "total": "27",
-        "data": [{
-            "id": "1",
-            "price": "71.72",
-            "company": "3m Co",
-            "date": "2007-09-01",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "2",
-            "price": "31.61",
-            "company": "AT&T Inc.",
-            "date": "2008-02-01",
-            "size": "extra large",
-            "visible": "0"
-        }, {
-            "id": "3",
-            "price": "29.01",
-            "company": "Aloca Inc",
-            "date": "2007-08-01",
-            "size": "medium",
-            "visible": "0"
-        }, {
-            "id": "4",
-            "price": "83.81",
-            "company": "Altria Group Inc",
-            "date": "2007-08-03",
-            "size": "large",
-            "visible": "0"
-        }, {
-            "id": "5",
-            "price": "52.55",
-            "company": "American Express Company",
-            "date": "2008-01-04",
-            "size": "extra large",
-            "visible": "1"
-        }, {
-            "id": "6",
-            "price": "64.13",
-            "company": "American International Group Inc.",
-            "date": "2008-03-04",
-            "size": "small",
-            "visible": "1"
-        }, {
-            "id": "7",
-            "price": "75.43",
-            "company": "Boeing Co.",
-            "date": "2008-01-01",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "8",
-            "price": "67.27",
-            "company": "Caterpillar Inc.",
-            "date": "2007-12-03",
-            "size": "medium",
-            "visible": "1"
-        }, {
-            "id": "9",
-            "price": "49.37",
-            "company": "Citigroup, Inc.",
-            "date": "2007-11-24",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "10",
-            "price": "40.48",
-            "company": "E.I. du Pont de Nemours and Company",
-            "date": "2007-05-09",
-            "size": "extra large",
-            "visible": "0"
-        }, {
-            "id": "11",
-            "price": "68.1",
-            "company": "Exxon Mobile Corp",
-            "date": "2007-12-12",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "12",
-            "price": "34.14",
-            "company": "General Electric Company",
-            "date": "2008-06-16",
-            "size": "extra large",
-            "visible": "1"
-        }, {
-            "id": "13",
-            "price": "30.27",
-            "company": "General Motors Corporation",
-            "date": "2006-12-07",
-            "size": "medium",
-            "visible": "1"
-        }, {
-            "id": "14",
-            "price": "36.53",
-            "company": "Hewlett-Packard Co.",
-            "date": "2007-05-13",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "15",
-            "price": "38.77",
-            "company": "Honweywell Intl Inc",
-            "date": "2006-11-07",
-            "size": "medium",
-            "visible": "0"
-        }, {
-            "id": "16",
-            "price": "19.88",
-            "company": "Intel Corporation",
-            "date": "2007-01-09",
-            "size": "small",
-            "visible": "1"
-        }, {
-            "id": "17",
-            "price": "81.41",
-            "company": "International Business Machines",
-            "date": "2005-01-21",
-            "size": "extra large",
-            "visible": "1"
-        }, {
-            "id": "18",
-            "price": "64.72",
-            "company": "Johnson & Johnson",
-            "date": "2008-01-10",
-            "size": "extra large",
-            "visible": "1"
-        }, {
-            "id": "19",
-            "price": "45.73",
-            "company": "JP Morgan & Chase & Co",
-            "date": "2008-02-20",
-            "size": "large",
-            "visible": "0"
-        }, {
-            "id": "20",
-            "price": "36.76",
-            "company": "McDonald's Corporation",
-            "date": "2007-06-12",
-            "size": "large",
-            "visible": "1"
-        }, {
-            "id": "21",
-            "price": "27.96",
-            "company": "Pfizer Inc",
-            "date": "2007-12-30",
-            "size": "small",
-            "visible": "0"
-        }, {
-            "id": "22",
-            "price": "45.07",
-            "company": "The Coca-Cola Company",
-            "date": "2007-01-30",
-            "size": "medium",
-            "visible": "0"
-        }, {
-            "id": "23",
-            "price": "34.64",
-            "company": "The Home Depot, Inc",
-            "date": "2006-12-31",
-            "size": "small",
-            "visible": "1"
-        }, {
-            "id": "24",
-            "price": "61.91",
-            "company": "The Procter & Gamble Company",
-            "date": "2007-04-08",
-            "size": "extra large",
-            "visible": "1"
-        }, {
-            "id": "25",
-            "price": "63.26",
-            "company": "United Technologies Corporation",
-            "date": "2006-06-04",
-            "size": "medium",
-            "visible": "1"
-        }, {
-            "id": "26",
-            "price": "35.57",
-            "company": "Verizon Communications",
-            "date": "2005-07-09",
-            "size": "small",
-            "visible": "0"
-        }, {
-            "id": "27",
-            "price": "45.45",
-            "company": "Wal-Mart Stores, Inc",
-            "date": "2006-09-09",
-            "size": "large",
-            "visible": "1"
-        }]
-    };
+    var dataLists = [];
+    for(let i=0;i<1000;i++){
+        dataLists.push({
+            id:(i+1),
+            code:"PU"+(2019081900000001+Number(i))+"",
+            status:(i%5)===0?"已审核":"在录入",
+            date:"2019-08-19",
+            vendor:(i%2)===0?"广东省深圳市南山区供应商A001":"广东省广州市天河区供应商B002",
+            price:(Math.random()*(3000-1000)+10).toFixed(2),
+            currency:"RMB",
+            recordman:"小明",
+            auditman:"大明",
+            special:(i%2)===0?true:false,
+        })
+    }
 
     //from https://git.daplie.com/Daplie/knuth-shuffle/
     function shuffle (array) {
@@ -230,23 +52,17 @@ Ext.define('uas.data.DataList', {
     Ext.ux.ajax.SimManager.register({
         type: 'json',
         delay: 300,
-        url: /\/uas\/DataList(\/\d+)?/,
+        url:/\/uas\/DataList/,
 
         data: function(ctx) {
-            var idPart = ctx.url.match(this.url)[1],
-                id;
-
-            if (idPart) {
-                id = parseInt(idPart.substring(1), 10);
+            //获取过滤条件
 
-                return Ext.Array.findBy(dataLists, function(dataList) {
-                    return dataList.id === id;
-                });
-            } else if (ctx.params.shuffle) {
-                return shuffle(dataLists);
-            }
+            // return Ext.Array.filter(dataLists, function(dataList) {
+            //     return dataList.id > start && dataList.id <= page*limit;
+            // });
 
-            return dataLists;
+            return dataLists
+            
         }
     });
 });

+ 3 - 1
app/store/DataListGridStore.js

@@ -2,12 +2,13 @@
  * @Description: 列表store
  * @Author: hy
  * @Date: 2019-08-12 18:34:16
- * @LastEditTime: 2019-08-16 15:14:33
+ * @LastEditTime: 2019-08-19 14:53:38
  */
 Ext.define('uas.store.DataListGridStore', {
     extend: 'Ext.data.Store',
     alias: 'store.dataListGridStore',
     model: 'uas.model.DataListGridModel',
+    pageSize: 30,
     proxy: {
         type: 'ajax',
         url: '/uas/DataList',
@@ -18,5 +19,6 @@ Ext.define('uas.store.DataListGridStore', {
             totalProperty: 'total'
         }
     },
+    autoLoad:true,
     remoteSort: false
 });

+ 53 - 42
app/view/grid/dataList/DataListPanel.js

@@ -2,12 +2,17 @@
  * @Description: 数据列表
  * @Author: hy
  * @Date: 2019-08-12 18:33:04
- * @LastEditTime: 2019-08-16 18:18:07
+ * @LastEditTime: 2019-08-19 14:55:29
  */
 Ext.define('uas.view.grid.dataList.DataListPanel', {
     extend: 'Ext.grid.Panel',
     xtype: 'dataListPanel',
 
+    requires: [
+        'Ext.toolbar.Paging',
+        'Ext.ux.PreviewPlugin'
+    ],
+    
     plugins: {
         gridHeaderFilter: true
     },
@@ -36,65 +41,59 @@ Ext.define('uas.view.grid.dataList.DataListPanel', {
         items:['->']
     },
 
+    bbar: {
+        xtype: 'pagingtoolbar',
+        displayInfo: true,
+        displayMsg: '显示 {0} - {1} 每页显示{3} 共 {2} 行',
+        emptyMsg: "无数据"
+    },
+
     columns: [{
         dataIndex: 'id',
-        text: 'Id',
-        width:50,
+        text: '序号',
+        width:60,
         locked: true
-
-        // Specify that this column has an associated Filter. This is
-        // processed by the gridfilters plugin. If this is a string,
-        // this is the type of filter to apply.
-        // filter: 'number'
     }, {
-        dataIndex: 'company',
-        text: 'Company',
-        width:150,
-        flex: 1,
+        dataIndex: 'code',
+        text: '采购单号',
+        width:240,
         locked: true,
-
-        // As an object, the type property indicates the type of filter to
-        // apply. All other properties configure that filter instance.
         filter: {
             type:'string'
         }
     }, {
-        dataIndex: 'price',
-        text: 'Price',
-        formatter: 'usMoney',
-        flex: 1,
-
+        dataIndex: 'status',
+        text: '单据状态',
+        width:100,
         filter: {
-            type:'number'
-        }
-    }, {
-        dataIndex: 'size',
-        text: 'Size',
-        flex: 1,
-
-        filter: {
-            type:'combo',
-            combo:[
-                ["small", "小"],
-                ["medium", "中"],
-                ["large", "大"],
-                ["extra large", "最大"]
-            ]
+            type:'string'
         }
     }, {
         xtype: 'datecolumn',
         dataIndex: 'date',
-        text: 'Date',
-        flex: 1,
-
+        text: '下单日期',
+        width: 200,
         filter: {
             type:'date'
         }
     }, {
-        dataIndex: 'visible',
-        text: 'Visible',
-        flex: 1,
-
+        dataIndex: 'vendor',
+        text: '供应商名',
+        width: 220,
+        filter: {
+            type:'string'
+        }
+    }, {
+        dataIndex: 'price',
+        text: '含税金额',
+        width:190,
+        filter: {
+            type:'number'
+        }
+    },{
+        dataIndex: 'special',
+        text:'特殊采购',
+        width:120,
         filter: {
             type:'combo',
             combo:[
@@ -102,5 +101,17 @@ Ext.define('uas.view.grid.dataList.DataListPanel', {
                 ["false", "否"]
             ]
         }
+    },{
+        dataIndex: 'currency',
+        text: '币别',
+        width:70
+    },{
+        dataIndex: 'recordman',
+        text: '采购员',
+        width:70
+    },{
+        dataIndex: 'auditman',
+        text: '审核人',
+        width:70
     }]
 });

+ 17 - 5
resources/json/navigation.json

@@ -1,5 +1,8 @@
-[
-    {
+[{
+    "text": "组件",
+    "leaf": false,
+    "iconCls": "x-fa fa-podcast",
+    "children": [{
         "text": "表单",
         "leaf": true,
         "iconCls": "x-fa fa-book"
@@ -18,7 +21,6 @@
             },
             {
                 "text": "筛选头",
-                "target": "dataListPanel",
                 "leaf": true,
                 "iconCls": "x-fa fa-smile-o"
             },
@@ -95,5 +97,15 @@
         "text": "按钮",
         "leaf": true,
         "iconCls": "x-fa fa-book"
-    }
-]
+    }]
+},{
+    "text": "界面",
+    "leaf": false,
+    "iconCls": "x-fa fa-empire",
+    "children": [{
+        "text": "列表界面",
+        "leaf": true,
+        "iconCls": "x-fa fa-smile-o",
+        "target": "dataListPanel"
+    }]
+}]