repository.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="categoryOne">
  3. <view class="body" v-if="dataInfo.list.length">
  4. <view class="body_item ellipsis" 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="importData(data)" @touchmove.stop.prevent 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 { defaultColor } from '@/static/js/theme.js'
  30. import { useSetTitle } from '@/share/useSetTitle.js'
  31. import { useLoginUserStore } from '@/stores/loginUser'
  32. import { useGoBack } from '@/share/useGoBack.js'
  33. useSetTitle();
  34. const loginUserStore = useLoginUserStore();
  35. const { goBack } = useGoBack();
  36. // 操作类型
  37. const operateType = ref(null)
  38. // 主题颜色
  39. const primaryColor = ref(defaultColor)
  40. // 数据
  41. const dataInfo = reactive({
  42. list: [],//工单列表
  43. idx: 0,//页码
  44. hasMore: true,//是否有更多数据
  45. incidentId: undefined,//事件ID
  46. })
  47. // 跳转知识库详情
  48. function toCategoryTwo(data){
  49. uni.navigateTo({
  50. url: `/pages/repositoryDetails/repositoryDetails?incidentId=${dataInfo.incidentId}
  51. &solutionnumber=${data.solutionnumber}&operateType=${operateType.value}`
  52. })
  53. }
  54. // 引入
  55. function importData(data){
  56. let url = null
  57. if(operateType.value=='malfunction'){ //故障处理
  58. url = '/pages/handler/handler'
  59. }else if(operateType.value=='reissue'){ //补单
  60. url = '/pages/handler/handler'
  61. }
  62. uni.navigateTo({
  63. url: `${url}?incidentId=${encodeURIComponent(JSON.stringify(dataInfo.incidentId))}
  64. &handleDescription=${encodeURIComponent(data.content)}&solutionId=${encodeURIComponent(JSON.stringify(data.id))}&isSummaryNext=1&type=${encodeURIComponent('rep')}
  65. &introduceCount=${encodeURIComponent(data.introduceCount)}`
  66. })
  67. }
  68. // 获取列表信息
  69. function getList(idx){
  70. uni.showLoading({
  71. title: "加载中",
  72. mask: true,
  73. });
  74. dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
  75. if(dataInfo.idx === 0){
  76. dataInfo.list = [];
  77. }
  78. let postData = {
  79. idx: dataInfo.idx,
  80. sum: 20,
  81. solution: {
  82. selectType:"",
  83. keySearch:"",
  84. keywords:"",
  85. solutionType:{id:""},
  86. status:{id:72},
  87. createUser:{name:""},
  88. dutyId:1,
  89. tabType:"publish"
  90. }
  91. }
  92. api_getSolution(postData).then(res => {
  93. uni.hideLoading();
  94. uni.stopPullDownRefresh();
  95. if(res.status == 200){
  96. let list = res.list || [];
  97. if(list.length){
  98. dataInfo.hasMore = true;
  99. dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  100. }else{
  101. dataInfo.hasMore = false;
  102. }
  103. }else{
  104. uni.showToast({
  105. icon: 'none',
  106. title: res.msg || '请求数据失败!'
  107. });
  108. }
  109. })
  110. }
  111. onLoad((option) => {
  112. dataInfo.incidentId = option.incidentId;
  113. operateType.value = option.operateType;
  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>