1
李喆(开发组)
7 天以前 2240e53ef2aa4cfb5033a0987149dc97482dd29d
src/views/wel/index.vue
@@ -73,7 +73,7 @@
        emptyText: "取消",
        menuPosition: "right",
        column: [{
          label: '升版',
          label: '工序版次',
          prop: 'processEdition',
          labelWidth: "80",
          span: 22
@@ -143,6 +143,12 @@
          {
            label: '最后修改时间',
            prop: 'updateTime',
            disabled: true,
            placeholder: " "
          },
          {
            label: '备注',
            prop: 'remark',
            disabled: true,
            placeholder: " "
          }
@@ -381,12 +387,13 @@
      axios({
        url: '/blade-mdm/program/ncfile/upgrade-process-edition',
        method: 'post',
        data: {id:row.id,newProcessEdition: row.processEdition},
        params: {bindNcNodeId:row.id,newProcessEdition: row.processEdition},
      }).then(
        res => {
            done();
            this.upgradeModal = false;
            //this.$message.success('操作成功');
            this.$message.success('操作成功');
            this.addLocalTreeNode(row.parentId);
        }
      );
    },
@@ -394,19 +401,20 @@
      this.upgradeModal = false;
    },
    downsend(row) {  //下发
      // this.loading = true;
      // axios({
      //   url: '/program/ncfile/send-to-machine-by-nodeid',
      //   method: 'get',
      //   params: {nodeId:id},
      // }).then(
      //   res => {
            //this.loading = false;
      //   }
      // );
      this.loading = true;
      axios({
        url: '/blade-mdm/program/ncfile/send-to-machine-by-nodeid',
        method: 'post',
        params: {nodeId:row.id},
      }).then(
        res => {
            this.loading = false;
            this.$message.success('操作成功');
        }
      );
    },
    upgrade(row) {  //升版
      this.upgradeModalForm = row;
      this.upgradeModalForm = {...row};
      this.upgradeModal = true;
    },
    delFile(item) {
@@ -480,15 +488,15 @@
    tabsHandleChange(tabs) {
      this.tabsType = tabs.prop;
    },
    showUpload(row) {
    showUpload(row) {//获取文件内容
      this.fileList = [];
      this.uploadmodalForm = row;
      //获取文件内容
      this.loading = true;
      var obj = {parentId: row.id}
      axios({
        url: '/blade-mdm/program/ncfile/list-by-node',
        url: '/blade-mdm/program/node/lazy-list',
        method: 'get',
        params: {nodeId: row.id},
        params: obj,
      }).then(
        res => {
          this.loading = false;
@@ -530,9 +538,7 @@
        }).then(
          res => {
            this.loading = false;
            var nodeArr = this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[row.parentId];
            var arr = nodeArr.filter(item => item.id !== row.id);
            this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[row.parentId] = arr;
            this.addLocalTreeNode(row.parentId);
          }
        );
      })
@@ -573,7 +579,7 @@
          this.modalBox = false;
          // 修改,更新本地数据
          if (this.modalTitle === "修改") {
            this.updateLocalTreeNode(this.modalForm);
            this.addLocalTreeNode(row.parentId);
          }else {
            // 如果是新增操作,可能需要重新加载数据
            //this.$refs.crud.refreshTable();
@@ -600,28 +606,14 @@
      }).then(
        res => {
          var children = res.data.data || [];
          this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[parentId] = [...children];
          if(parentId == 0) {
            this.data = [...children];
          }else {
            this.$refs.crud.$refs.table.store.states.lazyTreeNodeMap.value[parentId] = [...children];
          }
          this.loading = false;
        }
      );
    },
    updateLocalTreeNode(nodeData) {   //修改的方法
      const updateNode = (nodes) => {
        for (let i = 0; i < nodes.length; i++) {
          if (nodes[i].id === nodeData.id) {
            // 更新节点数据
            Object.assign(nodes[i], nodeData);
            return true;
          }
          if (Array.isArray(nodes[i].children) && nodes[i].children.length > 0) {
            if (updateNode(nodes[i].children)) {
              return true;
            }
          }
        }
        return false;
      };
      updateNode(this.data);
    },
    modalCancel() {
      this.modalBox = false;