repository.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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,api_getDictionary } 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 dicData = ref(null)
  64. // 数据
  65. const dataInfo = reactive({
  66. list: [],//工单列表
  67. idx: 0,//页码
  68. hasMore: true,//是否有更多数据
  69. incidentId: undefined,//事件ID
  70. })
  71. // 跳转知识库详情
  72. function toCategoryTwo(data){
  73. uni.navigateTo({
  74. url: `/pages/repositoryDetails/repositoryDetails?incidentId=${dataInfo.incidentId}
  75. &solutionnumber=${data.solutionNumber}&editType=${entrance.value}`
  76. })
  77. }
  78. // 引入
  79. function importData(data){
  80. let url = null
  81. let type = handlerStore.handler.data.operateType
  82. let storeInfo = handlerStore.handler.data
  83. storeInfo.introduceCount = introduceCount.value
  84. storeInfo.handleDescription = data.content
  85. storeInfo.solutionId = data.id
  86. storeInfo.type = 'rep'
  87. storeInfo.isSummaryNext = 1
  88. handlerStore.setHandlerData(storeInfo,'assign', 'assign')
  89. if(type=='malfunction'){ //故障处理
  90. url = '/pages/handler/handler'
  91. }else if(type=='reissue'){ //补单
  92. url = '/pages/assign/assign'
  93. }
  94. uni.navigateTo({
  95. url: url
  96. })
  97. }
  98. // 点击筛选
  99. function filterClick(){
  100. isFilter.value = true;
  101. }
  102. // 确认筛选
  103. function conformFilter(evtFilter){
  104. evtFilter.value = evtFilter;
  105. isFilter.value = false;
  106. getList(evtFilter);
  107. }
  108. // 关闭筛选
  109. function cancelFilter(){
  110. isFilter.value = false;
  111. }
  112. // 获取列表信息
  113. function getList(data){
  114. uni.showLoading({
  115. title: "加载中",
  116. mask: true,
  117. });
  118. if(dataInfo.idx === 0){
  119. dataInfo.list = [];
  120. }
  121. let categoryId = entrance.value=='view' ? data && data.category : handlerStore.handler.data.category.id
  122. let postData = {
  123. idx: 0,
  124. sum: 9999,
  125. solution: {
  126. deleteFlag:0,
  127. hosId: loginUserStore.loginUser.user.currentHospital.id,
  128. // category:{
  129. // id:'',
  130. // },
  131. categoryId:null,
  132. title:'',
  133. status:{id:dicData.value.id},
  134. }
  135. }
  136. if(typeof(categoryId)=='number' || typeof(categoryId)=='string'){
  137. postData.solution.categoryId = categoryId
  138. }else{
  139. delete postData.solution.categoryId
  140. }
  141. if(data && data.title){
  142. postData.solution.title = data.title
  143. }else{
  144. delete postData.solution.title
  145. }
  146. if(loginUserStore.loginUser.user.duty){
  147. postData.solution.dutyId = loginUserStore.loginUser.user.duty.id;
  148. }else if(loginUserStore.loginUser.user.branch){
  149. postData.solution.branch = loginUserStore.loginUser.user.branch.id;
  150. }
  151. // if(entrance.value=='view'){
  152. // postData.solution.selectType = "keySearch"
  153. // postData.solution.tabType = "publish"
  154. // }
  155. api_getSolution(postData).then(res => {
  156. uni.hideLoading();
  157. // uni.stopPullDownRefresh();
  158. if(res.status == 200){
  159. let list = res.list || [];
  160. introduceCount.value = res.totalNum
  161. dataInfo.list = list
  162. // if(list.length){
  163. // dataInfo.hasMore = true;
  164. // dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
  165. // }else{
  166. // dataInfo.hasMore = false;
  167. // }
  168. }else{
  169. uni.showToast({
  170. icon: 'none',
  171. title: res.msg || '请求数据失败!'
  172. });
  173. }
  174. })
  175. }
  176. // 获取字典
  177. function getDic(){
  178. let postData = {
  179. "key": 'solution_status',
  180. "type": "list",
  181. };
  182. api_getDictionary(postData).then(res => {
  183. dicData.value = res.find(v => v.value == '3');
  184. getList();
  185. })
  186. }
  187. onLoad((option) => {
  188. dataInfo.incidentId = option.incidentId;
  189. entrance.value = option.type
  190. getDic()
  191. })
  192. onPullDownRefresh(() => {
  193. // getList(0)
  194. })
  195. onReachBottom(() => {
  196. // dataInfo.idx += 1;
  197. // if (dataInfo.hasMore) {
  198. // getList(); // 当触底时加载更多数据
  199. // }
  200. })
  201. </script>
  202. <style lang="scss" scoped>
  203. .categoryOne{
  204. display: flex;
  205. flex-direction: column;
  206. justify-content: space-between;
  207. .filter{
  208. width: 100%;
  209. display: flex;
  210. justify-content: flex-end;
  211. align-items: center;
  212. position: fixed;
  213. height: 80rpx;
  214. background: #fff;
  215. border-bottom: 0.25rem solid #DEDEDE;
  216. .newicon-shaixuan{
  217. margin-right: 40rpx;
  218. font-size: 36rpx;
  219. color: #2C2C2C;
  220. }
  221. }
  222. .mar-t40{
  223. margin-top: 80rpx;
  224. }
  225. .head{
  226. height: 88rpx;
  227. display: flex;
  228. align-items: center;
  229. padding: 0 24rpx;
  230. position: fixed;
  231. z-index: 99;
  232. width: 100%;
  233. box-sizing: border-box;
  234. background: #fff;
  235. font-size: 26rpx;
  236. color: $uni-primary;
  237. }
  238. .body{
  239. font-size: 30rpx;
  240. .body_item{
  241. border-bottom: 8rpx solid #DEDEDE;
  242. .title{
  243. font-weight: 600;
  244. padding: 24rpx;
  245. border-bottom: 1rpx solid #DEDEDE;
  246. }
  247. .content{
  248. color: #6A6A6A;
  249. font-size: 24rpx;
  250. padding: 24rpx;
  251. border-bottom: 1rpx solid #DEDEDE;
  252. view{
  253. display: -webkit-box;
  254. overflow: hidden;
  255. -webkit-box-orient: vertical;
  256. -webkit-line-clamp: 3;
  257. text-overflow: ellipsis;
  258. white-space: initial;
  259. }
  260. }
  261. .sign{
  262. display: flex;
  263. justify-content: space-between;
  264. padding: 24rpx 24rpx 0 24rpx;
  265. font-size: 26rpx;
  266. }
  267. .btn-style{
  268. padding: 24rpx;
  269. }
  270. }
  271. }
  272. .zanwu{
  273. margin-bottom: 140rpx;
  274. margin-top: 88rpx;
  275. display: flex;
  276. justify-content: center;
  277. .newicon-zanwu{
  278. font-size: 256rpx;
  279. color: #D6D6D6;
  280. margin-top: 140rpx;
  281. }
  282. }
  283. .foot_common_btns{
  284. position: fixed;
  285. left: 0;
  286. bottom: 0;
  287. background-color: #fff;
  288. }
  289. .back-style{
  290. background: #D6D6D6;
  291. width: 100rpx;
  292. height: 100rpx;
  293. border-radius: 50%;
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. position: fixed;
  298. right: 30rpx;
  299. bottom: 30rpx;
  300. text{
  301. font-size: 50rpx;
  302. color: #fff;
  303. }
  304. }
  305. }
  306. </style>