repository.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. if(list.length){
  109. dataInfo.hasMore = true;
  110. dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  111. }else{
  112. dataInfo.hasMore = false;
  113. }
  114. }else{
  115. uni.showToast({
  116. icon: 'none',
  117. title: res.msg || '请求数据失败!'
  118. });
  119. }
  120. })
  121. }
  122. onLoad((option) => {
  123. dataInfo.incidentId = option.incidentId;
  124. getList(0);
  125. })
  126. onPullDownRefresh(() => {
  127. getList(0)
  128. })
  129. onReachBottom(() => {
  130. dataInfo.idx += 1;
  131. if (dataInfo.hasMore) {
  132. getList(); // 当触底时加载更多数据
  133. }
  134. })
  135. </script>
  136. <style lang="scss" scoped>
  137. .categoryOne{
  138. display: flex;
  139. flex-direction: column;
  140. justify-content: space-between;
  141. .head{
  142. height: 88rpx;
  143. display: flex;
  144. align-items: center;
  145. padding: 0 24rpx;
  146. position: fixed;
  147. z-index: 99;
  148. width: 100%;
  149. box-sizing: border-box;
  150. background: #fff;
  151. font-size: 26rpx;
  152. color: $uni-primary;
  153. }
  154. .body{
  155. font-size: 30rpx;
  156. .body_item{
  157. border-bottom: 8rpx solid #DEDEDE;
  158. .title{
  159. font-weight: 600;
  160. padding: 24rpx;
  161. border-bottom: 1rpx solid #DEDEDE;
  162. }
  163. .content{
  164. color: #6A6A6A;
  165. font-size: 24rpx;
  166. padding: 24rpx;
  167. border-bottom: 1rpx solid #DEDEDE;
  168. view{
  169. display: -webkit-box;
  170. overflow: hidden;
  171. -webkit-box-orient: vertical;
  172. -webkit-line-clamp: 3;
  173. text-overflow: ellipsis;
  174. white-space: initial;
  175. }
  176. }
  177. .sign{
  178. display: flex;
  179. justify-content: space-between;
  180. padding: 24rpx 24rpx 0 24rpx;
  181. font-size: 26rpx;
  182. }
  183. .btn-style{
  184. padding: 24rpx;
  185. }
  186. }
  187. }
  188. .zanwu{
  189. margin-bottom: 140rpx;
  190. margin-top: 88rpx;
  191. display: flex;
  192. justify-content: center;
  193. .newicon-zanwu{
  194. font-size: 256rpx;
  195. color: #D6D6D6;
  196. margin-top: 140rpx;
  197. }
  198. }
  199. .foot_common_btns{
  200. position: fixed;
  201. left: 0;
  202. bottom: 0;
  203. background-color: #fff;
  204. }
  205. .btn-view{
  206. position: fixed;
  207. bottom: 40rpx;
  208. width: 93.5%;
  209. padding: 24rpx 0 0 24rpx;
  210. }
  211. .back-style{
  212. background: #D6D6D6;
  213. width: 100rpx;
  214. height: 100rpx;
  215. border-radius: 50%;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. position: fixed;
  220. right: 30rpx;
  221. bottom: 30rpx;
  222. text{
  223. font-size: 50rpx;
  224. color: #fff;
  225. }
  226. }
  227. }
  228. </style>