Browse Source

init erp_h5

zhuxc 7 years ago
commit
0f80faa4c0
100 changed files with 9562 additions and 0 deletions
  1. 3 0
      .bowerrc
  2. 34 0
      .gitignore
  3. 72 0
      README.md
  4. 1 0
      _anywhere.bat
  5. 1 0
      _runandroid.bat
  6. 17 0
      bower.json
  7. BIN
      color.png
  8. 84 0
      config.xml
  9. 468 0
      docker.md
  10. 67 0
      gulpfile.js
  11. 83 0
      hooks/README.md
  12. 94 0
      hooks/after_prepare/010_add_platform_class.js
  13. 13 0
      ionic.config.json
  14. 146 0
      ionic.md
  15. 20 0
      ionic.project
  16. 47 0
      package.json
  17. 65 0
      platforms/android/CordovaLib/src/org/apache/cordova/CallbackMap.java
  18. 51 0
      platforms/android/assets/www/apps/accountMng/index.html
  19. 871 0
      platforms/android/assets/www/apps/accountMng/js/controllers.js
  20. 0 0
      platforms/android/assets/www/apps/accountMng/js/directive.js
  21. 67 0
      platforms/android/assets/www/apps/accountMng/js/factory.js
  22. 61 0
      platforms/android/assets/www/apps/accountMng/js/route.js
  23. 52 0
      platforms/android/assets/www/apps/accountMng/templates/account-manage.html
  24. 23 0
      platforms/android/assets/www/apps/accountMng/templates/applycheck.html
  25. 19 0
      platforms/android/assets/www/apps/accountMng/templates/compinfo.html
  26. 18 0
      platforms/android/assets/www/apps/accountMng/templates/contacts-companylst.html
  27. 39 0
      platforms/android/assets/www/apps/accountMng/templates/contacts-deptlst.html
  28. 35 0
      platforms/android/assets/www/apps/accountMng/templates/createcomp-modaltemplate.html
  29. 24 0
      platforms/android/assets/www/apps/accountMng/templates/editDep.html
  30. 20 0
      platforms/android/assets/www/apps/accountMng/templates/edit_deptdegree.html
  31. 37 0
      platforms/android/assets/www/apps/accountMng/templates/joincomp.html
  32. 30 0
      platforms/android/assets/www/apps/accountMng/templates/managecomp.html
  33. 46 0
      platforms/android/assets/www/apps/accountMng/templates/personinfo.html
  34. 49 0
      platforms/android/assets/www/apps/daily/index.html
  35. 1526 0
      platforms/android/assets/www/apps/daily/js/controllers.js
  36. 118 0
      platforms/android/assets/www/apps/daily/js/directive.js
  37. 94 0
      platforms/android/assets/www/apps/daily/js/factory.js
  38. 96 0
      platforms/android/assets/www/apps/daily/js/route.js
  39. 32 0
      platforms/android/assets/www/apps/daily/templates/additem.html
  40. 24 0
      platforms/android/assets/www/apps/daily/templates/custom-form.html
  41. 69 0
      platforms/android/assets/www/apps/daily/templates/daily-details.html
  42. 37 0
      platforms/android/assets/www/apps/daily/templates/daily-edit.html
  43. 27 0
      platforms/android/assets/www/apps/daily/templates/daily-man.html
  44. 38 0
      platforms/android/assets/www/apps/daily/templates/daily-permission.html
  45. 48 0
      platforms/android/assets/www/apps/daily/templates/daily-read.html
  46. 17 0
      platforms/android/assets/www/apps/daily/templates/daily-readDay.html
  47. 31 0
      platforms/android/assets/www/apps/daily/templates/daily-readDayCount.html
  48. 15 0
      platforms/android/assets/www/apps/daily/templates/daily-readDayDeptCount.html
  49. 24 0
      platforms/android/assets/www/apps/daily/templates/daily-readMouthCount.html
  50. 28 0
      platforms/android/assets/www/apps/daily/templates/daily-template.html
  51. 22 0
      platforms/android/assets/www/apps/daily/templates/daily-templateEdit.html
  52. 32 0
      platforms/android/assets/www/apps/daily/templates/daily-templateScope.html
  53. 24 0
      platforms/android/assets/www/apps/daily/templates/daily.html
  54. 9 0
      platforms/android/assets/www/apps/daily/templates/modal-selectDate.html
  55. 11 0
      platforms/android/assets/www/apps/daily/templates/modal-selectdept.html
  56. 58 0
      platforms/android/assets/www/apps/daily/templates/selectdeptoritem.html
  57. 18 0
      platforms/android/assets/www/apps/daily/templates/template-daily.html
  58. 51 0
      platforms/android/assets/www/apps/daily/templates/template-itemWrite.html
  59. 54 0
      platforms/android/assets/www/apps/notice/index.html
  60. 962 0
      platforms/android/assets/www/apps/notice/js/controllers.js
  61. 0 0
      platforms/android/assets/www/apps/notice/js/directive.js
  62. 256 0
      platforms/android/assets/www/apps/notice/js/factory.js
  63. 45 0
      platforms/android/assets/www/apps/notice/js/route.js
  64. 28 0
      platforms/android/assets/www/apps/notice/templates/modal-back.html
  65. 11 0
      platforms/android/assets/www/apps/notice/templates/modal-selectgroup.html
  66. 44 0
      platforms/android/assets/www/apps/notice/templates/modal-vote.html
  67. 211 0
      platforms/android/assets/www/apps/notice/templates/notice-details.html
  68. 27 0
      platforms/android/assets/www/apps/notice/templates/notice-posted.html
  69. 69 0
      platforms/android/assets/www/apps/notice/templates/notice-result.html
  70. 38 0
      platforms/android/assets/www/apps/notice/templates/notice.html
  71. 53 0
      platforms/android/assets/www/apps/notice/templates/postnotice.html
  72. 48 0
      platforms/android/assets/www/apps/notice/templates/power-set.html
  73. 18 0
      platforms/android/assets/www/apps/notice/templates/result-details.html
  74. 54 0
      platforms/android/assets/www/apps/pay/index.html
  75. 1573 0
      platforms/android/assets/www/apps/pay/js/controllers.js
  76. 90 0
      platforms/android/assets/www/apps/pay/js/directive.js
  77. 23 0
      platforms/android/assets/www/apps/pay/js/factory.js
  78. 90 0
      platforms/android/assets/www/apps/pay/js/route.js
  79. 32 0
      platforms/android/assets/www/apps/pay/templates/addtype.html
  80. 46 0
      platforms/android/assets/www/apps/pay/templates/auditstep.html
  81. 44 0
      platforms/android/assets/www/apps/pay/templates/auditstepset.html
  82. 14 0
      platforms/android/assets/www/apps/pay/templates/billapprove.html
  83. 13 0
      platforms/android/assets/www/apps/pay/templates/billapproved.html
  84. 10 0
      platforms/android/assets/www/apps/pay/templates/billlist.html
  85. 13 0
      platforms/android/assets/www/apps/pay/templates/billpay.html
  86. 13 0
      platforms/android/assets/www/apps/pay/templates/modal-paytype.html
  87. 24 0
      platforms/android/assets/www/apps/pay/templates/modal-selectrecord.html
  88. 10 0
      platforms/android/assets/www/apps/pay/templates/modal-stepReject.html
  89. 19 0
      platforms/android/assets/www/apps/pay/templates/pay-analyse.html
  90. 64 0
      platforms/android/assets/www/apps/pay/templates/pay-bill.html
  91. 46 0
      platforms/android/assets/www/apps/pay/templates/pay-record.html
  92. 45 0
      platforms/android/assets/www/apps/pay/templates/pay.html
  93. 85 0
      platforms/android/assets/www/apps/pay/templates/paybilldetails.html
  94. 19 0
      platforms/android/assets/www/apps/pay/templates/payman.html
  95. 33 0
      platforms/android/assets/www/apps/pay/templates/seestepmflist.html
  96. 23 0
      platforms/android/assets/www/apps/pay/templates/template-filterbar.html
  97. 13 0
      platforms/android/assets/www/apps/pay/templates/template-payBillList.html
  98. 22 0
      platforms/android/assets/www/apps/pay/templates/typeset.html
  99. 52 0
      platforms/android/assets/www/apps/process/index.html
  100. 122 0
      platforms/android/assets/www/apps/process/js/controllers.js

+ 3 - 0
.bowerrc

@@ -0,0 +1,3 @@
+{
+  "directory": "www/lib"
+}

+ 34 - 0
.gitignore

@@ -0,0 +1,34 @@
+# ---> Node
+# Logs
+logs
+*.log
+npm-debug.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
+node_modules
+/www/css/linker.css
+/www/css/ionic.app.css
+.idea
+.project
+/www/lib/

+ 72 - 0
README.md

@@ -0,0 +1,72 @@
+# h5
+    先安装node.js
+
+    安装成功后,现在命令行进行安装ionic和cordova
+
+    mac下需加sudo权限
+
+    1、安装npm镜像
+    npm install -g cnpm
+    
+    cnpm install -g ionic@1.7.16
+    cnpm install -g cordova
+    
+    安装完成后进入到项目所在文件夹,进行npm,bower,sass的更新和安装
+    1、安装gulp自动化构建工具
+    cnpm install gulp //windows 加 -g
+
+    2、安装bower前端包管理工具
+    cnpm install bower //windows 加 -g
+    
+    3、安装npm插件
+    cnpm install
+    
+    4、安装bower插件
+    bower install   //mac 加 --allow-root
+    
+    5、安装sass插件
+    ionic setup sass
+    
+# Debug 在chrome进行调试
+    chrome://inspect/#devices
+    手机进入某一个应用模块,再chrome进入webview页面即可
+
+# Android/IOS打包 apk
+## 添加resources
+    ionic resources
+## 添加相对应的平台
+    ionic platform add anroid/ios
+## Android需安装JDK
+    配置环境变量JAVA_HOME
+    准备SDK
+    添加 CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL file:///D:/android-sdk/gradle-2.13-all.zip
+## 前端资源打包
+    ionic prepare android/ios
+
+# 初始化
+## 安装cnpm
+    npm install -g cnpm --registry=https://registry.npm.taobao.org
+
+## 安装依赖
+    * bower install
+    * cnpm install
+  
+## 运行
+    ionic run android --device s -cls
+
+# webstorm破解
+    http://idea.iteblog.com/key.php
+
+# 资料
+## ionic 中文官方文档
+
+    http://www.ionic-china.com/
+    在网页的右上角 --> 中文文档
+
+## ionic 例子
+
+    http://codepen.io/ionic/pens/public/
+
+## underscore
+
+    http://www.css88.com/doc/underscore/

+ 1 - 0
_anywhere.bat

@@ -0,0 +1 @@
+anywhere -d "e:\Share" -p 8002 -h 192.168.1.8 -s

+ 1 - 0
_runandroid.bat

@@ -0,0 +1 @@
+ionic run android --device s -cls

+ 17 - 0
bower.json

@@ -0,0 +1,17 @@
+{
+  "name": "linker",
+  "private": "true",
+  "devDependencies": {
+    "underscore": "^1.8.3",
+    "angular-underscore-module": "^1.0.3",
+    "ngCordova": "~0.1.27-alpha",
+    "angular-translate": "^2.13.0",
+    "angular-resource": "1.5.3"
+  },
+  "dependencies": {
+    "ionic": "driftyco/ionic-bower#v1.3.1",
+    "angular-translate": "^2.13.0",
+    "angular-translate-loader-static-files": "^2.14.0",
+    "angular-resource": "1.5.3"
+  }
+}

BIN
color.png


+ 84 - 0
config.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<widget id="com.ionicframework.tabs483686" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+  <name>Linker</name>
+  <description>&#xD;&#xD;&#xD;&#xD;&#xD;
+        中小企业云平台&#xD;&#xD;&#xD;&#xD;&#xD;
+    </description>
+  <author email="hwswin@amtxts.com" href="http://www.amtxts.com/">&#xD;&#xD;&#xD;&#xD;&#xD;
+      Linker Team&#xD;&#xD;&#xD;&#xD;&#xD;
+    </author>
+  <content src="index.html"/>
+  <access origin="*"/>
+  <preference name="webviewbounce" value="false"/>
+  <preference name="UIWebViewBounce" value="false"/>
+  <preference name="DisallowOverscroll" value="true"/>
+  <preference name="FadeSplashScreenDuration" value="2000"/>
+  <preference name="android-minSdkVersion" value="16"/>
+  <preference name="BackupWebStorage" value="none"/>
+  <preference name="AndroidPersistentFileLocation" value="Compatibility"/>
+  <preference name="SplashScreen" value="screen"/>
+  <preference name="SplashScreenDelay" value="3000"/>
+  <feature name="StatusBar">
+    <param name="ios-package" onload="true" value="CDVStatusBar"/>
+  </feature>
+  <plugin name="cordova-plugin-device" spec="~1.1.2"/>
+  <plugin name="cordova-plugin-console" spec="~1.0.3"/>
+  <plugin name="cordova-plugin-whitelist" spec="~1.2.2"/>
+  <plugin name="cordova-plugin-statusbar" spec="~2.1.3"/>
+  <plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
+  <plugin name="cordova-plugin-app-preferences" spec="~0.99.3"/>
+  <plugin name="cordova-plugin-app-event" spec="~1.2.0"/>
+  <plugin name="de.appplant.cordova.plugin.local-notification" spec="~0.8.4"/>
+  <plugin name="cordova-plugin-globalization" spec="~1.0.4"/>
+  <platform name="android">
+    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
+    <icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
+    <icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
+    <icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
+    <icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
+    <icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
+    <splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/>
+    <splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/>
+    <splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/>
+    <splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
+    <splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
+    <splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
+    <splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
+    <splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
+    <splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
+    <splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
+    <splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
+    <splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
+  </platform>
+  <platform name="ios">
+    <icon src="resources\ios\icon\icon.png" width="57" height="57"/>
+    <icon src="resources\ios\icon\icon@2x.png" width="114" height="114"/>
+    <icon src="resources\ios\icon\icon-40.png" width="40" height="40"/>
+    <icon src="resources\ios\icon\icon-40@2x.png" width="80" height="80"/>
+    <icon src="resources\ios\icon\icon-40@3x.png" width="120" height="120"/>
+    <icon src="resources\ios\icon\icon-50.png" width="50" height="50"/>
+    <icon src="resources\ios\icon\icon-50@2x.png" width="100" height="100"/>
+    <icon src="resources\ios\icon\icon-60.png" width="60" height="60"/>
+    <icon src="resources\ios\icon\icon-60@2x.png" width="120" height="120"/>
+    <icon src="resources\ios\icon\icon-60@3x.png" width="180" height="180"/>
+    <icon src="resources\ios\icon\icon-72.png" width="72" height="72"/>
+    <icon src="resources\ios\icon\icon-72@2x.png" width="144" height="144"/>
+    <icon src="resources\ios\icon\icon-76.png" width="76" height="76"/>
+    <icon src="resources\ios\icon\icon-76@2x.png" width="152" height="152"/>
+    <icon src="resources\ios\icon\icon-83.5@2x.png" width="167" height="167"/>
+    <icon src="resources\ios\icon\icon-small.png" width="29" height="29"/>
+    <icon src="resources\ios\icon\icon-small@2x.png" width="58" height="58"/>
+    <icon src="resources\ios\icon\icon-small@3x.png" width="87" height="87"/>
+    <splash src="resources\ios\splash\Default-568h@2x~iphone.png" width="640" height="1136"/>
+    <splash src="resources\ios\splash\Default-667h.png" width="750" height="1334"/>
+    <splash src="resources\ios\splash\Default-736h.png" width="1242" height="2208"/>
+    <splash src="resources\ios\splash\Default-Landscape-736h.png" width="2208" height="1242"/>
+    <splash src="resources\ios\splash\Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
+    <splash src="resources\ios\splash\Default-Landscape~ipad.png" width="1024" height="768"/>
+    <splash src="resources\ios\splash\Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
+    <splash src="resources\ios\splash\Default-Portrait~ipad.png" width="768" height="1024"/>
+    <splash src="resources\ios\splash\Default@2x~iphone.png" width="640" height="960"/>
+    <splash src="resources\ios\splash\Default~iphone.png" width="320" height="480"/>
+  </platform>
+  <icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
+</widget>

+ 468 - 0
docker.md

@@ -0,0 +1,468 @@
+#alias
+
+    alias ionic-build="docker run -ti --privileged -v /share/ionic/tabs/tabs:/myApp:rw -p 8103:8100 -p 35728:35729 mkaag/ionic bash"
+    
+    alias ionic-build="docker run -ti --privileged -v /share/ionic/tabs/tabs:/myApp:rw -p 8103:8100 -p 35728:35729 ionic-build bash"
+
+    alias cnpm="npm --registry=https://registry.npm.taobao.org \
+    --cache=$HOME/.npm/.cache/cnpm \
+    --disturl=https://npm.taobao.org/dist \
+    --userconfig=$HOME/.cnpmrc"
+
+    echo 'alias cnpm="npm --registry=https://registry.npm.taobao.org --cache=$HOME/.npm/.cache/cnpm --disturl=https://npm.taobao.org/dist --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
+
+NPM代理配置
+
+    如果您工作的环境中有防火墙,那么可能需要为npm配置代理。在命令行模式下,运行下面命令:
+
+    配置http代理: npm config set proxy [proxy]:[port].
+    配置https代理: npm config set https-proxy [proxy]:[port].
+
+    例如,下面为http和https设置了相同的代理http://example.proxy.com和代理端口8080。
+
+    > npm config set proxy http://example.proxy.com:8080
+    > npm config set https-proxy http://example.proxy.com:8080
+
+#确定操作系统
+    cat /etc/issue
+    lsb_release -a
+
+#加速源
+
+    npm install -g cnpm --registry=https://registry.npm.taobao.org  
+
+    sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g'  /etc/apt/sources.list 
+
+    sed -i 's|httpredir.debian.org|mirrors.aliyun.com|g'  /etc/apt/sources.list 
+    sed -i 's|security.debian.org|mirrors.aliyun.com|g'  /etc/apt/sources.list 
+
+    https://q9h4ikji.mirror.aliyuncs.com
+    sudo sed -i 's|OPTIONS='--registry-mirror=true'|OPTIONS='--registry-mirror=https://q9h4ikji.mirror.aliyuncs.com|g' /etc/sysconfig/docker && service docker restart
+    sudo sed -i 's|other_args=""|other_args="--registry-mirror=https://q9h4ikji.mirror.aliyuncs.com"|g' /etc/sysconfig/docker && service docker restart
+
+    docker-machine ssh default "echo 'EXTRA_ARGS=\"--registry-mirror=https://q9h4ikji.mirror.aliyuncs.com\"' | sudo tee -a /var/lib/boot2docker/profile"
+    docker-machine restart default 
+
+    docker-machine ssh default 'mkdir linker && sudo mount -t vboxsf linker linker'
+
+# TODO: remove when https://github.com/npm/npm/issues/9863 is fixed
+RUN cd $(npm root -g)/npm \
+ && npm install fs-extra \
+ && sed -i -e s/graceful-fs/fs-extra/ -e s/fs\.rename/fs.move/ ./lib/utils/rename.js
+
+#Android apk Builder
+
+    Set the JAVA_HOME environment variable to the location of your JDK installation
+
+    Set the ANDROID_HOME environment variable to the location of your Android SDK installation
+
+    It is also recommended that you add the Android SDK's tools and platform-tools directories to your PATH
+
+    export ANDROID_HOME='/share/docker/android-sdk-linux'
+    export PATH=$PATH:/share/docker/jdk1.8.0_101/bin/
+    platforms/android/cordova/lib/builders/GradleBuilder.js
+
+    CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
+    export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="file:/share/docker/gradle-2.13-all.zip"
+
+    android list sdk --all --extended
+
+#docker
+
+    pkill -f "manage.py runserver"
+    python manage.py runserver 0.0.0.0:8000
+
+    docker run --name nginx -it -v /share/ionic/tabs/tabs:/etc/nginx -p 80:80 nginx bash
+    service nginx restart
+
+api请求要带最后一个斜杠
+http://192.168.99.100/i/menuglobals/
+
+#cordova plugins
+
+cordova plugin remove cordova-plugin-whitelist
+cordova plugin add cordova-plugin-whitelist
+ionic browser add crosswalk
+
+ionic serve --platform="android"
+
+cordova plugin remove cn-linker-cordova
+cordova plugin add cordovaLinker
+
+ionic run android --device s -cls
+
+#python permission
+
+IsOwnerOrReadOnly未使用
+import django
+print (django.__path__)
+
+#调试
+
+    weinre --boundHost 192.168.31.125
+    weinre --boundHost 192.168.31.125 --httpPort 8081
+
+    <script src="http://192.168.31.125:8081/target/target-script-min.js#anonymous"></script>
+
+#自动挂载(有问题)
+
+若想开机自动挂载,可以在 /etc/fstab 文件末添加一项    
+sharing /mnt/share vboxsf defaults 0 0
+  或
+sharing /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0 
+当然,这个还不行的,还记得刚开始分配数据空间那个地方吗,那里也有一个自动挂载的选项,是VxBox提供的。
+但是,如果那个选项勾选了,那么这个共享这辈子也不会开机自动挂载,即便是设置了 /etc/fstab文件,要想实现自动挂载,VxBox的那个自动挂载的选项不能选,而且要配置/etc/fstab文件!
+
+大部分网络资料都是说在 /etc/fstab 文件中追加 
+VirtualBox虚拟机文件夹共享挂载命令 “ sharing /mnt/share vboxsf defaults 0 0 ”,其实是错误的,
+因为系统调用fstab的时候,Virtualbox的共享目录的模块还没有加载,所以每次加载都会失败,最终的解决方案如下:
+在文件 /etc/rc.local 中(用root用户)追加如下命令
+mount -t vboxsf sharing /mnt/share
+
+#Genymotion
+
+关闭硬件声音
+设置网卡2为桥接,运行后确认网卡2是否成功启用
+安装Genymotion-ARM-Translation_v1.1
+
+#server-build
+
+    cd E:\Projects\IM\sealtalk-server
+    grunt build --force
+
+#server-run
+
+    cd E:\Projects\IM\sealtalk-server
+    set DEBUG=*
+    grunt nodemon
+
+#debug
+
+    set DEBUG=*,-not_this
+    
+    ls env:
+    $env:DEBUG="*"
+
+#web-connect
+
+    cd E:\Projects\IM\sealtalk-web
+    grunt build
+    grunt connect
+
+#cors
+
+    注释$httpProvider.defaults.withCredentials = true;
+
+    app.use cors                # 使用 CORS,支持跨域
+      origin: Config.CORS_HOSTS
+      credentials: true
+    改为
+    app.use cors                # 使用 CORS,支持跨域
+      origin: '*'
+      # credentials: true
+
+    https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials
+
+多个站点跨域请求
+
+    # app.use cors                # 使用 CORS,支持跨域
+    #   origin: Config.CORS_HOSTS
+    #   credentials: true
+
+    whitelist = Config.CORS_HOSTS # ['http://192.168.31.125:8100','http://192.168.31.125:81']
+    corsOptions=
+      origin: (origin,callback) ->
+        originIsWhitelisted = whitelist.indexOf origin != -1
+        callback(null,originIsWhitelisted)
+      credentials: true
+    app.use cors corsOptions
+
+#ionic-serve
+
+    cd G:\share\ionic\tabs\tabs
+    ionic serve
+
+#重启
+
+关闭80端口
+
+1、挂载
+
+    sudo mkdir /docker && sudo mount -t vboxsf docker /docker
+    sudo mkdir /share && sudo mount -t vboxsf share /share
+    docker start db1
+    docker start appsrv
+    docker start nginx
+    docker start imdb
+
+2、启动
+
+    docker exec -it db1 bash
+    service mysql start
+
+    docker exec -it nginx bash
+    service nginx start
+
+    docker exec -it appsrv bash
+    cd ../app/trunk/
+    python manage.py runserver 0.0.0.0:8000
+
+3、应用ls /
+
+    --sealtalk-server
+    grunt nodemon
+    --sealtalk-web
+    grunt connect
+
+4、socorro
+
+    docker run --privileged -d -ti -e "container=docker"  -v /sys/fs/cgroup:/sys/fs/cgroup --name socorro socorro  /usr/sbin/init
+
+#更改服务器ip
+    1、Nginx中地址转向
+    2、应用服务器数据库地址
+        sed -i 's|192.168.31.125|192.168.2.125|g'  /app/trunk/Linker/settings.py
+    3、应用服务器svn服务器地址
+        svn relocate https://192.168.31.125:8443/svn/linkersrv https://192.168.2.125:8443/svn/linkersrv
+
+#部署到华为云
+
+    1、应用服务器
+    cd /linker
+    svn checkout https://112.91.82.75:8443/svn/linkersrv/trunk
+    mv trunk srv
+
+    1.1、数据库服务器
+    docker run -p 3307:3306 -v ~/linker/sysdb/data:/var/lib/mysql --name sysdb -e MYSQL_ROOT_PASSWORD=abc.123 -d mysql
+
+    2、IM服务器
+    docker pull node
+    npm install
+    
+    2.1、IM数据库服务器
+     chmod 777 linker/imsrv/data
+     docker run -p 3305:3306 -v ~/linker/imsrv/data:/var/lib/mysql --name imdb -e MYSQL_ROOT_PASSWORD=abc.123 -d mysql
+    
+     2.2、启动IM应用服务器
+     docker run -it -p 8585:8585 --name imsrv -d --link imdb:imdb -v ~/linker/imsrv/:/usr/src/imsrv -w /usr/src/imsrv imsrv node build/src
+
+    3、nginx
+    docker run --name nginx -v ~/linker/nginx:/etc/nginx -p 80:80 -d nginx
+
+    环境变量
+    export NODE_ENV=production;node build/src/
+
+#测试环境搭建
+
+    挂载
+    cd ~
+    mkdir linker
+    sudo mount -t vboxsf linker linker
+
+    数据库表情支持
+    docker run --name mysql_mb4 -it mysql bash
+    cat <<EOT >/etc/mysql/my.cnf                                                                           
+    # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+    #
+    # This program is free software; you can redistribute it and/or modify
+    # it under the terms of the GNU General Public License as published by
+    # the Free Software Foundation; version 2 of the License.
+    #
+    # This program is distributed in the hope that it will be useful,
+    # but WITHOUT ANY WARRANTY; without even the implied warranty of
+    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    # GNU General Public License for more details.
+    #
+    # You should have received a copy of the GNU General Public License
+    # along with this program; if not, write to the Free Software
+    # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+    
+    !includedir /etc/mysql/conf.d/
+    !includedir /etc/mysql/mysql.conf.d/
+    [client]
+    default-character-set = utf8mb4
+    [mysql]
+    default-character-set = utf8mb4
+    [mysqld]
+    character-set-client-handshake = FALSE
+    character-set-server = utf8mb4
+    collation-server = utf8mb4_unicode_ci
+    EOT
+    docker commit mysql_mb4 mysql:mb4                                               
+
+    1、应用服务器
+    1.1、数据库 sysdb
+    docker run -p 3307:3306 -v ~/linker/data/sysdb:/var/lib/mysql --name sysdb -e MYSQL_ROOT_PASSWORD=abc.123 -d mysql:mb4
+    1.2、数据库 dbsrv1
+    docker run -p 3308:3306 -v ~/linker/data/dbsrv1:/var/lib/mysql --name dbsrv1 -e MYSQL_ROOT_PASSWORD=abc.123 -d mysql:mb4
+    1.3、搭建srv (DJAGNO)
+    1.3.1、安装中间件
+    docker run -p 8000:8000 -v ~/linker/srv:/linker/srv -w /linker/srv --link sysdb:sysdb --link dbsrv1:dbsrv1 --name srv -it srv:1.10.1 bash
+    pip install djangorestframework
+    pip install pymysql
+    pip install django-cors-headers
+    pip install qiniu
+    1.3.2、初始化数据库
+    运行创建基础表的sql语句(dbmodel/linkersys.sql)
+    python manage.py migrate
+    1.3.3、提交更改
+    docker commit srv srv:1.10.1
+    1.4、启动
+    docker run --rm -p 8000:8000 -v ~/linker/srv:/linker/srv -w /linker/srv --link sysdb:sysdb --link dbsrv1:dbsrv1 --name srv -it srv:1.10.1 python manage.py runserver 0.0.0.0:8000 --settings=Linker.settingsproduction
+
+    2、IM服务器
+    2.1、数据库imdb
+        docker run -p 3305:3306 -v ~/linker/data/imdb:/var/lib/mysql --name imdb -e MYSQL_ROOT_PASSWORD=abc.123 -d mysql:mb4
+    2.2、imsrv
+        docker pull node:4.6.2-slim
+    2.2.1、初始化数据库
+        docker run --rm --name imsrv -it -p 8585:8585 --link imdb:imdb -v ~/linker:/linker -w /linker/imsrv/ node:4.6.2-slim bash
+        npm install
+        npm install --save-dev coffee-script
+        npm run initdb
+    2.2.2、启动imsrv
+        docker run --name imsrv -it -p 8585:8585 --link imdb:imdb -v ~/linker:/linker -w /linker/imsrv/ -d node:4.6.2-slim node /linker/imsrv/build/src/index.js
+        export NODE_ENV=production;node build/src/
+    3、NGINX服务器
+        docker run --name nginx -v ~/linker/nginx:/etc/nginx -p 80:80 -d nginx
+
+    移除所有容器    docker rm -f $(docker ps -a| awk  '{print $1}')
+    开机记录    last
+    重启    shutdown -r now
+
+    #弹性云
+    禁用防火墙,添加入站规则
+    service iptables stop #停止
+    chkconfig iptables off #禁用
+
+    1、安装docker
+    https://docs.docker.com/engine/installation/linux/centos/
+    sudo yum update
+    curl -fsSL https://get.docker.com/ | sh
+    service start docker
+
+#android debug 
+
+    Hi, I've just documented how to view the console log on android:
+
+    Running logcat (see webview console log messages) on android
+
+    run ADB and get connected devices (first change dir to the android platform tools dir)
+
+    $ cd /Users/kevin/ADT/sdk/platform-tools
+
+    $ adb devices
+
+    List of devices attached 
+    40CBA8038654 device
+
+    get PID (process ID) of app - first get all processes
+
+    $ adb -s 40CBA8038654 shell ps
+
+    then grep that (look for a string that identifies your app)
+    $ adb -s 40CBA8038654 shell ps | grep solomon (solomon being part of package name)
+    u0_a129 17099 151 363464 69256 ffffffff 00000000 S ie.solomon.myapp
+
+    $ adb -s 40CBA8038654 shell ps | grep 17099 (check for sub processes - so far i've found that the app runs as a single process)
+    u0_a129 17099 151 363464 69256 ffffffff 00000000 S ie.solomon.myapp
+
+    finally run logcat and filter by PID so you just see output from your app:
+
+    adb -s 40CBA8038654 shell logcat –v time | grep 17099
+
+    For IOS, I've found that once you have installed it via the USB, by doing cordova run ios, it will automatically provide a log
+
+    All this is on a Mac, but steps exactly same on Ubuntu (Linux). Of course IOS only works with a Mac
+
+    监控adb安装应用
+
+https://gonzalo123.com/2014/07/21/testing-phonegapcordova-applications-fast-as-hell-in-the-device-with-ionic-framework/
+
+#Testing Phonegap/Cordova applications fast as hell in the device (with ionic framework)
+
+    <script type="text/javascript">//<![CDATA[
+    document.write('<script src="http://192.168.31.125:35729/livereload.js?snipver=1" type="text/javascript"><\/script>')
+    //]]></script>
+
+    <content src="http://192.168.31.125:8100/index.html" />
+
+    cordova run android --device
+
+    cd www
+    cmd /c mklink cordova.js ..\..\platforms\android\assets\www\cordova.js
+    cmd /c mklink cordova_plugins.js ..\..\platforms\android\assets\www\cordova_plugins.js
+    cmd /c mklink /D plugins ..\..\platforms\android\assets\www\plugins
+
+cd www
+rm www/cordova.js
+rm www/cordova_plugins.js
+rd www/plugins
+
+    ionic serve --nobrowser
+    ionic serve -b
+
+#贡献代码
+
+    Fork
+    创建您的特性分支 git checkout -b my-new-feature
+    提交您的改动 git commit -am 'Added some feature'
+    将您的修改记录提交到远程 git 仓库 git push origin my-new-feature
+    然后到 github 网站的该 git 远程仓库的 my-new-feature 分支下发起 Pull Request
+
+#django
+
+    动态设置http://stackoverflow.com/questions/6528723/changing-django-settings-at-runtime
+    django部署,部署是一个大事,为了部署django相信你应该会学习fabric,supervisor,gunicorn|uwsgi(gunicorn胜在配置简单,uwsgi有很多分析是内存占用小,速度快)
+    相信很多时候你会需要跑一些统计或者其他的定时任务,django-celery也是需要学的,当然你可以用linux的crontab,这个看你(celery有很多不错的配置)
+
+    from django.core import management
+    management.call_command('syncdb', interactive=False)
+
+    pip freeze > requirements.txt
+    pip install -r requirements.txt
+
+
+#二维码登录
+
+    https://github.com/mdp/rotp
+    https://galois.com/blog/2011/01/quick-authentication-using-mobile-devices-and-qr-codes/
+    http://blog.miguelgrinberg.com/post/two-factor-authentication-with-flask
+
+#Windows server 2012R2上无法安装Intel I219-V网卡驱动的问题
+
+    http://blog.csdn.net/ryu2003/article/details/50855146
+
+# Crosswalk
+
+    cnpm install -g crosswalk-app-tools
+    crosswalk-app check android
+
+#git proxy
+    set https_proxy="https://127.0.0.1:1080/"
+
+#boot2docker自动挂载
+    "C:/Program Files/Oracle VM VirtualBox/VBoxManage" sharedfolder add default -name linker -hostpath /f/linker
+
+    #Then make this folder automount 
+    docker-machine ssh
+
+    sudo vi /var/lib/boot2docker/profile
+
+    Add following at the end of profile file:
+        sudo mkdir /home/docker/linker
+        sudo mount -t vboxsf linker /home/docker/linker
+
+    Restart docker-machine
+        docker-machine restart
+
+#cat追加文件内容
+    cat >>profile <<EOF
+    > TZ='Asia/Shanghai'; export TZ
+    > EOF
+
+# 更改时区
+    dpkg-reconfigure tzdata
+
+# mysql 重置自增长id的初始值
+    alter table SchemaInfo auto_increment = 5

+ 67 - 0
gulpfile.js

@@ -0,0 +1,67 @@
+var gulp = require('gulp');
+var gutil = require('gulp-util');
+var bower = require('bower');
+var concat = require('gulp-concat');
+var sass = require('gulp-sass');
+var minifyCss = require('gulp-minify-css');
+var rename = require('gulp-rename');
+var sh = require('shelljs');
+var uglify = require("gulp-uglify");
+var stripDebug = require('gulp-strip-debug');
+var ngAnnotate = require('gulp-ng-annotate');
+
+var paths = {
+    sass: ['./scss/**/*.scss'],
+    starter: ['./www/js/start/config.js','./www/js/start/controller.js','./www/js/start/directive.js','./www/js/start/factory.js','./www/js/start/filter.js']
+};
+
+gulp.task('default', ['sass', 'starter']);
+
+gulp.task('starter', function () {
+    gulp.src(paths.starter)
+    .pipe(concat('starter.js'))
+    .pipe(gulp.dest('./www/js'))
+    .pipe(ngAnnotate())
+    .pipe(stripDebug())
+    .pipe(uglify())
+    .pipe(rename({extname: '.min.js'}))
+    .pipe(gulp.dest('./www/js/'));
+});
+
+gulp.task('sass', function (done) {
+    gulp.src(['./scss/ionic.app.scss', './scss/linker.scss'])
+    .pipe(sass())
+    .on('error', sass.logError)
+    .pipe(gulp.dest('./www/css/'))
+    .pipe(minifyCss({
+        keepSpecialComments: 0
+    }))
+    .pipe(rename({extname: '.min.css'}))
+    .pipe(gulp.dest('./www/css/'))
+    .on('end', done);
+});
+
+gulp.task('watch', function () {
+    gulp.watch(paths.sass, ['sass']);
+    gulp.watch(paths.starter, ['starter']);
+});
+
+gulp.task('install', ['git-check'], function () {
+    return bower.commands.install()
+    .on('log', function (data) {
+        gutil.log('bower', gutil.colors.cyan(data.id), data.message);
+    });
+});
+
+gulp.task('git-check', function (done) {
+    if (!sh.which('git')) {
+        console.log(
+            '  ' + gutil.colors.red('Git is not installed.'),
+            '\n  Git, the version control system, is required to download Ionic.',
+            '\n  Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
+            '\n  Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
+        );
+        process.exit(1);
+    }
+    done();
+});

+ 83 - 0
hooks/README.md

@@ -0,0 +1,83 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+# Cordova Hooks
+
+This directory may contain scripts used to customize cordova commands. This
+directory used to exist at `.cordova/hooks`, but has now been moved to the
+project root. Any scripts you add to these directories will be executed before
+and after the commands corresponding to the directory name. Useful for
+integrating your own build systems or integrating with version control systems.
+
+__Remember__: Make your scripts executable.
+
+## Hook Directories
+The following subdirectories will be used for hooks:
+
+    after_build/
+    after_compile/
+    after_docs/
+    after_emulate/
+    after_platform_add/
+    after_platform_rm/
+    after_platform_ls/
+    after_plugin_add/
+    after_plugin_ls/
+    after_plugin_rm/
+    after_plugin_search/
+    after_prepare/
+    after_run/
+    after_serve/
+    before_build/
+    before_compile/
+    before_docs/
+    before_emulate/
+    before_platform_add/
+    before_platform_rm/
+    before_platform_ls/
+    before_plugin_add/
+    before_plugin_ls/
+    before_plugin_rm/
+    before_plugin_search/
+    before_prepare/
+    before_run/
+    before_serve/
+    pre_package/ <-- Windows 8 and Windows Phone only.
+
+## Script Interface
+
+All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
+
+* CORDOVA_VERSION - The version of the Cordova-CLI.
+* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
+* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
+* CORDOVA_HOOK - Path to the hook that is being executed.
+* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
+
+If a script returns a non-zero exit code, then the parent cordova command will be aborted.
+
+
+## Writing hooks
+
+We highly recommend writting your hooks using Node.js so that they are
+cross-platform. Some good examples are shown here:
+
+[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
+

+ 94 - 0
hooks/after_prepare/010_add_platform_class.js

@@ -0,0 +1,94 @@
+#!/usr/bin/env node
+
+// Add Platform Class
+// v1.0
+// Automatically adds the platform class to the body tag
+// after the `prepare` command. By placing the platform CSS classes
+// directly in the HTML built for the platform, it speeds up
+// rendering the correct layout/style for the specific platform
+// instead of waiting for the JS to figure out the correct classes.
+
+var fs = require('fs');
+var path = require('path');
+
+var rootdir = process.argv[2];
+
+function addPlatformBodyTag(indexPath, platform) {
+  // add the platform class to the body tag
+  try {
+    var platformClass = 'platform-' + platform;
+    var cordovaClass = 'platform-cordova platform-webview';
+
+    var html = fs.readFileSync(indexPath, 'utf8');
+
+    var bodyTag = findBodyTag(html);
+    if(!bodyTag) return; // no opening body tag, something's wrong
+
+    if(bodyTag.indexOf(platformClass) > -1) return; // already added
+
+    var newBodyTag = bodyTag;
+
+    var classAttr = findClassAttr(bodyTag);
+    if(classAttr) {
+      // body tag has existing class attribute, add the classname
+      var endingQuote = classAttr.substring(classAttr.length-1);
+      var newClassAttr = classAttr.substring(0, classAttr.length-1);
+      newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;
+      newBodyTag = bodyTag.replace(classAttr, newClassAttr);
+
+    } else {
+      // add class attribute to the body tag
+      newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">');
+    }
+
+    html = html.replace(bodyTag, newBodyTag);
+
+    fs.writeFileSync(indexPath, html, 'utf8');
+
+    process.stdout.write('add to body class: ' + platformClass + '\n');
+  } catch(e) {
+    process.stdout.write(e);
+  }
+}
+
+function findBodyTag(html) {
+  // get the body tag
+  try{
+    return html.match(/<body(?=[\s>])(.*?)>/gi)[0];
+  }catch(e){}
+}
+
+function findClassAttr(bodyTag) {
+  // get the body tag's class attribute
+  try{
+    return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0];
+  }catch(e){}
+}
+
+if (rootdir) {
+
+  // go through each of the platform directories that have been prepared
+  var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
+
+  for(var x=0; x<platforms.length; x++) {
+    // open up the index.html file at the www root
+    try {
+      var platform = platforms[x].trim().toLowerCase();
+      var indexPath;
+
+      if(platform == 'android') {
+        indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');
+      } else {
+        indexPath = path.join('platforms', platform, 'www', 'index.html');
+      }
+
+      if(fs.existsSync(indexPath)) {
+        addPlatformBodyTag(indexPath, platform);
+      }
+
+    } catch(e) {
+      process.stdout.write(e);
+    }
+  }
+
+}

+ 13 - 0
ionic.config.json

@@ -0,0 +1,13 @@
+{
+  "name": "Linker",
+  "app_id": "",
+  "gulpStartupTasks": [
+    "sass",
+    "watch",
+    "starter"
+  ],
+  "watchPatterns": [
+    "www/**/*",
+    "!www/lib/**/*"
+  ]
+}

+ 146 - 0
ionic.md

@@ -0,0 +1,146 @@
+# 依赖和注入
+### [angular-resource](https://github.com/angular/bower-angular-resource)
+    bower install angular-resource@1.5.3 --save
+
+    <script src="lib/angular-resource/angular-resource.js"></script>
+
+    angular.module('myApp', ['ngResource']);
+
+### [angular-underscore-module](https://github.com/andresesfm/angular-underscore-module)
+    bower install angular-underscore-module --save
+    
+    <script src="lib/underscore/underscore-min.js"></script>
+    <script src="lib/angular-underscore-module/angular-underscore-module.js"></script>
+    
+    angular.module('myApp', ['underscore'])
+
+### config
+    $resourceProvider.defaults.stripTrailingSlashes = false;
+    $resourceProvider.defaults.actions.update = {
+        method: 'PUT',
+        params: {
+          id: "@id"
+        }
+    };
+    $resourceProvider.defaults.actions.patch = {
+        method: 'PATCH',
+    };
+
+# list
+## controller
+    var task = $resource('url/:id/');
+    task.get(function (res) {
+        $scope.taskList = res;
+    }, function (err) {
+        alert(JSON.stringify(err));
+    })
+
+    $scope.toDetail = function (item) {
+        Task.detail = _.clone(item);
+        $state.go('tab.task-detail',{
+            id:item.id
+        })
+    }
+    
+    $scope.toAdd = function () {
+        $state.go('tab.task.detail',{
+            id:0
+        })
+    }
+
+## html
+    1.title
+        <ion-nav-buttons side="right">
+            <button class="button button-icon icon ion-android-add" ng-click="toAdd()"></button>
+        </ion-nav-buttons>
+    2.list
+        <ion-item class="item item-icon-left" ng-repeat="item in taskList" ng-click="toDetail(item)">
+            <i ng-if="item.is_completed" class="icon ion-checkmark-round"></i>
+            <span>{{item.title}}</span>&nbsp;<span>{{item.created | date:'yyyy/MM/dd' }}</span>
+            <p>{{item.description}}</p>
+        </ion-item>
+
+## doRefresh
+    <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+
+    function getData() {
+        Task.getTask.get(function (res) {
+            $scope.taskList = res;
+        }, function (err) {
+            alert(JSON.stringify(err));
+        }).$promise.finally(function () {
+            $scope.$broadcast('scroll.refreshComplete');
+        });
+    }
+    
+## config timestamp
+    $httpProvider.interceptors.push(function () {
+        return {
+            'request': function (config) {
+                config.url += (config.url.indexOf("?") === -1 ? "?" : "&") + "v=" + Date.now();
+                return config;
+             }
+        };
+    });
+
+# details
+
+## controller
+    1.route
+        .state('tab.task-detail', {
+            url: '/account/:id',
+            views: {
+            'tab-account': {
+                templateUrl: 'templates/task-detail.html',
+                controller: 'TaskDetailCtrl'
+                 }
+            }
+        });
+        
+    2.factory
+        .factory('Task', function ($resource) {
+            var task = {};
+            task.detail = {};
+            task.getTask = $resource('url/:id/');
+            return task;
+        })
+
+    3.controller
+        var id = $stateParams.id;
+        var isNew = id == 0 ? true : false;
+
+        $scope.data = isNew ? {
+            title:null,
+            description:null
+        } : _.clone(Task.detail);
+
+        $scope.addTask = function () {
+            if (isNew) {
+                task.save($scope.data,function () {
+                    $ionicHistory.goBack();
+                });
+            } else {
+                Task.getTask.put($scope.data,function () {
+                    $ionicHistory.goBack();
+                });
+            }
+        }
+        
+        $scope.deleteTask = function () {
+            Task.getTask.delete({id:id});
+        }
+        
+        
+## html
+    <ion-nav-buttons side="right">
+        <button ng-if="data.id != null" class="button button-icon icon ion-minus-round" ng-click="deleteTask()"></button>
+    </ion-nav-buttons>
+
+
+    <label class="item item-input">
+        <input ng-model="data.title" type="text" placeholder="标题">
+    </label>
+    <label class="item item-input">
+        <textarea ng-model="data.description" rows="6" placeholder="对该任务的描述"></textarea>
+    </label>
+    <button ng-disabled="(data.title == null || data.title == '') && (data.description == null || data.description == '')" class="button button-block button-positive" ng-click="addTask()">提交</button>

+ 20 - 0
ionic.project

@@ -0,0 +1,20 @@
+{
+  "name": "linker",
+  "app_id": "",
+  "gulpStartupTasks": [
+    "sass",
+    "watch",
+    "starter"
+  ],
+  "watchPatterns": [
+    "www/**/*",
+    "!www/lib/**/*"
+  ],
+  "browsers": [
+    {
+      "platform": "android",
+      "browser": "crosswalk",
+      "version": "12.41.296.5"
+    }
+  ]
+}

+ 47 - 0
package.json

@@ -0,0 +1,47 @@
+{
+  "name": "tabs",
+  "version": "1.1.1",
+  "description": "tabs: An Ionic project",
+  "dependencies": {
+    "gulp": "^3.5.6",
+    "gulp-sass": "^2.0.4",
+    "gulp-concat": "^2.2.0",
+    "gulp-minify-css": "^0.3.0",
+    "gulp-rename": "^1.2.0"
+  },
+  "devDependencies": {
+    "bower": "^1.3.3",
+    "del": "^2.2.2",
+    "gulp-ng-annotate": "^2.0.0",
+    "gulp-strip-debug": "^1.1.0",
+    "gulp-uglify": "^2.0.0",
+    "gulp-util": "^2.2.14",
+    "shelljs": "^0.3.0"
+  },
+  "cordovaPlugins": [
+    "cordova-plugin-device",
+    "cordova-plugin-console",
+    "cordova-plugin-whitelist",
+    "cordova-plugin-statusbar",
+    "ionic-plugin-keyboard",
+    "cordova-plugin-media-capture",
+    "cordova-plugin-file@3.0.0",
+    "cordova-plugin-camera@2.2.0",
+    "cordova-plugin-media@1.0.1",
+    "cordova-plugin-file-transfer",
+    "cordovaLinker",
+    "cordova-plugin-camera",
+    "cordova-plugin-image-picker",
+    "cordova-plugin-app-preferences",
+    "cordova-plugin-app-event",
+    "de.appplant.cordova.plugin.local-notification",
+    "cordova-plugin-globalization",
+    {
+      "locator": "https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git",
+      "id": "cordova-plugin-calendar"
+    }
+  ],
+  "cordovaPlatforms": [
+    "android"
+  ]
+}

+ 65 - 0
platforms/android/CordovaLib/src/org/apache/cordova/CallbackMap.java

@@ -0,0 +1,65 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+package org.apache.cordova;
+
+import android.util.Pair;
+import android.util.SparseArray;
+
+/**
+ * Provides a collection that maps unique request codes to CordovaPlugins and Integers.
+ * Used to ensure that when plugins make requests for runtime permissions, those requests do not
+ * collide with requests from other plugins that use the same request code value.
+ */
+public class CallbackMap {
+    private int currentCallbackId = 0;
+    private SparseArray<Pair<CordovaPlugin, Integer>> callbacks;
+
+    public CallbackMap() {
+        this.callbacks = new SparseArray<Pair<CordovaPlugin, Integer>>();
+    }
+
+    /**
+     * Stores a CordovaPlugin and request code and returns a new unique request code to use
+     * in a permission request.
+     *
+     * @param receiver      The plugin that is making the request
+     * @param requestCode   The original request code used by the plugin
+     * @return              A unique request code that can be used to retrieve this callback
+     *                      with getAndRemoveCallback()
+     */
+    public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
+        int mappedId = this.currentCallbackId++;
+        callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode));
+        return mappedId;
+    }
+
+    /**
+     * Retrieves and removes a callback stored in the map using the mapped request code
+     * obtained from registerCallback()
+     *
+     * @param mappedId      The request code obtained from registerCallback()
+     * @return              The CordovaPlugin and orignal request code that correspond to the
+     *                      given mappedCode
+     */
+    public synchronized Pair<CordovaPlugin, Integer> getAndRemoveCallback(int mappedId) {
+        Pair<CordovaPlugin, Integer> callback = callbacks.get(mappedId);
+        callbacks.remove(mappedId);
+        return callback;
+    }
+}

+ 51 - 0
platforms/android/assets/www/apps/accountMng/index.html

@@ -0,0 +1,51 @@
+<!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="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>
+

+ 871 - 0
platforms/android/assets/www/apps/accountMng/js/controllers.js

@@ -0,0 +1,871 @@
+starter.controller('AccountManageCtrl', function ($scope, global, showPopup, CompManage) {
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        $scope.show = {
+            isshow: false
+        };
+        global.fetch_user().then(function (data) {
+            $scope.is_showcurrent = (global.user.compno!=null);
+            if (global.user.token != "") {
+                CompManage.get_Compdata().then(function (data) {
+                    data = _.filter(data, function (item) {
+                        return item.usr_status == 2;
+                    });
+                    if (data.length > 0) {
+                        _.each(data, function (c) {
+                            c.check = false;
+                            if (c.id == global.user.compno) {
+                                $scope.currentcomp = c;
+                                c.check = true;
+                            }
+                        });
+                    }
+                    $scope.compdata = data;
+                }, function (err) {
+                    $scope.is_showcurrent = false;
+                    alert(JSON.stringify(err))
+                });
+            } else {
+                $scope.compdata = [];
+            }
+        });
+    });
+
+    $scope.change = function (comp) {
+        if ($scope.compdata.length > 0) {
+            if ($scope.currentcomp != comp) {
+                showPopup.showLoading(1, '', false);
+                var password = global.user.password;
+                CompManage.post_authcheck(global.user.im_usrid, comp.id).then(function (data) {
+                    $scope.currentcomp = comp;
+                    $scope.show.isshow = false;
+                    _.each($scope.compdata, function (_comp) {
+                        if (comp.id != _comp.id) {
+                            _comp.check = false;
+                        }
+                    });
+                    global.user = data;
+                    global.user.password = password;
+                    CompManage.store_user().then(function (data) {
+                        console.log(data);
+                        showPopup.hideLoading();
+                    }, function (error) {
+                        showPopup.hideLoading();
+                        console.log('store error:' + JSON.stringify(error));
+                    });
+                }, function (error) {
+                    showPopup.hideLoading();
+                    alert(JSON.stringify(error));
+                });
+            }
+        }
+    };
+
+    $scope.goBack = function () {
+        global.goBack();
+    };
+
+    $scope.showcomplist = function () {
+        if ($scope.compdata.length > 0) $scope.show.isshow = !$scope.show.isshow;
+    }
+})
+
+.controller('ManageCompCtrl', function ($scope, $state, $ionicPopup, $rootScope, $ionicHistory, $q, global, ImageManage, showPopup, CompManage) {
+    $scope.newcompname = {
+        "compname": ""
+    };
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        $scope.loading = ($scope.compdata == undefined);
+        global.fetch_user().then(function (data) {
+            if (global.user.token != "") {
+                getmycomplist();
+            } else {
+                $scope.compdata = [];
+                $scope.loading = false;
+            }
+            $scope.popup = {
+                isSetPopup: false
+            };
+        });
+    });
+
+    $scope.tocompinfo = function (compid, op) {
+        $state.go('compinfo', {
+            'compid': compid,
+            'op': op
+        });
+    };
+
+    $scope.showaddcompmodel = function () {
+        showPopup.modalTemplate('templates/createcomp-modaltemplate.html', 'slide-in-right', $scope).then(function (modal) {
+            $rootScope.commons.modal = modal;
+            $rootScope.commons.modal.show();
+        });
+    };
+
+    $scope.cancel = function () {
+        $rootScope.commons.modal.hide();
+        $scope.logourl = '../../../img/logo.png';
+    };
+
+    $scope.createcomp = function () {
+        var newcompdata = {"compname": "", "cellphone": global.user.cellphone, "username": "", "imid": "", "password": global.user.password};
+        newcompdata.username = global.user.usrname;
+        newcompdata.compname = $scope.newcompname.compname;
+        newcompdata.imid = global.user.im_usrid;
+        showPopup.showLoading(1, '正在提交', true, $scope.logourl != "../../../img/logo.png" ? 20000 : 10000);
+        CompManage.post_Register(newcompdata).then(function (compdata) {
+            if ($scope.logourl != "../../../img/logo.png") {
+                if (global.user.token == "") {
+                    var password = global.user.password;
+                    CompManage.post_authcheck(global.user.im_usrid, compdata.compid).then(function (data) {
+                        global.user = data;
+                        global.user.password = password;
+                        uploadcomplogo(compdata);
+                        CompManage.store_user().then(function () {
+                        }, function (error) {
+                            showPopup.hideLoading();
+                            console.log('store error:' + JSON.stringify(error));
+                        });
+                    }, function (err) {
+                        showPopup.hideLoading();
+                        alert('post_authcheck error:' + JSON.stringify(err))
+                    });
+                } else {
+                    uploadcomplogo(compdata)
+                }
+            } else {
+                get_authcheckInfo(compdata.compid);
+            }
+        }, function (e) {
+            showPopup.hideLoading();
+            if (_.has(e.data, 'msg')) showPopup.PopupWindow(0, e.data.msg, false, 2000);
+            else alert(JSON.stringify(e));
+        });
+    };
+
+    $scope.$on('$destroy', function () {
+        if ($rootScope.commons.modal != null) {
+            $rootScope.commons.modal.remove();
+        }
+        beforeEnter = null;
+    });
+
+    $scope.logourl = '../../../img/logo.png';
+
+    $scope.editlogo = function () {
+        $scope.popup.optionsPopup = showPopup.showSelectImgPopup(Camera, ImagePicker, $scope);
+        $scope.popup.isSetPopup = true;
+    };
+
+    function uploadcomplogo(comp) {
+        ImageManage.uploadImage($scope.logourl, 'comp', comp.compid, 'complogo').then(function (res) {
+            $q.all(res).then(function (res1) {
+                get_authcheckInfo(comp.id);
+            }, function (error) {
+                showPopup.hideLoading();
+                alert('upload error:' + JSON.stringify(error));
+            });
+        }, function (err) {
+            showPopup.hideLoading();
+            alert('upload token error:' + JSON.stringify(err));
+        });
+    }
+
+    function get_authcheckInfo(compid) {
+        if (global.user.token == '') {
+            var password = global.user.password;
+            CompManage.post_authcheck(global.user.im_usrid, compid).then(function (data) {
+                global.user = data;
+                global.user.password = password;
+                getmycomplist();
+                CompManage.store_user().then(function (data) {
+                    console.log(data);
+                    $ionicHistory.goBack();
+                    showPopup.hideLoading();
+                }, function (error) {
+                    showPopup.hideLoading();
+                    console.log('store error:' + JSON.stringify(error));
+                });
+            }, function (err) {
+                showPopup.hideLoading();
+                alert('post_authcheck error:' + JSON.stringify(err))
+            });
+        } else {
+            showPopup.hideLoading();
+            if ($rootScope.commons.modal != null) $rootScope.commons.modal.hide();
+            getmycomplist();
+        }
+    }
+
+    function getmycomplist() {
+        CompManage.get_Compdata().then(function (data) {
+            _.each(data, function (comp) {
+                if (comp.file_thumbnail_path == null) {
+                    comp.file_thumbnail_path = $scope.logourl;
+                }
+                var admin = _.find(comp.compadmin, function (adminitem) {
+                    return adminitem.user_id == global.user.usrid;
+                });
+                comp.op = admin == undefined ? 0 : 1;
+                comp.compadmins = _.pluck(comp.compadmin, 'username').join(',');
+            });
+            $scope.compdata = _.sortBy(data, 'op').reverse();
+            $scope.loading = false;
+            $scope.newcompname.compname = "";
+            $scope.logourl = "../../../img/logo.png"
+        }, function (err) {
+            $scope.loading = false;
+            alert(JSON.stringify(err));
+        });
+    }
+
+    var ImagePicker = function () { //打开相册
+        $scope.popup.optionsPopup.close();
+        ImageManage.ImagePicker_getPictures(1).then(function (data) {
+            if (data.length == 0) return;
+            $scope.logourl = data[0];
+        });
+    };
+
+    var Camera = function () {
+        $scope.popup.optionsPopup.close();
+        ImageManage.Camera_getPicture(true).then(function (result) {
+            $scope.logourl = result;
+        });
+    };
+})
+
+.controller('JoinCompCtrl', function ($scope, $ionicHistory, $timeout, CompManage, global, showPopup) {
+    $scope.data = {
+        "compid": ""
+    };
+    var compdata = _.pick(global.user, 'cellphone', 'password');
+    compdata.username = global.user.usrname;
+    compdata.imid = global.user.im_usrid;
+    $scope.addedcomp = {};
+    $scope.is_show_jointip = false;
+    $scope.joincomp = function () {
+        var complist = CompManage.getComplist();
+        var comp = _.findWhere(complist, {'id': $scope.data.compid});
+        compdata.compid = $scope.data.compid;
+        if (comp == undefined) { //未加入过
+            showPopup.showLoading(1, '正在提交', true);
+            CompManage.post_Joinin(compdata).then(function (data) {
+                showPopup.hideLoading();
+                $scope.is_show_jointip = true;
+                $timeout(function () {
+                    $scope.is_show_jointip = false;
+                }, 5000);
+            }, function (e) {
+                showPopup.hideLoading();
+                if (_.has(e.data, 'msg')) showPopup.PopupWindow(0, e.data.msg, false, 2000);
+                else alert(JSON.stringify(e));
+            });
+        } else {
+            if (comp.file_thumbnail_path == "") {
+                comp.file_thumbnail_path = '../../../img/logo.png'
+            }
+            showPopup.PopupWindow(0, '你已加入该公司!', false, 2000);
+            $scope.addedcomp = comp;
+        }
+    };
+})
+
+.controller('CompInfoCtrl', function ($scope, $ionicPopup, $state, $ionicHistory, $q, showPopup, ImageManage, CompManage, global) {
+    var compid = $state.params['compid'];
+    $scope.op = $state.params['op'];
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        var compdata = CompManage.getComplist();
+        $scope.rdata = _.find(compdata, function (comp) {
+            return comp.id == $state.params['compid'];
+        });
+        console.log($scope.rdata);
+        $scope.data = _.clone($scope.rdata);
+        $scope.popup = {
+            isPopup: false
+        };
+    });
+
+    $scope.$on("$destroy", function () {
+        beforeEnter = null;
+    });
+
+    $scope.selectphoto = function () {
+        if ($scope.op == 0) {
+            return;
+        }
+        $scope.popup.optionsPopup = showPopup.showSelectImgPopup(Camera, ImagePicker, $scope);
+        $scope.popup.isPopup = true;
+    };
+
+    $scope.disbandcomp = function () {
+        showPopup.confirm('确定解散公司吗?', '确定', '取消').then(function (res) {
+            if (res) {
+                //解散
+                showPopup.showLoading(1, '', false);
+                CompManage.dismiss_comp($scope.data.id).then(function () {
+                    CheckComp();
+                    // alert('dismiss_comp success')
+                }, function (error) {
+                    showPopup.hideLoading();
+                    alert('error disbandcomp:' + JSON.stringify(error));
+                });
+            }
+        })
+    };
+
+    $scope.leavecomp = function () {
+        showPopup.confirm('确定退出公司吗?', '确定', '取消').then(function (res) {
+            if (res) {
+                if ($scope.op == 1) { //admin
+                    if ($scope.rdata.compadmin.length > 1) { //admin count>=2
+                        //退出
+                        showPopup.showLoading(1, '', false);
+                        CompManage.leave_comp($scope.data.id).then(function () {
+                            CheckComp();
+                        }, function (error) {
+                            showPopup.hideLoading();
+                            alert('error leavecomp:' + JSON.stringify(error));
+                        })
+                    } else {
+                        showPopup.PopupWindow(0, '你是该公司唯一的管理员不允许退出!', false);
+                    }
+                } else {
+                    //退出
+                    showPopup.showLoading(1, '', false, 20000);
+                    CompManage.leave_comp($scope.data.id).then(function () {
+                        CheckComp();
+                    }, function (error) {
+                        showPopup.hideLoading();
+                        alert('error leavecomp:' + JSON.stringify(error));
+                    });
+                }
+            }
+        })
+    };
+
+    $scope.showeditpopup = function () {
+        if ($scope.op == 0) {
+            return;
+        }
+        $scope.editdata = _.clone($scope.data);
+        var myPopup = $ionicPopup.show({
+            template: '<div class="popup-edit-comp" ><input type="text" ng-model="editdata.name" ><label ></label></div>',
+            title: '<div><h5>修改公司名称</h5></div>',
+            scope: $scope,
+            buttons: [{
+                text: '取消',
+                onTap: function () {
+                    return false;
+                }
+            }, {
+                text: '<b>保存</b>',
+                type: 'button-positive',
+                onTap: function (e) {
+                    if (!$scope.editdata.name) {
+                        e.preventDefault();
+                    } else {
+                        return true;
+                    }
+                }
+            }]
+        });
+
+        myPopup.then(function (res) {
+            if (res) {
+                // alert('editComp');
+                if ($scope.editdata.name != $scope.data.name) {
+                    CompManage.editComp($scope.editdata).then(function (data) {
+                        $scope.data.name = $scope.editdata.name;
+                        // alert(1);
+                    }, function (err) {
+                        alert('Error:' + JSON.stringify(err));
+                    });
+                }
+            }
+        });
+    };
+    $scope.image_list = [];
+
+    var ImagePicker = function () { //打开相册
+        $scope.popup.optionsPopup.close();
+        ImageManage.ImagePicker_getPictures(1).then(function (result) {
+            if (result.length == 0) return;
+            uploadimage(result[0]);
+        });
+    };
+
+    var Camera = function () {
+        $scope.popup.optionsPopup.close();
+        ImageManage.Camera_getPicture(true).then(function (result) {
+            uploadimage(result);
+        });
+    };
+
+    function CheckComp() {
+        var compdata = CompManage.getComplist();
+        compdata.splice(_.findIndex(compdata, {'id': $scope.data.id}), 1);
+        if (compdata.length > 0 && global.user.compno == $scope.data.id) { //退出/解散当前登录的公司
+            var comp = compdata[0];
+            var password = global.user.password;
+            CompManage.post_authcheck(global.user.im_usrid, comp.id).then(function (data) {
+                global.user = data;
+                global.user.password = password;
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+                CompManage.store_user().then(function (data) {
+                    console.log(data);
+                }, function (error) {
+                    console.log('store error:' + JSON.stringify(error));
+                });
+            });
+        } else if (compdata.length == 0) { //用户没有公司时
+            global.user.token = "";
+            global.user.compno = "";
+            global.user.compname = "";
+            global.user.deptno = "";
+            global.user.deptname = "";
+            global.user.roleid = "";
+            showPopup.hideLoading();
+            $ionicHistory.goBack();
+            CompManage.store_user().then(function (data) {
+                console.log(JSON.stringify(data));
+            }, function (error) {
+                console.log('store error:' + JSON.stringify(error));
+            });
+        } else {
+            showPopup.hideLoading();
+            $ionicHistory.goBack();
+        }
+    }
+
+    function uploadimage(result) {
+        showPopup.showLoading(1, '', false, 20000);
+        ImageManage.uploadImage(result, 'comp', $scope.data.id, 'complogo').then(function (res) {
+            $q.all(res).then(function (res1) {
+                showPopup.hideLoading();
+                $scope.data.file_thumbnail_path = JSON.parse(res1[0].response).file_thumbnail_path;
+            }, function (error) {
+                showPopup.hideLoading();
+                alert('upload error:' + JSON.stringify(error));
+            })
+        }, function (error) {
+            alert('get token error:' + JSON.stringify(error));
+            showPopup.hideLoading();
+        });
+    }
+})
+
+.controller('ApplyCheckCtrl', function ($scope, $ionicPlatform, $cordovaPreferences, $location, global, CompManage, showPopup) {
+    var compid = $location.search().compid;
+    global.fetch_user().then(function (data) {
+        getAuditUsers();
+    }, function (error) {
+        alert(JSON.stringify(error));
+    });
+
+    $scope.check = function (user, op) { //todo:y=0;n=1
+        // alert(JSON.stringify($scope.audituserlst))
+        showPopup.showLoading(1, '正在提交', false);
+        CompManage.auditUser(user, op, compid).then(function (data) {
+            showPopup.hideLoading();
+            $scope.audituserlst.splice(_.indexOf($scope.audituserlst, user), 1);
+        }, function (err) {
+            showPopup.hideLoading();
+            alert(JSON.stringify(err));
+        });
+    };
+    $scope.doRefresh = function () {
+        getAuditUsers();
+    };
+
+    $scope.goBack = function () {
+        global.goBack();
+    }
+
+    function getAuditUsers() {
+        if (global.user.token != "") {
+            CompManage.getUserAuditstatus(1, compid).then(function (data) {
+                $scope.audituserlst = data;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+            });
+        }
+    }
+})
+
+.controller('ContactsCompanylstCtrl', function ($scope, $cordovaPreferences, $ionicPlatform, $state, global, Dept, CompManage) {
+    $scope.complistdata = [];
+    $scope.logourl = '../../../img/logo.png';
+    $scope.loading = true;
+    var beforeEnter = $scope.$on('$ionicView.beforeEnter', function () {
+        Dept.setdeptlst([]);
+        // alert(Dept.all().length);
+    });
+    $scope.init = function () {
+        global.fetch_user().then(function (data) {
+            if (global.user.token != "") {
+                CompManage.get_Compdata().then(function (data) {
+                    // alert(JSON.stringify(data));
+                    _.each(data, function (c) {
+                        if (c.file_thumbnail_path == null) {
+                            c.file_thumbnail_path = $scope.logourl;
+                        }
+                    })
+                    $scope.complistdata = data;
+                    $scope.loading = false;
+                });
+            } else {
+                $scope.loading = false;
+            }
+        }, function (error) {
+            $scope.loading = false;
+            alert(JSON.stringify(error));
+        });
+    };
+
+    $scope.goBack = function () {
+        global.goBack();
+    }
+
+    $scope.tocompuser = function (compid, compname) {
+        $state.go('deptlst', {
+            id: -1,
+            name: compname,
+            compid: compid
+        })
+    };
+
+    function getcompdata() {
+        if (global.user.token != "") {
+            CompManage.get_Compdata().then(function (data) {
+                $scope.complistdata = data;
+            });
+        }
+    }
+})
+
+.controller('DeptCtrl', function ($scope, $state, $http, $stateParams, Dept, $ionicViewSwitcher) {
+    $scope.deptlst = [];
+    $scope.emplst = [];
+    $scope.titleName = '';
+    $scope.checked = false;
+    $scope.titleName = $stateParams.name;
+    $scope.deptid = -1;
+    $scope.$on('$ionicView.beforeEnter', function () {
+        $scope.deptid = setdeptid();
+        if (Dept.all().length == 0) {
+            $scope.loading = true;
+            Dept.getDep($stateParams.compid).then(function (data) {
+                $scope.deptid = setdeptid();
+                data = _.filter(data, function (item) {
+                    return item.parent == $scope.deptid;
+                });
+                $scope.dept_data = data;
+                $scope.deptlst = data;
+                getemp();
+            }, function (err) {
+                $scope.loading = false;
+            });
+        } else {
+            $scope.loading = false;
+            var data = Dept.getChildDept($scope.deptid);
+            $scope.dept_data = data;
+            $scope.deptlst = data;
+            getemp();
+        }
+    });
+
+    function setdeptid() {
+        var deptid = parseInt($stateParams.id);
+        if (Dept.all().length > 0) {
+            if (deptid < 0) {
+                deptid = _.find(Dept.all(), function (item) {
+                    return item.level == 0
+                }).id;
+            }
+        }
+        return deptid;
+    }
+
+    function getemp() {
+        Dept.getEmp($scope.deptid, $stateParams.compid).then(function (data) {
+            console.log('user json:' + JSON.stringify(data));
+            $scope.emplst = data;
+            $scope.loading = false;
+        }, function (err) {
+            $scope.loading = false;
+            alert(JSON.stringify(err));
+        });
+    }
+
+    $scope.deptdisplay = function () {
+        if ($scope.deptlst.length > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    };
+
+    $scope.empdisplay = function () {
+        if ($scope.emplst.length > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    };
+
+    $scope.search = function () {
+        $state.go('search');
+    };
+
+    $scope.editDep = function () {
+        $state.go('editDep', {
+            id: $scope.deptid,
+            compid: $stateParams.compid,
+            name: $stateParams.name
+        });
+        $ionicViewSwitcher.nextDirection("back");
+    };
+
+    $scope.cancel = function () {
+        $state.go('addGroup2');
+    };
+
+    $scope.lookMsg = function (im_id, name, cellphone) {
+        var data = {
+            'im_id': im_id,
+            'name': name,
+            'cellphone': cellphone
+        }
+        console.log(data)
+        if (window.cordovaLinker != undefined) {
+            window.cordovaLinker.startChat(data, function (s) {
+                console.log(s);
+            }, function (err) {
+                console.error(err);
+            });
+        }
+    };
+
+    $scope.todept = function (dept) {
+        $state.go('deptlst', {id: dept.id, name: dept.depname, compid: $stateParams.compid})
+    };
+})
+
+.controller('EditDepCtrl', function ($scope, $ionicPopup, $stateParams, $timeout, $ionicHistory, Dept, showPopup, Tool) {
+    $scope.deptlst = [];
+    $scope.titleName = $stateParams.name;
+    var del_deptids = [];
+    var dept_data = [];
+    var compid = $stateParams.compid;
+    var beforeenter = $scope.$on('$ionicView.beforeEnter', function () {
+        $scope.deptlst = Tool.cloneObj(Dept.getChildDept($stateParams.id));
+        dept_data = Tool.cloneObj($scope.deptlst);
+    });
+
+    $scope.add = function () {
+        $timeout(function () {
+            $scope.deptlst.push({
+                depname: '',
+                parent_id: $stateParams.id
+            })
+        })
+    };
+    $scope.remove = function (dept, index) {
+        if (_.has(dept, 'id')) del_deptids.push(dept.id);
+        $scope.deptlst.splice(index, 1);
+    };
+
+    $scope.save = function () {
+        var deptlst = _.filter($scope.deptlst, function (dep) {
+            return Tool.trim(dep.depname).length > 0;
+        });
+        if (deptlst.length > _.uniq(_.pluck(deptlst, 'depname')).length) {
+            showPopup.PopupWindow(0, '名称不能重复!', false);
+            return;
+        }
+        var depts = _.partition(deptlst, 'id');
+        var up_depts = _.map(_.difference(stringify(depts[0]), stringify(dept_data)), JSON.parse);
+        var add_depts = depts[1];
+        if (del_deptids.length > 0 || add_depts.length > 0 || up_depts.length > 0) {
+            showPopup.showLoading(1, '', false);
+            $scope.isdisabled_ok = true;
+            Dept.save(up_depts, del_deptids, add_depts, compid).then(function (data) {
+                Dept.setdeptlst([]);
+                $ionicHistory.goBack();
+            }, function (err) {
+                console.log(err);
+            }).finally(function (f) {
+                showPopup.hideLoading();
+                $scope.isdisabled_ok = false;
+            }); //修改、删除、添加;
+        }
+    };
+
+    function stringify(data) {
+        return _.map(data, JSON.stringify);
+    }
+
+    $scope.cancel = function () {
+        if (JSON.stringify($scope.deptlst) != JSON.stringify(dept_data)) {
+            showPopup.confirm('是否退出编辑?', '是', '否').then(function (res) {
+                if (res) {
+                    $ionicHistory.goBack();
+                }
+            });
+        } else $ionicHistory.goBack();
+    };
+})
+
+.controller('PersonInfoCtrl', function ($scope, $state, $rootScope, $ionicPopup, $ionicModal, $q, $timeout, $ionicHistory, formatFilter, Dept, showPopup, global, ImageManage, Member) {
+    $scope.personinfo = {value: ''};
+    $scope.selectdatas = [{
+        name: '女',
+        id: 0
+    }, {
+        name: '男',
+        id: 1
+    }];
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        global.fetch_user().then(function (data) {
+            $scope.loading = $scope.userinfo == undefined;
+            Dept.getUsrDetail().then(function (data) {
+                $scope.userinfo = angular.copy(data);
+                $scope.userinfo.photo = data.photo == null ? '../../../img/panda.png' : data.photo;
+                $scope.userinfo.compname = global.user.compname;
+                $scope.userinfo.compno = global.user.compno;
+                $scope.loading = false;
+            }, function (err) {
+                alert(JSON.stringify(err))
+            });
+        });
+        $scope.popup = {
+            isPopup: false,
+            optionsPopup: null
+        };
+    });
+
+    $scope.selectimg = function () {
+        $scope.popup.optionsPopup = showPopup.showSelectImgPopup(Camera, ImagePicker, $scope);
+        $scope.popup.isPopup = true;
+    };
+
+    $scope.editInfo = function (title, input_type, field_name, value) {
+        $scope.userinfo[field_name] = value == undefined ? '' : value;
+        $scope.personinfo.value = value == undefined ? '' : value;
+        var template = formatFilter('<div rj-close-back-drop><label class="item item-input"> <input type="{0}" ng-model="personinfo.value" placeholder="输入{1}"></label></div>', input_type, title);
+        $scope.popup.optionsPopup = $ionicPopup.show({
+            template: template,
+            title: '<div><h4>' + title + '</h4></div>',
+            scope: $scope,
+            buttons: [{
+                text: '取消',
+                onTap: function () {
+                    return false;
+                }
+            }, {
+                text: '<b>保存</b>',
+                type: 'button-positive',
+                onTap: function (e) {
+                    if (!$scope.personinfo.value) e.preventDefault(); else  return true;
+                }
+            }]
+        });
+        $scope.popup.optionsPopup.then(function (res) {
+            if (res) {
+                $scope.userinfo[field_name] = $scope.personinfo.value;
+                $scope.updateInfo();
+                $scope.popup.optionsPopup.close();
+            }
+        });
+        $scope.popup.isPopup = true;
+    };
+
+    var ImagePicker = function () {
+        $scope.popup.optionsPopup.close();
+        ImageManage.ImagePicker_getPictures(1).then(function (data) {
+            if (data.length == 0) return;
+            uploadimg(data);
+        });
+    };
+
+    var Camera = function () {
+        $scope.popup.optionsPopup.close();
+        ImageManage.Camera_getPicture(true).then(function (result) {
+            uploadimg([result])
+        });
+    };
+
+    function uploadimg(files) {
+        showPopup.showLoading(1, '', true);
+        ImageManage.uploadImage(files, 'user', global.user.usrid, 'userfile').then(function (ps) {
+            $q.all(ps).then(function (fs) {
+                $scope.userinfo.photo = JSON.parse(fs[0].response).file_thumbnail_path;
+                showPopup.hideLoading();
+            }, function (err) {
+                showPopup.hideLoading();
+            })
+        }, function (err) {
+            showPopup.hideLoading();
+        })
+    }
+
+    $scope.updateInfo = function () {
+        showPopup.showLoading(1, '', false);
+        Dept.putUsrInfo($scope.userinfo).then(function (res) {
+            showPopup.hideLoading();
+        }, function (err) {
+            showPopup.hideLoading();
+        })
+    };
+
+    $scope.$on("$destroy", function () {
+        beforeEnter = null;
+        Member.selecteddepts = [];
+        if ($rootScope.commons.modal != null) $rootScope.commons.modal.remove();
+    })
+})
+
+.controller('EditDeptDegreeCtrl', function ($scope, $state, $rootScope, $ionicHistory, $timeout, global, Member, showPopup, Dept, Tool) {
+    $scope.userinfo = {};
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        global.fetch_user().then(function (data) {
+            if (Member.selecteddepts.length > 0) {
+                $scope.userinfo.depname = Member.selecteddepts[0].depname;
+                $scope.userinfo.dept_id = Member.selecteddepts[0].id;
+            } else $scope.userinfo = Tool.getTempData('userinfo');
+        });
+    });
+
+    $scope.selectdept = function () {
+        Member.routename = 'editdeptdegree';
+        Member.titlename = '选择部门';
+        Member.resourcemember = [{'id': $scope.userinfo.dept_id, 'depname': $scope.userinfo.depname}];
+        Member.selecteddepts = [];
+        $state.go('selectsingledept');
+    };
+
+    $scope.ok = function () {
+        showPopup.showLoading(1, '', false);
+        Dept.putUsrInfo($scope.userinfo).then(function (res) {
+            showPopup.hideLoading();
+            $ionicHistory.goBack();
+        }, function (err) {
+            showPopup.hideLoading();
+            alert(JSON.stringify(err));
+        })
+    };
+
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    };
+
+    $scope.$on("$destroy", function () {
+        beforeEnter = null;
+        Member.selecteddepts = [];
+    })
+})
+;

+ 0 - 0
platforms/android/assets/www/apps/accountMng/js/directive.js


+ 67 - 0
platforms/android/assets/www/apps/accountMng/js/factory.js

@@ -0,0 +1,67 @@
+starter.factory('CompManage', function ($http, $q, $filter, $ionicPlatform, $cordovaPreferences, cfg, formatFilter, global, Tool) {
+
+    var complist = [];
+
+    return {
+        post_Register: function (data) {
+            console.log(data)
+            var url = formatFilter('{0}register/', cfg.api);
+            return Tool.post(url, data);
+        },
+        post_Joinin: function (data) {
+            console.log(data)
+            var url = formatFilter('{0}joinin/', cfg.api);
+            return Tool.post(url, data);
+        },
+        getUserAuditstatus: function (auditstatus, compid) {
+            var url = formatFilter('{0}joinin/?auditstatus={1}&compid={2}', cfg.api, auditstatus, compid);
+            return Tool.get(url);
+        },
+        auditUser: function (user, status, compid) {
+            var url = formatFilter('{0}joinin/{1}/?status={2}&compid={3}', cfg.api, user.user_id, status, compid);
+            return Tool.put(url);
+        },
+        get_Compdata: function () {
+            var url = formatFilter('{0}comps/', cfg.api);
+            return Tool.get(url, true, 'complist');
+        },
+        getComplist: function () {
+            complist = Tool.getTempData('complist');
+            return complist;
+        },
+        editComp: function (data) {
+            var url = formatFilter('{0}comps/{1}/', cfg.api, data.id);
+            return Tool.put(url, data);
+        },
+        post_authcheck: function (imid, compid) {
+            var url = formatFilter('{0}authcheck/', cfg.api);
+            var d = $filter('format')("imid={0}&compid={1}&password={2}", imid, compid, global.user.password);
+            return Tool.post(url, d, false);
+        },
+        store_user: function () {
+            var deferred = $q.defer();
+            var user = Tool.cloneObj(global.user);
+            user.cfg = {'api': global.api};
+            $cordovaPreferences.store('user', ionic.Platform.isAndroid() ? JSON.stringify(user) : user)
+            .success(function (value) {
+                deferred.resolve(value);
+                // alert("store Success: " + value);
+            })
+            .error(function (error) {
+                deferred.reject(err);
+                alert("store Error: " + error);
+            });
+            return deferred.promise;
+        },
+        leave_comp: function (compid) {
+            var url = formatFilter('{0}comps/{1}/?type={2}', cfg.api, compid, "leave");
+            var d = $filter('format')("imid={0}&compid={1}", global.user.im_usrid, compid);
+            return Tool.put(url, d);
+        },
+        dismiss_comp: function (compid) {
+            var url = formatFilter('{0}comps/{1}/?type={2}', cfg.api, compid, "dismiss");
+            var d = $filter('format')("compid={0}", compid);
+            return Tool.put(url, d);
+        }
+    };
+})

+ 61 - 0
platforms/android/assets/www/apps/accountMng/js/route.js

@@ -0,0 +1,61 @@
+starter.config(function ($stateProvider, $translateProvider) {
+    $stateProvider.state('account-manage', {
+        url: '/index',
+        templateUrl: 'templates/account-manage.html',
+        controller: 'AccountManageCtrl'
+    })
+
+    .state('managecomp', {
+        url: '/managecomp',
+        templateUrl: 'templates/managecomp.html',
+        controller: 'ManageCompCtrl'
+    })
+
+    .state('compinfo', {
+        url: '/compinfo/:compid/:op',
+        templateUrl: 'templates/compinfo.html',
+        controller: 'CompInfoCtrl'
+    })
+
+    .state('joincomp', {
+        url: '/joincomp',
+        templateUrl: 'templates/joincomp.html',
+        controller: 'JoinCompCtrl'
+    })
+
+    .state('applycheck', {
+        url: '/applycheck',
+        templateUrl: 'templates/applycheck.html',
+        controller: 'ApplyCheckCtrl'
+    })
+
+    .state('contacts-companylst', {
+        url: '/contacts-companylst',
+        templateUrl: 'templates/contacts-companylst.html',
+        controller: 'ContactsCompanylstCtrl'
+    })
+
+    .state('deptlst', {
+        url: '/contacts/:id&:name&:compid',
+        templateUrl: 'templates/contacts-deptlst.html',
+        controller: 'DeptCtrl'
+    })
+
+    .state('editDep', {
+        url: '/editDep/:id&:name&:compid',
+        templateUrl: 'templates/editDep.html',
+        controller: 'EditDepCtrl'
+    })
+
+    .state('personinfo', {
+        url: '/personinfo',
+        templateUrl: 'templates/personinfo.html',
+        controller: 'PersonInfoCtrl'
+    })
+
+    .state('editdeptdegree', {
+        url: '/editdeptdegree',
+        templateUrl: 'templates/edit_deptdegree.html',
+        controller: 'EditDeptDegreeCtrl'
+    })
+});

+ 52 - 0
platforms/android/assets/www/apps/accountMng/templates/account-manage.html

@@ -0,0 +1,52 @@
+<ion-view view-title="公司" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-content class="account-back-color">
+        <div class="item item-divider"></div>
+        <a class="item item-icon-left item-icon-right current-account item-text-wrap" ng-click="showcomplist()" ng-if="is_showcurrent">
+            <i class="icon icon ion-android-globe placeholder-icon"></i>{{'currentcompTitle' | translate}}
+            <p class="item-text-wrap">{{currentcomp.name}}(代号:{{currentcomp.id}})</p>
+            <i class="icon cirl-i" ng-class="{true:'ion-ios-arrow-up',false:'ion-ios-arrow-down'}[show.isshow]"></i>
+        </a>
+        <ul class="list comp-list" ng-if="show.isshow" ng-class="{true:'hidden-item',false:''}[headerion.rightion]">
+            <li class="item-sort" ng-repeat="comp in compdata">
+                <div class="account-wrap item-text-wrap">
+                    <ion-radio class=" item-radio account-radio over-flow-auto  item-text-wrap" name='right' ng-model="comp.check" ng-value="true" ng-click="change(comp)">
+                        {{comp.name}}&nbsp;&nbsp;({{'codeTitle' | translate}}:{{comp.id}})
+                    </ion-radio>
+                </div>
+            </li>
+        </ul>
+        <a class="item item-icon-left item-icon-right" href="#/managecomp">
+            <i class="icon ion-disc placeholder-icon"></i>{{'managecompTitle' | translate}}
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <a class="item item-icon-left item-icon-right" href="#/joincomp">
+            <i class="icon ion-plus-circled placeholder-icon"></i>{{'joinnewcompTitle'| translate }}
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <div class="item item-divider"></div>
+        <a class="item item-icon-left item-icon-right" href="#/personinfo">
+            <i class="icon ion-person placeholder-icon"></i>我的个人信息
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <!--<a class="item item-icon-left item-icon-right" href="#/account-manage">
+            <i class="icon ion-ios-locked placeholder-icon"></i>{{'accesscontrolTitle'| translate }} 
+            <p>比如 成员管理权限、考勤管理权限...</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>-->
+        <!-- <div class="item item-divider"></div> -->
+        <!--<a class="item item-icon-left item-icon-right" href="">
+            <i class="icon ion-eye-disabled placeholder-icon"></i>{{'privacysetlTitle'| translate }}
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <a class="item item-icon-left item-icon-right" href="">
+            <i class="icon ion-ios-cloud-download placeholder-icon"></i>{{'companydataretrieveTitle'| translate }} 
+            <p>比如 离职员工资料信息...</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>-->
+        <!--         <div class="item item-divider"></div>
+        <button class="button button-full button-light account-botton">解散公司</button> -->
+    </ion-content>
+</ion-view>

+ 23 - 0
platforms/android/assets/www/apps/accountMng/templates/applycheck.html

@@ -0,0 +1,23 @@
+<ion-view view-title="成员申请" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div class="none-content center" ng-if="audituserlst.length==0">申请人列表为空!</div>
+        <ion-list class="apply-list">
+            <ion-item class="item item-apply" type="item-text-wrap" ng-repeat="user in audituserlst">
+                {{user.username}}
+                <p>{{user.cellphone}}</p>
+                <div>
+                    <button class="button button-outline button-energized" ng-click="check(user,1)">
+                        拒绝
+                    </button>
+                    <button class="button button-outline button-balanced" ng-click="check(user,0);">
+                        接受
+                    </button>
+                </div>
+            </ion-item>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 19 - 0
platforms/android/assets/www/apps/accountMng/templates/compinfo.html

@@ -0,0 +1,19 @@
+<ion-view view-title="{{'compinfoTitle' | translate}}">
+    <ion-content ng-init="init()">
+        <ion-item class="item item-icon-right item-icon-left item-group item-comp" ng-disabled="op==0" type="item-text-wrap" ng-click="selectphoto();">
+            <label class="compname">{{'companyTitle' | translate}}logo</label>
+            <img ng-src="{{data.file_thumbnail_path}}">
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <ion-item class="item item-icon-right over-flow-auto item-text-wrap" type="" ng-disabled="op==0" ng-click="showeditpopup();">
+            {{'companynameTitle' | translate}}
+            <p class="label-right-text">{{data.name}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+
+        <div class="comp-edit-button">
+            <button class="apply-register button button-block" ng-if="op==1" ng-click="disbandcomp()">{{'dismisscompTitle' | translate}}</button>
+            <button class="apply-register button button-block" ng-click="leavecomp()">{{'leavecompTitle' | translate}}</button>
+        </div>
+    </ion-content>
+</ion-view>

+ 18 - 0
platforms/android/assets/www/apps/accountMng/templates/contacts-companylst.html

@@ -0,0 +1,18 @@
+<ion-view view-title="公司" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider divider-font"><i class="icon ion-ios-star"></i>已加入公司({{complistdata.length}})</div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-init="init()" ng-show="!loading">
+            <ion-item class=" empclass complist item-avatar item-icon-right" ng-repeat="comp in complistdata" ng-click="tocompuser(comp.id,comp.name);" type="">
+                <img ng-src="{{comp.file_thumbnail_path}}">
+                <span class=" item-text-wrap">{{comp.name}}</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <ion-list>
+    </ion-content>
+</ion-view>

+ 39 - 0
platforms/android/assets/www/apps/accountMng/templates/contacts-deptlst.html

@@ -0,0 +1,39 @@
+<ion-view view-title="{{titleName}}" hide-nav-bar="false" hide-tabs="true">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="editDep();">编辑</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <!--<div class="item item-divider">-->
+            <!--<div>-->
+                <!--<label class="item item-input search-label">-->
+                    <!--<i class="icon ion-ios-search placeholder-icon"></i>-->
+                    <!--<input type="text" ng-focus="search();" placeholder="搜索姓名/拼音/电话">-->
+                <!--</label>-->
+            <!--</div>-->
+        <!--</div>-->
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div class="item item-divider divider-font" ng-if="deptdisplay();"><i class="icon ion-ios-star"></i>部门({{deptlst.length}})</div>
+        <ion-list ng-if="!loading">
+            <!--部门列表-->
+            <ion-item class="item item-icon-right" ng-repeat="dept in deptlst" type="item-text-wrap" ng-click="todept(dept)">
+                {{dept.depname}}
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </ion-list>
+        <!--联系人-->
+        <div class="item item-divider divider-font" ng-if="empdisplay();"><i class="icon ion-ios-star"></i>联系人({{emplst.length}})</div>
+        <ion-list class="audit-list" ng-if="!loading">
+            <ion-item ng-repeat="emp in emplst" ng-click="lookMsg(emp.im_usrid,emp.username,emp.cellphone)" class="item-thumbnail-left over-flow-auto item-text-wrap">
+                <img ng-src="../../../img/panda.png">
+                <h2>{{emp.username}}</h2>
+                <p>{{titleName}} {{emp.degree}}</p>
+                <ion-delete-button class="ion-minus-circled" ng-click="onItemDelete(item)">
+                </ion-delete-button>
+            </ion-item>
+            <ion-item class="item-border">
+            </ion-item>
+            <ion-list>
+    </ion-content>
+</ion-view>

+ 35 - 0
platforms/android/assets/www/apps/accountMng/templates/createcomp-modaltemplate.html

@@ -0,0 +1,35 @@
+<ion-modal-view class="newcomp-modalview">
+    <ion-header-bar>
+        <button class="button button-clear" ng-click="cancel()">{{'cancelTitle' | translate}}</button>
+        <h1 class="title">{{'createcompTitle' | translate}}</h1>
+    </ion-header-bar>
+    <ion-content class="create-comp-content">
+        <div class="comp-logo-box">
+            <img ng-src="{{logourl}}" ng-click="editlogo();">
+            <div><i class="ion-edit"></i>{{'editTitle' | translate}}logo</div>
+        </div>
+        <form name="form" novalidate>
+            <div class="list list-inset compname-div">
+                <label class="item item-input" ng-class="{'true':'border-red'}[form.compname.$dirty &&form.compname.$invalid]">
+                    <input type="text" name="compname" ng-model="newcompname.compname" ng-minlength="2" ng-maxlength="45"  required placeholder="{{'entercompanynameTitle'| translate }}">
+                </label>
+            </div>
+            <button type="submit" class="create-comp-button button button-block calm" ng-disabled="form.compname.$invalid||form.compname.$pristine" ng-click="createcomp()">{{'createcompTitle'| translate }}</button>
+        </form>
+        <!-- <div class="line-hr">
+            <div>^[\a-\z\A-\Z0-9\u4E00-\u9FA5]
+                <ion-item class=" comp-item item-avatar item-icon-right" type="item-text-wrap">
+                    <img ng-src="../../../img/panda.png">
+                    <label for="">聚福轩</label>
+                    <p><i class="ion-ios-person-outline icon-accessory ion-person"></i>管理员 李丽云</p>
+                </ion-item>
+                <div class="comp-op">
+                    <div>
+                        <label for="">已加入: 3人</label>
+                        <button class="button button-outline button-calm" ng-click="tocompinfo(0,0)">申请</button>
+                    </div>
+                </div>
+            </div>
+        </div> -->
+    </ion-content>
+</ion-modal-view>

+ 24 - 0
platforms/android/assets/www/apps/accountMng/templates/editDep.html

@@ -0,0 +1,24 @@
+<!---编辑部门-->
+<ion-view view-title="{{titleName}}" hide-back-button="true" cache-view="false">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="cancel();">取消</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="save();" ng-disabled="isdisabled_ok" >完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider divider-font"><i class="icon ion-ios-star"></i>部门({{deptlst.length}})</div>
+        <ion-list>
+            <ion-item class="item item-icon-left item-icon-right" ng-repeat="dept in deptlst track by $index" type="item-text-wrap">
+                <i class="icon ion-android-remove-circle" style="color:red;" ng-click="remove(dept,$index)"></i>
+                <input type="text" ng-model="dept.depname" placeholder="请输入部门名称"/>
+                <i class="icon ion-navicon-round icon-accessory"></i>
+            </ion-item>
+        </ion-list>
+        <ion-item class="item item-icon-left item-icon-right" type="item-text-wrap" ng-click="add();">
+            <i class="icon ion-plus-circled balanced"></i> 添加部门
+            <i class="icon ion-navicon-round icon-accessory"></i>
+        </ion-item>
+    </ion-content>
+</ion-view>
+<!-- ng-click="deptlst.splice($index, 1) -->

+ 20 - 0
platforms/android/assets/www/apps/accountMng/templates/edit_deptdegree.html

@@ -0,0 +1,20 @@
+<ion-view view-title="部门职位" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="cancel()">&nbsp;取消</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="ok()">&nbsp;完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider"></div>
+        <ion-item class="item item-icon-right" ng-click="selectdept()">
+            部门
+            <p class="label-right-text">{{userinfo.depname}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <label class="item item-input">
+            <span class="input-left-text">职位</span>
+            <input type="text" ng-model="userinfo.degree" focus-me="true">
+        </label>
+    </ion-content>
+</ion-view>

+ 37 - 0
platforms/android/assets/www/apps/accountMng/templates/joincomp.html

@@ -0,0 +1,37 @@
+<ion-view view-title="{{'joincompTitle'| translate }}">
+    <ion-content ng-init="init()">
+        <div class="joincomp-tip " ng-if="is_show_jointip">
+            <div class="title">
+                <label for=""><i class="ion-ios-checkmark-outline"></i></label>
+                <label for="">{{'successjointipTitle'| translate }}</label>
+            </div>
+        </div>
+        <div class="comp-logo-box">
+
+        </div>
+        <form name="form" novalidate>
+            <div class="list list-inset compname-div">
+                <label class="item item-input" ng-class="{'true':'border-red'}[form.compid.$dirty &&form.compid.$invalid]">
+                    <input type="tel" name="compid" ng-model="data.compid" ng-pattern="/^[1-9]\d{0,10}$/" required placeholder="{{'entercompanycodetipTitle'| translate }}">
+                </label>
+                <!--<span class="colorred" ng-show="form.compid.$dirty &&form.compid.$invalid">&nbsp;&nbsp;请输入正确的公司代号</span>-->
+            </div>
+            <button type="submit" class="create-comp-button button button-block calm" ng-disabled="form.compid.$invalid||form.compid.$pristine" ng-click="joincomp()">{{'joincompTitle'| translate }}</button>
+        </form>
+        <div class="line-hr" ng-if="addedcomp.compid!=undefined">
+            <div>
+                <ion-item class=" comp-item item-avatar item-icon-right" type="item-text-wrap">
+                    <img ng-src="{{file_thumbnail_path}}">
+                    <label for="">{{addedcomp.name}}</label>
+                    <p><i class="ion-ios-person-outline icon-accessory ion-person"></i>{{'administratorTitle' | translate}} {{addedcomp.compadmin}}</p>
+                </ion-item>
+                <div class="comp-op">
+                    <div>
+                        <label for="">{{'hadjoinedTitle' | translate}}: {{addedcomp.usrcount}}{{'personTitle' | translate}}</label>
+                        <!-- <button class="button button-outline button-calm" ng-click="tocompinfo(0,0)">申请</button> -->
+                    </div>
+                </div>
+            </div>
+        </div>
+    </ion-content>
+</ion-view>

+ 30 - 0
platforms/android/assets/www/apps/accountMng/templates/managecomp.html

@@ -0,0 +1,30 @@
+<ion-view view-title="{{'managecompTitle' | translate}}">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="showaddcompmodel()">
+            <i class="icon ion-android-add"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider divider-font">{{'hasjoinedcompTitle' | translate}}({{compdata==undefined?0:compdata.length}})</div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-init="init()" ng-show="!loading">
+            <div ng-repeat="comp in compdata">
+                <ion-item class=" comp-item item-avatar item-icon-right" type="item-text-wrap">
+                    <img ng-src="{{comp.file_thumbnail_path}}">
+                    <label for="" class="item-text-wrap">{{comp.name}}&nbsp;&nbsp;({{'codeTitle' | translate}}:{{comp.id}})</label>
+                    <p><i class="ion-ios-person-outline icon-accessory ion-person"></i>{{'administratorTitle' | translate}} {{comp.compadmins}}</p>
+                </ion-item>
+                <div class="comp-op">
+                    <div>
+                        <label for="">{{'hadjoinedTitle' | translate}}: {{comp.usrcount}}{{'personTitle' | translate}}</label>
+                        <button class="button button-outline button-calm" ng-if="comp.op==0&&comp.usr_status==2" ng-click="tocompinfo(comp.id,0)">{{'seeTitle' | translate}}</button>
+                        <button class="button button-outline button-calm" ng-if="comp.op==1&&comp.usr_status==2" ng-click="tocompinfo(comp.id,1)">{{'editTitle' | translate}}</button>
+                    </div>
+                </div>
+            </div>
+            <ion-list>
+    </ion-content>
+</ion-view>
+

+ 46 - 0
platforms/android/assets/www/apps/accountMng/templates/personinfo.html

@@ -0,0 +1,46 @@
+<ion-view view-title="个人信息">
+    <ion-content>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div class="item item-divider"></div>
+        <div class="list" ng-if="!loading">
+            <ion-item class="item item-icon-right item-group item-comp" ng-click="selectimg()">
+                <label class="compname">头像</label>
+                <img ng-src="{{userinfo.photo}}">
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <ion-item class="item item-icon-right" ng-click="editInfo('姓名','text','username',userinfo.username)">
+                姓名
+                <p class="label-right-text" ng-bind="userinfo.username"></p>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <label class="item item-input item-select">
+                <div class="input-label">
+                    性别
+                </div>
+                <select ng-model="userinfo.sex" ng-options="x.id as x.name for x in selectdatas" ng-change="updateInfo()"></select>
+            </label>
+            <div class="item item-divider"></div>
+            <ion-item class="item">
+                公司
+                <p class="item-note">{{userinfo.compname}}&nbsp;(代号:{{userinfo.compno}})</p>
+            </ion-item>
+            <ion-item class="item item-icon-right" ng-href="#/editdeptdegree">
+                部门职位
+                <p class="label-right-text">{{userinfo.depname}}&nbsp;&nbsp;&nbsp;&nbsp;{{userinfo.degree}}</p>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <ion-item class="item item-icon-right">
+                联系方式
+                <p class="label-right-text">{{userinfo.cellphone}}</p>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <ion-item class="item item-icon-right" ng-click="editInfo('邮箱','email','email',userinfo.email)">
+                邮箱
+                <p class="label-right-text" ng-bind="userinfo.email"></p>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </div>
+    </ion-content>
+</ion-view>

+ 49 - 0
platforms/android/assets/www/apps/daily/index.html

@@ -0,0 +1,49 @@
+<!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="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.min.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">
+        返回
+    </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>

+ 1526 - 0
platforms/android/assets/www/apps/daily/js/controllers.js

@@ -0,0 +1,1526 @@
+starter.controller('DailyCtrl', function ($rootScope, $scope, $state, global, Daily, Tool) {
+    $scope.goBack = function () {
+        global.goBack();
+    }
+
+    global.fetch_user().then(function () {
+        getdailydata();
+    });
+
+    $scope.toman = function () {
+        $state.go('daily-man');
+    }
+
+    $scope.towrite = function () {
+        $state.go('daily-edit', {
+            'flag': 0
+        });
+    }
+
+    $scope.totransfer = function (id) {
+        $state.go('transfer', {
+            module: 'daily',
+            id: id
+        });
+    }
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getdailydata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.dailys != undefined && $scope.dailys.next != null) {
+            Tool.get($scope.dailys.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.dailys.results.push(item);
+                });
+                $scope.dailys.next = data.next;
+                $scope.dailys.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.dailys != undefined && $scope.dailys.next != null ? true : false;
+    }
+
+    function getdailydata() {
+        if (global.user.token != "") {
+            if ($scope.dailys == undefined) {
+                $scope.loading = true;
+            }
+            Daily.dailymf.get(function (res) {
+                $scope.dailys = res;
+                console.log($scope.dailys);
+                $scope.roleid = global.user.roleid;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    enter = $scope.$on("$ionicView.enter", function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            $rootScope.commons.refresh = false;
+            getdailydata();
+        }
+    });
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+    });
+})
+
+.controller('DailyReadCtrl', function ($scope, $state, $ionicSlideBoxDelegate, Daily, global, Tool) {
+    $scope.index = 0;
+
+    global.fetch_user().then(function () {
+        getsummaryata();
+    });
+
+    $scope.select = function (index) {
+        $ionicSlideBoxDelegate.slide(index);
+        $scope.index = $ionicSlideBoxDelegate.currentIndex();
+    }
+
+    $scope.toMonthCount = function (item) {
+        $state.go('daily-readMonthCount', {
+            'daily_dd': item.daily_date
+        });
+    }
+
+    $scope.toDayCount = function (date) {
+        $state.go('daily-readDay', {
+            'daily_dd': date
+        })
+    }
+
+    $scope.isMonth = function (item) {
+        var date = new Date(item.daily_date);
+        return date.getMonth() == new Date().getMonth() ? false : true;
+    }
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getsummaryata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.summary != undefined && $scope.summary.next != null) {
+            Tool.get($scope.summary.next).then(function (data) {
+                data.results = initialize(data.results);
+                _.each(data.results, function (value, key) {
+                    var item = _.pick($scope.summary.results, key);
+                    if (item[key]) {
+                        _.each(value, function (i) {
+                            $scope.summary.results[key].push(i);
+                        })
+                    } else {
+                        $scope.summary.results[key] = value;
+                    }
+                });
+                console.log($scope.summary.results);
+                $scope.summary.next = data.next;
+                $scope.summary.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.summary != undefined && $scope.summary.next != null ? true : false;
+    }
+
+    function getsummaryata() {
+        if (global.user.token != "") {
+            if ($scope.summary == undefined) {
+                $scope.loading = true;
+            }
+            Daily.dailysummary.get(function (res) {
+                console.log(res.results);
+                res.results = initialize(res.results);
+                $scope.summary = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    function initialize(data) {
+        _.each(data, function (item) {
+            var date = new Date(item.daily_date);
+            item.month = date.getFullYear() + '-' + (date.getMonth() + 1);
+        });
+        return _.groupBy(data, 'month');
+    }
+})
+
+.controller('DailyDetailsCtrl', function ($rootScope, $scope, $state, $ionicPopover, $ionicPopup, $ionicHistory, global, Daily, showPopup) {
+    $scope.id = $state.params['id'];
+    $scope.cssstyle = true;
+    $scope.comments = {};
+    $scope.reads = {};
+    $scope.data = {
+        daily_mf: $scope.id,
+        comment: null
+    }
+    var view = $ionicHistory.backView();
+
+    $scope.popup = {
+        isPopup: false
+    }
+
+    global.fetch_user().then(function () {
+        if (view) {
+            $scope.loading = true;
+            $scope.daily = Daily.daily;
+            Daily.dailyread.get({mf_id: $scope.id}, function (data) {
+                $scope.comments = data;
+                $scope.loading = false;
+            });
+            Daily.readview.query({mf_id: $scope.id}, function (data) {
+                $scope.reads = data;
+            });
+        } else {
+            getdailydata();
+        }
+    });
+
+    $scope.goBack = function () {
+        global.goBack();
+    }
+
+    $ionicPopover.fromTemplateUrl('templates/detiilsmenu.html', {
+        scope: $scope
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+
+    $scope.sendComment = function () {
+        if ($scope.data.comment != null && $scope.data.comment != "") {
+            Daily.dailyread.save($scope.data, function (data) {
+                $scope.comments.results.splice(0, 0, data);
+                $scope.data.comment = null;
+            })
+        }
+    }
+
+    $scope.popupMessageOpthins = function (id, usrid) {
+        if (usrid == global.user.usrid) {
+            $scope.popup.optionsPopup = $ionicPopup.show({
+                template: '<div class="center" style="height:20px;width:100%;line-height:20px;margin-top:10px;" rj-close-back-drop><h4>用户操作</h4></div>',
+                scope: $scope,
+                buttons: [{
+                    text: '删除',
+                    type: 'button-positive',
+                    onTap: function (e) {
+                        Daily.dailyread.delete({id: id}, function () {
+                            var comment = _.find($scope.comments.results, function (item) {
+                                if (item.id === parseInt(id))
+                                    return item;
+                            });
+                            if (comment != undefined)
+                                $scope.comments.results.splice($scope.comments.results.indexOf(comment), 1);
+                        });
+                    }
+                }]
+            });
+            $scope.popup.isPopup = true;
+        }
+    }
+
+    $scope.transfer = function () {
+        $scope.popover.hide();
+        $state.go('transfer', {
+            module: 'daily',
+            id: $scope.id
+        });
+    }
+
+    $scope.remove = function () {
+        $scope.popover.hide();
+        showPopup.confirm('是否删除该汇报?', '是', '否').then(function (res) {
+            if (res) {
+                Daily.dailymf.delete({id: $scope.id}, function () {
+                    $rootScope.commons.refresh = true;
+                    $ionicHistory.goBack();
+                });
+            }
+        });
+    }
+
+    $scope.edit = function () {
+        $scope.popover.hide();
+        $state.go('daily-edit', {
+            'flag': $scope.id
+        })
+    }
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getdailydata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.comments != undefined && $scope.comments.next != null) {
+            Tool.get($scope.comments.next).then(function (data) {
+                _.each(data.comments, function (item) {
+                    $scope.comments.results.push(item);
+                });
+                $scope.comments.next = data.next;
+                $scope.comments.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.comments != undefined && $scope.comments.next != null ? true : false;
+    }
+
+    function getdailydata() {
+        if ($scope.daily == undefined) {
+            $scope.loading = true;
+        }
+        Daily.dailymf.get({id: $scope.id}, function (res) {
+            Daily.daily = _.clone(res);
+            $scope.daily = res;
+        }, function (err) {
+            alert(JSON.stringify(err));
+        }).$promise.finally(function () {
+            $scope.$broadcast('scroll.refreshComplete');
+            $scope.loading = false;
+        });
+        Daily.dailyread.get({mf_id: $scope.id}, function (data) {
+            $scope.comments = data;
+        });
+        Daily.readview.query({mf_id: $scope.id}, function (data) {
+            $scope.reads = data;
+        });
+    }
+
+    enter = $scope.$on('$ionicView.enter', function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            if (view == null)
+                $rootScope.commons.refresh = false;
+            getdailydata();
+        }
+    });
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+        $scope.popover.remove();
+    })
+})
+
+.controller('DailyPermissionCtrl', function ($rootScope, $scope, $ionicPopover, $state, global, Daily) {
+    var deletes = {C: [], D: [], U: []};
+
+    global.fetch_user().then(function () {
+        getpermissiondata();
+    });
+
+    $ionicPopover.fromTemplateUrl('templates/add.html', {
+        scope: $scope
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+
+    $scope.isshowdelete = {
+        showDelete: false
+    }
+
+    $scope.displayremove = function () {
+        $scope.isshowdelete.showDelete = !$scope.isshowdelete.showDelete;
+        $scope.popover.hide();
+    }
+
+    $scope.ok = function () {
+        $scope.popover.hide();
+        if (deletes.D.length > 0) {
+            deletes.D = deletes.D.join(',');
+            Daily.dailypermission.patch(deletes, function () {
+                deletes.D = [];
+            });
+        }
+        $scope.isshowdelete.showDelete = false;
+    }
+
+    $scope.toadd = function () {
+        $scope.popover.hide();
+        $state.go('additem');
+    }
+
+    $scope.remove = function (item) {
+        _.each(item.permissions, function (permission) {
+            deletes.D.push(permission.id);
+        });
+        $scope.userlist.results.splice(_.indexOf($scope.userlist.results, item), 1);
+    }
+
+    $scope.toSelectDeptOrItem = function (item) {
+        Daily.permissionUser = _.clone(item);
+        $state.go('selectdeptoritem', {
+            "id": item.user_id
+        });
+    }
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpermissiondata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.userlist != undefined && $scope.userlist.next != null) {
+            Tool.get($scope.userlist.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.userlist.results.push(item);
+                });
+                $scope.userlist.next = data.next;
+                $scope.userlist.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.userlist != undefined && $scope.userlist.next != null ? true : false;
+    }
+
+    function getpermissiondata() {
+        if (global.user.token != "") {
+            if ($scope.userlist == undefined) {
+                $scope.loading = true;
+            }
+            Daily.dailypermission.get(function (res) {
+                $scope.userlist = res;
+                Daily.permissionUsers = res.results;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    enter = $scope.$on('$ionicView.enter', function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            $rootScope.commons.refresh = false;
+            getpermissiondata();
+        }
+    });
+
+    $scope.$on('$destroy', function () {
+        enter = null;
+        $scope.popover.remove();
+    })
+})
+
+.controller('SelectDeptOrItemCtrl', function ($rootScope, $scope, $state, $stateParams, $ionicHistory, Daily, Dept, showPopup, Tool) {
+    var userId = $stateParams.id;
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    }
+    $scope.leftbtn = [{
+        text: '取消',
+        click: 'cancel'
+    }, {
+        text: '上一层',
+        click: 'up'
+    }];
+    $scope.index = 0;
+    $scope.deptlst = [];
+    $scope.emplst = [];
+    $scope.deptid = null;
+    $scope.selecteditems = Tool.cloneObj(Daily.permissionUser);
+    var selecteditems_old = [];
+    _.each($scope.selecteditems.depts, function (dept) {
+        selecteditems_old.push(dept.permission);
+    });
+    _.each($scope.selecteditems.users, function (user) {
+        selecteditems_old.push(user.permission);
+    });
+
+    var patchs = {C: [], D: [], U: []};
+    $scope.selectcount = '';
+    $scope.isUp = false;
+    $scope.loading = true;
+    Dept.getDep().then(function (data) {
+        d = _.find(data, function (dept) {
+            return dept.parent == null;
+        });
+        data = _.filter(data, function (item) {
+            return item.level == 1;
+        });
+        $scope.deptlst = data;
+        setdeptrighticon($scope.deptlst);
+        getemp(d.id);
+        $scope.loading = false;
+    });
+
+    $scope.tochilddept = function (dept) {
+        getChildDept(dept.id);
+    }
+
+    function getemp(id, childdepts) {
+        Dept.getEmp(id).then(function (data) {
+            $scope.emplst = data;
+            setitem();
+        });
+    }
+
+    function getChildDept(did) {
+        Dept.getEmp(did).then(function (data) {
+            $scope.emplst = data;
+            $scope.deptlst = Dept.getChildDept(did);
+            setdeptrighticon($scope.deptlst);
+            setitem();
+            deptid = did;
+            if (did == 1) {
+                $scope.index = 0;
+            } else {
+                $scope.index = 1;
+            }
+        });
+    }
+
+    function setitem() {
+        _.each($scope.deptlst, function (cd) {
+            cd.selected = false;
+            _.each($scope.selecteditems.depts, function (dept) {
+                if (cd.id == dept.id)
+                    cd.selected = true;
+            });
+            cd.isShow = Dept.getChildDept(cd.id).length == 0 ? false : true;
+        });
+        _.each($scope.emplst, function (e) {
+            e.selected = false;
+            _.each($scope.selecteditems.users, function (user) {
+                if (e.user_id == user.user_id)
+                    e.selected = true;
+            });
+        });
+    }
+
+    function setdeptrighticon(deptlst) {
+        _.each(deptlst, function (d) {
+            d.isShow = Dept.getChildDept(d.id).length == 0 ? false : true;
+        })
+    }
+
+    $scope.up = function () {
+        var dept = _.find(Dept.all(), function (d) {
+            return d.id == parseInt(deptid);
+        });
+        getChildDept(dept.parent);
+    }
+
+    $scope.change = function (selitem, op) {
+        var type = op == 'd' ? true : false;
+        if (op == 'd') {
+            setSelectItem(selitem, type, $scope.selecteditems.depts);
+        } else {
+            setSelectItem(selitem, type, $scope.selecteditems.users);
+        }
+        if ($scope.selecteditems.all) {
+            $scope.selecteditems.all = false;
+            if ($scope.selecteditems.permissions.length == 1 && $scope.selecteditems.permissions[0].flag == 0) {
+                patchs.D = $scope.selecteditems.permissions[0].id.toString();
+            }
+        }
+    }
+
+    function setSelectItem(selectItem, type, array) {
+        if (selectItem.selected) {
+            selectItem.permission = {
+                'user_id': userId,
+                'flag': type ? 1 : 2,
+                'value': type ? selectItem.id : selectItem.user_id
+            };
+            array.push(selectItem);
+        } else {
+            var item = _.find(array, function (item) {
+                return type ? item.id == selectItem.id : item.user_id == selectItem.user_id;
+            });
+            array.splice(_.indexOf(array, item), 1);
+        }
+    }
+
+    $scope.ok = function () {
+        selecteditems = [];
+        _.each($scope.selecteditems.depts, function (dept) {
+            selecteditems.push(dept.permission);
+        });
+        _.each($scope.selecteditems.users, function (user) {
+            selecteditems.push(user.permission);
+        });
+
+        rst = _.diff(selecteditems, selecteditems_old);
+        if (patchs.D.length > 0) {
+            if (rst.D.length > 0) {
+                rst.D = rst.D + ',' + patchs.D;
+            } else {
+                rst.D = patchs.D;
+            }
+        }
+        if (rst.C.length > 0 || rst.U.length > 0 || rst.D.length > 0) {
+            showPopup.showLoading(1, '正在提交');
+            Daily.dailypermission.patch(rst, function () {
+                $rootScope.commons.refresh = true;
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            })
+        } else {
+            $ionicHistory.goBack();
+        }
+    }
+
+    $scope.selectAll = function () {
+        if ($scope.selecteditems.all) {
+            if ($scope.selecteditems.permissions.length == 1 && $scope.selecteditems.permissions[0].flag == 0) {
+                $ionicHistory.goBack();
+            } else {
+                showPopup.showLoading(1, '正在提交');
+                var data = {C: [], D: [], U: []};
+                data.C.push({
+                    'user_id': userId,
+                    'flag': 0,
+                    'value': 0
+                });
+                data.D = _.map($scope.selecteditems.permissions, function (permission) {
+                    return permission.id;
+                }).join(',');
+                Daily.dailypermission.patch(data, function () {
+                    $rootScope.commons.refresh = true;
+                    showPopup.hideLoading();
+                    $ionicHistory.goBack();
+                })
+            }
+        }
+    }
+})
+
+.controller('DailyTemplateCtrl', function ($rootScope, $scope, $state, Daily, global) {
+    $scope.gosetmoban = function (template) {
+        Daily.currentTemplate = template;
+        $state.go('daily-templateEdit', {
+            "id": template.id
+        });
+    }
+
+    global.fetch_user().then(function () {
+        gettemplatedata();
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        gettemplatedata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.templates != undefined && $scope.templates.next != null) {
+            Tool.get($scope.templates.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.templates.results.push(item);
+                });
+                $scope.templates.next = data.next;
+                $scope.templates.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.templates != undefined && $scope.templates.next != null ? true : false;
+    }
+
+    function gettemplatedata() {
+        if (global.user.token != "") {
+            if ($scope.templates == undefined) {
+                $scope.loading = true;
+            }
+            Daily.template.get(function (res) {
+                $scope.templates = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    enter = $scope.$on('$ionicView.enter', function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            $rootScope.commons.refresh = false;
+            gettemplatedata();
+        }
+    });
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+    });
+})
+
+.controller('DailyTemplateScopeCtrl', function ($rootScope, $scope, $stateParams, $ionicHistory, $state, Dept, Daily) {
+    $scope.leftbtn = [{
+        text: '取消',
+        click: 'cancel'
+    }, {
+        text: '上一层',
+        click: 'up'
+    }];
+    $scope.isNew = $stateParams.id == -1;
+    // Daily.templateData = {items: [], depts: []}
+    $scope.deptsAll = [];
+    $scope.index = 0;
+    $scope.actived = false;
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    }
+    $scope.depts = [];
+    if (!$scope.isNew) {
+        $scope.selecteddepts = _.map(Daily.templateData.depts, function (dept) {
+            return {'id': dept.dept_id, 'depname': dept.dept_name}
+        });
+    } else {
+        $scope.selecteddepts = []
+    }
+
+    $scope.selecteddepts_old = _.map($scope.selecteddepts, _.clone)
+    $scope.selectdeptcount = '';
+    $scope.showupbtn = false;
+    var resourcedept = [];
+    $scope.isUp = false;
+    $scope.loading = true;
+    function setdept(data) {
+        $scope.depts = data;
+    }
+
+    Dept.getDep().then(function (data) {
+        $scope.deptsAll = data;
+        Daily.templatedept.get(function (res) {
+            _.each($scope.deptsAll, function (dept) {
+                dept.selected = _.find($scope.selecteddepts, function (d) {
+                    return d.id == dept.id && !$scope.isNew;
+                }) == undefined ? false : true; //selected the existing dept
+                if (!dept.selected) {
+                    dept.isdisabled = _.find(res.results, function (d) {
+                        return d.dept_id == dept.id;
+                    }) == undefined ? false : true;//部门是否已设置模板
+                }
+                dept.isshow = Dept.getChildDept(dept.id).length > 0;
+            });
+            $scope.loading = false;
+        });
+
+        depts_lvl_1 = _.filter($scope.deptsAll, function (item) {
+            return item.level == 1;
+        });
+        setdept(depts_lvl_1);
+    });
+
+    $scope.change = function (dept) {
+        if (dept.selected) {
+            $scope.selecteddepts.push(dept);
+            Daily.templateDepts.push(dept);
+        } else {
+            $scope.selecteddepts.splice(_.indexOf($scope.selecteddepts, dept), 1);
+            Daily.templateDepts.splice(_.indexOf(Daily.templateDepts, dept), 1);
+        }
+    }
+
+    $scope.ok = function () {
+        depts = _.pluck($scope.selecteddepts, 'depname');
+        dept_names = depts.join(',');
+        dept_ids = _.pluck($scope.selecteddepts, 'id');
+        if ($scope.isNew) {
+            Daily.template.save({'name': dept_names, 'dept_ids': dept_ids}, function (dept) {
+                $rootScope.commons.refresh = true;
+                $state.go('custom-form', {id: dept.id});
+            })
+        } else {
+            Daily.template.update({'id': $stateParams.id, 'name': dept_names, 'dept_ids': dept_ids}, function (dept) {
+                $rootScope.commons.refresh = true;
+                $ionicHistory.goBack();
+            })
+        }
+    }
+
+    var activedept = {};
+    $scope.tochilddept = function (dept) {
+        activedept = dept;
+        if (dept.isshow) {
+            getChildDept(dept);
+        } else {
+            activedept.selected = !activedept.selected;
+            $scope.change(activedept);
+        }
+    }
+
+    function getChildDept(dept) {
+        var childdepts = Dept.getChildDept(dept.id);
+        $scope.index = dept.level < 1 ? 0 : 1;
+        if (childdepts.length > 0) {
+            setdept(childdepts);
+        }
+    }
+
+    $scope.up = function () {
+        dept = _.find($scope.deptsAll, function (dept) {
+            return dept.id == activedept.parent;
+        });
+        getChildDept(dept);
+        activedept = dept
+    }
+})
+
+.controller('DailyTemplateEditCtrl', function ($rootScope, $scope, $ionicHistory, $state, $stateParams, global, Dept, Daily, showPopup) {
+    Daily.templateId = $stateParams.id;
+
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    }
+
+    global.fetch_user().then(function (data) {
+        gettemplatedata();
+    });
+
+    $scope.delete = function () {
+        showPopup.confirm('是否删除该日报模板?', '是', '否').then(function (res) {
+            if (res) {
+                Daily.template.delete({id: $stateParams.id}, function () {
+                    $rootScope.commons.refresh = true;
+                    $ionicHistory.goBack();
+                });
+            }
+        });
+    }
+
+    $scope.defineform = function () {
+        $state.go('custom-form', {
+            id: $stateParams.id
+        });
+    }
+
+    $scope.toSetDept = function () {
+        $state.go('daily-templateScope', {
+            "id": $stateParams.id
+        });
+    }
+
+    function gettemplatedata() {
+        if (global.user.token != "") {
+            Daily.template.get({'id': Daily.templateId}, function (res) {
+                $scope.template = res;
+                Daily.templateData = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            });
+        }
+    }
+
+    enter = $scope.$on('$ionicView.enter', function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh)
+            gettemplatedata();
+    });
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+    });
+})
+
+.controller('FormFieldTypeCtrl', function ($scope, $state, $ionicHistory, global, showPopup, Daily) {
+    $scope.template_field = {};
+    $scope.index = $state.params['id'];
+    $scope.isNew = $scope.index == -1;
+    $scope.showadd = false;
+    $scope.template_field.required = false;
+    $scope.selecttexts = [{text: ""}];
+    $scope.template_field_active = {};
+    if (!$scope.isNew && Daily.templateData.items[$scope.index]) {
+        $scope.template_field = Daily.templateData.items[$scope.index];
+    }
+
+    watch = $scope.$watch('template_field', function (n, o) {
+        if (n == o)
+            return;
+        $scope.template_field.isModified = true; //TODO:check
+    }, true);
+
+    global.fetch_user().then(function () {
+        Daily.templatefield.get(function (res) {
+            $scope.template_fields = res.results;
+            if ($scope.isNew) {
+                if ($scope.template_fields.length > 1) {
+                    $scope.template_field_active = $scope.template_fields[1]
+                }
+            } else {
+                $scope.template_field_active = _.find($scope.template_fields, function (r_field) {
+                    return r_field.id == $scope.template_field.daily_template_field_id;
+                })
+            }
+
+            if ($scope.template_field && $scope.template_field.extra)
+                $scope.selecttexts = JSON.parse($scope.template_field.extra)
+        })
+    });
+
+    $scope.back = function () {
+        $ionicHistory.goBack();
+    }
+
+    $scope.add = function () {
+        $scope.selecttexts.push({text: ""});
+    }
+
+    $scope.change = function (item) {
+        $scope.template_field_active = item;
+    }
+
+    $scope.ok = function () {
+        if ($scope.template_field.name == '' || $scope.template_field.name == undefined) {
+            showPopup.PopupWindow(0, '名称不能为空!', false);
+            return;
+        }
+
+        if ($scope.template_field.showlist)
+            if ($scope.selecttexts.length == 0) {
+                showPopup.PopupWindow(0, '请添加选项!', false);
+                return;
+            } else {
+                $scope.template_field.extra = $scope.selecttexts;
+            }
+        exists = _.find(Daily.templateData.items, function (f) {
+            return f.name == $scope.template_field.name && f != $scope.template_field;
+        });
+
+        if (exists) {
+            showPopup.PopupWindow(0, '名称不能重复!', false);
+            return;
+        }
+
+        if ($scope.template_field_active) {
+            $scope.template_field.daily_template_field_id = $scope.template_field_active.id;
+            $scope.template_field.t__type = $scope.template_field_active.type;
+        }
+
+        d = _.filter($scope.selecttexts, function (item) {
+            return item.text != "";
+        });
+        if (d.length > 0) {
+            $scope.template_field.extra = JSON.stringify(d)
+        }
+
+        if ($scope.isNew) {
+            $scope.template_field.daily_template_id = Daily.templateId;
+            Daily.templateData.items.push($scope.template_field);
+        }
+
+        $ionicHistory.goBack();
+    }
+
+    $scope.delete = function () {
+        Daily.templateData.items.splice($scope.index, 1);
+        $ionicHistory.goBack();
+    }
+
+    $scope.remove = function (index) {
+        $scope.selecttexts.splice(index, 1);
+    }
+
+    $scope.$on("$destroy", function () {
+        watch();
+    })
+})
+
+.controller('CustomFormCtrl', function ($rootScope, $scope, $ionicHistory, $state, global, Daily, showPopup, Tool) {
+    $scope.fieldItems = [];
+    $scope.fieldItems_old = [];
+
+    $scope.mobanitems = null;
+    $scope.addmobanitems = null;
+    Daily.templateId = $state.params['id'];
+    $scope.isNew = Daily.templateId == -1;
+
+    global.fetch_user().then(function (data) {
+        Daily.templateitem.get({'daily_template_id': Daily.templateId}, function (res) {
+            Daily.templateData.items = res.results;
+            $scope.fieldItems = Daily.templateData.items;
+            $scope.fieldItems_old = _.map($scope.fieldItems, _.clone);
+        })
+    });
+
+    $scope.ok = function () {
+        if (Daily.templateData.items.length == 0) {
+            showPopup.PopupWindow(0, '请添加字段!', false);
+            return;
+        }
+        showPopup.showLoading(1, '正在上传');
+        Daily.templateData.description = Daily.get_description();
+        Daily.template.update({'id': Daily.templateId, 'description': Daily.templateData.description});
+        var fieldItems = _.map($scope.fieldItems, function (item) {
+            return _.omit(item, 't__type');
+        });
+        rst = _.diff(fieldItems, $scope.fieldItems_old);
+        Daily.templateitem.patch(rst, function () {
+            $rootScope.commons.refresh = true;
+            Tool.removeBackView('daily-templateScope');
+            showPopup.hideLoading();
+            $ionicHistory.goBack();
+        });
+    }
+
+    $scope.cancel = function () {
+        Daily.templateData.items = [];
+        Tool.removeBackView('daily-templateScope');
+        $ionicHistory.goBack();
+    }
+
+    $rootScope.commons.fun = $scope.cancel;
+
+    $scope.tohref = function (item) {
+        var index = _.indexOf(Daily.templateData.items, item);
+        return '#/fieldtype/' + index;
+    }
+
+    $scope.preview = function () {
+        Daily.previewData = {
+            'daily_tfs': Daily.templateData.items
+        }
+        $state.go('daily-edit', {
+            'flag': -1
+        });
+    }
+})
+
+.controller('AddItemCtrl', function ($rootScope, $scope, $state, $ionicHistory, Dept, Daily, showPopup) {
+    $scope.isUp = false;
+    $scope.leftbtn = [{
+        text: '取消',
+        click: 'cancel'
+    }, {
+        text: '上一层',
+        click: 'up'
+    }];
+    $scope.index = 0;
+    $scope.deptlst = [];
+    $scope.emplst = [];
+    $scope.selectedemplst = [];
+    var deptid = 0;
+    $scope.selectcount = '';
+    Dept.getDep().then(function (data) {
+        d = _.find(data, function (dept) {
+            return dept.parent == null;
+        });
+        data = _.filter(data, function (item) {
+            return item.level == 1;
+        });
+        $scope.deptlst = data;
+        setdeptrighticon($scope.deptlst);
+        getemp(d.id);
+    });
+
+    $scope.changedept = function (dept) {
+        getdept_emp(dept.id);
+    }
+
+    $scope.change = function (emp) {
+        if (emp.selected) {
+            $scope.selectedemplst.push(emp);
+        } else {
+            $scope.selectedemplst.splice(_.indexOf($scope.selectedemplst, emp), 1);
+        }
+    }
+
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    }
+
+    $scope.up = function () {
+        var dept = _.find(Dept.all(), function (d) {
+            return d.id == parseInt(deptid);
+        });
+        getdept_emp(dept.parent);
+    }
+
+    $scope.ok = function () {
+        showPopup.showLoading(1, '提交中');
+        var data = [];
+        _.each($scope.selectedemplst, function (item) {
+            data.push({'user': item.user_id, 'flag': 0, 'value': 0});
+        });
+        Daily.dailypermission.save(data, function () {
+            $rootScope.commons.refresh = true;
+            showPopup.hideLoading();
+            $ionicHistory.goBack();
+        });
+    }
+
+    function getdept_emp(did) {
+        Dept.getEmp(did).then(function (data) {
+            $scope.emplst = data;
+            $scope.deptlst = Dept.getChildDept(did);
+            setdeptrighticon($scope.deptlst);
+            setitem();
+            deptid = did;
+            if (did == 1) {
+                $scope.index = 0;
+            } else {
+                $scope.index = 1;
+            }
+        });
+    }
+
+    function getemp(id) {
+        Dept.getEmp(id).then(function (data) {
+            $scope.emplst = data;
+            setitem();
+        });
+    }
+
+    function setitem() {
+        _.each($scope.emplst, function (e) {
+            e.selected = false;
+            e.disabled = false;
+            _.each(Daily.permissionUsers, function (p) {
+                if (p.user_id == parseInt(e.user_id)) {
+                    e.disabled = true;
+                    e.selected = true;
+                }
+            });
+            _.each($scope.selectedemplst, function (e1) {
+                if (e1.user_id == e.user_id) {
+                    e.selected = true;
+                }
+            });
+        });
+    }
+
+    function setdeptrighticon(deptlst) {
+        _.each(deptlst, function (d) {
+            d.isShow = Dept.getChildDept(d.id).length == 0 ? false : true;
+        })
+    }
+})
+
+.controller('DailyEditCtrl', function ($rootScope, $scope, $stateParams, $state, $ionicHistory, $q, global, ImageManage, showPopup, Daily, Tool) {
+    $scope.flag = $stateParams.flag;
+    $scope.change = 1;
+    $scope.index = 14;
+    $scope.coke = 11;
+    $scope.image_list = [];
+    $scope.deleteimage_list = [];
+    $scope.popup = {
+        isPopup: false
+    };
+    var isModified = false;
+
+    $scope.changeDate = function (id) {
+        $scope.index = id;
+        $scope.change = 15 - id;
+        $scope.closeModal();
+    }
+
+    global.fetch_user().then(function () {
+        if ($scope.flag == 0) {
+            Daily.templatedept.get(function (td) {
+                dept = _.find(td.results, function (d) {
+                    return d.dept_id == global.user.deptno;
+                });
+                Daily.templateitem.get({'daily_template_id': dept.daily_template_id}, function (res) {
+                    Daily.templateData.items = res.results;
+                    _.each(Daily.templateData.items, function (item) {
+                        item.daily_template_item = item.id
+                    });
+                    Daily.previewData = {
+                        'daily_tfs': res.results
+                    };
+                    $scope.item = Daily.previewData;
+                    $scope.item.files = [];
+                })
+            });
+            $scope.newDate = Daily.getDate();
+        } else if ($scope.flag == -1) {
+            $scope.item = Daily.previewData;
+            $scope.item.files = [];
+            $scope.newDate = Daily.getDate();
+        } else {
+            $scope.item = Tool.cloneObj(Daily.daily);
+        }
+    });
+
+    $scope.goBack = function () {
+        if ($scope.flag == 0) {
+            back = _.find($scope.item.daily_tfs, function (item) {
+                return item.text !== undefined && item.text != '';
+            });
+            showConfirm(isModified, '是否退出写日报?');
+        } else if ($scope.flag > 0) {
+            showConfirm(isModified, '是否放弃当前编辑?');
+        } else {
+            $ionicHistory.goBack();
+        }
+    }
+
+    $scope.addDaily = function () {
+        if (Daily.checkDaily($scope.item.daily_tfs)) {
+            showPopup.showLoading(1, '正在提交');
+            if ($scope.flag == 0) {
+                date = $scope.newDate[$scope.change].day;
+                Daily.dailymf.save({'daily_dd': date}, function (res) {
+                    var id = res.id;
+                    data = _.map($scope.item.daily_tfs, function (it) {
+                        return _.extend(_.pick(it, 'text', 'daily_template_item'), {'daily_mf': id});
+                    });
+                    Daily.dailytf.save(data, function (res) {
+                        $rootScope.commons.refresh = true;
+                        var imagefiles = [];
+                        _.each($scope.item.files, function (image) {
+                            if (!image.id)
+                                imagefiles.push(image.file_full_path);
+                        });
+                        if (imagefiles.length > 0) {
+                            postimg(imagefiles, id);
+                        } else {
+                            showPopup.hideLoading();
+                            $ionicHistory.goBack();
+                        }
+                    });
+                });
+            } else if ($scope.flag > 0) {
+                if (isModified) {
+                    data = _.map($scope.item.daily_tfs, function (it) {
+                        return _.pick(it, 'id', 'text', 'daily_template_item', 'daily_mf')
+                    });
+                    Daily.dailytf.update(data, function (res) {
+                        $rootScope.commons.refresh = true;
+                        _.each($scope.deleteimage_list, function (file) {
+                            Daily.dailyfile.delete({id: file});
+                        });
+                        var imagefiles = [];
+                        _.each($scope.item.files, function (image) {
+                            if (!image.id)
+                                imagefiles.push(image.file_full_path);
+                        });
+                        if (imagefiles.length > 0) {
+                            postimg(imagefiles, $scope.flag);
+                        } else {
+                            showPopup.hideLoading();
+                            $ionicHistory.goBack();
+                        }
+                    });
+                } else {
+                    showPopup.hideLoading();
+                    $ionicHistory.goBack();
+                }
+            } else {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            }
+        }
+    }
+
+    showPopup.modalTemplate('templates/modal-selectDate.html', 'slide-in-right', $scope).then(function (modal) {
+        $scope.select_date_modal = modal;
+    });
+
+    $scope.showModal = function () {
+        $scope.select_date_modal.show();
+        $rootScope.commons.modal = $scope.select_date_modal;
+    }
+
+    $scope.closeModal = function (rst) {
+        $rootScope.commons.modal.hide();
+    }
+
+    $scope.shouBigImage = function (imageName) { //传递一个参数(图片的URl)
+        $scope.Url = imageName; //$scope定义一个变量Url,这里会在大图出现后再次点击隐藏大图使用
+        $rootScope.commons.bigImage = true; //显示大图
+    }
+
+    $rootScope.commons.bigImage = false; //初始默认大图是隐藏的
+    $scope.hideBigImage = function () {
+        $rootScope.commons.bigImage = false;
+    }
+
+    $scope.deleteimage = function () {
+        var img = _.find($scope.item.files, function (image) {
+            return image.file_full_path == $scope.Url;
+        });
+        if (img) {
+            $scope.item.files.splice(_.indexOf($scope.item.files, img), 1);
+            if (img.id)
+                $scope.deleteimage_list.push(img.id);
+        }
+        $rootScope.commons.bigImage = false;
+    }
+
+    $scope.addphoto = function () {
+        $scope.popup.optionsPopup = showPopup.showSelectImgPopup(Camera, ImagePicker, $scope);
+        $scope.popup.isPopup = true;
+    }
+
+    if ($scope.flag > 0) {
+        watch = $scope.$watch('item', function (n, o) {
+            if (n == o)
+                return;
+            isModified = true;
+        }, true);
+    }
+
+    $scope.$on("$destroy", function () {
+        if ($rootScope.commons.modal)
+            $rootScope.commons.modal = null;
+        $scope.select_date_modal.remove();
+        if ($scope.flag > 0) {
+            watch();
+        }
+    });
+
+    function ImagePicker() { //打开相册
+        $scope.popup.optionsPopup.close();
+        ImageManage.ImagePicker_getPictures(10).then(function (data) {
+            _.each(data, function (imageUrl) {
+                $scope.item.files.push({
+                    "file_thumbnail_path": imageUrl,
+                    "file_full_path": imageUrl
+                });
+            });
+        });
+    }
+
+    function Camera() {
+        $scope.popup.optionsPopup.close();
+        ImageManage.Camera_getPicture().then(function (result) {
+            $scope.item.files.push({
+                "file_thumbnail_path": result,
+                "file_full_path": result
+            });
+        });
+    }
+
+    function postimg(imgfiles, id) {
+        ImageManage.uploadImage(imgfiles, 'daily', id, 'dailyfile').then(function (res) {
+            $q.all(res).then(function (data) {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            })
+        }, function (err) {
+            alert(JSON.stringify(error));
+            showPopup.PopupWindow(0, 'upload image fail');
+        })
+    }
+
+    function showConfirm(flag, content) {
+        if (flag) {
+            showPopup.confirm(content, '是', '否').then(function (res) {
+                if (res)
+                    $ionicHistory.goBack();
+            });
+        } else {
+            $ionicHistory.goBack();
+        }
+    }
+})
+
+.controller('DailyReadMonthCountCtrl', function ($rootScope, $scope, $state, global, Daily, showPopup) {
+    var daily_dd = $state.params['daily_dd'];
+    var date = new Date(daily_dd);
+    $scope.year = date.getFullYear();
+    $scope.month = date.getMonth() + 1;
+
+    global.fetch_user().then(function () {
+        if (global.user.token != "") {
+            Daily.mouthsummary.get({'daily_dd': daily_dd}, function (res) {
+                $scope.monthView = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            });
+            Daily.dailydeptview.query(function (res) {
+                $scope.index = res[0].id;
+                if (res[0].id == 1 && res[0].parent == null)
+                    res[0].depname = '全体成员';
+                $scope.depts = res;
+            })
+        }
+    });
+
+    $scope.changeindex = function (dept) {
+        $scope.index = dept.id;
+        var data = {'dept': dept.id, 'daily_dd': daily_dd};
+        if (dept.parent == null)
+            data = _.omit(data, 'dept');
+        Daily.mouthsummary.get(data, function (res) {
+            $scope.monthView = res;
+            $scope.closeModal();
+        })
+    }
+
+    showPopup.modalTemplate('templates/modal-selectdept.html', 'slide-in-right', $scope).then(function (modal) {
+        $scope.select_dept_modal = modal;
+    });
+
+    $scope.showModal = function () {
+        $scope.select_dept_modal.show();
+        $rootScope.commons.modal = $scope.select_dept_modal;
+    }
+
+    $scope.closeModal = function (rst) {
+        $rootScope.commons.modal.hide();
+    }
+
+    $scope.$on("$destroy", function () {
+        if ($rootScope.commons.modal)
+            $rootScope.commons.moda = null;
+        $scope.select_dept_modal.remove();
+    })
+})
+
+.controller('DailyReadDayCtrl', function ($rootScope, $scope, $state, global, Daily, Tool) {
+    var daily_dd = $state.params['daily_dd'];
+    var date = new Date(daily_dd);
+    $scope.month = date.getMonth() + 1;
+    $scope.day = date.getDate();
+
+    global.fetch_user().then(function () {
+        getdailydata();
+    });
+
+    $scope.totransfer = function (id) {
+        $state.go('transfer', {
+            module: 'daily',
+            id: id
+        });
+    }
+
+    $scope.lookCount = function () {
+        $state.go('daily-readDayCount', {
+            'daily_dd': daily_dd
+        });
+    }
+
+    $scope.shouBigImage = function (imageName, event) { //传递一个参数(图片的URl)
+        $scope.Url = imageName; //$scope定义一个变量Url,这里会在大图出现后再次点击隐藏大图使用
+        $rootScope.commons.bigImage = true; //显示大图
+        event.stopPropagation();
+    }
+
+    $rootScope.commons.bigImage = false; //初始默认大图是隐藏的
+    $scope.hideBigImage = function () {
+        $rootScope.commons.bigImage = false;
+    }
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getdailydata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.dailys != undefined && $scope.dailys.next != null) {
+            Tool.get($scope.dailys.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.dailys.results.push(item);
+                });
+                $scope.dailys.next = data.next;
+                $scope.dailys.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.dailys != undefined && $scope.dailys.next != null ? true : false;
+    }
+
+    function getdailydata() {
+        if (global.user.token != "") {
+            if ($scope.dailys == undefined) {
+                $scope.loading = true;
+            }
+            Daily.dailyview.get({'daily_dd': daily_dd}, function (res) {
+                $scope.dailys = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+})
+
+.controller('DailyReadDayCountCtrl', function ($scope, $state, global, Daily) {
+    var daily_dd = $state.params['daily_dd'];
+    var date = new Date(daily_dd);
+    $scope.year = date.getFullYear();
+    $scope.month = date.getMonth() + 1;
+    $scope.day = date.getDate();
+
+    global.fetch_user().then(function () {
+        if (global.user.token != "") {
+            Daily.todaysummary.get({'daily_dd': daily_dd}, function (res) {
+                console.log(res);
+                $scope.toDayView = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            });
+        }
+    });
+
+    $scope.lookDeptCount = function (flag, users, dept, isSubmit) {
+        if (isSubmit != 0) {
+            Daily.toDayViewUsers = users;
+            $state.go('daily-readDayDeptCount', {
+                'flag': flag,
+                'daily_dd': daily_dd,
+                'dept': dept
+            });
+        }
+    }
+})
+
+.controller('DailyReadDayDeptCountCtrl', function ($scope, $state, Daily) {
+    var daily_dd = $state.params['daily_dd'];
+    $scope.flag = $state.params['flag'];
+    $scope.dept = $state.params['dept'];
+    var date = new Date(daily_dd);
+    $scope.year = date.getFullYear();
+    $scope.month = date.getMonth() + 1;
+    $scope.day = date.getDate();
+
+    $scope.users = Daily.toDayViewUsers;
+});

+ 118 - 0
platforms/android/assets/www/apps/daily/js/directive.js

@@ -0,0 +1,118 @@
+starter.directive('itemWrite', [function () {
+    return {
+        restrict: "E",
+        scope: {
+            item: "=itemData"
+        },
+        templateUrl: 'templates/template-itemWrite.html',
+        controller: function ($scope, $cordovaDatePicker) {
+
+            $scope.selectedChange = function (value) {
+                $scope.item.text = value;
+            }
+
+            $scope.chooseDate = function (datetime) {
+                var options = {
+                    mode: 'date',
+                    date: new Date(),
+                    androidTheme: 3
+                };
+
+                $cordovaDatePicker.show(options).then(function (date) {
+                    if (date == undefined) return;
+                    $scope.item.datetime_data = date;
+                });
+            }
+
+            if ($scope.item.t__type in [1, 4]) {
+                if ($scope.item.required) {
+                    $scope.note = '输入内容';
+                } else {
+                    $scope.note = '输入内容(选填)';
+                }
+            } else if ($scope.item.t__type in [2, 3, 5]) {
+                if ($scope.item.t__type == 5) {
+                    if ($scope.item.select_data == undefined)
+                        $scope.item.select_data = $scope.item.selecttext;
+                    data = JSON.parse($scope.item.extra)
+                    data = _.pluck(data, 'text')
+                    $scope.selectData = data;
+                }
+                if (!$scope.item.required)
+                    $scope.note = '(选填)';
+            }
+        }
+    }
+}])
+
+.directive('setClassWhenAtTop', function ($window) {
+    var $win = angular.element($window);
+    return {
+        restrict: 'A',
+        link: function (scope, element, attrs) {
+            var topClass = attrs.setClassWhenAtTop,
+                offsetTop = element[0].offsetTop;
+
+            $win.on('scroll', function (e) {
+                if ($win.scrollTop() >= 44) {
+                    element.addClass(topClass);
+                } else {
+                    element.removeClass(topClass);
+                }
+            });
+        }
+    };
+})
+
+.directive('daily', function () {
+    return {
+        restrict: "E",
+        scope: {
+            dailys: "=dailys",
+            loading: "=loading"
+        },
+        templateUrl: 'templates/template-daily.html',
+        controller: function ($scope, $state, Daily) {
+            $scope.todetails = function (daily) {
+                Daily.daily = _.clone(daily);
+                $state.go('daily-details', {
+                    'id': daily.id
+                });
+            }
+        }
+    }
+})
+
+.directive('dailyHeader', function () {
+    return {
+        restrict: "E",
+        scope: {
+            daily: "=daily"
+        },
+        template: '<div class="item item-avatar"><img ng-src="../../../img/panda.png" ng-click="showcardinfo(daily.create_user)"><span>{{daily.create_user_name}}</span><p>{{daily.create_date | date:"MM-dd HH:mm"}}</p><p class="time">日报({{daily.daily_dd | date:"M月d日"}})</p></div>'
+    }
+})
+
+.directive('dailyContent', function () {
+    return {
+        restrict: "E",
+        scope: {
+            daily: "=daily"
+        },
+        template: '<div class="item item-body"><span ng-bind-html="itemContent | getHtmlContent" ng-repeat="itemContent in daily.daily_tfs"></span><div class="blob"><image-popover all-images="daily.files"></image-popover></div></div>'
+    }
+})
+
+.filter('getHtmlContent', function () {
+    return function (content) {
+        if (!content.required && !content.text)
+            return null;
+        fieldname = '';
+        if (content.daily_template_item != 1)
+            fieldname = content.name + '&nbsp:&nbsp';
+        fielddata = content.text || '';
+        var str = fieldname + fielddata + '<br/>';
+        str = str.replace(/\n/g, '<br/>');
+        return str;
+    }
+})

+ 94 - 0
platforms/android/assets/www/apps/daily/js/factory.js

@@ -0,0 +1,94 @@
+starter.factory('Daily', function ($resource, cfg, formatFilter, Tool, showPopup) {
+    var daily = {};
+    daily.templateData = {};
+    daily.templateId = -1;
+    daily.fieldItems = []; //存放模板字段集合
+    daily.templateDepts = [];
+    daily.currentTemplate = {};
+    daily.daily = {};
+    daily.permissionUsers = [];
+    daily.permissionUser = {};
+    daily.previewData = {};
+    daily.toDayViewUsers = [];
+    
+    daily.templatefield = $resource(formatFilter('{0}daily/templatefield/', cfg.api));
+    daily.templateitem = $resource(formatFilter('{0}daily/templateitem/', cfg.api));
+    daily.templatedept = $resource(formatFilter('{0}daily/templatedept/', cfg.api));
+    daily.template = $resource(formatFilter('{0}daily/template/:id/', cfg.api));
+    daily.dailytf = $resource(formatFilter('{0}daily/dailytf/', cfg.api), {}, {'save': {method: 'POST', isArray: true}, 'update': {method: 'PUT', isArray: true}});
+    daily.dailymf = $resource(formatFilter('{0}daily/dailymf/:id/', cfg.api));
+    daily.dailypermission = $resource(formatFilter('{0}daily/dailypermission/', cfg.api), {}, {'save': {method: 'POST', isArray: true}, 'patch': {method: 'PATCH', isArray: true}});
+    daily.dailyread = $resource(formatFilter('{0}daily/dailyread/:id/', cfg.api));
+    daily.dailyfile = $resource(formatFilter('{0}daily/dailyfile/:id/', cfg.api));
+    daily.dailysummary = $resource(formatFilter('{0}daily/dailysummary/', cfg.api));
+    daily.dailyview = $resource(formatFilter('{0}daily/dailyview/', cfg.api));
+    daily.mouthsummary = $resource(formatFilter('{0}daily/monthsummary/', cfg.api));
+    daily.dailydeptview = $resource(formatFilter('{0}daily/dailydeptview/', cfg.api));
+    daily.todaysummary = $resource(formatFilter('{0}daily/todaysummary/', cfg.api));
+    daily.readview = $resource(formatFilter('{0}daily/readview/', cfg.api));
+    
+    daily.get_name = function () {
+        return daily.templateDepts.map(function (dept) {
+            return dept.depname;
+        }).join(',');
+    }
+
+    daily.get_fieldItems = function () {
+        if (daily.templateId == -1) {
+            return _.map(daily.fieldItems, function (fi) {
+                return _.pick(fi, 'name', 'daily_template_field_id', 'required', 'extra');
+            })
+        } else {
+            return _.map(daily.fieldItems, function (fi) {
+                return _.pick(fi, 'id', 'name', 'daily_template_field_id', 'required', 'extra');
+            })
+        }
+    }
+
+    daily.get_description = function () {
+        return _.map(daily.templateData.items, function (fi) {
+            return fi.name;
+        }).join(',')
+    }
+    
+    daily.checkDaily = function (dailys) {
+        var flag = true;
+        var note = null;
+        
+        daily = _.find(dailys, function(daily){
+            return (!daily.text || daily.text == '') && daily.required
+        });
+        
+        if (daily) {
+            if (parseInt(daily.t__type) in [1, 2, 4]) {
+            	note = '请填写';
+            } else if (parseInt(daily.t__type) in [3, 5]) {
+                note = '请选择';
+            }
+            note += daily.name;
+            flag = false;
+            showPopup.PopupWindow(0, note, false);
+        }
+        return flag;
+    }
+    
+    daily.getDate = function (timer) {
+        timer = timer || 7;
+        var newDate = [];
+        timer = timer - 2;
+        for (var i = -timer; i < 2; i++) {
+            var id = i + timer;
+            var day = new Date();
+            day.setDate(day.getDate() + i);
+            var week_day = Tool.getTranslateByKey("weekdays", day.getDay());
+            newDate.push({
+                'id':id,
+                'day':day,
+                'week':week_day
+            });
+        }
+        return newDate.reverse();
+    }
+    
+    return daily;
+});

+ 96 - 0
platforms/android/assets/www/apps/daily/js/route.js

@@ -0,0 +1,96 @@
+starter.config(function ($stateProvider) {
+    $stateProvider.state('daily', {
+        url: '/index',
+        templateUrl: 'templates/daily.html',
+        controller: 'DailyCtrl'
+    })
+
+    .state('daily-man', {
+        url: '/daily-man',
+        templateUrl: 'templates/daily-man.html'
+    })
+
+    .state('daily-read', {
+        url: '/daily-read',
+        templateUrl: 'templates/daily-read.html',
+        controller: 'DailyReadCtrl'
+    })
+
+    .state('daily-details', {
+        url: '/daily/:id',
+        templateUrl: 'templates/daily-details.html',
+        controller: 'DailyDetailsCtrl'
+    })
+
+    .state('daily-edit', {
+        url: '/daily-edit/:flag',
+        templateUrl: 'templates/daily-edit.html',
+        controller: 'DailyEditCtrl'
+    })
+
+    .state('daily-readMonthCount', {
+        url: '/daily-readMonthCount/:daily_dd',
+        templateUrl: 'templates/daily-readMouthCount.html',
+        controller: 'DailyReadMonthCountCtrl'
+    })
+
+    .state('daily-readDay', {
+        url: '/daily-read/:daily_dd',
+        templateUrl: 'templates/daily-readDay.html',
+        controller: 'DailyReadDayCtrl'
+    })
+
+    .state('daily-readDayCount', {
+        url: '/daily-readDayCount/:daily_dd',
+        templateUrl: 'templates/daily-readDayCount.html',
+        controller: 'DailyReadDayCountCtrl'
+    })
+
+    .state('daily-readDayDeptCount', {
+        url: '/daily-readDayCount/:daily_dd&:dept&:flag',
+        templateUrl: 'templates/daily-readDayDeptCount.html',
+        controller: 'DailyReadDayDeptCountCtrl'
+    })
+
+    .state('daily-permission', {
+        url: '/daily-permission',
+        templateUrl: 'templates/daily-permission.html',
+        controller: 'DailyPermissionCtrl'
+    })
+
+    .state('selectdeptoritem', {
+        url: '/selectdeptoritem/:id',
+        templateUrl: 'templates/selectdeptoritem.html',
+        controller: 'SelectDeptOrItemCtrl'
+    })
+
+    .state('daily-template', {
+        url: '/daily-template',
+        templateUrl: 'templates/daily-template.html',
+        controller: 'DailyTemplateCtrl'
+    })
+
+    .state('daily-templateScope', {
+        url: '/daily-templateScope/:id',
+        templateUrl: 'templates/daily-templateScope.html',
+        controller: 'DailyTemplateScopeCtrl'
+    })
+
+    .state('daily-templateEdit', {
+        url: '/daily-templateEdit/:id',
+        templateUrl: 'templates/daily-templateEdit.html',
+        controller: 'DailyTemplateEditCtrl'
+    })
+
+    .state('custom-form', {
+        url: '/custom-form/:id',
+        templateUrl: 'templates/custom-form.html',
+        controller: 'CustomFormCtrl'
+    })
+
+    .state('additem', {
+        url: '/additem',
+        templateUrl: 'templates/additem.html',
+        controller: 'AddItemCtrl'
+    })
+});

+ 32 - 0
platforms/android/assets/www/apps/daily/templates/additem.html

@@ -0,0 +1,32 @@
+<ion-view view-title="选择添加的成员" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="this[leftbtn[index].click]();">{{leftbtn[index].text}}</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider divider-font" ng-if="deptlst.length>0"><i class="icon ion-ios-star"></i>部门({{deptlst.length}})</div>
+        <ion-list>
+            <!--部门列表-->
+            <ion-item class="item item-icon-right" ng-repeat="dept in deptlst" ng-click="changedept(dept);">
+                {{dept.depname}}
+                <i class="icon ion-chevron-right icon-accessory" ng-if="dept.isShow"></i>
+            </ion-item>
+        </ion-list>
+        <!--员工-->
+        <div class="item item-divider divider-font"><i class="icon ion-ios-star"></i>联系人({{emplst.length}})</div>
+        <ion-list>
+            <ion-checkbox ng-repeat="emp in emplst" ng-disabled="emp.disabled" ng-change="change(emp)" ng-model="emp.selected" class="ion-checkbox-class">
+                <img ng-src="../../../img/panda.png"/>
+                <label class="labelname">{{emp.username}}</label>
+                <label class="labelrole">{{emp.degree}}</label>
+            </ion-checkbox>
+            <ion-list>
+            <div class='obligate-item'></div>
+    </ion-content>
+    <div ng-class="{true:'bar bar-footer bar-dark footer-div bigview',false:'bar bar-footer footer-div bar-dark'}[isUp]" style="">
+        <i ng-class="{true:'ion-ios-arrow-down cirl-i',false:' ion-ios-arrow-up cirl-i'}[isUp]" ng-click="isUp = !isUp"></i>
+        <ul class='ul-imgs dept-icon'>
+            <li ng-repeat="user in selectedemplst track by $index">{{user.username}}</li>
+        </ul>
+        <button ng-disabled="selectedemplst.length==0" ng-click="ok();" class="button pull-right button-calm">确定{{selectedemplst.length>0?"("+selectedemplst.length+")":""}}</button>
+    </div>
+</ion-view>

+ 24 - 0
platforms/android/assets/www/apps/daily/templates/custom-form.html

@@ -0,0 +1,24 @@
+<ion-view view-title="自定义表单" hide-back-button="true">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click='ok();'>完成</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click='cancel();'>取消</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider dividercolor dividertextcolor" ng-if="fieldItems.length>0" ng-click="preview();">点击预览</div>
+        <div class="item-divider item-divider-defineform"></div>
+        <ion-list>
+            <ion-item class="empclass item-icon-right" type="item-text-wrap" ng-repeat="item in fieldItems" ng-href="{{tohref(item)}}">
+                <h2>{{item.name}}<i class="ion-ios-compose-outline"></i></h2>
+                <p class="from-p">字段类型:{{item.fieldtype.name}}({{item.required?"必填":"选填"}})</p>
+                <i class="icon ion-navicon-round icon-accessory"></i>
+            </ion-item>
+        </ion-list>
+        <div class="item-divider item-divider-defineform"></div>
+        <ion-item class="positive" type="item-text-wrap" style="text-align:center" ng-href="#/fieldtype/-1">
+            添加字段&nbsp;<i class="ion-plus"></i>
+        </ion-item>
+    </ion-content>
+</ion-view>
+

+ 69 - 0
platforms/android/assets/www/apps/daily/templates/daily-details.html

@@ -0,0 +1,69 @@
+<ion-view view-title="汇报详情" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-icon ion-ios-more" ng-click="popover.show($event)" ng-if="cssstyle"></button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-if="!loading" class="list daily">
+            <div class="item item-divider"></div>
+            <daily-header daily="daily"></daily-header>
+            <daily-content daily="daily"></daily-content>
+            <div class="item item-divider" ng-if="reads.length != 0"></div>
+            <div class="item" ng-if="reads.length != 0">
+                <p>看过&nbsp;{{reads.length == 0 ? "" : reads.length}}</p>
+                <div class="list see-list">
+                    <img ng-repeat="read in reads" ng-click="showcardinfo(read.create_user)" ng-src="../../../img/cat.png"/>
+                    <!--//todo:{{readitem.usrid.photo}}-->
+                </div>
+            </div>
+            <div class="item item-divider"></div>
+            <!--//todo:将评论和看过独立出一个指令进行操作-->
+            <div class="item">
+                <p>评论&nbsp;{{comments.results.length == 0 ? "" : comments.results.length}}</p>
+            </div>
+            <ion-list>
+                <div class="item center" ng-if="comments.results.length == 0">还没有人进行评论哦</div>
+                <a class="item item-avatar item-text-wrap" ng-repeat="comment in comments.results" ng-click="popupMessageOpthins(comment.id,comment.create_user)">
+                    <img ng-src="../../../img/panda.png" ng-click="showcardinfo()">
+                    <!--//todo:查看信息-->
+                    <div>
+                        <span>{{comment.create_user_name}}</span>
+                        <p>{{comment.comment}}</p>
+                        <p class="time">{{comment.create_date | getDateDiff}}</p>
+                    </div>
+                </a>
+                <div class='obligate-item'></div>
+            </ion-list>
+        </div>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+    <ion-footer-bar keyboard-attach class="bar-stable">
+        <div class="bar bar-footer item-input-inset">
+            <!--<button ng-click="addhappy()" class="button button-clear">
+                <i class="icon ion-android-happy clear"></i>
+            </button>-->
+            <label class="item-input-wrapper radius-30">
+                <input type="text" ng-model="data.comment" placeholder="添加评论">
+            </label>
+            <button class="button button-positive" ng-disabled="data.comment == '' || data.comment == null" ng-click="sendComment()">发送</button>
+        </div>
+    </ion-footer-bar>
+    <script id="templates/detiilsmenu.html" type="text/ng-template">
+        <!--<ion-popover-view ng-class="{true:'details-popup',false:'details-popup-other'}[cssstyle]">-->
+        <ion-popover-view ng-class="{true:'popver_view',false:'details-popup-other'}[cssstyle]">
+            <ion-content>
+                <ion-list>
+                    <!--<ion-item class="item item-button" type="item-text-wrap" ng-click="transfer()">转发</ion-item>-->
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="edit()" ng-if="cssstyle">编辑</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="remove()" ng-if="cssstyle">删除</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 37 - 0
platforms/android/assets/www/apps/daily/templates/daily-edit.html

@@ -0,0 +1,37 @@
+<ion-view view-title="写日报" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="goBack()">取消</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-if="flag >= 0" ng-click="addDaily()">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider"></div>
+        <a class="item item-icon-right" ng-click="flag <= 0 ? showModal() : null">日期
+            <span class="item-note" ng-if="flag <= 0">{{newDate[change].day | date:'yyyy年M月d日'}}</span>
+            <span class="item-note" ng-if="flag > 0">{{item.daily_dd | date:'yyyy年M月d日'}}</span>
+            <i class="icon ion-chevron-right icon-accessory" ng-if="flag <= 0"></i>
+        </a>
+        <div class="list">
+            <div ng-repeat="data in item.daily_tfs">
+                <item-write item-data="data"></item-write>
+            </div>
+            <!--照片-->
+            <div>
+                <div class="item item-divider"></div>
+                <div class="item camera-item">
+                    <div ng-repeat="image in item.files" ng-click="shouBigImage(image.file_full_path)">
+                        <img ng-src="{{image.file_thumbnail_path}}"/>
+                    </div>
+                    <div class="center" ng-click="addphoto()">
+                        <i class="icon ion-camera"></i>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div id="rightDisplay" ng-show="commons.bigImage" class="popover-backdrop1">
+            <img class="fullscreen-image" ng-click="hideBigImage()" ng-src="{{Url}}" ng-pinch-zoom/>
+            <i class="ion-ios-trash-outline" ng-click="deleteimage();"></i>
+        </div>
+    </ion-content>
+</ion-view>

+ 27 - 0
platforms/android/assets/www/apps/daily/templates/daily-man.html

@@ -0,0 +1,27 @@
+<ion-view view-title="工作汇报管理" hide-tabs="true">
+    <ion-content>
+        <div class=" item item-divider"></div>
+        <ion-list>
+            <ion-item class="item item-icon-right" type="item-text-wrap" href="#/daily-permission">
+                允许谁看工作汇报
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <div class="item item-divider dividertext">
+                <label>可选择每个人的查看范围</label>
+            </div>
+            <ion-item class="item item-icon-right" type="item-text-wrap" href="#/daily-template">
+                日报模板设置
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <!-- <ion-item class="item item-icon-right" type="item-text-wrap">
+                周报模板设置
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <ion-item class="item item-icon-right" type="item-text-wrap">
+                月报模板设置
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item> -->
+            <div class="desctext">可自定义模板表单,让员工按要求填写,比如:今日总结、明日计划、产品销量...</div>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 38 - 0
platforms/android/assets/www/apps/daily/templates/daily-permission.html

@@ -0,0 +1,38 @@
+<ion-view view-title="允许谁看工作汇报" hide-nav-bar="false">
+    <ion-nav-buttons side="right">
+        <button class="button button-icon ion-ios-more" ng-if="isshowdelete.showDelete!=true" ng-click="popover.show($event)"></button>
+        <button class="button button-clear" ng-if="isshowdelete.showDelete" ng-click="ok();">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div class="item item-divider dividercolor">可以设置每个人的查看范围</div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list show-delete="isshowdelete.showDelete">
+            <ion-item class="item item-icon-right item-remove-animate item-text-wrap" ng-repeat="item in userlist.results" ng-click="toSelectDeptOrItem(item)">
+                <span>{{item.username}}</span>
+                <p> 
+                    <span ng-if="item.depts.length == 0 && item.users.length == 0 && item.all">全体成员</span>
+                    <span ng-repeat="dept in item.depts">{{dept.depname}}{{$last ? '' : '、'}}</span>
+                    <span ng-if="item.depts.length > 0 && item.users.length > 0">、</span>
+                    <span ng-repeat="user in item.users">{{user.username}}{{$last ? '' : '、'}}</span>
+                </p>
+                <ion-delete-button class="ion-minus-circled" ng-click="remove(item)">
+                </ion-delete-button>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </ion-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+    <script id="templates/add.html" type="text/ng-template">
+        <ion-popover-view class="popver_view">
+            <ion-content>
+                <ion-list>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="toadd();">添加成员</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="displayremove();">移除成员</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 48 - 0
platforms/android/assets/www/apps/daily/templates/daily-read.html

@@ -0,0 +1,48 @@
+<ion-view view-title="我可以查看的工作汇报">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <!--<div class="button-bar report-button">
+            <button class="button" ng-class="{true:'daily-color',false:'daily-hover'}[index==0?true:false]" ng-click="select(0)">日报</button>
+            <button class="button" ng-class="{true:'daily-color',false:'daily-hover'}[index==1?true:false]" ng-click="select(1)">周报</button>
+            <button class="button" ng-class="{true:'daily-color',false:'daily-hover'}[index==2?true:false]" ng-click="select(2)">月报</button>
+        </div>
+        <ion-slide-box show-pager="false" ng-init="init()" class="text-margin">
+            <ion-slide>-->
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-if="!loading">
+            <div ng-repeat="(key,item) in summary.results track by $index">
+                <div class="item item-stable center"><!--ng-if="isMonth(item[0])"-->
+                    <a class="link" ng-click="toMonthCount(item[0])">{{key}}&nbsp;统计</a>
+                </div>
+                <a class="item item-icon-right" 
+                    ng-repeat="it in item track by $index"
+                    ng-click="toDayCount(it.daily_date)">
+                    {{it.daily_date | date:'MM-dd'}}
+                    <span class="item-note">{{it.count}}篇</span>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </a>    
+            </div>
+        </ion-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+        <!--</ion-slide>
+        <ion-slide>
+            <ion-list>
+                <a class="item item-icon-right" href="#/daily-read/1">{xx月xx周}
+                    <span class="item-note">{number}</span>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </a>
+            </ion-list>
+        </ion-slide>
+        <ion-slide>
+            <ion-list>
+                <a class="item item-icon-right">{xx月}
+                    <span class="item-note">{number}</span>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </a>
+            </ion-list>
+        </ion-slide>
+    </ion-slide-box>-->
+    </ion-content>
+</ion-view>

+ 17 - 0
platforms/android/assets/www/apps/daily/templates/daily-readDay.html

@@ -0,0 +1,17 @@
+<ion-view view-title="日报({{month}}月{{day}}日)">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div class="item item-stable center">
+            <a class="link" ng-click="lookCount()">本日日报统计></a>
+        </div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <daily dailys="dailys.results" loading="loading"></daily>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+        <h4 class="stable center" ng-show="dailys != undefined && dailys.next == null && dailys.results.length > 10">没有更多了</h4>
+    </ion-content>
+    <div id="rightDisplay" ng-show="commons.bigImage" class="popover-backdrop1">
+        <img class="img-responsive" ng-click="hideBigImage()" ng-src="{{Url}}"/>
+    </div>
+</ion-view>

+ 31 - 0
platforms/android/assets/www/apps/daily/templates/daily-readDayCount.html

@@ -0,0 +1,31 @@
+<ion-view view-title="日报统计">
+    <ion-content>
+        <div class="item-stable row daily-count-back">
+            <span class="note col-34">{{year}}年{{month}}月
+                <p>{{day}}日</p>
+            </span>
+            <span class="note col-66">
+                <h4>共<span>&nbsp;{{toDayView.reported_count}}&nbsp;</span>人写了日报 </h4>
+            </span>
+        </div>
+        <ion-list>
+            <div class="item" ng-repeat="dept in toDayView.depts">
+                <div class="row">
+                    <span><b>{{dept.dept_name}}</b></span>
+                </div>
+                <div class="row">
+                    <div class="col-40 div-active" ng-click="lookDeptCount(1, dept.reported, dept.dept_name,dept.reported_count)">
+                        <span>提交&nbsp;:{{dept.reported_count}}人</span>
+                        <i class="icon ion-chevron-right float-right" ng-class="{'disabled':dept.reported_count == 0}"></i>
+                    </div>
+                    <div class="col-10 border-right"></div>
+                    <div class="col-10"></div>
+                    <div class="col-40 div-active" ng-click="lookDeptCount(0, dept.unreported, dept.dept_name, dept.unreported_count)">
+                        <span>未提交&nbsp;:{{dept.unreported_count}}人</span>
+                        <i class="icon ion-chevron-right float-right" ng-class="{'disabled':dept.unreported_count == 0}"></i>
+                    </div>
+                </div>
+            </div>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 15 - 0
platforms/android/assets/www/apps/daily/templates/daily-readDayDeptCount.html

@@ -0,0 +1,15 @@
+<ion-view view-title="{{dept}}">
+    <ion-content>
+        <div class="item-stable daily-count-back daily-count-height-40" ng-class="{true:'daily-count-back-submit'}[flag == 0]">
+            <p>{{year}}年{{month}}月{{day}}日,共&nbsp;{{users.length}}&nbsp;人{{flag == 1 ? '写了' : '没写'}}日报</p>
+        </div>
+        <div class="item item-divider center">人员列表</div>
+        <ion-list>
+            <a class="item item-avatar" ng-repeat="user in users">{{user.user_name}}
+                <img ng-src="../../../img/cat.png"/>
+                <span class="item-note">{{user.diary_dd | date:'HH:mm'}}</span>
+                <p>{{dept}}&nbsp;{{user.degree}}</p>
+            </a>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 24 - 0
platforms/android/assets/www/apps/daily/templates/daily-readMouthCount.html

@@ -0,0 +1,24 @@
+<ion-view view-title="日报月统计">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="showModal()">选择部门</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item-stable row daily-count-back">
+            <span class="note col-34">{{year}}年
+                <p>{{month}}月</p>
+            </span>
+            <span class="note col-33">汇报人员
+                <p>{{monthView.total}}人</p>
+            </span>
+            <span class="note col-33">日报
+                <p>{{monthView.mfs_count}}篇</p>
+            </span>
+        </div>
+        <div class="item item-divider disabled">汇报人员</div>
+        <a class="item item-avatar item-icon-right text-line-height" ng-repeat="item in monthView.daily_mfs">{{item.create_username}}
+            <img ng-src="../../../img/cat.png"/>
+            <span class="item-note">{{item.count}}</span>
+            <!--<i class="icon ion-chevron-right icon-accessory"></i>-->
+        </a>
+    </ion-content>
+</ion-view>

+ 28 - 0
platforms/android/assets/www/apps/daily/templates/daily-template.html

@@ -0,0 +1,28 @@
+<ion-view view-title="日报模板设置">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div class="item item-divider"></div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-show="!loading">
+            <ion-item class="item item-icon-right positive" type="item-text-wrap" href="#/daily-templateScope/-1">
+                新建日报模板
+                <i class="icon ion-android-add positive"></i>
+            </ion-item>
+            <div ng-repeat="template in templates.results">
+                <div class="item item-divider"></div>
+                <ion-item class="mobanitem" ng-click="gosetmoban(template);">
+                    <ion-item class="item item-icon-right " type="item-text-wrap">
+                        {{template.name}}
+                        <i class="icon ion-chevron-right icon-accessory"></i>
+                    </ion-item>
+                    <div class="item itemfield">
+                        <label>{{template.description}}</label>
+                    </div>
+                </ion-item>
+            </div>
+        </ion-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+</ion-view>

+ 22 - 0
platforms/android/assets/www/apps/daily/templates/daily-templateEdit.html

@@ -0,0 +1,22 @@
+<ion-view view-title="编辑日报模板">
+    <ion-content>
+        <div class=" item item-divider item-divider-deptmoban"></div>
+        <ion-list>
+            <ion-item class="item item-icon-right" type="item-text-wrap" ng-click="toSetDept();">
+                谁能使用
+                <span class="item-note">{{template.name}}</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <div class="item item-divider divider-editmoban-text"><label>公司的哪些部门,可以使用该模板</label></div>
+            <ion-item class="item item-icon-right" type="item-text-wrap" ng-click="defineform();">
+                自定义表单
+                <span class="item-note">{{template.description}}</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </ion-list>
+        <div class=" item item-divider item-divider-deptmoban"></div>
+        <ion-item class="item assertive" type="item-text-wrap" ng-click="delete();" style="text-align:center">
+            删除模板
+        </ion-item>
+    </ion-content>
+</ion-view>

+ 32 - 0
platforms/android/assets/www/apps/daily/templates/daily-templateScope.html

@@ -0,0 +1,32 @@
+<ion-view view-title="选择模板范围" cache-view="false" hide-nav-bar="false" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="this[leftbtn[index].click]();">{{leftbtn[index].text}}</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div class="item item-divider dividercolor">公司哪些部门,能够使用该模板</div>
+        <ul ng-if="!loading" class="list">
+            <li class="check-dept-li" ng-click="consoles();" ng-repeat="dept in depts track by $index" ng-class="{true:'clickactive',fasle:''}[actived]">
+                <label class="list item-checkbox">
+                    <div class="checkbox checkbox-input-hidden disable-pointer-events checkbox-circle">
+                        <input ng-disabled="dept.isdisabled" ng-model="dept.selected" ng-change="change(dept)" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
+                        <i class="checkbox-icon" ng-show="!dept.isdisabled"></i>
+                    </div>
+                </label>
+                <label ng-click="tochilddept(dept);" ng-class="{true:'',false:'disabled'}[!dept.isdisabled]">
+                    <span class="deptname">{{dept.depname}}{{dept.isdisabled?"(已设置)":""}}</span>
+                    <i class="icon ion-chevron-right icon-accessory" ng-show="dept.isshow"></i>
+                </label>
+            </li>
+        </ul>
+    </ion-content>
+    <div ng-class="{true:'bar bar-footer bar-dark footer-div bigview',false:'bar bar-footer footer-div bar-dark'}[isUp]">
+        <i ng-class="{true:'ion-ios-arrow-down cirl-i',false:' ion-ios-arrow-up cirl-i'}[isUp]" ng-click="isUp = !isUp"></i>
+        <ul class='ul-imgs dept-icon'>
+            <li ng-repeat="deptitem in selecteddepts track by $index">{{deptitem.depname}}</li>
+        </ul>
+        <button ng-disabled="selecteddepts.length==0" ng-click="ok();" class="button pull-right button-calm">确定{{selecteddepts.length>0?"("+selecteddepts.length+")":""}}</button>
+    </div>
+</ion-view>

+ 24 - 0
platforms/android/assets/www/apps/daily/templates/daily.html

@@ -0,0 +1,24 @@
+<ion-view view-title="工作汇报" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="toman()" ng-if="roleid==1">管理&nbsp;&nbsp;</button>
+        <button class="button button-clear" ng-click="towrite()">
+            <i class="icon ion-android-add"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <a class="item item-icon-right" href="#/daily-read">我可以查看的工作汇报
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <div class="item item-divider"></div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <daily dailys="dailys.results" loading="loading"></daily>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+        <h4 class="stable center" ng-show="dailys != undefined && dailys.next == null && dailys.results.length > 10">没有更多了</h4>
+    </ion-content>
+</ion-view>

+ 9 - 0
platforms/android/assets/www/apps/daily/templates/modal-selectDate.html

@@ -0,0 +1,9 @@
+<ion-modal-view>
+    <ion-header-bar>
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="closeModal(ok)">&nbsp;返回</button>
+        <h1 class="title">日期</h1>
+    </ion-header-bar>
+    <ion-content>
+        <ion-radio ng-model="index" ng-click="changeDate(day.id)" ng-value="day.id" ng-repeat="day in newDate">{{day.day | date:'M月d日'}}&nbsp;{{day.week | translate}}</ion-radio>
+    </ion-content>
+</ion-modal-view>

+ 11 - 0
platforms/android/assets/www/apps/daily/templates/modal-selectdept.html

@@ -0,0 +1,11 @@
+<ion-modal-view>
+    <ion-header-bar>
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="closeModal('ok')">&nbsp;返回</button>
+        <h1 class="title">选择部门</h1>
+    </ion-header-bar>
+    <ion-content>
+        <ion-list>
+            <ion-radio ng-model="index" ng-click="changeindex(dept)" ng-value="dept.id" ng-repeat="dept in depts">{{dept.depname}}</ion-radio>
+        </ion-list>
+    </ion-content>
+</ion-modal-view>

+ 58 - 0
platforms/android/assets/www/apps/daily/templates/selectdeptoritem.html

@@ -0,0 +1,58 @@
+<ion-view view-title="选择部门或成员" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="this[leftbtn[index].click]();">{{leftbtn[index].text}}</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-show="!loading">
+            <ul>
+                <li class="check-dept-li" ng-show="index==0">
+                    <label class="list item-checkbox">
+                        <div class="checkbox checkbox-input-hidden disable-pointer-events checkbox-circle">
+                            <input ng-model="selecteditems.all" ng-click="selectAll()" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
+                            <i class="checkbox-icon"></i>
+                        </div>
+                    </label>
+                    <label ng-click="selectAll()">
+                        <span class="deptname">全部成员</span>
+                    </label>
+                </li>
+                <div class="item item-divider divder divider-font" ng-if="deptlst.length>0"><i class="icon ion-ios-star"></i>部门({{deptlst.length}})</div>
+                <li class="check-dept-li" ng-repeat="dept in deptlst track by $index" ng-class="{true:'clickactive',fasle:''}[actived]">
+                    <label class="list item-checkbox">
+                        <div class="checkbox checkbox-input-hidden disable-pointer-events checkbox-circle">
+                            <input ng-model="dept.selected" ng-change="change(dept,'d')" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
+                            <i class="checkbox-icon"></i>
+                        </div>
+                    </label>
+                    <label ng-click="tochilddept(dept);">
+                        <span class="deptname">{{dept.depname}}</span>
+                        <i class="icon ion-chevron-right icon-accessory" ng-show="dept.isShow"></i>
+                    </label>
+                </li>
+            </ul>
+            <!--员工-->
+            <div class="item item-divider divder divider-font"><i class="icon ion-ios-star"></i>联系人({{emplst.length}})</div>
+            <ion-list>
+                <ion-checkbox ng-change="change(emp,'e')" ng-model="emp.selected" class="ion-checkbox-class" ng-repeat="emp in emplst">
+                    <img ng-src="../../../img/panda.png"/>
+                    <label class="labelname">{{emp.username}}</label>
+                    <label class="labelrole">{{emp.degree}}</label>
+                </ion-checkbox>
+                <ion-list>
+                <div class='obligate-item'></div>
+        </div>
+    </ion-content>
+    <div class="bar bar-footer bar-dark footer-div" ng-class="{true:'bigview',false:''}[isUp]" style="">
+        <i ng-class="{true:'ion-ios-arrow-down cirl-i',false:' ion-ios-arrow-up cirl-i'}[isUp]" ng-click="isUp = !isUp"></i>
+        <ul class='ul-imgs dept-icon'>
+            <li ng-repeat="dept in selecteditems.depts">{{dept.depname}}
+            </li>
+            <li ng-repeat="user in selecteditems.users">{{user.username}}
+            </li>
+        </ul>
+        <button ng-click="ok();" ng-disabled="selecteditems.depts.length==0&&selecteditems.users.length==0" class="button pull-right button-calm">确定{{selecteditems.depts.length>0||selecteditems.users.length>0?"(" + (selecteditems.depts.length + selecteditems.users.length) +")":""}}</button>
+    </div>
+</ion-view>

+ 18 - 0
platforms/android/assets/www/apps/daily/templates/template-daily.html

@@ -0,0 +1,18 @@
+<div ng-if="!loading" class="daily" ng-repeat="daily in dailys">
+    <daily-header daily="daily"></daily-header>
+    <daily-content daily="daily" ng-click="todetails(daily)"></daily-content>
+    <div class="item item-body tool">
+        <div class="row">
+            <!--<a class="icon col-33 ion-ios-upload-outline" ng-click="totransfer(daily.id)">
+                    &nbsp;{{(daily.transfertimes == null || daily.transfertimes == 0)? "转发" : daily.transfertimes}}
+                </a>-->
+            <a class="icon col-50 ion-ios-chatboxes-outline" ng-click="todetails(daily)">
+                &nbsp;{{(daily.comment_times == null || daily.comment_times == 0)? "评论" : daily.comment_times}}
+            </a>
+            <a class="icon col-50 ion-ios-eye-outline" ng-click="todetails(daily)">
+                &nbsp;{{(daily.read_times == null || daily.read_times == 0) ? "看过" : daily.read_times}}
+            </a>
+        </div>
+    </div>
+    <div class="item item-divider"></div>
+</div>

+ 51 - 0
platforms/android/assets/www/apps/daily/templates/template-itemWrite.html

@@ -0,0 +1,51 @@
+<!--单行-->
+<div ng-if="item.t__type == 1">
+    <div class="item item-divider"></div>
+    <div class="item item-input">
+        <span>{{item.name}}</span>
+        <label class="input-margin">
+            <input type="text" ng-model="item.text" placeholder="{{note}}">
+        </label>
+    </div>
+</div>
+<!--多行-->
+<div ng-if="item.t__type == 2">
+    <div class="item item-divider"></div>
+    <div class="item item-input">
+        <textarea rows="6" ng-model="item.text" placeholder="{{item.name}}{{note}}"></textarea>
+    </div>
+</div>
+<!--日期-->
+<div ng-if="item.t__type == 3">
+    <div class="item item-divider"></div>
+    <a class="item item-icon-right" ng-click="chooseDate(item.text)">{{item.name}}
+        <span class="item-note">{{item.text | date:"yyyy-MM-dd"}}</span>
+        <span>{{note}}</span>
+        <i class="icon ion-chevron-right icon-accessory"></i>
+    </a>
+</div>
+<!--数字-->
+<div ng-if="item.t__type == 4">
+    <div class="item item-divider"></div>
+    <div class="item item-input">
+        <span>{{item.name}}</span>
+        <label class="input-margin">
+            <input type="number" ng-model="item.text" placeholder="{{note}}">
+        </label>
+    </div>
+</div>
+<!--单选-->
+<div ng-if="item.t__type == 5">
+    <div class="item item-divider"></div>
+    <div class="list">
+        <label class="item item-input item-select">
+            <div class="input-label">
+                <span>{{item.name}}</span>
+                <span>{{note}}</span>
+            </div>
+            <select ng-model="item.text" ng-change="selectedChange(item.text)">
+                <option ng-repeat="selectitem in selectData track by $index">{{selectitem}}</option>
+            </select>
+        </label>
+    </div>
+</div>

+ 54 - 0
platforms/android/assets/www/apps/notice/index.html

@@ -0,0 +1,54 @@
+<!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="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/chineseTopinyin.js"></script>
+
+    <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.min.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">
+        返回
+    </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>
+

+ 962 - 0
platforms/android/assets/www/apps/notice/js/controllers.js

@@ -0,0 +1,962 @@
+starter.controller('NoticeCtrl', function ($rootScope, $scope, $state, $ionicHistory, _, global, Member, Notice, Tool) {
+    var beoreenter = $scope.$on("$ionicView.beforeEnter", function () {
+        global.fetch_user().then(function () {
+            Notice.getCreateUsrsState().then(function (data) {
+                $scope.createstate = data.state;
+            });
+            getnoticedata();
+            $scope.roleid = global.user.roleid;
+        }, function (err) {
+            alert(JSON.stringify(err));
+            $scope.loading = false;
+        });
+        Notice.getsavedata = Notice.getstructdata();
+        Member.selectedemplst = [];
+        $ionicHistory.clearHistory(); //清除所有的view
+    });
+    $scope.$on("$destroy", function () {
+        beoreenter = null;
+    });
+
+    $scope.goBack = function () {
+        global.goBack();
+    };
+
+    $scope.todetails = function (id) {
+        $state.go('notice-details', {
+            id: id
+        });
+    };
+
+    $scope.toper = function () {
+        $state.go('power-set');
+    };
+
+    $scope.toadd = function () {
+        Member.resourcemember = [];
+        Member.selectedemplst = [];
+        Member.showall = true;
+        Member.showgroup = true;
+        Member.titlename = "选择通知的成员";
+        Member.routename = "postnotice";
+        Member.routeparams = {
+            "id": -1
+        };
+        $state.go('selectmember');
+    };
+
+    $scope.doRefresh = function () {
+        getnoticedata();
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.Notice != undefined && $scope.Notice.next != null) {
+            Notice.getNext($scope.Notice.next).then(function (data) {
+                console.log(data);
+                _.each(data.results, function (item) {
+                    $scope.Notice.results.push(item);
+                })
+                $scope.Notice.next = data.next;
+                $scope.Notice.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    }
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.Notice != undefined && $scope.Notice.next != null ? true : false;
+    };
+
+    function getnoticedata() {
+        if (global.user.token != "") {
+            if ($scope.Notice == undefined) $scope.loading = true;
+            Notice.getReceive().then(function (data) {
+                data.results = _.sortBy(data.results, 'create_dd').reverse();
+                $scope.Notice = data;
+                console.log($scope.Notice);
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+})
+
+.controller('NoticeDetailsCtrl', function ($rootScope, $scope, $state, $ionicSlideBoxDelegate, $ionicPopover, $ionicPopup, _, global, showPopup, Notice, General) {
+    $scope.id = $state.params['id'];
+    $scope.isScopeShow = false;
+    $scope.activeIndex = 0;
+    $scope.data = {
+        notice_id: $scope.id,
+        content: null
+    };
+    var isChange = false;
+
+    $scope.goBack = function () {
+        global.goBack();
+    };
+
+    $scope.change = function (index) {
+        $scope.activeIndex = index;
+        $ionicSlideBoxDelegate.slide(index);
+    };
+
+    $scope.lockSlide = function () {
+        $ionicSlideBoxDelegate.enableSlide(false);
+    };
+
+    $scope.changeIndex = function (index) {
+        if (!isChange) {
+            isChange = true;
+        }
+        if ($scope.details.vote_selecttype == 1) {
+            $scope.selectIndex = index;
+        } else {
+            var flag = false;
+            _.each($scope.selectIndex, function (item) {
+                if (item == index) {
+                    $scope.selectIndex.splice($scope.selectIndex.indexOf(item), 1);
+                    flag = true;
+                }
+            })
+            if (!flag) {
+                $scope.selectIndex.push(index);
+            }
+        }
+    }
+
+    $scope.result = function () {
+        // type 0 admin 1 usr
+        var type = null;
+        if ($scope.isAdmin) {
+            type = 0;
+        } else {
+            type = 1;
+        }
+        $scope.popover.hide();
+        $state.go('notice-result', {
+            id: $scope.id,
+            type: type
+        });
+    }
+
+    $scope.transfer = function (id) {
+        $scope.popover.hide();
+    }
+
+    $scope.deleteNotice = function () {
+        $scope.popover.hide();
+        showPopup.confirm("是否删除改公告?", '是', '否').then(function (res) {
+            if (res) {
+                Notice.delete_NoticeMf($scope.id).then(function (data) {
+                    $state.go('notice');
+                }, function (error) {
+                    alert('delete noticemf error:' + JSON.stringify(error))
+                })
+            }
+        });
+    }
+
+    $scope.sendComment = function () {
+        if ($scope.data.content != null && $scope.data.content != "") {
+            $scope.data.create_dd = new Date();
+            General.postComment($scope.data, 'notice').then(function (data) {
+                $scope.data.content = null;
+            });
+        }
+    }
+
+    $scope.popupMessageOpthins = function (id, usrid) {
+        if (usrid == global.user.usrid) {
+            $scope.popup.optionsPopup = $ionicPopup.show({
+                template: '<div class="center" style="height:20px;width:100%;line-height:20px;margin-top:10px;" rj-close-back-drop><h4>用户操作</h4></div>',
+                scope: $scope,
+                buttons: [{
+                    text: '删除',
+                    type: 'button-positive',
+                    onTap: function (e) {
+                        General.deleteComment(id, 'notice');
+                    }
+                }]
+            });
+            $scope.popup.isPopup = true;
+        } else {
+            //todo:对其进行回复
+        }
+    };
+
+    $scope.giveUp = function (type) {
+        // type 0:投票 1:反馈
+        var title = ['是否放弃投票?', '是否放弃反馈?']
+        showPopup.confirm(title[type], '是', '否').then(function (res) {
+            if (res) {
+                postGiveUp(type);
+            }
+        })
+    };
+
+    $scope.postVote = function () {
+        if (isChange) {
+            var data = {
+                vote_selectindex: ''
+            };
+            $scope.usr_select_index = $scope.selectIndex;
+            if ($scope.details.vote_selecttype == 0) {
+                for (var i = 0; i < $scope.selectIndex.length; i++) {
+                    if (i == $scope.selectIndex.length - 1) {
+                        data.vote_selectindex += $scope.selectIndex[i];
+                    } else {
+                        data.vote_selectindex += $scope.selectIndex[i] + ';';
+                    }
+                }
+            } else {
+                data.vote_selectindex = $scope.selectIndex;
+            }
+            postRecordData(data);
+        }
+    }
+
+    $scope.showbackpopup = function () {
+        $scope.backData = {
+            content: null
+        };
+        var backpopup = $ionicPopup.show({
+            template: '<div class="popup-edit-comp" ><input type="text" ng-model="backData.content" ><label ></label></div>',
+            title: '<div><h5>请输入反馈内容</h5></div>',
+            scope: $scope,
+            buttons: [{
+                text: '取消',
+                onTap: function () {
+                    return false;
+                }
+            }, {
+                text: '<b>提交</b>',
+                type: 'button-positive',
+                onTap: function (e) {
+                    if (!$scope.backData.content) {
+                        e.preventDefault();
+                    } else {
+                        return true;
+                    }
+                }
+            }]
+        }).then(function (res) {
+            if (res) {
+                postBackContent();
+            }
+        });
+    };
+
+    $scope.edit = function () {
+        $scope.popover.hide();
+        $state.go("postnotice", {
+            "id": $scope.id
+        })
+    }
+
+    $ionicPopover.fromTemplateUrl('templates/detiilsmenu.html', {
+        scope: $scope,
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+
+    $scope.shouBigImage = function (imageName, event) {
+        if (event != undefined) {
+            event.stopPropagation();
+        }
+        $scope.Url = imageName;
+        $rootScope.commons.bigImage = true;
+    };
+
+    $scope.doRefresh = function () {
+        getDetails();
+    };
+
+    function postBackContent() {
+        postRecordData({
+            back_content: $scope.backData.content
+        });
+    }
+
+    function postGiveUp(type) {
+        // type 0 投票 1 反馈
+        var data = {};
+        if (type == 0) {
+            data.vote_giveup = 1
+        } else if (type == 1) {
+            data.back_giveup = 1
+        }
+        postRecordData(data);
+    }
+
+    function postRecordData(data) {
+        data.notice_id = $scope.id;
+        data.user_id = global.user.usrid;
+        Notice.postRecord(data).then(function (data) {
+            $scope.record = data;
+        })
+    }
+
+    function getDetails() {
+        if ($scope.details == undefined) {
+            $scope.loading = true;
+        }
+        Notice.getDetails($scope.id).then(function (data) {
+            $scope.details = data;
+            if ($scope.details.user == global.user.usrid) {
+                $scope.isAdmin = true;
+            }
+            if ($scope.details.vote_enddd != null) {
+                $scope.details.vote_enddd = new Date($scope.details.vote_enddd)
+            }
+            if ($scope.details.back_enddd != null) {
+                $scope.details.back_enddd = new Date($scope.details.back_enddd)
+            }
+            $scope.datetime = new Date();
+            if ($scope.details.vote_selectdata != null) {
+                $scope.selectData = $scope.details.vote_selectdata.split(';');
+            }
+            if ($scope.details.vote_selecttype == 1) {
+                $scope.selectIndex = 0;
+            } else if ($scope.details.vote_selecttype == 0) {
+                $scope.selectIndex = [];
+            }
+            Notice.getRecord($scope.id).then(function (data) {
+                $scope.record = data;
+                if ($scope.record != null) {
+                    if ($scope.record.vote_selectindex != null) {
+                        $scope.usr_select_index = $scope.record.vote_selectindex.split(';');
+                    }
+                }
+                $scope.loading = false;
+            });
+            General.getComment($scope.id, 'notice').then(function (data) {
+                $scope.commentData = data.reverse();
+            });
+            General.getRead($scope.id, 'notice').then(function (data) {
+                $scope.readData = data.reverse();
+            });
+            General.getRead($scope.id, 'notice', 'unreads').then(function (data) {
+                $scope.unreadData = data.reverse();
+            });
+        }).finally(function () {
+            $scope.$broadcast('scroll.refreshComplete');
+        });
+    }
+
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        if (global.user.token == "") {
+            global.fetch_user().then(function () {
+                getDetails();
+            }, function (err) {
+                $scope.loading = false;
+                alert(JSON.stringify(err));
+            });
+        } else {
+            getDetails();
+        }
+
+        $scope.popup = {
+            isPopup: false
+        };
+    });
+
+    $scope.$on("$destroy", function () {
+        $scope.popover.remove();
+        beforeEnter = null;
+        $rootScope.commons.bigImage = false;
+    })
+})
+
+.controller('PowerSetCtrl', function ($rootScope, $scope, $state, $timeout, $location, $ionicScrollDelegate, $ionicPopover, _, global, Dept, Member, Notice) {
+    $ionicPopover.fromTemplateUrl('templates/add.html', {
+        scope: $scope
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        $scope.sortchars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#'];
+        if (Member.selectedemplst.length > 0) {
+            var add_usrs = _.pluck(Member.selectedemplst, 'user_id');
+            // alert("add_usrs data:"+JSOM.stringify(add_usrs));
+            Notice.post_NoticeCreateUsrs(add_usrs).then(function (data) {
+                getCreateUsrs();
+            }, function (error) {
+                console.log(error);
+            })
+        } else {
+            getCreateUsrs();
+        }
+        Member.cancelroutename = '';
+        Member.cancelrouteparams = {};
+    });
+
+    $scope.$on("$destroy", function () {
+        $scope.popover.remove();
+        beforeEnter = null;
+    });
+
+    $scope.isshowdelete = {
+        showDelete: false
+    };
+    $scope.sortchar = 'A';
+    $scope.Isshowmiddle = false;
+
+    $scope.sortByChar = function (char, id) {
+        $scope.sortchar = char;
+        $scope.Isshowmiddle = true;
+        $location.hash(id);
+        $ionicScrollDelegate.anchorScroll();
+        $timeout(function () {
+            $scope.Isshowmiddle = false;
+        }, 200);
+    };
+
+    $scope.displayremove = function () {
+        $scope.isshowdelete.showDelete = !$scope.isshowdelete.showDelete;
+        $scope.popover.hide();
+    };
+
+    $scope.ok = function () {
+        $scope.popover.hide();
+        $scope.isshowdelete.showDelete = false;
+        if (delete_data.length > 0) {
+            Notice.delete_NoticeCreateUsrs(delete_data);
+            for (var i = 0; i < $scope.empdata.length; i++) {
+                _.each(delete_data, function (d) {
+                    if (d == $scope.empdata[i].id) {
+                        $scope.empdata.splice(i, 1)
+                    }
+                })
+            }
+        }
+    };
+
+    $scope.toadd = function () {
+        Member.resourcemember = [];
+        Member.selectedemplst = [];
+        Member.disabled = true;
+        Member.resourcemember = $scope.empdata;
+        Member.showall = false;
+        Member.showgroup = false;
+        Member.titlename = "选择成员";
+        Member.routename = "";
+        $scope.popover.hide();
+        $state.go('selectmember');
+    };
+    var delete_data = [];
+    $scope.removeItem = function (id, _char) {
+        delete_data.push(id);
+        for (var i = 0; i < $scope.resultdata.length; i++) {
+            if ($scope.resultdata[i].sortchar == _char) {
+                for (var j = 0; j < $scope.resultdata[i].persons.length; j++) {
+                    if ($scope.resultdata[i].persons[j].nid == id) {
+                        $scope.resultdata[i].persons.splice(j, 1);
+                        if ($scope.resultdata[i].persons.length == 0) {
+                            $scope.resultdata.splice(i, 1)
+                        }
+                        break;
+                    }
+                }
+                break;
+            }
+        }
+    };
+
+    function getCreateUsrs() {
+        if ($scope.resultdata == undefined) {
+            $scope.loading = true;
+        }
+        Notice.getCreateUsrs().then(function (data) {
+            $scope.loading = false;
+            $scope.empdata = data;
+            $scope.resultdata = [];
+            var chars = _.map($scope.empdata, function (emp) {
+                var char = pinyin.getCamelChars(emp.name).toUpperCase().charAt(0);
+                return _.contains($scope.sortchars, char) ? char : '#';
+            });
+            chars = _.sortBy(_.uniq(chars));
+            for (var i = 0; i < chars.length; i++) {
+                var d = {
+                    "sortchar": chars[i],
+                    "persons": []
+                };
+                $scope.resultdata.push(d);
+                for (var j = 0; j < $scope.empdata.length; j++) {
+                    var char = pinyin.getCamelChars($scope.empdata[j].name).toUpperCase().charAt(0);
+                    var empchar = _.contains($scope.sortchars, char) ? char : '#';
+                    if (empchar == chars[i]) {
+                        d.persons.push({
+                            "nid": $scope.empdata[j].id,
+                            "username": $scope.empdata[j].name
+                        });
+                    }
+                }
+            }
+            var index = _.pluck($scope.resultdata, 'sortchar').indexOf('#');
+            if (index >= 0) {
+                var item = $scope.resultdata[index];
+                $scope.resultdata.splice(index, 1);
+                $scope.resultdata.push(item);
+            }
+            Member.selectedemplst = [];
+        }, function (err) {
+            $scope.loading = false;
+            alert(JSON.stringify(err))
+        });
+    }
+})
+
+.controller('PostNoticeCtrl', function ($rootScope, $scope, $state, $cordovaDatePicker, $timeout, $ionicHistory, $q, $ionicScrollDelegate, _, global, ImageManage, showPopup, Notice, Member, Tool, formatFilter) {
+    $rootScope.commons.bigImage = false;
+    var tmday = new Date((new Date() / 1000 + 86400) * 1000);
+    $scope.isNew = (parseInt($state.params["id"]) < 0);
+    $scope.selectdatas = [{
+        name: '多选',
+        id: 0
+    }, {
+        name: '单选',
+        id: 1
+    }];
+    var deleteimages = {};
+
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        Tool.removeBackView('selectmember');
+        $scope.usernames = "";
+        if ($scope.isNew) { //add
+            deleteimages = Notice.getsavedata.deleteimages;
+            $scope.noticedata = Notice.getsavedata;
+            $scope.noticedata.allid = Member.all;
+            if (Member.dialogresult == 0) { //cancel
+                $scope.noticedata.allid == 0 ? setreadusrs($scope.noticedata.readusrs) : $scope.usernames = "全部成员";
+            } else {
+                if (Member.all == 0 && Member.selectedemplst.length > 0) {
+                    $scope.noticedata.readusrs = _.map(Member.selectedemplst, function (item) {
+                        return _.pick(item, 'user_id', 'username');
+                    });
+                    setreadusrs(Member.selectedemplst);
+                } else if (Member.all == 1) {
+                    $scope.noticedata.readusrs = [];
+                    $scope.usernames = "全部成员";
+                }
+            }
+        } else { //edit
+            deleteimages = Notice.getLoalDetails().deleteimages;
+            $scope.noticedata = Notice.getLoalDetails();
+            $scope.editvotedata = $scope.noticedata.selectitems;
+            $scope.noticedata.disablededit.showadditem = (Tool.trim($scope.noticedata.vote_title).length == 0);
+            $scope.noticedata.disablededit.showeditback = (Tool.trim($scope.noticedata.back_title).length == 0);
+            if (Member.selectedemplst.length > 0) {
+                $scope.noticedata.allid = Member.all;
+                $scope.noticedata.readusrs = _.map(Member.selectedemplst, function (item) {
+                    return _.pick(item, 'user_id', 'username');
+                });
+                setreadusrs(Member.selectedemplst)
+            } else {
+                if ($scope.noticedata.allid == 1) {
+                    $scope.noticedata.readusrs = [];
+                    $scope.usernames = "全部成员";
+                } else {
+                    setreadusrs($scope.noticedata.readusrs)
+                }
+            }
+        }
+        Member.routeparams = {};
+        $scope.popup = {
+            isSetPopup: false
+        };
+        $ionicScrollDelegate.resize();
+    });
+
+    $scope.$on("$destroy", function () {
+        $rootScope.commons.modal = null;
+        $rootScope.commons.fun = null;
+        beforeEnter = null;
+        Notice.getsavedata = Notice.getstructdata();
+    });
+
+    $scope.noticedata = [];
+    $scope.imagePicker = function () {
+        ImageManage.ImagePicker_getPictures(10).then(function (data) {
+            if (data.length == 0) return;
+            $scope.noticedata.noticefiles = $scope.noticedata.noticefiles.concat(_.map(data, function (imageUrl) {
+                return {"file_thumbnail_path": imageUrl, "file_full_path": imageUrl};
+            }));
+        });
+    };
+
+    $scope.Camera = function () {
+        ImageManage.Camera_getPicture().then(function (result) {
+            $scope.noticedata.noticefiles.push({
+                "file_thumbnail_path": result,
+                "file_full_path": result
+            });
+        });
+    };
+
+    $scope.shouBigImage = function (imageName, event) {
+        if (event != undefined) event.stopPropagation();
+        $scope.Url = imageName;
+        $rootScope.commons.bigImage = true;
+    };
+
+    $rootScope.commons.bigImage = false;
+    $scope.hideBigImage = function () {
+        $rootScope.commons.bigImage = false;
+    };
+
+    $scope.deleteimage = function () {
+        for (var i = 0; i < $scope.noticedata.noticefiles.length; i++) {
+            if ($scope.noticedata.noticefiles[i].file_full_path == $scope.Url) {
+                if (_.has($scope.noticedata.noticefiles[i], 'id')) {
+                    deleteimages.oldimages.push($scope.noticedata.noticefiles[i]);
+                }
+                $scope.noticedata.noticefiles.splice(i, 1);
+                break;
+            }
+        }
+        $rootScope.commons.bigImage = false;
+    };
+
+    var tempdata = {};
+    $scope.set_voteback = function (type, event) {
+        type == 'vote' ? $scope.noticedata.setbtnstyle.vote = true : $scope.noticedata.setbtnstyle.back = true;
+        tempdata = Tool.cloneObj($scope.noticedata);
+        tempdata.selectitems = tempdata.vote_selectdata == "" ? [] : _.map(tempdata.vote_selectdata.split(';'), function (text) {
+                return {'text': text};
+            });
+        showPopup.modalTemplate(formatFilter('templates/modal-{0}.html', type), 'slide-in-right', $scope).then(function (modal) {
+            $rootScope.commons.fun = clear_change;
+            $rootScope.commons.modal = modal;
+            $rootScope.commons.modal.show();
+        })
+    };
+
+    $scope.cancel = function (op) {
+        $rootScope.commons.fun = null;
+        if (op == 'notice') {
+            $ionicHistory.goBack();
+        } else {
+            clear_change()
+        }
+    };
+
+    function clear_change() {
+        $scope.noticedata = Tool.cloneObj(tempdata);
+        if (Tool.trim(tempdata.vote_title).length == 0) $scope.noticedata.setbtnstyle.vote = false;
+        if (Tool.trim(tempdata.back_title).length == 0) $scope.noticedata.setbtnstyle.back = false;
+        set_modal();
+    }
+
+    $scope.ok = function (op) {
+        $rootScope.commons.fun = null;
+        if (op == "notice") { //创建公告的首页-确定按钮
+            if (Tool.trim($scope.noticedata.title).length == 0) {
+                showPopup.PopupWindow(0, "标题不能为空!", false);
+                return;
+            }
+            if (Tool.trim($scope.noticedata.content).length == 0) {
+                showPopup.PopupWindow(0, "内容不能为空!", false);
+                return;
+            }
+            showPopup.showLoading(1, '正在提交');
+            $scope.noticedata.usrid = global.user.usrid;
+            var temp_notice = Tool.cloneObj($scope.noticedata);
+            temp_notice.readusrs = _.pluck(temp_notice.readusrs, 'user_id');
+            if ($scope.isNew) {
+                Notice.post_NoticeMf(temp_notice).then(function (data) {
+                    if ($scope.noticedata.noticefiles.length > 0) {
+                        postimg($scope.noticedata.noticefiles, data.id);
+                    } else {
+                        showPopup.hideLoading();
+                        $ionicHistory.goBack();
+                        $timeout(function () {
+                            $state.go("notice-details", {
+                                "id": data.id
+                            })
+                        });
+                    }
+                }, function (error) {
+                    showPopup.hideLoading();
+                    alert('post_NoticeMf error:  ' + JSON.stringify(error))
+                });
+            } else {
+                temp_notice.del_files = _.pluck(deleteimages.oldimages, 'id');
+                Notice.put_NoticeMf(temp_notice).then(function (data) {
+                    postimgs = _.filter($scope.noticedata.noticefiles, function (img) {
+                        return !_.has(img, 'id');
+                    });
+                    if (postimgs.length > 0) {
+                        postimg(postimgs, $state.params['id']);
+                    } else {
+                        showPopup.hideLoading();
+                        $ionicHistory.goBack();
+                    }
+                }, function (error) {
+                    showPopup.hideLoading();
+                    alert("put notice error: " + JSON.stringify(error))
+                })
+            }
+        } else if (op == "vote") { //添加投票模态窗口-确定按钮
+            if (Tool.trim($scope.noticedata.vote_title).length == 0) {
+                showPopup.PopupWindow(0, '标题不能为空!', false);
+                return;
+            }
+            var items = _.filter($scope.noticedata.selectitems, function (item) {
+                return Tool.trim(item.text).length > 0;
+            });
+
+            var resultitems = _.uniq(_.pluck(items, 'text'));
+            if (resultitems.length < items.length) {
+                showPopup.PopupWindow(0, '选项不能重复!', false);
+                return;
+            }
+            if (resultitems.length < 2) {
+                showPopup.PopupWindow(0, '实际投票选项不能少于2项!', false);
+                return;
+            }
+            $scope.noticedata.vote_selectdata = _.pluck($scope.noticedata.selectitems, 'text').join(';');
+            set_modal();
+            $timeout(function () {
+                $scope.noticedata.showvoteDelete = true;
+            }, 1000);
+        } else if (op == "back") {
+            if (Tool.trim($scope.noticedata.back_title).length == 0) {
+                showPopup.PopupWindow(0, '问题内容不能为空!', false);
+                return;
+            }
+            set_modal();
+            $timeout(function () {
+                $scope.noticedata.showbackDelete = true;
+            }, 1000);
+        }
+    };
+
+    $scope.checkend_dd = function (op) {
+        var date = null;
+        if ($scope.isNew) {
+            date = tmday;
+        } else {
+            if (op == "vote") {
+                date = $scope.noticedata.vote_enddd == null ? tmday : $scope.noticedata.vote_enddd;
+            } else {
+                date = $scope.noticedata.back_enddd == null ? tmday : $scope.noticedata.vote_enddd;
+            }
+        }
+        var options = {
+            mode: 'date',
+            date: date,
+            androidTheme: 3
+        };
+        $cordovaDatePicker.show(options).then(function (date) {
+            $timeout(function () {
+                if (date == undefined) return;
+                op == "vote" ? $scope.noticedata.vote_enddd = date : $scope.noticedata.back_enddd = date;
+            });
+        });
+    };
+
+    $scope.addItem = function () {
+        $timeout(function () {
+            $scope.noticedata.selectitems.push({
+                "text": ""
+            });
+        });
+    };
+
+    $scope.removeItem = function (index) {
+        $scope.noticedata.selectitems.splice(index, 1);
+    };
+
+    //todo:选择要通知的成员
+    $scope.toselect = function () {
+        Member.resourcemember = [];
+        Member.showall = true;
+        Member.showgroup = true;
+        Member.titlename = "选择通知的成员";
+        Member.routename = "postnotice";
+        Member.cancelroutename = "postnotice";
+        Member.cancelrouteparams = {
+            "id": $state.params['id']
+        };
+        Member.disabled = false;
+        if ($scope.isNew) {
+            Member.dialogresult == 0 ? setresourcedata($scope.noticedata.readusrs) : setresourcedata(Member.selectedemplst);
+            Member.routeparams = {
+                "id": -1
+            };
+        } else {
+            Member.selectedemplst.length == 0 ? setresourcedata($scope.noticedata.readusrs) : setresourcedata(Member.selectedemplst);
+            Member.routeparams = {
+                "id": $state.params['id']
+            };
+        }
+        Member.selectedemplst = [];
+        $state.go('selectmember');
+    };
+
+    $scope.delete = function (op) {
+        if (op == "vote") {
+            $scope.noticedata.vote_title = "";
+            $scope.noticedata.vote_selectdata = "";
+            $scope.noticedata.vote_selecttype = 1;
+            $scope.noticedata.vote_enddd = tmday;
+            $scope.noticedata.selectitems = [];
+            $scope.noticedata.setbtnstyle.vote = false;
+            $scope.noticedata.showvoteDelete = false;
+            $scope.noticedata.disablededit.showadditem = true;
+        } else {
+            $scope.noticedata.back_title = "";
+            $scope.noticedata.back_enddd = tmday;
+            $scope.noticedata.setbtnstyle.back = false;
+            $scope.noticedata.showbackDelete = false;
+            $scope.noticedata.disablededit.showeditback = true;
+        }
+        set_modal();
+    };
+
+    $scope.getaddress = function () {
+        if (window.cordovaLinker) {
+            var local = {
+                NAME: "",
+                Latitude: "",
+                Longitude: "",
+                Distance: ""
+            };
+            cordovaLinker.callMap(local, function (mapdata) {
+                $scope.noticedata.address = mapdata.NAME
+            });
+        }
+    };
+
+    function setresourcedata(data) {
+        Member.resourcemember = Member.resourcemember.concat(_.map(data, function (item) {
+            if (_.has(item, 'user__username')) item.username = item.user__username;
+            return item
+        }));
+    }
+
+    function setreadusrs(data) {
+        $scope.usernames = _.map(data, function (item) {
+            return _.has(item, 'username') ? item.username : item.user__username;
+        }).join('、');
+    }
+
+    function postimg(imgfiles, id) {
+        ImageManage.uploadImage(_.pluck(imgfiles, 'file_full_path'), 'notice', id, 'noticefile').then(function (res) {
+            $q.all(res).then(function (res1) {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+                $timeout(function () {
+                    $state.go("notice-details", {
+                        "id": id
+                    })
+                });
+            })
+        }, function (err) {
+            showPopup.hideLoading();
+            alert(JSON.stringify(error));
+            showPopup.PopupWindow(0, 'upload image fail');
+        })
+    }
+
+    function set_modal() {
+        $rootScope.commons.modal.hide();
+        $rootScope.commons.modal = null;
+    }
+})
+
+.controller('NoticeResultCtrl', function ($rootScope, $scope, $state, $timeout, showPopup, Notice) {
+    $scope.id = $state.params['id'];
+    $scope.type = $state.params['type'];
+
+    $scope.toResultDetails = function (type, index) {
+        // type 0 未看 1 已看 2 未反馈 3 已反馈 4 放弃反馈 5 未投票 6 放弃投票 7 已投票
+        // index 选项的下标
+        showPopup.showLoading(1, '加载中');
+        var data = Notice.getCountDetails();
+        if (type == 7) {
+            data.selectItem = $scope.selectData[index];
+        }
+        Notice.getUsrCount($scope.id, type, index).then(function () {
+            $state.go('result-details', {
+                type: type
+            });
+            showPopup.hideLoading();
+        })
+    }
+
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        if ($scope.details == undefined) {
+            showPopup.showLoading(1, '加载中');
+        }
+        Notice.getCount($scope.id).then(function (data) {
+            $scope.countData = data;
+            $scope.details = Notice.getLoalDetails();
+            if ($scope.details.vote_title != null) {
+                $scope.selectData = $scope.details.vote_selectdata.split(';');
+                $scope.usrvotecount = 0;
+                for (var i = 0; i < $scope.countData.votecount.length; i++) {
+                    $scope.usrvotecount += $scope.countData.votecount[i];
+                }
+                $scope.usrvotecount += $scope.countData.unvote;
+                $scope.usrvotecount += $scope.countData.votegiveup;
+            }
+            showPopup.hideLoading();
+        });
+    });
+
+    $scope.$on("$destroy", function () {
+        beforeEnter = null;
+    })
+})
+
+.controller('NoticePostedCtrl', function ($scope, $state, Member, Notice) {
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        if ($scope.createstate == undefined)
+            $scope.createstate = 0; //默认不显示'+'标记
+        Notice.getCreateUsrsState().then(function (data) {
+            $scope.createstate = data.state;
+        });
+        Notice.getRelease().then(function (data) {
+            $scope.Notice = _.sortBy(data.results, 'create_dd').reverse();
+        });
+        Notice.getsavedata = Notice.getstructdata();
+        Member.selectedemplst = [];
+    });
+
+    $scope.$on("$destroy", function () {
+        beforeEnter = null;
+    });
+
+    $scope.toadd = function () {
+        Member.resourcemember = [];
+        Member.selectedemplst = [];
+        Member.showall = true;
+        Member.showgroup = true;
+        Member.titlename = "选择通知的成员";
+        Member.routename = "postnotice";
+        Member.routeparams = {
+            "id": -1
+        };
+        $state.go('selectmember');
+    };
+
+    $scope.todetails = function (id) {
+        $state.go('notice-details', {
+            id: id
+        });
+    };
+})
+
+.controller('ResultDetailsCtrl', function ($scope, $state, Notice) {
+    $scope.type = $state.params['type'];
+    $scope.titleArr = ['未看', '已看', '未反馈', '已反馈', '放弃反馈', '未投票', '放弃投票', '已投票'];
+    $scope.countDetails = Notice.getCountDetails();
+});

+ 0 - 0
platforms/android/assets/www/apps/notice/js/directive.js


+ 256 - 0
platforms/android/assets/www/apps/notice/js/factory.js

@@ -0,0 +1,256 @@
+starter.factory('Notice', function ($http, $q, cfg, global, formatFilter, Tool) {
+    var NoticeDetailsData = null;
+    var curDate = new Date();
+    var tmday = new Date((curDate / 1000 + 86400) * 1000);
+    var savedata = {
+        "user_id": global.user.usrid,
+        "title": "",
+        "content": "",
+        "address": null,
+        "create_dd": null,
+        "readtimes": 0,
+        "commenttimes": 0,
+        "back_title": null,
+        "back_enddd": tmday,
+        "vote_title": null,
+        "vote_selecttype": 1,
+        "vote_selectdata": "",
+        "vote_enddd": tmday,
+        "allid": 0,
+        "groupid": null,
+        "readusrs": [],
+        "noticefiles": [],
+        "setbtnstyle": {
+            vote: false,
+            back: false
+        },
+        "selectitems": [],
+        "deleteimages": {
+            "oldimages": [],
+            "newimages": []
+        },
+        "disablededit": {
+            showadditem: true,
+            showeditback: true
+        }
+    };
+
+    var countDetails = {
+        usrCountList: [],
+        selectItem: null
+    };
+
+    function pick() {
+
+    }
+
+    function setdata(data) {
+        if (Tool.trim(data.vote_title).length == 0) {
+            data.vote_title = null;
+            data.vote_enddd = null;
+        }
+        if (Tool.trim(data.back_title).length == 0) {
+            data.back_title = null;
+            data.back_enddd = null;
+        }
+    }
+
+    return {
+        getCreateUsrs: function () {
+            var url = formatFilter('{0}notice/createusrs/', cfg.api);
+            return Tool.get(url);
+        },
+        post_NoticeCreateUsrs: function (add_usrs) {
+            var url = formatFilter('{0}notice/createusrs/', cfg.api);
+            return Tool.post(url, add_usrs);
+        },
+        delete_NoticeCreateUsrs: function (delete_usrs) {
+            var data = [{
+                "op": "del",
+                "values": delete_usrs
+            }];
+            var url = formatFilter('{0}notice/createusrs/', cfg.api);
+            return Tool.patch(url, data);
+        },
+        post_NoticeMf: function (data) {
+            console.log(Tool.cloneObj(data));
+            console.log(data);
+            data = _.pick(data,
+                    "user_id",
+                    "title",
+                    "content",
+                    "address",
+                    "create_dd",
+                    "commenttimes",
+                    "back_title",
+                    "back_enddd",
+                    "vote_title",
+                    "vote_selecttype",
+                    "vote_selectdata",
+                    "vote_enddd",
+                    "allid",
+                    "groupid",
+                    "update_dd",
+                    "readusrs");
+            var url = formatFilter('{0}notice/', cfg.api);
+            setdata(data);
+            return Tool.post(url, data);
+        },
+        post_NoticeReadList: function (data) {
+            var url = formatFilter('{0}notice/readlist/', cfg.api);
+            return Tool.post(url, data);
+        },
+        getReceive: function () {
+            var url = formatFilter('{0}notice/list/?type=receive', cfg.api);
+            return Tool.get(url);
+        },
+        getRelease: function () {
+            var url = formatFilter('{0}notice/list/', cfg.api);
+            return Tool.get(url);
+        },
+        getNext: function(url) {
+            return Tool.get(url);
+        },
+        getDetails: function (id) {
+            var url = formatFilter('{0}notice/{1}/', cfg.api, id);
+            var deferred = $q.defer();
+            $http.get(url).then(function (res) {
+                        deferred.resolve(res.data);
+                        NoticeDetailsData = Tool.cloneObj(res.data);
+                        NoticeDetailsData.setbtnstyle = {
+                            vote: false,
+                            back: false
+                        };
+                        NoticeDetailsData.selectitems = [];
+                        if (NoticeDetailsData.vote_title !== null) {
+                            NoticeDetailsData.setbtnstyle.vote = true;
+                            var selectitems = NoticeDetailsData.vote_selectdata.split(';');
+                            _.each(selectitems, function (item) {
+                                NoticeDetailsData.selectitems.push({
+                                    "text": item
+                                });
+                            });
+                        }
+                        if (NoticeDetailsData.back_title != null) {
+                            NoticeDetailsData.setbtnstyle.back = true;
+                        }
+
+                        NoticeDetailsData.showvoteDelete = false;
+                        NoticeDetailsData.showbackDelete = false;
+                        if (NoticeDetailsData.vote_title != null) {
+                            NoticeDetailsData.showvoteDelete = true;
+                        } else {
+                            NoticeDetailsData.vote_enddd = tmday;
+                        }
+                        if (NoticeDetailsData.back_title != null) {
+                            NoticeDetailsData.showbackDelete = true;
+                        } else {
+                            NoticeDetailsData.back_enddd = tmday;
+                        }
+                        NoticeDetailsData.deleteimages = {
+                            "oldimages": [],
+                            "newimages": []
+                        };
+                        NoticeDetailsData.disablededit = {
+                            showadditem: true,
+                            showeditback: true
+                        };
+                        console.log(NoticeDetailsData)
+                    },
+                    function (err) {
+                        deferred.reject(err);
+                    });
+            return deferred.promise;
+        },
+        getLoalDetails: function (op) {
+            return NoticeDetailsData;
+        },
+        getsavedata: savedata,
+        getstructdata: function () {
+            var structdata = {
+                "user_id": global.user.usrid,
+                "title": "",
+                "content": "",
+                "address": null,
+                "create_dd": null,
+                "readtimes": 0,
+                "commenttimes": 0,
+                "back_title": null,
+                "back_enddd": tmday,
+                "vote_title": null,
+                "vote_selecttype": 1,
+                "vote_selectdata": "",
+                "vote_enddd": tmday,
+                "allid": 0,
+                "groupid": null,
+                "readusrs": [],
+                "noticefiles": [],
+                "setbtnstyle": {
+                    vote: false,
+                    back: false
+                },
+                "selectitems": [],
+                "deleteimages": {
+                    "oldimages": [],
+                    "newimages": []
+                },
+                "disablededit": {
+                    showadditem: true,
+                    showeditback: true
+                }
+            };
+            return Tool.cloneObj(structdata);
+        },
+        put_NoticeMf: function (data) {
+            data = _.pick(data, "id",
+                    "title",
+                    "content",
+                    "address",
+                    "back_enddd",
+                    "back_title",
+                    "vote_title",
+                    "vote_selecttype",
+                    "vote_selectdata",
+                    "vote_enddd",
+                    "allid",
+                    "groupid",
+                    "update_dd",
+                    "readusrs",
+                    "del_files");
+            var url = formatFilter('{0}notice/{1}/', cfg.api, data.id);
+            setdata(data);
+            return Tool.put(url, data);
+        },
+        delete_NoticeMf: function (id) {
+            var url = formatFilter('{0}notice/{1}/', cfg.api, id);
+            return Tool.delete(url);
+        },
+        getUsrCount: function (id, type, index) {
+            var url = formatFilter('{0}notice/stat/detail/?notice_id={1}&type={2}', cfg.api, id, type);
+            if (type == 7 && index != undefined) {
+                url = formatFilter('{0}notice/stat/detail/?notice_id={1}&type={2}&index={3}', cfg.api, id, type, index);
+            }
+            return Tool.get(url, true, 'noticecount');
+        },
+        getCountDetails: function () {
+            countDetails.usrCountList = Tool.getTempData('noticecount');
+            return countDetails;
+        },
+        getCount: function (id) {
+            var url = formatFilter('{0}notice/stat/?notice_id={1}', cfg.api, id);
+            return Tool.get(url);
+        },
+        getRecord: function (id) {
+            var url = formatFilter('{0}notice/record/?noticeid={1}', cfg.api, id);
+            return Tool.get(url);
+        },
+        postRecord: function (data) {
+            var url = formatFilter('{0}notice/record/', cfg.api);
+            return Tool.post(url, data);
+        },
+        getCreateUsrsState: function () {
+            var url = formatFilter('{0}notice/createusrs/?type={1}', cfg.api, 'state');
+            return Tool.get(url);
+        }
+    }
+});

+ 45 - 0
platforms/android/assets/www/apps/notice/js/route.js

@@ -0,0 +1,45 @@
+starter.config(function ($stateProvider) {
+    $stateProvider
+
+    .state('notice', {
+        url: '/index',
+        templateUrl: 'templates/notice.html',
+        controller: 'NoticeCtrl'
+    })
+
+    .state('notice-details', {
+        url: '/notice-details/:id',
+        templateUrl: 'templates/notice-details.html',
+        controller: 'NoticeDetailsCtrl'
+    })
+
+    .state('power-set', {
+        url: '/power-set',
+        templateUrl: 'templates/power-set.html',
+        controller: 'PowerSetCtrl'
+    })
+
+    .state('postnotice', {
+        url: '/postnotice/:id',
+        templateUrl: 'templates/postnotice.html',
+        controller: 'PostNoticeCtrl'
+    })
+
+    .state('notice-result', {
+        url: '/notice-result/:id&:type',
+        templateUrl: 'templates/notice-result.html',
+        controller: 'NoticeResultCtrl'
+    })
+
+    .state('notice-posted', {
+        url: '/notice-posted',
+        templateUrl: 'templates/notice-posted.html',
+        controller: 'NoticePostedCtrl'
+    })
+
+    .state('result-details', {
+        url: '/result-details/:type',
+        templateUrl: 'templates/result-details.html',
+        controller: 'ResultDetailsCtrl'
+    })
+});

+ 28 - 0
platforms/android/assets/www/apps/notice/templates/modal-back.html

@@ -0,0 +1,28 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="cancel('back');">取消</button>
+        <h1 class="title">反馈</h1>
+        <button class="button button-clear button-calm" ng-click="ok('back');">完成</button>
+    </ion-header-bar>
+    <ion-content>
+        <div class=" item item-divider"></div>
+        <div class="list notice-input">
+            <label class="item item-input">
+                <span class="input-label">问题:</span>
+                <input type="text" class="notice-title" placeholder="输入问题" ng-model="noticedata.back_title" ng-if="noticedata.disablededit.showeditback" focus-me="true">
+                <label for="" ng-if="!noticedata.disablededit.showeditback">{{noticedata.back_title}}</label>
+            </label>
+            <div class="item item-divider dividertext">
+                <label>提出问题,让被通知的员工逐一回答</label>
+            </div>
+            <ion-item class="item item-icon-right" type="item-text-wrap" ng-disabled="noticedata.disablededit.showeditback" ng-click="checkend_dd('back');">
+                截止日期
+                <label class="label-right-text item-note">{{noticedata.back_enddd | date:"y年MM月dd日"}}</label>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </div>
+    </ion-content>
+    <div class="bar bar-footer bar-balanced footer" ng-click='delete("back");' ng-show="noticedata.showbackDelete">
+        <div class="title">删除</div>
+    </div>
+</ion-modal-view>

+ 11 - 0
platforms/android/assets/www/apps/notice/templates/modal-selectgroup.html

@@ -0,0 +1,11 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="back()">
+            <i class="icon ion-ios-arrow-left"></i>
+        </button>
+        <h1 class="title">选择通知的小组</h1>
+    </ion-header-bar>
+    <ion-content>
+        <div class="item item-divider divider-font"><i class="icon ion-ios-star"></i>我加入的小组({{0}})</div>
+    </ion-content>
+</ion-modal-view>

+ 44 - 0
platforms/android/assets/www/apps/notice/templates/modal-vote.html

@@ -0,0 +1,44 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="cancel('vote');">取消</button>
+        <h1 class="title">投票</h1>
+        <button class="button button-clear button-calm" ng-click="ok('vote');">完成</button>
+    </ion-header-bar>
+    <ion-content>
+        <div class=" item item-divider"></div>
+        <div class="list notice-input">
+            <label class="item item-input">
+                <span class="input-label">标题:</span>
+                <input type="text" class="notice-title" placeholder="输入投票标题" ng-model="noticedata.vote_title" ng-if="noticedata.disablededit.showadditem" focus-me="true">
+                <label ng-if="!noticedata.disablededit.showadditem">{{noticedata.vote_title}}</label>
+            </label>
+            <label class="item item-input item-select">
+                <div class="input-label">
+                    类型
+                </div>
+                <select ng-model="noticedata.vote_selecttype" ng-options="x.id as x.name for x in selectdatas" ng-disabled="!noticedata.disablededit.showadditem"></select>
+            </label>
+            <ion-item class="item item-icon-right" type="item-text-wrap" ng-disabled="!noticedata.disablededit.showadditem" ng-click="checkend_dd('vote');">
+                截止日期
+                <label class="label-right-text item-note">{{noticedata.vote_enddd | date:"y年MM月dd日"}}</label>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <div class=" item item-divider"></div>
+            <ion-item class="item item-text-wrap item-icon-left" ng-repeat="_item in noticedata.selectitems track by $index" ng-if="noticedata.disablededit.showadditem">
+                <i class="icon ion-android-remove-circle" style="color:red;" ng-click="removeItem($index);"></i>
+                <input type="text" placeholder="请输入选项标题" ng-model="_item.text" focus-me="true"/>
+            </ion-item>
+            <ion-item class="item item-icon-left" ng-click="addItem();" ng-if="noticedata.disablededit.showadditem">
+                <i class="icon ion-plus-circled balanced"></i> 选项
+            </ion-item>
+            <div ng-show="!noticedata.disablededit.showadditem">
+                <ion-item class="item item-text-wrap" ng-click="" ng-repeat="_item in editvotedata track by $index">
+                    {{_item.text}}
+                </ion-item>
+            </div>
+        </div>
+    </ion-content>
+    <div class="bar bar-footer bar-balanced footer" ng-click='delete("vote");' ng-show="noticedata.showvoteDelete">
+        <div class="title">删除</div>
+    </div>
+</ion-modal-view>

+ 211 - 0
platforms/android/assets/www/apps/notice/templates/notice-details.html

@@ -0,0 +1,211 @@
+<ion-view view-title="公告详情" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button ng-if="isAdmin" class="button button-icon ion-ios-more" ng-click="popover.show($event)"></button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div class="item border-style item-text-wrap" ng-if="!loading" style="margin:-1px 0;">
+            <h1>{{details.title}}</h1>
+            <p>{{details.user__username}}
+                <span ng-if="details.update_dd != details.create_dd">&nbsp;修改于</span> &nbsp;{{details.update_dd == null ? details.create_dd : details.update_dd | date:'MM月dd日 HH:mm'}}
+                <a class="float-right" ng-click="isScopeShow = !isScopeShow">{{isScopeShow ? '隐藏详情' : '显示详情'}}</a>
+            </p>
+            <p ng-show="isScopeShow">范围:
+                <span ng-if="details.allid == 1">全体成员</span>
+                <span ng-if="details.groupid != null"></span>
+                <span ng-if="details.readusrs.length != 0">
+                    <span ng-repeat="item in details.readusrs">{{item.user__username}}{{$last ? '' : '、'}}</span>
+                </span>
+            </p>
+            <br/>
+            <span ng-bind-html="details.content | SwitchHtmlContent"></span>
+            <br/>
+            <image-popover all-images="details.noticefiles"></image-popover>
+            <br/>
+            <!--投票-->
+            <div ng-if="details.vote_title != null">
+                <p>需要投票来完成</p>
+                <div class="item item-body">
+                    <span>{{details.vote_title}}{{details.vote_selecttype == 1 ? '(单选)' : '(多选)'}}</span>
+                    <!--未过期单选-->
+                    <ion-list ng-if="details.vote_selecttype == 0 && details.vote_enddd >= datetime">
+                        <br/>
+                        <!--未选-->
+                        <ion-checkbox ng-if="record.vote_selectindex == null && record.vote_giveup == null" ng-repeat="selectitem in selectData track by $index" class="notice-details-voteitem" ng-click="changeIndex($index)" ng-model="selectIndexArr" ng-value="selectitem">
+                            {{selectitem}}
+                        </ion-checkbox>
+                        <!--已选-->
+                        <div ng-if="record.vote_selectindex != null || record.vote_giveup != null" ng-click="result()" class="item item-icon-left item-icon-right notice-details-voteitem">
+                            <i ng-if="record.vote_selectindex != null || record.vote_giveup == 1" class="icon ion-checkmark-circled energized"></i>
+                            <span ng-if="record.vote_selectindex != null">投票成功</span>
+                            <span ng-if="record.vote_giveup == 1">放弃投票</span>
+                            <div ng-repeat="item in usr_select_index">
+                                <p>{{selectData[item]}}</p>
+                            </div>
+                            <i class="icon ion-chevron-right icon-accessory"></i>
+                        </div>
+                        <br/>
+                    </ion-list>
+                    <!--未过期多选-->
+                    <ion-list ng-if="details.vote_selecttype == 1 && details.vote_enddd >= datetime">
+                        <br/>
+                        <!--未选-->
+                        <ion-radio ng-if="record.vote_selectindex == null && record.vote_giveup == null" ng-repeat="selectitem in selectData track by $index" class="notice-details-voteitem" ng-click="changeIndex($index)" ng-model="selectIndex" ng-value="selectitem">
+                            {{selectitem}}
+                        </ion-radio>
+                        <!--已选-->
+                        <div ng-if="record.vote_selectindex != null || record.vote_giveup != null" ng-click="result()" class="item item-icon-left item-icon-right notice-details-voteitem">
+                            <i ng-if="record.vote_selectindex != null || record.vote_giveup == 1" class="icon ion-checkmark-circled energized"></i>
+                            <span ng-if="record.vote_selectindex != null">投票成功</span>
+                            <span ng-if="record.vote_giveup == 1">放弃投票</span>
+                            <div ng-repeat="item in usr_select_index">
+                                <p>{{selectData[item]}}</p>
+                            </div>
+                            <i class="icon ion-chevron-right icon-accessory"></i>
+                        </div>
+                        <br/>
+                    </ion-list>
+                    <!--已过期-->
+                    <ion-list ng-if="details.vote_enddd < datetime">
+                        <br/>
+                        <div class="item item-icon-left item-icon-right notice-details-voteitem" ng-click="result()">
+                            <!--未选-->
+                            <i ng-if="record.vote_selectindex == null && record.vote_giveup == null" class="icon ion-close-circled assertive"></i>
+                            <span ng-if="record.vote_selectindex == null && record.vote_giveup == null">已过期</span>
+                            <!--已选-->
+                            <i ng-if="record.vote_selectindex != null || record.vote_giveup == 1" class="icon ion-checkmark-circled energized"></i>
+                            <span ng-if="record.vote_selectindex != null">投票成功</span>
+                            <span ng-if="record.vote_giveup == 1">放弃投票</span>
+                            <div ng-repeat="item in usr_select_index">
+                                <p>{{selectData[item]}}</p>
+                            </div>
+                            <i class="icon ion-chevron-right icon-accessory"></i>
+                        </div>
+                        <br/>
+                    </ion-list>
+                    <button ng-show="record.vote_selectindex == null && record.vote_giveup == null && details.vote_enddd >= datetime" class="button button-outline button-energized notice-details-button" ng-click="postVote()">确定投票</button>
+                    <button ng-show="record.vote_selectindex == null && record.vote_giveup == null && details.vote_enddd >= datetime" class="button button-clear button-light float-right notice-details-giveupbutton" ng-click="giveUp(0)">放弃投票?</button>
+                </div>
+            </div>
+            <br/>
+            <!--反馈-->
+            <div ng-if="details.back_title != null">
+                <p>需要反馈来完成</p>
+                <div class="item item-body">
+                    <span>{{details.back_title}}</span>
+                    <ion-list>
+                        <!--未过期未填-->
+                        <hr ng-if="details.back_enddd >= datetime && record.back_content == null && record.back_giveup == null" class="notice-details-hr"/>
+                        <!--未过期已填-->
+                        <br ng-if="details.back_enddd >= datetime && (record.back_content != null || record.back_giveup == 1)"/>
+                        <div ng-if="details.back_enddd >= datetime && (record.back_content != null || record.back_giveup == 1)" class="item item-icon-left notice-details-voteitem">
+                            <i ng-if="record.back_content != null || record.back_giveup == 1" class="icon ion-checkmark-circled energized"></i>
+                            <span ng-if="record.back_content != null">反馈成功</span>
+                            <span ng-if="record.back_giveup == 1">放弃反馈</span>
+                            <p ng-if="record.back_content != null">反馈内容:&nbsp;{{record.back_content}}</p>
+                        </div>
+                        <br ng-if="details.back_enddd >= datetime && (record.back_content != null || record.back_giveup == 1)"/>
+                        <!--已过期-->
+                        <br ng-if="details.back_enddd < datetime"/>
+                        <div ng-if="details.back_enddd < datetime" class="item item-icon-left notice-details-voteitem">
+                            <!--未填-->
+                            <i ng-if="record.back_content == null && record.back_giveup == null" class="icon ion-close-circled assertive"></i>
+                            <span ng-if="record.back_content == null && record.back_giveup == null">已过期</span>
+                            <!--已填-->
+                            <i ng-if="record.back_content != null || record.back_giveup == 1" class="icon ion-checkmark-circled energized"></i>
+                            <span ng-if="record.back_content != null">反馈成功</span>
+                            <span ng-if="record.back_giveup == 1">放弃反馈</span>
+                            <p ng-if="record.back_content != null">反馈内容:&nbsp;{{record.back_content}}</p>
+                        </div>
+                        <br ng-if="details.back_enddd < datetime"/>
+                        <!--未过期未填-->
+                        <button ng-show="record.back_content == null && record.back_giveup == null && details.back_enddd >= datetime" class="button button-outline button-energized notice-details-button" ng-click="showbackpopup()">反馈</button>
+                        <button ng-show="record.back_content == null && record.back_giveup == null && details.back_enddd >= datetime" class="button button-clear button-light float-right notice-details-giveupbutton" ng-click="giveUp(1)">放弃反馈?</button>
+                    </ion-list>
+                </div>
+            </div>
+        </div>
+        <div class="task-button-div" id="nav-comment" ng-if="!loading">
+            <div class="comment-div" ng-click="change(0)" ng-class="{'colorgray':!(activeIndex == 0)}">评论&nbsp;{{commentData.length == 0 ? '0' : commentData.length}}
+                <label>|</label>
+                <hr ng-show="activeIndex==0">
+            </div>
+            <div class="comment-div" ng-click="change(1)" ng-class="{'colorgray':!(activeIndex == 1)}">看过&nbsp;{{readData.length == 0 ? '0' : readData.length}}
+                <label>|</label>
+                <hr ng-show="activeIndex==1">
+            </div>
+            <div ng-click="change(2)" ng-class="{'colorgray':!(activeIndex == 2)}">未看&nbsp;{{unreadData.length == 0 ? '0' : unreadData.length}}
+                <hr ng-show="activeIndex==2">
+            </div>
+        </div>
+        <ion-slide-box class="slide-task" show-pager="false" ng-init="lockSlide()" active-slide="activeIndex" ng-if="!loading">
+            <ion-slide>
+                <ion-list class="daily">
+                    <div class="item center notice-details-voteitem" ng-if="commentData.length == 0">还没有人进行评论哦</div>
+                    <a class="item item-avatar item-text-wrap" ng-repeat="comment in commentData" ng-click="popupMessageOpthins(comment.id,comment.user_id)">
+                        <img ng-src="../../../img/panda.png" ng-click="showcardinfo(comment.user_id)">
+                        <div>
+                            <span>{{comment.user__username}}</span>
+                            <p>{{comment.content}}</p>
+                            <p class="time">{{comment.create_dd | getDateDiff}}</p>
+                        </div>
+                    </a>
+                </ion-list>
+                <div class='obligate-item' ng-if="!loading"></div>
+            </ion-slide>
+            <ion-slide>
+                <ion-list>
+                    <div class="item item-avatar" ng-repeat="read in readData">
+                        <img ng-src="../../../img/panda.png" ng-click="showcardinfo({{read.user_id}})">
+                        <div>
+                            <span>{{read.user__username}}</span>
+                            <p>{{read.user__usr__degree}}</p>
+                        </div>
+                    </div>
+                </ion-list>
+                <div class='obligate-item' ng-if="!loading"></div>
+            </ion-slide>
+            <ion-slide>
+                <!--<button ng-if="unreadData.lenght != 0" class="button button-outline button-energized notice-details-warn">提醒未看成员</button>-->
+                <ion-list>
+                    <div class="item item-avatar" ng-repeat="unread in unreadData">
+                        <img ng-src="../../../img/panda.png" ng-click="showcardinfo({{unread.user_id}})">
+                        <div>
+                            <span>{{unread.user__username}}</span>
+                            <p>{{unread.user__usr__degree}}</p>
+                        </div>
+                    </div>
+                </ion-list>
+                <div class='obligate-item' ng-if="!loading"></div>
+            </ion-slide>
+        </ion-slide-box>
+    </ion-content>
+    <ion-footer-bar keyboard-attach class="bar-stable" ng-if="!loading">
+        <div class="bar bar-footer item-input-inset">
+            <!--<button ng-click="addhappy()" class="button button-clear">
+                <i class="icon ion-android-happy clear"></i>
+            </button>-->
+            <label class="item-input-wrapper radius-30">
+                <input type="text" ng-model="data.content" placeholder="添加评论">
+            </label>
+            <button class="button button-positive" ng-disabled="data.content == '' || data.content == null" ng-click="sendComment()">发送</button>
+        </div>
+    </ion-footer-bar>
+    <script id="templates/detiilsmenu.html" type="text/ng-template">
+        <ion-popover-view class="details-popup">
+            <ion-content>
+                <ion-list>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="result()">统计结果</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="edit()">编辑</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="deleteNotice()">删除</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 27 - 0
platforms/android/assets/www/apps/notice/templates/notice-posted.html

@@ -0,0 +1,27 @@
+<ion-view view-title="发布的公告">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="toadd()" ng-show="createstate==1">
+            <i class="icon ion-android-add"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-if="!loading">
+            <div class="list">
+                <div class="item item-avatar item-icon-right" ng-repeat="data in Notice" ng-click="todetails(data.id)">
+                    <img ng-src="../../../img/panda.png" ng-click="showcardinfo({{data.usrid.id}})">
+                    <span>{{data.title}}</span>
+                    <p>{{data.content}}</p>
+                    <p>{{data.update_dd == null ? data.create_dd : data.update_dd | date:'MM-dd'}}&nbsp;
+                        <span ng-hide="(data.readtimes == 0 || data.readtimes == null) || (data.commenttimes == 0 || data.commenttimes == null)">|</span>&nbsp;
+                        <span ng-hide="data.readtimes == 0 || data.readtimes == null">{{data.readtimes}}看</span>&nbsp;
+                        <span ng-hide="data.commenttimes == 0 || data.commenttimes == null">{{data.commenttimes}}评</span>
+                    </p>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </div>
+            </div>
+        </div>
+    </ion-content>
+</ion-view>

+ 69 - 0
platforms/android/assets/www/apps/notice/templates/notice-result.html

@@ -0,0 +1,69 @@
+<ion-view view-title="统计结果">
+    <ion-content>
+        <!--反馈-->
+        <div ng-if="details.back_title != null && type == 0">
+            <div class="item item-divider">
+                <span class="notice-result-title">反馈统计</span>
+            </div>
+            <div class="item item-text-wrap">
+                <span>{{details.back_title}}</span>
+            </div>
+            <div class="item item-icon-right" ng-click="toResultDetails(3)">
+                <span>已反馈</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+                <span class="item-note">{{countData.backed}}人({{ countData.backed / (countData.backed + countData.unback + countData.backgiveup) | percentage }})</span>
+            </div>
+            <div class="item item-icon-right" ng-click="countData.unback != 0 ? toResultDetails(2) : null">
+                <span>未反馈</span>
+                <i class="icon ion-chevron-right icon-accessory" ng-if="countData.unback != 0"></i>
+                <span class="item-note">{{countData.unback}}人({{ countData.unback / (countData.backed + countData.unback + countData.backgiveup) | percentage }})</span>
+            </div>
+            <div class="item item-icon-right" ng-if="countData.backgiveup != 0" ng-click="toResultDetails(4)">
+                <span>放弃反馈</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+                <span class="item-note">{{countData.backgiveup}}人({{ countData.backgiveup / (countData.backed + countData.unback + countData.backgiveup) | percentage }})</span>
+            </div>
+        </div>
+        <!--投票-->
+        <div ng-if="details.vote_title != null">
+            <div class="item item-divider">
+                <span class="notice-result-title">投票统计{{details.vote_selecttype == 1 ? '(单选)' : '(多选)'}}</span>
+            </div>
+            <div class="item item-text-wrap">
+                <span>投票标题</span>
+                <span class="item-note">{{details.vote_title}}</span>
+            </div>
+            <div class="item item-icon-right" ng-repeat="item in selectData track by $index" ng-click="type == 0 ? toResultDetails(7,[$index]) : null">
+                <span>{{item}}</span>
+                <i class="icon ion-chevron-right icon-accessory" ng-if="type == 0"></i>
+                <span class="item-note">{{countData.votecount[$index]}}人({{ countData.votecount[$index] / usrvotecount | percentage }})</span>
+            </div>
+            <div class="item item-icon-right" ng-click="countData.unvote != 0 && type == 0 ? toResultDetails(5) : null">
+                <span>未投票</span>
+                <i class="icon ion-chevron-right icon-accessory" ng-if="countData.unvote != 0 && type == 0"></i>
+                <span class="item-note">{{countData.unvote}}人({{ countData.unvote / usrvotecount | percentage }})</span>
+            </div>
+            <div class="item item-icon-right" ng-if="countData.votegiveup != 0" ng-click="type == 0 ? toResultDetails(6) : null">
+                <span>放弃投票</span>
+                <i class="icon ion-chevron-right icon-accessory" ng-if="type == 0"></i>
+                <span class="item-note">{{countData.votegiveup}}人({{ countData.votegiveup / usrvotecount | percentage }})</span>
+            </div>
+        </div>
+        <!--阅读-->
+        <div ng-if="type == 0">
+            <div class="item item-divider">
+                <span class="notice-result-title">阅读统计</span>
+            </div>
+            <div class="item item-icon-right" ng-click="toResultDetails(1)">
+                <span>已看</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+                <span class="item-note">{{countData.readed}}人({{ countData.readed / (countData.readed + countData.unread) | percentage }})</span>
+            </div>
+            <div class="item item-icon-right" ng-click="toResultDetails(0)">
+                <span>未看</span>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+                <span class="item-note">{{countData.unread}}人({{ countData.unread / (countData.readed + countData.unread) | percentage }})</span>
+            </div>
+        </div>
+    </ion-content>
+</ion-view>

+ 38 - 0
platforms/android/assets/www/apps/notice/templates/notice.html

@@ -0,0 +1,38 @@
+<ion-view view-title="公告">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="toper()" ng-if="roleid==1">权限&nbsp;&nbsp;</button>
+        <button class="button button-clear" ng-click="toadd()" ng-show="createstate==1">
+            <i class="icon ion-android-add"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <a class="item item-icon-right" href="#/notice-posted">发布的公告
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <div class="item item-divider">收到的公告</div>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-if="!loading">
+            <div class="list">
+                <div class="item item-avatar item-icon-right" ng-repeat="data in Notice.results" ng-click="todetails(data.id)">
+                    <img ng-src="../../../img/panda.png" ng-click="showcardinfo(data.usrid.id)">
+                    <span>{{data.title}}</span>
+                    <p>{{data.content}}</p>
+                    <p>{{data.update_dd == null ? data.create_dd : data.update_dd | date:'MM-dd'}}&nbsp;
+                        <span ng-hide="(data.readtimes == 0 || data.readtimes == null) || (data.commenttimes == 0 || data.commenttimes == null)">|</span>&nbsp;
+                        <span ng-hide="data.readtimes == 0 || data.readtimes == null">{{data.readtimes}}看</span>&nbsp;
+                        <span ng-hide="data.commenttimes == 0 || data.commenttimes == null">{{data.commenttimes}}评</span>
+                    </p>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </div>
+            </div>
+        </div>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+        <h4 class="stable center" ng-show="Notice&& Notice.next == null&&Notice.results.length>=10">没有更多了</h4>
+    </ion-content>
+</ion-view>

+ 53 - 0
platforms/android/assets/www/apps/notice/templates/postnotice.html

@@ -0,0 +1,53 @@
+<ion-view hide-back-button="true">
+    <ion-nav-title>{{isNew?'发布通知':'编辑通知'}}</ion-nav-title>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click='ok("notice");'>完成</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click='cancel("notice");'>取消</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="list notice-input">
+            <label class="item item-input" ng-click="toselect();">
+                <span class="input-label">发送:</span>
+                <span for="" class='notice-resvicename item-text-wrap'>{{usernames}}</span>
+            </label>
+            <div class="row input-btn-row">
+                <div class="col col-67">
+                    <label class="item item-input" ng-click="test($event)">
+                        <span class="input-label">标题:</span>
+                        <input type="text" placeholder="输入标题" ng-model="noticedata.title" focus-me=true>
+                    </label>
+                </div>
+                <div class="col col-35">
+                    <button class="button button-energized" ng-class="{true:'',false:'button-outline'}[noticedata.setbtnstyle.vote]" ng-click="set_voteback('vote',$event)">
+                        投票
+                    </button>
+                </div>
+                <div class="col col-35">
+                    <button class="button button-energized" ng-class="{true:'',false:'button-outline'}[noticedata.setbtnstyle.back]" ng-click="set_voteback('back',$event)">
+                        反馈
+                    </button>
+                </div>
+            </div>
+            <div class="comment-box notice-content">
+                <div ng-if="noticedata.address!=null" class="div-address"><i class="ion-ios-location"></i>{{noticedata.address}}</div>
+                <textarea placeholder="输入内容..." ng-model="noticedata.content"></textarea>
+                <div class="row row-wrap">
+                    <div  ng-repeat="image in noticedata.noticefiles">
+                        <img ng-src={{image.file_thumbnail_path}} ng-click="shouBigImage(image.file_full_path)" class="img-popver-pad"/>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </ion-content>
+    <div class="bar bar-footer postnotice-footer">
+        <div class="notice-first-ion" ng-click="Camera();"><i class="ion-android-camera" style=""></i></div>
+        <div class="notice-right-ion" ng-click="imagePicker();"><i class="ion-android-image"></i></div>
+        <div class="notice-right-ion" ng-click="getaddress();"><i class="ion-ios-location"></i></div>
+    </div>
+    <div ng-show="commons.bigImage" class="popover-backdrop1">
+        <img class="fullscreen-image" ng-click="hideBigImage()" ng-src="{{Url}}" ng-pinch-zoom/>
+        <i class="ion-ios-trash-outline" ng-click="deleteimage();"></i>
+    </div>
+</ion-view>

+ 48 - 0
platforms/android/assets/www/apps/notice/templates/power-set.html

@@ -0,0 +1,48 @@
+<ion-view view-title="权限设置">
+    <ion-nav-buttons style="border:none" side="right">
+        <button class="button button-icon ion-ios-more" ng-if="isshowdelete.showDelete!=true && !loading" ng-click="popover.show($event)"></button>
+        <button class="button button-clear" ng-if="isshowdelete.showDelete && !loading" ng-click="ok();">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider dividercolor">允许发通知的成员</div>
+        <div ng-show="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-if="!loading">
+            <ion-item class="rj-contacts-item">
+                <div ng-repeat="result in resultdata  track by $index">
+                    <div class="rj-contacts-index-bar item-remove-animate" id="index_{{result.sortchar}}">{{result.sortchar}}</div>
+                    <ion-list class="rj-list item-icon-right">
+                        <ion-item class="rj-item item-remove-animate" ng-repeat="person in result.persons track by $index">
+                            <div class="rj-contacts-pic">
+                                <img src="../../../img/panda.png">
+                            </div>
+                            <i ng-if="isshowdelete.showDelete" ng-click="removeItem(person.nid,result.sortchar);" class="icon ion-android-remove-circle" style="color:red;"></i>
+                            <h2>{{person.username}}</h2>
+                        </ion-item>
+                    </ion-list>
+                </div>
+            </ion-item>
+            <ion-item class="item-border">
+            </ion-item>
+        </ion-list>
+    </ion-content>
+    <div class="rj-contacts-right-bar" rj-position-middle on-drag="contacts_right_bar_swipe($event)">
+        <div>&uarr;</div>
+        <div>☆</div>
+        <div ng-repeat="char in sortchars" ng-click="sortByChar(char,'index_{{char}}')">{{char}}</div>
+    </div>
+    <div class="rj-contacts-middle-bar" ng-show="Isshowmiddle">
+        {{sortchar}}
+    </div>
+    <script id="templates/add.html" type="text/ng-template">
+        <ion-popover-view class="popver_view">
+            <ion-content>
+                <ion-list>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="toadd();">添加成员</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="displayremove();">移除成员</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 18 - 0
platforms/android/assets/www/apps/notice/templates/result-details.html

@@ -0,0 +1,18 @@
+<ion-view view-title="{{titleArr[type]}}{{countDetails.usrCountList.length}}人">
+    <!--<ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="towarn()">提醒</button>
+    </ion-nav-buttons>-->
+    <ion-content>
+        <div class="item item-energized item-text-wrap" ng-if="type == 7">
+            <span>{{countDetails.selectItem}}</span>
+        </div>
+        <ion-list>
+            <div class="item item-avatar" ng-repeat="item in countDetails.usrCountList">
+                <img src="../../../img/cat.png" ng-click="showcardinfo({{item.user_id}})"/>
+                <span>{{item.username}}</span>
+                <p>{{item.degree}}</p>
+                <p>{{item.content}}</p>
+            </div>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 54 - 0
platforms/android/assets/www/apps/pay/index.html

@@ -0,0 +1,54 @@
+<!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="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">
+    <link href="/css/timeline.css" rel="stylesheet">
+
+
+    <script src="/lib/chineseTopinyin.js"></script>
+
+    <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.min.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">
+        返回
+    </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>
+

+ 1573 - 0
platforms/android/assets/www/apps/pay/js/controllers.js

@@ -0,0 +1,1573 @@
+starter.controller('PayCtrl', function ($rootScope, $scope, $state, $ionicPopover, global, Member, Pay, Tool) {
+    beforeEnter = $scope.$on("$ionicView.beforeEnter", function (event, data) {
+        global.fetch_user().then(function () {
+            if ($scope.recordlist == undefined) getpaydata();
+            set_step_data();
+        });
+    });
+
+    Member.selectedemplst = [];
+
+    $scope.goBack = function () {
+        global.goBack();
+    };
+
+    $scope.toman = function () {
+        $state.go('payman');
+    };
+
+    $scope.torecord = function (record) {
+        if (record) {
+            Pay.recordItem = _.clone(record);
+            $state.go('pay-record', {
+                id: record.id
+            });
+        } else {
+            $scope.popover.hide();
+            $state.go('pay-record', {
+                id: -1
+            });
+        }
+    };
+
+    $scope.addpaybill = function () {
+        $scope.popover.hide();
+        $state.go('pay-bill', {
+            type: 0,
+            id: -1
+        })
+    };
+
+    $scope.toauditstep = function () {
+        $scope.popover.hide();
+        Member.customerop = null;
+        if ($scope.is_have_step) {
+            $state.go('auditstep', {
+                "id": 0
+            });
+        } else {
+            Member.selectedemplst.push({
+                "user_id": global.user.usrid,
+                "username": global.user.usrname
+            });
+            Member.dialogresult = 1;
+            Member.customerop = 1;
+            $state.go('auditstep', {
+                "id": -1
+            });
+        }
+    };
+
+    $ionicPopover.fromTemplateUrl('templates/paymenu.html', {
+        scope: $scope
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpaydata();
+    };
+
+    $scope.loadMore = function () {
+        if ($scope.recordlist != undefined && $scope.recordlist.next != null) {
+            Tool.get($scope.recordlist.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.recordlist.results.push(item);
+                });
+                $scope.recordlist.next = data.next;
+                $scope.recordlist.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    };
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.recordlist != undefined && $scope.recordlist.next != null;
+    };
+
+    function getpaydata() {
+        if (global.user.token != "") {
+            if ($scope.recordlist == undefined) {
+                $scope.loading = true;
+            }
+            Pay.record.get(function (res) {
+                Pay.recordList = _.clone(res.results);
+                $scope.recordlist = res;
+                $scope.roleid = global.user.roleid;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    enter = $scope.$on("$ionicView.enter", function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            $rootScope.commons.refresh = false;
+            getpaydata();
+        }
+    });
+
+    $scope.is_have_step = false;
+
+    function set_step_data() {
+        Pay.auditstep.query({"userid": global.user.usrid}, function (data) {
+            Pay.personstepdata = data;
+            $scope.is_have_step = data.length > 0;
+        }, function (err) {
+            alert(JSON.stringify(err));
+        })
+    }
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+        Pay.auditstepdata = [];
+        $scope.popover.remove();
+    });
+})
+
+.controller('TypeSetCtrl', function ($rootScope, $scope, $state, $ionicHistory, global, showPopup, Pay, Tool) {
+    $scope.ordering = false;
+    global.fetch_user().then(function () {
+        gettypedata();
+    });
+
+    $scope.toaddtype = function () {
+        $state.go("addtype", {
+            "id": -1
+        });
+    };
+
+    $scope.toedittype = function (item) {
+        Pay.typeItem = _.clone(item);
+        $state.go("addtype", {
+            "id": item.id
+        });
+    };
+
+    $scope.reorderItem = function (item, fromIndex, toIndex) {
+        $scope.types.splice(fromIndex, 1);
+        $scope.types.splice(toIndex, 0, item);
+    };
+
+    $scope.ok = function () {
+        $scope.ordering = !$scope.ordering;
+        if (!$scope.ordering) {
+            var data = [];
+            for (var i = 0; i < $scope.types.length; i++) {
+                data.push({
+                    'id': $scope.types[i].id,
+                    'ordering': i
+                });
+            }
+            Pay.type.patch(data, function (data) {
+                $scope.doRefresh();
+            })
+        }
+    };
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        gettypedata();
+    }
+
+    function gettypedata() {
+        if (global.user.token != "") {
+            if ($scope.types == undefined) {
+                $scope.loading = true;
+            }
+            Pay.type.get(function (res) {
+                $scope.types = res;
+                Pay.typeList = res;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    enter = $scope.$on("$ionicView.enter", function (event, data) {
+        if (data.fromCache && $rootScope.commons.refresh) {
+            $rootScope.commons.refresh = false;
+            gettypedata();
+        }
+    });
+
+    $scope.$on("$destroy", function () {
+        enter = null;
+    });
+})
+
+.controller('AuditStepSetCtrl', function ($rootScope, $scope, $state, $ionicPopover, $timeout, $location, $ionicScrollDelegate, $ionicHistory, global, showPopup, Member, Pay) {
+    $ionicPopover.fromTemplateUrl('templates/add.html', {
+        scope: $scope
+    }).then(function (popover) {
+        $scope.popover = popover;
+    });
+    var beforeEnter = $scope.$on("$ionicView.beforeEnter", function () {
+        getPayStepMflist();
+    });
+
+    $scope.sortchars = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#'];
+    $scope.sortchar = 'A';
+    $scope.is_show_middle = false;
+    $scope.is_show_delete = false;
+
+    $scope.sortByChar = function (char, id) {
+        $scope.sortchar = char;
+        $scope.is_show_middle = true;
+        $location.hash(id);
+        $ionicScrollDelegate.anchorScroll();
+        $timeout(function () {
+            $scope.is_show_middle = false;
+        }, 200);
+    };
+
+    $scope.displayremove = function () {
+        $scope.is_show_delete = !$scope.is_show_delete;
+        $scope.popover.hide();
+    };
+
+    $scope.ok = function () {
+        $scope.popover.hide();
+        $scope.is_show_delete = false;
+        var data = {"U": [], "D": delete_data, "C": []};
+        if (delete_data.length > 0) {
+            Pay.auditstep.patch(data, function (data) {
+                console.log(data);
+            }, function (err) {
+                // alert('delete error');
+            }).$promise.finally(function (f) {
+                delete_data = [];
+            });
+            Pay.auditstepdata = _.filter(Pay.auditstepdata, function (item) {
+                return !_.contains(delete_data, item.id);
+            });
+        }
+    };
+
+    $scope.toadd = function () {
+        Member.resourcemember = [];
+        Member.selectedemplst = [];
+        Member.disabled = true;
+        Member.resourcemember = _.map(_.pluck(Pay.auditstepdata, 'create_user'), function (m) {
+            return {"user_id": m.id, "username": m.username};
+        });
+        Member.showall = false;
+        Member.showgroup = false;
+        Member.customerop = 1;
+        Member.titlename = "选择添加的成员";
+        Member.routename = "auditstep";
+        Member.routeparams = {
+            "id": -1
+        };
+
+        $scope.popover.hide();
+        $state.go('selectmember');
+    };
+
+    var delete_data = [];
+    $scope.removeItem = function (user, _char) {
+        var ids = _.pluck(_.filter(Pay.auditstepdata, function (item) {
+            return item.create_user.id == user.id;
+        }), 'id');
+        delete_data = delete_data.concat(ids);
+        for (var i = 0; i < $scope.resultdata.length; i++) {
+            if ($scope.resultdata[i].sortchar == _char) {
+                for (var j = 0; j < $scope.resultdata[i].persons.length; j++) {
+                    if ($scope.resultdata[i].persons[j].emp.id == user.id) {
+                        $scope.resultdata[i].persons.splice(j, 1);
+                        if ($scope.resultdata[i].persons.length == 0) {
+                            $scope.resultdata.splice(i, 1);
+                        }
+                        break;
+                    }
+                }
+                break;
+            }
+        }
+    };
+
+    $scope.toedit = function (usrid) {
+        Member.customerop = null;
+        $state.go('auditstep', {
+            "id": usrid
+        });
+    };
+
+    $scope.doRefresh = function () {
+        getPayStepMflist();
+    };
+
+    function getPayStepMflist() {
+        if ($scope.resultdata == undefined) {
+            showPopup.showLoading(1, '正在加载', false);
+        }
+        Pay.auditstep.query(function (data) {
+            Pay.auditstepdata = angular.copy(data);
+            $scope.resultdata = [];
+            var chars = _.map(data, function (item) {
+                return _.indexOf($scope.sortchars, getCamelChar(item.create_user.username)) >= 0 ? getCamelChar(item.create_user.username) : '#';
+            });
+            chars = _.sortBy(_.uniq(chars));
+            for (var i = 0; i < chars.length; i++) {
+                var d = {
+                    "sortchar": chars[i],
+                    "persons": []
+                };
+                var users = _.map(_.uniq(_.map(_.pluck(data, 'create_user'), JSON.stringify)), JSON.parse);
+                for (var j = 0; j < users.length; j++) {
+                    var char = _.indexOf($scope.sortchars, getCamelChar(users[j].username)) >= 0 ? getCamelChar(users[j].username) : '#';
+                    if (char == chars[i]) {
+                        var p = {"emp": users[j], "checknames": ""};
+                        var steps = _.sortBy(_.filter(data, function (v) {
+                            return v.create_user.id == users[j].id && !v.is_teller;
+                        }), 'ordering');
+                        var newsteps = steps.length > 3 ? steps.slice(0, 3) : steps;
+                        p.checknames = _.pluck(_.pluck(newsteps, 'verifier'), 'username').join('→');
+                        if (steps.length > 3) p.checknames += '...';
+                        d.persons.push(p)
+                    }
+                }
+                $scope.resultdata.push(d);
+            }
+            var index = _.pluck($scope.resultdata, 'sortchar').indexOf('#');
+            if (index >= 0) {
+                var item = $scope.resultdata[index];
+                $scope.resultdata.splice(index, 1);
+                $scope.resultdata.push(item);
+            }
+            showPopup.hideLoading();
+        }, function (err) {
+            showPopup.hideLoading();
+        }).$promise.finally(function (f) {
+            $scope.$broadcast('scroll.refreshComplete');
+        });
+    }
+
+    function getCamelChar(str) {
+        return pinyin.getCamelChars(str).toUpperCase().charAt(0)
+    }
+})
+
+.controller('AddTypeCtrl', function ($rootScope, $scope, $state, $ionicHistory, global, showPopup, Pay, Tool) {
+    var icon = {icon: null}, iconcolor = null, isModified = false;
+    $scope.typeid = $state.params['id'];
+    $scope.data = {
+        "name": "",
+        "icon": "",
+        "icon_color": "",
+        "ordering": 0
+    };
+    $scope.iconcolordata = [{
+        'background': "#FCB232",
+        'isacitve': false
+    }, {
+        'background': "#F89E79",
+        'isacitve': false
+    }, {
+        'background': "#FB7B7A",
+        'isacitve': false
+    }, {
+        'background': "#F393C3",
+        'isacitve': false
+    }, {
+        'background': "#DF9FF3",
+        'isacitve': false
+    }, {
+        'background': "#C08CCE",
+        'isacitve': false
+    }, {
+        'background': "#609BF5",
+        'isacitve': false
+    }, {
+        'background': "#4BB1FB",
+        'isacitve': false
+    }, {
+        'background': "#89cff0",
+        'isacitve': false
+    }, {
+        'background': "#68D3C9",
+        'isacitve': false
+    }, {
+        'background': "#87CC79",
+        'isacitve': false
+    }, {
+        'background': "#4AD592",
+        'isacitve': false
+    }, {
+        'background': "#C8BEBD",
+        'isacitve': false
+    }, {
+        'background': "#CBA7AB",
+        'isacitve': false
+    }, {
+        'background': "#868CA6",
+        'isacitve': false
+    }, {
+        'background': "#8299CF",
+        'isacitve': false
+    }, {
+        'background': "#A0C7E6",
+        'isacitve': false
+    }, {
+        'background': "#90B1B6",
+        'isacitve': false
+    }];
+
+    $scope.icondata = [{
+        'background': "#fff",
+        'icon': "ion-android-bus",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-cart",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-telephone",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-home",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-fork",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "icon-money",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-android-film",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-umbrella",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-game-controller-b",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-android-print",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-tshirt",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-medkit",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-outlet",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-android-bicycle",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-pulse-strong",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-trophy",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-android-favorite",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-ios-cloud-download",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-plane",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-android-bar",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-nuclear",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-film-marker",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-icecream",
+        'isacitve': false
+    }, {
+        'background': "#fff",
+        'icon': "ion-flag",
+        'isacitve': false
+    }];
+
+    global.fetch_user().then(function () {
+        if ($scope.typeid > 0) {
+            $scope.data = Tool.cloneObj(Pay.typeItem);
+            iconcolor = _.find($scope.iconcolordata, function (item) {
+                if (item.background == $scope.data.icon_color) {
+                    item.isacitve = true;
+                    return item;
+                }
+            });
+            iconcolor = iconcolor.background;
+            icon = _.find($scope.icondata, function (item) {
+                if (item.icon == $scope.data.icon) {
+                    item.isacitve = true;
+                    item.background = $scope.data.icon_color;
+                    return item;
+                }
+            });
+        } else {
+            $scope.data.ordering = Pay.typeList.length;
+            $scope.iconcolordata[0].isacitve = true;
+            $scope.icondata[0].background = '#FCB232';
+            $scope.icondata[0].isacitve = true;
+            iconcolor = $scope.iconcolordata[0].background;
+            icon.icon = $scope.icondata[0].icon;
+        }
+    });
+
+    if ($scope.typeid > 0) {
+        watch = $scope.$watch('data', function (n, o) {
+            if (n == o)
+                return;
+            isModified = true;
+        }, true);
+    }
+
+    $scope.selecticon = function (iconitem) {
+        _.find($scope.icondata, function (item) {
+            if (item.isacitve) {
+                item.isacitve = false;
+                item.background = '#fff';
+                return item;
+            }
+        });
+        iconitem.isacitve = true;
+        iconitem.background = iconcolor;
+        icon = iconitem;
+    };
+
+    $scope.selectcolor = function (coloritem) {
+        _.find($scope.iconcolordata, function (item) {
+            if (item.isacitve) {
+                item.isacitve = false;
+                return item;
+            }
+        });
+        coloritem.isacitve = true;
+        icon.background = coloritem.background;
+        iconcolor = coloritem.background;
+    };
+
+    $scope.ok = function () {
+        if ($scope.data.name == "") {
+            return showPopup.PopupWindow(0, '类型名称不能为空!');
+        }
+        $scope.data.icon = icon.icon;
+        $scope.data.icon_color = iconcolor;
+        var type = null;
+        if ($scope.typeid > 0) {
+            if (isModified) {
+                type = _.find(Pay.typeList, function (item) {
+                    if (item.id != $scope.typeid && item.name == $scope.data.name) {
+                        showPopup.PopupWindow(0, '类型名称不能重复!');
+                        return item;
+                    }
+                });
+                if (!type) {
+                    showPopup.showLoading(1, '正在上传');
+                    Pay.type.update($scope.data, function () {
+                        $rootScope.commons.refresh = true;
+                        showPopup.hideLoading();
+                        $scope.back();
+                    });
+                }
+            } else {
+                $scope.back();
+            }
+        } else {
+            type = _.find(Pay.typeList, function (item) {
+                if (item.name == $scope.data.name) {
+                    showPopup.PopupWindow(0, '类型名称不能重复!');
+                    return item;
+                }
+            });
+            if (!type) {
+                showPopup.showLoading(1, '正在上传');
+                Pay.type.save($scope.data, function () {
+                    $rootScope.commons.refresh = true;
+                    showPopup.hideLoading();
+                    $scope.back();
+                });
+            }
+        }
+    };
+
+    $scope.deltype = function () {
+        showPopup.confirm('确定删除该类型吗?', '确定', '取消').then(function (res) {
+            if (res) {
+                showPopup.showLoading(1, '正在删除');
+                Pay.type.delete({'id': $scope.typeid}, function () {
+                    $rootScope.commons.refresh = true;
+                    showPopup.hideLoading();
+                    $scope.back();
+                });
+            }
+        });
+    };
+
+    $scope.back = function () {
+        $ionicHistory.goBack();
+    };
+
+    $scope.$on('$destroy', function () {
+        if ($scope.typeid > 0) {
+            watch();
+        }
+    })
+})
+
+.controller('AuditStepCtrl', function ($rootScope, $scope, $state, $ionicHistory, $timeout, global, Member, showPopup, Pay, Tool) {
+    $scope.create_users = [];
+    $scope.step_users = [];
+    $scope.teller = null;
+    $scope.op_id = 0;
+    var beforeEnter = $scope.$on("$ionicView.enter", function () {
+        $scope.op_id = $state.params['id'];
+        if ($scope.op_id != 0) Tool.removeBackView(['selectmember', 'selectsinglemember', 'auditstep']);
+        var back = $ionicHistory.backView();
+        if ($scope.op_id > 0) {
+            $scope.titlename = "编辑审批步骤";
+            if (Member.customerop == null) {
+                $scope.create_users = [_.find(Pay.auditstepdata, function (item) {
+                    return item.create_user.id == $scope.op_id;
+                }).create_user];
+                setusers(Pay.auditstepdata, $scope.op_id);
+            } else seteditdata();
+        } else if ($scope.op_id < 0) {
+            $scope.titlename = "添加审批步骤";
+            setdata();
+            if (back.stateName == 'pay' && Member.customerop == null && Pay.personstepdata.length > 0) setusers(Pay.personstepdata, Pay.personstepdata[0].create_user.id);
+        } else if ($scope.op_id == 0) { //修改当前登录人的审批步骤
+            $scope.titlename = "编辑审批步骤";
+            if (Member.customerop == null) {
+                if (Pay.personstepdata.length == 0) {
+                    Pay.auditstep.query({"userid": global.user.usrid}, function (data) {
+                        $scope.step_data = angular.copy(data);
+                        $scope.create_users.push({"id": global.user.usrid, "username": global.user.usrname});
+                        setusers(data, global.user.usrid);
+                    });
+                } else {
+                    $scope.create_users = [{"id": global.user.usrid, "username": global.user.usrname}];
+                    setusers(Pay.personstepdata, Pay.personstepdata[0].create_user.id);
+                }
+            } else setdata();
+            $scope.showbar = true;
+        }
+        $scope.is_current_user = (global.user.usrid == formatusers($scope.create_users)[0].user_id && back.stateName == "pay");
+    });
+
+    $scope.$on("$destroy", function () {
+        Pay.personstepdata = [];
+        Member.selectedemplst = [];
+        Member.unenabledata = [];
+        beforeEnter = null;
+    });
+
+    $scope.add_teller = function () {
+        set_member_option(false, $scope.teller == null ? [] : [$scope.teller], 3, "选择出纳人员", "selectsinglemember");
+    };
+
+    $scope.add_step_user = function () {
+        set_member_option(true, $scope.step_users, 2, "选择审批人", "selectsinglemember");
+    };
+
+    $scope.add_create_user = function () {
+        set_member_option(false, $scope.create_users, 1, "选择添加的成员", "selectmember");
+        Member.unenabledata = formatusers(_.pluck(Pay.auditstepdata, "create_user"));
+    };
+
+    $scope.ok = function () {
+        if ($scope.step_users.length == 0) {
+            showPopup.PopupWindow(0, "请选择审批人!", false);
+            return;
+        }
+        if ($scope.teller == null) {
+            showPopup.PopupWindow(0, "请选择出纳人!", false);
+            return;
+        }
+        showPopup.showLoading(1, '正在提交', false);
+        if ($scope.op_id >= 0) {//edit
+            Pay.auditstep.patch({"C": [], "D": [], "U": get_upload_data()}, function (data) {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            }, function (err) {
+                showPopup.hideLoading();
+                // alert(JSON.stringify(err))
+                $ionicHistory.goBack();
+            })
+        } else if ($scope.op_id < 0) { //add
+            Pay.auditstep.save(get_upload_data(), function (data) {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            }, function (err) {
+                alert(JSON.stringify(err));
+            })
+        }
+    };
+
+    $scope.goback = function () {
+        $ionicHistory.goBack();
+    };
+
+    $scope.toSeeList = function () {
+        $state.go("seestepmflist");
+    };
+
+    function set_member_option(is_disabled, data, op, titlename, route) {
+        Member.selectedemplst = [];
+        Member.disabled = is_disabled;
+        Member.resourcemember = formatusers(data);
+        Member.customerop = op;
+        Member.titlename = titlename;
+        $state.go(route);
+    }
+
+    function seteditdata() {
+        $scope.titlename = "编辑审批步骤";
+        if (Member.customerop == null) $scope.create_users = Member.selectedemplst;
+        setdata();
+    }
+
+    function setdata() {
+        if (Member.customerop == 1) { //申请
+            if (Member.dialogresult == 1) $scope.create_users = Member.selectedemplst;
+        } else if (Member.customerop == 2) { //审核
+            if (Member.selectedemplst.length > 0) $scope.step_users.push(Member.selectedemplst[0])
+        } else if (Member.customerop == 3) {//出纳
+            if (Member.selectedemplst.length > 0) $scope.teller = Member.selectedemplst[0]
+        }
+    }
+
+    function get_upload_data() {
+        var data = [];
+        _.each($scope.create_users, function (c_user) {
+            data = data.concat(_.map($scope.step_users, function (s_user, index) {
+                return {"create_user": getuserid(c_user), "verifier": getuserid(s_user), "is_teller": false, "ordering": index + 1};
+            }));
+            data.push({"create_user": getuserid(c_user), "verifier": getuserid($scope.teller), "is_teller": true, "ordering": $scope.step_users.length + 1})
+        });
+        return data;
+    }
+
+    function getuserid(user) {
+        return _.has(user, 'id') ? user.id : user.user_id;
+    }
+
+    function setusers(data, userid) {
+        $scope.step_users = _.pluck(_.sortBy(_.filter(data, function (item) {
+            return item.create_user.id == userid && !item.is_teller;
+        }), "ordering"), 'verifier');
+        $scope.teller = _.find(data, function (item) {
+            return item.create_user.id == userid && item.is_teller;
+        }).verifier;
+    }
+
+    function formatusers(data) {
+        return _.map(data, function (item) {
+            return {"user_id": _.has(item, 'id') ? item.id : item.user_id, "username": item.username}
+        })
+    }
+})
+
+.controller('SeeStepMfListCtrl', function ($rootScope, $scope, $state, $ionicHistory, $cordovaDatePicker, $timeout, global, Pay, Member, showPopup) {
+    doRefresh();
+    $scope.usestep = function (step) {
+        Member.customerop = null;
+        Pay.personstepdata = _.filter($scope.step_data_copy, function (item) {
+            return item.create_user.id == step.create_user.id;
+        });
+        $ionicHistory.goBack();
+    };
+
+    $scope.doRefresh = function () {
+        doRefresh();
+    };
+
+    function doRefresh() {
+        if ($scope.step_datas == undefined) showPopup.showLoading(1, '正在加载', false);
+        Pay.auditstep.query(function (data) {
+            $scope.step_datas = [];
+            $scope.step_data_copy = angular.copy(data);
+            var users = _.map(_.uniq(_.map(_.pluck(data, 'create_user'), JSON.stringify)), JSON.parse);
+            _.each(users, function (user) {
+                if (user.id != global.user.usrid) {
+                    var step_users = _.pluck(_.sortBy(_.filter(data, function (item) {
+                        return item.create_user.id == user.id && !item.is_teller;
+                    }), 'ordering'), 'verifier');
+                    var step_usernames = _.pluck(step_users, 'username').join('→');
+                    var teller = _.find(data, function (item) {
+                        return item.create_user.id == user.id && item.is_teller;
+                    }).verifier;
+                    $scope.step_datas.push({"create_user": user, "step_users": step_users, "teller": teller, "step_usernames": step_usernames})
+                }
+            })
+        }, function (err) {
+            showPopup.hideLoading();
+            alert(JSON.stringify(err));
+        }).$promise.finally(function () {
+            $scope.$broadcast('scroll.refreshComplete');
+            showPopup.hideLoading();
+        });
+    }
+
+    $scope.goback = function () {
+        $ionicHistory.goBack();
+    };
+})
+
+.controller('PayRecordCtrl', function ($rootScope, $scope, $state, $cordovaDatePicker, $timeout, $ionicModal, $ionicHistory, $q, ImageManage, global, showPopup, Pay, Tool) {
+    showPopup.modalTemplate('templates/modal-paytype.html', 'slide-in-right', $scope).then(function (modal) {
+        $scope.select_pay_type = modal;
+    });
+    $scope.recordid = $state.params['id'];
+    $scope.titleArr = ['新建', '编辑'];
+    $scope.popup = {
+        isPopup: false
+    };
+    $scope.record = {
+        "amount": null,
+        "pay_type": null,
+        "type_modal": null,
+        "spend_date": null,
+        "description": null,
+        "files": []
+    };
+    var isModified = false;
+
+    Pay.type.get(function (res) {
+        $scope.types = res;
+        Pay.typeList = res;
+        _.each($scope.types, function (type) {
+            type.color = {
+                'color': type.icon_color
+            };
+            type.selected = false;
+        });
+    }, function (err) {
+        alert(JSON.stringify(err));
+    });
+
+    if ($scope.recordid > 0) {
+        $scope.record = Tool.cloneObj(Pay.recordItem);
+        $scope.record.amount = parseFloat($scope.record.amount);
+    }
+
+    $scope.ok = function () {
+        if ($scope.record.amount == null) {
+            showPopup.PopupWindow(0, "请填写金额", false);
+            return
+        } else if ($scope.record.type_modal == null) {
+            showPopup.PopupWindow(0, "请选择消费类型", false);
+            return
+        } else if ($scope.record.spend_date == null) {
+            showPopup.PopupWindow(0, "请选择消费日期", false);
+            return
+        }
+        showPopup.showLoading(1, '正在提交', true);
+        if ($scope.recordid > 0) {
+            if (isModified) {
+                Pay.record.update($scope.record, function () {
+                    $rootScope.commons.refresh = true;
+                    _.each($scope.deleteimage_list, function (imageID) {
+                        Pay.recordfile.delete({id: imageID});
+                    });
+                    var imagefiles = [];
+                    _.each($scope.record.files, function (image) {
+                        if (!image.id)
+                            imagefiles.push(image.file_full_path);
+                    });
+                    if (imagefiles.length > 0) {
+                        postimg(imagefiles, $scope.recordid);
+                    } else {
+                        showPopup.hideLoading();
+                        $ionicHistory.goBack();
+                    }
+                });
+            }
+        } else {
+            Pay.record.save($scope.record, function (data) {
+                $rootScope.commons.refresh = true;
+                var imagefiles = [];
+                _.each($scope.record.files, function (image) {
+                    if (!image.id)
+                        imagefiles.push(image.file_full_path);
+                });
+                if (imagefiles.length > 0) {
+                    postimg(imagefiles, data.id);
+                } else {
+                    showPopup.hideLoading();
+                    $ionicHistory.goBack();
+                }
+            }, function (err) {
+                alert('post Record error' + err);
+            });
+        }
+    }
+
+    $scope.selectSpendDate = function (spend_date) {
+        var options = {
+            mode: 'date',
+            date: spend_date ? new Date(spend_date) : new Date(),
+            androidTheme: 3
+        };
+        $cordovaDatePicker.show(options).then(function (date) {
+            if (date == undefined) return;
+            $scope.record.spend_date = date;
+        });
+    }
+
+    $scope.selectPayType = function () {
+        $scope.select_pay_type.show();
+        $rootScope.commons.modal = $scope.select_pay_type;
+    }
+
+
+    $scope.cancel = function (op) {
+        $rootScope.commons.modal.hide();
+    }
+
+    $scope.checkType = function (type) {
+        $scope.pay_type = type.id;
+        $scope.record.type_modal = type;
+        $rootScope.commons.modal.hide();
+    }
+
+    $scope.deleteRecord = function () {
+        showPopup.confirm("是否删除该消费记录?", '是', '否').then(function (res) {
+            if (res) {
+                Pay.record.delete({id: $scope.recordid}, function () {
+                    $rootScope.commons.refresh = true;
+                    $ionicHistory.goBack();
+                });
+            }
+        });
+    }
+
+    $scope.addphoto = function () {
+        if ($scope.record.files.length < 5) {
+            $scope.popup.optionsPopup = showPopup.showSelectImgPopup(Camera, ImagePicker, $scope);
+            $scope.popup.isPopup = true;
+        } else {
+            showPopup.PopupWindow(0, "上传图片数量需小于等于5!", false);
+        }
+    };
+
+    var ImagePicker = function () { //打开相册
+        $scope.popup.optionsPopup.close();
+        ImageManage.ImagePicker_getPictures(5).then(function (result) {
+            _.each(result, function (imageUrl) {
+                $scope.record.files.push({
+                    "file_thumbnail_path": imageUrl,
+                    "file_full_path": imageUrl
+                });
+            })
+        });
+    };
+
+    var Camera = function () {
+        $scope.popup.optionsPopup.close();
+        ImageManage.Camera_getPicture(true).then(function (result) {
+            $scope.record.files.push({
+                "file_thumbnail_path": result,
+                "file_full_path": result
+            });
+        });
+    };
+
+    function postimg(imgfiles, id) {
+        ImageManage.uploadImage(imgfiles, 'pay', id, 'payrecordfile').then(function (res) {
+            $q.all(res).then(function (data) {
+                showPopup.hideLoading();
+                $ionicHistory.goBack();
+            })
+        }, function (err) {
+            alert(JSON.stringify(error));
+            showPopup.PopupWindow(0, 'upload image fail');
+        })
+    }
+
+    $scope.deleteimage_list = [];
+    $scope.shouBigImage = function (imageUrl) {
+        $scope.Url = imageUrl;
+        $rootScope.commons.bigImage = true;
+    };
+
+    $rootScope.commons.bigImage = false;
+    $scope.hideBigImage = function () {
+        $rootScope.commons.bigImage = false;
+    };
+
+    $scope.deleteimage = function () {
+        var img = _.find($scope.record.files, function (image) {
+            return image.file_full_path == $scope.Url;
+        });
+        if (img) {
+            $scope.record.files.splice(_.indexOf($scope.record.files, img), 1);
+            if (img.id)
+                $scope.deleteimage_list.push(img.id);
+        }
+        $rootScope.commons.bigImage = false;
+    };
+
+    if ($scope.recordid > 0) {
+        watch = $scope.$watch('record', function (n, o) {
+            if (n == o)
+                return;
+            isModified = true;
+        }, true);
+    }
+
+    $scope.$on("$destroy", function () {
+        $scope.select_pay_type.remove();
+        if ($scope.recordid > 0) {
+            watch();
+        }
+    });
+})
+
+.controller('PayBillCtrl', function ($rootScope, $scope, $state, $ionicHistory, $ionicModal, global, showPopup, Pay, Tool) {
+    $scope.select_record = showPopup.modalTemplate('templates/modal-selectrecord.html', 'slide-in-right', $scope);
+    var isFirst = false;
+    $scope.type = $state.params['type'];
+    $scope.billid = $state.params['id']
+    $scope.titleArr = ['新建', '编辑'];
+    $scope.amountSum = 0;
+    $scope.bill = {
+        "title": null,
+        "note": null,
+        "status": null,
+        "record": [],
+        "record_old": []
+    }
+    $scope.records = [];
+
+    global.fetch_user().then(function () {
+        Pay.auditstep.get({userid: global.user.usrid}, function (data) {
+            $scope.checkusrdata = data;
+        });
+        if ($scope.billid < 0) {
+            $scope.recordlist = Tool.cloneObj(Pay.recordList);
+            $scope.select_record.then(function (modal) {
+                $scope.select_record = modal;
+                $rootScope.commons.modal = modal;
+                $scope.select_record.show();
+            });
+            isFirst = true;
+        } else {
+            $scope.select_record.then(function (modal) {
+                $scope.select_record = modal;
+                $rootScope.commons.modal = modal;
+            });
+            $scope.bill = Tool.cloneObj(Pay.detailItem);
+            $scope.recordlist = Tool.cloneObj(Pay.recordList);
+            $scope.records = $scope.bill.record;
+            $scope.bill.record_old = _.map($scope.bill.record, function (record) {
+                return record.id;
+            });
+            _.each($scope.records.reverse(), function (record) {
+                record.selected = true;
+                $scope.recordlist.splice(0, 0, record);
+            });
+            $scope.amountSum = $scope.bill.total_amount;
+        }
+    });
+
+    $scope.selectRecord = function (recorditem) {
+        if (recorditem.selected) {
+            $scope.amountSum = parseFloat($scope.amountSum) + parseFloat(recorditem.amount);
+        } else {
+            $scope.amountSum = parseFloat($scope.amountSum) - parseFloat(recorditem.amount);
+        }
+        $scope.amountSum = $scope.amountSum.toFixed(2);
+    };
+
+    $scope.toEditRecord = function () {
+        $scope.select_record.show();
+        $rootScope.commons.modal = $scope.select_record;
+    };
+
+    $scope.cancel = function (op) {
+        if (op == 'm') {
+            if (isFirst) {
+                $ionicHistory.goBack();
+            }
+            $rootScope.commons.modal.hide();
+            $rootScope.commons.modal = undefined;
+        } else {
+            $ionicHistory.goBack();
+        }
+
+    };
+
+    $scope.ok = function (op) {
+        if (op == 'bill') {
+            if ($scope.bill.title == null) {
+                showPopup.PopupWindow(0, "请填写标题", false);
+                return;
+            }
+            $scope.bill.record = _.map($scope.records, function (item) {
+                return item.id;
+            });
+            showPopup.showLoading(1, '正在提交', false);
+            if ($scope.billid < 0) {
+                Pay.billdetail.save($scope.bill, function (data) {
+                    showPopup.hideLoading();
+                    $state.go('paybilldetails', {
+                        id: data.id
+                    });
+                }, function (err) {
+                    alert(JSON.stringify(err))
+                });
+            } else {
+                $scope.bill = _.pick($scope.bill, 'id', 'title', 'note', 'status', 'record', 'record_old');
+                Pay.billdetail.update($scope.bill, function (data) {
+                    showPopup.hideLoading();
+                    $state.go('paybilldetails', {
+                        id: data.id
+                    });
+                }, function (err) {
+                    alert(JSON.stringify(err))
+                });
+            }
+        } else {
+            $scope.records = _.filter($scope.recordlist, function (item) {
+                return item.selected;
+            });
+            $rootScope.commons.modal.hide();
+        }
+    }
+
+    $scope.$on("$destroy", function () {
+        $scope.select_record.remove();
+    });
+})
+
+.controller('BillListCtrl', function ($rootScope, $scope, $state, global, Pay) {
+    var type = $state.params['type'];
+    global.fetch_user().then(function () {
+        getpaylistdata();
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpaylistdata();
+    };
+
+    $scope.loadMore = function () {
+        if ($scope.bills != undefined && $scope.bills.next != null) {
+            Tool.get($scope.bills.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.bills.results.push(item);
+                });
+                $scope.bills.next = data.next;
+                $scope.bills.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    };
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.bills != undefined && $scope.bills.next != null;
+    };
+
+    function getpaylistdata() {
+        if (global.user.token != "") {
+            if ($scope.bills == undefined) {
+                $scope.loading = true;
+            }
+            Pay.bill.get({type: type}, function (data) {
+                $scope.bills = data;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+})
+
+.controller('BillApproveCtrl', function ($rootScope, $scope, $state, global, Pay) {
+    var type = $state.params['type'];
+    global.fetch_user().then(function () {
+        getpaylistdata();
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpaylistdata();
+    };
+
+    $scope.loadMore = function () {
+        if ($scope.bills != undefined && $scope.bills.next != null) {
+            Tool.get($scope.bills.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.bills.results.push(item);
+                });
+                $scope.bills.next = data.next;
+                $scope.bills.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    };
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.bills != undefined && $scope.bills.next != null;
+    };
+
+    function getpaylistdata() {
+        if (global.user.token != "") {
+            if ($scope.bills == undefined) {
+                $scope.loading = true;
+            }
+            Pay.bill.get({type: type}, function (data) {
+                $scope.bills = data;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+})
+
+.controller('BillApprovedCtrl', function ($rootScope, $scope, $state, global, Pay, Member, Tool) {
+    var type = $state.params['type'];
+    $scope.centerdata = [
+        {"key": null, "name": "全部状态", "check": true},
+        {"key": 0, "name": "已驳回", "check": false},
+        {"key": 1, "name": "已支付", "check": false},
+        {"key": 2, "name": "未支付", "check": false},
+        {"key": 3, "name": "处理中", "check": false}];
+    var beforeenter = $scope.$on('$ionicView.beforeEnter', function () {
+        $scope.user_id = Member.selectedemplst.length > 0 ? Member.selectedemplst[0].user_id : 0;
+    });
+    global.fetch_user().then(function () {
+        getpaylistdata(null, null, null, null);
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpaylistdata();
+    };
+
+    $scope.loadMore = function () {
+        if ($scope.bills != undefined && $scope.bills.next != null) {
+            Tool.get($scope.bills.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.bills.results.push(item);
+                });
+                $scope.bills.next = data.next;
+                $scope.bills.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    };
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.bills != undefined && $scope.bills.next != null;
+    };
+
+    $scope.selectClick = function (date, status, user_id) {
+        var year = date == null ? date : (date.length > 4 ? date.substr(0, 4) : date);
+        var month = date == null ? date : (date.length == 4 ? null : date.substr(5, date.length - 5));
+        getpaylistdata(status == null ? status : parseInt(status), year, month, user_id);
+    };
+
+    $scope.setUser = function () {
+        $scope.user_id = 0;
+    };
+
+    function getpaylistdata(status, year, month, create_user) {
+        if (global.user.token != "") {
+            if ($scope.bills == undefined) {
+                $scope.loading = true;
+            }
+            Pay.bill.get({"type": type, "status": status, "year": year, "month": month, "create_user": create_user}, function (data) {
+                $scope.bills = data;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+
+    $scope.$on('$destroy', function () {
+        beforeenter = null;
+        Member.selectedemplst = [];
+    });
+})
+
+.controller('BillPayCtrl', function ($rootScope, $scope, $state, global, Pay) {
+    var type = $state.params['type'];
+    global.fetch_user().then(function () {
+        getpaylistdata();
+    });
+
+    $scope.doRefresh = function () {
+        global.refresh = true;
+        getpaylistdata();
+    };
+
+    $scope.toAnalyse = function () {
+        $state.go('pay-analyse');
+    }
+
+    $scope.loadMore = function () {
+        if ($scope.bills != undefined && $scope.bills.next != null) {
+            Tool.get($scope.bills.next).then(function (data) {
+                _.each(data.results, function (item) {
+                    $scope.bills.results.push(item);
+                });
+                $scope.bills.next = data.next;
+                $scope.bills.previous = data.previous;
+            }).finally(function () {
+                $scope.$broadcast('scroll.infiniteScrollComplete');
+                $scope.loading = false;
+            });
+        } else {
+            $scope.$broadcast('scroll.infiniteScrollComplete');
+        }
+    };
+
+    $scope.moreCanBeLoaded = function () {
+        return $scope.bills != undefined && $scope.bills.next != null;
+    };
+
+    function getpaylistdata() {
+        if (global.user.token != "") {
+            if ($scope.bills == undefined) {
+                $scope.loading = true;
+            }
+            Pay.bill.get({type: type}, function (data) {
+                $scope.bills = data;
+            }, function (err) {
+                alert(JSON.stringify(err));
+            }).$promise.finally(function () {
+                $scope.$broadcast('scroll.refreshComplete');
+                $scope.loading = false;
+            });
+        }
+    }
+})
+
+.controller('PayBillDetailsCtrl', function ($rootScope, $scope, $state, $ionicPopup, $ionicHistory, $cordovaDialogs, global, Pay, showPopup, Tool) {
+    showPopup.modalTemplate('templates/modal-stepReject.html', 'slide-in-right', $scope).then(function (modal) {
+        $scope.step_reject = modal;
+    });
+    $scope.index = null;
+    var paybillid = $state.params["id"];
+    Tool.removeBackView('pay-bill');
+
+    global.fetch_user().then(function () {
+        $scope.user = global.user.usrid;
+        getbilldata();
+    });
+
+    $scope.toedit = function () {
+        $state.go('pay-bill', {
+            type: 1,
+            id: paybillid
+        });
+    }
+
+    $scope.deleteBill = function () {
+        $cordovaDialogs.confirm('是否撤销该报销单', '提示', ['是', '否']).then(function (buttonIndex) {
+            if (buttonIndex == 1) {
+                showPopup.showLoading(1, '撤销中');
+                Pay.billdetail.delete({id: paybillid}, function () {
+                    showPopup.hideLoading();
+                    $ionicHistory.goBack();
+                });
+            }
+        });
+    }
+
+    $scope.audit = function (op) {
+        $scope.data = {};
+        if (op == 0) {
+            setPopup('驳回', '请输入驳回理由(必填)', op);
+        } else if (op == 1) {
+            setPopup('同意', '请输入备注(选填)', op);
+        } else if (op == 2) {
+            showPopup.showLoading(1, '提交中');
+            Pay.billdetail.update({id: paybillid, status: 2}, function (data) {
+                getbilldata();
+                showPopup.hideLoading();
+            });
+        }
+    }
+
+    $scope.ok = function () {
+        console.log($scope.index);
+        $scope.data.ordering = $scope.index;
+        postHistory($scope.data);
+        $scope.cancel();
+    }
+
+    $scope.cancel = function () {
+        $rootScope.commons.modal.hide();
+    }
+
+    $scope.changeIndex = function (index) {
+        $scope.index = index;
+    }
+
+    function getbilldata() {
+        if (global.user.token != "") {
+            if ($scope.bill == undefined) {
+                $scope.loading = true;
+            }
+            Pay.billdetail.get({id: paybillid}, function (res) {
+                $scope.loading = false;
+                $scope.bill = res;
+                Pay.detailItem = _.clone(res);
+                console.log(res);
+                $scope.billhistorydata = [];
+                _.each(res.history, function (item) {
+                    var historyitem = {};
+                    historyitem.date = item.create_date;
+                    historyitem.title = item.create_user.username;
+                    historyitem.profilePicture = "../../../img/panda.png";
+                    historyitem.text = item.content;
+                    historyitem.icon = item.status == 0 ? "ion-ios-undo assertive" : "ion-ios-checkmark balanced"
+                    $scope.billhistorydata.push(historyitem);
+                });
+                if (!$scope.bill.verifier.is_teller) {
+                    $scope.billhistorydata.push({
+                        icon: 'ion-load-c task-create-member-p',
+                        title: $scope.bill.status == 0 ? $scope.user == $scope.bill.create_user.id ? '等待我处理' : '当前处理人:' + $scope.bill.create_user.username : $scope.user == $scope.bill.verifier.verifier_id ? '等待我处理' : '当前处理人:' + $scope.bill.verifier.verifier__username,
+                        profilePicture: "../../../img/panda.png"
+                    });
+                }
+                $scope.billhistorydata.reverse();
+            })
+        }
+    }
+
+    function setPopup(title, placeholdertext, op) {
+        $cordovaDialogs.prompt(placeholdertext, title, ['确定', '取消']).then(function (result) {
+            var input = result.input1;
+            var btnIndex = result.buttonIndex;
+            if (btnIndex == 1) {
+                if (input == '' && op == 0) {
+                    $cordovaDialogs.alert('请填写驳回理由', '提示', '确定');
+                } else {
+                    $scope.data = {
+                        status: op,
+                        content: input == '' ? null : input,
+                        pay_bill_id: paybillid,
+                        ordering: null
+                    }
+                    if (op == 1) {
+                        postHistory($scope.data);
+                    } else if (op == 0) {
+                        $scope.step = getStep($scope.bill.step);
+                        if ($scope.step.length >= 1) {
+                            $scope.step.reverse();
+                            $scope.step.push({
+                                ordering: 0,
+                                verifier: {
+                                    username: $scope.bill.create_user.username
+                                }
+                            });
+                            $scope.index = $scope.step[0].ordering;
+                            $scope.step_reject.show();
+                            $rootScope.commons.modal = $scope.step_reject;
+                        } else {
+                            postHistory($scope.data);
+                        }
+                    }
+                }
+            }
+        });
+    }
+
+    function postHistory(data) {
+        showPopup.showLoading(1, '提交中');
+        Pay.billhistory.save(data, function (data) {
+            getbilldata();
+            showPopup.hideLoading();
+        })
+    }
+
+    function getStep(step) {
+        return _.filter(step, function (item) {
+            return item.is_approved;
+        });
+    }
+
+    $scope.$on("$destroy", function () {
+        $scope.step_reject.remove();
+    });
+})
+
+.controller('PayAnalyseCtrl', function ($rootScope, $scope, $filter, $state, global, Pay) {
+    global.fetch_user().then(function () {
+        getanalysedata();
+    });
+
+    function getanalysedata() {
+        if (global.user.token != "") {
+            if ($scope.data == undefined) {
+                $scope.loading = true;
+            }
+            Pay.analyse.get(function (res) {
+                $scope.loading = false;
+                $scope.data = res;
+                _.each($scope.data.result, function (item) {
+                    item.percentage = $filter('percentage')(item.count / $scope.data.count, 2, "%");
+                })
+            })
+        }
+    }
+})

+ 90 - 0
platforms/android/assets/www/apps/pay/js/directive.js

@@ -0,0 +1,90 @@
+starter.directive('payBillList', function () {
+    return {
+        restrict: "E",
+        scope: {
+            bills: "=bills",
+            loading: "=loading"
+        },
+        templateUrl: 'templates/template-payBillList.html',
+        controller: function ($scope, $state, global) {
+            $scope.user = global.user.usrid;
+            $scope.todetails = function (id) {
+                $state.go('paybilldetails', {
+                    id: id
+                })
+            }
+        }
+    }
+})
+
+.directive('filterBar', function () {
+    return {
+        restrict: "E",
+        scope: {
+            setuser: "&",
+            selClick: "&",
+            centerData: "=",
+            userId: "="
+        },
+        templateUrl: "templates/template-filterbar.html",
+        controller: function ($scope, $state, formatFilter, Member) {
+            setdata();
+            $scope.$watch('userId', function (newValue, oldValue) {
+                if (newValue === oldValue) return;
+                if (Member.selectedemplst.length > 0) {
+                    $scope.values.user_id = Member.selectedemplst[0].user_id;
+                    $scope.right_title = Member.selectedemplst[0].username;
+                    $scope.right_data[1].name = "选择单个成员" + formatFilter("({0})", Member.selectedemplst[0].username);
+                    $scope.selClick($scope.values);
+                }
+            });
+
+            $scope.selectclick = function (item, index) {
+                $scope.acitve_indexs[$scope.key] = index;
+                $scope.Ishidded = !$scope.Ishidded;
+                if ($scope.key == "R" && index == 1) {
+                    Member.routename = "";
+                    Member.titlename = "选择单个成员";
+                    Member.selectedemplst = [];
+                    $state.go('selectsinglemember');
+                    return;
+                } else if ($scope.key == "R" && index == 0) {
+                    Member.selectedemplst = [];
+                    $scope.setuser();
+                    $scope.right_title = $scope.right_data[0].name = "全部成员";
+                    $scope.right_data[1].name = "选择单个成员";
+                }
+                $scope.key == "L" ? $scope.values.date = $scope.left_data[index].key : ($scope.key == "C" ? $scope.values.status = $scope.centerData[index].key : $scope.values.user_id = $scope.right_data[index].key);
+                $scope.selClick($scope.values);
+            };
+
+            $scope.headerclick = function (key) {
+                if ($scope.key == key) {
+                    $scope.Ishidded = !$scope.Ishidded;
+                } else {
+                    $scope.key = key;
+                    $scope.Ishidded = false;
+                }
+            };
+
+            function setdata() {
+                $scope.acitve_indexs = {"L": 0, "C": 0, "R": 0};
+                $scope.key = "L";
+                $scope.Ishidded = true;
+                $scope.left_data = [];
+                var year = new Date().getFullYear();
+                $scope.left_data.push({"key": null, "name": "全部时间", "check": true});
+                for (var y = year; y >= year - 1; y--) {
+                    $scope.left_data.push({"key": formatFilter('{0}', y), "name": formatFilter('{0}年 全年', y), "check": false});
+                    for (var m = 1; m < 13; m++) {
+                        $scope.left_data.push({"key": formatFilter('{0}-{1}', y, m), "name": formatFilter('{0}年 {1}月', y, m), "check": false})
+                    }
+                }
+                $scope.right_data = [{"key": null, "name": "全部成员", "check": true}, {"key": null, "name": "选择单个成员", "check": false}];
+                $scope.data = {"L": $scope.left_data, "C": $scope.centerData, "R": $scope.right_data};
+                $scope.values = {"date": _.find($scope.left_data, {check: true}).key, "status": _.find($scope.centerData, {check: true}).key, "user_id": _.find($scope.right_data, {check: true}).key};
+                $scope.right_title = $scope.right_data[0].name;
+            }
+        }
+    }
+})

+ 23 - 0
platforms/android/assets/www/apps/pay/js/factory.js

@@ -0,0 +1,23 @@
+starter.factory('Pay', function ($resource, cfg, formatFilter, Tool, showPopup) {
+    var pay = {};
+
+    pay.typeList = [];
+    pay.typeItem = {};
+    pay.recordItem = {};
+    pay.recordList = [];
+    pay.detailItem = {};
+    pay.auditstepdata = [];
+    pay.personstepdata = [];
+
+    pay.type = $resource(formatFilter('{0}pay/type/:id/', cfg.api), {}, {'get': {method: 'GET', isArray: true}, 'patch': {method: 'PATCH', isArray: true}});
+    pay.record = $resource(formatFilter('{0}pay/record/:id/', cfg.api));
+    pay.recordfile = $resource(formatFilter('{0}pay/recordfile/:id/', cfg.api));
+    pay.auditstep = $resource(formatFilter('{0}pay/auditstep/:id/', cfg.api), {}, {'save': {method: 'POST', isArray: true}, 'get': {method: 'GET', isArray: true}});
+    pay.bill = $resource(formatFilter('{0}pay/bill/', cfg.api));
+    pay.billdetail = $resource(formatFilter('{0}pay/billdetail/:id/', cfg.api));
+    pay.stepcopy = $resource(formatFilter('{0}pay/stepcopy/:id/', cfg.api));
+    pay.billhistory = $resource(formatFilter('{0}pay/billhistory/:id/', cfg.api));
+    pay.analyse = $resource(formatFilter('{0}pay/analyse/', cfg.api));
+
+    return pay;
+});

+ 90 - 0
platforms/android/assets/www/apps/pay/js/route.js

@@ -0,0 +1,90 @@
+starter.config(function ($stateProvider) {
+    $stateProvider.state('pay', {
+        url: '/index',
+        templateUrl: 'templates/pay.html',
+        controller: 'PayCtrl'
+    })
+
+    .state('payman', {
+        url: '/payman',
+        templateUrl: 'templates/payman.html'
+    })
+
+    .state('typeset', {
+        url: '/typeset',
+        templateUrl: 'templates/typeset.html',
+        controller: 'TypeSetCtrl'
+    })
+
+    .state('auditstepset', {
+        url: '/auditstepset',
+        templateUrl: 'templates/auditstepset.html',
+        controller: 'AuditStepSetCtrl'
+    })
+
+    .state('addtype', {
+        url: '/addtype/:id',
+        templateUrl: 'templates/addtype.html',
+        controller: 'AddTypeCtrl'
+    })
+
+    .state('pay-record', {
+        url: '/pay-record/:type&:id',
+        templateUrl: 'templates/pay-record.html',
+        controller: 'PayRecordCtrl'
+    })
+
+    .state('pay-bill', {
+        url: '/pay-bill/:type&:id',
+        templateUrl: 'templates/pay-bill.html',
+        controller: 'PayBillCtrl'
+    })
+
+    .state('auditstep', {
+        url: '/auditstep/:id',
+        templateUrl: 'templates/auditstep.html',
+        controller: 'AuditStepCtrl'
+    })
+
+    .state('seestepmflist', {
+        url: '/seestepmflist',
+        templateUrl: 'templates/seestepmflist.html',
+        controller: 'SeeStepMfListCtrl'
+    })
+
+    .state('billlist', {
+        url: '/billlist/:type',
+        templateUrl: 'templates/billlist.html',
+        controller: 'BillListCtrl'
+    })
+
+    .state('paybilldetails', {
+        url: '/paybilldetails/:id',
+        templateUrl: 'templates/paybilldetails.html',
+        controller: 'PayBillDetailsCtrl'
+    })
+
+    .state('billapprove', {
+        url: '/billapprove/:type',
+        templateUrl: 'templates/billapprove.html',
+        controller: 'BillApproveCtrl'
+    })
+
+    .state('billapproved', {
+        url: '/billapproved/:type',
+        templateUrl: 'templates/billapproved.html',
+        controller: 'BillApprovedCtrl'
+    })
+
+    .state('billpay', {
+        url: '/billpay/:type',
+        templateUrl: 'templates/billpay.html',
+        controller: 'BillPayCtrl'
+    })
+
+    .state('pay-analyse', {
+        url: '/pay-analyse',
+        templateUrl: 'templates/pay-analyse.html',
+        controller: 'PayAnalyseCtrl'
+    })
+});

+ 32 - 0
platforms/android/assets/www/apps/pay/templates/addtype.html

@@ -0,0 +1,32 @@
+<ion-view view-title="添加消费类型" hide-tabs="true" hide-back-button="true" cache-view="false">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click='ok();'>确定</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click='back();'>取消</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class=" item item-divider"></div>
+        <label class="item item-input">
+            <input type="text" placeholder="类型名称" ng-model="data.name">
+        </label>
+        <div class="item item-divider divider-font">选择图标颜色</div>
+        <ul class='ul-imgs dept-icon type-icon'>
+            <li ng-repeat="data in iconcolordata" style="background-color: {{data.background}}" ng-click="selectcolor(data)"><i ng-if="data.isacitve" class="ion-ios-checkmark-empty"></i></li>
+        </ul>
+        <div class="item item-divider divider-font">选择图标</div>
+        <ul class='ul-imgs dept-icon type-icon type-icon-bg'>
+            <li ng-repeat="item in icondata" style="background-color: {{item.background}}" ng-click="selecticon(item)"><i class="iconassertive {{item.icon}}" ng-class="{true:'acitvecolor',false:'unacitvecolor'}[item.isacitve]"></i></li>
+        </ul>
+        <!-- <ion-list>
+            <ion-item class="item item-icon-right item-group item-comp">
+                <label class="compname">图标</label>
+                <i class="icon ion-ios-compose-outline positive"></i>
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+        </ion-list> -->
+    </ion-content>
+    <div class="bar bar-footer assertive footer" ng-if="typeid>0" ng-click="deltype()">
+        <div class="title">删除</div>
+    </div>
+</ion-view>

+ 46 - 0
platforms/android/assets/www/apps/pay/templates/auditstep.html

@@ -0,0 +1,46 @@
+<ion-view hide-back-button="true">
+    <ion-nav-title>{{titlename}}</ion-nav-title>
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="goback()">取消</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="ok()">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class=" item item-divider" ng-if="op_id<0&&!is_current_user"></div>
+        <ion-item class="item item-icon-right over-flow-auto item-text-wrap" ng-click="add_create_user();" ng-if="op_id<0&&!is_current_user">
+            已选成员
+            <p class="label-right-text">{{create_users.length==1?create_users[0].username:create_users.length+"人"}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <div class=" item item-divider"></div>
+        <ion-item class="item auditemp-box">
+            请添加完整的报销审批步骤
+            <div class="item auditstepbox">
+                <div class="audit-member-div">
+                    <img src="../../../img/panda.png" alt="">
+                    <p>{{create_users[0].username}}</p>
+                </div>
+                <div class="audit-member-div" ng-repeat="checkusr in step_users">
+                    <i class="icon ion-ios-close" ng-click="step_users.splice($index,1)"></i>
+                    <img src="../../../img/panda.png" alt="">
+                    <p>{{checkusr.username}}</p>
+                </div>
+                <div class="audit-member-div member-add">
+                    <i class="icon ion-ios-plus-outline" ng-click="add_step_user();"></i>
+                    <p>审批人</p>
+                </div>
+            </div>
+        </ion-item>
+        <div class=" item item-divider"></div>
+        <ion-item class="item item-icon-right over-flow-auto item-text-wrap" ng-click="add_teller();">
+            出纳人员
+            <p class="label-right-text">{{teller==null?"必填":teller.username}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <div class="desctext">将报销单抄送给出纳人员</div>
+    </ion-content>
+    <div class="bar bar-footer footer" ng-click="toSeeList()" ng-if="op_id<=0&&is_current_user">
+        <div class="title calm">看一看同事的报销审批步骤</div>
+    </div>
+</ion-view>

+ 44 - 0
platforms/android/assets/www/apps/pay/templates/auditstepset.html

@@ -0,0 +1,44 @@
+<ion-view view-title="审批步骤设置" hide-tabs="true">
+    <ion-nav-buttons style="border:none" side="right">
+        <button class="button button-icon ion-ios-more" ng-if="is_show_delete!=true" ng-click="popover.show($event)"></button>
+        <button class="button button-clear" ng-if="is_show_delete" ng-click="ok();">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider dividercolor">可以设置每个人的审批步骤</div>
+        <ion-refresher pulling-text="下拉刷新" pulling-icon="ion-ios-arrow-thin-down" on-refresh="doRefresh()"></ion-refresher>
+        <ion-list class="audit-list" show-delete="is_show_delete">
+            <div ng-repeat="result in resultdata track by $index">
+                <div class="rj-contacts-index-bar item-remove-animate" id="index_{{result.sortchar}}">{{result.sortchar}}</div>
+                <ion-item ng-repeat="person in result.persons track by $index" ng-click="toedit(person.emp.id)" class="item-thumbnail-left item-icon-right over-flow-auto item-text-wrap">
+                    <img ng-src="../../../img/panda.png">
+                    <h2>{{person.emp.username}}</h2>
+                    <p ng-style="">{{person.emp.degree}}</p>
+                    <ion-delete-button class="ion-minus-circled" ng-click="removeItem(person.emp,result.sortchar)">
+                    </ion-delete-button>
+                    <p class="label-right-text">{{person.checknames}}</p>
+                    <i class="icon ion-chevron-right icon-accessory"></i>
+                </ion-item>
+            </div>
+            <ion-item class="item-border">
+            </ion-item>
+        </ion-list>
+    </ion-content>
+    <div class="rj-contacts-right-bar" rj-position-middle on-drag="contacts_right_bar_swipe($event)">
+        <div>&uarr;</div>
+        <div>☆</div>
+        <div ng-repeat="char in sortchars" ng-click="sortByChar(char,'index_{{char}}')">{{char}}</div>
+    </div>
+    <div class="rj-contacts-middle-bar" ng-show="is_show_middle">
+        {{sortchar}}
+    </div>
+    <script id="templates/add.html" type="text/ng-template">
+        <ion-popover-view class="popver_view">
+            <ion-content>
+                <ion-list>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="toadd();">添加成员</ion-item>
+                    <ion-item class="item item-button" type="item-text-wrap" ng-click="displayremove();">移除成员</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 14 - 0
platforms/android/assets/www/apps/pay/templates/billapprove.html

@@ -0,0 +1,14 @@
+<ion-view view-title="需要我审批的报销单">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <a class="item item-icon-right" ng-href="#/billapproved/2">已审批的报销单
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <div class="item item-divider">需要我审批的({{bills.results.length}})</div>
+        <pay-bill-list  bills="bills.results" loading="loading"></pay-bill-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+</ion-view>

+ 13 - 0
platforms/android/assets/www/apps/pay/templates/billapproved.html

@@ -0,0 +1,13 @@
+<ion-view view-title="已审批的报销单">
+    <ion-content>
+        <filter-bar sel-click="selectClick(date,status,user_id)" center-data="centerdata" user-id="user_id" setuser="setUser()"></filter-bar>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-scroll style="height: 90%">
+            <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+            <pay-bill-list bills="bills.results" loading="loading"></pay-bill-list>
+        </ion-scroll>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+</ion-view>

+ 10 - 0
platforms/android/assets/www/apps/pay/templates/billlist.html

@@ -0,0 +1,10 @@
+<ion-view view-title="我提交的报销单">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <pay-bill-list  bills="bills.results" loading="loading"></pay-bill-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+</ion-view>

+ 13 - 0
platforms/android/assets/www/apps/pay/templates/billpay.html

@@ -0,0 +1,13 @@
+<ion-view view-title="需要我支付的报销单">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="toAnalyse()">分析</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <pay-bill-list  bills="bills.results" loading="loading"></pay-bill-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+</ion-view>

+ 13 - 0
platforms/android/assets/www/apps/pay/templates/modal-paytype.html

@@ -0,0 +1,13 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="cancel();">取消</button>
+        <h1 class="title">选择消费类型</h1>
+        <button class="button button-clear button-calm" ng-click="ok();">完成</button>
+    </ion-header-bar>
+    <ion-content>
+        <ion-radio class="item-icon-left item-icon-right" ng-model="record.pay_type" ng-click="checkType(type)" ng-value="type.id" ng-repeat="type in types">
+            <i style="color:{{type.icon_color}}" class="icon" ng-class="type.icon"></i>
+            <span style="padding-left: 38px">{{type.name}}</span>
+        </ion-radio>
+    </ion-content>
+</ion-modal-view>

+ 24 - 0
platforms/android/assets/www/apps/pay/templates/modal-selectrecord.html

@@ -0,0 +1,24 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="cancel('m');">取消</button>
+        <h1 class="title">选择要报销的消费</h1>
+    </ion-header-bar>
+    <ion-content>
+        <!--<div class="item item-divider divider-font">本月</div>-->
+        <ul class="list">
+            <li class="item item-checkbox item-icon-right" ng-repeat="record in recordlist">
+                <i class="icon" style="color:{{record.type_modal.icon_color}}" ng-class="record.type_modal.icon"></i>
+                {{record.description}}
+                <span class="item-note assertive">¥{{record.amount}}</span>
+                <p>{{record.spend_date | date:'yyyy-MM-dd'}}</p>
+                <label class="checkbox">
+                    <input type="checkbox" ng-model="record.selected" ng-click="selectRecord(record)">
+                </label>
+            </li>
+        </ul>
+    </ion-content>
+    <div class="bar bar-footer bar-dark footer-div record-count-div">
+        <span class="record-count-span">合计:¥<label for="">{{amountSum}}</label></span>
+        <button ng-click="ok();" class="button pull-right button-calm" ng-disabled="amountSum==0">确定</button>
+    </div>
+</ion-modal-view>

+ 10 - 0
platforms/android/assets/www/apps/pay/templates/modal-stepReject.html

@@ -0,0 +1,10 @@
+<ion-modal-view>
+    <ion-header-bar class="bar bar-header">
+        <button class="button button-clear button-calm" ng-click="cancel()">取消</button>
+        <h1 class="title">驳回到</h1>
+        <button class="button button-clear button-calm" ng-click="ok()">完成</button>
+    </ion-header-bar>
+    <ion-content>
+        <ion-radio ng-model="index" ng-value="s.ordering" ng-click="changeIndex(s.ordering)" ng-repeat="s in step">{{s.ordering == 0 ? '提交报销单' : '第'+ s.ordering + '步审批'}}({{s.verifier.username}})</ion-radio>
+    </ion-content>
+</ion-modal-view>

+ 19 - 0
platforms/android/assets/www/apps/pay/templates/pay-analyse.html

@@ -0,0 +1,19 @@
+<ion-view view-title="需支付的报销金额">
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-if="!loading" class="item item-divider">
+            ¥{{data.count}}
+        </div>
+        <div ng-if="!loading" class="item item-divider" style="overflow: auto;">
+            <div ng-repeat="item in data.result" style="float: left; width: {{item.percentage}}; height: 12px; background-color: {{item.type_modal.icon_color}}"></div>
+        </div>
+        <div ng-if="!loading" class="item item-icon-left item-icon-right" ng-repeat="item in data.result" ng-click="torecord(record)">
+            <i class="icon icon-style" style="background-color:{{item.type_modal.icon_color}}" ng-class="item.type_modal.icon"></i>{{item.type_modal.name}}({{item.percentage}})
+            <p>¥{{item.count}}</p>
+            <!--<i class="icon ion-chevron-right icon-accessory"></i>-->
+        </div>
+    </ion-content>
+</ion-view>

+ 64 - 0
platforms/android/assets/www/apps/pay/templates/pay-bill.html

@@ -0,0 +1,64 @@
+<ion-view view-title="{{titleArr[type]}}报销单" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="cancel();">取消</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="ok('bill');">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider"></div>
+        <label class="item item-input text-input">
+            <span class="input-label">标题</span>
+            <input type="text" placeholder="输入报销单名称" ng-model="bill.title"/>
+        </label>
+        <div class="item item-divider"></div>
+        <ion-item class="item auditemp-box">
+            需报销的消费({{records.length}})
+            <label for="" class="edit-text-label positive" ng-click="toEditRecord()">修改</label>
+            <div class="item item-text-wrap bill-record-box">
+                <div class="item item-icon-left" ng-repeat="item in records">
+                    <i class="icon icon-style" ng-class="item.type_modal.icon" style="background-color:{{item.type_modal.icon_color}}"></i>{{item.description}}
+                    <span class="item-note ">¥{{item.amount}}</span>
+                    <p>{{item.spend_date | date:'yyyy-MM-dd'}}</p>
+                </div>
+            </div>
+
+            <div class="bill-sum ">共计:
+                <label class="assertive">¥{{amountSum}}</label>
+            </div>
+        </ion-item>
+        <div class="item item-divider"></div>
+        <!--<label class="item item-input text-input">-->
+            <!--<span class="input-label">补助&nbsp;¥</span>-->
+            <!--<input type="number" ng-model="bill.grant" placeholder="输入金额(选填)" ng-pattern="/^([1-9][\d]{0,8}|0)(\.[\d]{1,2})?$/">-->
+        <!--</label>-->
+        <label class="item item-input text-input">
+            <span class="input-label">备注</span>
+            <input type="text" ng-model="bill.note" placeholder="输入备注(选填)"/>
+        </label>
+        <div class="item item-divider"></div>
+        <ion-item class="item">
+            报销审批步骤
+        </ion-item>
+        <ion-list class="audit-list bill-auditlist-box">
+            <ion-item class="bill-audit-item item-thumbnail-left item-text-wrap">
+                <img ng-src="../../../img/panda.png">
+                <h2>{{checkusrdata[0].create_user.username}}</h2>
+                <p>申请</p>
+                <ion-delete-button class="ion-minus-circled" ng-click="onItemDelete(item)">
+                </ion-delete-button>
+            </ion-item>
+            <div class=" "></div>
+            <ion-item class="bill-audit-item item-thumbnail-left item-text-wrap" ng-repeat="checkusr in checkusrdata">
+                <img ng-src="../../../img/panda.png">
+                <h2>{{checkusr.verifier.username}}</h2>
+                <p>{{checkusr.verifier.degree}}</p>
+                <ion-delete-button class="ion-minus-circled" ng-click="onItemDelete(item)">
+                </ion-delete-button>
+            </ion-item>
+            <div class=" "></div>
+            <ion-item class="item-border">
+            </ion-item>
+            <ion-list>
+    </ion-content>
+</ion-view>

+ 46 - 0
platforms/android/assets/www/apps/pay/templates/pay-record.html

@@ -0,0 +1,46 @@
+<ion-view view-title="{{titleArr[recordid == -1 ? 0 : 1]}}消费记录">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="ok();">完成</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <div class="item item-divider"></div>
+        <label class="item item-input text-input">
+            <span class="input-label">金额&nbsp;¥</span>
+            <input type="number" ng-model="record.amount" placeholder="输入金额" ng-pattern="/^([1-9][\d]{0,8}|0)(\.[\d]{1,2})?$/">
+        </label>
+        <div class=" item item-divider"></div>
+        <ion-item class="item item-icon-right over-flow-auto item-text-wrap" ng-click="selectPayType();">
+            消费类型
+            <p class="label-right-text">{{record.type_modal.name}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <ion-item class="item item-icon-right over-flow-auto item-text-wrap" ng-click="selectSpendDate(record.spend_date)">
+            消费日期
+            <p class="label-right-text">{{record.spend_date | date:"y年MM月dd日"}}</p>
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </ion-item>
+        <div class=" item item-divider"></div>
+        <div class="item">票据图片</div>
+        <div class="item camera-item">
+            <div ng-repeat="img in record.files" ng-click="shouBigImage(img.file_full_path)">
+                <img ng-src="{{img.file_thumbnail_path}}"/>
+            </div>
+            <div class="center" ng-click="addphoto()">
+                <i class="icon ion-image"></i>
+            </div>
+        </div>
+        <div class=" item item-divider"></div>
+        <label class="item item-input text-input">
+            <span class="input-label">描述</span>
+            <input type="text" ng-model="record.description" placeholder="输入描述"/>
+        </label>
+        <div class=" item item-divider" ng-if="recordid>0"></div>
+        <ion-item class="item assertive" type="item-text-wrap" ng-if="recordid>0" ng-click="deleteRecord();" style="text-align:center">
+            删除
+        </ion-item>
+    </ion-content>
+    <div ng-show="commons.bigImage" class="popover-backdrop1">
+        <img class="fullscreen-image" ng-click="hideBigImage()" ng-src="{{Url}}" ng-pinch-zoom/>
+        <i class="ion-ios-trash-outline" ng-click="deleteimage();"></i>
+    </div>
+</ion-view>

+ 45 - 0
platforms/android/assets/www/apps/pay/templates/pay.html

@@ -0,0 +1,45 @@
+<ion-view view-title="报销" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button ion-chevron-left button-clear button-dark" ng-click="goBack()">&nbsp;返回</button>
+    </ion-nav-buttons>
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="toman()" ng-if="roleid==1">管理&nbsp;&nbsp;</button>
+        <button class="button button-clear" ng-click="popover.show($event)">
+            <i class="icon ion-android-add"></i>
+        </button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <a class="item item-icon-right" ng-href="#/billlist/0">我提交的报销单
+            <i class="icon ion-chevron-right icon-accessory"></i>
+            <!--<span class="badge badge-assertive">1</span>-->
+        </a>
+        <a class="item item-icon-right" ng-href="#/billapprove/1">需要我审批的报销单
+            <i class="icon ion-chevron-right icon-accessory"></i>
+            <!--<span class="badge badge-assertive">1</span>-->
+        </a>
+        <a class="item item-icon-right" ng-href="#/billpay/3">需要我支付的报销单
+            <i class="icon ion-chevron-right icon-accessory"></i>
+        </a>
+        <div class="item item-divider">消费记录({{recordlist.results.length}})</div>
+        <ion-list>
+            <div class="item item-icon-left" ng-repeat="record in recordlist.results" ng-click="torecord(record)">
+                <i class="icon icon-style" style="background-color:{{record.type_modal.icon_color}}" ng-class="record.type_modal.icon"></i>{{record.description}}
+                <span class="item-note assertive">¥{{record.amount}}</span>
+                <p>{{record.spend_date | date:'yyyy-MM-dd'}}</p>
+            </div>
+        </ion-list>
+        <ion-infinite-scroll spinner="android" ng-if="moreCanBeLoaded()" on-infinite="loadMore()" distance="1%" immediate-check="false"></ion-infinite-scroll>
+    </ion-content>
+    <script id="templates/paymenu.html" type="text/ng-template">
+        <ion-popover-view ng-class="{'true':'details-popup','false':'popver_view'}[is_have_step]">
+            <ion-content>
+                <ion-list>
+                    <ion-item class="item item-button" ng-click="torecord()">添加消费记录</ion-item>
+                    <ion-item class="item item-button" ng-click="addpaybill()" ng-if="is_have_step">创建报销单</ion-item>
+                    <ion-item class="item item-button" ng-click="toauditstep()">{{is_have_step?"修改审批人":"添加审批步骤"}}</ion-item>
+                </ion-list>
+            </ion-content>
+        </ion-popover-view>
+    </script>
+</ion-view>

+ 85 - 0
platforms/android/assets/www/apps/pay/templates/paybilldetails.html

@@ -0,0 +1,85 @@
+<ion-view view-title="报销单详情">
+    <ion-content>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <div ng-if="!loading">
+            <ion-item class="mission-header item item-avatar " type="item-text-wrap">
+                <img ng-src="../../../img/panda.png" style="">
+                <span class="item-note">{{bill.create_date | date:'MM-dd'}}</span>
+                <h2>{{bill.create_user.username}}</h2>
+                <p>{{bill.create_user.degree}}</p>
+            </ion-item>
+            <div class="item item-text-wrap bill-details-item">
+                {{bill.title}}
+                <p> 报销金额:
+                    <label for="" class="energized">{{bill.total_amount}}元 </label>
+                </p>
+                <p> 备注:
+                    <label for="" class="dark">{{bill.note}}</label>
+                </p>
+                <!--<p style="float:right">报销单号:{{bill.billno}}</p>-->
+            </div>
+            <div class="item item-divider"></div>
+            <ion-item class="item auditemp-box">
+                消费详情
+                <label for="" class="edit-text-label positive">{{bill.record.length}}笔消费</label>
+                <div class="item item-text-wrap bill-record-box">
+                    <div class="item item-icon-left" ng-repeat="rd in bill.record">
+                        <i class="icon icon-style {{rd.type_modal.icon}}" style="background-color:{{rd.type_modal.icon_color}}"></i>{{rd.type_modal.name}}
+                        <span class="item-note ">¥{{rd.amount}}</span>
+                        <p>{{rd.spend_date | date:'yyyy-MM-dd'}}</p>
+                        <p>{{rd.description}}</p>
+                        <!-- <hr> -->
+                    </div>
+                </div>
+                <!--<div class="bill-grant">-->
+                    <!--<p><i class="ion-android-add"></i>&nbsp;补助-->
+                        <!--<la bel class="assertive">¥ {{bill.grant}}</label>-->
+                    <!--</p>-->
+                <!--</div>-->
+            </ion-item>
+            <div class="item item-divider"></div>
+            <ion-item class="item">审批信息
+                <span ng-if="bill.status == 1" class="item-note energized">未支付</span>
+            </ion-item>
+            <section id="cd-timeline" class="cd-container">
+                <div ng-repeat="hs in billhistorydata">
+                    <div class="cd-timeline-block">
+                        <div class="cd-timeline-picture">
+                            <img ng-src={{hs.profilePicture}} />
+                        </div>
+                        <!-- cd-timeline-img -->
+                        <div class="cd-timeline-content">
+                            <h5 class="marginBottom0 marginTop0">
+                                <i class="{{hs.icon}}"></i>
+                                <span ng-class="{true:'task-create-member-p'}[$index == 0 && !bill.verifier.is_teller]">{{hs.title}}</span>
+                                <label class="cd-author">{{hs.date | date: "yyyy年MM月dd日 HH:mm"}}</label>
+                            </h5>
+                            <p class="timelineText">{{hs.text}}</p>
+                        </div>
+                    </div>
+                </div>
+            </section>
+            <button ng-if="user == bill.create_user.id && bill.status == 0 || bill.history.length == 0" class="button button-full button-assertive" ng-click="deleteBill()">撤销</button>
+        </div>
+        <ion-item ng-if="user == bill.verifier.verifier_id || (user == bill.create_user.id && bill.status == 0)" class="item"></ion-item>
+    </ion-content>
+    <ion-footer-bar ng-if="(!bill.status && user == bill.verifier.verifier_id) || (user == bill.create_user.id && bill.status == 0) || (user == bill.verifier.verifier_id && bill.status == 1)">
+        <div class="bar bar-footer" ng-if="user == bill.verifier.verifier_id && !bill.status">
+            <button class="button button-balanced col-40" ng-click="audit(1)">同意</button>
+            <div class="col-20"></div>
+            <button class="button button-energized col-40" ng-click="audit(0)">驳回</button>
+        </div>
+        <div class="bar bar-footer" ng-if="user == bill.create_user.id && bill.status == 0">
+            <div class="col-10"></div>
+            <button class="button button-energized col-80" ng-click="toedit()">已被驳回,请修改报销单</button>
+            <div class="col-10"></div>
+        </div>
+        <div class="bar bar-footer" ng-if="user == bill.verifier.verifier_id && bill.status == 1">
+            <div class="col-10"></div>
+            <button class="button button-balanced col-80" ng-click="audit(2)">标记为已支付</button>
+            <div class="col-10"></div>
+        </div>
+    </ion-footer-bar>
+</ion-view>

+ 19 - 0
platforms/android/assets/www/apps/pay/templates/payman.html

@@ -0,0 +1,19 @@
+<ion-view view-title="报销管理" hide-tabs="true">
+    <ion-content>
+        <div class=" item item-divider"></div>
+        <ion-list>
+            <ion-item class="item item-icon-right" type="item-text-wrap" href="#/typeset">
+                消费类型设置
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <div class="item item-divider dividertext">
+                <label>自定义消费类型,比如:交通、住宿、餐饮...</label>
+            </div>
+            <ion-item class="item item-icon-right" type="item-text-wrap" href="#/auditstepset">
+                审批步骤设置
+                <i class="icon ion-chevron-right icon-accessory"></i>
+            </ion-item>
+            <div class="desctext">设置每个员工的报销审批步骤</div>
+        </ion-list>
+    </ion-content>
+</ion-view>

+ 33 - 0
platforms/android/assets/www/apps/pay/templates/seestepmflist.html

@@ -0,0 +1,33 @@
+<ion-view view-title="同事的报销审批步骤" hide-tabs="true" hide-back-button="true">
+    <ion-nav-buttons side="left">
+        <button class="button button-clear" ng-click="goback()">取消</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher pulling-text="下拉刷新" pulling-icon="ion-ios-arrow-thin-down" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-repeat="step_item in step_datas">
+            <div class=" item item-divider"></div>
+            <ion-item class="stepmfitembox">
+                <ion-item class="item-avatar item stepmfitem">
+                    <img ng-src="../../../img/panda.png"/>
+                    <span>{{step_item.create_user.username}}</span>
+                    <p>{{step_item.create_user.degree}}</p>
+                    <button class="button button-calm" ng-click="usestep(step_item)">使用</button>
+                </ion-item>
+                <div class="item auditstepbox mission-create-member stepmfitemdiv item-text-wrap">
+                    <p>审批步骤:&nbsp;&nbsp;<label for="">{{step_item.step_usernames}}</label></p>
+                    <p>出纳人员:&nbsp;&nbsp;<label for="">{{step_item.teller.username}}</label></p>
+                </div>
+            </ion-item>
+        </div>
+        <!--<ul>-->
+            <!--<li class="h-li">1</li>-->
+            <!--<li class="h-li">2</li>-->
+            <!--<li class="h-li">8</li>-->
+            <!--<li class="h-li active-li">9</li>-->
+            <!--<li class="h-li">10</li>-->
+            <!--<li class="h-li">11</li>-->
+            <!--<li class="h-li">12</li>-->
+            <!--<li class="h-li">13</li>-->
+        <!--</ul>-->
+    </ion-content>
+</ion-view>

+ 23 - 0
platforms/android/assets/www/apps/pay/templates/template-filterbar.html

@@ -0,0 +1,23 @@
+<div class="row item item-row">
+    <div class="col col-33" ng-click="headerclick('L')">
+        {{data["L"][acitve_indexs['L']].name}}&nbsp;&nbsp;<i ng-class="{false:'ion-android-arrow-dropdown',true:'ion-android-arrow-dropup updown-color'}[key=='L'&&!Ishidded]"></i>
+    </div>
+    <label class="v-line">|</label>
+    <div class="col col-33" ng-click="headerclick('C');">
+        {{data["C"][acitve_indexs['C']].name}}&nbsp;&nbsp;<i ng-class="{false:'ion-android-arrow-dropdown',true:'ion-android-arrow-dropup updown-color'}[key=='C'&&!Ishidded]"></i>
+    </div>
+    <label class="v-line">|</label>
+    <div class="col col-33" ng-click="headerclick('R');">
+        {{right_title}}&nbsp;&nbsp;<i ng-class="{false:'ion-android-arrow-dropdown',true:'ion-android-arrow-dropup updown-color'}[key=='R'&&!Ishidded]"></i>
+    </div>
+</div>
+<div style="overflow-y: scroll" class="select-div" ng-class="{true:'hidden-item',false:''}[Ishidded]">
+    <ul class="list" ng-class="{true:'hidden-item',false:''}[headerion.leftion]">
+        <li class="item-sort">
+            <ion-radio ng-model="item.check" ng-value="true" ng-repeat="item in data[key]" ng-click="selectclick(item,$index)">
+                {{item.name}}
+            </ion-radio>
+        </li>
+    </ul>
+</div>
+<div class="select-back" ng-class="{true:'hidden-item',false:''}[Ishidded]" ng-click="Ishidded=true"></div>

+ 13 - 0
platforms/android/assets/www/apps/pay/templates/template-payBillList.html

@@ -0,0 +1,13 @@
+<div class="item" ng-if="!loading" ng-repeat="bill in bills" ng-click="todetails(bill.id)">
+    {{bill.title}}
+    <span class="item-note">{{bill.create_date | date:'MM-dd'}}</span>
+    <p> {{bill.create_user.username}}:报销¥{{bill.total_amount}} </p>
+    <p class="task-create-member-p"> 状态:
+        {{bill.status == 0 ? '已驳回' : bill.verifier.is_teller ? null : bill.verifier.verifier__username}}
+        {{bill.status != 0 ? !bill.verifier.is_teller ? '正在审核中' : '审批完成' : null}}
+        <label for="" class="assertive float-right">
+            {{bill.status==1?'未支付':null}}
+            {{bill.status==2?'已支付':null}}
+        </label>
+    </p>
+</div>

+ 22 - 0
platforms/android/assets/www/apps/pay/templates/typeset.html

@@ -0,0 +1,22 @@
+<ion-view view-title="消费类型设置">
+    <ion-nav-buttons side="right">
+        <button class="button button-clear" ng-click="ok()">{{ordering ?'完成':'排序'}}</button>
+    </ion-nav-buttons>
+    <ion-content>
+        <ion-refresher ng-if="!ordering" pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
+        <div ng-if="loading" class="center init-load action-sheet-backdrop">
+            <ion-spinner icon="android"></ion-spinner>
+        </div>
+        <ion-list ng-if="!loading" show-reorder="ordering" can-swipe="true" class="typelist">
+            <ion-item class="item item-icon-left" ng-repeat="type in types" ng-click="toedittype(type)">
+                <i class="icon" ng-class="type.icon" style="color:{{type.icon_color}}"></i>
+                <h2>{{type.name}}<i class="ion-edit ion-ios-compose-outline positive"></i></h2>
+                <ion-reorder-button class="ion-navicon" on-reorder="reorderItem(type, $fromIndex, $toIndex)">
+                </ion-reorder-button>
+            </ion-item>
+        </ion-list>
+    </ion-content>
+    <div class="calm bar bar-footer footer" ng-click="toaddtype();">
+        <div class="title">添加消费类型&nbsp;<i class="ion-plus"></i></div>
+    </div>
+</ion-view>

+ 52 - 0
platforms/android/assets/www/apps/process/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="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.min.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">
+        返回
+    </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>
+

+ 122 - 0
platforms/android/assets/www/apps/process/js/controllers.js

@@ -0,0 +1,122 @@
+starter.controller('ProcessCtrl', function ($scope, $state) {
+    $scope.toman = function () {
+        $state.go('process-manage');
+    }
+    $scope.toapply = function () {
+        $state.go('process-apply');
+    }
+})
+
+.controller('ProcessManageCtrl', function ($scope) {
+
+})
+
+.controller('ProcessApplyCtrl', function ($scope) {
+
+})
+
+.controller('ProcessCreateCtrl', function ($scope, $stateParams, $state, $ionicSlideBoxDelegate, $ionicHistory, Process) {
+    $scope.datatext = {
+        leftbtn: [{
+            text: '取消',
+            click: "cancel",
+            params: "c"
+        }, {
+            text: '上一步',
+            click: 'back'
+        }],
+        rightbtn: [{
+            text: '下一步',
+            click: 'down'
+        }, {
+            text: '完成',
+            click: 'ok'
+        }]
+    };
+    $scope.titleName = ['填写流程名称', '选择流程模板', '创建审批人步骤', '添加流程介绍'];
+    $scope.leftIndex = 0;
+    $scope.rightIndex = 0;
+    $scope.activeIndex = 0;
+
+    //下一步
+    $scope.down = function () {
+        $ionicSlideBoxDelegate.next();
+        console.log($ionicSlideBoxDelegate.currentIndex());
+        $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
+        if ($scope.activeIndex >= 1) {
+            $scope.leftIndex = 1;
+            $scope.rightIndex = 0;
+            if ($scope.activeIndex == 3) {
+                $scope.rightIndex = 1;
+            }
+        } else {
+            $scope.leftIndex = 0;
+            $scope.rightIndex = 1;
+        }
+    };
+
+    $scope.cancel = function (op) {
+        $ionicHistory.goBack();
+    };
+
+    $scope.back = function () {
+        if ($scope.activeIndex != 0) {
+            $ionicSlideBoxDelegate.previous();
+            $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
+            $scope.rightIndex = 0;
+            if ($scope.activeIndex == 0) {
+                $scope.leftIndex = 0;
+            }
+        } else {
+            $ionicHistory.goBack();
+        }
+    };
+
+    $scope.lockSlide = function () {
+        $ionicSlideBoxDelegate.enableSlide(false);
+    };
+
+    $scope.setitems = [{
+        id: 1,
+        show: false
+    }, {
+        id: 2,
+        show: false
+    }, {
+        id: 3,
+        show: false
+    }, {
+        id: 4,
+        show: false
+    }, {
+        id: 5,
+        show: true
+    }];
+
+    $scope.checkmoban = function (op) {
+        var items = _.filter($scope.setitems, function (_item) {
+            return _item.id == parseInt(op);
+        });
+        if (!items[0].show) {
+            items[0].show = true;
+        }
+        _.each($scope.setitems, function (_item) {
+            if (_item.id != parseInt(op)) {
+                _item.show = false;
+            }
+        });
+    };
+
+    $scope.toSetItem = function () {
+        $state.go('process-setfielditem', {
+            id: -1
+        });
+    };
+
+})
+
+.controller('ProcessSetFieldItemCtrl', function ($scope, $ionicHistory) {
+    $scope.cancel = function () {
+        $ionicHistory.goBack();
+    };
+});

Some files were not shown because too many files changed in this diff