repositoryDetails.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="box">
  3. <view class="head">{{dataInfo.data.title}}</view>
  4. <view class="sign">
  5. <text>引入次数:{{dataInfo.data.introduceCount?dataInfo.data.introduceCount: 0}}</text>
  6. <text>版本号:{{dataInfo.data.visionNumber}}</text>
  7. <text>{{dataInfo.data.createtime}}</text>
  8. </view>
  9. <view class="theme">{{mutiCategory}}</view>
  10. <view class="content" v-html="dataInfo.data.content"></view>
  11. <view class="file-list" v-for="item in dataInfo.fileData" :key="item">
  12. <view class="file-item" @click="downloadFile(item)">{{item.name}}</view>
  13. <text class="newicon newicon-xiazai" @click="downloadFile(item)"></text>
  14. </view>
  15. <view class="foot_common_btns btn-style">
  16. <button @click="goBack" type="default" class="cancelButton btn">返回</button>
  17. <button @click="importData" type="default" class="primaryButton btn ">引入</button>
  18. </view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import { ref, reactive} from 'vue'
  23. import { onLoad } from '@dcloudio/uni-app'
  24. import { api_getSolution, api_listAttachment} from "@/http/api.js"
  25. import { useSetTitle } from '@/share/useSetTitle.js'
  26. import { useGoBack } from '@/share/useGoBack.js'
  27. import { useHandlerStore } from '@/stores/handler'
  28. useSetTitle();
  29. const handlerStore = useHandlerStore();
  30. const { goBack } = useGoBack();
  31. // 故障类型
  32. const mutiCategory = ref(null)
  33. // 操作类型
  34. // const operateType = ref(null)
  35. // 关联故障分类的知识库数量
  36. const introduceCount = ref(0)
  37. // tab类型
  38. const tabType = ref('null')
  39. // 数据
  40. const dataInfo = reactive({
  41. data: [],//数据
  42. incidentId: undefined,//事件ID
  43. solutionnumber:undefined,
  44. fileData:[] //附件数据
  45. })
  46. // 下载附件
  47. function downloadFile(item){
  48. console.log(666,item)
  49. let url = location.origin + "/file" + item.relativeFilePath
  50. uni.downloadFile({
  51. url: url, //仅为示例,并非真实的资源
  52. success: (res) => {
  53. if (res.statusCode === 200) {
  54. console.log('下载成功');
  55. }
  56. }
  57. });
  58. }
  59. // 引入
  60. function importData(){
  61. let url = null
  62. let type = handlerStore.handler.data.operateType
  63. let storeInfo = handlerStore.handler.data
  64. storeInfo.introduceCount = introduceCount.value
  65. storeInfo.handleDescription = dataInfo.data.content
  66. storeInfo.solutionId = dataInfo.data.id
  67. storeInfo.type = 'rep'
  68. storeInfo.isSummaryNext = 1
  69. handlerStore.setHandlerData(storeInfo,'assign', 'assign')
  70. if(type=='malfunction'){ //故障处理
  71. url = '/pages/handler/handler'
  72. }else if(type=='reissue'){ //补单
  73. url = '/pages/assign/assign'
  74. }
  75. uni.navigateTo({
  76. url: url
  77. })
  78. }
  79. // 获取附件
  80. function getHandlerImgs(type,id){
  81. uni.showLoading({
  82. title: "加载中",
  83. mask: true,
  84. });
  85. api_listAttachment(type, id).then(res => {
  86. uni.hideLoading();
  87. dataInfo.fileData = res.data
  88. })
  89. }
  90. // 获取列表信息
  91. function getList(){
  92. uni.showLoading({
  93. title: "加载中",
  94. mask: true,
  95. });
  96. let postData = {
  97. idx: dataInfo.idx,
  98. sum: 20,
  99. solution: {
  100. solutionnumber: dataInfo.solutionnumber,
  101. }
  102. }
  103. api_getSolution(postData).then(res => {
  104. uni.hideLoading();
  105. if(res.status == 200){
  106. let list = res.list || [];
  107. introduceCount.value = res.totalNum
  108. dataInfo.data = list[0]
  109. mutiCategory.value = list[0].category.mutiCategory
  110. getHandlerImgs('knowledge',list[0].id)
  111. }else{
  112. uni.showToast({
  113. icon: 'none',
  114. title: res.msg || '请求数据失败!'
  115. });
  116. }
  117. })
  118. }
  119. onLoad((option) => {
  120. dataInfo.incidentId = option.incidentId;
  121. dataInfo.solutionnumber = option.solutionnumber ;
  122. // operateType.value = decodeURIComponent(option.operateType);
  123. if(option.tabType){
  124. tabType.value = option.tabType;
  125. }
  126. getList();
  127. })
  128. </script>
  129. <style lang="scss" scoped>
  130. .box{
  131. padding: 24rpx;
  132. .head{
  133. color: #000;
  134. font-size: 32rpx;
  135. font-weight: 600;
  136. }
  137. .sign{
  138. color: #686868;
  139. font-size: 24rpx;
  140. padding: 24rpx 0;
  141. text{
  142. margin-right: 40rpx;
  143. }
  144. }
  145. .theme{
  146. font-size: 26rpx;
  147. color: #49b856;
  148. padding: 0 0 24rpx 0;
  149. }
  150. .content{
  151. padding-bottom: 24rpx;
  152. border-bottom: 1px solid #eee;
  153. // overflow-y: scroll;
  154. }
  155. .file-list{
  156. display: flex;
  157. margin-bottom: 10rpx;
  158. margin-top: 24rpx;
  159. .file-item{
  160. color: #00aaff;
  161. text-decoration: underline;
  162. }
  163. text{
  164. margin-left: 15rpx;
  165. margin-top: 8rpx;
  166. }
  167. }
  168. .btn-style{
  169. position: fixed;
  170. bottom: 40rpx;
  171. width: 93.5%;
  172. padding: 0;
  173. }
  174. }
  175. </style>