exportExcel.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="export-excel">
  3. <el-dialog
  4. :title="values.relation_maintenance"
  5. :visible.sync="dialogExport"
  6. >
  7. <p class="option-tip">{{values.optionTips}}</p>
  8. <el-row :span="24">
  9. <el-col :span="8">
  10. <p>
  11. <i class="iconfont icon-doc-line"/>
  12. {{values.currentNum}} 0
  13. </p>
  14. <a :href="downloadProject('excel')">
  15. <el-button
  16. type="primary"
  17. class="mt-10"
  18. >
  19. {{values.download}}
  20. </el-button>
  21. </a>
  22. </el-col>
  23. <el-col :span="10">
  24. {{values.lastTime}}
  25. </el-col>
  26. </el-row>
  27. <el-upload
  28. class="upload-demo"
  29. drag
  30. action="/api/datacenter/graphic/import"
  31. multiple
  32. :show-file-list='false'
  33. name="file"
  34. :headers="headers"
  35. :data="dataId"
  36. :on-progress="progress"
  37. :on-success="success"
  38. :on-error="error"
  39. accept="xlsx,xls"
  40. >
  41. <i class="el-icon-upload"/>
  42. <div
  43. class="el-upload__text"
  44. v-html="values.uploadTxt"
  45. />
  46. <div class="upload__tip danger" slot="tip">{{ values.uploadTips}}</div>
  47. </el-upload>
  48. </el-dialog>
  49. <!--手动编辑:手动维护.process结束-->
  50. <el-dialog
  51. :title="values.relation_maintenance"
  52. :visible.sync="dialogProcess"
  53. >
  54. <div class="block">
  55. <el-timeline>
  56. <el-timeline-item
  57. v-for="(activity, index) in activities"
  58. :key="index"
  59. :icon="activity.icon"
  60. :type="activity.type"
  61. :color="activity.color"
  62. :size="activity.size"
  63. >
  64. {{activity.content}}
  65. </el-timeline-item>
  66. </el-timeline>
  67. </div>
  68. <!-- 下载报告-->
  69. <a :href="downloadProject('report')">
  70. <el-button>{{values.downloadFile}}</el-button>
  71. </a>
  72. <footer
  73. slot="footer"
  74. class="dialog-footer "
  75. >
  76. <el-button @click="errBack">{{values.back}}</el-button>
  77. <el-button
  78. type="primary"
  79. @click="finish"
  80. >{{values.done}}
  81. </el-button>
  82. </footer>
  83. </el-dialog>
  84. </div>
  85. </template>
  86. <script>
  87. import {mapGetters} from 'vuex'
  88. import storage from '@/framework/utils/storage'
  89. export default {
  90. name: "exportExcel",
  91. props: ['values'],
  92. data() {
  93. return {
  94. dialogExport: false,
  95. dialogProcess: false,
  96. activities: [{
  97. content: '数据文件处理中..',
  98. size: 'large',
  99. type: 'primary',
  100. icon: 'el-icon-check',
  101. color: '#0bbd87'
  102. }, {
  103. content: '数据处理成功',
  104. color: '#0bbd87',
  105. icon: 'el-icon-check',
  106. size: 'large',
  107. type: 'primary',
  108. }],
  109. }
  110. },
  111. computed: {
  112. ...mapGetters('layout', ['projectId']),
  113. headers() {
  114. return {
  115. 'ProjectId': this.projectId,
  116. 'Comming': 'adm',
  117. 'Account': storage.get("user_name")
  118. }
  119. },
  120. dataId() {
  121. return {
  122. // relType: this.ManualMaintenance.RelationType || '',
  123. // zoneType: this.ManualMaintenance.ZoneType || '',
  124. // projectId: this.projectId
  125. }
  126. },
  127. },
  128. methods: {
  129. downloadProject(str) {
  130. // let relType = this.ManualMaintenance.RelationType ? `?relType=${this.ManualMaintenance.RelationType}` : ''
  131. // let zoneType = this.ManualMaintenance.ZoneType ? `&zoneType=${this.ManualMaintenance.ZoneType}` : ''
  132. // let url;
  133. // if (str === 'excel') {
  134. // relType = this.ManualMaintenance.RelationType ? `&relType=${this.ManualMaintenance.RelationType}` : ''
  135. // url = `/api/datacenter/graphic/export?code=对象ID${relType}${zoneType}`
  136. // } else {
  137. // url = `/api/datacenter/graphic/report-downloads${relType}${zoneType}`
  138. // }
  139. // return url
  140. },
  141. progress(event, file, fileList) {
  142. // console.log(event.file, fileList)
  143. },
  144. success(event, file, fileList) {
  145. this.dialogExport = true
  146. this.dialogProcess = true
  147. },
  148. error(event, file, fileList) {
  149. this.dialogExport = true
  150. this.dialogProcess = true
  151. },
  152. errBack() {
  153. this.dialogProcess = false
  154. },
  155. finish() {
  156. this.dialogProcess = false
  157. this.dialogExport = false
  158. },
  159. }
  160. }
  161. </script>
  162. <style scoped lang="less">
  163. .export-excel {
  164. .mt-10 {
  165. margin-top: 10px;
  166. }
  167. .danger {
  168. color: #d9001b;
  169. }
  170. .font-big {
  171. font-weight: 600;
  172. }
  173. .exist-title {
  174. font-size: 12px;
  175. color: #AAAAAA;
  176. }
  177. .option-tip {
  178. font-size: 18px;
  179. font-weight: 600;
  180. }
  181. .upload-demo {
  182. margin: 20px 0;
  183. }
  184. /deep/ .el-upload-dragger {
  185. width: 600px;
  186. margin: 0 auto;
  187. }
  188. }
  189. </style>