floorTable.vue 8.1 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="240"></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;position:relative;top:1px;" title="查看版本更新信息" @click="handleClickVersion(scope.row)"></i>
  22. </template>
  23. </el-table-column>
  24. <el-table-column prop="AcceptTime" label="上传时间" width="200"></el-table-column>
  25. <el-table-column prop="UserName" label="上传人"></el-table-column>
  26. <el-table-column prop="address" align="center" label="操作" width="240">
  27. <template slot-scope="scope">
  28. <div class="operate" v-show="scope.row.Status == 4">
  29. <el-button title="下载模型" type="primary" size="mini" class="iconfont icon-download" @click="downloadModel(scope.row)"></el-button>
  30. <el-button title="替换模型" type="primary" size="mini" class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
  31. <el-button title="查看版本日志" type="primary" size="mini" class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
  32. </div>
  33. <div :class="['upLoad-loading']" v-show="scope.row.Status != 4">
  34. <div class="progress">
  35. <el-progress :text-inside="false" :stroke-width="20" :percentage="100" :color="scope.row.Status?'#909399':'#67C23A'"></el-progress>
  36. </div>
  37. <div class="progress-right">
  38. <span v-if="!scope.row.Status">上传中...</span>
  39. <span v-else-if="scope.row.Status == 1">等待检查...</span>
  40. <span v-else>模型检查中...</span>
  41. <!-- <span v-show="!scope.row.Status">上传中...</span>
  42. <span v-show="scope.row.Status == 1">等待检查...</span>
  43. <span v-show="scope.row.Status == 10">模型检查中...</span>
  44. <span v-show="scope.row.Status == 11">未通过检查</span>
  45. <span v-show="scope.row.Status == 2 || scope.row.Status == 20">等待数据导出...</span>
  46. <span v-show="scope.row.Status == 21">模型数据导出失败</span>
  47. <span v-show="scope.row.Status == 3">处理导出数据中...</span>
  48. <span v-show="scope.row.Status == 31">同步到数据中心失败</span> -->
  49. </div>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <version-dialog :dialogVisible.sync="dialogVisible" :modelFile="modelFile" ref="addSpaceDialog"></version-dialog>
  55. </div>
  56. </template>
  57. <script>
  58. import { mapGetters } from "vuex";
  59. import versionDialog from "@/components/model/file/versionDialog";
  60. export default {
  61. components: {
  62. versionDialog
  63. },
  64. props: {
  65. tableData: Array,
  66. persentList: Array,
  67. modelFolderName: String
  68. },
  69. data() {
  70. return {
  71. maxHeight: 0,
  72. dialogVisible: false,
  73. modelFile: null
  74. };
  75. },
  76. computed: {
  77. ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"])
  78. },
  79. methods: {
  80. // 查看日志
  81. queryModelLog(item) {
  82. this.$emit("openModelLog", item);
  83. },
  84. // 查看版本信息
  85. handleClickVersion(item) {
  86. this.modelFile = item;
  87. this.dialogVisible = true;
  88. },
  89. // 替换日志
  90. repliaceModel(item) {
  91. if (item.Status != 4) {
  92. this.$alert("正在识别模型对象,请稍后再替换。", "替换模型", {
  93. confirmButtonText: "确定",
  94. callback: action => {
  95. }
  96. });
  97. } else {
  98. this.$emit("replaceModel", item);
  99. }
  100. },
  101. filterTag(Id, precent) {
  102. this.$refs.filterTable.data.map(item => {
  103. if (item.Id == Id) {
  104. if (precent >= 100) {
  105. // 如过precent == 100 不能关闭进度条,
  106. if (precent == 100) {
  107. item.precent = 99;
  108. } else if (precent == 101) {
  109. // 如过precent == 101 则返回结果为suceess 不能关闭进度条,
  110. item.precent = 100;
  111. this.$emit("percentFinish");
  112. }
  113. return;
  114. } else {
  115. item.precent = precent;
  116. }
  117. }
  118. });
  119. },
  120. // 下载模型文件
  121. downloadModel(item) {
  122. let url = item.Url.match(/(\/image-service\S*)$/g) ? item.Url.match(/(\/image-service\S*)$/g)[0] : ''
  123. if (url) {
  124. let a = document.createElement("a");
  125. a.href = url;
  126. a.download = `${this.modelFolderName}${item.FloorName}模型文件v${item.Version}.rvt`;
  127. a.click();
  128. } else {
  129. this.$message({
  130. message: "该文件夹下没有资源",
  131. type: "error"
  132. });
  133. }
  134. },
  135. // 停止上传
  136. closeUpdate(item) {
  137. if (this.userInfo.userName == item.UserName) {
  138. this.$emit("closeUpdateFile", item);
  139. } else {
  140. this.$message({
  141. message: "您不是该文件的上传者,不能停止该文件上传!",
  142. type: "error"
  143. });
  144. }
  145. },
  146. // 跳转至模型流程处理监控
  147. toPathControl(row) {
  148. this.$router.push({
  149. path: '/model/path',
  150. query: {
  151. Id: row.CurrentModelId,
  152. Size: row.Size,
  153. OriginalName: row.OriginalName
  154. }
  155. })
  156. }
  157. },
  158. watch: {
  159. persentList: {
  160. immediate: true,
  161. deep: true,
  162. handler: function (val, oldVal) {
  163. if (val.length != 0) {
  164. val.map(item => {
  165. if (item.precent != 0) {
  166. this.filterTag(item.Id, item.precent);
  167. }
  168. });
  169. }
  170. }
  171. }
  172. }
  173. };
  174. </script>
  175. <style scoped lang="less">
  176. .box-card {
  177. height: 100%;
  178. .filterTable-container {
  179. height: calc(100% - 54px);
  180. margin-bottom: 8px;
  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>