my.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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="new-btn">
  48. <button @click="addPolling" v-if="bindingPolling" type="default" class="primaryButton"><text class="icon-style newicon newicon-bangding"></text>巡检点绑定</button>
  49. </view>
  50. <view class="foot_common_btns">
  51. <button @click="myRepair" type="default" class="primaryButton btn"><text class="icon-style newicon newicon-ziyuan-baoxiu1"></text>我的报修</button>
  52. <button @click="toBuildIncident" type="default" class="primaryButton btn"><text class="newicon newicon-xinjian2"></text>新建事件</button>
  53. </view>
  54. <view class="foot_common_btns">
  55. <button @click="addrRepairs" type="default" class="primaryButton btn"><text class="icon-style newicon newicon-ziyuan-baoxiu1"></text>报修处理</button>
  56. <button @click="callRecord" type="default" class="primaryButton btn"><text class="newicon newicon-xinjian2"></text>通话记录</button>
  57. </view>
  58. </view>
  59. </template>
  60. <script setup>
  61. import { ref, reactive } from 'vue'
  62. import { onLoad, onTabItemTap } from '@dcloudio/uni-app'
  63. import { api_getDictionary, api_incident_count, api_systemConfiguration } from "@/http/api.js"
  64. import { defaultColor } from '@/static/js/theme.js'
  65. import { useSetTitle } from '@/share/useSetTitle.js'
  66. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  67. import { useLoginUserStore } from '@/stores/loginUser'
  68. import { useIncidentNumStore } from '@/stores/incidentNum'
  69. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  70. import { useSetTabbar } from '@/share/useSetTabbar.js'
  71. import { useIncidentBuildStore } from '@/stores/incidentBuild'
  72. import { transform } from '@/utils/index.js'
  73. useSetTitle();
  74. const loginUserStore = useLoginUserStore();
  75. const incidentNumStore = useIncidentNumStore();
  76. const incidentBuildStore = useIncidentBuildStore();
  77. const { makePhoneCall } = useMakePhoneCall();
  78. const repositorySearchStore = repositoryListSearchStore();
  79. const { setTabbar } = useSetTabbar();
  80. // 主题颜色
  81. const primaryColor = ref(defaultColor)
  82. // 巡检点绑定权限
  83. const bindingPolling = ref(false)
  84. // 数据
  85. const dataInfo = reactive({
  86. todo: 0,
  87. doing: 0,
  88. owns: 0,
  89. resolve: 0,
  90. })
  91. // 获取列表数量
  92. function getCount(){
  93. uni.showLoading({
  94. title: "加载中",
  95. });
  96. let group = []
  97. if(loginUserStore.loginUser.user && loginUserStore.loginUser.user.group){
  98. group = loginUserStore.loginUser.user.group
  99. }
  100. let postData = {
  101. incidentList: [
  102. {
  103. "queryTask": "todo",
  104. "assignee": loginUserStore.loginUser.user.id,
  105. "candidateGroups": group.map(v => v.id).toString()
  106. },
  107. {
  108. "queryTask": "doing",
  109. "assignee": loginUserStore.loginUser.user.id,
  110. },
  111. {
  112. "queryTask": "owns",
  113. "assignee": loginUserStore.loginUser.user.id,
  114. "candidateGroups": group.map(v => v.id).toString()
  115. },
  116. {
  117. "queryTask": "resolve",
  118. "assignee": loginUserStore.loginUser.user.id,
  119. },
  120. ],
  121. }
  122. api_incident_count(postData).then(res => {
  123. uni.hideLoading();
  124. if(res.state == 200){
  125. dataInfo.todo = res.data.todo;
  126. dataInfo.doing = res.data.doing;
  127. dataInfo.owns = res.data.owns;
  128. dataInfo.resolve = res.data.resolve;
  129. }else{
  130. uni.showToast({
  131. icon: 'none',
  132. title: res.msg || '请求数据失败!'
  133. });
  134. }
  135. })
  136. }
  137. // 巡检点绑定
  138. function addPolling(){
  139. uni.navigateTo({
  140. url: `/pages/setPolling/setPolling`
  141. })
  142. }
  143. // 知识库
  144. function myRepair(){
  145. // repositorySearchStore.clearRepositoryListSearchData()
  146. uni.navigateTo({
  147. url: `/pages/myRepair/myRepair`
  148. })
  149. }
  150. // 新建事件
  151. function toBuildIncident(){
  152. incidentBuildStore.clearIncidentBuildData();
  153. uni.navigateTo({
  154. url: '/pages/buildIncident/buildIncident'
  155. })
  156. }
  157. // 报修处理
  158. function addrRepairs(){
  159. uni.navigateTo({
  160. url: '/pages/addrRepairs/addrRepairs'
  161. })
  162. }
  163. // 通话记录
  164. function callRecord(){
  165. uni.navigateTo({
  166. url: '/pages/callRecord/callRecord'
  167. })
  168. }
  169. // 点击数量跳转
  170. function toIncident(queryTask, statusId){
  171. incidentNumStore.setIncidentNumData({
  172. queryTask,
  173. statusId,
  174. })
  175. uni.reLaunch({
  176. url: '/pages/incidentList/incidentList'
  177. })
  178. }
  179. // 获取配置项
  180. function getConfig(data){
  181. api_systemConfiguration({
  182. idx: 0,
  183. sum: 9999,
  184. }).then(res=>{
  185. uni.setStorageSync('sysData',JSON.stringify(res.list))
  186. })
  187. }
  188. // 获取工作组
  189. function changeGroup(){
  190. let postData = {
  191. "key": 'usertype',
  192. "type": "list",
  193. };
  194. api_getDictionary(postData).then((data) => {
  195. uni.setStorageSync('groupData',JSON.stringify(data))
  196. });
  197. }
  198. // 初始化
  199. function onLoadFn(){
  200. getCount();
  201. }
  202. onLoad((option) => {
  203. changeGroup()
  204. getConfig()
  205. let menu = loginUserStore.loginUser.menu
  206. menu = menu.map(i=> ({...i, parentid: i.parentid}))
  207. let arr = transform(menu, 'id', 'parentid')
  208. let item = arr.find(v => v.link === 'wxPperation')
  209. if(item && item.children && item.children.length>0){
  210. bindingPolling.value = item.children.some(v => v.link === 'bindingPolling')
  211. }
  212. for(let i = 0; i<7; i++){
  213. setTabbar(i)
  214. }
  215. onLoadFn();
  216. })
  217. onTabItemTap(e => {
  218. onLoadFn();
  219. })
  220. </script>
  221. <style lang="scss" scoped>
  222. page{
  223. height: calc(100vh - var(--window-bottom));
  224. background-color: #EBEBEB;
  225. }
  226. .mine{
  227. height: 100%;
  228. overflow-y: auto;
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: space-between;
  232. .phone-filled{
  233. margin-right: 5rpx;
  234. }
  235. .newicon-xinjian2,
  236. .newicon-zhishiku{
  237. margin-right: 10rpx;
  238. }
  239. .body{
  240. width: 714rpx;
  241. height: 100%;
  242. margin: 16rpx auto ;
  243. box-sizing: border-box;
  244. border-radius: 8rpx;
  245. .top{
  246. padding: 30rpx;
  247. background-color: #fff;
  248. .top_name{
  249. font-size: 28rpx;
  250. font-weight: bold;
  251. }
  252. .top_count{
  253. margin-top: 45rpx;
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. .top_count_item{
  258. text-align: center;
  259. .name{
  260. color: #949494;
  261. font-size: 22rpx;
  262. }
  263. .value{
  264. font-size: 50rpx;
  265. font-weight: bold;
  266. margin-top: 15rpx;
  267. }
  268. }
  269. }
  270. }
  271. .bottom{
  272. background-color: #fff;
  273. margin-top: 15rpx;
  274. .bottom_name{
  275. font-size: 26rpx;
  276. color: $uni-primary;
  277. padding: 21rpx 24rpx;
  278. }
  279. .bottom_list{
  280. .bottom_list_item{
  281. border-top: 1rpx solid #DEDEDE;
  282. padding: 30rpx 30rpx 30rpx 47rpx;
  283. display: flex;
  284. justify-content: space-between;
  285. align-items: center;
  286. font-size: 24rpx;
  287. .value{
  288. max-width: 380rpx;
  289. color: #555555;
  290. display: flex;
  291. align-items: center;
  292. text-align: justify;
  293. }
  294. }
  295. }
  296. }
  297. }
  298. .icon-style{
  299. position: relative;
  300. left: -6rpx;
  301. }
  302. .new-btn{
  303. padding: 0 24rpx;
  304. }
  305. }
  306. </style>