mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 18:15:56 +08:00
add 登录页面搜索公司 (SysTenantController#listByWord) ;
This commit is contained in:
parent
5b08bba16c
commit
16c8f65909
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.system.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.baomidou.lock.annotation.Lock4j;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
@ -51,6 +52,15 @@ public class SysTenantController extends BaseController {
|
||||
return sysTenantService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询租户列表
|
||||
*/
|
||||
@SaIgnore
|
||||
@GetMapping("/listByWord/{keyword}")
|
||||
public R<List<SysTenantVo>> listByWord(@PathVariable String keyword) {
|
||||
return R.ok(sysTenantService.listByWord(keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出租户列表
|
||||
*/
|
||||
|
||||
@ -30,6 +30,11 @@ public interface ISysTenantService {
|
||||
*/
|
||||
TableDataInfo<SysTenantVo> queryPageList(SysTenantBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 根据关键字查询租户列表
|
||||
*/
|
||||
List<SysTenantVo> listByWord(String keyword);
|
||||
|
||||
/**
|
||||
* 查询租户列表
|
||||
*/
|
||||
|
||||
@ -77,6 +77,17 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询租户列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysTenantVo> listByWord(String keyword) {
|
||||
SysTenantBo bo = new SysTenantBo();
|
||||
bo.setCompanyName(keyword);
|
||||
LambdaQueryWrapper<SysTenant> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysTenant> buildQueryWrapper(SysTenantBo bo) {
|
||||
LambdaQueryWrapper<SysTenant> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), SysTenant::getTenantId, bo.getTenantId());
|
||||
|
||||
@ -55,3 +55,11 @@ export function delTenant(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据关键字获取相关企业名称
|
||||
export function listByWord(data) {
|
||||
return request({
|
||||
url: '/system/tenant/listByWord/' + data,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@ -12,6 +12,25 @@
|
||||
<svg-icon slot="prefix" icon-class="input" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="companyName">
|
||||
<el-select v-if="loginForm.tenantId"
|
||||
v-model="loginForm.companyName"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入公司名称"
|
||||
:remote-method="remoteMethod"
|
||||
:loading="selectLoading" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in companyList"
|
||||
:key="item.id"
|
||||
:label="item.companyName"
|
||||
:value="item.tenantId">
|
||||
</el-option>
|
||||
<svg-icon slot="prefix" icon-class="input" class="el-input__icon input-icon" />
|
||||
</el-select>
|
||||
<span v-else>{{loginForm.companyName}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
@ -75,6 +94,7 @@
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import { listByWord } from "@/api/system/tenant";
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
@ -106,7 +126,9 @@ export default {
|
||||
captchaEnabled: true,
|
||||
// 注册开关
|
||||
register: false,
|
||||
redirect: undefined
|
||||
redirect: undefined,
|
||||
selectLoading:false,
|
||||
companyList:[]
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -131,6 +153,24 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
getListByWord(word) {
|
||||
listByWord(word).then(res => {
|
||||
this.selectLoading = false;
|
||||
this.companyList = res.data
|
||||
})
|
||||
},
|
||||
// 搜索公司
|
||||
remoteMethod(query) {
|
||||
if (query !== '') {
|
||||
this.selectLoading = true;
|
||||
setTimeout(() => {
|
||||
this.selectLoading = false;
|
||||
this.getListByWord(query)
|
||||
}, 200);
|
||||
} else {
|
||||
this.companyList = [];
|
||||
}
|
||||
},
|
||||
getCookie() {
|
||||
const tenantId = Cookies.get("tenantId");
|
||||
const username = Cookies.get("username");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user