index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <div id="file_moddle_manage" v-loading="loading">
  3. <!-- 左边模型文件夹列表 -->
  4. <div class="col_left">
  5. <div class="grid-content grid-left">
  6. <el-card class="box-card" :body-style="{ padding: '0px', height: '100%' }">
  7. <div class="top_hand left_top_hand">
  8. <div class="folder-box">
  9. <el-tooltip class="item" effect="dark" content="新建建筑" placement="top-start">
  10. <el-button icon="el-icon-plus" size="small" @click="addBuild"></el-button>
  11. </el-tooltip>
  12. <el-tooltip class="item" effect="dark" content="删除建筑" placement="top-start">
  13. <el-button icon="el-icon-minus" size="small" @click="deleteBuild"></el-button>
  14. </el-tooltip>
  15. <el-tooltip class="item" effect="dark" content="编辑建筑" placement="top-start">
  16. <el-button @click="updateBuild" icon="el-icon-edit-outline" size="small"></el-button>
  17. </el-tooltip>
  18. </div>
  19. </div>
  20. <div class="folder-list">
  21. <div class="head">建筑</div>
  22. <ul class="lists">
  23. <el-scrollbar style="height: 100%">
  24. <li
  25. @click="openFolder(index, item)"
  26. v-for="(item, index) in navigationBuild"
  27. :key="index"
  28. :class="[choiceIndex === index + 1 ? 'li-active' : '']"
  29. >
  30. <i
  31. :class="[choiceIndex === index + 1 ? 'el-icon-folder-opened' : 'el-icon-folder', 'icon_font']"
  32. width="40"
  33. height="40"
  34. ></i>
  35. <span :title="item.Name">{{ item.Name }}</span>
  36. </li>
  37. </el-scrollbar>
  38. </ul>
  39. </div>
  40. </el-card>
  41. </div>
  42. </div>
  43. <!-- 右边文件表格 -->
  44. <div class="col_right">
  45. <el-card class="box-card" :body-style="{ padding: '0px', height: '100%' }">
  46. <!-- 顶部操作栏 -->
  47. <div class="top_hand right_top_hand">
  48. <el-button size="small" @click="addFloorFileVisible = true">添加楼层模型文件</el-button>
  49. <el-button size="small" @click="queryFloorFile(currentFolderId)">刷新</el-button>
  50. </div>
  51. <!-- 列表 -->
  52. <floor-table
  53. v-loading="tableLoading"
  54. ref="floorTable"
  55. :tableData="tableData"
  56. :modelFolderName="currentFolderName"
  57. @openModelLog="queryModelLog"
  58. @replaceModel="repliaceModel"
  59. ></floor-table>
  60. </el-card>
  61. </div>
  62. <!-- 弹窗 开始-->
  63. <!-- 模型日志弹窗 -->
  64. <!-- <modelLog
  65. :modelLogVisible="modelLogVisible"
  66. :modelFolderName="currentFolderName"
  67. @deleteFinish="updataLog"
  68. @CloseModelLogDia="modelLogVisible = false"
  69. :logData="logData"
  70. ></modelLog> -->
  71. <!-- 替换模型弹窗 -->
  72. <replice-model
  73. :repliceModelVisible="repliceModelVisible"
  74. @closeReplaceModelDia="repliceModelVisible = false"
  75. :replaceModelItem="replaceModelItem"
  76. @uploadModelFile="uploadModelFile"
  77. ></replice-model>
  78. <!-- 新增楼层 -->
  79. <add-floor-dialog
  80. :addFloorFileVisible="addFloorFileVisible"
  81. :floorList="tableData"
  82. :FolderName="currentFolderName"
  83. :FolderId="currentFolderId"
  84. @closeAddFloorDia="addFloorFileVisible = false"
  85. @uploadModelFile="uploadModelFile"
  86. ></add-floor-dialog>
  87. <!-- 新增文件夹名称 -->
  88. <!-- <addFolder
  89. :addFolderVisible="addFolderVisible"
  90. @closeAddFolderVisible="
  91. addFolderVisible = false;
  92. folderName = '';
  93. "
  94. :folderName="folderName"
  95. @getfolderModel="queryModel"
  96. ></addFolder> -->
  97. <!-- 编辑文件夹名字 -->
  98. <!-- <changeFolderName
  99. :currentFolderId="currentFolderId"
  100. :changeFolderNameVisible="changeFolderNameVisible"
  101. :folderName="folderName"
  102. @finishChangeFolderName="queryModel"
  103. @closeChangeFolderVisible="
  104. changeFolderNameVisible = false;
  105. folderName = '';
  106. "
  107. ></changeFolderName> -->
  108. <!-- 弹窗 结束-->
  109. </div>
  110. </template>
  111. <script lang="ts">
  112. import { Vue, Component, Watch } from "vue-property-decorator";
  113. import { UserModule } from "@/store/modules/user";
  114. import { queryModel, queryFloorList } from "@/api/modelapi";
  115. import Bus from "@/utils/bus";
  116. import FloorTable from "./components/FloorTable/index.vue"; //右侧list表
  117. import AddFloorDialog from "./components/AddFloorDialog/index.vue"; //新增楼层弹窗
  118. import RepliceModel from "./components/RepliceModel/index.vue"; //替换模型弹窗
  119. @Component({
  120. name: "buildFloor",
  121. components: {
  122. FloorTable,
  123. AddFloorDialog,
  124. RepliceModel,
  125. },
  126. })
  127. export default class extends Vue {
  128. private addFolderVisible = false; // 是否显示新增文件夹弹窗
  129. private addFloorFileVisible = false; // 是否显示增加楼层文件弹窗
  130. private repliceModelVisible = false; // 是否显示替换楼层模型弹窗
  131. private modelLogVisible = false; // 是否显示模型日志弹窗
  132. private changeFolderNameVisible = false; // 是否显示编辑文件夹弹窗
  133. private navigationBuild: any[] = []; // 文件夹模型list
  134. private choiceIndex = 0; // 当前文件夹index
  135. private currentFolderId = ""; // 当前选择的文件夹id
  136. private currentFolderName = ""; // 当前选择文件夹的Name
  137. private tableData = []; // 楼层列表
  138. private loading = false; // 加载loading
  139. private tableLoading = false; // 表格加载loading
  140. private replaceModelItem = null; // 替换文件的item
  141. private get projectId(): string {
  142. return UserModule.projectId;
  143. }
  144. mounted() {
  145. this.queryModel();
  146. Bus.$on("modelStatusChange", () => {
  147. this.queryFloorFile(this.currentFolderId);
  148. });
  149. }
  150. /**
  151. * 打开模型文件夹
  152. */
  153. private openFolder(index: number, item: any): void {
  154. this.choiceIndex = index + 1;
  155. this.currentFolderId = item.Id;
  156. this.currentFolderName = item.Name;
  157. // 获取模型文件夹对应得楼层文件
  158. this.queryFloorFile(this.currentFolderId);
  159. }
  160. /**
  161. * 新增建筑
  162. */
  163. private addBuild(): void {
  164. return;
  165. }
  166. /**
  167. * 删除建筑
  168. */
  169. private deleteBuild(): void {
  170. return;
  171. }
  172. /**
  173. * 维护建筑
  174. */
  175. private updateBuild(): void {
  176. return;
  177. }
  178. /**
  179. * 查询所有文件夹模型
  180. */
  181. private async queryModel(): Promise<void> {
  182. this.navigationBuild = [];
  183. this.loading = true;
  184. const res = await queryModel({ Orders: "Name asc" });
  185. this.navigationBuild = res.Content;
  186. this.loading = false;
  187. if (this.navigationBuild.length) {
  188. //默认选择第一个文件夹
  189. this.choiceIndex = 1;
  190. this.currentFolderName = this.navigationBuild[0].Name;
  191. this.currentFolderId = this.navigationBuild[0].Id;
  192. this.queryFloorFile(this.currentFolderId);
  193. } else {
  194. this.tableData = [];
  195. }
  196. }
  197. /**
  198. * 查询建筑下的楼层
  199. *
  200. * @info: 状态显示说明
  201. * 0: 上传中(上传的用户可操作:中止)
  202. * 1: 等待检查
  203. * 10: 模型检查中
  204. * 11: 未通过检查
  205. * 2、20、21、3、31: 正常(所有用户可操作:下载、查看历史)
  206. * 4: 正常(所有用户可操作:下载、替换、查看历史)
  207. *
  208. * @param currentFolderId 当前选中的建筑Id
  209. */
  210. private async queryFloorFile(currentFolderId: string): Promise<void> {
  211. if (currentFolderId) {
  212. this.tableData = [];
  213. this.tableLoading = true;
  214. let params = {
  215. Filters: `FolderId='${currentFolderId}'`,
  216. PageNumber: 1,
  217. PageSize: 1000,
  218. };
  219. const res = await queryFloorList(params);
  220. this.tableData = res.Content;
  221. this.tableLoading = false;
  222. }
  223. }
  224. /**
  225. * 打开替换文件模型
  226. */
  227. private repliaceModel(item: any): void {
  228. this.replaceModelItem = item;
  229. this.repliceModelVisible = true;
  230. }
  231. /**
  232. * 上传模型文件
  233. */
  234. private uploadModelFile(data: any) {
  235. Bus.$emit(
  236. "openUploader",
  237. {
  238. uploadId: data.uploadId,
  239. modelId: data.modelId,
  240. systemId: "revit", //系统名称
  241. secret: "63afbef6906c342b", //系统密码
  242. },
  243. data.file.raw
  244. );
  245. this.queryFloorFile(this.currentFolderId);
  246. }
  247. /**
  248. * 查看模型日志
  249. */
  250. private queryModelLog(item: any): void {
  251. console.log(item);
  252. }
  253. @Watch("projectId")
  254. onProjectIdChanged() {
  255. this.queryModel();
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. #file_moddle_manage {
  261. width: 100%;
  262. height: 100%;
  263. display: flex;
  264. overflow: hidden !important;
  265. .col_left {
  266. width: 280px;
  267. height: 100%;
  268. }
  269. .col_right {
  270. width: calc(100% - 280px);
  271. height: 100%;
  272. }
  273. .grid-content {
  274. height: 100%;
  275. }
  276. .box-card {
  277. height: 100%;
  278. }
  279. .grid-left {
  280. padding-right: 10px;
  281. box-sizing: border-box;
  282. }
  283. // 顶部
  284. .top_hand {
  285. // height: 60px;
  286. width: 100%;
  287. padding: 10px;
  288. box-sizing: border-box;
  289. display: flex;
  290. }
  291. .left_top_hand {
  292. align-items: center;
  293. justify-content: space-between;
  294. .folder-box {
  295. ::v-deep .el-button--small {
  296. padding: 8.5px 9px;
  297. }
  298. }
  299. }
  300. // 左侧文件夹列表
  301. .folder-list {
  302. width: 100%;
  303. height: calc(100% - 52px);
  304. .head {
  305. height: 41px;
  306. width: 100%;
  307. padding-left: 10px;
  308. box-sizing: border-box;
  309. background: #d9d9d9;
  310. color: #2b2b2b;
  311. display: flex;
  312. justify-content: left;
  313. align-items: center;
  314. font-weight: bold;
  315. span {
  316. font-weight: normal;
  317. font-size: 12px;
  318. color: #606266;
  319. }
  320. }
  321. .lists {
  322. width: 100%;
  323. margin-top: 10px;
  324. height: calc(100% - 51px);
  325. overflow-y: auto;
  326. li {
  327. height: 42px;
  328. display: flex;
  329. justify-content: left;
  330. align-items: center;
  331. padding-left: 20px;
  332. box-sizing: border-box;
  333. color: #555;
  334. cursor: pointer;
  335. span {
  336. padding-left: 6px;
  337. overflow: hidden;
  338. text-overflow: ellipsis;
  339. white-space: nowrap;
  340. }
  341. }
  342. li:hover {
  343. background-color: #f5f7fa;
  344. color: #000;
  345. }
  346. .li-active {
  347. background-color: #f5f7fa;
  348. color: #000;
  349. }
  350. }
  351. }
  352. .icon_font {
  353. font-size: 18px;
  354. }
  355. }
  356. ::v-deep .el-scrollbar__wrap {
  357. overflow-x: hidden;
  358. }
  359. </style>