|
@@ -1,214 +1,218 @@
|
|
|
-<template>
|
|
|
- <div class="hui-flex hui-content">
|
|
|
- <div class="hui-content-title">
|
|
|
- <div class="hui-title-item active">模型列表</div>
|
|
|
- </div>
|
|
|
- <div class="hui-flex-box hui-flex hui-table">
|
|
|
- <div class="hui-content-insert">
|
|
|
- <el-button type="primary" size="medium" @click="drawer = true">上传模型</el-button>
|
|
|
- <bim-upload ref="bimUpload" v-show="false" @changeBim="init"></bim-upload>
|
|
|
- </div>
|
|
|
- <div class="hui-flex-box">
|
|
|
- <el-table ref="singleTable" :data="tableData" border height="100%">
|
|
|
- <el-table-column label="序号" width="50">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{scope.$index + 1}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="name" label="模型名称"></el-table-column>
|
|
|
- <el-table-column prop="projectItemName" label="单位建筑"></el-table-column>
|
|
|
- <el-table-column prop="projectItemTargetName" label="具体位置"></el-table-column>
|
|
|
- <el-table-column prop="createUserName" width="100" label="上传人"></el-table-column>
|
|
|
- <el-table-column width="200" label="上传时间">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{$dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="100" label="类型">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="hui-table-tag">
|
|
|
- <div class="hui-tag">
|
|
|
- {{typeList.filter(item=>item.id == scope.row.type)[0].typeName}}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="100" label="状态">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="hui-table-tag">
|
|
|
- <div class="hui-tag hui-tag-success" v-if="scope.row.status === 2">
|
|
|
- 转换成功
|
|
|
- </div>
|
|
|
- <div class="hui-tag hui-tag-warning" v-if="scope.row.status === 1">
|
|
|
- 转换中
|
|
|
- </div>
|
|
|
- <div class="hui-tag hui-tag-warning" v-if="scope.row.status === 0">
|
|
|
- 等待转换
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="220" label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="hui-table-operation">
|
|
|
- <span class="table-operation" @click="reloadUpload(scope.row)">
|
|
|
- 重新上传
|
|
|
- </span>
|
|
|
- <span class="table-operation" v-if="scope.row.status === 0"
|
|
|
- @click="convertBim(scope.row)">
|
|
|
- 转换
|
|
|
- </span>
|
|
|
- <span class="table-operation" v-if="scope.row.status === 2"
|
|
|
- @click="previewBim(scope.row)">
|
|
|
- 预览
|
|
|
- </span>
|
|
|
- <span class="table-operation" @click="deleteBim(scope.row)">
|
|
|
- 删除
|
|
|
- </span>
|
|
|
- <span class="table-operation" @click="downloadBim(scope.row)">
|
|
|
- 下载
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <template slot="empty">
|
|
|
- <empty description="暂无数据"></empty>
|
|
|
- </template>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-dialog :close-on-click-modal="false" title="上传模型" :visible.sync="drawer" width="900px" :append-to-body="true">
|
|
|
- <bim-form @callback="callback" v-if="drawer"></bim-form>
|
|
|
- </el-dialog>
|
|
|
- <el-dialog :close-on-click-modal="false" title="预览模型" :visible.sync="dialogVisible" :append-to-body="true" width="80%">
|
|
|
- <preview v-if="dialogVisible" @close="dialogVisible = false" type="model" :file="file"></preview>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import {
|
|
|
- getBimList,
|
|
|
- updateProjectItemTargetBim,
|
|
|
- getProjectItemTargetBimList,
|
|
|
- translateBim,
|
|
|
- toBimFace,
|
|
|
- getBimType
|
|
|
- } from '@/httpApi/bim';
|
|
|
- import bimForm from '@/components/work/bim/bimForm'
|
|
|
- import preview from '@/components/work/bim/preview'
|
|
|
- import config from '@/config';
|
|
|
- import bimUpload from '@/components/common/bimUpload'
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tableData: [],
|
|
|
- drawer: false,
|
|
|
- typeList: [],
|
|
|
- dialogVisible: false,
|
|
|
- file: {},
|
|
|
- projectTargetBim: {},
|
|
|
- timer: null
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- getBimType().then(res => {
|
|
|
- if (res.state) this.typeList = res.data;
|
|
|
- this.init();
|
|
|
- });
|
|
|
- },
|
|
|
- beforeDestroy() {
|
|
|
- if (this.timer) {
|
|
|
- clearInterval(this.timer);
|
|
|
- this.timer = null;
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
+<template>
|
|
|
+ <div class="hui-flex hui-content">
|
|
|
+ <div class="hui-content-title">
|
|
|
+ <div class="hui-title-item active">模型列表</div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-flex-box hui-flex hui-table">
|
|
|
+ <div class="hui-content-insert">
|
|
|
+ <el-button v-permission="'/work/bim/upload'" type="primary" size="medium"
|
|
|
+ @click="drawer = true">上传模型</el-button>
|
|
|
+ <bim-upload ref="bimUpload" v-show="false" @changeBim="init"></bim-upload>
|
|
|
+ </div>
|
|
|
+ <div class="hui-flex-box">
|
|
|
+ <el-table ref="singleTable" :data="tableData" border height="100%">
|
|
|
+ <el-table-column label="序号" width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.$index + 1}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="模型名称"></el-table-column>
|
|
|
+ <el-table-column prop="projectItemName" label="单位建筑"></el-table-column>
|
|
|
+ <el-table-column prop="projectItemTargetName" label="具体位置"></el-table-column>
|
|
|
+ <el-table-column prop="createUserName" width="100" label="上传人"></el-table-column>
|
|
|
+ <el-table-column width="200" label="上传时间">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{$dayjs(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="100" label="类型">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-tag">
|
|
|
+ <div class="hui-tag">
|
|
|
+ {{typeList.filter(item=>item.id == scope.row.type)[0].typeName}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="100" label="状态">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-tag">
|
|
|
+ <div class="hui-tag hui-tag-success" v-if="scope.row.status === 2">
|
|
|
+ 转换成功
|
|
|
+ </div>
|
|
|
+ <div class="hui-tag hui-tag-warning" v-if="scope.row.status === 1">
|
|
|
+ 转换中
|
|
|
+ </div>
|
|
|
+ <div class="hui-tag hui-tag-warning" v-if="scope.row.status === 0">
|
|
|
+ 等待转换
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="220" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-operation">
|
|
|
+ <span v-permission="'/work/bim/reload'" class="table-operation" @click="reloadUpload(scope.row)">
|
|
|
+ 重新上传
|
|
|
+ </span>
|
|
|
+ <span v-permission="'/work/bim/convert'" class="table-operation" v-if="scope.row.status === 0"
|
|
|
+ @click="convertBim(scope.row)">
|
|
|
+ 转换
|
|
|
+ </span>
|
|
|
+ <span v-permission="'/work/bim/preview'" class="table-operation" v-if="scope.row.status === 2"
|
|
|
+ @click="previewBim(scope.row)">
|
|
|
+ 预览
|
|
|
+ </span>
|
|
|
+ <span v-permission="'/work/bim/delete'" class="table-operation" @click="deleteBim(scope.row)">
|
|
|
+ 删除
|
|
|
+ </span>
|
|
|
+ <span v-permission="'/work/bim/download'" class="table-operation" @click="downloadBim(scope.row)">
|
|
|
+ 下载
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <template slot="empty">
|
|
|
+ <empty description="暂无数据"></empty>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-dialog :close-on-click-modal="false" title="上传模型" :visible.sync="drawer" width="900px"
|
|
|
+ :append-to-body="true">
|
|
|
+ <bim-form @callback="callback" v-if="drawer"></bim-form>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog :close-on-click-modal="false" title="预览模型" :visible.sync="dialogVisible" :append-to-body="true"
|
|
|
+ width="80%">
|
|
|
+ <preview v-if="dialogVisible" @close="dialogVisible = false" type="model" :file="file"></preview>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ getBimList,
|
|
|
+ updateProjectItemTargetBim,
|
|
|
+ getProjectItemTargetBimList,
|
|
|
+ translateBim,
|
|
|
+ toBimFace,
|
|
|
+ getBimType
|
|
|
+ } from '@/httpApi/bim';
|
|
|
+ import bimForm from '@/components/work/bim/bimForm'
|
|
|
+ import preview from '@/components/work/bim/preview'
|
|
|
+ import config from '@/config';
|
|
|
+ import bimUpload from '@/components/common/bimUpload'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tableData: [],
|
|
|
+ drawer: false,
|
|
|
+ typeList: [],
|
|
|
+ dialogVisible: false,
|
|
|
+ file: {},
|
|
|
+ projectTargetBim: {},
|
|
|
+ timer: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getBimType().then(res => {
|
|
|
+ if (res.state) this.typeList = res.data;
|
|
|
+ this.init();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
init() {
|
|
|
- getBimList(this.$store.getters.project.id).then(res => {
|
|
|
- if (res.state) {
|
|
|
- this.tableData = res.data;
|
|
|
- this.projectTargetBimFunc(res.data);
|
|
|
- let loading = this.tableData.filter(node => node.status === 1).length;
|
|
|
- if (loading === 0 && this.timer) {
|
|
|
- clearInterval(this.timer);
|
|
|
- return this.timer = null;
|
|
|
- }
|
|
|
- if (loading > 0 && !this.timer) {
|
|
|
- this.timer = setInterval(this.init, 30000);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- projectTargetBimFunc(data) {
|
|
|
- let obj = {};
|
|
|
- for (let i = 0; i < data.length; i++) {
|
|
|
- if (!obj[data[i].projectItemTargetId]) obj[data[i].projectItemTargetId] = [];
|
|
|
- obj[data[i].projectItemTargetId].push(data[i].id)
|
|
|
- }
|
|
|
- this.projectTargetBim = obj;
|
|
|
- },
|
|
|
- callback(type) {
|
|
|
- this.drawer = false;
|
|
|
- if (type == 'init') this.init();
|
|
|
- },
|
|
|
- convertBim(item) {
|
|
|
- this.$confirm('确定要转换该模型?', () => {
|
|
|
- item.status == 0 ? toBimFace(item.id).then(res => {
|
|
|
- if (res.state) this.translateBim(item);
|
|
|
- }) : this.translateBim(item);
|
|
|
- });
|
|
|
- },
|
|
|
- translateBim(item) {
|
|
|
- translateBim(item.id).then(res => {
|
|
|
- if (res.state) {
|
|
|
- this.$message.success('开始转换模型');
|
|
|
- this.init();
|
|
|
- this.timer = setInterval(this.init, 30000);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- previewBim(item) {
|
|
|
- this.file = {
|
|
|
- id: item.bimfaceInfo.fileId,
|
|
|
- name: item.name
|
|
|
- }
|
|
|
- this.dialogVisible = true;
|
|
|
- },
|
|
|
- deleteBim(item) {
|
|
|
- this.$confirm('确定要删除该模型?', () => {
|
|
|
- let bims = this.projectTargetBim[item.projectItemTargetId];
|
|
|
- let index = bims.findIndex(node => node == item.id);
|
|
|
- bims.splice(index, 1);
|
|
|
- getProjectItemTargetBimList(item.projectItemTargetId).then(node => {
|
|
|
- if (node.state) {
|
|
|
- updateProjectItemTargetBim({
|
|
|
- projectItemTargetId: item.projectItemTargetId,
|
|
|
- bims: bims.join(','),
|
|
|
- id: node.data.id
|
|
|
- }).then(res => {
|
|
|
- if (res.state) {
|
|
|
- this.$message.success('操作成功');
|
|
|
- this.init();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- reloadUpload(row) {
|
|
|
- this.$refs.bimUpload.reloadUpload(row);
|
|
|
- },
|
|
|
- downloadBim(row) {
|
|
|
- window.location.href = config.baseURL + '/bim/bim/download/' + row.id;
|
|
|
- }
|
|
|
- },
|
|
|
- components: {
|
|
|
- bimForm,
|
|
|
- preview,
|
|
|
- bimUpload
|
|
|
- },
|
|
|
- }
|
|
|
-</script>
|
|
|
-
|
|
|
+ if (!this.auth('/work/bim/list')) return;
|
|
|
+ getBimList(this.$store.getters.project.id).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.tableData = res.data;
|
|
|
+ this.projectTargetBimFunc(res.data);
|
|
|
+ let loading = this.tableData.filter(node => node.status === 1).length;
|
|
|
+ if (loading === 0 && this.timer) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ return this.timer = null;
|
|
|
+ }
|
|
|
+ if (loading > 0 && !this.timer) {
|
|
|
+ this.timer = setInterval(this.init, 30000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ projectTargetBimFunc(data) {
|
|
|
+ let obj = {};
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ if (!obj[data[i].projectItemTargetId]) obj[data[i].projectItemTargetId] = [];
|
|
|
+ obj[data[i].projectItemTargetId].push(data[i].id)
|
|
|
+ }
|
|
|
+ this.projectTargetBim = obj;
|
|
|
+ },
|
|
|
+ callback(type) {
|
|
|
+ this.drawer = false;
|
|
|
+ if (type == 'init') this.init();
|
|
|
+ },
|
|
|
+ convertBim(item) {
|
|
|
+ this.$confirm('确定要转换该模型?', () => {
|
|
|
+ item.status == 0 ? toBimFace(item.id).then(res => {
|
|
|
+ if (res.state) this.translateBim(item);
|
|
|
+ }) : this.translateBim(item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ translateBim(item) {
|
|
|
+ translateBim(item.id).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.$message.success('开始转换模型');
|
|
|
+ this.init();
|
|
|
+ this.timer = setInterval(this.init, 30000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ previewBim(item) {
|
|
|
+ this.file = {
|
|
|
+ id: item.bimfaceInfo.fileId,
|
|
|
+ name: item.name
|
|
|
+ }
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ deleteBim(item) {
|
|
|
+ this.$confirm('确定要删除该模型?', () => {
|
|
|
+ let bims = this.projectTargetBim[item.projectItemTargetId];
|
|
|
+ let index = bims.findIndex(node => node == item.id);
|
|
|
+ bims.splice(index, 1);
|
|
|
+ getProjectItemTargetBimList(item.projectItemTargetId).then(node => {
|
|
|
+ if (node.state) {
|
|
|
+ updateProjectItemTargetBim({
|
|
|
+ projectItemTargetId: item.projectItemTargetId,
|
|
|
+ bims: bims.join(','),
|
|
|
+ id: node.data.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ reloadUpload(row) {
|
|
|
+ this.$refs.bimUpload.reloadUpload(row);
|
|
|
+ },
|
|
|
+ downloadBim(row) {
|
|
|
+ window.location.href = config.baseURL + '/bim/bim/download/' + row.id;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ bimForm,
|
|
|
+ preview,
|
|
|
+ bimUpload
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
<style lang="scss"></style>
|