4 Commits f7e7198bcd ... 70ebd691d8

Author SHA1 Message Date
  duxiangyu 70ebd691d8 Merge branch 'master' into dev_duxiangyu 2 years ago
  qule 13b2a18585 Merge branch 'master' of http://39.106.8.246:3003/BDTP/adm-frontend 2 years ago
  qule 3c2e236762 bug 2 years ago
  niuheng 997c9d7e89 系统图编辑工具支持修改文本背景色 2 years ago

+ 2 - 1
public/systemConf.js

@@ -28,7 +28,8 @@ var __systemConf = {
         size: 16,
         color: '#646C73',
         weight: 600,
-        backGround: '#FFFFFF'
+        backGround: '#ffffff',
+        padding: 4
       },
       line:{
         width: 2,

+ 18 - 11
src/components/cadDrawingManage/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: ql
  * @Date: 2022-01-11 14:46:04
- * @LastEditTime: 2022-01-24 19:30:09
+ * @LastEditTime: 2022-01-25 12:08:13
  * @LastEditors: Please set LastEditors
  * @FilePath: \adm-frontend\src\components\cadDrawingManage\index.vue
 -->
@@ -36,7 +36,7 @@
                       :http-request='uploadHandle'
                       :before-upload="beforeUpload"
                       :show-file-list="false">
-                        <Button style="max-width: 220px" slot="trigger"  type="primary" icon="el-icon-download">上传.dwg CAD文件</Button>
+                        <Button style="max-width: 220px" slot="trigger"  type="primary" icon="el-icon-download" @click="resetUpload">上传.dwg CAD文件</Button>
                     </el-upload>
                   </div>
                  
@@ -135,7 +135,7 @@ export default {
       floorId: '',  //当前楼层
       buildingId: '', //当前建筑
       tableLoading: false,
-      fileList: [], //已选择文件
+      // fileList: [], //已选择文件
       // 基础表格表头列表
       headList: [
         {
@@ -158,7 +158,7 @@ export default {
     }
   },
   computed: {
-    ...mapState('uploadFile', ['successList', 'uploadVisible', 'errorList'])
+    ...mapState('uploadFile', ['successList', 'uploadVisible', 'errorList', 'fileList'])
   },
   filters: {
     timeFormat(timestr) {
@@ -169,7 +169,7 @@ export default {
     }
   },
   methods: {
-    ...mapMutations('uploadFile', ['updata']),
+    ...mapMutations('uploadFile', ['updata', 'resetData']),
     // 获取楼层信息
     async getCascader() {
       let param = {
@@ -204,7 +204,8 @@ export default {
       this.tableLoading = false
     },
     async uploadHandle(option) {
-      const isHas = this.fileList.find(item => option.file.name === item.name);
+      // console.log({option})
+      // const isHas = this.fileList.find(item => option.file.name === item.name);
       // if(isHas) {
       //   this.$message.closeAll();
       //   this.$message({ type: 'error', message: '当前文件已存在,请重新选择' });
@@ -214,17 +215,23 @@ export default {
         fileName: option.file.name,
         file: option.file
       }
-      this.fileList.push(file);
-      this.updata({uploadVisible: true, fileList: this.fileList})
+
+      // this.fileList.push(file);
+      const fileList = [...this.fileList, file]
+      this.updata({uploadVisible: true, fileList})
       
 
     },
     beforeUpload(file) {
-      if(this.uploadVisible) {
-        return false
-      }
+      // if(this.uploadVisible) {
+      //   return false
+      // }
       
     },
+    // 重置弹框
+    resetUpload() {
+       this.resetData()
+    },
    
     delHandle(row) {
       const id = row.id

+ 1 - 1
src/components/systemGraph/edit.vue

@@ -614,7 +614,7 @@ export default {
       //更新图形以及图形数据源
       this.$refs.graphc.updateDataAndGraph(3, 4, {
         id: this.selText.id,
-        fontColor: this.fontBackColor,
+        fontBackColor: this.fontBackColor,
       });
     },
     //文本X轴坐标变化后事件

+ 59 - 1
src/components/systemGraph/graph.vue

@@ -157,6 +157,7 @@ export default {
         });
 
         pixiContainer.appendChild(pixiApp.view);
+        pixiApp.stage.sortableChildren = true;
         _this.pixiApp = pixiApp;
       } else pixiApp = _this.pixiApp;
 
@@ -223,6 +224,7 @@ export default {
       });
 
       //文本
+      let textDefaultConfig = window.__systemConf.systemGraph.peiDian.text;
       _this.labelArr.forEach((_labelObj) => {
         var pixiTextStyle = new PIXI.TextStyle({
           fill: _labelObj.style.fontColor,
@@ -240,6 +242,8 @@ export default {
         });
 
         textInstance.position.set(newCordObj.x, newCordObj.y);
+        //zIndex没用?
+        // textInstance.zIndex = 2000000;
         // console.log(textInstance.width, "-", textInstance.height);
         //启用事件
         textInstance.interactive = true;
@@ -247,6 +251,39 @@ export default {
           _this.isClickGraphNode = true;
           _this.clickEventCall(event, 3);
         });
+
+        //----------------------------------------绘制文本的矩形背景框
+        var graphicsRect = new PIXI.Graphics();
+        graphicsRect.lineStyle({ width: 0 });
+        let newCordObjRect = _this.convertCoordToLeftOrigina({
+          x: _labelObj.absolutePosition.x - textDefaultConfig.padding,
+          y: _labelObj.absolutePosition.y - textDefaultConfig.padding,
+        });
+        var newWidth =
+          (textInstance.width + 2 * textDefaultConfig.padding) *
+          _this.canvasProObj.originalScale;
+        var newHeight =
+          (textInstance.height + 2 * textDefaultConfig.padding) *
+          _this.canvasProObj.originalScale;
+        graphicsRect.beginFill(
+          "0x" + _labelObj.style.backColor.substring(1)
+        );
+        graphicsRect.drawRect(
+          newCordObjRect.x,
+          newCordObjRect.y,
+          newWidth,
+          newHeight
+        );
+        graphicsRect.endFill();
+        graphicsRect.name = _this.constructorTextBackId(_labelObj.id);
+        graphicsRect._data = {
+          x: newCordObjRect.x,
+          y: newCordObjRect.y,
+          width: newWidth,
+          height: newHeight,
+        };
+        // textInstance.zIndex = 1;
+        pixiApp.stage.addChild(graphicsRect);
         pixiApp.stage.addChild(textInstance);
       });
 
@@ -668,11 +705,26 @@ export default {
               break;
             case 3:
               _dataObj.style.fontColor = exprObj.fontColor;
-              _dataObj.style.backColor = exprObj.fontBackColor;
               _stageStyle.fill = exprObj.fontColor;
               stageChild.style = _stageStyle;
               break;
             case 4:
+              let rectId = this.constructorTextBackId(exprObj.id);
+              let stageRectChild = this.pixiApp.stage.getChildByName(rectId);
+              // stageChild.fill.color = "0x000000";
+              let _cachData = stageRectChild._data;
+              stageRectChild.clear();
+              stageRectChild.beginFill(
+                "0x" + exprObj.fontBackColor.substring(1)
+              );
+              stageRectChild.drawRect(
+                _cachData.x,
+                _cachData.y,
+                _cachData.width,
+                _cachData.height
+              );
+              stageRectChild.endFill();
+
               _dataObj.style.backColor = exprObj.fontBackColor;
               break;
             case 6:
@@ -691,6 +743,12 @@ export default {
         }
       }
     },
+    /**
+     * 构造文本背景项的ID
+     */
+    constructorTextBackId: function (textId) {
+      return "textback_" + textId;
+    },
   },
   created() {},
 

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

@@ -64,7 +64,9 @@ export default {
     watch: {
         async uploadVisible(nv, ov) {
             const that = this;
+            this.synced = 0
             if (nv) {
+
                 this.uploading = true
                 const res = await FileController.uploadFiles({
                     uploadProgressCall(_obj) {

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

@@ -14,6 +14,12 @@ export default {
             for (const key in payload) {
                 state[key] = payload[key]
             }
+        },
+        resetData(state) {
+            state.uploadVisible = false;
+            state.fileList = [];
+            state.successList = [];
+            state.errorList = []
         }
     },
     actions: {