floorTable.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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="模型校验完成..."
  7. @click="toPathControl(scope.row)"></i>
  8. <i v-else-if="scope.row.Status == 31" class="iconfont icon-yun--tianchong1" style="color:#F56C6C;cursor:pointer;fontSize:18px;"
  9. title="同步到数据中心出问题..." @click="toPathControl(scope.row)"></i>
  10. <i v-else-if="scope.row.Status == 21" class="iconfont icon-yun--tianchong1" style="color:#F56C6C;cursor:pointer;fontSize:18px;"
  11. title="模型数据导出出问题..." @click="toPathControl(scope.row)"></i>
  12. <i v-else class="iconfont icon-yun--tianchong2" style="color:#E6A23C;cursor:pointer;fontSize:18px;" title="模型校验进行中..."
  13. @click="toPathControl(scope.row)"></i>
  14. <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column prop="Note" label="备注" width="180"></el-table-column>
  18. <el-table-column label="版本号">
  19. <template slot-scope="scope">
  20. <span style="margin-right: 5px">{{ scope.row.Version }}</span>
  21. <i v-show="scope.row.Version && scope.row.Status == 4" class="iconfont icon-warn" style="cursor:pointer;" title="查看版本更新信息"
  22. @click="handleClickVersion(scope.row)"></i>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="AcceptTime" label="上传时间" width="140"></el-table-column>
  26. <el-table-column prop="UserName" label="上传人"></el-table-column>
  27. <el-table-column prop="address" align="center" label="操作" width="240">
  28. <template slot-scope="scope">
  29. <div class="operate" v-show="scope.row.Status == 4">
  30. <el-button title="下载模型" type="primary" size="mini" class="iconfont icon-download" @click="downloadModel(scope.row)"></el-button>
  31. <el-button title="替换模型" type="primary" size="mini" class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
  32. <el-button title="查看版本日志" type="primary" size="mini" class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
  33. </div>
  34. <div :class="['upLoad-loading']" v-show="scope.row.Status != 4">
  35. <div class="progress">
  36. <el-progress :text-inside="false" :stroke-width="20" :percentage="100" :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. toPathControl(row) {
  149. this.$router.push({
  150. path: '/model/path',
  151. query: {
  152. Id: row.CurrentModelId,
  153. Size: row.Size,
  154. OriginalName: row.OriginalName
  155. }
  156. })
  157. }
  158. },
  159. watch: {
  160. persentList: {
  161. immediate: true,
  162. deep: true,
  163. handler: function (val, oldVal) {
  164. if (val.length != 0) {
  165. val.map(item => {
  166. if (item.precent != 0) {
  167. this.filterTag(item.Id, item.precent);
  168. }
  169. });
  170. }
  171. }
  172. }
  173. }
  174. };
  175. </script>
  176. <style scoped lang="less">
  177. .box-card {
  178. height: 100%;
  179. .filterTable-container {
  180. height: calc(100% - 80px);
  181. }
  182. .operate {
  183. .iconfont {
  184. font-size: 12px;
  185. padding: 7px 12px;
  186. }
  187. }
  188. .icon-termination {
  189. color: #f56c6c;
  190. background: #fff;
  191. padding: 0;
  192. border: 0;
  193. font-size: 20px;
  194. margin-left: 5px;
  195. }
  196. .upLoad {
  197. display: flex;
  198. justify-content: center;
  199. align-items: center;
  200. padding: 4px 0;
  201. .progress {
  202. // width: 150px;
  203. width: 175px;
  204. height: 20px;
  205. }
  206. .progress-right {
  207. height: 20px;
  208. line-height: 20px;
  209. }
  210. }
  211. .upLoad-loading {
  212. position: relative;
  213. justify-content: center;
  214. .progress {
  215. width: 220px;
  216. height: 20px;
  217. }
  218. .progress-right {
  219. position: absolute;
  220. left: 50%;
  221. top: 50%;
  222. transform: translate(-50%, -50%);
  223. color: #fff;
  224. }
  225. }
  226. }
  227. /deep/ .el-icon-warning {
  228. display: none;
  229. // color: transparent;
  230. }
  231. /deep/ .el-progress__text {
  232. display: none;
  233. }
  234. /deep/ .upLoad-loading .el-progress-bar {
  235. padding-right: 44px;
  236. margin-right: -44px;
  237. }
  238. /deep/ .el-progress-bar__inner {
  239. text-align: center;
  240. }
  241. </style>