index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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" :key="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. // 流程列表
  129. const processList = ref({
  130. fList: [],
  131. ftypeList: [
  132. {
  133. typeName: ''
  134. }
  135. ],
  136. })
  137. // 获取流程宫格数据
  138. function initProcessList() {
  139. const staffId = userStore.user.useId
  140. const unitId = userStore.user.unitId
  141. getProcessList(staffId, unitId).then(res => {
  142. processList.value = res.returnParams // 设置processList
  143. })
  144. }
  145. // 点击流程宫格
  146. function changeProcessGrid(e) {
  147. console.log('changeProcessGrid', e);
  148. const { modelName, modelId, control } = processList.value.fList[e.detail.index]
  149. // 跳转流程申请页面
  150. $tab.navigateTo('/pages/work/edit/index?modelName=' + modelName + '&modelId=' + modelId + '&control=' + control)
  151. }
  152. // 点击考勤宫格
  153. function changeAttendanceGrid(e) {
  154. if (1 == e.detail.index) { // 考勤
  155. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  156. }
  157. if (2 == e.detail.index) { // 打卡
  158. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  159. }
  160. }
  161. // 点击日报宫格
  162. function changeDiaryGrid(e) {
  163. if (1 == e.detail.index) {
  164. wx.navigateToMiniProgram({
  165. appId: 'wxd45c635d754dbf59',
  166. path: `pages/detail/detail?url=https://docs.qq.com/sheet/DZndGYU5aWVBpR1Nm`
  167. })
  168. return
  169. }
  170. if (2 == e.detail.index) {
  171. $tab.navigateTo('/pages/work/diary/index')
  172. return
  173. }
  174. }
  175. // 点击工具宫格
  176. function changeToolsGrid(e) {
  177. switch (e.detail.index) {
  178. case 1:
  179. openCalculatorPopup() // 打开计算器弹出层
  180. break
  181. case 2:
  182. openClearCachePopup() // 打开清除缓存弹出层
  183. break
  184. default:
  185. }
  186. }
  187. // 计算器
  188. const calculatorPopup = ref(null)
  189. function openCalculatorPopup() { // 打开计算器弹出层
  190. calculatorPopup.value.open()
  191. }
  192. // 清除缓存
  193. const clearCacheDialog = ref(null)
  194. function openClearCachePopup() { // 打开清除缓存弹出层
  195. clearCacheDialog.value.open()
  196. }
  197. // const userStore = useUserStore()
  198. function clearCache() {
  199. const userInfo = getUserInfo()
  200. uni.clearStorageSync();
  201. uni.setStorageSync('userInfo', userInfo)
  202. userStore.user = userInfo
  203. userStore.useId = userInfo.useId
  204. // 提示用户缓存清理成功
  205. uni.showToast({
  206. title: '缓存清理成功',
  207. icon: 'success',
  208. duration: 2000
  209. });
  210. }
  211. </script>
  212. <style lang="scss">
  213. @import "@/static/font/ygoa/iconfont.css";
  214. .ygoa-icon {
  215. font-size: 80rpx;
  216. // color: #468bf0;
  217. }
  218. /* #ifndef APP-NVUE */
  219. page {
  220. display: flex;
  221. flex-direction: column;
  222. box-sizing: border-box;
  223. background-color: #fff;
  224. min-height: 100%;
  225. height: auto;
  226. }
  227. view {
  228. font-size: 14px;
  229. line-height: inherit;
  230. }
  231. /* #endif */
  232. .text {
  233. text-align: center;
  234. font-size: 26rpx;
  235. margin-top: 10rpx;
  236. }
  237. .grid-item-box {
  238. flex: 1;
  239. /* #ifndef APP-NVUE */
  240. display: flex;
  241. /* #endif */
  242. flex-direction: column;
  243. align-items: center;
  244. justify-content: center;
  245. padding: 15px 0;
  246. }
  247. .uni-margin-wrap {
  248. width: 690rpx;
  249. width: 100%;
  250. ;
  251. }
  252. .swiper {
  253. height: 300rpx;
  254. }
  255. .swiper-box {
  256. height: 150px;
  257. }
  258. .swiper-item {
  259. /* #ifndef APP-NVUE */
  260. display: flex;
  261. /* #endif */
  262. flex-direction: column;
  263. justify-content: center;
  264. align-items: center;
  265. color: #fff;
  266. height: 300rpx;
  267. line-height: 300rpx;
  268. }
  269. @media screen and (min-width: 500px) {
  270. .uni-swiper-dot-box {
  271. width: 400px;
  272. /* #ifndef APP-NVUE */
  273. margin: 0 auto;
  274. /* #endif */
  275. margin-top: 8px;
  276. }
  277. .image {
  278. width: 100%;
  279. }
  280. }
  281. </style>