repository.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="categoryOne">
  3. <view class="filter" @click="filterClick" v-if="entrance == 'view'">
  4. <text class="newicon newicon-shaixuan"></text>
  5. </view>
  6. <view class="body" v-if="dataInfo.list.length" :class="entrance == 'view' ? 'mar-t40' : ''">
  7. <view class="body_item" v-for="data in dataInfo.list" :key="data.id">
  8. <view @click="toCategoryTwo(data)">
  9. <view class="title">{{data.title}}</view>
  10. <view class="content">
  11. <view v-html="data.content"></view>
  12. </view>
  13. <view class="sign">
  14. <view>引入次数:{{data.introduceCount || 0}}</view>
  15. <view>{{data.createtime}}</view>
  16. </view>
  17. </view>
  18. <view class="btn-style">
  19. <button v-if="entrance!='view'" @click.stop="importData(data)" type="default" class="primaryButton btn">引入</button>
  20. </view>
  21. </view>
  22. <view class="back-style" @click="goBack">
  23. <text class="newicon newicon-fanhui1"></text>
  24. </view>
  25. </view>
  26. <view class="zanwu" v-else>
  27. <text class="newicon newicon-zanwu"></text>
  28. </view>
  29. <view class="back-style" @click="goBack" v-if="entrance == 'view'">
  30. <text class="newicon newicon-fanhui1"></text>
  31. </view>
  32. <view v-if="dataInfo.list.length==0 && entrance!='view'" class="foot_common_btns">
  33. <button @click="goBack" type="default" class="primaryButton btn">返回</button>
  34. </view>
  35. <repositoryFilter v-if="isFilter" @cancelEmit="cancelFilter"
  36. @confirmEmit="conformFilter" :evt="evtFilter"></repositoryFilter>
  37. </view>
  38. </template>
  39. <script setup>
  40. import { ref, reactive} from 'vue'
  41. import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
  42. import { api_getSolution } from "@/http/api.js"
  43. import { useSetTitle } from '@/share/useSetTitle.js'
  44. import { useGoBack } from '@/share/useGoBack.js'
  45. import { useHandlerStore } from '@/stores/handler'
  46. import repositoryFilter from '@/components/repositoryFilter.vue';
  47. import { useLoginUserStore } from '@/stores/loginUser'
  48. useSetTitle();
  49. const loginUserStore = useLoginUserStore();
  50. const handlerStore = useHandlerStore();
  51. const { goBack } = useGoBack();
  52. // 操作类型
  53. // const operateType = ref(null)
  54. // 关联故障分类的知识库数量
  55. const introduceCount = ref(0)
  56. // 入口类型
  57. const entrance = ref(null)
  58. // 筛选数据
  59. const evtFilter = ref({})
  60. // 筛选状态
  61. const isFilter = ref(null)
  62. // 数据
  63. const dataInfo = reactive({
  64. list: [],//工单列表
  65. idx: 0,//页码
  66. hasMore: true,//是否有更多数据
  67. incidentId: undefined,//事件ID
  68. })
  69. // 跳转知识库详情
  70. function toCategoryTwo(data){
  71. uni.navigateTo({
  72. url: `/pages/repositoryDetails/repositoryDetails?incidentId=${dataInfo.incidentId}
  73. &solutionnumber=${data.solutionnumber}&editType=${entrance.value}`
  74. })
  75. }
  76. // 引入
  77. function importData(data){
  78. let url = null
  79. let type = handlerStore.handler.data.operateType
  80. let storeInfo = handlerStore.handler.data
  81. storeInfo.introduceCount = introduceCount.value
  82. storeInfo.handleDescription = data.content
  83. storeInfo.solutionId = data.id
  84. storeInfo.type = 'rep'
  85. storeInfo.isSummaryNext = 1
  86. handlerStore.setHandlerData(storeInfo,'assign', 'assign')
  87. if(type=='malfunction'){ //故障处理
  88. url = '/pages/handler/handler'
  89. }else if(type=='reissue'){ //补单
  90. url = '/pages/assign/assign'
  91. }
  92. uni.navigateTo({
  93. url: url
  94. })
  95. }
  96. // 点击筛选
  97. function filterClick(){
  98. isFilter.value = true;
  99. }
  100. // 确认筛选
  101. function conformFilter(evtFilter){
  102. evtFilter.value = evtFilter;
  103. isFilter.value = false;
  104. getList(0,evtFilter);
  105. }
  106. // 关闭筛选
  107. function cancelFilter(){
  108. isFilter.value = false;
  109. }
  110. // 获取列表信息
  111. function getList(idx,data){
  112. uni.showLoading({
  113. title: "加载中",
  114. mask: true,
  115. });
  116. dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
  117. if(dataInfo.idx === 0){
  118. dataInfo.list = [];
  119. }
  120. let categoryId = entrance.value=='view' ? data && data.category : handlerStore.handler.data.category.id
  121. let postData = {
  122. idx: dataInfo.idx,
  123. sum: 9999,
  124. solution: {
  125. category:{
  126. id:'',
  127. },
  128. title:'',
  129. status:{id:72},
  130. }
  131. }
  132. if(typeof(categoryId)=='number' || typeof(categoryId)=='string'){
  133. postData.solution.category.id = categoryId
  134. }else{
  135. delete postData.solution.category.id
  136. }
  137. if(data && data.title){
  138. postData.solution.title = data.title
  139. }else{
  140. delete postData.solution.title
  141. }
  142. if(loginUserStore.loginUser.user.duty){
  143. postData.solution.dutyId = loginUserStore.loginUser.user.duty.id;
  144. }else if(loginUserStore.loginUser.user.branch){
  145. postData.solution.branch = loginUserStore.loginUser.user.branch.id;
  146. }
  147. if(entrance.value=='view'){
  148. postData.solution.selectType = "keySearch"
  149. postData.solution.tabType = "publish"
  150. }
  151. api_getSolution(postData).then(res => {
  152. uni.hideLoading();
  153. // uni.stopPullDownRefresh();
  154. if(res.status == 200){
  155. let list = res.list || [];
  156. introduceCount.value = res.totalNum
  157. dataInfo.list = list
  158. // if(list.length){
  159. // dataInfo.hasMore = true;
  160. // dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  161. // }else{
  162. // dataInfo.hasMore = false;
  163. // }
  164. }else{
  165. uni.showToast({
  166. icon: 'none',
  167. title: res.msg || '请求数据失败!'
  168. });
  169. }
  170. })
  171. }
  172. onLoad((option) => {
  173. dataInfo.incidentId = option.incidentId;
  174. entrance.value = option.type
  175. getList(0);
  176. })
  177. onPullDownRefresh(() => {
  178. // getList(0)
  179. })
  180. onReachBottom(() => {
  181. // dataInfo.idx += 1;
  182. // if (dataInfo.hasMore) {
  183. // getList(); // 当触底时加载更多数据
  184. // }
  185. })
  186. </script>
  187. <style lang="scss" scoped>
  188. .categoryOne{
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: space-between;
  192. .filter{
  193. width: 100%;
  194. display: flex;
  195. justify-content: flex-end;
  196. align-items: center;
  197. position: fixed;
  198. height: 80rpx;
  199. background: #fff;
  200. border-bottom: 0.25rem solid #DEDEDE;
  201. .newicon-shaixuan{
  202. margin-right: 40rpx;
  203. font-size: 36rpx;
  204. color: #2C2C2C;
  205. }
  206. }
  207. .mar-t40{
  208. margin-top: 80rpx;
  209. }
  210. .head{
  211. height: 88rpx;
  212. display: flex;
  213. align-items: center;
  214. padding: 0 24rpx;
  215. position: fixed;
  216. z-index: 99;
  217. width: 100%;
  218. box-sizing: border-box;
  219. background: #fff;
  220. font-size: 26rpx;
  221. color: $uni-primary;
  222. }
  223. .body{
  224. font-size: 30rpx;
  225. .body_item{
  226. border-bottom: 8rpx solid #DEDEDE;
  227. .title{
  228. font-weight: 600;
  229. padding: 24rpx;
  230. border-bottom: 1rpx solid #DEDEDE;
  231. }
  232. .content{
  233. color: #6A6A6A;
  234. font-size: 24rpx;
  235. padding: 24rpx;
  236. border-bottom: 1rpx solid #DEDEDE;
  237. view{
  238. display: -webkit-box;
  239. overflow: hidden;
  240. -webkit-box-orient: vertical;
  241. -webkit-line-clamp: 3;
  242. text-overflow: ellipsis;
  243. white-space: initial;
  244. }
  245. }
  246. .sign{
  247. display: flex;
  248. justify-content: space-between;
  249. padding: 24rpx 24rpx 0 24rpx;
  250. font-size: 26rpx;
  251. }
  252. .btn-style{
  253. padding: 24rpx;
  254. }
  255. }
  256. }
  257. .zanwu{
  258. margin-bottom: 140rpx;
  259. margin-top: 88rpx;
  260. display: flex;
  261. justify-content: center;
  262. .newicon-zanwu{
  263. font-size: 256rpx;
  264. color: #D6D6D6;
  265. margin-top: 140rpx;
  266. }
  267. }
  268. .foot_common_btns{
  269. position: fixed;
  270. left: 0;
  271. bottom: 0;
  272. background-color: #fff;
  273. }
  274. .back-style{
  275. background: #D6D6D6;
  276. width: 100rpx;
  277. height: 100rpx;
  278. border-radius: 50%;
  279. display: flex;
  280. justify-content: center;
  281. align-items: center;
  282. position: fixed;
  283. right: 30rpx;
  284. bottom: 30rpx;
  285. text{
  286. font-size: 50rpx;
  287. color: #fff;
  288. }
  289. }
  290. }
  291. </style>