var starter=angular.module("starter",["ionic","ngResource","underscore","ngCordova","pascalprecht.translate"]);starter.run(["$ionicPlatform","$rootScope","$http","formatFilter","$q","$cordovaPreferences","$ionicLoading","$timeout","$ionicHistory","$cordovaKeyboard","$translate","global","cfg","showPopup",function(e,t,n,o,i,r,a,l,c,s,u,d,p,m){function f(e){cordova.plugins.Keyboard.isVisible=!0,l(function(){cordova.plugins.Keyboard.isVisible=!1},100)}t.commons={refresh:!1,upload_maxcount:10,bigImage:void 0,modal:void 0,goBackIsDisable:void 0,isShowPopup:void 0,fun:null},e.ready(function(){window.cordova&&window.cordova.plugins&&window.cordova.plugins.Keyboard&&(cordova.plugins.Keyboard.hideKeyboardAccessoryBar(!0),cordova.plugins.Keyboard.disableScroll(!0)),window.StatusBar&&StatusBar.styleDefault(),window.cordovaLinker&&window.cordovaLinker.loadFinished("",function(){},function(){}),void 0!==navigator.globalization&&navigator.globalization.getPreferredLanguage(function(e){var t=e.value.split("-")[0];switch("TW"==e.value.split("-")[1]&&(t=e.value),t){case"zh-TW":t="locate-zh_tw";break;case"en":t="locate-en_us";break;case"zh":default:t="locate-zh_cn"}u.use(t).then(function(e){},function(e){})})}),d.fetch_user=function(){var t=i.defer();return d.user&&d.user.token?usergot(d.user,t):"win32"==ionic.Platform.platform()||"linux"==ionic.Platform.platform()?n.post(o("{0}authcheck/",p.api),"imid=zPayHMi6s&password=123456",{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(e){usergot(e.data,t)},function(e){t.reject(e)}):e.ready(function(){r.fetch("user").success(function(e){usergot(ionic.Platform.isAndroid()?JSON.parse(e):e,t)}).error(function(e){t.reject(e)})}),t.promise},usergot=function(e,t){d.user=e,e.cfg&&(d.api=e.cfg.api),t.resolve(e)},d.fetch_user(),d.goBack=function(){void 0!=window.cordovaLinker&&(c.backView()?c.goBack():window.cordovaLinker.goBack(1,function(e){},function(e){}))},window.addEventListener("native.keyboardhide",f),e.registerBackButtonAction(function(e){l(function(){if(t.commons.isShowPopup)m.hideLoading();else{if(t.commons.goBackIsDisable)return!1;s.isVisible()?s.close():t.commons.bigImage?null==t.commons.fun?t.commons.bigImage=!1:(t.commons.fun(),t.commons.fun=null):null!=t.commons.modal?null==t.commons.fun?(t.commons.modal.hide(),t.commons.modal=null):(t.commons.fun(),t.commons.fun=null):c.backView()?null==t.commons.fun?c.goBack():(t.commons.fun(),t.commons.fun=null):d.goBack()}return!1})},201);var g;void 0!=(g=window.localStorage.getItem("global.user"))&&(d.user=JSON.parse(g))}]).config(["$stateProvider","$urlRouterProvider","$ionicConfigProvider","$httpProvider","$provide","$translateProvider","$resourceProvider","cfg",function(e,t,n,o,i,r,a,l){n.platform.ios.tabs.style("standard"),n.platform.ios.tabs.position("bottom"),n.platform.android.tabs.style("standard"),n.platform.android.tabs.position("bottom"),n.platform.ios.navBar.alignTitle("center"),n.platform.android.navBar.alignTitle("center"),n.platform.ios.backButton.previousTitleText("").icon("ion-ios-arrow-thin-left"),n.platform.android.backButton.previousTitleText("").icon("ion-android-arrow-back"),n.platform.ios.views.transition("ios"),n.platform.android.views.transition("android");var c=new RegExp(".(html|js|css|png|jpg)$","i"),s=function(e){return c.test(e)};e.state("selectmember",{url:"/selectmember",templateUrl:"/templates/common/selectmember.html",controller:"SelectMemberCtrl"}).state("selectsinglemember",{url:"/selectsinglemember",templateUrl:"/templates/common/selectsinglemember.html",controller:"SelectSingleMemberCtrl"}).state("selectdept",{url:"/selectdept/:id",templateUrl:"/templates/common/selectdept.html",controller:"SelectDeptCtrl"}).state("fieldtype",{url:"/fieldtype/:id",templateUrl:"/templates/common/fieldtype.html",controller:"FormFieldTypeCtrl"}).state("transfer",{url:"/transfer/:module/:id",templateUrl:"/templates/common/transfer.html",controller:"TransferCtrl"}).state("selectsingledept",{url:"/selectsingledept",templateUrl:"/templates/common/selectsingledept.html",controller:"SelectSingleDeptCtrl"}),t.otherwise("/index"),r.useStaticFilesLoader({prefix:"/i18n/",suffix:".json"}),o.interceptors.push(["$q","cfg","global",function(e,t,n){return{request:function(e){return s(e.url)||!n.refresh&&!n.debug||(e.url+=(-1===e.url.indexOf("?")?"?":"&")+"v="+Date.now(),n.refresh&&(n.refresh=!1)),(e.url.startsWith(t.api)||0==e.url.indexOf(n.api))&&(e.url.startsWith(t.api)&&(e.url=n.api+e.url),n.user.token&&(e.headers.authorization="Token "+n.user.token)),e.timeout=1e4,e},responseError:function(t){return e.reject(t)}}}]),a.defaults.stripTrailingSlashes=!1,a.defaults.actions.update={method:"PUT",params:{id:"@id"}},a.defaults.actions.patch={method:"PATCH"}}]).constant("cfg",{api:"/api/"}).value("global",{user:{usrid:"",token:"",usrname:"",compno:"",compname:"",deptno:"",deptname:"",roleid:"",im_usrid:"",cellphone:"",password:""},api:"",debug:!0,refresh:!1}),_.mixin({diff:function(e,t){var n={C:[],D:[],U:[]};return list_new=_.pluck(e,"id"),list_old=_.pluck(t,"id"),n.D=_.difference(list_old,list_new).join(","),n.C=_.filter(e,function(e){return void 0==e.id}),n.U=_.map(_.filter(e,function(e){return e.isModified&&void 0!=e.id}),_.clone),_.each(n.U,function(e){delete e.isModified}),_.each(n.C,function(e){delete e.isModified}),n}}),"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(e){return 0===this.indexOf(e)}),starter.controller("SelectParentCtrl",["$scope","$state","Member",function(e,t,n){e.deptlst=[],e.emplst=[],e.index=0,e.isUp=!1,e.deptid=1,e.titlename=n.titlename,e.selectedemplst=n.selectedemplst,e.disabled=n.disabled,e.showall=n.showall,e.showgroup=n.showgroup,e.loading=!0,e.leftbtn=[{text:"取消",click:"cancel"},{text:"上一层",click:"up"}]}]).controller("SelectMemberCtrl",["$scope","$state","$ionicHistory","$rootScope","$ionicModal","$timeout","$controller","Dept","Member",function(e,t,n,o,i,r,a,l,c){function s(t){g(e.deptlst),c.selectedemplst=[],c.disabled||(e.selectedemplst=e.selectedemplst.concat(t),c.selectedemplst=e.selectedemplst),p()}function u(t){l.getEmp(t).then(function(n){c.member[t.toString()]=angular.copy(n),e.emplst=n,m(),e.loading=!1})}function d(t){c.member[t.toString()]?k(t):(e.loading=!0,l.getEmp(t).then(function(n){c.member[t.toString()]=angular.copy(n),k(t),e.loading=!1},function(t){e.loading=!1}))}function p(){e.selectcount=e.selectedemplst.length>0?"("+e.selectedemplst.length+")":""}function m(){_.each(e.emplst,function(t){t.selected=!1,t.disabled=!1,t.depname=w.depname,f(t,c.resourcemember,!0),f(t,c.unenabledata,!1),void 0!=_.find(e.selectedemplst,{user_id:t.user_id})&&(t.selected=!0)})}function f(e,t,n){void 0!=_.find(t,{user_id:e.user_id})&&(e.disabled=e.selected=!0,!c.disabled&&n&&(e.disabled=!1))}function g(e){_.each(e,function(e){e.isShow=h(e)})}function h(e){return!(0==l.getChildDept(e.id).length)}var v=(a("SelectParentCtrl",{$scope:e}),i.fromTemplateUrl("/templates/common/modal-selectgroup.html",{scope:e,animation:"slide-in-right"})),b=null;o.commons.goBackIsDisable=!0;e.$on("$ionicView.beforeEnter",function(){0!=c.homerenderdata.length?(e.loading=!1,_.each(c.homerenderdata,function(t){e.deptlst.push(t)}),s(c.resourcemember)):l.getDep().then(function(t){b=_.find(t,function(e){return null==e.parent}),u(b.id),t=_.filter(t,function(e){return e.parent==b.id}),e.deptlst=t,s(c.resourcemember)},function(e){})});e.changeindex=function(t,n){e.index=t,e.deptid=n},e.change=function(t){t.selected?(e.selectedemplst.push(t),c.selectedemplst=e.selectedemplst):(e.selectedemplst=_.filter(e.selectedemplst,function(e){return e.user_id!=parseInt(t.user_id)}),c.selectedemplst=e.selectedemplst),p()},e.up=function(){var t=void 0;c.homerenderdata.length>0&&(t=_.find(c.homerenderdata,function(t){return t.id==parseInt(e.deptid)})),void 0!=t?(e.deptlst=e.deptlst.concat(c.homerenderdata),e.emplst=[],e.index=0):(t=_.find(l.all(),function(t){return t.id==parseInt(e.deptid)}),d(t.parent))},e.cancel=function(){c.selectedemplst=[],c.dialogresult=0,""!=c.cancelroutename?t.go(c.cancelroutename,c.cancelrouteparams):n.goBack()};var w={};e.changedept=function(e){w=e,d(e.id)},e.ok=function(){c.dialogresult=1,c.all=0,""!=c.routename?t.go(c.routename,c.routeparams):n.goBack()},e.selectAll=function(){c.all=1,t.go(c.routename,c.routeparams)},e.back=function(){null!=o.commons.modal&&o.commons.modal.hide()},e.toselectgroup=function(){v.then(function(e){o.commons.modal=e,o.commons.modal.show()})},e.$on("$destroy",function(){o.commons.goBackIsDisable=!1,c.member={}});var k=function(t){e.deptlst=l.getChildDept(t),g(e.deptlst),e.emplst=c.member[t.toString()],m(),e.deptid=t,e.index=b&&t==b.id?0:1}}]).controller("SelectSingleMemberCtrl",["$scope","$ionicHistory","$state","$controller","Dept","Member",function(e,t,n,o,i,r){function a(t){i.getEmp(t).then(function(n){r.member[t.toString()]=angular.copy(n),e.emplst=n,c(),e.loading=!1})}function l(t){r.member[t.toString()]?m(t):(e.loading=!0,i.getEmp(t).then(function(n){r.member[t.toString()]=angular.copy(n),m(t),e.loading=!1}))}function c(){_.each(e.emplst,function(t){t.selected=!1,t.disabled=!1,t.depname=p.depname,_.each(r.resourcemember,function(e){e.user_id==parseInt(t.user_id)&&(t.disabled=!0,t.selected=!0,r.disabled||(t.disabled=!1))}),_.each(e.selectedemplst,function(e){e.user_id==t.user_id&&(t.selected=!0)})})}function s(e){_.each(e,function(e){e.isShow=u(e)})}function u(e){return 0!=i.getChildDept(e.id).length}var d=(o("SelectParentCtrl",{$scope:e}),{});e.init=function(){i.getDep().then(function(t){d=_.find(t,function(e){return null==e.parent}),a(d.id),t=_.filter(t,function(e){return e.parent==d.id}),e.deptlst=t,s(e.deptlst)})},e.changeindex=function(t,n){e.index=t,e.deptid=n},e.change=function(e){r.dialogresult=1,r.selectedemplst.push(e),""!=r.routename?n.go(r.routename,r.routeparams):t.goBack()},e.up=function(){l(_.find(i.all(),function(t){return t.id==parseInt(e.deptid)}).parent)},e.cancel=function(){r.dialogresult=0,r.selectedemplst=[],t.goBack()};var p={};e.changedept=function(e){p=e,l(e.id)},e.deptdisplay=function(){return e.deptlst.length>0};var m=function(t){e.deptlst=i.getChildDept(t),s(e.deptlst),e.emplst=r.member[t.toString()],c(),e.deptid=t,e.index=d&&t==d.id?0:1};e.$on("$destroy",function(){r.member={}})}]).controller("SelectDeptCtrl",["$scope","$state","$ionicHistory","$timeout","$controller","Dept","Member",function(e,t,n,o,i,r,a){function l(n){_.each(n,function(e){e.selected=!1,e.isdisabled=!1,e.ishide=!1,e.disableddesc="",e.isShow=u(e),3==a.datatype?null!=e.diarymobid&&t.params.id!=e.diarymobid&&(e.disableddesc="(已设置)",e.isdisabled=!0):4==a.datatype&&null!=e.workatdsetid&&t.params.id!=e.workatdsetid&&(e.disableddesc="(已设置)",e.isdisabled=!0),_.find(a.resourcemember,function(t){return t.id==e.id})&&(e.selected=!0)}),e.deptlst=n}function c(t){var n=r.getChildDept(t);n.length>0&&(d=t,t==p.id?e.index=0:e.index=1,l(n))}function s(){a.selecteddepts.length>0?e.selectcount="("+a.selecteddepts.length+")":e.selectcount=""}function u(e){return 0!=r.getChildDept(e.id).length}i("SelectParentCtrl",{$scope:e});e.id=t.params.id,e.selecteddepts=a.selecteddepts,e.selectdeptcount="",e.isallcheck=a.isallcheck,e.flag=0,e.isAll=!1;var d=1,p=null;e.isAllCheck=function(){a.dialogresult=1,e.isallcheck=!e.isallcheck,a.isallcheck=e.isallcheck,a.isallcheck&&(a.selecteddepts=[],""!=a.routename?t.go(a.routename,a.routeparams):n.goBack())},e.cancel=function(){a.dialogresult=0,a.selecteddepts=[],n.goBack()},e.ok=function(){a.dialogresult=1,a.all=0,""!=a.routename?t.go(a.routename,a.routeparams):n.goBack()},e.up=function(){0==e.index&&a.showall&&(e.showall=!0),c(_.find(r.all(),function(e){return e.id==parseInt(d)}).parent)},e.change=function(t){a.isallcheck&&(e.isallcheck=!e.isallcheck,a.isallcheck=e.isallcheck),t.selected?(e.selecteddepts.push(t),a.selecteddepts=e.selecteddepts):(e.selecteddepts=_.filter(e.selecteddepts,function(e){return e.id!=parseInt(t.id)}),a.selecteddepts=e.selecteddepts),s()},e.tochilddept=function(t){e.index==p.id&&(e.showall=!1),c(t.id)};var m=e.$on("$ionicView.beforeEnter",function(){e.loading=!0,r.getDep().then(function(t){p=_.find(t,function(e){return null==e.parent}),a.selecteddepts=a.resourcemember,e.selecteddepts=a.selecteddepts,3==a.datatype?_.each(t,function(t){null!=t.diarymobid&&e.flag++,1==t.id&&null!=t.diarymobid&&(e.isAll=!0)}):4==a.datatype&&_.each(t,function(t){null!=t.workatdsetid&&e.flag++,1==t.id&&null!=t.workatdsetid&&(e.isAll=!0)}),-1==e.id?(1==e.flag&&e.isAll?e.showall=!0:e.flag>=1&&!e.isAll&&(e.showall=!1),e.flag>=1&&e.flag+1==t.length&&!e.isAll&&(e.isAll=!0)):1==e.flag&&e.isAll?e.showall=!0:e.flag>=1&&!e.isAll&&0==a.resourcemember.length?e.showall=!0:e.flag>=1&&!e.isAll&&e.flag==a.resourcemember.length?e.showall=!0:e.flag>=1&&!e.isAll&&e.flag!=a.resourcemember.length&&(e.showall=!1),l(_.filter(t,function(e){return 1===e.level})),a.disabled||(_.each(a.resourcemember,function(t){e.selecteddepts.push(t)}),a.selecteddepts=e.selecteddepts),s()}).finally(function(){e.loading=!1})});e.$on("$destroy",function(){m=null})}]).controller("SelectSingleDeptCtrl",["$scope","$state","$ionicHistory","$timeout","Dept","Member",function(e,t,n,o,i,r){function a(t){var n=i.getChildDept(t);if(n.length>0){l=t,e.index=t==c.id?0:1;var o=_.find(n,{id:e.id});void 0!=o&&(o.selected=void 0!=o),e.deptlst=n}}e.titlename=r.titlename;var l=1,c=null;e.leftbtn=[{text:"取消",click:"cancel"},{text:"上一层",click:"up"}];var s=e.$on("$ionicView.beforeEnter",function(){e.loading=!0,i.getDep().then(function(t){c=_.find(t,{parent:null}),e.id=r.resourcemember.length>0?r.resourcemember[0].id:null,a(c.id)}).finally(function(){e.loading=!1})});e.cancel=function(){r.dialogresult=0,r.selecteddepts=[],n.goBack()},e.up=function(){a(_.find(i.all(),{id:l}).parent)},e.change=function(e){r.selecteddepts=[],e.selected&&(r.selecteddepts.push(e),""==r.routename?n.goBack():t.go(r.routename,r.routeparams))},e.tochilddept=function(e){a(e.id)},e.is_showright=function(e){return i.getChildDept(e.id).length>0},e.$on("$destroy",function(){s=null})}]).controller("TransferCtrl",["$scope","$state","$stateParams","$ionicPopup","$ionicHistory","global","Member",function(e,t,n,o,i,r,a){function l(){if(a.selectedemplst.length>0){if(e.memberlist.push(r.user.imusrid),_.each(a.selectedemplst,function(t){e.memberlist.push(t.im_usrid)}),a.selectedemplst=[],void 0!=window.cordovaLinker){var t={name:"讨论组",ids:[]};t.ids=e.memberlist,window.cordovaLinker.discuss(t,function(e){o.confirm({title:"
转发至

",subTitle:t.name,okText:"是",cancelText:"否"}).then(function(e){})},function(e){})}a.resourcemember=[]}}e.selectmember=function(){e.isremove=!1,a.resourcemember=[],a.resourcemember.push({id:r.user.usrid}),a.routename="",a.titlename="选择联系人",t.go("selectmember")},e.goback=function(){i.goBack()};var c=e.$on("$ionicView.beforeEnter",function(){e.module=n.module,e.id=n.id,e.linkurl="/tab/app/"+e.module+"/"+e.id,e.memberlist=[],e.popup={isPopup:!1},l()});e.$on("$destroy",function(){c=null})}]),starter.directive("itemMember",["Dept",function(e){return{restrict:"E",replace:!0,template:'
'}}]).directive("itemDept",["Dept",function(e){return{restrict:"E",replace:!0,template:'
{{dept.depname}}
'}}]).directive("footerMember",["Dept",function(e){return{restrict:"E",replace:!0,template:''}}]).directive("rjCloseBackDrop",[function(){return{scope:!1,restrict:"A",replace:!1,link:function(e,t,n,o){var i=angular.element(document.querySelector("html"));i.unbind("click"),i.on("click",function(t){"HTML"===t.target.nodeName&&e.popup.optionsPopup&&e.popup.isPopup?(e.popup.optionsPopup.close(),e.popup.isPopup=!1):"DIV"===t.target.nodeName&&e.popup.optionsPopup&&e.popup.isSetPopup&&(e.popup.optionsPopup.close(),e.popup.isSetPopup=!1)})}}}]).directive("ngPinchZoom",[function(){function e(e,t,n){function o(e){var t=e.originalEvent?e.originalEvent.touches:e.touches;_=t[0].clientX,S=t[0].clientY,w=v,k=b,T=0,P=0}function i(e){var n=e.originalEvent?e.originalEvent.touches:e.touches;""===u&&(1===n.length&&m>1?u="swipe":2===n.length&&(u="pinch",g=m,p=a(n),y=n[0].clientX-parseInt((n[0].clientX-n[1].clientX)/2,10)-t[0].offsetLeft-w,$=n[0].clientY-parseInt((n[0].clientY-n[1].clientY)/2,10)-t[0].offsetTop-k)),"swipe"===u?(e.preventDefault(),T=n[0].clientX-_,P=n[0].clientY-S,v=w+T,b=k+P,l()):"pinch"===u&&2===n.length&&(e.preventDefault(),d=a(n),f=d/p,m=f*g,v=y*(1-f)+w+T,b=$*(1-f)+k+P,l())}function r(e){var t=e.originalEvent?e.originalEvent.touches:e.touches;""===u||t.length>0||(m<1?(m=1,v=0,b=0):m>h?(m=h,f=m/g,v=y*(1-f)+w+T,b=$*(1-f)+k+P):(v>0?v=0:v0?b=0:b",controller:["$scope","$rootScope","$ionicModal",function(e,t,n){function o(){t.commons.bigImage=!1,t.commons.modal.hide(),t.commons.modal.remove(),t.commons.modal=null}e.showImages=function(t,n){void 0!=n&&n.stopPropagation(),e.activeSlide=t,e.showModal("../../templates/modal-imagepopover.html")},e.bigImage=t.commons.bigImage,e.showModal=function(i){t.commons.fun=o,t.commons.bigImage=!0,n.fromTemplateUrl(i,{scope:e,animation:"slide-in-up"}).then(function(e){t.commons.modal=e,t.commons.modal.show()})},e.closeModal=function(){o(),t.commons.fun=null}}]}}]).directive("removePopoverHeader",[function(){return{restrict:"A",link:function(e,t,n,o){document.getElementsByClassName("popup")[0].removeChild(document.getElementsByClassName("popup-head")[0])}}}]),starter.factory("Tool",["$http","$q","$translate","$ionicHistory",function(e,t,n,o){var i={},r={weekdays:["sundayTitle","mondayTitle","tuesdayTitle","wednesdayTitle","thursdayTitle","fridayTitle","saturdayTitle"]};return{trim:function(e){return null==e&&(e=""),e.replace(/(^\s*)|(\s*$)/g,"")},cloneObj:function(e){if(null==e)return null;var t,n=e.constructor===Array?[]:{};if("object"==typeof e){if(window.JSON)t=JSON.stringify(e),n=JSON.parse(t);else for(var o in e)n[o]="object"==typeof e[o]?cloneObj(e[o]):e[o];return n}},getTempData:function(e){return i[e]},setTempData:function(e){i[e]=[]},get:function(n,o,r){var a=t.defer();return o=o||!1,e.get(n).then(function(e){a.resolve(e.data),o&&(i[r]=e.data)},function(e){a.reject(e)}),a.promise},post:function(n,o,i){var r=t.defer(),a=null;return 0==i&&(a={"Content-Type":"application/x-www-form-urlencoded"}),e.post(n,o,{headers:a}).then(function(e){r.resolve(e.data)},function(e){r.reject(e)}),r.promise},patch:function(n,o){var i=t.defer();return e.patch(n,o).then(function(e){i.resolve(e.data)},function(e){i.resolve(e)}),i.promise},put:function(n,o,r){var a=t.defer();return r=r||!1,e.put(n,o).then(function(e){a.resolve(e.data),r&&(i=e.data)},function(e){a.reject(e)}),a.promise},delete:function(n){var o=t.defer();return e.delete(n).then(function(e){o.resolve(e.data)},function(e){o.reject(e)}),o.promise},getTranslateByKey:function(e,t){return void 0===r[e]||void 0===r[e][t]?null:n.instant(r[e][t])},removeBackView:function(e){var t=o.backView();t&&(_.isArray(e)||(e=[e]),_.find(e,function(e){if(t.stateName==e)return o.removeBackView()}))}}}]).factory("showPopup",["$timeout","$ionicLoading","$ionicPopup","$rootScope","$ionicModal",function(e,t,n,o,i){function r(e,n,o){void 0==o&&(o=!0),t.show({template:c[e]+n,animation:"fade-in",showBackdrop:o,maxWidth:200,Showdelay:0})}function a(){t.hide()}function l(t,n,o,i){void 0==i&&(i=1500),r(t,n,o),e(function(){a()},i)}var c=['
','
'];return{PopupWindow:function(e,t,n,o){l(e,t,n,o)},hideLoading:function(){a(),o.commons.isShowPopup=!1},showLoading:function(n,i,a,c){r(n,i,a),o.commons.isShowPopup=!0,c=c||1e4,e(function(){o.commons.isShowPopup&&(t.hide(),l(0,"请求超时!",!1),o.commons.isShowPopup=!1)},c)},confirm:function(e,t,o){return n.confirm({title:"
"+e+"

",okText:t,cancelText:o})},showSelectImgPopup:function(e,t,o){var i=n.show({templateUrl:"../../templates/template-selectimg.html",scope:o});return o.Camera=e,o.ImagePicker=t,i},modalTemplate:function(e,t,n){return i.fromTemplateUrl(e,{scope:n,animation:t,focusFirstInput:!0})}}}]).factory("ImageManage",["$q","$cordovaCamera","$cordovaImagePicker","$cordovaFileTransfer","$cordovaFile","$http","cfg","formatFilter","Tool",function(e,t,n,o,i,r,a,l,c){function s(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function u(){return s()+s()+"-"+s()+"-"+s()+"-"+s()+"-"+s()+s()+s()}return{ImagePicker_getPictures:function(t){void 0==t&&(t=1);var o=e.defer(),r={maximumImagesCount:t,quality:30},a=[];return n.getPictures(r).then(function(t){_.each(t,function(t){var n=e.defer();i.readFileMetadata(cordova.file.cacheDirectory,t.substr(t.lastIndexOf("/")+1)).then(function(e){},function(e){}),i.readAsDataURL(cordova.file.cacheDirectory,t.substr(t.lastIndexOf("/")+1)).then(function(e){n.resolve(e)},function(e){n.reject(e)}),a.push(n.promise)}),o.resolve(a)},function(e){o.reject(e)}),o.promise},Camera_getPicture:function(n){void 0==n&&(n=!1);var o=e.defer(),i={quality:30,destinationType:Camera.DestinationType.DATA_URL,sourceType:Camera.PictureSourceType.CAMERA,allowEdit:n,encodingType:Camera.EncodingType.JPEG,popoverOptions:CameraPopoverOptions,saveToPhotoAlbum:!0,correctOrientation:!0};return t.getPicture(i).then(function(e){o.resolve("data:image/jpeg;base64,"+e)},function(e){o.reject(e)}),o.promise},upload:function(t,n,i){var r=[],a=t,l=new FileUploadOptions;return _.isArray(a)||(a=[],a.push(t)),_.each(a,function(e){var t={};l.params=t,t.token=n,t.mimeType="image/jpg",t.key=i+u()+e.substr(e.lastIndexOf(".")),r.push(o.upload("http://up.qiniu.com",e,l,!0))}),e.all(r)},getToken:function(e,t,n){var o=l("{0}qiniuupload/?app={1}&cls={2}&pk={3}",a.api,e,n,t);return r.get(o)},get_upload_Token:function(e,t){var n=l("{0}{1}/{2}/",a.api,e,t);return r.get(n)},uploadImage:function(t,n,i,r){var s=l("{0}qiniuupload/?app={1}&cls={2}&pk={3}",a.api,n,r,i),d=e.defer();return c.get(s).then(function(n){var i=[],r=t,a=new FileUploadOptions;_.isArray(r)||(r=[],r.push(t)),_.each(r,function(t){var r={};a.params=r,r.token=n.token,r.mimeType="image/jpg",r.key=n.filepath+u()+t.substr(t.lastIndexOf("."));var l=e.defer();o.upload("http://up.qiniu.com",t,a,!0).then(function(e){l.resolve(e)},function(e){l.reject(e)}),i.push(l.promise)}),d.resolve(i)},function(e){d.reject(e)}),d.promise}}}]).factory("Member",function(){var e={};return e.resourcemember=[],e.selectedemplst=[],e.selecteddepts=[],e.isallcheck=!1,e.unenabledata=[],e.homerenderdata=[],e.routename="",e.routeparams={},e.cancelroutename="",e.cancelrouteparams={},e.titlename="选择成员",e.datatype="",e.disabled=!0,e.hide=!1,e.dialogresult=1,e.showall=!1,e.showgroup=!1,e.all=1,e.customerop=null,e.member={},e}).factory("Dept",["$http","$q","cfg","formatFilter","Tool","global",function(e,t,n,o,i,r){var a=[];new Array,new Array;return{selecteddepts:[],titleName:{name:""},save:function(e,t,r,a){var l=[];t.length>0&&l.push({op:"del",values:t}),r.length>0&&l.push({op:"add",values:r}),e.length>0&&l.push({op:"up",values:e});var c=o("{0}depts/?compid={1}",n.api,a);return i.patch(c,l)},all:function(){return a=i.getTempData("deptlist")||[]},setdeptlst:function(e){a=e,i.setTempData("deptlist")},getDep:function(e){var t=o("{0}depts/",n.api);return e&&(t=o("{0}depts/?compid={1}",n.api,e)),i.get(t,!0,"deptlist")},getEmp:function(e,t){var r=o("{0}usrs/",n.api);return void 0!=e&&(r=o("{0}usrs/?deptid={1}",n.api,e)),void 0!=t&&void 0!=e&&(r=o("{0}usrs/?compid={1}&deptid={2}",n.api,t,e)),i.get(r)},getChildDept:function(e){return _.filter(this.all(),function(t){return parseInt(t.parent)==parseInt(e)})},getUsrDetail:function(){return i.get(o("{0}usrs/{1}/?compid={2}",n.api,r.user.usrid,r.user.compno),!0,"userinfo")},putUsrInfo:function(e){return e.dept=e.dept_id,e=_.pick(e,"username","sex","dept","degree","email"),i.put(o("{0}usrs/{1}/",n.api,r.user.usrid),e)}}}]).factory("General",["$http","$q","cfg","global","formatFilter",function(e,t,n,o,i){var r={};return{getComment:function(o,a){var l=i("{0}{1}/comments/?{2}id={3}",n.api,a,a,o),c=t.defer();return e.get(l).then(function(e){c.resolve(e.data),r=e.data},function(e){c.reject(e)}),c.promise},getRead:function(o,r,a){var l=i("{0}{1}/readeds/?{2}id={3}",n.api,r,r,o);void 0!=a&&(l+="&type=unreads");var c=t.defer();return e.get(l).then(function(e){c.resolve(e.data)},function(e){c.reject(e)}),c.promise},postComment:function(a,l){var c=i("{0}{1}/comment/",n.api,l),s=t.defer();return e.post(c,a,{headers:{"Content-Type":"application/json"}}).then(function(e){s.resolve(e.data),e.data.user__username=o.user.usrname,e.data.user_id=o.user.usrid,e.data.create_dd=new Date,r.splice(0,0,e.data)},function(e){s.reject(e)}),s.promise},postRead:function(o,r){var a=i("{0}{1}/readeds/",n.api,r),l=t.defer();return e.post(a,o,{headers:{"Content-Type":"application/json"}}).then(function(e){l.resolve(e.data)},function(e){l.reject(e)}),l.promise},deleteComment:function(t,o){var a=_.find(r,function(e){if(e.id===parseInt(t))return e});if(void 0!=a){r.splice(r.indexOf(a),1);var l=i("{0}{1}/comment/{2}/",n.api,o,t);return e.delete(l)}}}}]),starter.filter("format",function(){return function(e){var t=arguments;return e.replace(/\{(\d+)\}/g,function(e,n){return t[1*n+1]})}}).filter("getDateDiff",function(){return function(e){if(null==e)return null;var t=(new Date).getTime(),n=new Date(e).getTime(),o=t-n;if(o+1e4<0)return!1;var i=o/31536e6,r=o/2592e6,a=o/6048e5,l=o/864e5,c=o/36e5,s=o/6e4;return result=i>=1?parseInt(i)+"年前":r>=1?parseInt(r)+"个月前":a>=1?parseInt(a)+"周前":l>=1?parseInt(l)+"天前":c>=1?parseInt(c)+"小时前":s>=1?parseInt(s)+"分钟前":"刚刚",result}}).filter("SwitchHtmlContent",function(){return function(e){return null!=e&&(e=e.replace(/\n/g,"
"),"undefined"!=typeof ioNull)?ioNull.emoji.parse(e):e}}).filter("percentage",["$window",function(e){return function(t,n,o){return n=angular.isNumber(n)?n:2,o=o||"%",e.isNaN(t)?"":Math.round(t*Math.pow(10,n+2))/Math.pow(10,n)+o}}]).filter("strtimeformat",["$filter",function(e){function t(e){return n(e,"HH:mm")}var n=e("date");return function(e){return null==e?null:(e=new Date("2016/10/1 "+e),t(e))}}]);