home.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="home">
  3. <view class="home_item" v-if="isDept.valueconfig==1" @click="repairsView(1)">
  4. <view class="title">科室报修</view>
  5. <view class="content">
  6. <view>
  7. <view class="con-title">处理中</view>
  8. <view class="con-value">{{repairData.deptHandlerCount}}</view>
  9. </view>
  10. <view>
  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}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="home_item" @click="repairsView(0)">
  21. <view class="title">我的报修</view>
  22. <view class="content">
  23. <view>
  24. <view class="con-title">处理中</view>
  25. <view class="con-value">{{repairData.userCloseCount}}</view>
  26. </view>
  27. <view>
  28. <view class="con-title">待评价</view>
  29. <view class="con-value">{{repairData.userHandlerCount}}</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 } from '@dcloudio/uni-app'
  61. import { api_systemConfiguration, api_getNotice, api_getCount } from "@/http/api.js"
  62. import { useSetTitle } from '@/share/useSetTitle.js'
  63. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  64. useSetTitle();
  65. // 数据
  66. const sysData = ref({})
  67. const isDept = ref({})
  68. const isRepair = ref({})
  69. const noticeData = ref('')
  70. const repairData = ref({})
  71. const repositorySearchStore = repositoryListSearchStore();
  72. // 知识库
  73. function repository(){
  74. repositorySearchStore.clearRepositoryListSearchData()
  75. uni.navigateTo({
  76. url: `/pages/repository/repository?type=view`
  77. })
  78. }
  79. // 报修列表
  80. function repairsView(type){
  81. uni.navigateTo({
  82. url: '/pages/repair/repairsList?type='+type
  83. })
  84. }
  85. // 获取公告
  86. function getNotice(){
  87. api_getNotice({
  88. idx: 0,
  89. sum: 3,
  90. type:'wxRepair',
  91. notice: {
  92. status: 1
  93. }
  94. }).then(res=>{
  95. uni.hideLoading();
  96. getHtml(res.list[0])
  97. })
  98. }
  99. // 获取报修数量
  100. function getCount(){
  101. api_getCount({}).then(res=>{
  102. repairData.value = res.data
  103. getNotice()
  104. })
  105. }
  106. // 快速报修
  107. function addRepairs(){
  108. uni.navigateTo({
  109. url: '/pages/repair/rapidRep'
  110. })
  111. }
  112. // 扫资产报修
  113. function scanCodes(){
  114. SM().then((res) => {
  115. let postData = {
  116. code: ress1,
  117. account: loginUserStore.loginUser.user.account,
  118. };
  119. // api_scanCode(postData).then((res) => {
  120. // uni.hideLoading();
  121. // if (res.status == 200) {
  122. // inspectionValueStore.setInspectionValueData(res.data);
  123. // uni.navigateTo({
  124. // url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
  125. // })
  126. // } else {
  127. // uni.showToast({
  128. // icon: 'none',
  129. // title: res.msg || '请求数据失败!'
  130. // });
  131. // }
  132. // });
  133. })
  134. }
  135. // 获取文本内容
  136. function getHtml(data) {
  137. const tempDiv = document.createElement('div');
  138. tempDiv.innerHTML = data.content;
  139. noticeData.value = tempDiv.textContent || tempDiv.innerText || '';
  140. }
  141. onLoad((option) => {
  142. })
  143. onShow((option) => {
  144. uni.showLoading({
  145. title: "加载中",
  146. });
  147. api_systemConfiguration({
  148. idx: 0,
  149. sum: 9999,
  150. }).then(res=>{
  151. sysData.value = res.list
  152. isDept.value = res.list.find(i=>i.keyconfig=='deptRepair')
  153. isRepair.value = res.list.find(i=>i.keyconfig=='cmdbRepair')
  154. uni.setStorageSync('sysData',JSON.stringify(res.list))
  155. getCount()
  156. })
  157. })
  158. </script>
  159. <style lang="scss" scoped>
  160. .home{
  161. height: 100vh;
  162. padding: 20rpx;
  163. background: #fff;
  164. .home_item{
  165. padding: 20rpx;
  166. box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);
  167. border-radius: 10rpx;
  168. margin-bottom: 30rpx;
  169. .title{
  170. font-size: 26rpx;
  171. color: $uni-primary;
  172. padding-left: 18rpx;
  173. position: relative;
  174. margin-bottom: 20rpx;
  175. &:before{
  176. content: '';
  177. width: 8rpx;
  178. height: 25rpx;
  179. background-color: $uni-primary;
  180. position: absolute;
  181. left: 0;
  182. top: 50%;
  183. transform: translateY(-50%);
  184. }
  185. }
  186. .content{
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-around;
  190. text-align: center;
  191. .con-title{
  192. color: #949494;
  193. font-size: 24rpx;
  194. margin-bottom: 15rpx;
  195. }
  196. .con-value{
  197. color: #000;
  198. font-size: 50rpx;
  199. }
  200. .con-value-gr{
  201. color: #49B856;
  202. font-size: 50rpx;
  203. }
  204. }
  205. .uni-noticebar{
  206. margin: 0 !important;
  207. padding: 0 !important;
  208. }
  209. }
  210. .home-disp{
  211. display: flex;
  212. justify-content: space-around;
  213. .bottom-left{
  214. height: 380rpx;
  215. background: linear-gradient( 269deg, #54B99C 0%, #7AC481 100%);
  216. border-radius: 10rpx;
  217. flex: 1.5;
  218. margin-right: 20rpx;
  219. display: flex;
  220. align-items: center;
  221. justify-content: center;
  222. color: #FFFFFF;
  223. margin-top: 20rpx;
  224. .bottom-left-box{
  225. text-align: center;
  226. .icon{
  227. font-size: 100rpx;
  228. position: relative;
  229. top: -20rpx;
  230. }
  231. }
  232. }
  233. .mar-t-20{
  234. margin-top: 20rpx;
  235. }
  236. .bottom-right{
  237. flex: 2;
  238. .bottom-right-item{
  239. height: 175rpx;
  240. background: #FFFFFF;
  241. border-radius: 10rpx;
  242. border: 2rpx solid #6FC073;
  243. margin-bottom: 20rpx;
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. position: relative;
  248. .icon{
  249. font-size: 50rpx;
  250. color: #6FC073;
  251. position: absolute;
  252. left: 60rpx;
  253. }
  254. .name1{
  255. font-size: 32rpx;
  256. position: absolute;
  257. right: 50rpx;
  258. }
  259. .name2{
  260. font-size: 32rpx;
  261. position: absolute;
  262. right: 80rpx;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. </style>