floorTable.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <el-table
  3. ref="filterTable"
  4. :data="tableData"
  5. style="width: 100%"
  6. :height="maxHeight"
  7. :header-cell-style="{background:'#d9d9d9',color:'#2b2b2b'}"
  8. >
  9. <el-table-column prop="FloorName" label="模型文件" width="180">
  10. <template slot-scope="scope">
  11. <i class="el-icon-document-checked icon_font"></i>
  12. <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
  13. </template>
  14. </el-table-column>
  15. <el-table-column prop="Note" label="备注" width="180"></el-table-column>
  16. <el-table-column prop="Version" label="版本号"></el-table-column>
  17. <el-table-column prop="AcceptTime" label="上传时间"></el-table-column>
  18. <el-table-column prop="UserName" label="上传人"></el-table-column>
  19. <el-table-column prop="address" align="center" label="操作" width="240">
  20. <template slot-scope="scope">
  21. <div class="operate" v-show="!scope.row.isDown">
  22. <el-button
  23. type="primary"
  24. size="mini"
  25. class="iconfont icon-download"
  26. @click="downloadModel(scope.row)"
  27. ></el-button>
  28. <el-button
  29. type="primary"
  30. size="mini"
  31. class="iconfont icon-replace"
  32. @click="repliaceModel(scope.row)"
  33. ></el-button>
  34. <el-button
  35. type="primary"
  36. size="mini"
  37. class="iconfont icon-Log"
  38. @click="queryModelLog(scope.row)"
  39. ></el-button>
  40. </div>
  41. <div
  42. :class="[scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)? 'upLoad-loading':'','upLoad']"
  43. v-show="scope.row.isDown"
  44. >
  45. <div class="progress">
  46. <el-progress
  47. :text-inside="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)?false:true"
  48. :stroke-width="20"
  49. :percentage="scope.row.precent"
  50. :color="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11?'#909399':'#67C23A'"
  51. ></el-progress>
  52. </div>
  53. <div class="progress-right">
  54. <!-- <el-button
  55. v-show="!scope.row.Status"
  56. type="danger"
  57. class="iconfont icon-termination"
  58. @click="closeUpdate(scope.row)"
  59. circle
  60. ></el-button>-->
  61. <span v-show="!scope.row.Status && scope.row.precent == 100">上传中</span>
  62. <span v-show="scope.row.Status == 1">等待检查...</span>
  63. <span v-show="scope.row.Status == 10">模型检查中</span>
  64. <span v-show="scope.row.Status == 11">未通过检查</span>
  65. </div>
  66. </div>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </template>
  71. <script>
  72. import { mapGetters } from "vuex";
  73. export default {
  74. props: {
  75. tableData: Array,
  76. persentList: Array,
  77. modelFolderName: String
  78. },
  79. data() {
  80. return {
  81. maxHeight: 0
  82. };
  83. },
  84. computed: {
  85. ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"])
  86. },
  87. methods: {
  88. // 查看日志
  89. queryModelLog(item) {
  90. this.$emit("openModelLog", item);
  91. },
  92. // 替换日志
  93. repliaceModel(item) {
  94. if (item.Status != 4 && item.Status != 21) {
  95. this.$alert("正在识别模型对象,请稍后再替换。", "替换模型", {
  96. confirmButtonText: "确定",
  97. callback: action => {
  98. }
  99. });
  100. } else {
  101. this.$emit("replaceModel", item);
  102. }
  103. },
  104. filterTag(Id, precent) {
  105. this.$refs.filterTable.data.map(item => {
  106. if (item.Id == Id) {
  107. if (precent >= 100) {
  108. // 如过precent == 100 不能关闭进度条,
  109. if (precent == 100) {
  110. item.precent = 99;
  111. } else if (precent == 101) {
  112. // 如过precent == 101 则返回结果为suceess 不能关闭进度条,
  113. item.precent = 100;
  114. item.isDown = false;
  115. this.$emit("percentFinish");
  116. }
  117. return;
  118. } else {
  119. item.precent = precent;
  120. }
  121. }
  122. });
  123. },
  124. // 下载模型文件
  125. downloadModel(item) {
  126. if (item.Url) {
  127. let a = document.createElement("a");
  128. a.href = item.Url;
  129. a.download =`${this.modelFolderName}${item.FloorName}模型文件v${item.Version}.rvt`;
  130. a.click();
  131. } else {
  132. this.$message({
  133. message: "该文件夹下没有资源",
  134. type: "error"
  135. });
  136. }
  137. },
  138. // 停止上传
  139. closeUpdate(item) {
  140. if (this.userInfo.username == item.UserName) {
  141. this.$emit("closeUpdateFile", item);
  142. } else {
  143. this.$message({
  144. message: "您不是该文件的上传者,不能停止该文件上传!",
  145. type: "error"
  146. });
  147. }
  148. }
  149. },
  150. watch: {
  151. persentList: {
  152. immediate: true,
  153. deep: true,
  154. handler: function(val, oldVal) {
  155. if (val.length != 0) {
  156. val.map(item => {
  157. if (item.precent != 0) {
  158. this.filterTag(item.Id, item.precent);
  159. }
  160. });
  161. }
  162. }
  163. }
  164. },
  165. mounted() {
  166. this.$nextTick(function() {
  167. this.maxHeight = $("#file_moddle_manage").height() - 60; // 获取最外层的高度
  168. });
  169. }
  170. };
  171. </script>
  172. <style scoped lang="less">
  173. .box-card {
  174. height: 100%;
  175. .operate {
  176. .iconfont {
  177. font-size: 12px;
  178. padding: 7px 12px;
  179. }
  180. }
  181. .icon-termination {
  182. color: #f56c6c;
  183. background: #fff;
  184. padding: 0;
  185. border: 0;
  186. font-size: 20px;
  187. margin-left: 5px;
  188. }
  189. .upLoad {
  190. display: flex;
  191. justify-content: center;
  192. align-items: center;
  193. padding: 4px 0;
  194. .progress {
  195. // width: 150px;
  196. width: 175px;
  197. height: 20px;
  198. }
  199. .progress-right {
  200. height: 20px;
  201. line-height: 20px;
  202. }
  203. }
  204. .upLoad-loading {
  205. position: relative;
  206. justify-content: center;
  207. .progress {
  208. width: 220px;
  209. height: 20px;
  210. }
  211. .progress-right {
  212. position: absolute;
  213. left: 50%;
  214. top: 50%;
  215. transform: translate(-50%, -50%);
  216. color: #fff;
  217. }
  218. }
  219. }
  220. /deep/ .el-icon-warning {
  221. display: none;
  222. // color: transparent;
  223. }
  224. /deep/ .el-progress__text {
  225. display: none;
  226. }
  227. /deep/ .upLoad-loading .el-progress-bar {
  228. padding-right: 44px;
  229. margin-right: -44px;
  230. }
  231. /deep/ .el-progress-bar__inner {
  232. text-align: center;
  233. }
  234. </style>