浏览代码

signinfilter

zhuxc 7 年之前
父节点
当前提交
a4a4dac5eb

+ 3 - 1
scss/linker.scss

@@ -2203,7 +2203,9 @@ ion-header-bar {
     margin-top: 10px;
 }
 
-
+.tab-title{
+    font-size: 1.4em;
+}
 
 
 

+ 2 - 1
www/apps/compmanage/js/controllers.js

@@ -31,7 +31,7 @@ starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDe
     };
 
     $scope.commit = function (r) {
-        $scope.activecomp = _.extend($scope.activecomp, {"cellphone": global.user.cellphone, "imid": global.user.im_usrid, "linkerpassword": global.user.password, "linkerusername": global.user.usrname, "region": 86});
+        $scope.activecomp = _.extend($scope.activecomp, {"cellphone": global.user.cellphone, "imid": global.user.im_usrid, "linkerpassword": "123456", "linkerusername": global.user.usrname, "region": 86});
         global.sn = $scope.serialnumber;
         showPopup.showLoading(1, '正在提交', false);
         Comp.comp("PostComp").save($scope.activecomp, function (data) {
@@ -51,6 +51,7 @@ starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDe
 
     $scope.importDept = function () {
         showPopup.showLoading(1, '导入中', false);
+        global.user.compno = $scope.activecomp.compid;
         Comp.dept("PostDept").save(function (data) {
             $window.location.href = formatFilter("http://" + $location.host() + ":8100/apps/accountMng/index.html#/contacts/-1&{0}&{1}", $scope.activecomp.name, $scope.activecomp.compid);
         }, function (err) {

+ 52 - 0
www/apps/signinfilter/index.html

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
+    <!--<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-eval'; connect-src * 'unsafe-eval'; object-src 'self'; style-src * 'unsafe-inline'; img-src *" >-->
+    <!--     <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> -->
+    <title></title>
+
+    <!-- compiled css output -->
+    <link href="/css/ionic.app.min.css" rel="stylesheet">
+    <link href="/css/linker.min.css" rel="stylesheet">
+
+
+    <script src="/lib/ionic/js/ionic.bundle.min.js"></script>
+    <!-- cordova script (this will be a 404 during development) -->
+    <script src="/lib/ngCordova/dist/ng-cordova.min.js"></script>
+    <!-- cordova script (this will be a 404 during development) -->
+    <script src="/cordova.js"></script>
+    <!-- your app's js -->
+    <script src="/lib/underscore/underscore-min.js"></script>
+    <script src="/lib/angular-resource/angular-resource.min.js"></script>
+    <script src="/lib/angular-underscore-module/angular-underscore-module.js"></script>
+    <script src="/lib/angular-translate/angular-translate.min.js"></script>
+    <script src="/lib/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js"></script>
+    <script src="/js/starter.js"></script>
+    <script src="js/route.js"></script>
+    <script src="js/controllers.js"></script>
+    <script src="js/directive.js"></script>
+    <script src="js/factory.js"></script>
+</head>
+
+<body ng-app="starter" ng-cloak>
+<!--
+  The nav bar that will be updated as we navigate between views.
+-->
+<ion-nav-bar class="bar-stable" ng-cloak>
+    <ion-nav-back-button class="button ion-chevron-left button-clear button-dark">
+        {{'backTitle' | translate}}
+    </ion-nav-back-button>
+</ion-nav-bar>
+<!--
+  The views will be rendered in the <ion-nav-view> directive below
+  Templates are in the /templates folder (but you could also
+  have templates inline in this html file if you'd like).
+-->
+<ion-nav-view></ion-nav-view>
+
+</body>
+</html>
+

+ 82 - 0
www/apps/signinfilter/js/controllers.js

@@ -0,0 +1,82 @@
+starter.controller('SigninFilterCtrl', function ($scope, $state, $ionicPlatform, $interval, $timeout, $rootScope, SigninFilter, showPopup, global, Tool) {
+    $scope.loading = true;
+    global.fetch_user().then(function () {
+        $scope.doRefresh();
+    });
+
+    $scope.loadMore = function () {
+        Tool.get_nextpage($scope.signin.next).then(function (res) {
+            var old_data = angular.copy($scope.signin.Data);
+            $scope.signin = res.Data;
+            $scope.signin.Data = old_data.concat(res.data.Data);
+        }).finally(function (f) {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        })
+    };
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        SigninFilter.signin.get({"condi": 6, "page": 0}, function (res) {
+            console.log(res);
+            $scope.signin = res;
+            get_results($scope.signin.Data)
+        }).$promise.finally(function (f) {
+            $scope.loading = false;
+            $scope.$broadcast('scroll.refreshComplete');
+        })
+    };
+
+    $scope.date_list = [
+        {"value": "去年", "key": 9},
+        {"value": "本年", "key": 8},
+        {"value": "上季", "key": 7},
+        {"value": "本季", "key": 6},
+        {"value": "上月", "key": 5},
+        {"value": "本月", "key": 4},
+        {"value": "上周", "key": 3},
+        {"value": "本周", "key": 2},
+        {"value": "当日", "key": 1},
+        {"value": "全部", "key": 0}
+    ].reverse();
+
+    $scope.acitve_date = $scope.date_list[1];
+
+    showPopup.modalTemplate('templates/modal-filter.html', 'slide-in-right', $scope).then(function (model) {
+        $rootScope.commons.model = model;
+    });
+
+    $scope.openModel = function () {
+        $rootScope.commons.model.show();
+    };
+
+    $scope.change = function (item) {
+        if ($scope.acitve_date.value == item.value) {
+            $rootScope.commons.model.hide();
+            return;
+        }
+        $scope.acitve_date = item;
+        $scope.loading = true;
+        SigninFilter.signin.get({"condi": item.key, "page": 0}, function (res) {
+            $scope.signin = res;
+            get_results($scope.signin.Data);
+        }, function (err) {
+            alert(JSON.stringify(err))
+        }).$promise.finally(function (f) {
+            $scope.loading = false;
+        });
+        $rootScope.commons.model.hide();
+        console.log(JSON.stringify(item));
+    };
+
+    function get_results(data) {
+        var date_list = _.uniq(_.map(data, function (item) {
+            item.date = item.bil_date.substring(0, 10);
+            return item.bil_date.substring(0, 10);
+        }));
+        data = _.map(date_list, function (item) {
+            return {'date': item, "daystr": Tool.getTranslateByKey("weekdays", new Date(item).getDay()), "items": _.filter(data, {"date": item})}
+        });
+        $scope.signin.Data = data;
+
+    }
+})

+ 0 - 0
www/apps/signinfilter/js/directive.js


+ 18 - 0
www/apps/signinfilter/js/factory.js

@@ -0,0 +1,18 @@
+starter.factory('SigninFilter', function ($resource, $q, $filter, cfg, formatFilter, global) {
+    var signinfilter = {};
+    signinfilter.signin = $resource(formatFilter('{0}ext_erp/Clock/GetData/', cfg.api));
+    return signinfilter;
+})
+
+.config(function ($httpProvider) {
+    $httpProvider.interceptors.push(function ($q, cfg, global) {
+        return {
+            'request': function (config) {
+                if (config.url.indexOf("ext_erp") != -1) {
+                    config.headers['cid'] = JSON.stringify({"linkid": global.user.compno, "langid": "TW", "phone": global.user.cellphone});
+                }
+                return config;
+            }
+        };
+    });
+})

+ 8 - 0
www/apps/signinfilter/js/route.js

@@ -0,0 +1,8 @@
+starter.config(function ($stateProvider, $translateProvider) {
+    $stateProvider.state('signinfilter', {
+        url: '/index',
+        templateUrl: 'templates/signinfilter.html',
+        controller: 'SigninFilterCtrl'
+    })
+})
+

+ 39 - 0
www/apps/signinfilter/templates/signinfilter.html

@@ -0,0 +1,39 @@
+<ion-view view-title="打卡记录">
+    <ion-nav-buttons side="left">
+        <ion-back-button></ion-back-button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="openModel()">
+            <i class="icon ion-navicon"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="none-content center" ng-if="signin.Data.length==0">{{acitve_date.key==0?"":acitve_date.value}}记录为空!</div>
+        <!--<ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>-->
+        <div ng-repeat="item in signin.Data">
+            <div class="item item-divider divider-font"><i class="icon ion-ios-star"></i>{{item.date}} | {{item.daystr}}</div>
+            <ion-item class="item item-text-wrap" ng-repeat="date_item in item.items">
+                {{date_item.bil_date}}
+            </ion-item>
+        </div>
+
+    </ion-content>
+    <script id="templates/modal-filter.html" type="text/ng-template">
+        <ion-modal-view>
+            <ion-header-bar class="bar bar-header">
+                <button class="button ion-chevron-left button-clear button-dark" ng-click="commons.model.hide()">&nbsp;返回</button>
+                <h1 class="title">选择</h1>
+            </ion-header-bar>
+            <ion-content>
+                <div class="item item-divider"></div>
+                <ion-list>
+                    <div ng-repeat="item in date_list">
+                        <ion-radio ng-model="acitve_date" ng-value="item" ng-click="change(item)">
+                            {{item.key+"."}}{{item.value}}
+                        </ion-radio>
+                    </div>
+                </ion-list>
+            </ion-content>
+        </ion-modal-view>
+    </script>
+</ion-view>

+ 1 - 0
www/js/start/config.js

@@ -95,6 +95,7 @@ starter.run(function ($ionicPlatform, $rootScope, $http, formatFilter, $q, $cord
         global.user = data;
         if (data.cfg && (ionic.Platform.platform() == "ios" || ionic.Platform.platform() == 'android')) {
             global.api = data.cfg.api;
+            global.api = "http://srv.linkerplus.com";//todo:测试
         } else {
             global.api = "http://srv.linkerplus.com";
         }