Browse Source

增加cad核查图纸页面

qule 3 years ago
parent
commit
5c0ae3bea6

+ 178 - 93
src/components/cadDrawingManage/index.vue

@@ -1,67 +1,82 @@
 <!--
  * @Author: ql
  * @Date: 2022-01-11 14:46:04
- * @LastEditTime: 2022-01-11 19:50:10
+ * @LastEditTime: 2022-01-14 15:18:59
  * @LastEditors: Please set LastEditors
  * @FilePath: \adm-frontend\src\components\cadDrawingManage\index.vue
 -->
 <template>
-  <div>
-      <el-row>
-        <el-col :span="4">
-          <div class="grid-content bg-purple" >
-            <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
+  <div class="contentContainer">
+      <el-row class="h100">
+        <el-col :span="4" class="h100">
+          <div class="grid-content bg-purple bg h100" style="overflow-y: scroll">
+            <Tree
+                :data="options"
+                @change="selectFloorHandle"
+            />
           </div>
         </el-col>
-        <el-col :span="20" style="padding-left: 24px">
-          <div class="grid-content bg-purple-light tab-right" style="background: #fff; padding: 0 16px 16px">
-            <el-tabs v-model="activeName" @tab-click="handleClick">
-              <el-tab-pane label="土建精装" name="first"></el-tab-pane>
-              <el-tab-pane label="空调专业" name="second"></el-tab-pane>
-              <el-tab-pane label="消防专业" name="third"></el-tab-pane>
-              <el-tab-pane label="给排水专业" name="fourth"></el-tab-pane>
-            </el-tabs>
+        <el-col :span="20" style="padding-left: 24px" class="h100">
+          <div class="grid-content bg-purple-light tab-right bg h100" style="padding: 0 16px 16px">
+            <div class="tab_warp">
+              <Tabs type="first-nav" :data="MENU_MAP" v-model="currentTab"  />
+            </div> 
             <div>
-              <div style="display: flex;  justify-content: space-between">
-                  <el-upload
-                    class="upload-demo"
-                    action="https://jsonplaceholder.typicode.com/posts/"
-                    :on-change="handleChange"
-                    :file-list="fileList">
-                    <el-button size="small" type="primary">上传.dwg CAD文件</el-button>
-                    
-                  </el-upload>
-                  <el-button type="primary" icon="el-icon-download">批量导出</el-button>
+              <div style="display: flex;  justify-content: space-between;margin-top: 24px">
+                  <h3>图纸文件列表</h3>
+                  
+                  <div>
+                    <Button type="primary" :disabled='true' icon="el-icon-download">批量导出</Button>
+                    <el-upload
+                      class="upload"
+                      ref="upload"
+                      :multiple="true"
+                      action="https://jsonplaceholder.typicode.com/posts/"
+                      :file-list="fileList"
+                      :show-file-list="false"
+                      :on-change='fileChange'
+                      :on-progress='progressHandle'
+                      :auto-upload="false">
+                        <Button slot="trigger"  type="primary" icon="el-icon-download">上传.dwg CAD文件</Button>
+                    </el-upload>
+                  </div>
+                 
               </div>
-              <el-divider></el-divider>
-              <div>
+              <div class="tableView1">
                 <el-table
-                  :data="tableData"
-                  style="width: 100%">
+                  ref="multipleTable"
+                  :data="tableList"
+                  tooltip-effect="dark"
+                  v-loading="tableLoading"
+                  style="width: 100%"
+                  @selection-change="handleSelectionChange">
                   <el-table-column
                     type="selection"
                     width="55">
                   </el-table-column>
                   <el-table-column
-                    prop="date"
-                    label="文件名"
-                    width="180">
+                    label="文件名称"
+                    prop="fileName"
+                  >
                   </el-table-column>
-                  <el-table-column
-                    prop="name"
+                  <el-table-column 
                     label="最新上传时间"
-                    width="180">
+                  >
+                    <template slot-scope="scope">{{ scope.row.modifiedTime }}</template>
                   </el-table-column>
                   <el-table-column
-                    prop="address"
-                    label="上传人">
+                    prop="creator"
+                    label="上传人"
+                  >
                   </el-table-column>
                   <el-table-column
+                    fixed="right"
                     label="操作"
-                    width="100">
+                  >
                     <template slot-scope="scope">
