Преглед на файлове

同步前端表格导出数据

lph преди 1 година
родител
ревизия
4062e84f3b

+ 165 - 0
zkqy-ui/src/components/ExcelDownLoad/index.vue

@@ -0,0 +1,165 @@
+<template>
+  <div id="app">
+    <download-excel
+      class="export-excel-wrapper"
+      :data="json_data"
+      :fields="headerList"
+      type="xlsx"
+      :title="excelTitle"
+      :name="fileName"
+    >
+      <el-button
+        type="warning"
+        plain
+        icon="el-icon-download"
+        size="mini"
+        v-hasPermi="['system:process:export']"
+      >
+        导出已选
+      </el-button>
+    </download-excel>
+  </div>
+</template>
+<script>
+import moment from "moment";
+export default {
+  name: "ExcelDownLoad",
+  props: ["headerList", "fieldList", "excelTitle"],
+  data() {
+    return {
+      fileName: "",
+      json_data: [], //导出的数据
+      json_fields: {}, // 转化导出的字段名
+    };
+  },
+  watch: {
+    dataList: {
+      handler(val) {
+        let temp = JSON.parse(JSON.stringify(val));
+        this.json_data = this.dataHandler(temp);
+      },
+      immediate: true,
+      deep: true,
+    },
+  },
+  computed: {
+    dataList() {
+      return this.fieldList || [];
+    },
+  },
+  methods: {
+    dataHandler(list) {
+      console.log("list", list);
+      this.fileName = this.excelTitle + "_" + new Date().getTime() + ".xlsx";
+      switch (this.excelTitle) {
+        case "process":
+          list.forEach((item) => {
+            item.processType == "0"
+              ? (item.processType = "OA类型")
+              : (item.processType = "mes类型");
+            if (item.processDeployTime) {
+              let date = new Date(item.processDeployTime);
+              item.processDeployTime = moment(date).format("YYYY-MM-DD") || "";
+            }
+            // 版本状态
+            item.processVersion == 0
+              ? (item.processVersion = "最新版本")
+              : (item.processVersion = "历史版本");
+          });
+          break;
+        case "form":
+          list.forEach((item) => {
+            item.dfHtmlTemplate = item.dfHtmlTemplate.replace(/\n/g, "");
+            console.log(item.dfHtmlTemplate);
+          });
+          break;
+        case "tenant":
+          list.forEach((item) => {
+            item.isDel = item.isDel == 0 ? "未删除" : "已删除";
+          });
+          break;
+        case "user":
+          list.forEach((item) => {
+            item.sex = item.sex == 0 ? "男" : item.sex == 1 ? "女" : "未知";
+            item.status = item.status == 0 ? "正常" : "禁用";
+            item.loginDate = moment(new Date(item.loginDate)).format(
+              "YYYY-MM-DD HH:mm:ss"
+            );
+            item.deptName = item.dept?.deptName;
+            item.leader = item.dept?.leader;
+          });
+          break;
+        case "role":
+          list.forEach((item) => {
+            switch (item.dataScope) {
+              case "1":
+                item.dataScope = "所有数据权限";
+                break;
+              case "2":
+                item.dataScope = "自定义数据权限";
+                break;
+              case "3":
+                item.dataScope = "本部门数据权限";
+                break;
+              case "4":
+                item.dataScope = "本部门及以下数据权限";
+                break;
+              case "5":
+                item.dataScope = "仅本人数据权限";
+                break;
+              default:
+                break;
+            }
+            item.status = item.status == 0 ? "正常" : "停用";
+          });
+          break;
+        case "post":
+          list.forEach((item) => {
+            item.status = item.status == 0 ? "正常" : "停用";
+          });
+          break;
+        case "type":
+          list.forEach((item) => {
+            item.status = item.status == 0 ? "正常" : "停用";
+          });
+          break;
+        case "config":
+          list.forEach((item) => {
+            item.configType = item.configType == "Y" ? "是" : "否";
+          });
+          break;
+        case "style":
+          list.forEach((item) => {
+            item.styleStatus = item.styleStatus == "0" ? "正常" : "停用";
+          });
+          break;
+        case "job":
+          list.forEach((item) => {
+            switch (item.misfirePolicy) {
+              case "0":
+                item.misfirePolicy = "默认";
+                break;
+              case "1":
+                item.misfirePolicy = "立即触发执行";
+                break;
+              case "2":
+                item.misfirePolicy = "触发一次执行";
+                break;
+              case "3":
+                item.misfirePolicy = "不触发立即执行";
+                break;
+              default:
+                item.misfirePolicy = "未知";
+            }
+            item.concurrent = item.concurrent == 0 ? "允许" : "禁止";
+            item.status = item.status == 0 ? "正常" : "暂停";
+          });
+          break;
+        default:
+          break;
+      }
+      return list;
+    },
+  },
+};
+</script>

