my.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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', 1543)">
  8. <view class="name">待接单</view>
  9. <view class="value">{{dataInfo.todo}}</view>
  10. </view>
  11. <view class="top_count_item" @click="toIncident('todoingAll', 1544)">
  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="repository" type="default" class="primaryButton btn"><text class="newicon newicon-zhishiku"></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. useSetTitle();
  65. const loginUserStore = useLoginUserStore();
  66. const incidentNumStore = useIncidentNumStore();
  67. const { makePhoneCall } = useMakePhoneCall();
  68. const repositorySearchStore = repositoryListSearchStore();
  69. const { setTabbar } = useSetTabbar();
  70. // 主题颜色
  71. const primaryColor = ref(defaultColor)
  72. // 数据
  73. const dataInfo = reactive({
  74. todo: 0,
  75. doing: 0,
  76. owns: 0,
  77. resolve: 0,
  78. })
  79. // 获取列表数量
  80. function getCount(){
  81. uni.showLoading({
  82. title: "加载中",
  83. });
  84. let postData = {
  85. incidentList: [
  86. {
  87. "queryTask": "todo",
  88. "assignee": loginUserStore.loginUser.user.id,
  89. "candidateGroups": loginUserStore.loginUser.user.group.map(v => v.id).toString()
  90. },
  91. {
  92. "queryTask": "doing",
  93. "assignee": loginUserStore.loginUser.user.id,
  94. },
  95. {
  96. "queryTask": "owns",
  97. "assignee": loginUserStore.loginUser.user.id,
  98. "candidateGroups": loginUserStore.loginUser.user.group.map(v => v.id).toString()
  99. },
  100. {
  101. "queryTask": "resolve",
  102. "assignee": loginUserStore.loginUser.user.id,
  103. },
  104. ],
  105. }
  106. api_incident_count(postData).then(res => {
  107. uni.hideLoading();
  108. if(res.state == 200){
  109. dataInfo.todo = res.data.todo;
  110. dataInfo.doing = res.data.doing;
  111. dataInfo.owns = res.data.owns;
  112. dataInfo.resolve = res.data.resolve;
  113. }else{
  114. uni.showToast({
  115. icon: 'none',
  116. title: res.msg || '请求数据失败!'
  117. });
  118. }
  119. })
  120. }
  121. // 知识库
  122. function repository(){
  123. repositorySearchStore.clearRepositoryListSearchData()
  124. uni.navigateTo({
  125. url: `/pages/repository/repository?type=view`
  126. })
  127. }
  128. // 新建事件
  129. function toBuildIncident(){
  130. uni.navigateTo({
  131. url: '/pages/buildIncident/buildIncident'
  132. })
  133. }
  134. // 点击数量跳转
  135. function toIncident(queryTask, statusId){
  136. incidentNumStore.setIncidentNumData({
  137. queryTask,
  138. statusId,
  139. })
  140. uni.reLaunch({
  141. url: '/pages/incidentList/incidentList'
  142. })
  143. }
  144. // 初始化
  145. function onLoadFn(){
  146. getCount();
  147. }
  148. onLoad((option) => {
  149. for(let i = 0; i<5; i++){
  150. setTabbar(i)
  151. }
  152. onLoadFn();
  153. })
  154. onTabItemTap(e => {
  155. onLoadFn();
  156. })
  157. </script>
  158. <style lang="scss" scoped>
  159. page{
  160. height: calc(100vh - var(--window-bottom));
  161. background-color: #EBEBEB;
  162. }
  163. .mine{
  164. height: 100%;
  165. display: flex;
  166. flex-direction: column;
  167. justify-content: space-between;
  168. .phone-filled{
  169. margin-right: 5rpx;
  170. }
  171. .newicon-xinjian2,
  172. .newicon-zhishiku{
  173. margin-right: 10rpx;
  174. }
  175. .body{
  176. width: 714rpx;
  177. height: 100%;
  178. margin: 16rpx auto var(--window-bottom) auto;
  179. box-sizing: border-box;
  180. border-radius: 8rpx;
  181. .top{
  182. padding: 30rpx;
  183. background-color: #fff;
  184. .top_name{
  185. font-size: 28rpx;
  186. font-weight: bold;
  187. }
  188. .top_count{
  189. margin-top: 45rpx;
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. .top_count_item{
  194. text-align: center;
  195. .name{
  196. color: #949494;
  197. font-size: 22rpx;
  198. }
  199. .value{
  200. font-size: 50rpx;
  201. font-weight: bold;
  202. margin-top: 15rpx;
  203. }
  204. }
  205. }
  206. }
  207. .bottom{
  208. background-color: #fff;
  209. margin-top: 15rpx;
  210. .bottom_name{
  211. font-size: 26rpx;
  212. color: $uni-primary;
  213. padding: 21rpx 24rpx;
  214. }
  215. .bottom_list{
  216. .bottom_list_item{
  217. border-top: 1rpx solid #DEDEDE;
  218. padding: 30rpx 30rpx 30rpx 47rpx;
  219. display: flex;
  220. justify-content: space-between;
  221. align-items: center;
  222. font-size: 24rpx;
  223. .value{
  224. max-width: 380rpx;
  225. color: #555555;
  226. display: flex;
  227. align-items: center;
  228. text-align: justify;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>