home.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="home">
  3. <view class="home_item" v-if="isDept.valueconfig==1">
  4. <view class="title">科室报修</view>
  5. <view class="content">
  6. <view @click="repairsView(1,'pending,handler,reassign')">
  7. <view class="con-title">处理中</view>
  8. <view class="con-value">{{repairData.deptHandlerCount}}</view>
  9. </view>
  10. <view @click="repairsView(1,'close0')">
  11. <view class="con-title">待评价</view>
  12. <view class="con-value">{{repairData.deptCloseCount}}</view>
  13. </view>
  14. <view>
  15. <view class="con-title">本月维修费用(元)</view>
  16. <view class="con-value-gr">{{repairData.deptCurrentMonthPrice || 0}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="home_item">
  21. <view class="title">我的报修</view>
  22. <view class="content">
  23. <view @click="repairsView(0,'pending,handler,reassign')">
  24. <view class="con-title">处理中</view>
  25. <view class="con-value">{{repairData.userHandlerCount}}</view>
  26. </view>
  27. <view @click="repairsView(0,'close0')">
  28. <view class="con-title">待评价</view>
  29. <view class="con-value">{{repairData.userCloseCount}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- <view class="home_item">
  34. <uni-notice-bar show-icon scrollable background-color="#ffffff" color="#000"
  35. :text="noticeData" />
  36. </view> -->
  37. <view class="home_item home-disp">
  38. <view class="bottom-left" @click="addRepairs">
  39. <view class="bottom-left-box">
  40. <text class="newicon newicon-kuaisubaoxiu icon"></text>
  41. <view>快速报修</view>
  42. </view>
  43. </view>
  44. <view class="bottom-right mar-t-20">
  45. <view class="bottom-right-item" v-if="isRepair.valueconfig==1" @click="scanCodes">
  46. <text class="newicon newicon-saoma icon"></text>
  47. <view class="name1">扫资产报修</view>
  48. </view>
  49. <view class="bottom-right-item" @click="repository">
  50. <text class="newicon newicon-zhishiku1 icon"></text>
  51. <view class="name2">知识库</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import { SM } from "@/http/http.js"
  59. import { ref, reactive } from 'vue'
  60. import { onLoad,onShow,onPullDownRefresh } from '@dcloudio/uni-app'
  61. import { api_systemConfiguration, api_repairScanCode, api_getNotice, api_getCount } from "@/http/api.js"
  62. import { useSetTitle } from '@/share/useSetTitle.js'
  63. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  64. import { useSetTabbar } from '@/share/useSetTabbar.js'
  65. useSetTitle();
  66. const { setTabbar } = useSetTabbar();
  67. // 数据
  68. const isDept = ref({})
  69. const isRepair = ref({})
  70. const isPublic = ref({})
  71. const noticeData = ref('')
  72. const repairData = ref({})
  73. const repositorySearchStore = repositoryListSearchStore();
  74. // 知识库
  75. function repository(){
  76. repositorySearchStore.clearRepositoryListSearchData()
  77. uni.navigateTo({
  78. url: `/pages/repository/repository?type=view&entranceType=repairs`
  79. })
  80. }
  81. // 报修列表
  82. function repairsView(type,value){
  83. uni.navigateTo({
  84. url: `/pages/repair/repairsList?type=${type}&value=${value}`
  85. })
  86. }
  87. // 获取公告
  88. function getNotice(){
  89. api_getNotice({
  90. idx: 0,
  91. sum: 3,
  92. type:'wxRepair',
  93. notice: {
  94. status: 1
  95. }
  96. }).then(res=>{
  97. uni.hideLoading();
  98. // getHtml(res.list[0])
  99. })
  100. }
  101. // 获取报修数量
  102. function getCount(){
  103. uni.showLoading({
  104. title: "加载中",
  105. mask: true,
  106. });
  107. api_getCount({}).then(res=>{
  108. uni.hideLoading();
  109. uni.stopPullDownRefresh();
  110. repairData.value = res.data
  111. // getNotice()
  112. })
  113. }
  114. // 快速报修
  115. function addRepairs(){
  116. if(isDept.value.valueconfig==0 && isPublic.value.valueconfig==0){
  117. uni.showToast({
  118. icon: 'none',
  119. title: '请先开启科室报修或公共报修'
  120. });
  121. return
  122. }
  123. uni.setStorageSync('repairsType','home')
  124. uni.navigateTo({
  125. url: '/pages/repair/rapidRep'
  126. })
  127. }
  128. // 扫资产报修
  129. function scanCodes(){
  130. uni.showLoading({
  131. title: "加载中",
  132. mask: true,
  133. });
  134. SM().then((res) => {
  135. api_repairScanCode({
  136. code:res
  137. }).then((res2) => {
  138. uni.hideLoading();
  139. if (res2.state == 200) {
  140. uni.navigateTo({
  141. url: `/pages/repair/rapidRep?property=${res2.data.name}&assetId=${res2.data.id}`
  142. })
  143. } else {
  144. uni.showToast({
  145. icon: 'none',
  146. title: res2.msg || '请求数据失败!'
  147. });
  148. }
  149. });
  150. })
  151. }
  152. // 获取文本内容
  153. function getHtml(data) {
  154. const tempDiv = document.createElement('div');
  155. tempDiv.innerHTML = data.content;
  156. noticeData.value = tempDiv.textContent || tempDiv.innerText || '';
  157. }
  158. // 获取配置项
  159. function getConfig(){
  160. api_systemConfiguration({
  161. idx: 0,
  162. sum: 9999,
  163. }).then(res=>{
  164. let data = res.list
  165. isDept.value = data.find(i=>i.keyconfig=='deptRepair')
  166. isRepair.value = data.find(i=>i.keyconfig=='cmdbRepair')
  167. isPublic.value = data.find(i=>i.keyconfig=='publicRepair')
  168. })
  169. }
  170. onPullDownRefresh(_=>{
  171. getCount();
  172. })
  173. onLoad((option) => {
  174. // 巡检tabbar
  175. for(let i = 0; i<6; i++){
  176. setTabbar(i)
  177. }
  178. getCount()
  179. getConfig()
  180. })
  181. onShow((option) => {
  182. getCount()
  183. })
  184. </script>
  185. <style lang="scss" scoped>
  186. .home{
  187. // height: calc(100vh - 180rpx);
  188. padding: 20rpx;
  189. background: #fff;
  190. .home_item{
  191. padding: 20rpx;
  192. box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);
  193. border-radius: 10rpx;
  194. margin-bottom: 30rpx;
  195. .title{
  196. font-size: 26rpx;
  197. color: $uni-primary;
  198. padding-left: 18rpx;
  199. position: relative;
  200. margin-bottom: 20rpx;
  201. &:before{
  202. content: '';
  203. width: 8rpx;
  204. height: 25rpx;
  205. background-color: $uni-primary;
  206. position: absolute;
  207. left: 0;
  208. top: 50%;
  209. transform: translateY(-50%);
  210. }
  211. }
  212. .content{
  213. display: flex;
  214. align-items: center;
  215. justify-content: space-around;
  216. text-align: center;
  217. .con-title{
  218. color: #949494;
  219. font-size: 24rpx;
  220. margin-bottom: 15rpx;
  221. }
  222. .con-value{
  223. color: #000;
  224. font-size: 50rpx;
  225. }
  226. .con-value-gr{
  227. color: #49B856;
  228. font-size: 50rpx;
  229. }
  230. }
  231. .uni-noticebar{
  232. margin: 0 !important;
  233. padding: 0 !important;
  234. }
  235. }
  236. .home-disp{
  237. display: flex;
  238. justify-content: space-around;
  239. .bottom-left{
  240. height: 380rpx;
  241. background: linear-gradient( 269deg, #54B99C 0%, #7AC481 100%);
  242. border-radius: 10rpx;
  243. flex: 1.5;
  244. margin-right: 20rpx;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. color: #FFFFFF;
  249. margin-top: 20rpx;
  250. .bottom-left-box{
  251. text-align: center;
  252. .icon{
  253. font-size: 100rpx;
  254. position: relative;
  255. top: -20rpx;
  256. }
  257. }
  258. }
  259. .mar-t-20{
  260. margin-top: 20rpx;
  261. }
  262. .bottom-right{
  263. flex: 2;
  264. .bottom-right-item{
  265. height: 175rpx;
  266. background: #FFFFFF;
  267. border-radius: 10rpx;
  268. border: 2rpx solid #6FC073;
  269. margin-bottom: 20rpx;
  270. display: flex;
  271. align-items: center;
  272. justify-content: center;
  273. position: relative;
  274. .icon{
  275. font-size: 50rpx;
  276. color: #6FC073;
  277. position: absolute;
  278. left: 60rpx;
  279. }
  280. .name1{
  281. font-size: 32rpx;
  282. position: absolute;
  283. right: 50rpx;
  284. }
  285. .name2{
  286. font-size: 32rpx;
  287. position: absolute;
  288. right: 80rpx;
  289. }
  290. }
  291. }
  292. }
  293. }
  294. </style>