This commit is contained in:
朱文强 2023-11-10 11:14:13 +08:00
parent 51635013b1
commit 67a21b43e6
16 changed files with 972 additions and 658 deletions

View File

@ -66,7 +66,7 @@ export default {
label: '订单出货日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -94,7 +94,7 @@ export default {
label: '订单出货日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -191,7 +191,7 @@ export default {
label: '选择日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -200,7 +200,7 @@ export default {
label: '选择日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -66,7 +66,7 @@ export default {
label: '订单出货日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -32,7 +32,9 @@
<el-table-column prop="process" label="工序" width="110">
<template slot-scope="scope">
<span>
{{ scope.row.process>=0 ? processArr[scope.row.process].name : '' }}
{{
scope.row.process >= 0 ? processArr[scope.row.process].name : ''
}}
</span>
</template>
</el-table-column>
@ -41,11 +43,14 @@
<span>{{ scope.row.cacheLocation === 0 ? '否' : '是' }}</span>
</template>
</el-table-column>
<el-table-column prop="warehouseStorehouseState" label="库位状态" width="100">
<el-table-column
prop="warehouseStorehouseState"
label="库位状态"
width="100">
<template slot-scope="scope">
<span>
{{
scope.row.warehouseStorehouseState>=0
scope.row.warehouseStorehouseState >= 0
? warehouseStorehouseState[scope.row.warehouseStorehouseState]
.name
: ''
@ -55,16 +60,29 @@
</el-table-column>
<el-table-column label="操作" width="70">
<template v-slot="scope">
<el-button
size="mini"
type="text"
:disabled="scope.row.warehouseStorehouseState===1"
@click="handleClick({ data: {id:scope.row}, type: 'edit' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
<span class="iconfont icon-edit primary-color"></span>
</el-button>
<span v-if="scope.row.deactivate === 1">
<el-button
size="mini"
type="text"
:disabled="scope.row.warehouseStorehouseState === 1"
@click="handleClick({ data: { id: scope.row }, type: 'edit' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
<span class="iconfont icon-edit primary-color"></span>
</el-button>
</span>
<span v-else>
<el-button
size="mini"
type="text"
@click="handleClick({ data: { id: scope.row }, type: 'restore' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
启用库位
</el-button>
</span>
</template>
</el-table-column>
</el-table>
@ -85,7 +103,10 @@ import AddOrUpdate from './add-or-updata';
import product from '../product-mini';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import { getWarehouseStorehousePage, } from "@/api/asrs/warehouseStorehouse";
import {
getWarehouseStorehousePage,
updateWarehouseStorehouse,
} from '@/api/asrs/warehouseStorehouse';
const processArr = [
{
@ -208,7 +229,8 @@ export default {
this.listQuery.goodName = val.pname;
this.listQuery.goodCode = val.pcode;
this.listQuery.process = val.processId;
this.listQuery.warehouseStorehouseState = val.warehouseStorehouseStateId;
this.listQuery.warehouseStorehouseState =
val.warehouseStorehouseStateId;
this.getDataList();
break;
case 'reset':
@ -232,6 +254,21 @@ export default {
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'restore') {
const dataForm = {
id: val.data.id.id,
deactivate: 1,
trayCode: val.data.id.trayCode ? val.data.id.trayCode : '',
};
updateWarehouseStorehouse(dataForm).then((response) => {
this.$modal.msgSuccess('启用成功');
this.getDataList();
});
} else {
console.log(11);
}
},
},
};
</script>

View File

@ -53,17 +53,31 @@
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="70">
<el-table-column label="操作" width="80">
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="handleClick({ data: {id:scope.row}, type: 'edit' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
<span class="iconfont icon-edit primary-color"></span>
</el-button>
<span v-if="scope.row.deactivate === 1">
<el-button
size="mini"
type="text"
:disabled="scope.row.warehouseStorehouseState === 1"
@click="handleClick({ data: { id: scope.row }, type: 'edit' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
<span class="iconfont icon-edit primary-color"></span>
</el-button>
</span>
<span v-else>
<el-button
size="mini"
type="text"
@click="handleClick({ data: { id: scope.row }, type: 'restore' })"
v-hasPermi="[
'asrs:warehouse-storehouse-goods-specification:update',
]">
启用库位
</el-button>
</span>
</template>
</el-table-column>
</el-table>
@ -84,7 +98,10 @@ import AddOrUpdate from './add-or-updata';
import product from '../product-mini';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import { getWarehouseStorehousePage, } from "@/api/asrs/warehouseStorehouse";
import {
getWarehouseStorehousePage,
updateWarehouseStorehouse,
} from '@/api/asrs/warehouseStorehouse';
const processArr = [
{
@ -234,6 +251,21 @@ export default {
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'restore') {
const dataForm = {
id: val.data.id.id,
deactivate: 1,
trayCode: val.data.id.trayCode ? val.data.id.trayCode : '',
};
updateWarehouseStorehouse(dataForm).then((response) => {
this.$modal.msgSuccess('启用成功');
this.getDataList();
});
} else {
console.log(11);
}
},
},
};
</script>

View File

@ -138,7 +138,7 @@ export default {
},
{
type: 'select',
label: '状态',
label: '出入库状态',
selectOptions: warehouseStorehouseStorageState,
param: 'state',
defaultSelect: '',
@ -149,7 +149,7 @@ export default {
label: '出入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -138,7 +138,7 @@ export default {
},
{
type: 'select',
label: '状态',
label: '出入库状态',
selectOptions: warehouseStorehouseStorageState,
param: 'state',
defaultSelect: '',
@ -149,11 +149,11 @@ export default {
label: '出入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime2',
param: 'searchTime',
},
{
type: 'button',

View File

@ -110,7 +110,7 @@ export default {
label: '出入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -1,81 +1,138 @@
<template xmlns="">
<div class="container">
<div class="logo"></div>
<!-- 登录区域 -->
<div class="content">
<!-- 配图 -->
<div class="pic"></div>
<!-- 表单 -->
<div class="field">
<!-- [移动端]标题 -->
<h2 class="mobile-title">
<h3 class="title">芋道后台管理系统</h3>
</h2>
<div class="container">
<div class="logo"></div>
<!-- 登录区域 -->
<div class="content">
<!-- 配图 -->
<div class="pic"></div>
<!-- 表单 -->
<div class="field">
<!-- [移动端]标题 -->
<h2 class="mobile-title">
<h3 class="title">芋道后台管理系统</h3>
</h2>
<!-- 表单 -->
<div class="form-cont">
<el-tabs class="form" v-model="loginForm.loginType" style=" float:none;">
<el-tab-pane label="账号密码登录" name="uname">
</el-tab-pane>
<!-- <el-tab-pane label="短信验证码登录" name="sms">
<!-- 表单 -->
<div class="form-cont">
<el-tabs
class="form"
v-model="loginForm.loginType"
style="float: none">
<el-tab-pane label="账号密码登录" name="uname"></el-tab-pane>
<!-- <el-tab-pane label="短信验证码登录" name="sms">
</el-tab-pane> -->
</el-tabs>
<div>
<el-form ref="loginForm" :model="loginForm" :rules="LoginRules" class="login-form">
<el-form-item prop="tenantName" v-if="tenantEnable">
<el-input v-model="loginForm.tenantName" type="text" auto-complete="off" placeholder='租户'>
<svg-icon slot="prefix" icon-class="tree" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<!-- 账号密码登录 -->
<div v-if="loginForm.loginType === 'uname'">
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="getCode">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">记住密码</el-checkbox>
</div>
</el-tabs>
<div>
<el-form
ref="loginForm"
:model="loginForm"
:rules="LoginRules"
class="login-form">
<el-form-item prop="tenantName" v-if="tenantEnable">
<el-input
v-model="loginForm.tenantName"
type="text"
auto-complete="off"
placeholder="租户">
<svg-icon
slot="prefix"
icon-class="tree"
class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<!-- 账号密码登录 -->
<div v-if="loginForm.loginType === 'uname'">
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号">
<svg-icon
slot="prefix"
icon-class="user"
class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="getCode">
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-checkbox
v-model="loginForm.rememberMe"
style="margin: 0 0 25px 0">
记住密码
</el-checkbox>
</div>
<!-- 短信验证码登录 -->
<div v-if="loginForm.loginType === 'sms'">
<el-form-item prop="mobile">
<el-input v-model="loginForm.mobile" type="text" auto-complete="off" placeholder="请输入手机号">
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="mobileCode">
<el-input v-model="loginForm.mobileCode" type="text" auto-complete="off" placeholder="短信验证码"
class="sms-login-mobile-code-prefix" @keyup.enter.native="handleLogin">
<template>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</template>
<template slot="append">
<span v-if="mobileCodeTimer <= 0" class="getMobileCode" @click="getSmsCode"
style="cursor: pointer;">获取验证码</span>
<span v-if="mobileCodeTimer > 0" class="getMobileCode">{{ mobileCodeTimer }}秒后可重新获取</span>
</template>
</el-input>
</el-form-item>
</div>
<!-- 短信验证码登录 -->
<div v-if="loginForm.loginType === 'sms'">
<el-form-item prop="mobile">
<el-input
v-model="loginForm.mobile"
type="text"
auto-complete="off"
placeholder="请输入手机号">
<svg-icon
slot="prefix"
icon-class="phone"
class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="mobileCode">
<el-input
v-model="loginForm.mobileCode"
type="text"
auto-complete="off"
placeholder="短信验证码"
class="sms-login-mobile-code-prefix"
@keyup.enter.native="handleLogin">
<template>
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon" />
</template>
<template slot="append">
<span
v-if="mobileCodeTimer <= 0"
class="getMobileCode"
@click="getSmsCode"
style="cursor: pointer">
获取验证码
</span>
<span v-if="mobileCodeTimer > 0" class="getMobileCode">
{{ mobileCodeTimer }}秒后可重新获取
</span>
</template>
</el-input>
</el-form-item>
</div>
<!-- 下方的登录按钮 -->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="getCode">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
<!-- 下方的登录按钮 -->
<el-form-item style="width: 100%">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width: 100%"
@click.native.prevent="getCode">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
<!-- 社交登录 -->
<!-- <el-form-item style="width:100%;">
<!-- 社交登录 -->
<!-- <el-form-item style="width:100%;">
<div class="oauth-login" style="display:flex">
<div class="oauth-login-item" v-for="item in SysUserSocialTypeEnum" :key="item.type" @click="doSocialLogin(item)">
<img :src="item.img" height="25px" width="25px" alt="登录" >
@ -83,267 +140,308 @@
</div>
</div>
</el-form-item> -->
</el-form>
</div>
</div>
</div>
</div>
</el-form>
</div>
</div>
</div>
</div>
<!-- 图形验证码 -->
<Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{ width: '400px', height: '200px' }"
@success="handleLogin" />
<!-- 图形验证码 -->
<Verify
ref="verify"
:captcha-type="'blockPuzzle'"
:img-size="{ width: '400px', height: '200px' }"
@success="handleLogin" />
<!-- footer -->
<div class="footer">
Copyright © 2023 中建材智能自动化院 All Rights Reserved.
</div>
</div>
<!-- footer -->
<div class="footer">
Copyright © 2023 中建材智能自动化院 All Rights Reserved.
</div>
</div>
</template>
<script>
import { sendSmsCode, socialAuthRedirect } from "@/api/login";
import { getTenantIdByName } from "@/api/system/tenant";
import { SystemUserSocialTypeEnum } from "@/utils/constants";
import { getCaptchaEnable, getTenantEnable } from "@/utils/ruoyi";
import { sendSmsCode, socialAuthRedirect } from '@/api/login';
import { getTenantIdByName } from '@/api/system/tenant';
import { SystemUserSocialTypeEnum } from '@/utils/constants';
import { getCaptchaEnable, getTenantEnable } from '@/utils/ruoyi';
import {
getPassword,
getRememberMe, getTenantName,
getUsername,
removePassword, removeRememberMe, removeTenantName,
removeUsername,
setPassword, setRememberMe, setTenantId, setTenantName,
setUsername
} from "@/utils/auth";
getPassword,
getRememberMe,
getTenantName,
getUsername,
removePassword,
removeRememberMe,
removeTenantName,
removeUsername,
setPassword,
setRememberMe,
setTenantId,
setTenantName,
setUsername,
} from '@/utils/auth';
import Verify from '@/components/Verifition/Verify';
import { resetUserPwd } from "@/api/system/user";
import { resetUserPwd } from '@/api/system/user';
export default {
name: "Login",
components: {
Verify
},
data() {
return {
codeUrl: "",
captchaEnable: true,
tenantEnable: true,
mobileCodeTimer: 0,
loginForm: {
loginType: "uname",
username: "admin",
password: "admin123",
captchaVerification: "",
mobile: "",
mobileCode: "",
rememberMe: false,
tenantName: "芋道源码",
},
scene: 21,
name: 'Login',
components: {
Verify,
},
data() {
return {
codeUrl: '',
captchaEnable: true,
tenantEnable: true,
mobileCodeTimer: 0,
loginForm: {
loginType: 'uname',
username: 'admin',
password: 'admin123',
captchaVerification: '',
mobile: '',
mobileCode: '',
rememberMe: false,
tenantName: '芋道源码',
},
scene: 21,
LoginRules: {
username: [
{ required: true, trigger: "blur", message: "用户名不能为空" }
],
password: [
{ required: true, trigger: "blur", message: "密码不能为空" }
],
mobile: [
{ required: true, trigger: "blur", message: "手机号不能为空" },
{
validator: function (rule, value, callback) {
if (/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/.test(value) === false) {
callback(new Error("手机号格式错误"));
} else {
callback();
}
}, trigger: "blur"
}
],
tenantName: [
{ required: true, trigger: "blur", message: "租户不能为空" },
{
validator: (rule, value, callback) => {
// debugger
getTenantIdByName(value).then(res => {
const tenantId = res.data;
if (tenantId && tenantId >= 0) {
//
setTenantId(tenantId)
callback();
} else {
callback('租户不存在');
}
});
},
trigger: 'blur'
}
]
},
loading: false,
redirect: undefined,
//
SysUserSocialTypeEnum: SystemUserSocialTypeEnum,
};
},
created() {
//
this.tenantEnable = getTenantEnable();
if (this.tenantEnable) {
getTenantIdByName(this.loginForm.tenantName).then(res => { //
const tenantId = res.data;
if (tenantId && tenantId >= 0) {
setTenantId(tenantId)
}
});
}
//
this.captchaEnable = getCaptchaEnable();
//
this.redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : undefined;
this.getCookie();
},
methods: {
getCode() {
this.captchaEnable = false
//
if (!this.captchaEnable) {
this.handleLogin({})
return;
}
LoginRules: {
username: [
{ required: true, trigger: 'blur', message: '用户名不能为空' },
],
password: [
{ required: true, trigger: 'blur', message: '密码不能为空' },
],
mobile: [
{ required: true, trigger: 'blur', message: '手机号不能为空' },
{
validator: function (rule, value, callback) {
if (
/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/.test(
value
) === false
) {
callback(new Error('手机号格式错误'));
} else {
callback();
}
},
trigger: 'blur',
},
],
tenantName: [
{ required: true, trigger: 'blur', message: '租户不能为空' },
{
validator: (rule, value, callback) => {
// debugger
getTenantIdByName(value).then((res) => {
const tenantId = res.data;
if (tenantId && tenantId >= 0) {
//
setTenantId(tenantId);
callback();
} else {
callback('租户不存在');
}
});
},
trigger: 'blur',
},
],
},
loading: false,
redirect: undefined,
//
SysUserSocialTypeEnum: SystemUserSocialTypeEnum,
};
},
created() {
//
this.tenantEnable = getTenantEnable();
if (this.tenantEnable) {
getTenantIdByName(this.loginForm.tenantName).then((res) => {
//
const tenantId = res.data;
if (tenantId && tenantId >= 0) {
setTenantId(tenantId);
}
});
}
//
this.captchaEnable = getCaptchaEnable();
//
this.redirect = this.$route.query.redirect
? decodeURIComponent(this.$route.query.redirect)
: undefined;
this.getCookie();
},
methods: {
getCode() {
this.captchaEnable = false;
//
if (!this.captchaEnable) {
this.handleLogin({});
return;
}
//
//
this.$refs.verify.show()
},
getCookie() {
const username = getUsername();
const password = getPassword();
const rememberMe = getRememberMe();
const tenantName = getTenantName();
this.loginForm = {
...this.loginForm,
username: username ? username : this.loginForm.username,
password: password ? password : this.loginForm.password,
rememberMe: rememberMe ? getRememberMe() : false,
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
};
},
handleLogin(captchaParams) {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
// Cookie
if (this.loginForm.rememberMe) {
setUsername(this.loginForm.username)
setPassword(this.loginForm.password)
setRememberMe(this.loginForm.rememberMe)
setTenantName(this.loginForm.tenantName)
} else {
removeUsername()
removePassword()
removeRememberMe()
removeTenantName()
}
this.loginForm.captchaVerification = captchaParams.captchaVerification
//
// console.log("", this.loginForm);
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
console.log(this.redirect)
this.$router.push({ path: "/" }).catch(() => {
});
}).catch(() => {
this.loading = false;
});
}
});
},
async doSocialLogin(socialTypeEnum) {
//
this.loading = true;
let tenant = false;
if (this.tenantEnable) {
await this.$prompt('请输入租户名称', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(async ({ value }) => {
await getTenantIdByName(value).then(res => {
const tenantId = res.data;
tenant = true
if (tenantId && tenantId >= 0) {
setTenantId(tenantId)
}
});
}).catch(() => {
// loading
this.loading = false;
//
//
this.$refs.verify.show();
},
getCookie() {
const username = getUsername();
const password = getPassword();
const rememberMe = getRememberMe();
const tenantName = getTenantName();
this.loginForm = {
...this.loginForm,
username: username ? username : this.loginForm.username,
password: password ? password : this.loginForm.password,
rememberMe: rememberMe ? getRememberMe() : false,
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
};
},
handleLogin(captchaParams) {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
// Cookie
if (this.loginForm.rememberMe) {
setUsername(this.loginForm.username);
setPassword(this.loginForm.password);
setRememberMe(this.loginForm.rememberMe);
setTenantName(this.loginForm.tenantName);
} else {
removeUsername();
removePassword();
removeRememberMe();
removeTenantName();
}
this.loginForm.captchaVerification =
captchaParams.captchaVerification;
//
// console.log("", this.loginForm);
this.$store
.dispatch(
this.loginForm.loginType === 'sms' ? 'SmsLogin' : 'Login',
this.loginForm
)
.then(() => {
console.log(this.redirect);
this.$store.dispatch('tagsView/delAllVisitedViews');
this.$router.push({ path: '/' }).catch(() => {});
})
.catch(() => {
this.loading = false;
});
}
});
},
async doSocialLogin(socialTypeEnum) {
//
this.loading = true;
let tenant = false;
if (this.tenantEnable) {
await this.$prompt('请输入租户名称', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
})
.then(async ({ value }) => {
await getTenantIdByName(value).then((res) => {
const tenantId = res.data;
tenant = true;
if (tenantId && tenantId >= 0) {
setTenantId(tenantId);
}
});
})
.catch(() => {
// loading
this.loading = false;
return false
});
} else {
tenant = true
}
if (tenant) {
// redirectUri
const redirectUri = location.origin + '/social-login?'
+ encodeURIComponent('type=' + socialTypeEnum.type + '&redirect=' + (this.redirect || "/")); //
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
// const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
//
socialAuthRedirect(socialTypeEnum.type, encodeURIComponent(redirectUri)).then((res) => {
// console.log(res.url);
window.location.href = res.data;
});
}
},
/** ========== 以下为升级短信登录 ========== */
getSmsCode() {
if (this.mobileCodeTimer > 0) return;
this.$refs.loginForm.validate(valid => {
if (!valid) return;
sendSmsCode(this.loginForm.mobile, this.scene, this.loginForm.uuid, this.loginForm.code).then(res => {
this.$modal.msgSuccess("获取验证码成功")
this.mobileCodeTimer = 60;
let msgTimer = setInterval(() => {
this.mobileCodeTimer = this.mobileCodeTimer - 1;
if (this.mobileCodeTimer <= 0) {
clearInterval(msgTimer);
}
}, 1000);
});
});
}
}
return false;
});
} else {
tenant = true;
}
if (tenant) {
// redirectUri
const redirectUri =
location.origin +
'/social-login?' +
encodeURIComponent(
'type=' +
socialTypeEnum.type +
'&redirect=' +
(this.redirect || '/')
); //
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
// const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
//
socialAuthRedirect(
socialTypeEnum.type,
encodeURIComponent(redirectUri)
).then((res) => {
// console.log(res.url);
window.location.href = res.data;
});
}
},
/** ========== 以下为升级短信登录 ========== */
getSmsCode() {
if (this.mobileCodeTimer > 0) return;
this.$refs.loginForm.validate((valid) => {
if (!valid) return;
sendSmsCode(
this.loginForm.mobile,
this.scene,
this.loginForm.uuid,
this.loginForm.code
).then((res) => {
this.$modal.msgSuccess('获取验证码成功');
this.mobileCodeTimer = 60;
let msgTimer = setInterval(() => {
this.mobileCodeTimer = this.mobileCodeTimer - 1;
if (this.mobileCodeTimer <= 0) {
clearInterval(msgTimer);
}
}, 1000);
});
});
},
},
};
</script>
<style lang="scss" scoped>
@import "~@/assets/styles/login.scss";
@import '~@/assets/styles/login.scss';
.oauth-login {
display: flex;
align-items: center;
cursor: pointer;
display: flex;
align-items: center;
cursor: pointer;
}
.oauth-login-item {
display: flex;
align-items: center;
margin-right: 10px;
display: flex;
align-items: center;
margin-right: 10px;
}
.oauth-login-item img {
height: 25px;
width: 25px;
height: 25px;
width: 25px;
}
.oauth-login-item span:hover {
text-decoration: underline red;
color: red;
text-decoration: underline red;
color: red;
}
.sms-login-mobile-code-prefix {
:deep(.el-input__prefix) {
top: 22%;
}
}</style>
:deep(.el-input__prefix) {
top: 22%;
}
}
</style>

