YaolongHan 5 gadi atpakaļ
vecāks
revīzija
202a434f9e

+ 27 - 17
src/api/model/file.js

@@ -82,7 +82,7 @@ let api = {
     queryFloor(data, success) {
         let Filters = `FolderId='${data.folderId}'`;
         if(data.FloorName){
-            Filters = `FolderId='${data.folderId}',ModelName='${data.FloorName}',ProjectId='${data.ProjectId}'`;
+            Filters = `FolderId='${data.folderId}';FloorName='${data.FloorName}';ProjectId='${data.ProjectId}'`;
         }
         let params = {
             Filters: Filters
@@ -96,22 +96,28 @@ let api = {
                   let data = {
                     Content: [params]
                 };
-                console.log(params)
         this.queryFloor(params,(res)=>{
-            console.log('queryFloor',res)
-            // if(res.Total == 0){
-            //     let data = {
-            //         Content: [params]
-            //     };
-            //     // 创建模型文件
-            //     this.createModelFile(data,(res)=>{
-            //     // 创建楼层文件(传入模型文件id)
-            //      httputils.postJson(`${baseUrl}/model-floor/create`, data, success)
-            //     })
+            if(res.Total == 0){
+                // let data = {
+                //     Content: [params]
+                // };
+                let modelFile = {
+                    Content:{
+                       ProjectId:params.ProjectId,
+                       FolderId:params.folderId,
+                       FloorName:params.FloorName
+                    }
+                }
+                // 创建模型文件
+                this.createModelFile(modelFile,(res)=>{
+                // 创建楼层文件(传入模型文件id)
+                console.log('/创建楼层文件(传入模型文件id)',res)
+                //  httputils.postJson(`${baseUrl}/model-floor/create`, data, success)
+                })
             
-            // }else{
-            //     Message.error({message:'该楼层文件已经存在!'});
-            // }
+            }else{
+                Message.error({message:'该楼层文件已经存在,请选择其他楼层!'});
+            }
         })
     },
     // 删除楼层文件
@@ -143,8 +149,12 @@ let api = {
         return httputils.postJson(`${baseUrl}/model-floor/update`, data)
     },
     //查询模型文件 
-    queryModelFile() {
-        return httputils.postJson(`${baseUrl}/model-floor/query`, data)
+    queryModelFile(FloorModelId,success) {
+        let params = {
+            Distince:true,
+            Filters : `FloorModelId='${FloorModelId}'`
+        }
+        return httputils.postJson(`${baseUrl}/model-floor/query`, params,success)
     }
 
 }

+ 19 - 11
src/components/model/file/addFloorDialog.vue

@@ -40,7 +40,7 @@
               style="margin-left:10px"
               v-model="form.floorNum"
               :min="1"
-              :disabled="form.floorTypeVal == '选项2'"
+              :disabled="form.floorTypeVal == 'RF'"
               @change="handleChange"
             ></el-input-number>
             <!-- 是否夹层 -->
@@ -78,7 +78,7 @@ export default {
   props: {
     addFloorFileVisible: Boolean,
     FolderName: String,
-    FolderId:String
+    FolderId: String
   },
   computed: {
     ...mapGetters("layout", ["projectId", "userId", "secret"])
@@ -140,10 +140,18 @@ export default {
         let FloorName = null;
         // 根据是否有夹层拼接楼层名
         if (this.haveInterlayer) {
-          FloorName =
-            this.form.floorTypeVal + this.form.floorNum + interlayerType;
+          if (floorTypeVal == "RF") {
+            FloorName = this.form.floorTypeVal + interlayerType;
+          } else {
+            FloorName =
+              this.form.floorTypeVal + this.form.floorNum + interlayerType;
+          }
         } else {
-          FloorName = this.form.floorTypeVal + this.form.floorNum;
+          if (floorTypeVal == "RF") {
+            FloorName = this.form.floorTypeVal;
+          } else {
+            FloorName = this.form.floorTypeVal + this.form.floorNum;
+          }
         }
         let data = {
           ProjectId: this.projectId,
@@ -158,12 +166,12 @@ export default {
           // this.$emit("finishCreateFloor", data1);
           // this.handleClose();
           this.headers.ProjectId = this.projectId;
-          this.updataData.model =JSON.stringify({
-            floorModelId:res.EntityList[0].Id,
-            modelName:this.FolderName,
-            userId:this.userId,
-            note:this.form.desc,
-            userName:''
+          this.updataData.model = JSON.stringify({
+            floorModelId: res.EntityList[0].Id,
+            modelName: this.FolderName,
+            userId: this.userId,
+            note: this.form.desc,
+            userName: ""
           });
           // this.$refs.upload.submit();
         });

+ 15 - 12
src/components/model/file/floorTable.vue

@@ -4,10 +4,10 @@
     style="width: 100%"
     :header-cell-style="{background:'#ccc',color:'#000'}"
   >
-    <el-table-column prop="date" label="模型文件" width="180">
+    <el-table-column prop="FloorName" label="模型文件" width="180">
       <template slot-scope="scope">
         <i class="el-icon-document-checked icon_font"></i>
-        <span style="margin-left: 10px">{{ scope.row.date }}</span>
+        <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
       </template>
     </el-table-column>
     <el-table-column prop="name" label="备注" width="180"></el-table-column>
@@ -16,26 +16,29 @@
     <el-table-column prop="address" label="上传人"></el-table-column>
     <el-table-column prop="address" label="操作">
       <template slot-scope="scope">
-        <el-button type="primary" class="icon_font" icon="el-icon-download"></el-button>
-        <el-button
-          type="primary"
-          class="icon_font"
-          icon="el-icon-goods"
-          @click="repliaceModel(scope.row)"
-        ></el-button>
-        <el-button type="primary" class="icon_font" icon="el-icon-date" @click="queryModelLog"></el-button>
+        <el-button type="primary" class="iconfont icon-download"></el-button>
+        <el-button type="primary" class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
+        <el-button type="primary" class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
       </template>
     </el-table-column>
   </el-table>
 </template>
 <script>
 export default {
+  props: {
+    tableData: Array
+  },
   data() {
     return {};
   },
   methods: {
-    queryModelLog() {},
-    repliaceModel() {}
+    // 查看日志
+    queryModelLog(item) {
+      this.$emit('openModelLog',item)
+    },
+    repliaceModel(item) {
+      this.$emit('replaceModel',item)
+    }
   }
 };
 </script>

+ 3 - 23
src/components/model/file/modelLog.vue

@@ -26,34 +26,14 @@
 <script>
 export default {
   props:{
-   modelLogVisible:Boolean
+   modelLogVisible:Boolean,
+   logData:Array
   },
   data() {
     return {
       dialogVisible: false, //是否显示该弹窗
       activeName: "first",  //默认选择上传日志
-      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 弄"
-        }
-      ]
+      tableData: []          //列表数据]
     };
   },
   methods: {

+ 14 - 45
src/components/model/file/replaceModelDialog.vue

@@ -28,15 +28,15 @@
         <el-form-item label="选择模型文件替换原因:">
           <ul>
             <li>
-              <el-radio v-model="form.radio" label="1">之前模型画错要修改</el-radio>
+              <el-radio :disabled="isChioce" v-model="form.radio" label="1">之前模型画错要修改</el-radio>
             </li>
             <li>
-              <el-radio v-model="form.radio" label="2">因工程改造,更新模型文件</el-radio>
+              <el-radio :disabled="isChioce" v-model="form.radio" label="2">因工程改造,更新模型文件</el-radio>
             </li>
           </ul>
         </el-form-item>
         <el-form-item>
-          <div class="dateTime" v-show ="form.radio == '2'">
+          <div class="dateTime" v-show="form.radio == '2'">
             <p>工程改造竣工时间:</p>
             <el-date-picker v-model="form.finishTime" type="date" placeholder="选择日期"></el-date-picker>
           </div>
@@ -52,58 +52,27 @@
 <script>
 export default {
   props: {
-    repliceModelVisible: Boolean
+    repliceModelVisible: Boolean,
+    replaceModelItem: Object
   },
   data() {
     return {
       form: {
-        name: "",
-        region: "",
-        date1: "",
-        date2: "",
-        delivery: false,
-        type: [],
-        resource: "",
-        desc: "",
         file: null, //上传文件
         radio: "1",
-        finishTime:''
+        finishTime: ""
       },
-      fileList: [],
-      floorType: [
-        {
-          value: "选项1",
-          label: "正常层(F)"
-        },
-        {
-          value: "选项2",
-          label: "屋顶(RF)"
-        },
-        {
-          value: "选项3",
-          label: "地下(B)"
-        }
-      ],
-      interlayerType: [
-        {
-          value: "选项1",
-          label: "夹层M1"
-        },
-        {
-          value: "选项2",
-          label: "夹层M2"
-        },
-        {
-          value: "选项3",
-          label: "夹层M2"
-        }
-      ],
-      value: ""
+      isChioce: true, //是否可以选择替换原因
+      fileList: []
     };
   },
   methods: {
     onSubmit() {
-      console.log("submit!");
+      if (this.form.file == null) {
+        this.$message.error("模型文件不能为空!");
+      } else {
+        this.$emit("updataModel", this.form);
+      }
     },
     // /上传到服务器/
     submitUpload() {
@@ -113,7 +82,7 @@ export default {
       this.$emit("closeReplaceModelDia");
     },
     handleRemove(file, fileList) {
-      console.log(file, fileList);
+      this.form.file = null;
     },
     handlePreview(file) {
       console.log(file);

+ 27 - 42
src/views/model/file/index.vue

@@ -45,52 +45,23 @@
       <el-card class="box-card" :body-style="{ padding: '0px' }">
         <!-- 顶部操作栏 -->
         <div class="top_hand right_top_hand">
-          <el-button type="primary" @click="addFloorFile">添加楼层文件</el-button>
-          <el-button type="primary" round>刷新</el-button>
+          <el-button @click="addFloorFile">添加楼层文件</el-button>
+          <el-button>刷新</el-button>
         </div>
-        <el-table
-          :data="tableData"
-          style="width: 100%"
-          :header-cell-style="{background:'#ccc',color:'#000'}"
-        >
-          <el-table-column prop="FloorName" label="模型文件" width="180">
-            <template slot-scope="scope">
-              <i class="el-icon-document-checked icon_font"></i>
-              <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column prop="name" label="备注" width="180"></el-table-column>
-          <el-table-column prop="address" label="版本号"></el-table-column>
-          <el-table-column prop="address" label="上传时间"></el-table-column>
-          <el-table-column prop="address" label="上传人"></el-table-column>
-          <el-table-column prop="address" label="操作">
-            <template slot-scope="scope">
-              <el-button type="primary" class="icon_font" icon="el-icon-download"></el-button>
-              <el-button
-                type="primary"
-                class="icon_font"
-                icon="el-icon-goods"
-                @click="repliaceModel(scope.row)"
-              ></el-button>
-              <el-button
-                type="primary"
-                class="icon_font"
-                icon="el-icon-date"
-                @click="queryModelLog"
-              ></el-button>
-            </template>
-          </el-table-column>
-        </el-table>
+        <!-- 列表 -->
+        <floorTable :tableData="tableData" @openModelLog="queryModelLog" @replaceModel="repliaceModel"></floorTable>
       </el-card>
     </el-col>
     <!-- 弹窗 开始-->
 
     <!-- 模型日志弹窗 -->
-    <modelLog :modelLogVisible="modelLogVisible" @CloseModelLogDia="modelLogVisible=false"></modelLog>
+    <modelLog :modelLogVisible="modelLogVisible" @CloseModelLogDia="modelLogVisible=false" :logData="logData"></modelLog>
     <!-- 替换模型弹窗 -->
     <repliceModel
       :repliceModelVisible="repliceModelVisible"
       @closeReplaceModelDia="repliceModelVisible=false"
+      :replaceModelItem="replaceModelItem"
+      @updataModel="updateModelFile"
     ></repliceModel>
     <!-- 新增楼层 -->
     <addFloorDialog
@@ -128,6 +99,7 @@ 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"; //右侧list表
 export default {
   computed: {
     ...mapGetters("layout", ["projectId", "userId", "secret"])
@@ -138,7 +110,8 @@ export default {
     repliceModel,
     addFloorDialog,
     addFolder,
-    changeFolderName
+    changeFolderName,
+    floorTable
   },
   data() {
     return {
@@ -158,6 +131,8 @@ export default {
       currentFolderName: "", //当前选择文件夹的Name
       tableData: [],
       loading: false, //加载loading
+      logData:[],      //楼层文件对应的模型日志
+      replaceModelItem:null   //替换文件的item
     };
   },
   methods: {
@@ -233,7 +208,7 @@ export default {
         ProjectId: this.projectId
       };
       request.queryFloor(data, res => {
-        this.tableData = res.Content
+        this.tableData = res.Content;
         this.loading = false;
       });
     },
@@ -244,17 +219,27 @@ export default {
 
     //以下是文件模型
 
-    //替换文件模型
-    repliaceModel(e) {
+    //打开替换文件模型
+    repliaceModel(item) {
+      this.replaceModelItem = item
       this.repliceModelVisible = true;
     },
+    // 上传模型文件
     uploadModelFIle(data) {
       // request.uploadModelFile(0);
       // this.queryFloorFile();
     },
+    //更新模型文件;
+    updateModelFile(data){
+      
+    },
     //查看模型日志
-    queryModelLog() {
-      this.modelLogVisible = true;
+    queryModelLog(item) {
+      let FloorModelId = item.CurrentModelId; //楼层模型文件
+      request.queryModelFile(FloorModelId, res => {
+        this.logData = res.EntityList
+        this.modelLogVisible = true;
+      });
     }
   },
   mounted() {