+ 35 - 21
zkqy-ui/src/views/bpmprocess/index.vue

@@ -24,7 +24,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item
+      <!-- <el-form-item
         label="流程开启状态"
         class="item_label"
         prop="processOpneState"
@@ -49,7 +49,7 @@
           placeholder="请选择流程部署时间"
         >
         </el-date-picker>
-      </el-form-item>
+      </el-form-item> -->
       <!-- <el-form-item label="版本状态" prop="processVersion">
 
         <el-select
@@ -111,12 +111,19 @@
         <el-button
           type="warning"
           plain
+          v-if="selection.length == 0"
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:process:export']"
-          >导出
+          >导出所有
         </el-button>
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -151,13 +158,13 @@
         </template>
       </el-table-column>
       <el-table-column label="流程别名" align="center" prop="processKey" />
-      <el-table-column label="流程状态" align="center" prop="processOpneState">
+      <!-- <el-table-column label="流程状态" align="center" prop="processOpneState">
         <template slot-scope="scope">
           <span>{{
             getDictLabel(scope.row.processOpneState, dict.type.bpm_state)
           }}</span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="流程类型" align="center" prop="processType">
         <template slot-scope="scope">
           <span>{{
@@ -165,7 +172,7 @@
           }}</span>
         </template>
       </el-table-column>
-      <el-table-column
+      <!-- <el-table-column
         label="流程部署时间"
         align="center"
         prop="processDeployTime"
@@ -176,7 +183,7 @@
             parseTime(scope.row.processDeployTime, "{y}-{m}-{d}")
           }}</span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column
         label="启动事件类型"
         align="center"
@@ -353,13 +360,31 @@ import {
   enableProcess,
 } from "@/api/bpmprocess/process";
 import Preview from "./components/preview.vue";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Process",
   dicts: ["bpm_state", "bpm_type", "bpm_start_event_type", "bpm_version"],
