floorTable.vue 7.1 KB

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