ludc
2024-07-24 dfd77a2f5f905e27216b87d207f9fe8c4035e797
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue
@@ -1,4 +1,6 @@
<template>
  <el-container>
    <el-main>
  <basic-container>
    <avue-crud
      ref="userCrud"
@@ -17,7 +19,8 @@
        <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button>
        <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button>
        <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button>
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板</el-button>
            <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板
            </el-button>
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">导出</el-button>
        <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">导入</el-button>
      </template>
@@ -90,10 +93,10 @@
    <el-dialog
      v-dialogDrag
      v-loading="checkViewLoading"
      title="查看使用范围"
      :visible.sync="checkViewVisible"
      append-to-body="true"
      class="avue-dialog"
          title="查看使用范围"
      width="70%"
    >
    <avue-crud
@@ -108,21 +111,102 @@
    </el-dialog>
    <!--导入    -->
    <upload-file ref="upload" :tipList="tipList" :fileType="upFileType" :fileUrl="fileUrl" title="导入" @updata="getTableList"></upload-file>
        <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入"
                     @updata="getTableList"></upload-file>
  </basic-container>
    </el-main>
    <el-aside width="30%">
      <basic-container>
        <el-descriptions :column="1" border size="medium" style="margin-bottom: 20px" title="枚举信息">
          <el-descriptions-item>
            <template slot="label">
              名称
            </template>
            {{ this.lastItem.id }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              标签
            </template>
            {{ this.lastItem.name }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              类型
            </template>
            {{ this.lastItem.enumValueDataType || 'String' }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              长度
            </template>
            <el-tag> {{ this.lastItem.length || 50 }}</el-tag>
          </el-descriptions-item>
        </el-descriptions>
        <p style="font-weight: bold">枚举项</p>
        <avue-crud
          :data="asideData"
          :option="asideOption"
        >
        </avue-crud>
      </basic-container>
    </el-aside>
  </el-container>
</template>
<script>
import basicOption from '@/util/basic-option'
import {getEnumTypeList, addEnumType, updateEnumType, deleteEnumTypes,getUsedEnumList,download,downloadEnumTemplate} from "@/api/modeling/enumType/api";
import {
  getEnumTypeList,
  addEnumType,
  updateEnumType,
  deleteEnumTypes,
  getUsedEnumList,
  download,
  downloadEnumTemplate
} from "@/api/modeling/enumType/api";
import func from "@/util/func";
import {deleteUser} from "@/api/system/user/api";
export default {
  name: "index",
  data() {
    return {
      tipList:["导入模板中标明红色字体的为必输项","*注意*:第二行开始的数据为示例数据,导入前请将其删除,当导入的枚举下具备多个枚举项时,应按照示例enum2的写法",
        "枚举项名称(当前枚举下有枚举项时必填)","枚举值(当前枚举下有枚举项时必填)"],
      asideOption: {
        ...basicOption,
        addBtn: false,
        editBtn: false,
        menu: false,
        refreshBtn: false,
        selection: false,
        index: false,
        column: [
          {
            label: '枚举项名称',
            prop: 'name',
            sortable: true,
          },
          {
            label: '枚举值',
            prop: 'value',
            sortable: true,
          },
          {
            label: '描述',
            prop: 'description',
          },
        ]
      },
      tipList: [
        "导入模板中标明红色字体的为必输项",
        "*注意*:第二行开始的数据为示例数据,导入前请将其删除,当导入的枚举下具备多个枚举项时,应按照示例enum2的写法",
        "枚举项名称(当前枚举下有枚举项时必填)",
        "枚举值(当前枚举下有枚举项时必填)",
        "导入一个枚举下的多个枚举项时,请将枚举名、标签、返回类型、等信息填写一致,再填写不同的枚举项"
      ],
      upFileType: ['xls', 'xlsx'],
      fileUrl: 'api/webEnumController/importEnumTypes',
      checkViewOption:{
@@ -239,6 +323,14 @@
      searchParams:{}
    }
  },
  computed: {
    lastItem() {
      return this.selectList.length > 0 ? this.selectList[this.selectList.length - 1] : {};
    },
    asideData() {
      return this.selectList.length > 0 ? this.selectList[this.selectList.length - 1].items : [];
    }
  },
  methods: {
    //表格查询请求
    getTableList() {
@@ -274,6 +366,7 @@
    // 选择框
    selectChange(row) {
      console.log(row)
      this.selectList = row;
    },
@@ -314,7 +407,6 @@
      this.dialogData = row.items;
      this.dialogVisible = true;
      this.editRow = row;
      console.log(row);
    },
    // 删除按钮点击
@@ -325,12 +417,23 @@
        ts: row.ts
      }
      let data = [params];
      this.$confirm('您确定要删除当前的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
      deleteEnumTypes(data).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
        }
      })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 多选删除
@@ -342,12 +445,25 @@
          ts: item.ts
        }
      })
      this.$confirm('您确定要删除所选择的数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
      deleteEnumTypes(data).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
        }
      })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 对话框枚举保存
@@ -499,7 +615,8 @@
      if(!params.source) {
        this.checkViewData = this.checkViewDataSearch;
        return done();
      };
      }
      ;
      this.checkViewData = this.checkViewData.filter(item => {
        return item.source && item.source.includes(source);