管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-05-28 fb5bc4314a4da6fc83a6403f3a70c0af25b8d20e
项目管理上移下移,非自动发布模型附件信息挂载,查询
已修改3个文件
267 ■■■■■ 文件已修改
src/components/mapsdk.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/preview_map.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/datamanage/catalogueManage.vue 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/mapsdk.vue
@@ -835,7 +835,8 @@
      window.pickedColor;
      window.modeCatchHandler = new Cesium.ScreenSpaceEventHandler(Viewer.scene.canvas);
      window.modeCatchHandler.setInputAction((event) => {
        window.pickedFeature && (window.pickedFeature.color = window.pickedColor);
        if (window.pickedColor) { window.pickedFeature && (window.pickedFeature.color = window.pickedColor); }
        // window.pickedFeature && (window.pickedFeature.color = window.pickedColor);
        window.pickedFeature = sgworld.Viewer.scene.pick(event.position);
        if (Cesium.defined(window.pickedFeature)) {
          if (window.pickedFeature.primitive instanceof Cesium.Cesium3DTileset) {
@@ -855,8 +856,9 @@
      var modelKey = 'id';
      var modelid;
      debugger
      if (result.tileset) {
        if (result.tileset.pubid) {
        if (result.tileset.pubid && parseInt(result.tileset.pubid) > 0) {
          const data = await comprehensive_selectPubById({ id: result.tileset.pubid })
          if (data.code != 200) {
@@ -869,12 +871,15 @@
            return this.$message('没有模型主键ID,无法查询数据');
          }
          modelid = pickedFeature.getProperty(modelKey);
        }
      } else {
        modelid = '3dml' + result.primitive.id;
      }
      var that = this
      if (!modelid) {
        modelid = "noAuto_" + pickedFeature.primitive.layerId;
      }
      var obj = {
        layerid: pickedFeature.primitive.layerId,
        modelid: modelid
src/components/preview_map.vue
@@ -734,8 +734,7 @@
      var modelKey = 'id';
      if (result.tileset) {
        if (result.tileset.pubid) {
        if (result.tileset.pubid && parseInt(result.tileset.pubid) > 0) {
          const data = await comprehensive_selectPubById({ id: result.tileset.pubid })
          if (data.code != 200) {
@@ -748,6 +747,7 @@
          }
          this.formInline.Id = result.getProperty(modelKey);
          this.layerID = result.getProperty(modelKey);
        }
      } else {
        var id = '3dml' + result.primitive.id;
@@ -759,6 +759,12 @@
      this.formInline.layerName = result.primitive.id;
      // this.formInline.title = result.getProperty("name")
      if (!this.formInline.Id) {
        this.formInline.Id = "noAuto_" + this.formInline.layerId;
      }
      if (!this.layerID) {
        this.layerID = "noAuto_" + this.formInline.layerId;
      }
      this.startModelData();
src/views/datamanage/catalogueManage.vue
@@ -524,6 +524,7 @@
        }
      ],
      currentData: null,
    };
  },
  methods: {
@@ -691,35 +692,54 @@
    },
    // 请求目录树
    getDirTree() {
    async getDirTree() {
      //获取目录树最大ID,新建节点使用
      // queryMaxId().then((res) => {
      //   this.id = res.data;
      // });
      // 获取目录树数据
      queryDirTree().then((res) => {
        // console.log(res);
        if (res.code == 200) {
      const data = await queryDirTree();
          this.oriData = res.result;
          this.newData = res.result;
          this.dirList = this.treeData(res.result);
          //  this.$nextTick(() => {
      if (data.code != 200) {
        return this.$message.error("项目列表查询失败");
      }
      this.oriData = data.result;
      this.newData = data.result;
      this.dirList = this.treeData(data.result);
          //    this.expandData=[15]
          //    this.$refs.tree.setCurrentKey(15);
          //   });
          if (this.itemaName != null) {
            this.$nextTick(() => {
              this.expandData = [this.itemaName];
              this.$refs.tree.setCurrentKey(this.itemaName);
            });
          }
        } else {
          console.log("接口报错");
        }
      var cdata;
      if (this.currentData) {
        var rs = JSON.parse(this.currentData);
        cdata = this.$refs.tree.getNode(rs.id).data;
      } else {
        cdata = this.dirList[0]
      }
      this.$nextTick(() => {
        this.expandData = [cdata.id];
        this.$refs.tree.setCurrentKey(cdata.id);
        this.layerFormInline(cdata)
      });
      // queryDirTree().then((res) => {
      //   // console.log(res);
      //   if (res.code == 200) {
      //     //  this.$nextTick(() => {
      //     //    this.expandData=[15]
      //     //    this.$refs.tree.setCurrentKey(15);
      //     //   });
      //   } else {
      //     console.log("接口报错");
      //   }
      // });
    },
    handleClose() {
      this.$confirm("关闭后无法保存,是否关闭?")
@@ -733,12 +753,19 @@
      return cloneData.filter((father) => {
        // 循环所有项
        let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
        if (branchArr.length > 0) {
          branchArr.sort(function (a, b) {
            return a.orderNum - b.orderNum
          })
        }
        branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值
        // 属于同一对象问题,例如:令 a=b、c=1 ,然后再令 b.c=c , 那么 a.c=b.c=c=1 ;同理,后续令 c.d=2 ,那么 a.c.d 也是=2;
        // 由此循环多次后,就能形成相应的树形数据结构
        return father.pid == 0; // 返回一级菜单
      });
    },
    //向上向下移动
    setEditNode(res) {
      let node = this.$refs.tree.getCurrentNode();
      let pchildNodes = this.$refs.tree.getNode(node.id).parent.childNodes;
@@ -756,7 +783,8 @@
            // tempChildrenNodex2.orderNum =
            //   pchildNodes[currentId - 1].data.orderNum;
            // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
            var arr = [];
            const arr = [];
            this.oriData.filter((res) => {
              if (res.id == tempChildrenNodex2.data.id) {
                // res.orderNum = tempChildrenNodex2.orderNum;
@@ -766,9 +794,11 @@
                arr.push(res);
              }
            });
            const orderNum = arr[1].orderNum
            arr[1].orderNum = arr[0].orderNum
            arr[0].orderNum = orderNum
            this.newData = arr;
            this.sendChange();
          } else {
@@ -785,7 +815,8 @@
            // tempChildrenNodex2.orderNum =
            //   pchildNodes[currentId + 1].data.orderNum;
            // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
            var arr = [];
            const arr = [];
            this.oriData.filter((res) => {
              if (res.id == tempChildrenNodex2.data.id) {
                // res.orderNum = tempChildrenNodex2.orderNum;
@@ -825,17 +856,33 @@
          });
        });
    },
    insertStart() {
      this.ruleForm = {
        level: null,
        orderNum: null,
        pid: null,
        name: "",
        descr: "",
        bak: "",
        checks: []
      }
    },
    setNewNode(res) {
      this.insertStart();
      var node = this.$refs.tree.getCurrentNode();
      this.newNode = node;
      var id, lever, orderNum;
      if (res == 1) {
        //新增同级
        id = this.itemdetail.pid;
        orderNum = this.getMaxOrderNum(this.newNode.parent.childNodes);
        let pchildNodes = this.$refs.tree.getNode(this.newNode.id).parent.childNodes
        orderNum = this.getMaxOrderNum(pchildNodes);
        lever = this.itemdetail.level;
      } else if (res == 2) {
        //新增子级
        id = this.itemdetail.id;
        orderNum = this.getMaxOrderNum(this.newNode.childNodes);
        let pchildNodes = this.$refs.tree.getNode(this.newNode.id).childNodes
        orderNum = this.getMaxOrderNum(pchildNodes);
        lever = this.itemdetail.level + 1;
      }
@@ -854,7 +901,6 @@
      val = val + 1;
      return val;
    },
    append(node, data) {
      this.dialogFormVisible = true;
      this.ruleForm.pid = data.id;
@@ -866,7 +912,7 @@
      this.ruleForm = {};
      this.$nextTick(() => {
        this.ruleForm = {};
        this.$refs[formName].resetFields();
        // this.$refs[formName].resetFields();
      });
    },
    submitForm(formName) {
@@ -880,8 +926,8 @@
            } else {
              val.checks = ''
            }
            // var val = JSON.parse(JSON.stringify(this.ruleForm))
            // this.itemdetail = val
            insertDir(val)
              .then((res) => {
                setTimeout(() => {
@@ -892,9 +938,9 @@
                      message: "添加成功",
                      type: "success",
                    });
                    this.itemaName = res.result;
                    this.itemdetail = {};
                    this.ruleForm = {};
                    // this.itemdetail = {};
                    // this.ruleForm = {};
                    this.dialogFormVisible = false;
                    this.$refs[formName].resetFields();
                    this.getDirTree();
@@ -944,6 +990,12 @@
                  type: "success",
                  message: "删除成功!",
                });
                let pchildNodes = this.$refs.tree.getNode(this.itemdetail.id).parent;
                if (pchildNodes.data.id) {
                  this.currentData = JSON.stringify(pchildNodes.data)
                } else {
                  this.currentData = null
                }
                this.itemdetail = {};
                this.getDirTree();
@@ -956,8 +1008,8 @@
              }
            })
            .catch(() => {
              this.$message.error("删除失败");
              this.itemdetail = {};
              // this.$message.error("删除失败");
              // this.itemdetail = {};
            });
          //重置要删除的子ID
          this.delChildIDs = [];
@@ -1045,19 +1097,25 @@
          this.dirList = this.old_dirDat; //将备份的dir重新赋值
        });
    },
    sendChange() {
      updateDirTrees(this.newData)
        .then((res) => {
          if (res.code == 200) {
            this.getDirTree();
            return;
          } else {
            this.$message.error("移动失败,请重试!");
          }
        })
        .catch(() => {
          this.$message.error("移动失败,请重试!");
        });
    async sendChange() {
      const data = await updateDirTrees(this.newData)
      if (data.code != 200) {
        return this.$message.error("移动失败");
      }
      this.getDirTree();
      // this.getLayerTree()
      //   .then((res) => {
      //     if (res.code == 200) {
      //
      //       return;
      //     } else {
      //       this.$message.error("移动失败,请重试!");
      //     }
      //   })
      //   .catch(() => {
      //     this.$message.error("移动失败,请重试!");
      //   });
    },
    setDirectoryDownload() {
@@ -1065,18 +1123,21 @@
      console.log(url)
      $("#Iframe1").attr("src", url).click()
    },
    handleNodeClick(data, node) {
      // console.log(data);
    layerFormInline(data) {
      if (data.pid == 0) {
        this.directoryData = data;
        this.directoryFlag = true;
      } else {
        this.directoryFlag = false;
      }
      this.newNode = node;
      this.newNode = this.$refs.tree.getNode(data.id);
      this.backUpData = JSON.stringify(data);
      var val = JSON.parse(JSON.stringify(data));
      var val = this.$refs.tree.getNode(data.id).data;
      this.itemdetail = val;
      this.currentData = JSON.stringify(data)
      debugger
      var checks = [];
      if (val.checks) {
        if (val.checks.indexOf(',') > -1) {
@@ -1084,6 +1145,8 @@
          for (var i in value) {
            checks.push(value[i])
          }
        } else if (val.checks.indexOf('[]') > -1) {
        } else {
          checks.push(val.checks)
        }
@@ -1091,38 +1154,67 @@
      } else {
        this.itemdetail.checks = []
      }
    },
    handleNodeClick(data, node) {
      this.layerFormInline(data)
      // console.log(data);
    },
    updCata(formName) {
      this.$nextTick(() => {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.fullscreenLoading = true;
    async updCata(formName) {
      this.fullscreenLoading = true;
      var val = JSON.parse(JSON.stringify(this.itemdetail));
      val.orderNum = this.newNode.data.orderNum;
            var val = this.itemdetail
            var value = this.itemdetail.checks.toString()
            val.checks = value;
      var value = this.itemdetail.checks.toString()
      val.checks = value;
      const data = await updateDirTree(val);
      this.currentData = JSON.stringify(this.itemdetail)
            updateDirTree(val)
              .then((res) => {
                setTimeout(() => {
                  this.fullscreenLoading = false;
                  if (res.code == 200) {
                    this.getDirTree();
                    this.itemdetail = {};
                    this.dialogFormVisible = false;
                  }
                }, 500);
              })
              .catch((res) => {
                this.$message.error("修改失败,请重试!");
                this.fullscreenLoading = false;
              });
          } else {
            return false;
          }
        });
      if (data.code != 200) {
        this.fullscreenLoading = false;
        return this.$message.error("修改失败");
      }
      this.$message({
        message: '修改成功',
        type: 'success'
      });
      this.fullscreenLoading = false;
      this.getDirTree();
      // this.$nextTick(() => {
      //   this.$refs[formName].validate((valid) => {
      //     if (valid) {
      //
      //       var val = this.itemdetail
      //       var value = this.itemdetail.checks.toString()
      //       val.checks = value;
      //       debugger
      //       let res = JSON.parse(JSON.stringify(this.itemdetail));
      //       this.itemdetail = res;
      //
      //       updateDirTree(val)
      //         .then((res) => {
      //           setTimeout(() => {
      //             this.fullscreenLoading = false;
      //             if (res.code == 200) {
      //               this.getDirTree();
      //               // this.itemdetail = {};
      //               this.dialogFormVisible = false;
      //             }
      //           }, 500);
      //         })
      //         .catch((res) => {
      //           this.$message.error("修改失败,请重试!");
      //           this.fullscreenLoading = false;
      //         });
      //     } else {
      //       return false;
      //     }
      //   });
      // });
    },
    reset(formName) {
      this.itemdetail = {};