index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <page-meta root-font-size="system" />
  3. <view class="work-container">
  4. <!-- 宫格组件 -->
  5. <view v-if="processList.fList.length != 0">
  6. <uni-section :title="processList.ftypeList[0].typeName" titleFontSize="1.3rem" type="line"></uni-section>
  7. <view class="grid-body">
  8. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeProcessGrid">
  9. <uni-grid-item v-for="(item, index) in processList.fList" :index="index" :key="index">
  10. <view class="grid-item-box">
  11. <text class="ygoa-icon"
  12. :class="item.modelPicture == 'default.png' ? 'icon-outsourcing' : item.modelPicture"></text>
  13. <text class="text">{{ item.modelName }}</text>
  14. </view>
  15. </uni-grid-item>
  16. </uni-grid>
  17. </view>
  18. </view>
  19. <uni-section title="考勤管理" titleFontSize="1.3rem" type="line"></uni-section>
  20. <view class="grid-body">
  21. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeAttendanceGrid">
  22. <uni-grid-item :index="1">
  23. <view class="grid-item-box">
  24. <text class="ygoa-icon icon-checkIn"></text>
  25. <text class="text">考勤</text>
  26. </view>
  27. </uni-grid-item>
  28. <uni-grid-item :index="2">
  29. <view class="grid-item-box">
  30. <text class="ygoa-icon icon-location"></text>
  31. <text class="text">打卡</text>
  32. </view>
  33. </uni-grid-item>
  34. </uni-grid>
  35. </view>
  36. <uni-section title="日报周报" titleFontSize="1.3rem" type="line"></uni-section>
  37. <view class="grid-body">
  38. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeDiaryGrid">
  39. <uni-grid-item :index="1">
  40. <view class="grid-item-box">
  41. <text class="ygoa-icon icon-diary"></text>
  42. <text class="text">日报</text>
  43. </view>
  44. </uni-grid-item>
  45. <!-- <uni-grid-item :index="2">
  46. <view class="grid-item-box">
  47. <text class="ygoa-icon icon-diary"></text>
  48. <text class="text">日报</text>
  49. </view>
  50. </uni-grid-item> -->
  51. </uni-grid>
  52. </view>
  53. <uni-section title="系统工具" titleFontSize="1.3rem" type="line"></uni-section>
  54. <view class="grid-body">
  55. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeToolsGrid">
  56. <uni-grid-item :index="1">
  57. <view class="grid-item-box">
  58. <text class="ygoa-icon icon-calculator"></text>
  59. <text class="text">计算器</text>
  60. </view>
  61. </uni-grid-item>
  62. <uni-grid-item :index="2">
  63. <view class="grid-item-box">
  64. <text class="ygoa-icon icon-clear-cache"></text>
  65. <text class="text">清除缓存</text>
  66. </view>
  67. </uni-grid-item>
  68. </uni-grid>
  69. </view>
  70. <!-- 计算器弹出层 -->
  71. <view class="popup_container">
  72. <cui-calculator ref="calculatorPopup" size="normal"></cui-calculator>
  73. </view>
  74. <!-- 清除缓存弹出层 -->
  75. <!-- <view class="clear_cache_popup_container">
  76. <uni-popup ref="clearCacheDialog" type="dialog">
  77. <uni-popup-dialog title="确认清除缓存" @confirm="clearCache"></uni-popup-dialog>
  78. </uni-popup>
  79. </view> -->
  80. </view>
  81. </template>
  82. <script setup lang="ts">
  83. import cuiCalculator from "@/components/cui-calculator/cui-calculator.vue"
  84. import { onMounted, ref } from "vue"
  85. import $tab from "@/plugins/tab.js"
  86. import { useUserStore } from '@/store/user.js'
  87. import { getProcessList } from '@/api/work.js'
  88. import { clearCache } from '@/utils/ygoa.js'
  89. import { onShow } from '@dcloudio/uni-app'
  90. const userStore = useUserStore()
  91. let sysFontSize = 0
  92. const uni_grid_column = ref(4)
  93. onMounted(() => {
  94. sysFontSize = uni.getAppBaseInfo().fontSizeSetting
  95. if (sysFontSize > 20) uni_grid_column.value = 3
  96. initProcessList()
  97. })
  98. onShow(()=>{
  99. uni.$emit('showTabBarBadge')
  100. })
  101. // 流程列表
  102. const processList = ref({
  103. fList: [],
  104. ftypeList: [
  105. {
  106. typeName: ''
  107. }
  108. ],
  109. })
  110. // 获取流程宫格数据
  111. function initProcessList() {
  112. const staffId = userStore.user.useId
  113. const unitId = userStore.user.unitId
  114. getProcessList(staffId, unitId).then(res => {
  115. processList.value = res.returnParams // 设置processList
  116. })
  117. }
  118. // 点击流程宫格
  119. function changeProcessGrid(e) {
  120. // console.log('changeProcessGrid', e);
  121. const { modelName, modelId, control } = processList.value.fList[e.detail.index]
  122. // 跳转流程申请页面
  123. $tab.navigateTo('/pages/work/edit/index?modelName=' + modelName + '&modelId=' + modelId + '&control=' + control)
  124. }
  125. // 点击考勤宫格
  126. function changeAttendanceGrid(e) {
  127. if (1 == e.detail.index) { // 考勤
  128. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  129. }
  130. if (2 == e.detail.index) { // 打卡
  131. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  132. }
  133. }
  134. // 点击日报宫格
  135. function changeDiaryGrid(e) {
  136. if (1 == e.detail.index) {
  137. wx.navigateToMiniProgram({
  138. appId: 'wxd45c635d754dbf59',
  139. path: `pages/detail/detail?url=https://docs.qq.com/sheet/DZndGYU5aWVBpR1Nm`
  140. })
  141. // wx.navigateToMiniProgram({
  142. // appId: 'wxde4bf149a4c88707',
  143. // path: `pages/login`
  144. // })
  145. return
  146. }
  147. if (2 == e.detail.index) {
  148. $tab.navigateTo('/pages/work/diary/index')
  149. return
  150. }
  151. }
  152. // 点击工具宫格
  153. function changeToolsGrid(e) {
  154. switch (e.detail.index) {
  155. case 1:
  156. openCalculatorPopup() // 打开计算器弹出层
  157. break
  158. case 2:
  159. clearCache()
  160. // openClearCachePopup() // 打开清除缓存弹出层
  161. break
  162. default:
  163. }
  164. }
  165. // 计算器
  166. const calculatorPopup = ref(null)
  167. function openCalculatorPopup() { // 打开计算器弹出层
  168. calculatorPopup.value.open()
  169. }
  170. // 清除缓存
  171. // const clearCacheDialog = ref(null)
  172. // function openClearCachePopup() { // 打开清除缓存弹出层
  173. // clearCacheDialog.value.open()
  174. // }
  175. // const userStore = useUserStore()
  176. </script>
  177. <style lang="scss">
  178. // @import "@/static/font/ygoa/iconfont.css";
  179. .ygoa-icon {
  180. font-size: calc(80rpx + 1.5*(1rem - 16px));
  181. }
  182. /* #ifndef APP-NVUE */
  183. page {
  184. display: flex;
  185. flex-direction: column;
  186. box-sizing: border-box;
  187. background-color: #fff;
  188. min-height: 100%;
  189. height: auto;
  190. }
  191. view {
  192. font-size: calc(14px + 1.5*(1rem - 16px));
  193. line-height: inherit;
  194. }
  195. /* #endif */
  196. .text {
  197. text-align: center;
  198. font-size: calc(26rpx + 1.5*(1rem - 16px));
  199. margin-top: 10rpx;
  200. }
  201. .work-container {
  202. .grid-item-box {
  203. flex: 1;
  204. /* #ifndef APP-NVUE */
  205. display: flex;
  206. /* #endif */
  207. flex-direction: column;
  208. align-items: center;
  209. justify-content: center;
  210. padding: 15px 0;
  211. }
  212. // .uni-margin-wrap {
  213. // width: 690rpx;
  214. // width: 100%;
  215. // }
  216. .swiper {
  217. height: 300rpx;
  218. }
  219. .swiper-box {
  220. height: 150px;
  221. }
  222. .swiper-item {
  223. /* #ifndef APP-NVUE */
  224. display: flex;
  225. /* #endif */
  226. flex-direction: column;
  227. justify-content: center;
  228. align-items: center;
  229. color: #fff;
  230. height: 300rpx;
  231. line-height: 300rpx;
  232. }
  233. @media screen and (min-width: 500px) {
  234. .uni-swiper-dot-box {
  235. width: 400px;
  236. /* #ifndef APP-NVUE */
  237. margin: 0 auto;
  238. /* #endif */
  239. margin-top: 8px;
  240. }
  241. .image {
  242. width: 100%;
  243. }
  244. }
  245. }
  246. </style>