View File

@ -92,7 +92,7 @@ export default {
label: '订单出货日期',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',

View File

@ -47,7 +47,7 @@
<dict-tag :type="DICT_TYPE.SYSTEM_ROLE_TYPE" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="显示顺序" prop="sort" width="100" />
<el-table-column label="显示顺序" prop="sort" sortable width="100" />
<el-table-column label="状态" align="center" width="100">
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)"/>
@ -58,6 +58,7 @@
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
@ -482,7 +483,7 @@ export default {
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal.confirm('是否确认导出所有角色数据项?').then(function() {
this.$modal.confirm('是否确认导出所有角色数据项?').then(()=> {
this.exportLoading = true;
return exportRole(queryParams);
}).then(response => {

View File

@ -1,314 +1,460 @@
<template>
<div class="app-container">
<doc-alert title="SaaS 多租户" url="https://doc.iocoder.cn/saas-tenant/" />
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="租户名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入租户名" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="租户状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择租户状态" clearable>
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="app-container">
<doc-alert title="SaaS 多租户" url="https://doc.iocoder.cn/saas-tenant/" />
<!-- 搜索工作栏 -->
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px">
<el-form-item label="租户名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入租户名"
clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input
v-model="queryParams.contactName"
placeholder="请输入联系人"
clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input
v-model="queryParams.contactMobile"
placeholder="请输入联系手机"
clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="租户状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择租户状态"
clearable>
<el-option
v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">
搜索
</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:tenant:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:tenant:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:tenant:create']">
新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['system:tenant:export']">
导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="租户编号" align="center" prop="id" />
<el-table-column label="租户名" align="center" prop="name" />
<el-table-column label="租户套餐" align="center" prop="packageId">
<template v-slot="scope">
<el-tag v-if="scope.row.packageId === 0" type="danger">系统租户</el-tag>
<el-tag v-else> {{getPackageName(scope.row.packageId)}} </el-tag>
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactName" />
<el-table-column label="联系手机" align="center" prop="contactMobile" />
<el-table-column label="账号额度" align="center" prop="accountCount">
<template v-slot="scope">
<el-tag> {{scope.row.accountCount}} </el-tag>
</template>
</el-table-column>
<el-table-column label="过期时间" align="center" prop="expireTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.expireTime) }}</span>
</template>
</el-table-column>
<el-table-column label="绑定域名" align="center" prop="domain" width="180" />
<el-table-column label="租户状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:tenant:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="租户编号" align="center" prop="id" />
<el-table-column label="租户名" align="center" prop="name" />
<el-table-column label="租户套餐" align="center" prop="packageId">
<template v-slot="scope">
<el-tag v-if="scope.row.packageId === 0" type="danger">
系统租户
</el-tag>
<el-tag v-else>{{ getPackageName(scope.row.packageId) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactName" />
<el-table-column label="联系手机" align="center" prop="contactMobile" />
<el-table-column label="账号额度" align="center" prop="accountCount">
<template v-slot="scope">
<el-tag>{{ scope.row.accountCount }}</el-tag>
</template>
</el-table-column>
<el-table-column
label="过期时间"
align="center"
prop="expireTime"
width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.expireTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="绑定域名"
align="center"
prop="domain"
width="180" />
<el-table-column label="租户状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:tenant:update']">
修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="租户名" prop="name">
<el-input v-model="form.name" placeholder="请输入租户名" />
</el-form-item>
<el-form-item label="租户套餐" prop="packageId">
<el-select v-model="form.packageId" placeholder="请选择租户套餐" clearable size="small">
<el-option v-for="item in packageList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="form.contactName" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input v-model="form.contactMobile" placeholder="请输入联系手机" />
</el-form-item>
<el-form-item v-if="form.id === undefined" label="用户名称" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item v-if="form.id === undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password />
</el-form-item>
<el-form-item label="账号额度" prop="accountCount">
<el-input-number v-model="form.accountCount" placeholder="请输入账号额度" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="过期时间" prop="expireTime">
<el-date-picker clearable size="small" v-model="form.expireTime" type="date"
value-format="timestamp" placeholder="请选择过期时间" />
</el-form-item>
<el-form-item label="绑定域名" prop="domain">
<el-input v-model="form.domain" placeholder="请输入绑定域名" />
</el-form-item>
<el-form-item label="租户状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="租户名" prop="name">
<el-input v-model="form.name" placeholder="请输入租户名" />
</el-form-item>
<el-form-item label="租户套餐" prop="packageId">
<el-select
v-model="form.packageId"
placeholder="请选择租户套餐"
clearable
size="small">
<el-option
v-for="item in packageList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contactName">
<el-input v-model="form.contactName" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系手机" prop="contactMobile">
<el-input v-model="form.contactMobile" placeholder="请输入联系手机" />
</el-form-item>
<el-form-item
v-if="form.id === undefined"
label="用户名称"
prop="username">
<el-input v-model="form.username" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item
v-if="form.id === undefined"
label="用户密码"
prop="password">
<el-input
v-model="form.password"
placeholder="请输入用户密码"
type="password"
show-password />
</el-form-item>
<el-form-item label="账号额度" prop="accountCount">
<el-input-number
v-model="form.accountCount"
placeholder="请输入账号额度"
controls-position="right"
:min="0" />
</el-form-item>
<el-form-item label="过期时间" prop="expireTime">
<el-date-picker
clearable
size="small"
v-model="form.expireTime"
type="date"
value-format="timestamp"
placeholder="请选择过期时间" />
</el-form-item>
<el-form-item label="绑定域名" prop="domain">
<el-input v-model="form.domain" placeholder="请输入绑定域名" />
</el-form-item>
<el-form-item label="租户状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value"
:label="parseInt(dict.value)">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createTenant, updateTenant, deleteTenant, getTenant, getTenantPage, exportTenantExcel } from "@/api/system/tenant";
import { CommonStatusEnum } from '@/utils/constants'
import {getTenantPackageList} from "@/api/system/tenantPackage";
import {
createTenant,
updateTenant,
deleteTenant,
getTenant,
getTenantPage,
exportTenantExcel,
} from '@/api/system/tenant';
import { CommonStatusEnum } from '@/utils/constants';
import { getTenantPackageList } from '@/api/system/tenantPackage';
export default {
name: "SystemTenant",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
packageList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
contactName: null,
contactMobile: null,
status: undefined,
createTime: []
},
//
form: {},
//
rules: {
name: [{ required: true, message: "租户名不能为空", trigger: "blur" }],
packageId: [{ required: true, message: "租户套餐不能为空", trigger: "blur" }],
contactName: [{ required: true, message: "联系人不能为空", trigger: "blur" }],
status: [{ required: true, message: "租户状态不能为空", trigger: "blur" }],
accountCount: [{ required: true, message: "账号额度不能为空", trigger: "blur" }],
expireTime: [{ required: true, message: "过期时间不能为空", trigger: "blur" }],
domain: [{ required: true, message: "绑定域名不能为空", trigger: "blur" }],
username: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
//
getTenantPackageList().then(response => {
this.packageList = response.data;
})
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getTenantPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
name: undefined,
packageId: undefined,
contactName: undefined,
contactMobile: undefined,
accountCount: undefined,
expireTime: undefined,
domain: undefined,
status: CommonStatusEnum.ENABLE,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加租户";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getTenant(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改租户";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateTenant(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createTenant(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除租户编号为"' + id + '"的数据项?').then(function() {
return deleteTenant(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
//
this.$modal.confirm('是否确认导出所有租户数据项?').then(() => {
this.exportLoading = true;
return exportTenantExcel(params);
}).then(response => {
this.$download.excel(response, '租户.xls');
this.exportLoading = false;
}).catch(() => {});
},
/** 套餐名格式化 */
getPackageName(packageId) {
for (const item of this.packageList) {
if (item.id === packageId) {
return item.name;
}
}
return '未知套餐';
}
}
name: 'SystemTenant',
components: {},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
packageList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
name: null,
contactName: null,
contactMobile: null,
status: undefined,
createTime: [],
},
//
form: {},
//
rules: {
name: [{ required: true, message: '租户名不能为空', trigger: 'blur' }],
packageId: [
{ required: true, message: '租户套餐不能为空', trigger: 'blur' },
],
contactName: [
{ required: true, message: '联系人不能为空', trigger: 'blur' },
],
status: [
{ required: true, message: '租户状态不能为空', trigger: 'blur' },
],
accountCount: [
{ required: true, message: '账号额度不能为空', trigger: 'blur' },
],
expireTime: [
{ required: true, message: '过期时间不能为空', trigger: 'blur' },
],
domain: [
{ required: true, message: '绑定域名不能为空', trigger: 'blur' },
],
username: [
{ required: true, message: '用户名称不能为空', trigger: 'blur' },
],
password: [
{ required: true, message: '用户密码不能为空', trigger: 'blur' },
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getTenantPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
name: undefined,
packageId: undefined,
contactName: undefined,
contactMobile: undefined,
accountCount: undefined,
expireTime: undefined,
domain: undefined,
status: CommonStatusEnum.ENABLE,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
//
getTenantPackageList().then((response) => {
this.packageList = response.data;
});
this.$nextTick(() => {
this.open = true;
this.title = '添加租户';
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getTenant(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改租户';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateTenant(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createTenant(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除租户编号为"' + id + '"的数据项?')
.then(function () {
return deleteTenant(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
//
this.$modal
.confirm('是否确认导出所有租户数据项?')
.then(() => {
this.exportLoading = true;
return exportTenantExcel(params);
})
.then((response) => {
this.$download.excel(response, '租户.xls');
this.exportLoading = false;
})
.catch(() => {});
},
/** 套餐名格式化 */
getPackageName(packageId) {
for (const item of this.packageList) {
if (item.id === packageId) {
return item.name;
}
}
return '未知套餐';
},
},
};
</script>

View File

@ -18,8 +18,8 @@
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户名称" prop="username">
<el-input v-model="queryParams.username" placeholder="请输入用户名称" clearable style="width: 240px"
<el-form-item label="用户账号" prop="username">
<el-input v-model="queryParams.username" placeholder="请输入用户账号" clearable style="width: 240px"
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="手机号码" prop="mobile">
@ -59,7 +59,7 @@
<el-table v-loading="loading" :data="userList">
<el-table-column label="用户编号" align="center" key="id" prop="id" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="username" prop="username" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户账号" align="center" key="username" prop="username" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickname" prop="nickname" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.name" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="mobile" prop="mobile" v-if="columns[4].visible" width="120" />
@ -128,8 +128,8 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item v-if="form.id === undefined" label="用户名称" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名称" />
<el-form-item v-if="form.id === undefined" label="用户账号" prop="username">
<el-input v-model="form.username" placeholder="请输入用户账号" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -197,7 +197,7 @@
<!-- 分配角色 -->
<el-dialog title="分配角色" :visible.sync="openRole" width="500px" append-to-body>
<el-form :model="form" label-width="80px">
<el-form-item label="用户名称">
<el-form-item label="用户账号">
<el-input v-model="form.username" :disabled="true" />
</el-form-item>
<el-form-item label="用户昵称">
@ -312,7 +312,7 @@ export default {
//
columns: [
{ key: 0, label: `用户编号`, visible: true },
{ key: 1, label: `用户名称`, visible: true },
{ key: 1, label: `用户账号`, visible: true },
{ key: 2, label: `用户昵称`, visible: true },
{ key: 3, label: `部门`, visible: true },
{ key: 4, label: `手机号码`, visible: true },
@ -322,7 +322,7 @@ export default {
//
rules: {
username: [
{ required: true, message: "用户名称不能为空", trigger: "blur" }
{ required: true, message: "用户账号不能为空", trigger: "blur" }
],
nickname: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }

View File

@ -12,7 +12,7 @@
</div> -->
<ul class="list-group list-group-striped">
<li class="list-group-item">
<svg-icon icon-class="user" />用户名称
<svg-icon icon-class="user" />用户账号
<div class="pull-right">{{ user.username }}</div>
</li>
<li class="list-group-item">