repositoryDetails.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.versionNumber}}</text>
  7. <text>{{formatDate(dataInfo.data.createTime, 'yyyy-MM-dd HH:mm:ss')}}</text>
  8. </view>
  9. <view class="theme" v-if="dataInfo.data.type">{{dataInfo.data.type.name}}</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 v-if="editType != 'view'" @click="importData" type="default" class="primaryButton btn">引入</button>
  18. </view>
  19. <uni-popup ref="popup" type="center">
  20. <img :src="fileUrl" alt="" class="view-img">
  21. </uni-popup>
  22. </view>
  23. </template>
  24. <script setup>
  25. import { ref, reactive} from 'vue'
  26. import { onLoad } from '@dcloudio/uni-app'
  27. import { api_getSolution, api_listAttachment} from "@/http/api.js"
  28. import { useSetTitle } from '@/share/useSetTitle.js'
  29. import { useGoBack } from '@/share/useGoBack.js'
  30. import { useHandlerStore } from '@/stores/handler'
  31. import { useLoginUserStore } from '@/stores/loginUser'
  32. import { filterFormatDate } from '@/filters/filterFormatDate.js'
  33. useSetTitle();
  34. const { formatDate } = filterFormatDate();
  35. const handlerStore = useHandlerStore();
  36. const loginUserStore = useLoginUserStore();
  37. const { goBack } = useGoBack();
  38. // 故障类型
  39. const mutiCategory = ref(null)
  40. // 关联故障分类的知识库数量
  41. const introduceCount = ref(0)
  42. // tab类型
  43. const tabType = ref('null')
  44. // tab类型
  45. const editType = ref(null)
  46. // 附件图片预览
  47. const fileUrl = ref('null')
  48. // Popup状态
  49. const popup = ref(null)
  50. // 数据
  51. const dataInfo = reactive({
  52. data: [],//数据
  53. incidentId: undefined,//事件ID
  54. solutionnumber:undefined,
  55. fileData:[] //附件数据
  56. })
  57. // 下载附件
  58. function downloadFile(item){
  59. console.log(666,item)
  60. let url = location.origin + "/file" + item.relativeFilePath
  61. fileUrl.value = url
  62. let name = item.name //文件下载后的名称(带后缀)
  63. if(item.suffix=='png' || item.suffix=='jpg' || item.suffix=='gif'){
  64. popup.value.open()
  65. }else{
  66. var oA = document.createElement("a");
  67. oA.download = name;
  68. oA.href = url
  69. document.body.appendChild(oA);
  70. oA.click();
  71. oA.remove();
  72. }
  73. }
  74. // 引入
  75. function importData(){
  76. let url = null
  77. let type = handlerStore.handler.data.operateType
  78. let storeInfo = handlerStore.handler.data
  79. storeInfo.introduceCount = introduceCount.value
  80. storeInfo.handleDescription = dataInfo.data.content
  81. storeInfo.solutionId = dataInfo.data.id
  82. storeInfo.type = 'rep'
  83. storeInfo.isSummaryNext = 1
  84. handlerStore.setHandlerData(storeInfo,'assign', 'assign')
  85. if(type=='malfunction'){ //故障处理
  86. url = '/pages/handler/handler'
  87. }else if(type=='reissue'){ //补单
  88. url = '/pages/assign/assign'
  89. }
  90. uni.navigateTo({
  91. url: url
  92. })
  93. }
  94. // 获取附件
  95. function getHandlerImgs(type,id){
  96. uni.showLoading({
  97. title: "加载中",
  98. mask: true,
  99. });
  100. api_listAttachment(type, id).then(res => {
  101. uni.hideLoading();
  102. dataInfo.fileData = res.data
  103. })
  104. }
  105. // 获取列表信息
  106. function getList(){
  107. uni.showLoading({
  108. title: "加载中",
  109. mask: true,
  110. });
  111. let postData = {
  112. idx: 0,
  113. sum: 999,
  114. solution: {
  115. deleteFlag:0,
  116. hosId: loginUserStore.loginUser.user.currentHospital.id,
  117. operationType: "lookOver",
  118. solutionNumber: dataInfo.solutionnumber,
  119. }
  120. }
  121. api_getSolution(postData).then(res => {
  122. uni.hideLoading();
  123. if(res.status == 200){
  124. let list = res.list || [];
  125. introduceCount.value = res.totalNum
  126. dataInfo.data = list[0]
  127. // mutiCategory.value = list[0].category.mutiCategory
  128. getHandlerImgs('knowledge',list[0].id)
  129. }else{
  130. uni.showToast({
  131. icon: 'none',
  132. title: res.msg || '请求数据失败!'
  133. });
  134. }
  135. })
  136. }
  137. onLoad((option) => {
  138. dataInfo.incidentId = option.incidentId;
  139. dataInfo.solutionnumber = option.solutionnumber ;
  140. if(option.tabType){
  141. tabType.value = option.tabType;
  142. }
  143. if(option.editType){
  144. editType.value = option.editType
  145. }
  146. getList();
  147. })
  148. </script>
  149. <style lang="scss" scoped>
  150. .box{
  151. padding: 24rpx;
  152. .head{
  153. color: #000;
  154. font-size: 32rpx;
  155. font-weight: 600;
  156. }
  157. .sign{
  158. color: #686868;
  159. font-size: 24rpx;
  160. padding: 24rpx 0;
  161. text{
  162. margin-right: 40rpx;
  163. }
  164. }
  165. .theme{
  166. font-size: 26rpx;
  167. color: #49b856;
  168. padding: 0 0 24rpx 0;
  169. }
  170. .content{
  171. padding-bottom: 24rpx;
  172. border-bottom: 1px solid #eee;
  173. // overflow-y: scroll;
  174. }
  175. .file-list{
  176. display: flex;
  177. margin-bottom: 10rpx;
  178. margin-top: 24rpx;
  179. .file-item{
  180. color: #00aaff;
  181. text-decoration: underline;
  182. }
  183. text{
  184. margin-left: 15rpx;
  185. margin-top: 8rpx;
  186. }
  187. }
  188. .btn-style{
  189. position: fixed;
  190. left:0;
  191. bottom: 0;
  192. }
  193. .view-img{
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. </style>