Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly
This commit is contained in:
commit
9a5ba71218
@ -151,3 +151,29 @@ export function getUploadUrl(params) {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置默认组织 */
|
||||
export function setDefaultOrg(data) {
|
||||
return request({
|
||||
url: `/api/project/setDefaultOrg`,
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/** 创建默认组织 */
|
||||
export function createDefaultOrg(id, data) {
|
||||
return request({
|
||||
url: `/api/project/${id}/createDefaultOrg`,
|
||||
method: 'POST',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/** 登录项目组织列表 */
|
||||
export function getOrgList(id) {
|
||||
return request({
|
||||
url: `/api/project/${id}/orgList`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export default {
|
||||
this.systemTitle = this.$store.state.projectConfig.homeTitle;
|
||||
this.logoImg = this.$store.state.projectConfig.loginProLogo;
|
||||
this.navigationLogoWidth = this.$store.state.projectConfig.homeProLogoWidth + 'px';
|
||||
this.navigationMarginLeft = '60px';
|
||||
this.navigationMarginLeft = '10px';
|
||||
},
|
||||
methods: {
|
||||
goToMain() {
|
||||
@ -47,12 +47,13 @@ export default {
|
||||
color: #fff;
|
||||
font-size:24px;
|
||||
font-weight:bold;
|
||||
vertical-align: top;
|
||||
}
|
||||
.logo{
|
||||
position: absolute;
|
||||
// position: absolute;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
top: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.logo_heb {
|
||||
position: absolute;
|
||||
|
262
src/views/login/forgetPassword.vue
Normal file
262
src/views/login/forgetPassword.vue
Normal file
@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="dialogShow"
|
||||
width="500px"
|
||||
:before-close="doClose"
|
||||
:z-index="9000"
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
top="25vh"
|
||||
>
|
||||
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="110px" class="demo-ruleForm">
|
||||
<el-form-item prop="type">
|
||||
<template slot="label">
|
||||
<span>找回途径:</span>
|
||||
</template>
|
||||
<el-radio-group v-model="form.type" size="small">
|
||||
<el-radio label="phone" border>手机号找回</el-radio>
|
||||
<el-radio label="email" border>邮箱找回</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'email'" prop="email">
|
||||
<template slot="label">
|
||||
<span>邮  箱:</span>
|
||||
</template>
|
||||
<el-input v-model="form.email" size="small" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'phone'" prop="phone">
|
||||
<template slot="label">
|
||||
<span>手机号:</span>
|
||||
</template>
|
||||
<el-input v-model="form.phone" size="small" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码:" prop="password">
|
||||
<template slot="label">
|
||||
<span>密  码:</span>
|
||||
</template>
|
||||
<el-input v-model="form.password" size="small" autocomplete="new-password" show-password style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码确认:" prop="repeatPassword">
|
||||
<el-input v-model="form.repeatPassword" size="small" autocomplete="new-password" show-password style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="vfCode">
|
||||
<template slot="label">
|
||||
<span>验证码:</span>
|
||||
</template>
|
||||
<el-input v-model="form.vfCode" size="small" style="display: inline-block;width: 200px" />
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
style="margin-top: 10px; margin-right: 10px;"
|
||||
:disabled="passWordCodeTime != 0"
|
||||
@click="sendVfcode"
|
||||
>
|
||||
{{ $t('global.sendCode') }}
|
||||
<span
|
||||
v-if="passWordCodeTime"
|
||||
>{{ passWordCodeTime }}</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<div style="display: flex;justify-content: space-around;">
|
||||
<el-button type="primary" size="small" @click="submitForm()">找回</el-button>
|
||||
<el-button size="small" @click="doClose()">返回登录</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { findPassword, sendPhoneVfcode, sendEmailVfcode } from '@/api/management/user';
|
||||
import md5 from 'js-md5';
|
||||
import {clearInterval, setInterval} from 'timers';
|
||||
export default {
|
||||
name: 'ForgetPassword',
|
||||
|
||||
data() {
|
||||
var validateEmail = (rule, value, callback) => {
|
||||
const regu = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||
const re = new RegExp(regu);
|
||||
if (!re.test(value) ) {
|
||||
callback(new Error('邮箱格式不正确'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
var validatePhone = (rule, value, callback) => {
|
||||
const regu = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
|
||||
const re = new RegExp(regu);
|
||||
if (!re.test(value)) {
|
||||
callback(new Error('手机号格式不正确'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
var validatePassword = (rule, value, callback) => {
|
||||
if (this.form.repeatPassword) {
|
||||
this.$refs.ruleForm.validateField('repeatPassword');
|
||||
}
|
||||
callback();
|
||||
};
|
||||
var validateRepeatPassword = (rule, value, callback) => {
|
||||
if (value !== this.form.password) {
|
||||
callback(new Error('两次密码不相同,请确认密码'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
var validateVfCode = (rule, value, callback) => {
|
||||
if (this.form.vfCode.length !== 4) {
|
||||
callback(new Error('验证码长度错误'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
dialogShow: false,
|
||||
message: '',
|
||||
operation: '',
|
||||
title: '密码找回',
|
||||
passWordTime: null,
|
||||
form: {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
email: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode: ''
|
||||
},
|
||||
passWordCodeTime: 0,
|
||||
rules: {
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{ validator: validatePhone, trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
||||
{ validator: validateEmail, trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ validator: validatePassword, trigger: 'blur' },
|
||||
{ min: 5, max: 20, message: '长度在 5 到 20 个字符', trigger: 'blur' }
|
||||
],
|
||||
repeatPassword: [
|
||||
{ required: true, message: '请重复输入密码', trigger: 'blur' },
|
||||
{ validator: validateRepeatPassword, trigger: 'blur' },
|
||||
{ min: 5, max: 20, message: '长度在 5 到 20 个字符', trigger: 'blur' }
|
||||
],
|
||||
vfCode: [
|
||||
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
||||
{ validator: validateVfCode, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.form = {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
email: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode: ''
|
||||
};
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
this.form = {
|
||||
type: 'phone',
|
||||
phone: '',
|
||||
email: '',
|
||||
password: '',
|
||||
repeatPassword: '',
|
||||
vfCode: ''
|
||||
};
|
||||
this.$refs.ruleForm.clearValidate();
|
||||
},
|
||||
async sendVfcode() {
|
||||
const reguEmail = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
||||
const reguPhone = /^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
|
||||
const rePhone = new RegExp(reguPhone);
|
||||
const reEmail = new RegExp(reguEmail);
|
||||
if (this.form.type === 'phone' && this.form.phone && rePhone.test(this.form.phone)) {
|
||||
const random = Math.floor(Math.random() * 10000 + 1);
|
||||
const timeCount = Date.parse(new Date()) / 1000;
|
||||
const pass = `${timeCount}86${this.form.phone}${random}`;
|
||||
const param = {
|
||||
mobile: this.form.phone,
|
||||
nationCode: '86',
|
||||
rd: random + '',
|
||||
time: timeCount + '',
|
||||
token: md5(pass)
|
||||
};
|
||||
try {
|
||||
this.passWordCodeTime = 60;
|
||||
this.passWordTime = setInterval(() => {
|
||||
this.passWordCodeTime--;
|
||||
if (this.passWordCodeTime <= 0) {
|
||||
this.passWordCodeTime = 0;
|
||||
clearInterval(this.mobileTime);
|
||||
this.passWordTime = null;
|
||||
}
|
||||
}, 1000);
|
||||
await sendPhoneVfcode(param);
|
||||
} catch (error) {
|
||||
this.$message.info(this.$t('global.codeFaile'));
|
||||
}
|
||||
} else if (this.form.type === 'email' && this.form.email && reEmail.test(this.form.email)) {
|
||||
const param = { email: this.form.email };
|
||||
try {
|
||||
this.passWordCodeTime = 60;
|
||||
this.passWordTime = setInterval(() => {
|
||||
this.passWordCodeTime--;
|
||||
if (this.passWordCodeTime <= 0) {
|
||||
this.passWordCodeTime = 0;
|
||||
clearInterval(this.mobileTime);
|
||||
this.passWordTime = null;
|
||||
}
|
||||
}, 1000);
|
||||
await sendEmailVfcode(param);
|
||||
} catch (error) {
|
||||
this.$message.info(this.$t('global.codeFaile'));
|
||||
}
|
||||
} else {
|
||||
this.$refs.ruleForm.validateField('email');
|
||||
this.$refs.ruleForm.validateField('phone');
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = { email: this.form.email, mobile: this.form.phone, newPwd: md5(this.form.password), vfCode: this.form.vfCode };
|
||||
findPassword(data).then(resp => {
|
||||
this.$message.success('设置密码成功!' );
|
||||
this.doClose();
|
||||
}).catch(error => {
|
||||
this.$message.error('设置密码失败:' + error.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.confirm-control-speed .context {
|
||||
padding-bottom: 40px !important;
|
||||
border: 1px solid lightgray;
|
||||
}
|
||||
.ningbo-01__systerm .el-dialog .el-button{
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
@ -3,7 +3,7 @@
|
||||
<div v-if="syncLogin">
|
||||
{{}}
|
||||
</div>
|
||||
<div v-else class="login-container" :style="{ 'background-image': showBackPic?'url(' + bgImg + ')':'none' }">
|
||||
<div v-else v-show="loadedConfig" class="login-container" :style="{ 'background-image': showBackPic?'url(' + bgImg + ')':'none' }">
|
||||
<div class="language_box">
|
||||
<el-tooltip effect="dark" :content="this.$t('login.clickSwitchLanguage')" placement="bottom-end">
|
||||
<el-button class="language_btn" type="text" @click="handleLanguage">{{ language }}</el-button>
|
||||
@ -18,13 +18,15 @@
|
||||
<!-- 微信登陆 -->
|
||||
<wechat-login v-if="wechatLogin" ref="wechatLogin" :project="backProject" :sync-login="syncLogin" />
|
||||
<!-- 默认登陆 -->
|
||||
<normal-login ref="normalLogin" :project="backProject" />
|
||||
<normal-login ref="normalLogin" :project="backProject" :local-project="localProject" @forgetPassword="forgetPassword" @showOrgList="showOrgList" />
|
||||
</div>
|
||||
<base-development v-if="baseDevelopment" ref="baseDevelopment" />
|
||||
<div class="bottomInfo">
|
||||
<span>{{ aboutSystem }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<forget-password ref="forgetPassword" />
|
||||
<OrgSelect ref="orgSelect" @select="selectOrgnization" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -35,15 +37,19 @@ import { getFrontProjectConfigByLogin} from '@/api/projectConfig';
|
||||
import WechatLogin from './wechatLogin';
|
||||
import NormalLogin from './normalLogin';
|
||||
import BaseDevelopment from './baseDevelopment';
|
||||
import ForgetPassword from './forgetPassword';
|
||||
import OrgSelect from './orgSelect';
|
||||
export default {
|
||||
name:'LoginNew',
|
||||
components: { WechatLogin, NormalLogin, BaseDevelopment },
|
||||
components: { WechatLogin, NormalLogin, BaseDevelopment, ForgetPassword, OrgSelect },
|
||||
data() {
|
||||
return {
|
||||
backProject:'',
|
||||
language: '中文',
|
||||
lang: 'zh',
|
||||
loginProtitle:'',
|
||||
localProject:false,
|
||||
loadedConfig:false,
|
||||
showBackPic:true,
|
||||
wechatLogin:true,
|
||||
loginProLogoWidth:0,
|
||||
@ -75,7 +81,7 @@ export default {
|
||||
if (response.data) {
|
||||
this.backProject = response.data.project;
|
||||
// loginProLogoHeight
|
||||
const {showBackPic, wechatLogin, aboutSystem, baseDevelopment, browserTitle, homeTitle, caseShow, loginProtitle, loginProLogoWidth, loginOrgTitle, homeProLogoWidth, loginProLogo} = response.data.viewSetting;
|
||||
const {showBackPic, wechatLogin, aboutSystem, baseDevelopment, browserTitle, homeTitle, caseShow, loginProtitle, loginProLogoWidth, loginOrgTitle, localProject, homeProLogoWidth, loginProLogo} = response.data.viewSetting;
|
||||
this.showBackPic = showBackPic;
|
||||
this.wechatLogin = wechatLogin;
|
||||
this.loginProtitle = loginProtitle;
|
||||
@ -85,12 +91,14 @@ export default {
|
||||
this.loginProLogo = loginProLogo ? this.$store.state.user.ossUrl + '/logo/' + loginProLogo : '';
|
||||
this.aboutSystem = aboutSystem;
|
||||
this.baseDevelopment = baseDevelopment;
|
||||
this.localProject = localProject;
|
||||
document.title = browserTitle;
|
||||
document.querySelector("link[rel*='icon']").href = this.loginProLogo;
|
||||
this.$store.dispatch('setHomeProLogoWidth', homeProLogoWidth);
|
||||
this.$store.dispatch('setLoginProLogo', this.loginProLogo);
|
||||
this.$store.dispatch('setHomeTitle', homeTitle);
|
||||
this.$store.dispatch('setCaseShow', caseShow);
|
||||
this.loadedConfig = true;
|
||||
// helpShow
|
||||
// 登录页 是否显示联系方式 loginContectInformation false
|
||||
setSessionStorage('project', this.project);
|
||||
@ -103,6 +111,15 @@ export default {
|
||||
handleLanguage() {
|
||||
this.$i18n.locale = this.lang;
|
||||
LangStorage.setLang(this.lang);
|
||||
},
|
||||
forgetPassword() {
|
||||
this.$refs.forgetPassword.doShow();
|
||||
},
|
||||
showOrgList(orgList) {
|
||||
this.$refs.orgSelect.doShow(orgList);
|
||||
},
|
||||
selectOrgnization(orgId) {
|
||||
this.$refs.normalLogin.selectOrg(orgId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -43,6 +43,7 @@
|
||||
<!-- <el-checkbox v-if="project === 'cgy'" v-model="teacherLogin">教师登录</el-checkbox> -->
|
||||
</div>
|
||||
<el-popover
|
||||
v-if="!localProject"
|
||||
placement="right"
|
||||
title=""
|
||||
width="200"
|
||||
@ -68,11 +69,11 @@
|
||||
{{ $t('login.login') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<!-- <div style="display: inline-block;width: 100%;">
|
||||
<div v-if="!localProject" style="display: inline-block;width: 100%;">
|
||||
<div class="popover_box active" style="bottom: 50px;" @click="forgetPassword">
|
||||
忘记密码?
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
@ -82,7 +83,6 @@ import md5 from 'js-md5';
|
||||
import Cookies from 'js-cookie';
|
||||
// getLoginWmurl, checkLoginStatus, getLoginInfo,
|
||||
import { getOrgList, selectOrgnization } from '@/api/login';
|
||||
// import ForgetPassword from './forgetPassword';
|
||||
export default {
|
||||
name:'NormalLogin',
|
||||
// Register,
|
||||
@ -93,6 +93,12 @@ export default {
|
||||
default: () => {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
localProject:{
|
||||
type: Boolean,
|
||||
default: () => {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// syncLogin:{
|
||||
// type: Boolean,
|
||||
@ -198,10 +204,17 @@ export default {
|
||||
}
|
||||
this.handleLoginSucessRoute();
|
||||
} else {
|
||||
this.$emit('showOrgList', orgList);
|
||||
// this.showOrgSelect(orgList).then(this.handleLoginSucessRoute());
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
selectOrg(orgId) {
|
||||
this.handleLoginSucessRoute();
|
||||
selectOrgnization(orgId);
|
||||
},
|
||||
handleLoginSucessRoute() {
|
||||
this.loading = false;
|
||||
this.tipsMsg = '';
|
||||
@ -229,6 +242,9 @@ export default {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
forgetPassword() {
|
||||
this.$emit('forgetPassword');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
42
src/views/login/orgSelect.vue
Normal file
42
src/views/login/orgSelect.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<el-dialog center :visible.sync="show" :close-on-click-modal="false" :show-close="false" title="请选择要登录的组织">
|
||||
<div class="formWrapper">
|
||||
<el-select v-model="selected" placeholder="请选择">
|
||||
<el-option v-for="option in orgList" :key="option.orgId" :label="option.name" :value="option.orgId" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-button slot="footer" primary size="small" @click="confirmSelect">确认</el-button>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'OrgSelect',
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
orgList: [],
|
||||
selected: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
confirmSelect() {
|
||||
this.$emit('select', this.selected);
|
||||
},
|
||||
doShow(orgList) {
|
||||
this.orgList = orgList;
|
||||
this.show = true;
|
||||
},
|
||||
doClose() {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.formWrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
@ -49,6 +49,9 @@
|
||||
<el-form-item label="帮助展示:" prop="helpShow" class="inlineBlock">
|
||||
<el-switch v-model="formModel.helpShow" />
|
||||
</el-form-item>
|
||||
<el-form-item label="本地项目:" prop="localProject" class="inlineBlock">
|
||||
<el-switch v-model="formModel.localProject" />
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="登陆后跳转路径:" prop="judgeRoute" class="inlineBlock">
|
||||
<el-input v-model="formModel.judgeRoute" style="width: 210px;" size="small" />
|
||||
@ -96,6 +99,7 @@ export default {
|
||||
navLogoHeight:'', // 导航栏Logo高度
|
||||
caseShow:true, // 导航栏案例展示是否展示
|
||||
helpShow:true, // 导航栏帮助展示是否展示
|
||||
localProject:false, // 是否本地项目
|
||||
|
||||
judgeRoute:'', // 跳转路径
|
||||
baseApiUrl:'', // api链接
|
||||
@ -153,11 +157,13 @@ export default {
|
||||
this.formModel.navLogoHeight = viewSetting.navLogoHeight || '';
|
||||
this.formModel.caseShow = viewSetting.caseShow || false;
|
||||
this.formModel.helpShow = viewSetting.helpShow || false;
|
||||
this.formModel.localProject = viewSetting.localProject || false;
|
||||
|
||||
this.formModel.judgeRoute = viewSetting.judgeRoute || '';
|
||||
this.formModel.baseApiUrl = viewSetting.baseApiUrl || '';
|
||||
this.formModel.baseSite = viewSetting.baseSite || '';
|
||||
this.formModel.ossUrl = viewSetting.ossUrl || '';
|
||||
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
@ -179,6 +185,7 @@ export default {
|
||||
navLogoHeight:'', // 导航栏Logo高度
|
||||
caseShow:true, // 导航栏案例展示是否展示
|
||||
helpShow:true, // 导航栏帮助展示是否展示
|
||||
localProject:false, // 是否本地项目
|
||||
|
||||
judgeRoute:'', // 跳转路径
|
||||
baseApiUrl:'', // api链接
|
||||
|
110
src/views/system/projectManage/defaultOrgniation.vue
Normal file
110
src/views/system/projectManage/defaultOrgniation.vue
Normal file
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="400px" :before-close="handleClose" center :close-on-click-modal="false">
|
||||
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="100px">
|
||||
<el-form-item v-if="createDefaultOrg" label="组织名称:" prop="name">
|
||||
<el-input v-model="formModel.name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="组织:" prop="defaultOrg">
|
||||
<el-select v-model="formModel.defaultOrg" placeholder="请选择" style="width: 200px;">
|
||||
<el-option
|
||||
v-for="item in orgList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { setDefaultOrg, createDefaultOrg, getOrgList} from '@/api/projectConfig';
|
||||
export default {
|
||||
name:'DefaultOrgniation',
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
dialogVisible: false,
|
||||
orgList:[],
|
||||
createDefaultOrg:true,
|
||||
formModel:{
|
||||
id:'', // 项目ID
|
||||
defaultOrg:'', // 组织ID
|
||||
name:'' // 公司名称
|
||||
}
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
rules() {
|
||||
const crules = {
|
||||
defaultOrg: [
|
||||
{ required: true, message: '请选择组织', trigger: 'blur' },
|
||||
{ required: true, message: '请选择组织', trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入组织名称', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
title() {
|
||||
return this.createDefaultOrg ? '创建默认组织' : '设置默认组织';
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
doShow(row) {
|
||||
this.createDefaultOrg = row.createDefaultOrg;
|
||||
if (!this.createDefaultOrg) {
|
||||
// 登录项目组织列表
|
||||
getOrgList(row.id).then(res=>{
|
||||
this.orgList = res.data || [];
|
||||
this.formModel.defaultOrg = row.defaultOrg.toString();
|
||||
});
|
||||
}
|
||||
this.formModel.id = row.id;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleClose() {
|
||||
this.formModel = {
|
||||
id:'', // 项目ID
|
||||
defaultOrg:'', // 组织ID
|
||||
name:'' // 公司名称
|
||||
};
|
||||
this.$refs.ruleForm.resetFields();
|
||||
this.dialogVisible = false;
|
||||
this.loading = false;
|
||||
this.orgList = [];
|
||||
},
|
||||
doSave() {
|
||||
if (this.createDefaultOrg) {
|
||||
const data = {name:this.formModel.name};
|
||||
// 创建默认组织
|
||||
createDefaultOrg(this.formModel.id, data).then(resp => {
|
||||
this.$message.success('创建默认组织成功!');
|
||||
this.handleClose();
|
||||
this.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
this.$message.error(error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
const data = {id:this.formModel.id, defaultOrg:parseInt(this.formModel.defaultOrg)};
|
||||
// 设置默认组织
|
||||
setDefaultOrg(data).then(resp => {
|
||||
this.$message.success('设置默认组织成功!');
|
||||
this.handleClose();
|
||||
this.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
this.$message.error(error.message);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -2,16 +2,20 @@
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<add-project ref="addProject" @reloadTable="reloadTable" />
|
||||
<default-orgniation ref="defaultOrgniation" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getBackProjectConfigByPage, deleteBackProjectConfig} from '@/api/projectConfig';
|
||||
import AddProject from './add';
|
||||
import DefaultOrgniation from './defaultOrgniation';
|
||||
|
||||
// getBackProjectConfigById
|
||||
export default {
|
||||
name:'ProjectManage',
|
||||
components: {
|
||||
AddProject
|
||||
AddProject,
|
||||
DefaultOrgniation
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -74,6 +78,11 @@ export default {
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.handleDelete,
|
||||
type: 'danger'
|
||||
},
|
||||
{
|
||||
name: '默认组织',
|
||||
handleClick: this.setDefaultOrg,
|
||||
type: 'success'
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -99,6 +108,9 @@ export default {
|
||||
createProject() {
|
||||
this.$refs.addProject.doShow();
|
||||
},
|
||||
setDefaultOrg(index, row) {
|
||||
this.$refs.defaultOrgniation.doShow(row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
this.$confirm('此操作将删除该项目数据!', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
|
Loading…
Reference in New Issue
Block a user