floorTable.vue 7.4 KB

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