my.vue 7.0 KB

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