1
李喆(开发组)
2025-06-24 616f3c388e528c7cd9052f635fc4e581c9dbe37b
1
已修改1个文件
189 ■■■■ 文件已修改
src/views/wel/index.vue 189 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/wel/index.vue
@@ -16,17 +16,28 @@
      @row-del="rowDel"
      @row-save="rowSave"
      @row-update="rowUpdate"
      @row-click="rowClick"
    >
      <template #name="{ row }">
        <span>{{row.name}}</span>
        <el-button :size="size" text icon="el-icon-setting" type="primary" placeholder="修改" @click="showEdit(row)"></el-button>
        <el-button :size="size" text icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="删除"></el-button>
        <el-button :size="size" text v-if="row.nodeType < 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级"></el-button>
        <el-button :size="size" text icon="el-icon-setting" type="primary" placeholder="修改" @click="showEdit(row)" title="修改"></el-button>
        <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 < 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="新增子级" title="新增子级"></el-button>
        <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="文件上传" title="文件上传"></el-button>
      </template>
    </avue-crud>
    <el-dialog :title="modalTitle" append-to-body v-model="modalBox">
      <avue-form :option="modalOption" v-model="modalForm" @submit="modalSubmit" @reset-change="modalCancel"/>
    </el-dialog>
    <el-dialog title="上传文件" append-to-body v-model="uploadmodalBox">
      <avue-form :option="uploadmodalOption" v-model="uploadmodalForm" @submit="uploadmodalSubmit" @reset-change="uploadmodalCancel"/>
    </el-dialog>
    <avue-tabs :option="tabsOption" @change="tabsHandleChange" style="margin-top: 30px;"></avue-tabs>
      <avue-form v-if="tabsType === 'tab1'" :option="tabsFormOption" v-model="tabsForm"/>
    <span v-else-if="tabsType === 'tab2'">版本信息</span>
  </basic-container>
</template>
@@ -35,6 +46,108 @@
export default {
  data() {
    return {
      tabsType: "tab1",
      tabsOption: {
        column: [{
          icon: 'el-icon-info',
          label: '节点信息',
          prop: 'tab1',
        }, {
          icon: 'el-icon-warning',
          label: '版本信息',
          prop: 'tab2',
        }]
      },
      tabsFormOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: '节点类型',
            prop: 'nodeType',
            disabled: true,
            placeholder: " "
          },
          {
            label: '创建人',
            prop: 'createUser',
            disabled: true,
            placeholder: " "
          },
          {
            label: '节点名称',
            prop: 'name',
            disabled: true,
            placeholder: " "
          },
          {
            label: '创建时间',
            prop: 'createTime',
            disabled: true,
            placeholder: " "
          },
          {
            label: '节点描述',
            prop: 'description',
            disabled: true,
            placeholder: " "
          },
          {
            label: '最后修改时间',
            prop: 'updateTime',
            disabled: true,
            placeholder: " "
          },
          {
            label: '节点全路径',
            prop: '',
            disabled: true,
            placeholder: " ",
            span: 24
          }
        ]
      },
      tabsForm: {},
      uploadmodalBox: false,
      uploadmodalOption: {
        submitText: "保存",
        emptyText: "取消",
        menuPosition: "right",
        column: [
          {
            label: '节点类型',
            prop: 'nodeType',
            type: 'select',
            dicUrl: '/blade-system/dict-biz/dictionary?code=nc_node_type',
            props: {
              label: 'dictValue',
              value: 'dictKey',
            },
            disabled: true
          },
          {
            label: '选择文件',
            prop: 'abcd',
            type: 'upload',
            data: "{a:123}",
            action: "",
            showFileList: false,
            span: 24
          },
          {
            label: '全路径',
            prop: 'abc',
            span: 24
          },
          {
            label: '备注',
            prop: 'remark',
            type: "textarea",
            span: 24
          }
        ]
      },
      uploadmodalForm: {},
      selectedColumn: {},
      modalForm: {},
      modalOption: {
@@ -154,6 +267,19 @@
    };
  },
  methods: {
    rowClick(row) {
      this.tabsForm = row;
    },
    tabsHandleChange(tabs) {
      this.tabsType = tabs.prop;
    },
    showUpload(row) {
      this.uploadmodalForm = row;
      this.uploadmodalBox = true;
    },
    uploadmodalSubmit(row,done) {
    },
    rowDel(row, index, done) {
      done(row);
    },
@@ -169,18 +295,24 @@
      this.modalForm = row;
    },
    showDel(row) {
      //调用接口
      this.loading = true;
      axios({
        url: '/blade-mdm/program/node/remove',
        method: 'post',
        params: {id: row.id},
      }).then(
        res => {
          this.loading = false;
          this.$refs.crud.rowDel(row);
        }
      );
      this.$confirm('将会删除该节点及其子节点,是否确认删除?', {
        confirmButtonText: '是',
        cancelButtonText: '否',
        type: 'warning',
      }).then(() => {
        //调用接口
        this.loading = true;
        axios({
          url: '/blade-mdm/program/node/remove',
          method: 'post',
          params: {id: row.id},
        }).then(
          res => {
            this.loading = false;
            this.$refs.crud.rowDel(row);
          }
        );
      })
    },
    showAdd (row) {  //新增子节点
      if(row.nodeType == 70) {
@@ -213,12 +345,12 @@
          // 修改,更新本地数据
          if (this.modalTitle === "修改") {
            this.updateLocalTreeNode(this.modalForm);
          }else {
            // 如果是新增操作,可能需要重新加载数据
            this.$refs.crud.refreshTable();
          }
          this.loading = false;
          done(row);
          // 如果是新增操作,可能需要重新加载数据
          // this.$refs.crud.refresh();
          // this.$refs.crud.refreshTable();
        }
      );
    },
@@ -242,6 +374,9 @@
    },
    modalCancel() {
      this.modalBox = false;
    },
    uploadmodalCancel() {
      this.uploadmodalBox = false;
    },
    treeLoad (tree, treeNode, resolve) {
      this.loading = true;
@@ -276,26 +411,10 @@
      }).then(
        res => {
          this.data = res.data.data;
          this.tabsForm = res.data.data[0];  //节点信息
          this.loading = false;
        }
      );
      // this.data =   [{
      //     id: this.parentId,
      //     parentId: this.parentId,
      //     date: '2016-05-02',
      //     name: '王小虎',
      //     address: 'hhh',
      //     hasChildren: true
      //   },
      //   {
      //     id: 7,
      //     parentId: 7,
      //     date: '2016-05-02',
      //     name: '王小虎',
      //     address: 'hhh',
      //     hasChildren: false
      //   }]
      //   this.loading = false;
    }
  },
};