repository.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="categoryOne">
  3. <view class="body" v-if="dataInfo.list.length">
  4. <view class="body_item" v-for="data in dataInfo.list" :key="data.id">
  5. <view @click="toCategoryTwo(data)">
  6. <view class="title">{{data.title}}</view>
  7. <view class="content">
  8. <view v-html="data.content"></view>
  9. </view>
  10. <view class="sign">
  11. <view>引入次数:{{data.introduceCount || 0}}</view>
  12. <view>{{data.createtime}}</view>
  13. </view>
  14. </view>
  15. <view class="btn-style">
  16. <button @click.stop="importData(data)" type="default" class="primaryButton btn">引入</button>
  17. </view>
  18. </view>
  19. <view class="back-style" @click="goBack">
  20. <text class="newicon newicon-fanhui1"></text>
  21. </view>
  22. </view>
  23. <view class="zanwu" v-else>
  24. <text class="newicon newicon-zanwu"></text>
  25. </view>
  26. <view v-if="dataInfo.list.length==0" class="btn-view">
  27. <button @click="goBack" type="default" class="primaryButton btn">返回</button>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { ref, reactive} from 'vue'
  33. import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
  34. import { api_getSolution } from "@/http/api.js"
  35. import { useSetTitle } from '@/share/useSetTitle.js'
  36. import { useGoBack } from '@/share/useGoBack.js'
  37. import { useHandlerStore } from '@/stores/handler'
  38. useSetTitle();
  39. const handlerStore = useHandlerStore();
  40. const { goBack } = useGoBack();
  41. // 操作类型
  42. // const operateType = ref(null)
  43. // 关联故障分类的知识库数量
  44. const introduceCount = ref(0)
  45. // tab类型
  46. // const tabType = ref(null)
  47. // 数据
  48. const dataInfo = reactive({
  49. list: [],//工单列表
  50. idx: 0,//页码
  51. hasMore: true,//是否有更多数据
  52. incidentId: undefined,//事件ID
  53. })
  54. // 跳转知识库详情
  55. function toCategoryTwo(data){
  56. uni.navigateTo({
  57. url: `/pages/repositoryDetails/repositoryDetails?incidentId=${dataInfo.incidentId}
  58. &solutionnumber=${data.solutionnumber}`
  59. })
  60. }
  61. // 引入
  62. function importData(data){
  63. let url = null
  64. let type = handlerStore.handler.data.operateType
  65. let storeInfo = handlerStore.handler.data
  66. storeInfo.introduceCount = introduceCount.value
  67. storeInfo.handleDescription = data.content
  68. storeInfo.solutionId = data.id
  69. storeInfo.type = 'rep'
  70. storeInfo.isSummaryNext = 1
  71. handlerStore.setHandlerData(storeInfo,'assign', 'assign')
  72. if(type=='malfunction'){ //故障处理
  73. url = '/pages/handler/handler'
  74. }else if(type=='reissue'){ //补单
  75. url = '/pages/assign/assign'
  76. }
  77. uni.navigateTo({
  78. url: url
  79. })
  80. }
  81. // 获取列表信息
  82. function getList(idx){
  83. uni.showLoading({
  84. title: "加载中",
  85. mask: true,
  86. });
  87. dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
  88. if(dataInfo.idx === 0){
  89. dataInfo.list = [];
  90. }
  91. console.log(777,handlerStore.handler.data)
  92. let postData = {
  93. idx: dataInfo.idx,
  94. sum: 9999,
  95. solution: {
  96. category:{
  97. id:handlerStore.handler.data.category.id,
  98. },
  99. status:{id:72},
  100. }
  101. }
  102. api_getSolution(postData).then(res => {
  103. uni.hideLoading();
  104. // uni.stopPullDownRefresh();
  105. if(res.status == 200){
  106. let list = res.list || [];
  107. introduceCount.value = res.totalNum
  108. dataInfo.list = list
  109. // if(list.length){
  110. // dataInfo.hasMore = true;
  111. // dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  112. // }else{
  113. // dataInfo.hasMore = false;
  114. // }
  115. }else{
  116. uni.showToast({
  117. icon: 'none',
  118. title: res.msg || '请求数据失败!'
  119. });
  120. }
  121. })
  122. }
  123. onLoad((option) => {
  124. dataInfo.incidentId = option.incidentId;
  125. getList(0);
  126. })
  127. onPullDownRefresh(() => {
  128. // getList(0)
  129. })
  130. onReachBottom(() => {
  131. // dataInfo.idx += 1;
  132. // if (dataInfo.hasMore) {
  133. // getList(); // 当触底时加载更多数据
  134. // }
  135. })
  136. </script>
  137. <style lang="scss" scoped>
  138. .categoryOne{
  139. display: flex;
  140. flex-direction: column;
  141. justify-content: space-between;
  142. .head{
  143. height: 88rpx;
  144. display: flex;
  145. align-items: center;
  146. padding: 0 24rpx;
  147. position: fixed;
  148. z-index: 99;
  149. width: 100%;
  150. box-sizing: border-box;
  151. background: #fff;
  152. font-size: 26rpx;
  153. color: $uni-primary;
  154. }
  155. .body{
  156. font-size: 30rpx;
  157. .body_item{
  158. border-bottom: 8rpx solid #DEDEDE;
  159. .title{
  160. font-weight: 600;
  161. padding: 24rpx;
  162. border-bottom: 1rpx solid #DEDEDE;
  163. }
  164. .content{
  165. color: #6A6A6A;
  166. font-size: 24rpx;
  167. padding: 24rpx;
  168. border-bottom: 1rpx solid #DEDEDE;
  169. view{
  170. display: -webkit-box;
  171. overflow: hidden;
  172. -webkit-box-orient: vertical;
  173. -webkit-line-clamp: 3;
  174. text-overflow: ellipsis;
  175. white-space: initial;
  176. }
  177. }
  178. .sign{
  179. display: flex;
  180. justify-content: space-between;
  181. padding: 24rpx 24rpx 0 24rpx;
  182. font-size: 26rpx;
  183. }
  184. .btn-style{
  185. padding: 24rpx;
  186. }
  187. }
  188. }
  189. .zanwu{
  190. margin-bottom: 140rpx;
  191. margin-top: 88rpx;
  192. display: flex;
  193. justify-content: center;
  194. .newicon-zanwu{
  195. font-size: 256rpx;
  196. color: #D6D6D6;
  197. margin-top: 140rpx;
  198. }
  199. }
  200. .foot_common_btns{
  201. position: fixed;
  202. left: 0;
  203. bottom: 0;
  204. background-color: #fff;
  205. }
  206. .btn-view{
  207. position: fixed;
  208. bottom: 40rpx;
  209. width: 93.5%;
  210. padding: 24rpx 0 0 24rpx;
  211. }
  212. .back-style{
  213. background: #D6D6D6;
  214. width: 100rpx;
  215. height: 100rpx;
  216. border-radius: 50%;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. position: fixed;
  221. right: 30rpx;
  222. bottom: 30rpx;
  223. text{
  224. font-size: 50rpx;
  225. color: #fff;
  226. }
  227. }
  228. }
  229. </style>