repository.vue 4.9 KB

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