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: '订单出货日期', label: '订单出货日期',
dateType: 'daterange', dateType: 'daterange',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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