my.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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="toBuildIncident" type="default" class="primaryButton btn"><text class="newicon newicon-xinjian2"></text>新建事件</button>
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import { ref, reactive } from 'vue'
  54. import { onLoad } from '@dcloudio/uni-app'
  55. import { api_incident_count } from "@/http/api.js"
  56. import { defaultColor } from '@/static/js/theme.js'
  57. import { useSetTitle } from '@/share/useSetTitle.js'
  58. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  59. import { useLoginUserStore } from '@/stores/loginUser'
  60. import { useIncidentNumStore } from '@/stores/incidentNum'
  61. useSetTitle();
  62. const loginUserStore = useLoginUserStore();
  63. const incidentNumStore = useIncidentNumStore();
  64. const { makePhoneCall } = useMakePhoneCall();
  65. // 主题颜色
  66. const primaryColor = ref(defaultColor)
  67. // 数据
  68. const dataInfo = reactive({
  69. todo: 0,
  70. doing: 0,
  71. owns: 0,
  72. resolve: 0,
  73. })
  74. // 获取列表数量
  75. function getCount(){
  76. uni.showLoading({
  77. title: "加载中",
  78. });
  79. let postData = {
  80. incidentList: [
  81. {
  82. "queryTask": "todo",
  83. "assignee": loginUserStore.loginUser.user.id,
  84. "candidateGroups": loginUserStore.loginUser.user.group.map(v => v.id).toString()
  85. },
  86. {
  87. "queryTask": "doing",
  88. "assignee": loginUserStore.loginUser.user.id,
  89. },
  90. {
  91. "queryTask": "owns",
  92. "assignee": loginUserStore.loginUser.user.id,
  93. "candidateGroups": loginUserStore.loginUser.user.group.map(v => v.id).toString()
  94. },
  95. {
  96. "queryTask": "resolve",
  97. "assignee": loginUserStore.loginUser.user.id,
  98. },
  99. ],
  100. }
  101. api_incident_count(postData).then(res => {
  102. uni.hideLoading();
  103. if(res.state == 200){
  104. dataInfo.todo = res.data.todo;
  105. dataInfo.doing = res.data.doing;
  106. dataInfo.owns = res.data.owns;
  107. dataInfo.resolve = res.data.resolve;
  108. }else{
  109. uni.showToast({
  110. icon: 'none',
  111. title: res.msg || '请求数据失败!'
  112. });
  113. }
  114. })
  115. }
  116. // 新建事件
  117. function toBuildIncident(){
  118. uni.navigateTo({
  119. url: '/pages/buildIncident/buildIncident'
  120. })
  121. }
  122. // 点击数量跳转
  123. function toIncident(queryTask, statusId){
  124. incidentNumStore.setIncidentNumData({
  125. queryTask,
  126. statusId,
  127. })
  128. uni.reLaunch({
  129. url: '/pages/incidentList/incidentList'
  130. })
  131. }
  132. onLoad((option) => {
  133. getCount();
  134. })
  135. </script>
  136. <style lang="scss" scoped>
  137. page{
  138. height: calc(100vh - 50px);
  139. background-color: #EBEBEB;
  140. }
  141. .mine{
  142. height: 100%;
  143. display: flex;
  144. flex-direction: column;
  145. justify-content: space-between;
  146. .phone-filled{
  147. margin-right: 5rpx;
  148. }
  149. .newicon-xinjian2{
  150. margin-right: 10rpx;
  151. }
  152. .body{
  153. width: 714rpx;
  154. height: 100%;
  155. margin: 16rpx auto 50px auto;
  156. box-sizing: border-box;
  157. border-radius: 8rpx;
  158. .top{
  159. padding: 30rpx;
  160. background-color: #fff;
  161. .top_name{
  162. font-size: 28rpx;
  163. font-weight: bold;
  164. }
  165. .top_count{
  166. margin-top: 45rpx;
  167. display: flex;
  168. align-items: center;
  169. justify-content: space-between;
  170. .top_count_item{
  171. text-align: center;
  172. .name{
  173. color: #949494;
  174. font-size: 22rpx;
  175. }
  176. .value{
  177. font-size: 50rpx;
  178. font-weight: bold;
  179. margin-top: 15rpx;
  180. }
  181. }
  182. }
  183. }
  184. .bottom{
  185. background-color: #fff;
  186. margin-top: 15rpx;
  187. .bottom_name{
  188. font-size: 26rpx;
  189. color: $uni-primary;
  190. padding: 21rpx 24rpx;
  191. }
  192. .bottom_list{
  193. .bottom_list_item{
  194. border-top: 1rpx solid #DEDEDE;
  195. padding: 30rpx 30rpx 30rpx 47rpx;
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. font-size: 24rpx;
  200. .value{
  201. max-width: 380rpx;
  202. color: #555555;
  203. display: flex;
  204. align-items: center;
  205. text-align: justify;
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. </style>