Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

haojianlong 4 years ago
parent
commit
37b55854c3

+ 4 - 0
src/api/editer.js

@@ -104,4 +104,8 @@ export function graphElementSearch(params){
 // 图例搜索(提取用)
 export function graphElementQuery(params){
     return httputils.postJson(`${testApi}/graphElement/query`, params)
+}
+//草稿箱原理图删除
+export function deleteByCategory(params){
+    return httputils.postJson(`${testApi}/graph/deleteByCategory`, params)
 }

+ 33 - 2
src/components/edit/top_toolbar.vue

@@ -2,7 +2,7 @@
   <div id="top_toolbar">
     <!-- 顶部编辑器 -->
     <div class="tit">
-      <!-- <a-icon type="left" /> -->
+      <a-icon style="cursor: pointer;" type="left" @click="goDrafts" />
       {{this.urlMsg.floorName}}
     </div>
     <div class="tool">
@@ -200,7 +200,9 @@ export default {
       scale: 0.5, //底图缩放比例
       initScale: 0.5, //初始 底图缩放比例
       baseScale: 1.0, //底图基础缩放比例,由底图加载完成后,传入进来
-      scaleStep: 0.05 // +-缩放步进
+      scaleStep: 0.05, // +-缩放步进
+      locationQuery: null,
+      urlMsg: {}
     };
   },
   computed: {
@@ -296,6 +298,35 @@ export default {
       //   this.$message.error("请选择指定对象!", 1);
       // }
     },
+    // 返回草稿箱
+    goDrafts() {
+      if (this.urlMsg.projectId && this.urlMsg.BuildingID && this.urlMsg.fmapID && this.urlMsg.token) {
+        this.$router.push({
+          path: 'drafts',
+          query: {
+            projectId: this.urlMsg.projectId,
+            BuildingID: this.urlMsg.BuildingID,
+            FloorID: this.urlMsg.FloorID,
+            fmapID: this.urlMsg.fmapID,
+            token: this.urlMsg.token
+          }
+        })
+      } else {
+        if (!this.urlMsg.projectId) {
+          console.log("暂无projectId!");
+        }
+        if (!this.urlMsg.BuildingID) {
+          console.log("暂无BuildingID!");
+        }
+        if (!this.urlMsg.fmapID) {
+          console.log("暂无fmapID!");
+        }
+        if (!this.urlMsg.token) {
+          console.log("暂无token!");
+        }
+        this.$message.error("参数缺失,无法跳转!");
+      }
+    },
     // 发布图例
     publishMap() {
       MessageBox.confirm("确认后即发布到平台?", "提示", {

+ 4 - 2
src/components/mapClass/EditScence.ts

@@ -457,8 +457,10 @@ export class EditScence extends SGraphScene {
                 IconUrl: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 Url: '/serve/topology-wanda/Picture/query/' + this._legend.Url,
                 Num: 1, // 此num与信息工程化得num无关
-                sWidth: 32,  //icon 的宽
-                sHeight: 32,   //icon 的高
+                Size: {
+                    Width: this._legend.Size?this._legend.Size.Width?this._legend.Size.Width:32:32,  //icon 的宽
+                    Height: this._legend.Size?this._legend.Size.Height?this._legend.Size.Height:32:32,   //icon 的高
+                },
                 font: 16,    //font
                 color: "#1F2429",  //字体颜色
                 FrameColor: this._legend.FrameColor,

+ 10 - 6
src/lib/items/SImageLegendItem.ts

@@ -90,11 +90,11 @@ export class SImageLegendItem extends SIconTextItem {
         if (data.Properties && data.Properties.Url) {
             this.img.url = data.Properties.Url;
         }
-        if (data.Properties && data.Properties.sWidth) {
-            this.sWidth = data.Properties.sWidth;
+        if (data.Properties && data.Properties.Size && data.Properties.Size.Width) {
+            this.sWidth = data.Properties.Size.Width;
         }
-        if (data.Properties && data.Properties.sHeight) {
-            this.sHeight = data.Properties.sHeight;
+        if (data.Properties && data.Properties.Size && data.Properties.Size.Height) {
+            this.sHeight = data.Properties.Size.Height;
         }
         if (data.Properties.ImgPos) {
             this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
@@ -130,10 +130,14 @@ export class SImageLegendItem extends SIconTextItem {
         this.data.Properties.Url = this.img.url;
         this.data.Properties.TextPos = { X: this.textItem.x, Y: this.textItem.y };
         this.data.Properties.ImgPos = { X: this.img.x, Y: this.img.y };
-        this.data.Properties.sWidth = this.sWidth;
-        this.data.Properties.sHeight = this.sHeight;
+        this.data.Properties.Size = {
+            Width: this.sWidth,
+            Height: this.sHeight
+        };
         this.data.Properties.font = this.font.size;
         this.data.Properties.color = this.color.value;
+        this.data.Properties.Font = this.font.size;
+        this.data.Properties.Coler = this.color.value;
         this.data.Properties.FrameColor = this.activeColor.value;
         this.data.Properties.IsActive = this.isActive;
         this.data.AnchorList = this.anchorList.map(t => {

+ 84 - 7
src/views/drafts.vue

@@ -17,7 +17,8 @@
         <div class="conent-tit">
           <div class="tit-left" v-if="floorName">{{systemName}}-{{floorName}}</div>
           <div class="tit-right">
-            <a-button @click="deleteBtn" :disabled="!floorName">删除</a-button>
+            <a-button @click="modalStatusTip=!modalStatusTip;grouptype='checked';grouptype1='uncheck';" :disabled="!floorName">删除</a-button>
+<!--            <a-button @click="deleteBtn" :disabled="!floorName">删除</a-button>-->
             <a-button @click="publishBtn" :disabled="!floorName">发布</a-button>
             <a-button type="primary" @click="goToEditer" :disabled="!floorName">编辑</a-button>
           </div>
@@ -68,6 +69,26 @@
         </div>
       </div>
     </div>
+    <Modal
+            :show="modalStatusTip"
+            title="确定要删除吗?"
+            mode="tip"
+            type="error"
+            @close="modalClose"
+    >
+      <template #content>
+        <div style="font-size: 15px; padding-left: 16px;padding-top: 16px;"  v-if="categoryId=='XFBFYCFL'||categoryId=='FZQZL'" >
+          <Radio :checked="grouptype" @change="grouptype='checked';grouptype1='uncheck'" >仅删除草稿</Radio>
+          <br>
+          <Radio :checked="grouptype1"  @change="grouptype1='checked';grouptype='uncheck'" >删除草稿和已发布的原理图</Radio>
+<!--          <radio-group  v-if="categoryId=='XFBFYCFL'||categoryId=='FZQZL'" :group-data.sync="groupData" :type="grouptype" @change="handleChange" />-->
+        </div>
+      </template>
+      <template #handle>
+        <Button @click="modalClose" type="default">取消</Button>
+        <Button @click="modalConfirm" type="error">确定</Button>
+      </template>
+    </Modal>
   </div>
 </template>
 <script>
@@ -82,7 +103,8 @@ import {
   queryDraftGroup,
   queryStatistic,
   deleteGraph,
-  publishGraph
+  publishGraph,
+  deleteByCategory
 } from "@/api/editer.js";
 import { STopologyParser } from "./../lib/parsers/STopologyParser";
 import { uuid } from "@/components/mapClass/until";
@@ -95,6 +117,9 @@ export default {
   components: { Tree },
   data() {
     return {
+      modalStatusTip:false,
+      grouptype:'checked',
+      grouptype1:'uncheck',
       treeData: [],
       columns: [
         {
@@ -121,7 +146,7 @@ export default {
       appName: "万达可视化系统",
       defaultProps: {
         children: "Category",
-        label: "Gcode"
+        label: "Code"
       },
       projectId: "", //项目id
       fmapID: "", //蜂鸟地图id
@@ -236,6 +261,7 @@ export default {
       }
     },
     change(id) {
+      console.log(id);
       const data = this.treeData;
       (function recursion(newObj) {
         newObj.map(function(item, index) {
@@ -272,7 +298,7 @@ export default {
       this.systemName = "";
       this.floorName = "";
       this.systemName = items.Gcode;
-      this.floorName = id.Gcode;
+      this.floorName = id.Code;
       this.floorId = id.Gname;
       this.categoryId = items.Id;
       // this.getLegend();
@@ -300,11 +326,12 @@ export default {
               (function recursion(newObj) {
                 newObj.map(function(item, index) {
                   item.id = item.Id || item.Gname;
-                  item.name = item.Gcode;
+                  item.name = item.Code;
 
                   item.checked = false;
                   if (item.Category && item.Category.length > 0) {
                     item.children = item.Category;
+                    item.name=item.Gcode;
                     item.open = false;
                     recursion(item.Category);
                   }
@@ -329,7 +356,7 @@ export default {
                 this.treeData[0].children[0].open = true;
                 this.treeData[0].children[0].children[0].checked = "checked";
                 this.systemName = this.treeData[0].children[0].Gcode;
-                this.floorName = this.treeData[0].children[0].children[0].Gcode;
+                this.floorName = this.treeData[0].children[0].children[0].Code;
                 this.floorId = this.treeData[0].children[0].children[0].Gname;
                 this.categoryId = this.treeData[0].children[0].Id;
                 // this.getLegend();
@@ -338,7 +365,7 @@ export default {
                 this.treeData[0].open = true;
                 this.treeData[0].children[0].checked = "checked";
                 this.systemName = this.treeData[0].Gcode;
-                this.floorName = this.treeData[0].children[0].Gcode;
+                this.floorName = this.treeData[0].children[0].Code;
                 this.floorId = this.treeData[0].children[0].Gname;
                 this.categoryId = this.treeData[0].Id;
                 // this.getLegend();
@@ -383,8 +410,56 @@ export default {
         }
       });
     },
+    modalClose() {
+      this.modalStatusTip = false;
+    },
+    modalConfirm() {
+     this.deleteBtn();
+      this.modalStatusTip = false;
+    },
     //删除
     deleteBtn() {
+      if(this.categoryId=='XFBFYCFL'||this.categoryId=='FZQZL'){
+        if(this.grouptype=='checked'){
+          this.deleteGraphMap();
+        }else{
+          this.deleteByCategoryMap();
+        }
+      }else{
+       this.deleteGraphMap()
+      }
+
+    },
+    //原理图删除
+    deleteByCategoryMap(){
+      const loadings = Loading.service({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)"
+      });
+      let params = {
+        "BuildingID": this.BuildingID,
+        "CategoryID": this.categoryId,
+        "FloorID": this.floorId,
+        "ProjectID": this.projectId
+      }
+      deleteByCategory(params).then(res=>{
+        loadings.close();
+        if (res.Result == "success") {
+          this.$message.success("删除成功");
+          this.getTreeData();
+          // this.init();
+          this.legendData = [];
+        } else {
+          this.$message.error(res.Message);
+        }
+      }).catch(()=>{
+        loadings.close();
+      });
+    },
+    //正常删除
+    deleteGraphMap(){
       const loadings = Loading.service({
         lock: true,
         text: "Loading",
@@ -402,6 +477,8 @@ export default {
         } else {
           this.$message.error(res.Message);
         }
+      }).catch(()=>{
+        loadings.close();
       });
     },
     //发布