my.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="mine">
  3. <scroll-view scroll-y class="body">
  4. <view class="top">
  5. <view class="top_name">Hi,{{loginUserStore.loginUser.user.name}}</view>
  6. <view class="top_count">
  7. <view class="top_count_item" @click="toIncident('todoingAll', 20407)">
  8. <view class="name">待接单</view>
  9. <view class="value">{{dataInfo.todo}}</view>
  10. </view>
  11. <view class="top_count_item" @click="toIncident('todoingAll', 20408)">
  12. <view class="name">处理中</view>
  13. <view class="value">{{dataInfo.doing}}</view>
  14. </view>
  15. <view class="top_count_item" @click="toIncident('owns', 0)">
  16. <view class="name">与我关联</view>
  17. <view class="value">{{dataInfo.owns}}</view>
  18. </view>
  19. <view class="top_count_item" @click="toIncident('resolve', 0)">
  20. <view class="name">由我解决</view>
  21. <view class="value">{{dataInfo.resolve}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="bottom">
  26. <view class="bottom_name">个人信息</view>
  27. <view class="bottom_list">
  28. <view class="bottom_list_item">
  29. <view class="name">工号</view>
  30. <view class="value">{{loginUserStore.loginUser.user.account}}</view>
  31. </view>
  32. <view class="bottom_list_item">
  33. <view class="name">手机号</view>
  34. <view class="value" @click="makePhoneCall(loginUserStore.loginUser.user.phone)"><uni-icons type="phone-filled" class="phone-filled" :size="18" :color="primaryColor"></uni-icons>{{loginUserStore.loginUser.user.phone}}</view>
  35. </view>
  36. <view class="bottom_list_item">
  37. <view class="name">部门</view>
  38. <view class="value">{{loginUserStore.loginUser.user.duty ? loginUserStore.loginUser.user.duty.dept : '无'}}</view>
  39. </view>
  40. <view class="bottom_list_item">
  41. <view class="name">工作组</view>
  42. <view class="value">{{(loginUserStore.loginUser.user.group && loginUserStore.loginUser.user.group.length) ? loginUserStore.loginUser.user.group.map(v => v.groupName).join('/') : '无'}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. </scroll-view>
  47. <view class="foot_common_btns">
  48. <button @click="myRepair" type="default" class="primaryButton btn"><text class="icon-style newicon newicon-ziyuan-baoxiu1"></text>我的报修</button>
  49. <button @click="toBuildIncident" type="default" class="primaryButton btn"><text class="newicon newicon-xinjian2"></text>新建事件</button>
  50. </view>
  51. </view>
  52. </template>
  53. <script setup>
  54. import { ref, reactive } from 'vue'
  55. import { onLoad, onTabItemTap } from '@dcloudio/uni-app'
  56. import { api_incident_count } from "@/http/api.js"
  57. import { defaultColor } from '@/static/js/theme.js'
  58. import { useSetTitle } from '@/share/useSetTitle.js'
  59. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  60. import { useLoginUserStore } from '@/stores/loginUser'
  61. import { useIncidentNumStore } from '@/stores/incidentNum'
  62. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  63. import { useSetTabbar } from '@/share/useSetTabbar.js'
  64. import { useIncidentBuildStore } from '@/stores/incidentBuild'
  65. useSetTitle();
  66. const loginUserStore = useLoginUserStore();
  67. const incidentNumStore = useIncidentNumStore();
  68. const incidentBuildStore = useIncidentBuildStore();
  69. const { makePhoneCall } = useMakePhoneCall();
  70. const repositorySearchStore = repositoryListSearchStore();
  71. const { setTabbar } = useSetTabbar();
  72. // 主题颜色
  73. const primaryColor = ref(defaultColor)
  74. // 数据
  75. const dataInfo = reactive({
  76. todo: 0,
  77. doing: 0,
  78. owns: 0,
  79. resolve: 0,
  80. })
  81. // 获取列表数量
  82. function getCount(){
  83. uni.showLoading({
  84. title: "加载中",
  85. });
  86. let group = []
  87. if(loginUserStore.loginUser.user && loginUserStore.loginUser.user.group){
  88. group = loginUserStore.loginUser.user.group
  89. }
  90. let postData = {
  91. incidentList: [
  92. {
  93. "queryTask": "todo",
  94. "assignee": loginUserStore.loginUser.user.id,
  95. "candidateGroups": group.map(v => v.id).toString()
  96. },
  97. {
  98. "queryTask": "doing",
  99. "assignee": loginUserStore.loginUser.user.id,
  100. },
  101. {
  102. "queryTask": "owns",
  103. "assignee": loginUserStore.loginUser.user.id,
  104. "candidateGroups": group.map(v => v.id).toString()
  105. },
  106. {
  107. "queryTask": "resolve",
  108. "assignee": loginUserStore.loginUser.user.id,
  109. },
  110. ],
  111. }
  112. api_incident_count(postData).then(res => {
  113. uni.hideLoading();
  114. if(res.state == 200){
  115. dataInfo.todo = res.data.todo;
  116. dataInfo.doing = res.data.doing;
  117. dataInfo.owns = res.data.owns;
  118. dataInfo.resolve = res.data.resolve;
  119. }else{
  120. uni.showToast({
  121. icon: 'none',
  122. title: res.msg || '请求数据失败!'
  123. });
  124. }
  125. })
  126. }
  127. // 知识库
  128. function myRepair(){
  129. // repositorySearchStore.clearRepositoryListSearchData()
  130. uni.navigateTo({
  131. url: `/pages/myRepair/myRepair`
  132. })
  133. }
  134. // 新建事件
  135. function toBuildIncident(){
  136. incidentBuildStore.clearIncidentBuildData();
  137. uni.navigateTo({
  138. url: '/pages/buildIncident/buildIncident'
  139. })
  140. }
  141. // 点击数量跳转
  142. function toIncident(queryTask, statusId){
  143. incidentNumStore.setIncidentNumData({
  144. queryTask,
  145. statusId,
  146. })
  147. uni.reLaunch({
  148. url: '/pages/incidentList/incidentList'
  149. })
  150. }
  151. // 初始化
  152. function onLoadFn(){
  153. getCount();
  154. }
  155. onLoad((option) => {
  156. for(let i = 0; i<7; i++){
  157. setTabbar(i)
  158. }
  159. onLoadFn();
  160. })
  161. onTabItemTap(e => {
  162. onLoadFn();
  163. })
  164. </script>
  165. <style lang="scss" scoped>
  166. page{
  167. height: calc(100vh - var(--window-bottom));
  168. background-color: #EBEBEB;
  169. }
  170. .mine{
  171. height: 100%;
  172. display: flex;
  173. flex-direction: column;
  174. justify-content: space-between;
  175. .phone-filled{
  176. margin-right: 5rpx;
  177. }
  178. .newicon-xinjian2,
  179. .newicon-zhishiku{
  180. margin-right: 10rpx;
  181. }
  182. .body{
  183. width: 714rpx;
  184. height: 100%;
  185. margin: 16rpx auto var(--window-bottom) auto;
  186. box-sizing: border-box;
  187. border-radius: 8rpx;
  188. .top{
  189. padding: 30rpx;
  190. background-color: #fff;
  191. .top_name{
  192. font-size: 28rpx;
  193. font-weight: bold;
  194. }
  195. .top_count{
  196. margin-top: 45rpx;
  197. display: flex;
  198. align-items: center;
  199. justify-content: space-between;
  200. .top_count_item{
  201. text-align: center;
  202. .name{
  203. color: #949494;
  204. font-size: 22rpx;
  205. }
  206. .value{
  207. font-size: 50rpx;
  208. font-weight: bold;
  209. margin-top: 15rpx;
  210. }
  211. }
  212. }
  213. }
  214. .bottom{
  215. background-color: #fff;
  216. margin-top: 15rpx;
  217. .bottom_name{
  218. font-size: 26rpx;
  219. color: $uni-primary;
  220. padding: 21rpx 24rpx;
  221. }
  222. .bottom_list{
  223. .bottom_list_item{
  224. border-top: 1rpx solid #DEDEDE;
  225. padding: 30rpx 30rpx 30rpx 47rpx;
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. font-size: 24rpx;
  230. .value{
  231. max-width: 380rpx;
  232. color: #555555;
  233. display: flex;
  234. align-items: center;
  235. text-align: justify;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. .icon-style{
  242. position: relative;
  243. left: -6rpx;
  244. }
  245. }
  246. </style>