floorTable.vue 7.6 KB

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