|
@@ -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("激活失败");
|
|
|
}
|