-                      <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
-                      <el-button type="text" size="small">编辑</el-button>
+                      <el-button @click="delHandle(scope.row)" type="text" size="small">删除</el-button>
+                      <el-divider direction="vertical"></el-divider>
+                      <el-button type="text" size="small" disabled>导出</el-button>
                     </template>
                   </el-table-column>
                 </el-table>
@@ -74,71 +89,141 @@
 </template>
 
 <script>
+import { Tree, Tabs, Button } from 'meri-design'
+import { MENU_MAP } from '@/data/cadConst'
+import BuildController from "@/controller/old-adm/buildController"
+import cadDrawingController from '@/controller/cadDarwingController'
 export default {
+  components: {
+    Tree,
+    Tabs,
+    Button,
+  },
+  watch: {
+    currentTab(nv, ov) {
+      console.log({nv, ov})
+    }
+  },
   data() {
     return {
-      data: [{
-          label: '一级 1',
-          children: [{
-            label: '二级 1-1',
-            children: [{
-              label: '三级 1-1-1'
-            }]
-          }]
-        }, {
-          label: '一级 2',
-          children: [{
-            label: '二级 2-1',
-            children: [{
-              label: '三级 2-1-1'
-            }]
-          }, {
-            label: '二级 2-2',
-            children: [{
-              label: '三级 2-2-1'
-            }]
-          }]
-        }, {
-          label: '一级 3',
-          children: [{
-            label: '二级 3-1',
-            children: [{
-              label: '三级 3-1-1'
-            }]
-          }, {
-            label: '二级 3-2',
-            children: [{
-              label: '三级 3-2-1'
-            }]
-          }]
-        }],
-        tableData: [{
-            date: '2016-05-02',
-            name: '王小虎',
-            address: '上海市普陀区金沙江路 1518 弄'
-          }, {
-            date: '2016-05-04',
-            name: '王小虎',
-            address: '上海市普陀区金沙江路 1517 弄'
-          }, {
-            date: '2016-05-01',
-            name: '王小虎',
-            address: '上海市普陀区金沙江路 1519 弄'
-          }, {
-            date: '2016-05-03',
-            name: '王小虎',
-            address: '上海市普陀区金沙江路 1516 弄'
-          }]
+      currentTab: 'id1',
+      MENU_MAP,
+      options: [],
+      tableList: [],  //文件列表数据
+      tableLoading: false,
+      fileList: [], //已选择文件
+      // 基础表格表头列表
+      headList: [
+        {
+            title: "文件名称", // 列的名称
+            key: "state", // 列的标识
+            show: true // 是否显示该列
+        },
+        {
+            title: "最新上传时间",
+            key: "name",
+            show: true,
+            width: 300
+        },
+        {
+            title: "上传人",
+            key: "job",
+            show: true
+        }
+      ],
+    }
+  },
+  methods: {
+    // 获取楼层信息
+    async getCascader() {
+      let param = {
+          cascade: [{ name: "floor", orders: "floorSequenceID desc", filters: `id != '${this.floorId}'` }],
+          pageNumber: 1,
+          pageSize: 50,
+      };
+    
+      this.options = await BuildController.buildDataFormat(param);
+      
+    },
+    // 选择楼层
+    selectFloorHandle(id) {
+      console.log({id})
+    },
+    // 获取文件列表数据
+    async getFileList () {
+      this.tableLoading = true
+      this.tableList = await cadDrawingController.queryFileList();
+      this.tableLoading = false
+      console.log({res})
+    },
+    fileChange(file, fileList) {
+      console.log({file, fileList})
+    },
+    progressHandle(e, file, fileList) {
+       console.log({file, fileList})
+    },
+    delHandle(row) {
+      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(async() => {
+          this.tableLoading = true
+          await cadDrawingController.delFile(row);
+          this.tableLoading = false;
+          this.getFileList();
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          });          
+        });
     }
+
+  },
+  mounted() {
+    this.getCascader()
+    this.getFileList()
   }
