index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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_work_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. <view v-if="diaryShow">
  37. <uni-section title="日报周报" titleFontSize="1.3rem" type="line"></uni-section>
  38. <view class="grid-body">
  39. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeDiaryGrid">
  40. <uni-grid-item :index="1">
  41. <view class="grid-item-box">
  42. <text class="ygoa-icon icon-diary"></text>
  43. <text class="text">日报</text>
  44. </view>
  45. </uni-grid-item>
  46. <!-- <uni-grid-item :index="2">
  47. <view class="grid-item-box">
  48. <text class="ygoa-icon icon-diary"></text>
  49. <text class="text">日报</text>
  50. </view>
  51. </uni-grid-item> -->
  52. </uni-grid>
  53. </view>
  54. </view>
  55. <uni-section title="系统工具" titleFontSize="1.3rem" type="line"></uni-section>
  56. <view class="grid-body">
  57. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeToolsGrid">
  58. <uni-grid-item :index="1">
  59. <view class="grid-item-box">
  60. <text class="ygoa_icon icon-calculator"></text>
  61. <text class="text">计算器</text>
  62. </view>
  63. </uni-grid-item>
  64. <uni-grid-item :index="2">
  65. <view class="grid-item-box">
  66. <text class="ygoa_icon icon-clear-cache"></text>
  67. <text class="text">清除缓存</text>
  68. </view>
  69. </uni-grid-item>
  70. </uni-grid>
  71. </view>
  72. <uni-section title="房屋管家" titleFontSize="1.3rem" v-if="homesysShow" type="line"></uni-section>
  73. <view class="grid-body" v-if="homesysShow">
  74. <uni-grid :column="uni_grid_column" :showBorder="false" @change="changeHomesys">
  75. <uni-grid-item v-for="(home, index) in homesysList" :index="index" v-if="homesysShow" :key="index">
  76. <view class="grid-item-box">
  77. <text class="ygoa_work_icon icon-zhinengjiaju"></text>
  78. <text class="text">
  79. {{ home.room_name || home.room_url.split('/').pop() }}
  80. </text>
  81. </view>
  82. </uni-grid-item>
  83. <uni-grid-item :index="homesysList.length + 1" v-if="userStore.user.userName == 'yzadmin'">
  84. <view class="grid-item-box">
  85. <text class="ygoa_work_icon icon-zhinengjiaju"></text>
  86. <text class="text">房屋管理</text>
  87. </view>
  88. </uni-grid-item>
  89. <!-- <uni-grid-item :index="homesysList.length + 2" v-if="userStore.user.userName == 'yzadmin'">
  90. <view class="grid-item-box">
  91. <text class="ygoa_work_icon icon-zhinengjiaju"></text>
  92. <text class="text">用户管理</text>
  93. </view>
  94. </uni-grid-item> -->
  95. <uni-grid-item :index="homesysList.length + 3" v-if="userStore.user.userName == 'yzadmin'">
  96. <view class="grid-item-box">
  97. <text class="ygoa_work_icon icon-zhinengjiaju"></text>
  98. <text class="text">用户管理</text>
  99. </view>
  100. </uni-grid-item>
  101. </uni-grid>
  102. </view>
  103. <!-- 计算器弹出层 -->
  104. <view class="popup_container">
  105. <cui-calculator ref="calculatorPopup" size="normal"></cui-calculator>
  106. </view>
  107. <!-- 清除缓存弹出层 -->
  108. <!-- <view class="clear_cache_popup_container">
  109. <uni-popup ref="clearCacheDialog" type="dialog">
  110. <uni-popup-dialog title="确认清除缓存" @confirm="clearCache"></uni-popup-dialog>
  111. </uni-popup>
  112. </view> -->
  113. </view>
  114. </template>
  115. <script setup lang="ts">
  116. import cuiCalculator from "@/components/cui-calculator/cui-calculator.vue"
  117. import { onMounted, ref } from "vue"
  118. import $tab from "@/plugins/tab.js"
  119. import { useUserStore } from '@/store/user.js'
  120. import { getProcessList, roomUserLogin, getUserRoomByUser } from '@/api/work.js'
  121. import { clearCache } from '@/utils/ygoa.js'
  122. import { onShow } from '@dcloudio/uni-app'
  123. import config from '@/config.js';
  124. const userStore = useUserStore()
  125. let sysFontSize = 0
  126. const uni_grid_column = ref(4)
  127. const diaryShow = ref(false)
  128. if(config.companyCode && config.companyCode == 'yg'){
  129. diaryShow.value = true;
  130. }else{
  131. diaryShow.value = false;
  132. }
  133. const homesysShow = ref(false)
  134. const homesysList = ref([])
  135. function getUserRoom() {
  136. getUserRoomByUser(userStore.user.userName).then((res) => {
  137. console.log('getUserRoomByUser', res)
  138. const hasRoom = res.length != 0
  139. if (hasRoom) {
  140. homesysList.value = res
  141. homesysShow.value = true
  142. console.log('getUserRoomByUser', homesysList.value)
  143. }
  144. })
  145. }
  146. // 点击房屋管家
  147. function changeHomesys(e) {
  148. const roomIndex = e.detail.index
  149. const roomListLength = homesysList.value.length
  150. // if (roomIndex > roomListLength) {
  151. switch (roomIndex) {
  152. case roomListLength + 1:
  153. $tab.navigateTo('/pages/work/homesysSetting/index')
  154. break
  155. case roomListLength + 2:
  156. $tab.navigateTo('/pages/work/homesysSetting/user')
  157. break
  158. case roomListLength + 3:
  159. $tab.navigateTo('/pages/work/homesysSetting/userList')
  160. break
  161. default:
  162. $tab.navigateTo('/pages/work/homesys/index?homeCode=' + homesysList.value[roomIndex].room_url)
  163. }
  164. // } else {
  165. // $tab.navigateTo('/pages/work/homesys/index?homeCode=' + homesysList.value[roomIndex].room_url)
  166. // }
  167. }
  168. onMounted(() => {
  169. getUserRoom()
  170. })
  171. onMounted(() => {
  172. sysFontSize = uni.getAppBaseInfo().fontSizeSetting
  173. if (sysFontSize > 20) uni_grid_column.value = 3
  174. initProcessList()
  175. })
  176. onShow(()=>{
  177. uni.$emit('showTabBarBadge')
  178. })
  179. // 流程列表
  180. const processList = ref({
  181. fList: [],
  182. ftypeList: [
  183. {
  184. typeName: ''
  185. }
  186. ],
  187. })
  188. // 获取流程宫格数据
  189. function initProcessList() {
  190. const staffId = userStore.user.useId
  191. const unitId = userStore.user.unitId
  192. getProcessList(staffId, unitId).then(res => {
  193. processList.value = res.returnParams // 设置processList
  194. })
  195. }
  196. // 点击流程宫格
  197. function changeProcessGrid(e) {
  198. // console.log('changeProcessGrid', e);
  199. const { modelName, modelId, control } = processList.value.fList[e.detail.index]
  200. // 跳转流程申请页面
  201. $tab.navigateTo('/pages/work/edit/index?modelName=' + modelName + '&modelId=' + modelId + '&control=' + control)
  202. }
  203. // 点击考勤宫格
  204. function changeAttendanceGrid(e) {
  205. if (1 == e.detail.index) { // 考勤
  206. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  207. }
  208. if (2 == e.detail.index) { // 打卡
  209. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  210. }
  211. }
  212. // 点击日报宫格
  213. function changeDiaryGrid(e) {
  214. if (1 == e.detail.index) {
  215. wx.navigateToMiniProgram({
  216. appId: 'wxd45c635d754dbf59',
  217. // path: `pages/detail/detail?url=https://docs.qq.com/sheet/DUmJRc2NYTmx1d3Nr`,
  218. })
  219. // wx.navigateToMiniProgram({
  220. // appId: 'wxde4bf149a4c88707',
  221. // path: `pages/login`
  222. // })
  223. return
  224. }
  225. if (2 == e.detail.index) {
  226. $tab.navigateTo('/pages/work/diary/index')
  227. return
  228. }
  229. }
  230. // 点击工具宫格
  231. function changeToolsGrid(e) {
  232. switch (e.detail.index) {
  233. case 1:
  234. openCalculatorPopup() // 打开计算器弹出层
  235. break
  236. case 2:
  237. clearCache()
  238. // openClearCachePopup() // 打开清除缓存弹出层
  239. break
  240. default:
  241. }
  242. }
  243. // 计算器
  244. const calculatorPopup = ref(null)
  245. function openCalculatorPopup() { // 打开计算器弹出层
  246. calculatorPopup.value.open()
  247. }
  248. // 清除缓存
  249. // const clearCacheDialog = ref(null)
  250. // function openClearCachePopup() { // 打开清除缓存弹出层
  251. // clearCacheDialog.value.open()
  252. // }
  253. // const userStore = useUserStore()
  254. </script>
  255. <style lang="scss">
  256. // @import "@/static/font/ygoa/iconfont.css";
  257. .ygoa_icon, .ygoa_work_icon {
  258. font-size: calc(80rpx + 1.5*(1rem - 16px));
  259. }
  260. .icon_size {
  261. font-size: calc(80rpx + 1.5*(1rem - 16px));
  262. }
  263. /* #ifndef APP-NVUE */
  264. page {
  265. display: flex;
  266. flex-direction: column;
  267. box-sizing: border-box;
  268. background-color: #fff;
  269. min-height: 100%;
  270. height: auto;
  271. }
  272. view {
  273. font-size: calc(14px + 1.5*(1rem - 16px));
  274. line-height: inherit;
  275. }
  276. /* #endif */
  277. .text {
  278. text-align: center;
  279. font-size: calc(26rpx + 1.5*(1rem - 16px));
  280. margin-top: 10rpx;
  281. }
  282. .work-container {
  283. .grid-item-box {
  284. flex: 1;
  285. /* #ifndef APP-NVUE */
  286. display: flex;
  287. /* #endif */
  288. flex-direction: column;
  289. align-items: center;
  290. justify-content: center;
  291. padding: 15px 0;
  292. }
  293. // .uni-margin-wrap {
  294. // width: 690rpx;
  295. // width: 100%;
  296. // }
  297. .swiper {
  298. height: 300rpx;
  299. }
  300. .swiper-box {
  301. height: 150px;
  302. }
  303. .swiper-item {
  304. /* #ifndef APP-NVUE */
  305. display: flex;
  306. /* #endif */
  307. flex-direction: column;
  308. justify-content: center;
  309. align-items: center;
  310. color: #fff;
  311. height: 300rpx;
  312. line-height: 300rpx;
  313. }
  314. @media screen and (min-width: 500px) {
  315. .uni-swiper-dot-box {
  316. width: 400px;
  317. /* #ifndef APP-NVUE */
  318. margin: 0 auto;
  319. /* #endif */
  320. margin-top: 8px;
  321. }
  322. .image {
  323. width: 100%;
  324. }
  325. }
  326. }
  327. </style>