child.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div class="contrl">
  3. <div style="width: 95%;">
  4. <div class="title-div">
  5. <p>{{ projectStore.projectInfo.projectName }}</p>
  6. </div>
  7. <div class="createNew-div">
  8. <img src="../../../assets/icons/word.png" style="width: 32px; height: 32px; float: left;margin-top: 22px;" />
  9. <span style="margin-left: 10px;">新的报告</span>
  10. <img src="../../../assets/icons/plus.png" style="width: 32px; height: 32px;float: right;margin-top: 22px;" />
  11. </div>
  12. <div class="createNew-div" @click="getCalculateProgress()">
  13. <img src="../../../assets/icons/excel.png" style="width: 32px; height: 32px; float: left;margin-top: 22px;" />
  14. <span style="margin-left: 10px;">新的测算表</span>
  15. <img src="../../../assets/icons/plus.png" style="width: 32px; height: 32px;float: right;margin-top: 22px;" />
  16. </div>
  17. </div>
  18. <div class="example-list report-div">
  19. <el-card class="report-item no-border" shadow="never" v-for="item in calculateList" @click="doCalculateBench(item)">
  20. <div class="report-icon">
  21. <img src="../../../assets/icons/excel.png" style="width: 52px; height: 52px;" />
  22. </div>
  23. <div class="report-text">
  24. <span class="report-text-type">{{ item.projectTypeName }}</span>
  25. <span> 一 </span>
  26. <span class="report-text-name">{{ item.calculateName }}
  27. </span>
  28. <div style="margin-top: 5px;">
  29. <span>
  30. <el-icon>
  31. <Avatar />
  32. </el-icon>
  33. {{ item.principal }}</span>
  34. <!-- <span>
  35. <el-tag style="margin-left: 5px;">
  36. {{ item.projectTypeName }}
  37. </el-tag>
  38. </span> -->
  39. <span style="float: right; color:darkgrey">
  40. {{ item.createTime }}
  41. </span>
  42. </div>
  43. </div>
  44. <div class="report-button" @click.stop="downloadFile(item.docUrl, item.docName)">
  45. <el-icon>
  46. <Download />
  47. </el-icon>
  48. </div>
  49. </el-card>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import { mapStores } from 'pinia'
  55. import { assetsProjectInfo } from '@/stores/assetsProjectStore';
  56. import { getUnFinishedCalculateProgress, listAllByProjectId } from '@/api/assetsCalculate';
  57. import fileUtil from '@/utils/file'
  58. export default {
  59. name: 'assetsChild',
  60. data() {
  61. return {
  62. msg: 0,
  63. projectInfo: {},
  64. folderName: null,
  65. calculateList: []
  66. }
  67. },
  68. computed: {
  69. ...mapStores(assetsProjectInfo),
  70. },
  71. created() {
  72. this.projectInfo = this.$route.query;
  73. this.getCalculateList();
  74. },
  75. methods: {
  76. createNewCalculate() {
  77. this.$router.push({ path: '/home/assets/workbench/calculate/baseInfo', query: { 'projectId': this.projectInfo.projectId } })
  78. },
  79. nextFolder() {
  80. },
  81. // 获取未完成测算表的进度信息并保存到缓存
  82. getCalculateProgress() {
  83. getUnFinishedCalculateProgress(this.projectStore.projectInfo.id).then(res => {
  84. if (res.data) {
  85. // 根据不同进度跳转到不同步骤页面
  86. if (res.data.progress === 'IMPORT' || res.data.progress === 'GENERATE' || res.data.progress === 'FINISHED') {
  87. this.$router.push('/home/assets/workbench/calculate/importInfo')
  88. } else if (res.data.progress === 'BASE') {
  89. this.$router.push('/home/assets/workbench/calculate/eqptBaseInfo')
  90. }
  91. this.projectStore.setCalculateProgress(res.data);
  92. } else {
  93. // 为空说明没有未完成的测算,从头开始新建
  94. this.createNewCalculate();
  95. this.projectStore.removeCalculateProgress();
  96. }
  97. })
  98. },
  99. // 前往测算表详情
  100. doCalculateBench(item) {
  101. this.projectStore.setCalculateProgress(item);
  102. // 根据不同进度跳转到不同步骤页面
  103. if (item.progress === 'IMPORT' || item.progress === 'GENERATE' || item.progress === 'FINISHED') {
  104. this.$router.push('/home/assets/workbench/calculate/importInfo')
  105. } else if (item.progress === 'BASE') {
  106. this.$router.push('/home/assets/workbench/calculate/eqptBaseInfo')
  107. }
  108. },
  109. // 获取测算表list
  110. getCalculateList() {
  111. listAllByProjectId(this.projectStore.projectInfo.id).then(res => {
  112. if (res.data) {
  113. this.calculateList = res.data;
  114. }
  115. })
  116. },
  117. // 下载文件
  118. downloadFile(docUrl, docName) {
  119. if (docUrl && docName) {
  120. let downloadUrl = '/file/download?fileDiskPath=' + docUrl + '&fileName=' + docName
  121. fileUtil.download(downloadUrl);
  122. } else {
  123. ElMessage({
  124. showClose: true,
  125. message: '文档还未生成,请完成生成步骤!',
  126. type: 'warning'
  127. })
  128. }
  129. }
  130. },
  131. }
  132. </script>
  133. <style scoped>
  134. .base {
  135. min-height: calc(100vh - 80px);
  136. width: 100%;
  137. }
  138. .content {
  139. margin-left: 160px;
  140. margin-right: 160px;
  141. padding: 50px 20px 20px 20px;
  142. }
  143. .contrl {
  144. width: 70.9%;
  145. border-right: 1.5px #dae1eb solid;
  146. padding: 0px 20px 20px 0px;
  147. float: left;
  148. }
  149. .report-div {
  150. margin-top: 100px;
  151. min-height: 600px;
  152. }
  153. :deep(.el-tabs__active-bar) {
  154. background-color: #ff6154;
  155. }
  156. :deep(.el-tabs__item.is-active) {
  157. color: #ff6154;
  158. }
  159. :deep(.el-tabs__item:hover) {
  160. color: #ff6154;
  161. }
  162. .title-div {
  163. width: 500px;
  164. float: left;
  165. overflow-y: hidden;
  166. height: 80px;
  167. }
  168. .createNew-div {
  169. height: 80px;
  170. line-height: 80px;
  171. border: #dae1eb 1.5px solid;
  172. border-radius: 0.6em;
  173. width: 200px;
  174. float: right;
  175. padding-left: 10px;
  176. padding-right: 10px;
  177. margin-left: 20px;
  178. }
  179. .createNew-div:hover {
  180. cursor: pointer;
  181. background-color: #dae1eb;
  182. border: #dae1eb 1.5px solid;
  183. transition: 0.5s;
  184. }
  185. :deep(.el-tabs__nav-wrap:after) {
  186. background-color: white;
  187. }
  188. .null-div {
  189. width: 100%;
  190. height: 100%;
  191. text-align: center;
  192. margin-top: 20%;
  193. color: var(--vt-c-text-light-2);
  194. }
  195. .no-border {
  196. border: none;
  197. }
  198. .no-border:hover {
  199. cursor: pointer;
  200. }
  201. </style>