my.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. // 巡检tabbar
  150. setTabbar(1);
  151. onLoadFn();
  152. })
  153. onTabItemTap(e => {
  154. onLoadFn();
  155. })
  156. </script>
  157. <style lang="scss" scoped>
  158. page{
  159. height: calc(100vh - var(--window-bottom));
  160. background-color: #EBEBEB;
  161. }
  162. .mine{
  163. height: 100%;
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: space-between;
  167. .phone-filled{
  168. margin-right: 5rpx;
  169. }
  170. .newicon-xinjian2,
  171. .newicon-zhishiku{
  172. margin-right: 10rpx;
  173. }
  174. .body{
  175. width: 714rpx;
  176. height: 100%;
  177. margin: 16rpx auto var(--window-bottom) auto;
  178. box-sizing: border-box;
  179. border-radius: 8rpx;
  180. .top{
  181. padding: 30rpx;
  182. background-color: #fff;
  183. .top_name{
  184. font-size: 28rpx;
  185. font-weight: bold;
  186. }
  187. .top_count{
  188. margin-top: 45rpx;
  189. display: flex;
  190. align-items: center;
  191. justify-content: space-between;
  192. .top_count_item{
  193. text-align: center;
  194. .name{
  195. color: #949494;
  196. font-size: 22rpx;
  197. }
  198. .value{
  199. font-size: 50rpx;
  200. font-weight: bold;
  201. margin-top: 15rpx;
  202. }
  203. }
  204. }
  205. }
  206. .bottom{
  207. background-color: #fff;
  208. margin-top: 15rpx;
  209. .bottom_name{
  210. font-size: 26rpx;
  211. color: $uni-primary;
  212. padding: 21rpx 24rpx;
  213. }
  214. .bottom_list{
  215. .bottom_list_item{
  216. border-top: 1rpx solid #DEDEDE;
  217. padding: 30rpx 30rpx 30rpx 47rpx;
  218. display: flex;
  219. justify-content: space-between;
  220. align-items: center;
  221. font-size: 24rpx;
  222. .value{
  223. max-width: 380rpx;
  224. color: #555555;
  225. display: flex;
  226. align-items: center;
  227. text-align: justify;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </style>