index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <u-navbar :autoBack="false" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
  3. <template #left>
  4. <u-icon name="arrow-left" size="20" color="#fff" @click="returnTo('index')"></u-icon>
  5. </template>
  6. <template #center>
  7. <text class="grid-area_center_item_title" style="color: #fff;">我的申请</text>
  8. </template>
  9. </u-navbar>
  10. <oa-scroll
  11. customClass="scroll-height"
  12. :customStyle="{ height: `calc(100vh - (104px + ${proxy.$settingStore.StatusBarHeight} + ${proxy.$settingStore.tabBarHeight}))` }"
  13. :refresherLoad="false"
  14. :refresherEnabled="true"
  15. :refresherEnabledTitle="false"
  16. :refresherDefaultStyle="'none'"
  17. :refresherThreshold="44"
  18. :refresherBackground="'#f5f6f7'"
  19. @refresh="refresh"
  20. >
  21. <template #default>
  22. <view class="home-container">
  23. <!-- 我的宫格 -->
  24. <view class="grid-area bg-white">
  25. <view class="grid-area_center cu-list grid col-4 no-border">
  26. <view class="grid-area_center_item cu-item justify-center align-center" @click="navItemClick(1)">
  27. <text class="grid-area_center_item_num">{{ state.statistics.pendingSum }}</text>
  28. <text class="grid-area_center_item_title">待处理</text>
  29. </view>
  30. <view class="grid-area_center_item cu-item justify-center align-center" @click="navItemClick(2)">
  31. <text class="grid-area_center_item_num">{{ state.statistics.alreadySum }}</text>
  32. <text class="grid-area_center_item_title">已处理</text>
  33. </view>
  34. <view class="grid-area_center_item cu-item justify-center align-center" style="cursor: not-allowed;">
  35. <text class="grid-area_center_item_num">{{ state.statistics.myInitiated }}</text>
  36. <text class="grid-area_center_item_title">已发起</text>
  37. </view>
  38. <view class="grid-area_center_item cu-item justify-center align-center" @click="navItemClick(3)">
  39. <text class="grid-area_center_item_num">{{ state.statistics.myReceived }}</text>
  40. <text class="grid-area_center_item_title">我收到的</text>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 我的宫格 -->
  45. <view class="grid-area bg-white" v-if="state.formList.length > 0">
  46. <view class="grid-area_title">我的</view>
  47. <u-icon class="grid-area_icon" name="arrow-down" color="#000" size="18" @click="splitNum(0,5)" v-if="state.appContent[0].direction == '0'"></u-icon>
  48. <u-icon class="grid-area_icon" name="arrow-up" color="#000" size="18" @click="splitNum(0,5)" v-if="state.appContent[0].direction == '1'"></u-icon>
  49. <view class="grid-area_center cu-list grid col-5 no-border" >
  50. <view class="grid-area_center_item cu-item align-center" v-for="(item, index) in state.appContent[0].array" :key="index" @click="toForm(item.formSign)">
  51. <image class="grid-area_center_item_image" :src="item.icon"></image>
  52. <text class="grid-area_center_item_title" >{{ item.formName }}</text>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 常用功能宫格 -->
  57. <!-- <view class="grid-area bg-white">
  58. <view class="grid-area_title">人事功能</view>
  59. <view class="grid-area_center cu-list grid col-5 no-border">
  60. <view class="grid-area_center_item cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in state.cuIconList" :key="index">
  61. <image class="grid-area_center_item_image" :src="item.meta.icon"></image>
  62. <text class="grid-area_center_item_title">{{ item.meta.aliasTitle ? item.meta.aliasTitle : item.meta.title }}</text>
  63. </view>
  64. </view>
  65. </view> -->
  66. </view>
  67. </template>
  68. </oa-scroll>
  69. <oa-tabbar :tabbarValue="0" :tabbarList="proxy.$constData.oaApprovalTabbar" :isSwitchTab="false"></oa-tabbar>
  70. </template>
  71. <script setup>
  72. /*----------------------------------依赖引入-----------------------------------*/
  73. import { onReady, onLoad, onShow, onNavigationBarButtonTap, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
  74. import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs, nextTick } from "vue";
  75. /*----------------------------------接口引入-----------------------------------*/
  76. import { scan_push, getHomePageData, getFunctionalModuleStatistics, getAppRouters, qrCodeSend, getMobileBanner } from "@/api/index";
  77. import { getOaFormDefinition, getFormCount } from "@/api/oa/approval/index";
  78. /*----------------------------------组件引入-----------------------------------*/
  79. /*----------------------------------store引入-----------------------------------*/
  80. import { useStores } from "@/store/modules/index";
  81. /*----------------------------------公共方法引入-----------------------------------*/
  82. import * as jwx from "@/utils/jssdk.js"; //引入js sdk的封装
  83. import { getToken, setToken, removeToken } from "@/utils/auth";
  84. import { storage, storageSystem } from "@/utils/storage"; // 公共方法引用
  85. /*----------------------------------公共变量-----------------------------------*/
  86. const { proxy } = getCurrentInstance();
  87. const useStore = useStores();
  88. /*----------------------------------变量声明-----------------------------------*/
  89. const state = reactive({
  90. dialogFlag: false,
  91. swiperBool: false,
  92. swiperIndex: 0,
  93. swiperTime: 5000,
  94. swiperList: [],
  95. cuIconList: [],
  96. recentlyUsed: [],
  97. formList:[],
  98. appContent:[
  99. {name:"my",array:[],direction:"0"},//我的app
  100. ],
  101. statistics:{
  102. "pendingSum": 0,
  103. "alreadySum": 0,
  104. "myInitiated": 0,
  105. "myReceived": 0
  106. },//头部统计
  107. });
  108. const { dialogFlag, formList, statistics,appContent } = toRefs(state);
  109. function init(){
  110. getFormList(); //获取表单列表数据
  111. getStatistics();//获取头部统计
  112. }
  113. /**
  114. * @scrollView刷新数据
  115. */
  116. function refresh() {
  117. getAppRoutersData(); //调用路由信息接口
  118. }
  119. /**
  120. * 表单权限列表
  121. */
  122. function getFormList(){
  123. getOaFormDefinition().then((res) => {
  124. state.formList = res.data;
  125. for(let i=0;i<state.formList.length;i++){
  126. state.formList[i].icon = proxy.$common.getAssetsFile(`images/oa/${state.formList[i].formImage}.png`);
  127. }
  128. state.appContent[0].array = state.formList
  129. })
  130. }
  131. function getStatistics(){
  132. getFormCount().then((res)=>{
  133. state.statistics = res.data
  134. })
  135. }
  136. /**
  137. * 返回上级页面
  138. * @param defaultPage 默认页面
  139. */
  140. function returnTo(defaultPage) {
  141. if(getCurrentPages().length > 1){
  142. uni.navigateBack()
  143. }else{
  144. uni.switchTab({
  145. url: `/pages/${defaultPage}`
  146. })
  147. }
  148. }
  149. /**
  150. * 跳转表单模版
  151. */
  152. function toForm(formSign){
  153. if(formSign == "QJD"){
  154. uni.navigateTo({
  155. url: `/pages/business/oa/approval/formType?formSign=${formSign}`
  156. })
  157. }
  158. }
  159. function navItemClick(index){
  160. uni.navigateTo({
  161. url: `/pages/business/oa/toDo/index?queryType=${index}`
  162. })
  163. }
  164. /**
  165. *
  166. * @param sub 数组下标
  167. * @param num 显示数量
  168. */
  169. function splitNum(sub,num) {
  170. state.appContent[sub].array = state.appContent[sub].direction == "0" ? state.formList.slice(0, num) : state.formList
  171. state.appContent[sub].direction = state.appContent[sub].direction == "0" ? 1 : "0"
  172. }
  173. /**
  174. * @获取路由信息
  175. * @api接口请求
  176. */
  177. function getAppRoutersData() {
  178. getAppRouters().then((res) => {
  179. state.cuIconList = res.data;
  180. storageSystem.set("homeList", state);
  181. });
  182. }
  183. onShow(() => {
  184. init()
  185. });
  186. </script>
  187. <style lang="scss" scoped>
  188. .home-container {
  189. font-family: "Alibaba_PuHuiTi_Regular";
  190. .transition {
  191. position: fixed;
  192. top: 0;
  193. left: 0;
  194. right: 0;
  195. bottom: 0;
  196. z-index: 1100;
  197. &-section {
  198. position: absolute;
  199. top: 10px;
  200. right: 15px;
  201. background-color: #fff;
  202. border-radius: 10px;
  203. box-shadow: 0px 0px 15px 0 rgba(0, 0, 0, 0.2);
  204. &-divider {
  205. border-bottom: 0.5px rgba(0, 0, 0, 0.1) solid;
  206. margin: 0 20px;
  207. }
  208. &-content {
  209. display: flex;
  210. padding: 15px 20px;
  211. &-icon {
  212. font-size: 18px;
  213. color: #000;
  214. }
  215. &-text {
  216. margin: 0 20px;
  217. }
  218. }
  219. &-content:first-child {
  220. padding-top: 15px;
  221. border-radius: 10px 10px 0 0;
  222. }
  223. &-content:last-child {
  224. padding-bottom: 15px;
  225. border-radius: 0 0 10px 10px;
  226. }
  227. &-content:hover {
  228. // transform: 3s;
  229. // transition: all 600ms cubic-bezier(0.3, 1, 0.2, 1);
  230. transition: all 3s cubic-bezier(0.7, -0.5, 0.2, 2);
  231. background-color: rgba(0, 0, 0, 0.1);
  232. }
  233. }
  234. }
  235. .grid-area {
  236. margin-top: 10px;
  237. width:calc(100% - 20px);
  238. margin-left:10px;
  239. border-radius: 6px;
  240. position: relative;
  241. &_title {
  242. padding: 10px 10px 5px 10px;
  243. color: #000000;
  244. font-size: $uni-font-size-base;
  245. }
  246. &_icon {
  247. position: absolute;
  248. right: 10px;
  249. top:10px;
  250. }
  251. &_center {
  252. border-radius: 6px;
  253. color:#000;
  254. &_item {
  255. &_image {
  256. width: 40px;
  257. height: 40px;
  258. }
  259. &_title {
  260. font-size: $uni-font-size-sm;
  261. word-wrap: break-word;
  262. max-width: 60px;
  263. text-align: center;
  264. }
  265. &_num {
  266. font-size: 16px;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. .topReturn{
  273. width:100%;
  274. height:44px;
  275. line-height: 44px;
  276. }
  277. </style>