my.vue 9.5 KB

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