+
 }
 </script>
 
 <style scoped lang='less'>
   .tab-right{
-    & /deep/ .el-tabs__nav-wrap::after {
-      height: 1px;
+    & /deep/ .el-divider--horizontal {
+      height: 0.5px;
+    }
+    & /deep/ .upload {
+      display: inline-block;
+      margin-left: 16px;
     }
   }
+  .bg {
+    background: #fff;
+  }
+  .h100 {
+    height: 100%;
+  }
+  .tableView1 {
+    margin-top: 16px;
+    height: 290px
+  }
+  .tab_warp {
+    display: flex;
+    justify-content: center;
+    border-bottom: 1px solid #eff0f1;
+    box-sizing: border-box;
+    & /deep/ .p-tabs-nav-wrap {
+      box-sizing: content-box;
+      margin-bottom: -1px;
+    }
+  }
+                
+
   
 </style>

+ 5 - 1
src/components/frame/pageRight.vue

@@ -49,12 +49,14 @@
     <div class="contentContainer">
       <router-view class="page-content"></router-view>
     </div>
+    <uploadFile />
   </div>
 </template>
 <script>
 import { mapState } from "vuex";
 import { sessionStore } from "@/store/sessionStore";
 import { logicConfig } from '@/logicConfig'
+import uploadFile from '@/components/uploadFile'
 export default {
   props: [],
   data() {
@@ -82,7 +84,9 @@ export default {
   created() {},
   watch: {},
   mounted() {},
-  components: {},
+  components: {
+    uploadFile
+  },
 };
 </script>
 

+ 52 - 0
src/components/uploadFile/index.vue

@@ -0,0 +1,52 @@
+<template>
+    <div>
+        <div v-if='uploadVisible' class="uploadWarp">
+            <el-collapse v-model="activeNames" @change="handleChange" style="position: absolute; width: 100%">
+                <el-collapse-item title="同步中.." name="1">
+                    <div>已成功同步100个文件,共200个文件</div>
+                    <el-progress :text-inside="true" :show-text='false' :stroke-width="2" :percentage="70"></el-progress>
+                </el-collapse-item>
+            </el-collapse>
+        </div>
+    </div>
+</template>
+
+<script>
+import { mapState } from 'vuex'
+export default {
+    components: {
+
+    },
+    props: [],
+    data() {
+        return {
+            activeNames: true
+        }
+    },
+    watch: {
+        uploadVisible(nv, ov) {
+            console.log({nv, ov})
+        }
+    },
+    computed: {
+        ...mapState('uploadFile', ['uploadVisible'])
+    },
+    mounted() {
+        
+        
+    },
+    methods: {
+        
+    },
+}
+</script>
+
+<style scoped lang='less'>
+    .uploadWarp {
+        position: fixed;
+        right: 32px;
+        bottom: 160px;
+        width: 420px;
+
+    }
+</style>

+ 59 - 0
src/controller/cadDarwingController.ts

@@ -0,0 +1,59 @@
+/*
+ * @Author: your name
+ * @Date: 2022-01-12 15:29:56
+ * @LastEditTime: 2022-01-14 11:34:27
+ * @LastEditors: Please set LastEditors
+ * @Description: CAD图纸核查管理
+ * @FilePath: \adm-frontend\src\controller\cadDarwingController.ts
+ */
+import { baseHttpUtils } from "@/utils/http/baseHttpUtils";
+import { customHttpUtils } from '@/utils/http/customHttpUtils'
+import { logicConfig } from "@/logicConfig";
+export default class cadDarwingController {
+    static baseUril = (window as any).__systemConf.baseServiceUrl;
+    static http = new baseHttpUtils();
+    static customHttp = new customHttpUtils()
+
+    /**
+     * @description: 查询文件列表接口
+     * @param {*}
+     * @return {*}
+     */    
+    static async queryFileList (params={}) {
+        const headers = {
+            'Content-Type': 'application/json',
+            'token': '16:31eyJhbGciOiJIUzI1NiJ9.eyJkZXZpY2VUeXBlIjoxLCJhdWQiOiJ5dXNodS1zYWFzLWNsaWVudCIsInN1YiI6Inl1c2h1LXVzZXIiLCJhY2NvdW50SWQiOiIxNDc4MjcyMTQwNjU4MjAwNTc4IiwiYWNjb3VudE5hbWUiOiLmnY7mnbAiLCJpc3MiOiJ5dXNodSIsImp0aSI6ImEyYzgwYWQxLTRkZTgtNDVjMy04ODMyLTE5MzUxNWU3OWFmMCJ9.HYLA4Tc2c4TEDRXdi9dJ39zWuVmBoGoj5VrGRJk_9Ec'
+        }
+        try {
+            const res = await this.customHttp.customRequest(`${this.baseUril}/adm-server/adm/adm-file/queryCadFiles?projectId=Pj5001120003&groupCode=XG&userId=adm`, headers, params, 'post');
+            if(res?.result != logicConfig.resultObj.success) {
+                console.log('error');
+                return []
+            }
+            return res.data
+        } catch (error) {
+            
+        } 
+    }
+    /**
+     * @description: 删除文件接口
+     * @param {*}
+     * @return {*}
+     */    
+    static async delFile(params) {
+        const headers = {
+            'Content-Type': 'application/x-www-form-urlencoded',
+            'token': '16:31eyJhbGciOiJIUzI1NiJ9.eyJkZXZpY2VUeXBlIjoxLCJhdWQiOiJ5dXNodS1zYWFzLWNsaWVudCIsInN1YiI6Inl1c2h1LXVzZXIiLCJhY2NvdW50SWQiOiIxNDc4MjcyMTQwNjU4MjAwNTc4IiwiYWNjb3VudE5hbWUiOiLmnY7mnbAiLCJpc3MiOiJ5dXNodSIsImp0aSI6ImEyYzgwYWQxLTRkZTgtNDVjMy04ODMyLTE5MzUxNWU3OWFmMCJ9.HYLA4Tc2c4TEDRXdi9dJ39zWuVmBoGoj5VrGRJk_9Ec'
+        }
+        try {
+            const res = await this.customHttp.customRequest(`${this.baseUril}/adm-server/adm/adm-file/delete?projectId=Pj5001120003&groupCode=XG&userId=adm&id=${params.id}`, headers, {}, 'post');
+            if(res?.result != logicConfig.resultObj.success) {
+                console.log('error');
+                return []
+            }
+            return res.data
+        } catch (error) {
+            
+        }
+    }
+}

+ 37 - 0
src/controller/old-adm/buildController.ts

@@ -1,5 +1,6 @@
 import FloorController from "./floorController";
 import { baseHttpUtils } from "@/utils/http/baseHttpUtils";
+import { logicConfig } from "@/logicConfig";
 
 export interface BuildReq {
   pageNumber: number;
@@ -18,6 +19,42 @@ class BuildController {
   static async buildingQuery(params: BuildReq) {
     return await this.http.postRequest(this.pre + "/building/query", params);
   }
+  /**
+   * @description: 处理楼层接口数据为树状结构
+   * @param {*} 
+   * @return {*}
+   */ 
+  static async buildDataFormat(params) {
+    try {
+      const res =  await this.buildingQuery(params);
+      if (res.result != logicConfig.resultObj.success) {
+        return;
+      }
+      return res?.content.map(item => {
+        const { id, localName:name  } = item;
+        const children =  item?.floor?.map(subitem => ({
+          id: subitem.buildingId,
+          name: subitem.localName,
+          open: false,
+          disabled: false,
+          checked: 'uncheck'
+        }))
+        return {
+          id,
+          name,
+          open: false,
+          disabled: false,
+          checked: 'uncheck',
+          children,
+        }
+
+      })
+
+    } catch (error) {
+      
+    }
+
+  } 
   static async getData(buildFloorData) {
     let data,
       buildParams = {

+ 14 - 0
src/data/cadConst.js

@@ -0,0 +1,14 @@
+/*
+ * @Author: ql
+ * @Date: 2022-01-12 11:46:51
+ * @LastEditTime: 2022-01-12 14:18:29
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: \adm-frontend\src\data\cadConst.js
+ */
+export const MENU_MAP = [
+    {name: '土建精装', id:'id1'},
+    {name: '空调专业', id:'id2' },
+    {name: '消防专业' , id:'id3'},
+    {name: '给排水专业', id:'id4' },
+]

+ 1 - 1
src/meri.js

@@ -6,4 +6,4 @@ Vue.use(Input)
 Vue.use(MSelect)
 Vue.use(Icon)
 Vue.use(Popover)
-Vue.use(ImageUpload)
+Vue.use(ImageUpload)

+ 3 - 1
src/store/index.js

@@ -1,6 +1,7 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
 import layout from './modules/layout'
+import uploadFile from './modules/uploadFile'
 Vue.use(Vuex)
 
 export default new Vuex.Store({
@@ -93,6 +94,7 @@ export default new Vuex.Store({
     },
     actions: {},
     modules: {
-        layout
+        layout,
+        uploadFile
     }
 })

+ 20 - 0
src/store/modules/uploadFile.ts

@@ -0,0 +1,20 @@
+export default {
+    namespaced: true,
+    state: {
+        uploadVisible: true,
+    },
+    getters: {
+
+    },
+    mutations: {
+        updata(state, payload) {
+            console.log({state, payload})
+            for (const key in payload) {
+                state[key] = payload[key]
+            }
+        }
+    },
+    actions: {
+
+    }
+}