-  components: { Preview },
+  components: { Preview, ExcelDownLoad },
   data() {
     return {
+      // 前端导出数据
+      headerList: {
+        流程名称: "processName",
+        流程别名: "processKey",
+        流程开启状态: "processOpenState",
+        流程类型: "processType",
+        流程部署时间: "processDeployTime",
+        启动事件类型: "startEventType",
+        版本注释: "note",
+        版本状态: "processVersion",
+        xml流文件: "processXml",
+        节点ison串: "processJson",
+        xml标签内容: "processXmlContent",
+        xml文件存放地址: "processXmlPath",
+      },
+      // fieldList: [],
+      excelTitle: "process",
       // 预览的数据
       previewData: {},
       // 预览弹窗
@@ -432,20 +457,9 @@ export default {
       this.loading = true;
       let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listProcess(this.queryParams).then((response) => {
-        response.rows = response.rows.filter(
-          (item) =>
-            !tempSelection.find((val) => val.processId == item.processId)
-        );
-        this.processList = [...tempSelection, ...response.rows];
+        this.processList = response.rows;
         this.total = response.total;
         this.loading = false;
-        if (tempSelection.length) {
-          this.$nextTick(() => {
-            tempSelection.forEach((item) => {
-              this.$refs.tableRef.toggleRowSelection(item);
-            });
-          });
-        }
       });
     },
     // 取消按钮
@@ -655,7 +669,7 @@ export default {
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        process.env.VUE_APP_BASE_API1 + "system/process/export",
+        process.env.VUE_APP_BASE_API4 + "system/process/export",
         {
           ...this.queryParams,
         },

+ 27 - 5
zkqy-ui/src/views/dragform/index.vue

@@ -92,7 +92,7 @@
         >
       </el-form-item>
     </el-form>
-    <!--  v-hasPermi="['dragform:form:add']"
+    <!--  v-hasPermi="['dragform:form:add']" 
           v-hasPermi="['dragform:form:edit']"
           v-hasPermi="['dragform:form:remove']"
           v-hasPermi="['dragform:form:export']"
@@ -132,6 +132,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -139,6 +140,12 @@
           @click="handleExport"
           >导出
         </el-button>
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -280,7 +287,7 @@
             >修改
           </el-button> -->
           <!--  v-hasPermi="['dragform:form:edit']"
-
+            
 
           -->
           <!-- <el-button
@@ -361,12 +368,27 @@
 
 <script>
 import { delForm, addForm, updateForm, listForm } from "@/api/dragform/form";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 // import fromModel from '../system/fromModel/index.vue'
 export default {
   name: "Form",
-
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      headerList: {
+        sql编号: "sqlKey",
+        表单名称: "dfName",
+        表单别名: "dfNickName",
+        表单vue模板: "dfVueTemplate",
+        表单html模版: "dfHtmlTemplate",
+        表单sql: "dfFormSql",
+        节点ID: "dfNodeId",
+        数据源名称: "dfDatabase",
+      },
+      excelTitle: "form",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -475,7 +497,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.fId);
-      this, (selection = selection);
+      this.selection = selection;
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
@@ -532,7 +554,7 @@ export default {
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        process.env.VUE_APP_BASE_API1 + "dragform/form/export",
+        process.env.VUE_APP_BASE_API3 + "dragform/form/export",
         {
           ...this.queryParams,
         },

+ 32 - 6
zkqy-ui/src/views/dragform/tableList.vue

@@ -73,6 +73,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -80,6 +81,12 @@
           @click="handleExport"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -224,15 +231,32 @@
 </template>
 <script>
 import { listTable, removeTableList } from "@/api/dragform/tableList";
-import { delStatistic } from "@/api/tablelist/commonTable"
+import { delStatistic } from "@/api/tablelist/commonTable";
 import { delMenu } from "@/api/system/menu";
 import { mapGetters } from "vuex";
 import DictData from "@/components/DictData";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Table",
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      headerList: {
+        表格名称: "dtName",
+        表格类型: "dtType",
+        表格别名: "dtNickname",
+        table编号: "tableKey",
+        sql编号: "sqlKey",
+        绑定表名称: "dtTableName",
+        表格描述: "dtNotes",
+        列字段标题名称: "dtColumnName",
+        时间格式: "timeFormat",
+      },
+      excelTitle: "表格列表",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -259,6 +283,7 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        dtType: 0,
         pageNum: 1,
         pageSize: 10,
         dtName: null,
@@ -350,7 +375,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.tId);
-      this.tableKeys = selection.map((item) =>item.tableKey);
+      this.tableKeys = selection.map((item) => item.tableKey);
       this.Keys = selection.map((item) => item.sqlKey);
       this.menuIds = selection.map((item) => item.menuId);
       this.selection = selection;
@@ -364,7 +389,6 @@ export default {
     //   this.title = "添加动态格";
     // },
     handleAdd() {
-      console.log(this.addRoutes);
       this.$router.push({
         path: "/system/fromModel/index/tableMange",
       });
@@ -462,11 +486,13 @@ export default {
         })
         .then(() => {
           this.getList();
-          this.tempSelection = []
+          this.tempSelection = [];
           this.reloadRouter();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch((e) => {console.log(e);});
+        .catch((e) => {
+          console.log(e);
+        });
     },
     // 更新路由
     reloadRouter() {
@@ -477,7 +503,7 @@ export default {
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        process.env.VUE_APP_BASE_API1 + "system/table/export",
+        process.env.VUE_APP_BASE_API3 + "system/table/export",
         {
           ...this.queryParams,
         },

+ 23 - 1
zkqy-ui/src/views/monitor/job/index.vue

@@ -95,6 +95,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -103,6 +104,12 @@
           v-hasPermi="['monitor:job:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -455,13 +462,27 @@ import {
   changeJobStatus,
 } from "@/api/monitor/job";
 import Crontab from "@/components/Crontab";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
-  components: { Crontab },
+  components: { Crontab, ExcelDownLoad },
   name: "Job",
   dicts: ["sys_job_group", "sys_job_status"],
   data() {
     return {
+      // 前端导出数据
+      selection: [],
+      headerList: {
+        任务序号: "jobId",
+        任务名称: "jobName",
+        任务组名: "jobGroup",
+        调用目标字符串: "invokeTarget",
+        执行表达式: "cronExpression",
+        计划策略: "misfirePolicy",
+        并发执行: "concurrent",
+        任务状态: "status",
+      },
+      excelTitle: "job",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -566,6 +587,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      this.selection = selection;
       this.ids = selection.map((item) => item.jobId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;

+ 22 - 0
zkqy-ui/src/views/system/config/index.vue

@@ -102,6 +102,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -110,6 +111,12 @@
           v-hasPermi="['system:config:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -284,12 +291,26 @@ import {
   updateConfig,
   refreshCache,
 } from "@/api/system/config";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Config",
   dicts: ["sys_yes_no"],
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      selection: [],
+      headerList: {
+        参数主键: "configId",
+        参数名称: "configName",
+        参数键名: "configKey",
+        参数键值: "configValue",
+        系统内置: "configType",
+      },
+      excelTitle: "config",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -388,6 +409,7 @@ export default {
       this.ids = selection.map((item) => item.configId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
+      this.selection = selection;
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 21 - 0
zkqy-ui/src/views/system/dict/index.vue

@@ -104,6 +104,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -112,6 +113,12 @@
           v-hasPermi="['system:dict:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -285,12 +292,25 @@ import {
   updateType,
   refreshCache,
 } from "@/api/system/dict/type";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Dict",
   dicts: ["sys_normal_disable"],
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      selection: [],
+      headerList: {
+        字典主键: "dictId",
+        字典名称: "dictName",
+        字典类型: "dictType",
+        状态: "status",
+      },
+      excelTitle: "type",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -385,6 +405,7 @@ export default {
       this.ids = selection.map((item) => item.dictId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
+      this.selection = selection;
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 18 - 0
zkqy-ui/src/views/system/post/index.vue

@@ -90,6 +90,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -98,6 +99,12 @@
           v-hasPermi="['system:post:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -248,12 +255,23 @@ import {
   addPost,
   updatePost,
 } from "@/api/system/post";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Post",
   dicts: ["sys_normal_disable"],
+  components: { ExcelDownLoad },
   data() {
     return {
+      // 前端导出数据
+      headerList: {
+        岗位序号: "postId",
+        岗位编码: "postCode",
+        岗位名称: "postName",
+        岗位排序: "postSort",
+        状态: "status",
+      },
+      excelTitle: "post",
       // 遮罩层
       loading: true,
       // 选中数组

+ 37 - 16
zkqy-ui/src/views/system/role/index.vue

@@ -112,6 +112,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -120,6 +121,12 @@
           v-hasPermi="['system:role:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -423,12 +430,26 @@ import {
   treeselect as menuTreeselect,
   roleMenuTreeselect,
 } from "@/api/system/menu";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Role",
   dicts: ["sys_normal_disable"],
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      excelTitle: "role",
+      headerList: {
+        角色序号: "roleId",
+        角色名称: "roleName",
+        角色权限: "roleKey",
+        角色排序: "roleSort",
+        数据范围: "dataScope",
+        角色状态: "status",
+      },
       // 遮罩层
       loading: true,
       // 选中数组
@@ -608,22 +629,22 @@ export default {
       if (this.$refs.menu != undefined) {
         this.$refs.menu.setCheckedKeys([]);
       }
-      this.menuExpand = false;
-      this.menuNodeAll = false;
-      this.deptExpand = true;
-      this.deptNodeAll = false;
-      this.form = {
-        roleId: undefined,
-        roleName: undefined,
-        roleKey: undefined,
-        roleSort: 0,
-        status: "0",
-        menuIds: [],
-        deptIds: [],
-        menuCheckStrictly: true,
-        deptCheckStrictly: true,
-        remark: undefined,
-      };
+      (this.menuExpand = false),
+        (this.menuNodeAll = false),
+        (this.deptExpand = true),
+        (this.deptNodeAll = false),
+        (this.form = {
+          roleId: undefined,
+          roleName: undefined,
+          roleKey: undefined,
+          roleSort: 0,
+          status: "0",
+          menuIds: [],
+          deptIds: [],
+          menuCheckStrictly: true,
+          deptCheckStrictly: true,
+          remark: undefined,
+        });
       this.resetForm("form");
     },
     /** 搜索按钮操作 */

+ 106 - 47
zkqy-ui/src/views/system/tenant/index.vue

@@ -99,6 +99,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -107,6 +108,12 @@
           v-hasPermi="['system:tenant:export']"
           >导出
         </el-button>
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
         <!-- <el-button
           type="warning"
           plain
@@ -134,6 +141,11 @@
       <el-table-column label="负责人" align="center" prop="owner" />
       <el-table-column label="联系方式" align="center" prop="contactInfo" />
       <el-table-column label="地址" align="center" prop="address" />
+      <el-table-column
+        label="到期天数"
+        align="center"
+        prop="tenantExpirationTime"
+      />
       <el-table-column
         label="操作"
         align="center"
@@ -369,6 +381,7 @@ import {
 import { getDataSourceInfo, insertDataSource } from "@/api/system/data";
 import { servicesLoading } from "@/utils/zkqy";
 import { getIsExistUser } from "@/api/system/user";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "Tenant",
@@ -379,8 +392,22 @@ export default {
     "dm_connection_information",
     "orcale_connection_information",
   ],
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      selection: [],
+      headerList: {
+        租户名称: "tenantName",
+        租户编号: "tenantCode",
+        负责人: "owner",
+        联系方式: "contactInfo",
+        地址: "address",
+        是否删除: "isDel",
+      },
+      excelTitle: "tenant",
       // 弹窗的加载提示
       dialogLoading: false,
       // 遮罩层
@@ -482,6 +509,9 @@ export default {
           { required: true, message: "请输入租户激活码", trigger: "blur" },
         ],
       },
+      currentPage: "",
+      // 已存在的数据库名称
+      databaseNameList: [],
     };
   },
   computed: {
@@ -494,6 +524,15 @@ export default {
     this.selectAllUser();
   },
   methods: {
+    // 获取所用用户名,作校验用
+    async selectAllUser() {
+      let res = await selectAllUser();
+      if (res.code == 200) {
+        this.allUser = res.data;
+      } else {
+        console.log(res.msg);
+      }
+    },
     // 租户名自定义校验规则
     async tenantAccountValidator(rule, value, callback) {
       // let isRepeat = this.allUser.filter((item) => item.userName == value);
@@ -517,32 +556,38 @@ export default {
       }
       callback();
     },
-    // 获取所用用户名,作校验用
-    async selectAllUser() {
-      let res = await selectAllUser();
-      if (res.code == 200) {
-        this.allUser = res.data;
-      } else {
-        console.log(res.msg);
-      }
-    },
-    // 租户名自定义校验规则
-    tenantAccountValidator(rule, value, callback) {
-      let isRepeat = this.allUser.filter((item) => item.userName == value);
-      if (isRepeat.length !== 0) {
-        callback(new Error("租户账号重复"));
-      } else {
-        callback();
-      }
-    },
+    // 数据库名自定义校验规则--请求后端校验
+    // async databaseNameValidator(rule, value, callback) {
+    //   if (value) {
+    //     await getDataSourceInfo({ databaseName: value }).then((res) => {
+    //       if (res.code == 200) {
+    //         if (res.data) {
+    //           callback();
+    //         } else {
+    //           callback(new Error("数据库名已存在"));
+    //         }
+    //       } else {
+    //         callback(new Error("数据库名校验失败,请重新输入"));
+    //       }
+    //     });
+    //   }
+    // },
     // 数据库名称校验规则
     databaseNameValidator(rule, value, callback) {
+      // 正则校验
       let regex = /^[a-z][a-z0-9]*$/;
       if (regex.test(value)) {
-        callback(); // 输入内容符合规则
+        // callback(); // 输入内容符合规则
       } else {
         callback(new Error("只能包含小写字母和数字,且以小写字母开头"));
       }
+      // 重名校验
+      let isRepeat = this.databaseNameList.filter((item) => item == value);
+      if (isRepeat.length !== 0) {
+        callback(new Error("数据库名重复"));
+      } else {
+        callback();
+      }
     },
     // 数据源类型改变回调
     dataSourceTypeChange(type) {
@@ -555,7 +600,10 @@ export default {
     handleOpe() {},
     /** 查询租户信息列表 */
     getList() {
+      console.log("dddddd");
       this.loading = true;
+      this.currentPage = this.queryParams.pageNum;
+      //alert("ddddddddd")
       listTenant(this.queryParams).then((response) => {
         this.tenantList = response.rows;
         this.total = response.total;
@@ -613,6 +661,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      this.selection = selection;
       this.ids = selection.map((item) => item.tenantId);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
@@ -668,10 +717,13 @@ export default {
             });
           }
         }
+        this.reset();
       });
     },
     /** 提交按钮 */
     submitForm1() {
+      if (this.dialogLoading) return;
+      this.dialogLoading = true;
       this.$refs["dataSourceForm"].validate((valid) => {
         if (valid) {
           // const loading = servicesLoading(
@@ -679,47 +731,51 @@ export default {
           //   "正在绑定数据源",
           //   true
           // );
-          this.dialogLoading = true;
           if (this.dataSourceForm.id != null) {
             // bindDatasource(this.dataSourceForm).then((response) => {
             //   this.$modal.msgSuccess("修改成功");
             //   this.dataSourceOpen = false;
             //   this.getList();
             // });
+            this.dialogLoading = false;
           } else {
             let query = {
               tenantId: this.fromTenantId,
               dataSource: this.dataSourceForm,
             };
-            bindDatasource(query).then((response) => {
-              if (response.code == 200) {
-                let data = {
-                  userName: this.dataSourceForm.tenantAccount,
-                  nickName: this.currentTenantInfo.tenantName,
-                  userType: "01",
-                  tenantId: this.currentTenantInfo.tenantId,
-                  password: "123456",
-                };
-                createTenant(data)
-                  .then(async (res) => {
-                    if (res.code == 200) {
-                      let resp = await initTenantMenuData(
-                        this.currentTenantInfo.tenantId
-                      );
-                      if ((resp.code = 200)) {
-                        this.$modal.msgSuccess("新增成功");
-                        this.dataSourceOpen = false;
+            bindDatasource(query)
+              .then((response) => {
+                if (response.code == 200) {
+                  let data = {
+                    userName: this.dataSourceForm.tenantAccount,
+                    nickName: this.currentTenantInfo.tenantName,
+                    userType: "01",
+                    tenantId: this.currentTenantInfo.tenantId,
+                    password: "123456",
+                  };
+                  createTenant(data)
+                    .then(async (res) => {
+                      if (res.code == 200) {
+                        let resp = await initTenantMenuData(
+                          this.currentTenantInfo.tenantId
+                        );
+                        if ((resp.code = 200)) {
+                          this.$modal.msgSuccess("新增成功");
+                          this.dataSourceOpen = false;
 
-                        // loading.close();
-                        this.getList();
+                          // loading.close();
+                          this.getList();
+                        }
                       }
-                    }
-                  })
-                  .finally(() => {
-                    this.dialogLoading = fasle;
-                  });
-              }
-            });
+                    })
+                    .finally(() => {
+                      this.dialogLoading = false;
+                    });
+                }
+              })
+              .finally(() => {
+                this.dialogLoading = false;
+              });
           }
         }
       });
@@ -773,6 +829,7 @@ export default {
       }
       getDataSourceInfo(qar).then((res) => {
         // console.log(res);
+        this.databaseNameList = res.data;
       });
     },
     handleTest() {
@@ -813,6 +870,8 @@ export default {
           );
           if (response.code == 200) {
             this.$message.success("激活成功");
+            //重新刷新列表
+            this.getList();
           } else {
             this.$message.error("激活失败");
           }

+ 27 - 1
zkqy-ui/src/views/system/user/index.vue

@@ -153,6 +153,7 @@
           </el-col>
           <el-col :span="1.5">
             <el-button
+              v-if="selection.length == 0"
               type="warning"
               plain
               icon="el-icon-download"
@@ -161,6 +162,12 @@
               v-hasPermi="['system:user:export']"
               >导出</el-button
             >
+            <ExcelDownLoad
+              v-else
+              :headerList="headerList"
+              :fieldList="selection"
+              :excelTitle="excelTitle"
+            ></ExcelDownLoad>
           </el-col>
           <right-toolbar
             :showSearch.sync="showSearch"
@@ -568,13 +575,30 @@ import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { mapGetters } from "vuex";
 import { getIsExistUser } from "@/api/system/user";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "User",
   dicts: ["sys_normal_disable", "sys_user_sex"],
-  components: { Treeselect },
+  components: { Treeselect, ExcelDownLoad },
   data() {
     return {
+      // 前端导出数据
+      headerList: {
+        用户序号: "userId",
+        部门编号: "deptId",
+        登录名称: "userName",
+        用户名称: "nickName",
+        用户邮箱: "email",
+        手机号码: "phonenumber",
+        用户性别: "sex",
+        帐号状态: "status",
+        最后登录IP: "loginIp",
+        最后登录时间: "loginDate",
+        部门名称: "deptName",
+        部门负责人: "leader",
+      },
+      excelTitle: "user",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -609,6 +633,7 @@ export default {
       roleOptions: [],
       // 表单参数
       form: {},
+      oldNickname: "", //旧昵称
       defaultProps: {
         children: "children",
         label: "label",
@@ -871,6 +896,7 @@ export default {
       const userId = row.userId || this.ids;
       getUser(userId).then((response) => {
         this.form = response.data;
+        this.oldNickname = response.data.nickname; //记录旧的昵称
         this.postOptions = response.posts;
         this.roleOptions = response.roles;
         this.$set(this.form, "postIds", response.postIds);

+ 25 - 0
zkqy-ui/src/views/tableMange/styleMange/index.vue

@@ -100,6 +100,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="selection.length == 0"
           type="warning"
           plain
           icon="el-icon-download"
@@ -108,6 +109,12 @@
           v-hasPermi="['system:style:export']"
           >导出</el-button
         >
+        <ExcelDownLoad
+          v-else
+          :headerList="headerList"
+          :fieldList="selection"
+          :excelTitle="excelTitle"
+        ></ExcelDownLoad>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -247,12 +254,29 @@ import {
 } from "@/api/system/style";
 import { getDictLabel } from "@/utils/other";
 import * as monaco from "monaco-editor";
+import ExcelDownLoad from "@/components/ExcelDownLoad/index.vue";
 
 export default {
   name: "StyleMange",
   dicts: ["table_style_type"],
+  components: {
+    ExcelDownLoad,
+  },
   data() {
     return {
+      // 前端导出数据
+      selection: [],
+      headerList: {
+        样式key: "styleKey",
+        样式名称: "styleName",
+        样式类型: "styleType",
+        样式代码: "styleCode",
+        样式描述: "styleDescription",
+        样式状态: "styleStatus",
+        创建者ID: "createById",
+        更新者ID: "updateById",
+      },
+      excelTitle: "style",
       // 遮罩层
       loading: true,
       // 选中数组
@@ -356,6 +380,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      this.selection = selection;
       this.ids = selection.map((item) => item.id);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;