repository.vue 4.8 KB

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