repository.vue 4.9 KB

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