Преглед изворни кода

修复员工界面展示功能

吴学文 пре 7 година
родитељ
комит
d8170bb157

+ 3 - 1
WebService/src/main/resources/components/pagination/pagination.html

@@ -3,7 +3,9 @@
         <li class="page-item" v-bind:class="{disabled:paginationInfo.currentPage == 1}">
             <a class="page-link" v-on:click="previous()">上一页</a>
         </li>
-        <li class="page-item" v-for="index in paginationInfo.total"><a class="page-link" v-on:click="current(index)">{{index}}</a></li>
+        <li class="page-item"  v-for="index in paginationInfo.total" v-bind:class="{active:index == paginationInfo.currentPage}">
+            <a class="page-link" v-on:click="current(index)">{{index}}</a>
+        </li>
         <li class="page-item" v-bind:class="{disabled:paginationInfo.currentPage == paginationInfo.total}">
             <a class="page-link" v-on:click="next()">下一页</a>
         </li>

+ 2 - 2
WebService/src/main/resources/components/pagination/pagination.js

@@ -12,7 +12,7 @@
         _initEvent:function(){
              vc.component.$on('pagination_info_event',function(_paginationInfo){
                     vc.component.paginationInfo.total = _paginationInfo.total;
-                    vc.component.paginationInfo.total = _paginationInfo.currentPage;
+                    vc.component.paginationInfo.currentPage = _paginationInfo.currentPage;
                 });
         },
         methods:{
@@ -33,7 +33,7 @@
 
             },
             current:function(_page){
-                if(_page > vc.component.paginationInfo.currentPage){
+                if(_page > vc.component.paginationInfo.total){
                     return ;
                 }
                 vc.component.paginationInfo.currentPage = _page;

+ 3 - 3
WebService/src/main/resources/components/staff/staff.html

@@ -29,10 +29,10 @@
                                 <td>{{staff.name}}</td>
                                 <td>{{staff.email}}</td>
                                 <td>{{staff.address}}</td>
-                                <td>{{staff.sex}}</td>
+                                <td>{{staff.sex == 0 ? '男' : '女'}}</td>
                                 <td>{{staff.tel}}</td>
-                                <td>{{staff.statusCd}}</td>
-                                <td>{{staff.createTime}}</td>
+                                <td>{{staff.statusCd == 0 ? '在用':'停用'}}</td>
+                                <td>{{vc.dateFormat(staff.createTime)}}</td>
                                 <td>
                                     <i class="glyphicon glyphicon-edit" style="color: #17a2b8;" v-on:click="openEditStaff(staff)"></i>
                                     <i v-if="staff.relCd != 600311000001" class="glyphicon glyphicon-remove-sign" style="color: #dc3545;margin-left:5px"></i>

+ 8 - 8
WebService/src/main/resources/components/staff/staff.js

@@ -5,27 +5,27 @@
 
             },
             _initMethod:function(){
-                vc.component.loadData();
+                vc.component.loadData(1,10);
             },
             _initEvent:function(){
                  vc.component.$on('pagination_page_event',function(_currentPage){
                         vc.component.currentPage(_currentPage);
                     });
                  vc.component.$on('addStaff_reload_event',function(){
-                     vc.component.loadData();
+                     vc.component.loadData(1,10);
                  });
                  vc.component.$on('editStaff_reload_event',function(){
-                      vc.component.loadData();
+                      vc.component.loadData(1,10);
                   });
 
 
             },
             methods:{
-                loadData:function(){
+                loadData:function(_page,_rows){
                     var param = {
                         params:{
-                            page:1,
-                            rows:10
+                            page:_page,
+                            rows:_rows
                         }
                     };
 
@@ -37,7 +37,7 @@
                                     var _staffInfo = JSON.parse(json);
                                     vc.component.staffData = _staffInfo.datas;
                                     vc.component.$emit('pagination_info_event',{
-                                        total:_staffInfo.total,
+                                        total:_staffInfo.records,
                                         currentPage:_staffInfo.page
                                     });
 
@@ -48,7 +48,7 @@
 
                 },
                 currentPage:function(_currentPage){
-
+                    vc.component.loadData(_currentPage,10);
                 },
                 openEditStaff:function(_staffInfo){
                      vc.component.$emit('edit_staff_event',_staffInfo);

+ 19 - 1
WebService/src/main/resources/static/js/core.js

@@ -145,4 +145,22 @@
     }
 
 
-})(window,window.vc);
+})(window,window.vc);
+
+/**
+    时间处理工具类
+**/
+(function(vc){
+    function add0(m){return m<10?'0'+m:m }
+    vc.dateFormat = function(shijianchuo){
+      //shijianchuo是整数,否则要parseInt转换
+      var time = new Date(parseInt(shijianchuo));
+      var y = time.getFullYear();
+      var m = time.getMonth()+1;
+      var d = time.getDate();
+      var h = time.getHours();
+      var mm = time.getMinutes();
+      var s = time.getSeconds();
+      return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
+    }
+})(window.vc);