index.vue 7.5 KB

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