田源
2024-10-21 8bd81a9ff5543b40c8717b88af357250958598ef
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/index.vue
@@ -25,6 +25,15 @@
    <el-main>
      <basic-container>
        <div v-if="!tableStatus" style="display: flex;justify-content: left;margin-top: 15px">
          <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">增加</el-button>
          <el-button icon="el-icon-delete" plain size="small" type="danger" @click="deleteClickHandler">删除</el-button>
          <el-button icon="el-icon-document-add" plain size="small" type="primary" @click="copyClickHandler">克隆
          </el-button>
          <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">导入</el-button>
          <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出
          </el-button>
        </div>
        <avue-crud
          v-if="!tableStatus"
          ref="crud"
@@ -61,17 +70,9 @@
            </el-button>
          </template>
        </avue-crud>
        <div v-if="!tableStatus" style="display: flex;justify-content: center;margin-top: 15px">
          <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">增加</el-button>
          <el-button icon="el-icon-delete" plain size="small" type="danger" @click="deleteClickHandler">删除</el-button>
          <el-button icon="el-icon-document-add" plain size="small" type="primary">克隆</el-button>
          <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">导入</el-button>
          <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出
          </el-button>
        </div>
      </basic-container>
    </el-main>
    <form-dialog ref="formDialog" :TreeNodeRow="this.nodeRow" :treeRadio="treeRadio"></form-dialog>
    <form-dialog ref="formDialog" :TreeNodeRow="this.nodeRow" :treeRadio="treeRadio" :editRow="editRow"></form-dialog>
    <table-dialog ref="tableDialog" :TreeNodeRow="this.nodeRow" :treeRadio="treeRadio"
                  @updataTable="getRightPortalVIDatas"></table-dialog>
    <!-- 导入 -->
@@ -117,6 +118,7 @@
        addBtn: false,
        editBtn: false,
        delBtn: false,
        calcHeight: -60,
        column: [
          {
            label: '业务名称',
@@ -146,7 +148,8 @@
        }
      },
      dbClickList: [],
      defaultData: [], // 用于查询恢复原始值
      defaultData: [], // 用于查询恢复原始值,
      editRow:{},
    }
  },
  created() {
@@ -165,11 +168,13 @@
        return;
      }
      if (this.tableRadio === "0") {
        this.editRow.id = "";
        this.$refs.formDialog.visible = true;
        this.$refs.formDialog.getTreeList();
      } else {
        this.$refs.tableDialog.visible = true;
        this.$refs.tableDialog.getDbList();
        this.$refs.tableDialog.getSearchSelectList();
      }
    },
@@ -184,6 +189,8 @@
        });
        this.treeData = data;
        this.treeLoading = false;
      }).catch(error => {
        loading.close();
      });
    },
@@ -199,11 +206,12 @@
            return item.attributes; // 返回处理后的 attributes
          });
          this.treeData = data;
          this.treeLoading = false;
        });
      } else {
        gridLink().then(res => {
          const data = res.data.data.map(item => {
            item.label = item.name;
            item.id = item.name;
            return item;
          });
          this.treeData = data;
@@ -225,6 +233,7 @@
    // 左侧树点击
    nodeClick(row) {
      console.log(row);
      this.tableRadio = null;
      this.nodeRow = row;
      this.getRightPortalVIDatas(row);
@@ -271,6 +280,7 @@
    // 编辑按钮
    editBtnClick(row) {
      console.log('row',row);
      // 表格
      if (row.viType === 0) {
        const params = {
@@ -318,7 +328,7 @@
          id: row.id,
          viType: row.viType
        };
        this.editRow = row;
        getPortalVIById(params).then(res => {
          if (res.data.code === 200) {
            const data = res.data.obj.prm.prmItemList;
@@ -334,6 +344,7 @@
            this.$refs.formDialog.getTreeList();
            this.$refs.formDialog.topForm.viName = res.data.obj.viName;
            this.$refs.formDialog.topForm.columnNumber = this.getValueBasedOnInput(res.data.obj.prm.showCols);
            this.$refs.formDialog.topForm.showColumn = res.data.obj.prm.showCols;
            this.$refs.formDialog.visible = true;
          }
@@ -384,12 +395,10 @@
        this.$message.error('请至少选择一条数据');
        return;
      }
      console.log(this.selectList);
      const params = {
        ids: this.selectList.map(item => item.id).join(',')
      }
      deleteByIds(params).then(res => {
        console.log(res);
        if (res.data.code === 200) {
          this.$message.success('删除成功');
          this.getRightPortalVIDatas();
@@ -397,7 +406,14 @@
      })
    },
    rowDeleteHandler(row) {
      deleteByIds({ids: row.id}).then(res => {
        if (res.data.code === 200) {
          this.$message.success('删除成功');
          this.getRightPortalVIDatas();
        }
      })
    },
    // 多选
    selectChangeHandler(row) {
      this.selectList = row;
@@ -439,6 +455,19 @@
    // 导入
    upLoadClickHandler() {
      this.$refs.upload.visible = true;
    },
    // 导出
    copyClickHandler() {
      if (this.selectList.length <= 0) {
        this.$message.error('请至少选择一条数据');
        return;
      }
      if (this.selectList.length > 1) {
        this.$message.error('只能选择一条数据');
        return;
      }
    }
  }
}