1
李喆(开发组)
2025-07-09 87acb007ca24a88652412d77b649199467b2a729
src/views/wel/index.vue
@@ -27,8 +27,8 @@
        <el-button :size="size" text icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除" title="删除"></el-button>
        <el-button :size="size" text v-if="row.nodeType < 60" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升级" title="升级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60 && !isSM" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 60" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="升级" title="升级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 70 && !isSM" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="下发" title="下发"></el-button>
      </template>
    </avue-crud>
    <!-- 新增节点 -->
@@ -198,6 +198,11 @@
        total: 0,
      },
      option: {
        rowKey: "id",
        treeProps: {
          children: "children",
          hasChildren: 'hasChildren',
        },
        lazy: true,
        rowKey: 'id',
        addBtn: false,
@@ -255,6 +260,7 @@
        ],
      },
      data: [],
      upData: []
    };
  },
  computed: {
@@ -290,7 +296,7 @@
          },
          {
            label: '零组件号/图号',
            prop: 'partNo'
            prop: 'drawingNo'
          },
          {
            label: '工序',
@@ -337,8 +343,17 @@
    }
  },
  methods: {
    downsend(row) {
    downsend(row) {  //下发
      // this.loading = true;
      // axios({
      //   url: '/program/ncfile/send-to-machine-by-nodeid',
      //   method: 'get',
      //   params: {nodeId:id},
      // }).then(
      //   res => {
      //   }
      // );
    },
    upgrade(row) {  //升级
      this.loading = true;
@@ -373,7 +388,6 @@
      return false;
    },
    uploadAfter() {
      alert(123)
    },
    uploadmodalSubmit(row,done) {
      if(this.file == null) {
@@ -550,7 +564,6 @@
            // 更新节点数据
            nodes[i].children = [...newChildren];
            this.data = [...this.data]; // 替换顶层引用
            return true;
          }
          if (Array.isArray(nodes[i].children) && nodes[i].children.length > 0) {
@@ -562,12 +575,19 @@
        return false;
      };
      updateTree(this.data);
      // this.upData = JSON.parse(JSON.stringify(this.data));
      // this.data = [];
      // 强制刷新
      this.$nextTick(() => {
        this.$refs.crud?.refreshTable();
        //this.$refs.crud.toggleRowExpansion('0', true);
        console.log(this.data,222)
        // this.data = this.upData;
        // this.option.defaultExpandAll = true;
      });
      // setTimeout(()=> {
      //   this.data = this.upData;
      //   this.option.defaultExpandAll = true;
      //   console.log(this.data,222)
      // },3000)
    },
    updateLocalTreeNode(nodeData) {   //修改的方法
      const updateNode = (nodes) => {
@@ -602,8 +622,8 @@
        params: obj,
      }).then(
        res => {
          resolve(res.data.data);
          this.loading = false;
          resolve(res.data.data);
        }
      );
    },
@@ -625,14 +645,17 @@
        params: obj,
      }).then(
        res => {
          this.loading = false;
          this.data = res.data.data;
          if(this.data.length == 0) {
            return;
          }
          this.tabsForm = res.data.data[0];  //节点信息
          this.nodeTypeList.forEach(item=> {
            if(item.dictKey == this.data[0].nodeType) {
              this.tabsForm.nodeTypeName = item.dictValue;
            }
          })
          this.loading = false;
        }
      );
    }