123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- <template>
- <div id="file_moddle_manage" v-loading="loading">
-
- <el-col class="col_left" :span="5">
- <div class="grid-content grid-left">
- <el-card class="box-card" :body-style="{ padding: '0px', height: '100%' }">
- <div class="top_hand left_top_hand">
- <div class="folder-box">
- <el-tooltip class="item" effect="dark" content="新建文件夹" placement="top-start">
- <el-button icon="el-icon-folder-add" @click="addFolder" class="icon_font"></el-button>
- </el-tooltip>
- <el-tooltip class="item" effect="dark" content="删除文件夹" placement="top-start">
- <el-button icon="el-icon-folder-remove" class="icon_font" @click="removeFolder"></el-button>
- </el-tooltip>
- </div>
- <div class="file-box">
- <el-tooltip class="item" effect="dark" content="编辑文件夹" placement="top-start">
- <el-button @click="editFolder" icon="el-icon-edit" class="icon_font"></el-button>
- </el-tooltip>
- </div>
- </div>
- <div class="folder-list">
- <div class="head">建筑模型文件夹
- <span>(建议按建筑模型进行命名)</span>
- </div>
- <ul class="lists">
- <el-scrollbar style="height:100%;">
- <li @click="openFolder(index,item)" v-for="(item,index) in navigationModel" :key="index"
- :class="[choiceIndex == index + 1 ? 'li-active' : '']">
- <i :class="[choiceIndex == index + 1 ? 'el-icon-folder-opened':'el-icon-folder','icon_font']" width="40" height="40"></i>
- <span>{{item.Name}}</span>
- </li>
- </el-scrollbar>
- </ul>
- </div>
- </el-card>
- </div>
- </el-col>
-
- <el-col class="col_left" :span="19">
- <el-card class="box-card" :body-style="{ padding: '0px', height:'100%' }">
-
- <div class="top_hand right_top_hand">
- <el-button @click="addFloorFile">添加楼层文件</el-button>
- <el-button @click="queryFloorFile(currentFolderId)">刷新</el-button>
- </div>
-
- <floorTable ref="floorTable" :tableData="tableData" :modelFolderName="currentFolderName" @openModelLog="queryModelLog"
- @replaceModel="repliaceModel" @percentFinish="queryFloorFile(currentFolderId)"
- :persentList="persentList"></floorTable>
- </el-card>
- </el-col>
-
-
- <modelLog :modelLogVisible="modelLogVisible" :modelFolderName="currentFolderName" @deleteFinish="updataLog"
- @CloseModelLogDia="modelLogVisible=false" :logData="logData"></modelLog>
-
- <repliceModel :repliceModelVisible="repliceModelVisible" @closeReplaceModelDia="repliceModelVisible=false" :replaceModelItem="replaceModelItem"
- @updataModel="updateModelFile"></repliceModel>
-
- <addFloorDialog :addFloorFileVisible="addFloorFileVisible" :floorList="tableData" :FolderName="currentFolderName" :FolderId="currentFolderId"
- @closeAddFloorDia="addFloorFileVisible=false" @finishCreateFloor="uploadModelFIle"></addFloorDialog>
-
- <addFolder :addFolderVisible="addFolderVisible" @closeAddFolderVisible="addFolderVisible=false;folderName=''" :folderName="folderName"
- @getfolderModel="queryModel"></addFolder>
-
- <changeFolderName :currentFolderId="currentFolderId" :changeFolderNameVisible="changeFolderNameVisible" :folderName="folderName"
- @finishChangeFolderName="queryModel" @closeChangeFolderVisible="changeFolderNameVisible=false;folderName=''"></changeFolderName>
-
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import request from "@/api/model/file.js";
- import Bus from '@/utils/bus.js'
- import dasBoard from "@/views/dasboard/index";
- import modelLog from "@/components/model/file/modelLog";
- import repliceModel from "@/components/model/file/replaceModelDialog";
- import addFloorDialog from "@/components/model/file/addFloorDialog";
- import addFolder from "@/components/model/file/addFolder";
- import changeFolderName from "@/components/model/file/changeFolderName";
- import floorTable from "@/components/model/file/floorTable";
- export default {
- computed: {
- ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret", "uploaderList"])
- },
- components: {
- dasBoard,
- modelLog,
- repliceModel,
- addFloorDialog,
- addFolder,
- changeFolderName,
- floorTable
- },
- data() {
- return {
- addFolderVisible: false,
- addFloorFileVisible: false,
- repliceModelVisible: false,
- modelLogVisible: false,
- changeFolderNameVisible: false,
- folderName: "",
- navigationModel: [
- {
- Name: ""
- }
- ],
- choiceIndex: 0,
- currentFolderId: "",
- currentFolderName: "",
- currentFloorModelId: "",
- tableData: [],
- loading: false,
- logData: [],
- replaceModelItem: null,
- uploadFloorModelIdList: [],
-
- headers: {
- ProjectId: ""
- },
- updataData: {
- model: {}
- },
- persentList: [],
- isJump: true
- };
- },
- mounted() {
-
-
-
-
-
-
-
-
- },
- destroyed() {
-
-
- },
- methods: {
-
-
- openFolder(index, item) {
- this.choiceIndex = index + 1;
- this.currentFolderId = item.Id;
- this.currentFolderName = item.Name;
-
- this.queryFloorFile(this.currentFolderId);
- },
-
- addFolder() {
- this.folderName = "";
- this.addFolderVisible = true;
- },
-
- removeFolder() {
- this.$alert(`确定要删除文件夹 <${this.currentFolderName}> 吗?`, "提示", {
- confirmButtonText: "确定",
- callback: action => {
- if (action == "confirm") {
- let params = {
- Id: this.currentFolderId,
- ProjectId: this.projectId
- };
- request.deleteModel(params, res => {
- this.$message({
- message: "删除成功!",
- type: "success"
- });
- this.queryModel();
- });
- } else {
- this.$message({
- type: "info",
- message: `取消操作`
- });
- }
- }
- });
- },
-
- editFolder() {
- this.folderName = this.currentFolderName;
- this.changeFolderNameVisible = true;
- },
-
- queryModel() {
- this.loading = true;
- request.queryModel("", res => {
- this.navigationModel = res.Content;
- this.loading = false;
- if (this.navigationModel.length) {
-
- this.choiceIndex = 1;
- this.currentFolderName = this.navigationModel[0].Name;
- this.currentFolderId = this.navigationModel[0].Id;
- this.queryFloorFile(this.currentFolderId);
- } else {
- this.tableData = []
- }
- });
- },
-
-
-
- queryFloorFile(currentFolderId) {
- if(currentFolderId){
- let data = {
- FolderId: currentFolderId,
- ProjectId: this.projectId
- };
- return new Promise((resolve, reject) => {
- request.queryFloorList(data, res => {
- res.Content.map(item => {
-
- if (item.Status == 2 || item.Status == 20 || item.Status == 21 || item.Status == 3 || item.Status == 31 || item.Status == 4) {
- Object.assign(item, { isDown: false, precent: 0 });
- } else {
- Object.assign(item, { isDown: true, precent: 100 });
- if (this.persentList.length != 0) {
- this.persentList.forEach(pItem => {
- if (item.Id == pItem.Id) {
- Object.assign(item, { isDown: true, precent: pItem.precent ? pItem.precent : 0 });
- }
- });
- }
- }
-
-
-
-
-
- });
- this.tableData = res.Content;
- this.loading = false;
- resolve();
- });
- });
- }
- },
-
- addFloorFile() {
- this.addFloorFileVisible = true;
- },
-
-
- repliaceModel(item) {
- this.replaceModelItem = item;
- this.repliceModelVisible = true;
- },
-
- uploadModelFIle(data) {
- Bus.$emit('openUploader', {
- uploadId: data.uploadId,
- modelId: data.modelId,
- systemId: 'revit',
- secret: '63afbef6906c342b',
- }, data.file.raw)
-
- this.persentList.push({
- Id: data.floorId,
- precent: 0
- });
- this.queryFloorFile(this.currentFolderId);
- },
-
- updateModelFile(data) {
- let params = {
- FileName: data.file.name,
- FloorName: data.replaceModelItem.FloorName,
- FolderId: data.replaceModelItem.FolderId,
- Note: data.replaceModelItem.Note,
- ProjectId: this.projectId,
- ReplaceReason: 0,
- Size: data.file.size,
- UserName: this.userInfo.userName,
- UserId: this.userInfo.userId
- };
-
- request.modelFileUpload(params, res => {
-
- this.persentList.push({
- Id: data.replaceModelItem.Id,
- precent: 0
- });
-
- this.tableData.map(item => {
- if (item.Id == data.replaceModelItem.Id) {
- item.isDown = true;
- item.precent = 0;
- }
- });
- this.queryFloorFile(this.currentFolderId);
- Bus.$emit('openUploader', {
- uploadId: res.UploadId,
- modelId: res.ModelId,
- systemId: 'revit',
- secret: '63afbef6906c342b',
- }, data.file.raw)
- });
- },
-
- queryModelLog(item) {
- this.FloorModelId = item.Id;
- request.queryModelFile(this.FloorModelId, res => {
- this.logData = res.Content;
- this.modelLogVisible = true;
- });
- },
-
- updataLog() {
- request.queryModelFile(this.FloorModelId, res => {
- this.logData = res.Content;
- });
- },
- },
- watch: {
- projectId() {
- this.queryModel()
- }
- },
- mounted() {
- this.queryModel();
- Bus.$on('modelStatusChange', message => {
- this.queryFloorFile(this.currentFolderId);
- })
-
-
-
-
- }
- };
- </script>
- <style lang="less" scoped>
- #file_moddle_manage {
- width: 100%;
- height: 100%;
- overflow: hidden !important;
- .col_left {
- height: 100%;
- }
- .grid-content {
- height: 100%;
- }
- .box-card {
- height: 100%;
- }
- .grid-left {
- padding-right: 10px;
- box-sizing: border-box;
- }
- // 顶部
- .top_hand {
- height: 60px;
- width: 100%;
- padding: 10px;
- box-sizing: border-box;
- display: flex;
- }
- .left_top_hand {
- align-items: center;
- justify-content: space-between;
- .folder-box {
- display: flex;
- height: 40px;
- flex-direction: row;
- }
- .box-icon {
- width: 40px;
- height: 40px;
- font-size: 30px;
- display: flex;
- justify-content: center;
- align-items: center;
- float: left;
- }
- }
- // 左侧文件夹列表
- .folder-list {
- width: 100%;
- height: calc(100% - 60px);
- .head {
- height: 42px;
- width: 100%;
- padding-left: 10px;
- box-sizing: border-box;
- background: #d9d9d9;
- color: #2b2b2b;
- display: flex;
- justify-content: left;
- align-items: center;
- font-weight: bold;
- span{
- font-weight: normal;
- font-size: 12px;
- color: #606266;
- }
- }
- .lists {
- width: 100%;
- margin-top: 10px;
- height: calc(100% - 52px);
- overflow-y: auto;
- li {
- height: 42px;
- display: flex;
- justify-content: left;
- align-items: center;
- padding-left: 20px;
- box-sizing: border-box;
- color: #555;
- cursor: pointer;
- span {
- padding-left: 6px;
- }
- }
- li:hover {
- background-color: #f5f7fa;
- color: #000;
- }
- .li-active {
- background-color: #f5f7fa;
- color: #000;
- }
- }
- }
- .icon_font {
- font-size: 18px;
- }
- }
- /deep/ .el-scrollbar__wrap {
- overflow-x: hidden;
- }
- </style>
|