Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2024-12-26 10:00:49 +08:00
commit 5dd1935997
31 changed files with 2067 additions and 594 deletions

View File

@ -5,3 +5,6 @@ npm install
# 启动服务
npm run dev
# v1.9.0修改
1. 角色修改全局userId实际意义修改为userRoleId用户角色id新增identityUserId新的用户id

View File

@ -30,7 +30,6 @@
</script>
<% } else { %>
<script>
console.log(2)
window.zzSessionStorage = {
setItem: (item, value) => {
return sessionStorage.setItem(item, value)

View File

@ -44,11 +44,19 @@ export function updateUser(param) {
data: param
})
}
export function getUser(userId) {
export function updateUserBasicInfo(param) {
return request({
url: `/user/getUser/${userId}`,
method: 'get'
url: `/user/updateUserBasicInfo`,
method: 'put',
data: param
})
}
export function getUser(params) {
return request({
url: `/user/getUser`,
method: 'get',
params
})
}

View File

@ -3914,4 +3914,21 @@ export function getVisitClinicalDataName(data) {
method: 'post',
data
})
}
// 修改外部人员权限配置
export function configTrialSPMInfo(data) {
return request({
url: `/TrialConfig/configTrialSPMInfo`,
method: 'post',
data
})
}
// 项目添加角色修改权限
export function updateTrialUserRole(data) {
return request({
url: `/TrialMaintenance/updateTrialUserRole`,
method: 'put',
data
})
}

View File

@ -193,3 +193,19 @@ export function getPublicKey() {
method: 'get',
})
}
// 登陆获取角色
export function getUserLoginRoleList(data) {
return request({
url: `/User/getUserLoginRoleList`,
method: 'post',
data,
})
}
// 登陆角色id获取token
export function loginSelectUserRole(params) {
return request({
url: `/User/loginSelectUserRole`,
method: 'get',
params,
})
}

View File

@ -0,0 +1,116 @@
<template>
<el-dialog
v-if="visible"
:visible.sync="visible"
v-dialogDrag
width="540px"
:close-on-click-modal="false"
:close-on-press-escape="false"
append-to-body
:title="$t('toggleRole:tip:title')"
center
top="30vh"
:show-close="false"
:before-close="cancel"
>
<template v-if="hasRole">
<el-radio-group v-model="form.userRoleId" class="roles">
<el-radio
v-for="item in roles"
:key="item.Id"
:label="item.Id"
:disabled="item.isUserRoleDisabled"
style="margin-bottom: 10px"
>
{{ item.UserTypeShortName }}
</el-radio>
</el-radio-group>
</template>
<div v-else style="text-align: center">
{{ $t('toggleRole:tip:noRole') }}
</div>
<div slot="footer">
<!-- 取消 -->
<el-button size="small" @click="cancel()">
{{ $t('common:button:cancel') }}
</el-button>
<!-- 保存 -->
<el-button
type="primary"
size="small"
@click="save"
:loading="loading"
v-if="hasRole"
>
{{ $t('common:button:confirm') }}
</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'toggleRole',
props: {
visible: {
type: Boolean,
default: false,
},
loading: {
type: Boolean,
default: false,
},
},
data() {
return {
form: {
userRoleId: null,
},
}
},
created() {
this.form.userRoleId = zzSessionStorage.getItem('userId')
},
computed: {
roles() {
return this.$store.state.user.roles
},
hasRole() {
return this.roles && this.roles.length > 0
},
},
methods: {
cancel() {
this.$emit('update:visible', false)
this.$emit('cancel')
},
async save() {
try {
if (!this.form.userRoleId)
return this.$message.warning(this.$t('toggleRole:ruleMessage:select'))
this.$emit('save', this.form.userRoleId)
} catch (err) {
console.log(err)
}
},
},
}
</script>
<style lang="scss" scoped>
.roles {
width: 100%;
display: flex;
align-content: center;
justify-content: center;
flex-wrap: wrap;
}
/deep/ .el-radio__original {
display: none !important; /* 隐藏原生 radio 输入,但仍然允许交互 */
}
/deep/.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
.el-radio__inner {
box-shadow: none !important;
}
</style>

View File

@ -1,6 +1,5 @@
import { SubjectCheckConfig } from './module/Subject'
console.log(SubjectCheckConfig.moduleType)
export const checkConfig = {
ModuleType: {
...SubjectCheckConfig.ModuleType

View File

@ -69,7 +69,7 @@ export default {
...mapGetters(['sidebar', 'name', 'device'])
},
created() {
this.isReviewer = JSON.parse(zzSessionStorage.getItem('IsReviewer'))
// this.isReviewer = JSON.parse(zzSessionStorage.getItem('IsReviewer'))
},
methods: {
...mapMutations({ setLanguage: 'lang/setLanguage' }),

View File

@ -78,6 +78,7 @@ router.beforeEach(async (to, from, next) => {
try {
// 获取用户信息
await store.dispatch('user/getInfo')
await store.dispatch('user/getUserInfo')
const accessRoutes = await store.dispatch('permission/generateRoutes')
router.addRoutes(accessRoutes)
next({ ...to, replace: true })

View File

@ -7,6 +7,7 @@ const getters = {
tree: state => state.user.tree,
userName: state => state.user.userName,
userId: state => state.user.userId,
identityUserId: state => state.user.identityUserId,
routes: state => state.permission.routes,
asyncRoutes: state => state.permission.addRoutes,
visitedViews: state => state.tagsView.visitedViews,

View File

@ -1,5 +1,6 @@
import { getToken, setToken, removeToken, setName, removeName } from '@/utils/auth'
import { login, loginOut, getUserMenuTree, getUserPermissions } from '@/api/user'
import { login, loginOut, getUserMenuTree, getUserPermissions, getUserLoginRoleList, loginSelectUserRole } from '@/api/user'
import { getUser } from '@/api/admin'
import { resetRouter } from '@/router'
import md5 from 'js-md5'
@ -9,6 +10,7 @@ const getDefaultState = () => {
name: '',
userName: '',
userId: '',
identityUserId: '',
avatar: '',
permissions: [],
tree: [],
@ -16,13 +18,17 @@ const getDefaultState = () => {
TotalNeedSignSystemDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0,
TotalNeedSignTrialDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0,
TrialStatusStr: null,
isTestUser: false
isTestUser: false,
roles: []
}
}
const state = getDefaultState()
const mutations = {
SET_ROLES: (state, roles) => {
state.roles = roles
},
RESET_STATE: (state) => {
Object.assign(state, getDefaultState())
},
@ -49,6 +55,9 @@ const mutations = {
SET_USERID: (state, id) => {
state.userId = id
},
SET_IDENTITYUSERID: (state, id) => {
state.identityUserId = id
},
SET_ISTESTUSER: (state, isTestUser) => {
state.isTestUser = eval(isTestUser)
},
@ -78,6 +87,9 @@ const mutations = {
}
const actions = {
setRoles({ commit }, roles) {
commit('SET_ROLES', roles)
},
changeUserName({ commit }, userName) {
commit('SET_USERNAME', userName)
},
@ -91,7 +103,7 @@ const actions = {
if (UserId) {
data.UserId = UserId;
}
login(data).then(async response => {
getUserLoginRoleList(data).then(async response => {
if (response.IsSuccess) {
zzSessionStorage.removeItem('lastWorkbench')
zzSessionStorage.setItem('my_username', username.trim())
@ -99,6 +111,7 @@ const actions = {
zzSessionStorage.setItem('my_EMail', response.Result.BasicInfo.EMail)
localStorage.setItem('CompanyInfo', JSON.stringify(response.Result.CompanyInfo))
const data = response.Result
commit('SET_ROLES', data.BasicInfo.AccountList)
if (data.BasicInfo.IsFirstAdd || data.BasicInfo.LoginState === 1) {
try {
zzSessionStorage.setItem('userId', data.BasicInfo.Id)
@ -114,25 +127,25 @@ const actions = {
zzSessionStorage.setItem('IsReviewer', data.BasicInfo.IsReviewer)
zzSessionStorage.setItem('userName', data.BasicInfo.UserName)
commit('SET_TOKEN', data.JWTStr)
commit('SET_NAME', data.BasicInfo.RealName)
zzSessionStorage.setItem('realName', data.BasicInfo.RealName)
// commit('SET_NAME', data.BasicInfo.UserName)
zzSessionStorage.setItem('isTestUser', data.BasicInfo.IsTestUser)
commit('SET_ISTESTUSER', data.BasicInfo.IsTestUser)
commit('SET_USERNAME', data.BasicInfo.UserName)
commit('SET_USERID', data.BasicInfo.Id)
commit('SET_USERID', data.BasicInfo.IdentityUserId)
setToken(data.JWTStr)
setName(data.BasicInfo.RealName)
// setName(data.BasicInfo.RealName)
const userString = decodeURIComponent(escape(window.atob(data.JWTStr.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
const user = JSON.parse(userString)
zzSessionStorage.setItem('userTypeShortName', user.userTypeShortName)
zzSessionStorage.setItem('userId', user.id)
// zzSessionStorage.setItem('userId', user.identityUserId)
commit('SET_IDENTITYUSERID', user.identityUserId)
zzSessionStorage.setItem('identityUserId', user.identityUserId)
zzSessionStorage.setItem('userTypeEnumInt', user.userTypeEnumInt)
var permissions = await getUserPermissions()
var menuTree = await getUserMenuTree()
commit('SET_TREE', menuTree.Result)
commit('SET_PERMISSIONS', permissions.Result)
zzSessionStorage.setItem('newTree', JSON.stringify(menuTree.Result))
zzSessionStorage.setItem('permissions', JSON.stringify(permissions.Result))
// var permissions = await getUserPermissions()
// var menuTree = await getUserMenuTree()
// commit('SET_TREE', menuTree.Result)
// commit('SET_PERMISSIONS', permissions.Result)
// zzSessionStorage.setItem('newTree', JSON.stringify(menuTree.Result))
// zzSessionStorage.setItem('permissions', JSON.stringify(permissions.Result))
} catch (e) {
console.log(e)
}
@ -146,6 +159,44 @@ const actions = {
})
})
},
loginByRole({ commit }, userInfo) {
const { userRoleId } = userInfo
let params = {
userRoleId
}
return new Promise((resolve, reject) => {
loginSelectUserRole(params).then(async response => {
if (response.IsSuccess) {
const data = response.Result
try {
commit('SET_TOKEN', data)
setToken(data)
const userString = decodeURIComponent(escape(window.atob(data.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
const user = JSON.parse(userString)
zzSessionStorage.setItem('userTypeShortName', user.userTypeShortName)
commit('SET_NAME', user.fullName)
setName(user.fullName)
var permissions = await getUserPermissions()
var menuTree = await getUserMenuTree()
commit('SET_TREE', menuTree.Result)
commit('SET_PERMISSIONS', permissions.Result)
zzSessionStorage.setItem('newTree', JSON.stringify(menuTree.Result))
zzSessionStorage.setItem('permissions', JSON.stringify(permissions.Result))
} catch (e) {
console.log(e)
}
resolve(response.Result)
} else {
reject(response.ErrorMessage)
}
}).catch(() => {
reject()
})
})
},
setTree({ commit }, tree) {
commit('SET_TREE', tree)
},
@ -170,21 +221,34 @@ const actions = {
commit('SET_PERMISSIONS', JSON.parse(zzSessionStorage.getItem('permissions')))
commit('SET_ISTESTUSER', zzSessionStorage.getItem('isTestUser'))
const user = JSON.parse(userString)
commit('SET_NAME', zzSessionStorage.getItem('realName'))
commit('SET_USERID', user.id)
commit('SET_NAME', zzSessionStorage.getItem('Name'))
commit('SET_IDENTITYUSERID', user.identityUserId)
commit('SET_USERID', user.userRoleId)
commit('SET_USERNAME', zzSessionStorage.getItem('userName'))
commit('SET_NEED_SIGN_SYSTEM_DOC_COUNT', parseInt(zzSessionStorage.getItem('TotalNeedSignSystemDocCount')))
commit('SET_NEED_SIGN_TRIALS_DOC_COUNT', parseInt(zzSessionStorage.getItem('TotalNeedSignTrialDocCount')))
console.log(zzSessionStorage.getItem('TotalNeedSignSystemDocCount'))
console.log(zzSessionStorage.getItem('TotalNeedSignTrialDocCount'))
// console.log(zzSessionStorage.getItem('TotalNeedSignSystemDocCount'))
// console.log(zzSessionStorage.getItem('TotalNeedSignTrialDocCount'))
zzSessionStorage.setItem('userName', user.name)
zzSessionStorage.setItem('userId', user.id)
zzSessionStorage.setItem('userId', user.userRoleId)
zzSessionStorage.setItem('identityUserId', user.identityUserId)
zzSessionStorage.setItem('userTypeShortName', user.userTypeShortName)
zzSessionStorage.setItem('userTypeEnumInt', user.userTypeEnumInt)
return user
},
updateInfo({ commit, state }) {
commit('SET_NAME', zzSessionStorage.getItem('realName'))
commit('SET_NAME', zzSessionStorage.getItem('Name'))
},
// 获取用户信息
getUserInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getUser().then(res => {
commit('SET_ROLES', res.Result.AccountList)
resolve(res.Result)
}).catch(err => {
reject(err)
})
})
},
// user logout
async logout({ commit, state }) {

View File

@ -5,7 +5,7 @@
:model="user"
:rules="userFormRules"
label-width="150px"
style="width:800px;"
style="width: 800px"
>
<el-card class="Basic" shadow="never" size="small">
<div slot="header" class="clearfix">
@ -25,7 +25,7 @@
<el-form-item label="Given Name: " prop="FirstName">
<el-input v-model="user.FirstName" />
</el-form-item>
<el-form-item label="Gender: " prop="Sex" style="margin-right:40px;">
<el-form-item label="Gender: " prop="Sex" style="margin-right: 40px">
<el-radio-group v-model="user.Sex">
<el-radio :label="1">Male</el-radio>
<el-radio :label="0">Female</el-radio>
@ -37,13 +37,24 @@
<el-form-item label="Phone: " prop="Phone">
<el-input v-model="user.Phone" />
</el-form-item>
<el-form-item v-if="type==1" label="Disable:">
<el-switch v-model="user.Status" :active-value="0" :inactive-value="1" />
<el-form-item v-if="type == 1" label="Disable:">
<el-switch
v-model="user.Status"
:active-value="0"
:inactive-value="1"
/>
</el-form-item>
<el-form-item label="User Type: " prop="UserTypeId">
<el-select ref="userType" v-model="user.UserTypeId" size="small" placeholder="Please select" style="width:100%;" :disabled="user.CanEditUserType === false">
<el-select
ref="userType"
v-model="user.UserTypeId"
size="small"
placeholder="Please select"
style="width: 100%"
:disabled="user.CanEditUserType === false"
>
<el-option
v-for="(userType,key) of userTypeOptions"
v-for="(userType, key) of userTypeOptions"
:key="key"
:label="userType.UserType"
:value="userType.Id"
@ -52,17 +63,28 @@
</el-form-item>
</el-card>
<el-card class="Affiliation" shadow="never" style="margin-top:10px;" size="small">
<el-card
class="Affiliation"
shadow="never"
style="margin-top: 10px"
size="small"
>
<div slot="header" class="clearfix">
<span>Affiliation</span>
</div>
<el-form-item prop="IsZhiZhun">
<el-radio-group v-model="user.IsZhiZhun" @change="OrgnizationTypeChanged">
<el-radio-group
v-model="user.IsZhiZhun"
@change="OrgnizationTypeChanged"
>
<el-radio :label="true">Internal</el-radio>
<el-radio :label="false">External</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-show="user.IsZhiZhun === false" label="Organization Name: ">
<el-form-item
v-show="user.IsZhiZhun === false"
label="Organization Name: "
>
<el-input v-model="user.OrganizationName" />
</el-form-item>
@ -78,19 +100,24 @@
type="primary"
size="small"
:disabled="isDisabled"
style="margin:10px 15px"
style="margin: 10px 15px"
@click="handleSave"
>Save</el-button>
>Save</el-button
>
</el-form-item>
</el-form>
</template>
<script>
import { getUser, addUser, updateUser, getUserTypeListByUserType } from '@/api/admin.js'
import {
getUser,
addUser,
updateUser,
getUserTypeListByUserType,
} from '@/api/admin.js'
export default {
name: 'UserInfo',
props: {
userId: { type: String, default: '' }
userId: { type: String, default: '' },
},
data() {
return {
@ -105,60 +132,69 @@ export default {
IsZhiZhun: '',
OrganizationName: '',
DepartmentName: '',
PositionName: ''
PositionName: '',
},
userFormRules: {
UserName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' }
{ max: 50, message: 'The maximum length is 50' },
],
UserTypeId: [
{ required: true, message: 'Please Select', trigger: ['blur', 'change'] }
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
IsZhiZhun: [
{ required: true, message: 'Please Select', trigger: ['blur', 'change'] }
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
OrganizationName: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ required: true, message: 'Please specify', trigger: 'blur' },
],
LastName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' }
{ max: 50, message: 'The maximum length is 50' },
],
FirstName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' }
{ max: 50, message: 'The maximum length is 50' },
],
Phone: [
{ max: 20, min: 7, message: 'The length is 7 to 20', trigger: ['blur'] }
{
max: 20,
min: 7,
message: 'The length is 7 to 20',
trigger: ['blur'],
},
],
EMail: [
{
required: true,
message: 'Please input the email address',
trigger: 'blur'
trigger: 'blur',
},
{
type: 'email',
message: 'Please input the correct email address',
trigger: ['blur']
trigger: ['blur'],
},
{ max: 50, message: 'The maximum length is 50' }
],
Sex: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ max: 50, message: 'The maximum length is 50' },
],
Sex: [{ required: true, message: 'Please specify', trigger: 'blur' }],
Status: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ required: true, message: 'Please specify', trigger: 'blur' },
],
DepartmentName: [
{ max: 50, message: 'The maximum length is 50' }],
PositionName: [{ max: 50, message: 'The maximum length is 50' }
]
DepartmentName: [{ max: 50, message: 'The maximum length is 50' }],
PositionName: [{ max: 50, message: 'The maximum length is 50' }],
},
userTypeOptions: [],
isDisabled: false,
type: 0 // 10
type: 0, // 10
}
},
created() {
@ -172,46 +208,58 @@ export default {
},
methods: {
handleSave() {
this.$refs.userForm.validate(valid => {
this.$refs.userForm.validate((valid) => {
if (valid) {
this.isDisabled = true
const selectedUserType = this.userTypeOptions.filter(item => item.Id === this.user.UserTypeId)
const selectedUserType = this.userTypeOptions.filter(
(item) => item.Id === this.user.UserTypeId
)
if (selectedUserType.length > 0) {
this.user.UserTypeEnum = selectedUserType[0].UserTypeEnum
}
if (this.user.Id) {
updateUser(this.user).then(res => {
this.isDisabled = false
this.$message.success('Updated successfully')
}).catch(() => { this.isDisabled = false })
updateUser(this.user)
.then((res) => {
this.isDisabled = false
this.$message.success('Updated successfully')
})
.catch(() => {
this.isDisabled = false
})
} else {
addUser(this.user).then(res => {
this.isDisabled = false
this.user.Id = res.Result.Id
this.user.UserCode = res.Result.UserCode
this.$emit('getUserId', res.Result.Id)
this.$message.success('Added successfully')
this.$router.push({ path: '/system/user/list' })
}).catch(() => { this.isDisabled = false })
addUser(this.user)
.then((res) => {
this.isDisabled = false
this.user.Id = res.Result.Id
this.user.UserCode = res.Result.UserCode
this.$emit('getUserId', res.Result.Id)
this.$message.success('Added successfully')
this.$router.push({ path: '/system/user/list' })
})
.catch(() => {
this.isDisabled = false
})
}
}
})
},
getUserTypeList() {
getUserTypeListByUserType(0).then(res => {
getUserTypeListByUserType(0).then((res) => {
if (res.IsSuccess) {
this.userTypeOptions = res.Result
}
})
},
getUserInfo() {
getUser(this.userId).then(res => {
getUser({
IdentityUserId: this.userId,
}).then((res) => {
this.user = res.Result
})
},
OrgnizationTypeChanged(val) {
this.user.OrganizationName = ''
}
}
},
},
}
</script>

View File

@ -95,7 +95,6 @@ export default {
: 'zh'
/* eslint-disable */
var reg1 = /^[a-zA-Z0-9_]{4,16}$/ //8
console.log(!reg1.test(value))
if (!reg1.test(value)) {
callback(
lang === 'zh'

View File

@ -76,7 +76,8 @@
>
<!-- 用户名 -->
<el-form-item :label="$t('passwordReset:form:userName')" prop="UserId">
<el-select
<el-input v-model="form.UserName" disabled />
<!-- <el-select
v-model="form.UserId"
clearable
filterable
@ -94,15 +95,15 @@
item.UserType
}}</span>
</el-option>
</el-select>
</el-select> -->
</el-form-item>
<!-- 用户类型 -->
<el-form-item
<!-- <el-form-item
v-if="form.UserId"
:label="$t('passwordReset:form:userType')"
>
<el-input v-model="form.UserType" disabled />
</el-form-item>
</el-form-item> -->
<!-- 新密码 -->
<el-form-item
class="my_new_pwd"
@ -338,11 +339,13 @@ export default {
)
.then((res) => {
this.formLoading = false
this.users = res.Result
if (this.users.length === 1) {
this.form.UserId = this.users[0].UserId
this.form.UserType = this.users[0].UserType
}
this.form.UserId = res.Result.Id
this.form.UserName = res.Result.UserName
// this.users = res.Result
// if (this.users.length === 1) {
// this.form.UserId = this.users[0].UserId
// this.form.UserType = this.users[0].UserType
// }
//
this.$message.success(
this.$t('passwordReset:message:verifiedSuccessfully')

View File

@ -83,7 +83,7 @@
<svg-icon icon-class="password" />
</span>
<!-- password -->
<!-- <el-input
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
@ -100,8 +100,8 @@
<svg-icon
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
/>
</span> -->
<el-input
</span>
<!-- <el-input
:key="passwordType"
ref="password"
v-model="pwdCover"
@ -115,7 +115,7 @@
/>
<span class="show-pwd" @click="hidePassword">
<svg-icon :icon-class="!isShowPassword ? 'eye' : 'eye-open'" />
</span>
</span> -->
</el-form-item>
<!-- Login -->
<el-button
@ -243,6 +243,13 @@
</div>
</el-dialog>
<browserTip ref="browserTip" />
<toggleRole
v-if="toggleRoleVisible"
:visible.sync="toggleRoleVisible"
:loading="toggleRoleLoading"
@save="loginByRole"
@cancel="cancel"
/>
</div>
</template>
@ -253,9 +260,10 @@ import TopLang from './topLang'
import Vcode from 'vue-puzzle-vcode'
import browserTip from '@/views/dictionary/template/browser/tip.vue'
import Img1 from '@/assets/pic-2.png'
import toggleRole from '@/components/toggleRole'
export default {
name: 'Login',
components: { TopLang, Vcode, browserTip },
components: { TopLang, Vcode, browserTip, toggleRole },
data() {
return {
NODE_ENV: process.env.NODE_ENV, // process.env.NODE_ENV
@ -298,6 +306,8 @@ export default {
isShow: false,
showCode: false,
Img1,
toggleRoleVisible: false,
toggleRoleLoading: false,
}
},
computed: {
@ -318,6 +328,7 @@ export default {
},
},
mounted() {
zzSessionStorage.clear()
this.loginType = this.$route.query.loginType
this.location = this.$route.query.location
zzSessionStorage.setItem('loginType', this.loginType)
@ -416,37 +427,79 @@ export default {
// this.$alert(this.$t('login:message:login4'), this.$t('common:title:warning'))
this.$message.warning(this.$t('login:message:login4'))
}
this.$store.dispatch('permission/generateRoutes').then((res) => {
this.loading = false
if (res && res.length > 0) {
this.$store.dispatch('global/getNoticeList')
this.$router.addRoutes(res)
if (this.loginType === 'DevOps') {
this.$router.replace({ path: res[0].path })
return
}
if (this.hasPermi(['role:radmin'])) {
this.$router.replace({ path: res[0].path })
return
}
if (
this.hasPermi(['role:air', 'role:rpm', 'role:rcrc', 'role:rir'])
) {
this.$router.replace({ path: '/trials/trials-list' })
} else {
this.$router.replace({ path: '/trials' })
}
} else {
//
this.$message.warning(this.$t('login:message:login2'))
}
})
if (
Array.isArray(this.$store.state.user.roles) &&
this.$store.state.user.roles.length === 1
) {
this.loginByRole(this.$store.state.user.roles[0].Id)
return
}
return (this.toggleRoleVisible = true)
})
.catch(() => {
this.showCode = true
this.loading = false
})
},
loginByRole(userRoleId) {
this.toggleRoleLoading = true
this.$store
.dispatch('user/loginByRole', { userRoleId })
.then((res) => {
this.toggleRoleLoading = false
if (res) {
this.$store
.dispatch('permission/generateRoutes')
.then((res) => {
this.loading = false
if (res && res.length > 0) {
this.$store.dispatch('global/getNoticeList')
this.$router.addRoutes(res)
if (this.loginType === 'DevOps') {
this.$router.replace({ path: res[0].path })
return
}
if (this.hasPermi(['role:radmin'])) {
this.$router.replace({ path: res[0].path })
return
}
if (
this.hasPermi([
'role:air',
'role:rpm',
'role:rcrc',
'role:rir',
])
) {
this.$router.replace({ path: '/trials/trials-list' })
} else {
this.$router.replace({ path: '/trials' })
}
} else {
this.toggleRoleLoading = false
//
this.$message.warning(this.$t('login:message:login2'))
}
})
.catch((err) => {
this.toggleRoleLoading = false
})
} else {
this.toggleRoleLoading = false
}
})
.catch(() => {
this.showCode = true
this.loading = false
this.toggleRoleLoading = false
})
},
cancel() {
this.showCode = true
this.loading = false
this.toggleRoleLoading = false
// this.toggleRoleVisible = false
},
onSuccess() {
this.isShow = false
this.loginIn()

View File

@ -5,24 +5,38 @@
:model="user"
:rules="userFormRules"
label-width="150px"
style="width:800px;"
style="width: 800px"
>
<el-card class="Basic" shadow="never" size="small">
<div slot="header" class="clearfix">
<span>{{ $t('system:userlist:title:Information') }}</span>
</div>
<el-form-item v-if="user.UserCode" :label="$t('system:userlist:table:S/N')" prop="UserCode">
<el-form-item
v-if="user.UserCode"
:label="$t('system:userlist:table:S/N')"
prop="UserCode"
>
<el-input v-model="user.UserCode" disabled />
</el-form-item>
<el-form-item :label="$t('system:userlist:table:UserName')" class="my_new_pwd" prop="UserName">
<el-form-item
:label="$t('system:userlist:table:UserName')"
class="my_new_pwd"
prop="UserName"
>
<el-input v-model="user.UserName" />
</el-form-item>
<el-form-item :label="$t('system:userlist:table:LastName')" prop="LastName">
<el-form-item
:label="$t('system:userlist:table:LastName')"
prop="LastName"
>
<el-input v-model="user.LastName" />
</el-form-item>
<el-form-item :label="$t('system:userlist:table:FirstName')" prop="FirstName">
<el-form-item
:label="$t('system:userlist:table:FirstName')"
prop="FirstName"
>
<el-input v-model="user.FirstName" />
</el-form-item>
<!-- <el-form-item :label="$t('system:userlist:table:Gender')" prop="Sex" style="margin-right:40px;">
@ -37,44 +51,101 @@
<el-form-item :label="$t('system:userlist:table:Phone')" prop="Phone">
<el-input v-model="user.Phone" />
</el-form-item>
<el-form-item v-if="type==1" :label="$t('system:userlist:table:Disable')">
<el-switch v-model="user.Status" :active-value="1" :inactive-value="0" />
<el-form-item
v-if="type == 1"
:label="$t('system:userlist:table:Disable')"
>
<el-switch
v-model="user.Status"
:active-value="1"
:inactive-value="0"
/>
</el-form-item>
<el-form-item :label="$t('system:userlist:table:IsTestUser')">
<el-radio-group v-model="user.IsTestUser">
<el-radio v-for="item of $d.YesOrNo" :label="item.value">{{ item.label }}</el-radio>
<el-radio
v-for="item of $d.YesOrNo"
:key="item.id"
:label="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('system:userlist:table:UserType')" prop="UserTypeId">
<el-select ref="userType" v-model="user.UserTypeId" size="small" placeholder="Please select" style="width:100%;" :disabled="user.CanEditUserType === false">
<el-option
v-for="(userType,key) of userTypeOptions"
v-if="userType.UserTypeEnum !== 20"
:key="key"
:label="userType.UserType"
:value="userType.Id"
/>
</el-select>
<el-form-item
:label="$t('system:userlist:table:UserType')"
prop="UserTypeId"
>
<div style="display: flex; align-items: center">
<el-select
ref="userType"
v-model="user.Roles"
size="small"
placeholder="Please select"
multiple
style="width: 100%"
:disabled="user.CanEditUserType === false || type === 1"
@change="handleChange"
>
<template v-for="(userType, key) of userTypeOptions">
<el-option
v-if="userType.UserTypeEnum !== 20"
:key="key"
:label="userType.UserType"
:value="userType.Id"
/>
</template>
</el-select>
<el-button
type="primary"
size="small"
style="margin-left: 5px"
v-if="type === 1"
@click.stop="openRoleList"
>
{{ $t('system:userlist:button:roles') }}
</el-button>
</div>
</el-form-item>
</el-card>
<el-card class="Affiliation" shadow="never" style="margin-top:10px;" size="small">
<el-card
class="Affiliation"
shadow="never"
style="margin-top: 10px"
size="small"
>
<div slot="header" class="clearfix">
<span>{{ $t('system:userlist:title:Affiliation') }}</span>
</div>
<el-form-item prop="IsZhiZhun">
<el-radio-group v-model="user.IsZhiZhun" @change="OrgnizationTypeChanged">
<el-radio :label="true">{{ $t('system:userlist:title:Internal') }}</el-radio>
<el-radio :label="false">{{ $t('system:userlist:title:External') }}</el-radio>
<el-radio-group
v-model="user.IsZhiZhun"
@change="OrgnizationTypeChanged"
>
<el-radio :label="true">{{
$t('system:userlist:title:Internal')
}}</el-radio>
<el-radio :label="false">{{
$t('system:userlist:title:External')
}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-show="user.IsZhiZhun === false" :label="$t('system:userlist:table:OrganizationName')">
<el-form-item
v-show="user.IsZhiZhun === false"
:label="$t('system:userlist:table:OrganizationName')"
>
<el-input v-model="user.OrganizationName" />
</el-form-item>
<el-form-item :label="$t('system:userlist:table:Department')" prop="DepartmentName">
<el-form-item
:label="$t('system:userlist:table:Department')"
prop="DepartmentName"
>
<el-input v-model="user.DepartmentName" />
</el-form-item>
<el-form-item :label="$t('system:userlist:table:Position')" prop="PositionName">
<el-form-item
:label="$t('system:userlist:table:Position')"
prop="PositionName"
>
<el-input v-model="user.PositionName" />
</el-form-item>
</el-card>
@ -83,20 +154,34 @@
type="primary"
size="small"
:disabled="isDisabled"
style="margin:10px 15px"
style="margin: 10px 15px"
@click="handleSave"
>Save</el-button>
>Save</el-button
>
</el-form-item>
<roleList
v-if="visible"
:visible.sync="visible"
:list="user.UserRoleList"
:roles.sync="user.Roles"
:userTypeOptions="userTypeOptions"
/>
</el-form>
</template>
<script>
import { getUser, addUser, updateUser, getUserTypeListByUserType } from '@/api/admin.js'
import {
getUser,
addUser,
updateUser,
getUserTypeListByUserType,
} from '@/api/admin.js'
import roleList from './roleList.vue'
export default {
name: 'UserInfo',
props: {
userId: { type: String, default: '' }
userId: { type: String, default: '' },
},
components: { roleList },
created() {
this.getUserTypeList()
if (this.userId !== '') {
@ -107,26 +192,42 @@ export default {
}
},
methods: {
updateQueryParam(param, newValue,wurl) {
openRoleList() {
this.visible = true
},
handleChange(val) {
this.user.UserRoleList = []
val.forEach((item) => {
let data = this.userTypeOptions.find((d) => d.Id === item)
this.user.UserRoleList.push({
UserTypeEnum: data.UserTypeEnum,
UserTypeId: data.Id,
IsUserRoleDisabled: false,
})
})
},
updateQueryParam(param, newValue, wurl) {
// URL
let url = wurl || window.location.href;
let url = wurl || window.location.href
//
let regex = new RegExp('([?&])' + param + '=.*?(&|$)');
let separator = url.indexOf('?') !== -1 ? '&' : '?';
let regex = new RegExp('([?&])' + param + '=.*?(&|$)')
let separator = url.indexOf('?') !== -1 ? '&' : '?'
//
if (regex.test(url)) {
return url.replace(regex, '$1' + param + '=' + newValue + '$2');
return url.replace(regex, '$1' + param + '=' + newValue + '$2')
} else {
return url + separator + param + '=' + newValue;
return url + separator + param + '=' + newValue
}
},
handleSave() {
this.$refs.userForm.validate(valid => {
this.$refs.userForm.validate((valid) => {
if (valid) {
this.isDisabled = true
const selectedUserType = this.userTypeOptions.filter(item => item.Id === this.user.UserTypeId)
const selectedUserType = this.userTypeOptions.filter(
(item) => item.Id === this.user.UserTypeId
)
let newUrl = this.updateQueryParam('userName', this.user.UserName)
newUrl = this.updateQueryParam('email', this.user.EMail, newUrl)
window.history.pushState({ path: newUrl }, '', newUrl)
@ -136,53 +237,87 @@ export default {
this.user.BaseUrl = `${location.protocol}//${location.host}/login`
this.user.RouteUrl = `${location.protocol}//${location.host}/email-recompose`
if (this.user.Id) {
updateUser(this.user).then(res => {
this.isDisabled = false
this.$message.success('Updated successfully')
}).catch(() => { this.isDisabled = false })
updateUser(this.user)
.then((res) => {
this.isDisabled = false
this.$message.success('Updated successfully')
})
.catch(() => {
this.isDisabled = false
})
} else {
addUser(this.user).then(res => {
this.isDisabled = false
this.user.Id = res.Result.Id
this.user.UserCode = res.Result.UserCode
this.$emit('getUserId', res.Result.Id)
this.$message.success('Added successfully')
this.$router.push({ path: '/system/user/list' })
}).catch(() => { this.isDisabled = false })
addUser(this.user)
.then((res) => {
this.isDisabled = false
this.user.Id = res.Result.Id
this.user.UserCode = res.Result.UserCode
this.$emit('getUserId', res.Result.Id)
this.$message.success('Added successfully')
this.$router.push({ path: '/system/user/list' })
})
.catch(() => {
this.isDisabled = false
})
}
}
})
},
getUserTypeList() {
getUserTypeListByUserType(0).then(res => {
getUserTypeListByUserType(0).then((res) => {
if (res.IsSuccess) {
this.userTypeOptions = res.Result
}
})
},
getUserInfo() {
getUser(this.userId).then(res => {
getUser({
IdentityUserId: this.userId,
}).then((res) => {
this.user = res.Result
this.user.Roles = []
this.user.UserRoleList = []
res.Result.AccountList.forEach((item) => {
if (!item.IsUserRoleDisabled) {
this.user.Roles.push(item.UserTypeId)
}
this.user.UserRoleList.push({
UserTypeEnum: item.UserTypeEnum,
UserTypeId: item.UserTypeId,
IsUserRoleDisabled: item.IsUserRoleDisabled,
UserTypeShortName: item.UserTypeShortName,
})
})
})
},
OrgnizationTypeChanged(val) {
this.user.OrganizationName = ''
}
},
},
data() {
var validatePassword = (rule, value, callback) => {
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh'
var lang = zzSessionStorage.getItem('lang')
? zzSessionStorage.getItem('lang')
: 'zh'
/* eslint-disable */
var reg1 = /^[a-zA-Z0-9_]{4,16}$/; //8
console.log(!reg1.test(value))
var reg1 = /^[a-zA-Z0-9_]{4,16}$/ //8
if (!reg1.test(value)) {
callback(lang==='zh' ? new Error("1新建账号用户名字符长度最小为4个字符最大为16个字符只可使用字母、数字、下划线") : new Error('For a new account, the username must have:1) At least 4 characters;2) At most 16 characters;3)Only letters, numbers, and underscores are allowed.'))
callback(
lang === 'zh'
? new Error(
'1新建账号用户名字符长度最小为4个字符最大为16个字符只可使用字母、数字、下划线'
)
: new Error(
'For a new account, the username must have:1) At least 4 characters;2) At most 16 characters;3)Only letters, numbers, and underscores are allowed.'
)
)
} else {
callback();
callback()
}
}
return {
user: {
Roles: [],
UserRoleList: [],
UserName: '',
LastName: '',
FirstName: '',
@ -194,65 +329,75 @@ export default {
OrganizationName: '',
DepartmentName: '',
PositionName: '',
IsTestUser: false
IsTestUser: false,
},
visible: false,
userFormRules: {
UserName: [
{ required: true, validator: validatePassword, trigger: 'blur' }
{ required: true, validator: validatePassword, trigger: 'blur' },
],
UserTypeId: [
{ required: true, message: 'Please Select', trigger: ['blur', 'change'] }
Roles: [
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
IsZhiZhun: [
{ required: true, message: 'Please Select', trigger: ['blur', 'change'] }
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
OrganizationName: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ required: true, message: 'Please specify', trigger: 'blur' },
],
LastName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' }
{ max: 50, message: 'The maximum length is 50' },
],
FirstName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' }
{ max: 50, message: 'The maximum length is 50' },
],
Phone: [
{ max: 20, min: 7, message: 'The length is 7 to 20', trigger: ['blur'] }
{
max: 20,
min: 7,
message: 'The length is 7 to 20',
trigger: ['blur'],
},
],
EMail: [
{
required: true,
message: 'Please input the email address',
trigger: 'blur'
trigger: 'blur',
},
{
type: 'email',
message: 'Please input the correct email address',
trigger: ['blur']
trigger: ['blur'],
},
{ max: 50, message: 'The maximum length is 50' }
],
Sex: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ max: 50, message: 'The maximum length is 50' },
],
Sex: [{ required: true, message: 'Please specify', trigger: 'blur' }],
Status: [
{ required: true, message: 'Please specify', trigger: 'blur' }
{ required: true, message: 'Please specify', trigger: 'blur' },
],
DepartmentName: [
{ max: 50, message: 'The maximum length is 50' }],
PositionName: [{ max: 50, message: 'The maximum length is 50' }
]
DepartmentName: [{ max: 50, message: 'The maximum length is 50' }],
PositionName: [{ max: 50, message: 'The maximum length is 50' }],
},
userTypeOptions: [],
isDisabled: false,
type: 0 // 10
type: 0, // 10
}
}
},
}
</script>
<style scoped>
/deep/ .is-error.my_new_pwd{
::v-deep .is-error.my_new_pwd {
margin-bottom: 40px;
}
</style>

View File

@ -0,0 +1,196 @@
<template>
<el-dialog
v-if="visible"
:visible.sync="visible"
v-dialogDrag
width="540px"
:close-on-click-modal="false"
:close-on-press-escape="false"
append-to-body
:show-close="false"
:title="$t('system:userlist:roleList:title')"
:before-close="cancel"
>
<el-button
size="mini"
type="primary"
@click.stop="openAdd"
style="float: right"
>
{{ $t('common:button:new') }}
</el-button>
<el-table :data="list" style="width: 100%" max-height="300px">
<el-table-column type="index" width="40" />
<el-table-column
prop="UserTypeShortName"
:label="$t('system:userlist:roleList:table:UserTypeShortName')"
/>
<el-table-column
prop="IsUserRoleDisabled"
:label="$t('system:userlist:roleList:table:IsUserRoleDisabled')"
>
<template slot-scope="scope">
<span> {{ $fd('IsEnable', !scope.row.IsUserRoleDisabled) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('common:action:action')" width="120px">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
:disabled="scope.row.IsUserRoleDisabled"
@click.stop="scope.row.IsUserRoleDisabled = true"
>
{{ $fd('IsEnable', false) }}
</el-button>
<el-button
size="mini"
type="text"
:disabled="!scope.row.IsUserRoleDisabled"
@click.stop="scope.row.IsUserRoleDisabled = false"
>
{{ $fd('IsEnable', true) }}
</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer">
<!-- 保存 -->
<el-button type="primary" size="small" @click="save">
{{ $t('common:button:confirm') }}
</el-button>
</div>
<el-dialog
v-if="addVisible"
:visible.sync="addVisible"
v-dialogDrag
:close-on-click-modal="false"
:close-on-press-escape="false"
append-to-body
width="540px"
:title="$t('system:userlist:roleList:addTitle')"
>
<el-form ref="addForm" :model="form" :rules="rule" label-width="80px">
<el-form-item :label="$t('system:userlist:table:UserType')">
<el-select
v-model="form.roles"
size="small"
placeholder=""
multiple
style="width: 100%"
>
<template v-for="item of roleList">
<el-option
:key="item.Id"
:label="item.UserType"
:value="item.Id"
/>
</template>
</el-select>
</el-form-item>
</el-form>
<div slot="footer">
<!-- 保存 -->
<el-button type="primary" size="small" @click="saveAdd">
{{ $t('common:button:confirm') }}
</el-button>
<!-- 取消 -->
<el-button size="small" @click="addVisible = false">
{{ $t('common:button:cancel') }}
</el-button>
</div>
</el-dialog>
</el-dialog>
</template>
<script>
export default {
name: 'roleList',
props: {
visible: {
type: Boolean,
default: false,
},
list: {
type: Array,
default: () => {
return []
},
},
roles: {
type: Array,
default: () => {
return []
},
},
userTypeOptions: {
type: Array,
default: () => {
return []
},
},
},
data() {
return {
addVisible: false,
form: {
roles: [],
},
rule: {
roles: [
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
},
}
},
computed: {
roleList() {
let arr = this.list.map((item) => item.UserTypeId)
return this.userTypeOptions.filter(
(item) => !arr.includes(item.Id) && item.UserTypeEnum !== 20
)
},
},
methods: {
cancel() {
this.$emit('update:visible', false)
},
openAdd() {
this.addVisible = true
},
save() {
let roles = []
this.list.forEach((item) => {
if (!item.IsUserRoleDisabled) {
roles.push(item.UserTypeId)
}
})
this.$emit('update:roles', roles)
this.$emit('update:visible', false)
},
async saveAdd() {
try {
let validate = await this.$refs.addForm.validate()
if (!validate) return
let arr = this.userTypeOptions.filter((item) =>
this.form.roles.includes(item.Id)
)
arr.forEach((item) => {
this.list.push({
UserTypeEnum: item.UserTypeEnum,
UserTypeId: item.Id,
IsUserRoleDisabled: false,
UserTypeShortName: item.UserTypeShortName,
})
})
this.addVisible = false
} catch (err) {
console.log(err)
}
},
},
}
</script>

View File

@ -35,6 +35,16 @@
<template slot="genderSlot" slot-scope="{ scope }">
{{ scope.row.Sex ? 'Male' : 'Female' }}
</template>
<template slot="UserTypeSlot" slot-scope="{ scope }">
{{
Array.isArray(scope.row.UserRoleList) &&
scope.row.UserRoleList.length > 0
? scope.row.UserRoleList.map((item) => item.UserTypeShortName).join(
','
)
: ''
}}
</template>
<template slot="roleSlot" slot-scope="{ scope }">
{{ scope.row.RoleNameList.map((role) => role.RoleName).join(',') }}
</template>
@ -115,7 +125,7 @@ export default {
showOverflowTooltip: true,
},
{
prop: 'RealName',
prop: 'FullName',
label: this.$t('system:userlist:table:RealName'),
minWidth: 120,
sortable: 'custom',
@ -154,6 +164,7 @@ export default {
prop: 'UserType',
label: this.$t('system:userlist:table:UserType'),
minWidth: 100,
slot: 'UserTypeSlot',
sortable: 'custom',
showOverflowTooltip: true,
},

View File

@ -44,7 +44,6 @@ export default {
this.$i18n.locale = lang
this.setLanguage(lang)
this.$updateDictionary()
console.log(Vue)
this.$upload()
window.location.reload()
}

View File

@ -11,7 +11,7 @@
<img v-else src="@/assets/zzlogo4.png" alt="" />
<span style="white-space: nowrap" v-if="NODE_ENV !== 'usa'">
<!-- 中心影像系统EICS -->
{{ $t("trials:trials:title:eics") }}
{{ $t('trials:trials:title:eics') }}
</span>
</div>
<div class="center-menu">
@ -39,13 +39,17 @@
>
<i class="el-icon-odometer" />
<!-- 工作台 -->
<span slot="title">{{ $t("trials:menuTitle:workbench") }}</span>
<span slot="title">{{ $t('trials:menuTitle:workbench') }}</span>
</el-menu-item>
<el-menu-item v-if="!hasPermi(['role:zys','role:zyss','role:zybs'])" index="2" :disabled="TotalNeedSignSystemDocCount !== 0">
<el-menu-item
v-if="!hasPermi(['role:zys', 'role:zyss', 'role:zybs'])"
index="2"
:disabled="TotalNeedSignSystemDocCount !== 0"
>
<i class="el-icon-box" />
<!-- 我的项目 -->
<span slot="title">
{{ $t("trials:tab:trials") }}
{{ $t('trials:tab:trials') }}
</span>
</el-menu-item>
<el-menu-item
@ -63,7 +67,7 @@
>
<i class="el-icon-chat-dot-square" />
<!-- 通知消息 -->
<span slot="title">{{ $t("trials:tab:notice") }}</span>
<span slot="title">{{ $t('trials:tab:notice') }}</span>
</el-menu-item>
<el-submenu index="4" class="my_info">
@ -75,128 +79,214 @@
</span>
<!-- 账户信息 -->
<el-menu-item v-if="!hasPermi(['role:air'])" index="4-2">{{
$t("trials:trials-myinfo:title:accountInfo")
$t('trials:trials-myinfo:title:accountInfo')
}}</el-menu-item>
<!-- 管理后台 -->
<el-menu-item
v-if="hasPermi(['role:dev', 'role:oa', 'role:admin'])"
index="4-4"
>{{ $t("trials:trials-myinfo:title:system") }}</el-menu-item
>{{ $t('trials:trials-myinfo:title:system') }}</el-menu-item
>
<!-- 切换角色 -->
<el-menu-item index="4-5" v-if="hasRole">{{
$t('trials:trials-myinfo:title:toggleRole')
}}</el-menu-item>
<!-- 退出 -->
<el-menu-item index="4-3">{{
$t("trials:trials-myinfo:button:loginout")
$t('trials:trials-myinfo:button:loginout')
}}</el-menu-item>
</el-submenu>
</el-menu>
<TopLang v-if="VUE_APP_OSS_CONFIG_REGION !== 'oss-us-west-1'&& NODE_ENV !== 'usa'" />
<TopLang
v-if="
VUE_APP_OSS_CONFIG_REGION !== 'oss-us-west-1' && NODE_ENV !== 'usa'
"
/>
</div>
<toggleRole
v-if="toggleRoleVisible"
:visible.sync="toggleRoleVisible"
:loading="toggleRoleLoading"
@save="loginByRole"
/>
</div>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import TopLang from "./topLang";
import NoticeMarquee from "./noticeMarquee";
import { mapGetters, mapMutations } from 'vuex'
import TopLang from './topLang'
import NoticeMarquee from './noticeMarquee'
import toggleRole from '@/components/toggleRole'
export default {
components: { TopLang, NoticeMarquee },
components: { TopLang, NoticeMarquee, toggleRole },
data() {
return {
activeIndex: "2",
activeIndex: '2',
isReviewer: false,
userTypeShortName: zzSessionStorage.getItem("userTypeShortName"),
notice: "",
userTypeShortName: zzSessionStorage.getItem('userTypeShortName'),
notice: '',
VUE_APP_OSS_CONFIG_REGION: process.env.VUE_APP_OSS_CONFIG_REGION,
NODE_ENV: process.env.NODE_ENV,
};
toggleRoleVisible: false,
toggleRoleLoading: false,
}
},
computed: {
...mapGetters([
"sidebar",
"name",
"userName",
"device",
"TotalNeedSignSystemDocCount",
"language",
'sidebar',
'name',
'userName',
'device',
'TotalNeedSignSystemDocCount',
'language',
]),
roles() {
return this.$store.state.user.roles
},
hasRole() {
return this.roles && this.roles.length > 1
},
},
watch: {
$route(v) {
this.changeRoute(v);
this.changeRoute(v)
},
},
created() {
console.log(!this.hasPermi(["role:air"]));
this.isReviewer = JSON.parse(zzSessionStorage.getItem("IsReviewer"));
this.changeRoute(this.$route);
// this.isReviewer = JSON.parse(zzSessionStorage.getItem('IsReviewer'))
this.changeRoute(this.$route)
},
methods: {
...mapMutations({ setLanguage: "lang/setLanguage" }),
...mapMutations({ setLanguage: 'lang/setLanguage' }),
changeRoute(v) {
if (v.path === "/trials/trials-workbench") {
this.activeIndex = "1";
if (v.path === '/trials/trials-workbench') {
this.activeIndex = '1'
}
if (
v.path === "/trials/trials-list" ||
~v.path.indexOf("/trials/trials-panel")
v.path === '/trials/trials-list' ||
~v.path.indexOf('/trials/trials-panel')
) {
this.activeIndex = "2";
this.activeIndex = '2'
}
if (v.path === "/trials/trials-notice") {
this.activeIndex = "3";
if (v.path === '/trials/trials-notice') {
this.activeIndex = '3'
}
if (v.path === "/trials/trials-myinfo") {
this.activeIndex = "4-2";
if (v.path === '/trials/trials-myinfo') {
this.activeIndex = '4-2'
}
},
handleSelect(key, keyPath) {
switch (key) {
case "4-2":
this.go("/trials/trials-myinfo");
break;
case "4-3":
this.logout();
break;
case "4-4":
this.go("/dashboard/list");
break;
case "1":
this.go("/trials/trials-workbench");
break;
case "2":
if (~this.$route.path.indexOf("/trials/trials-panel")) {
return;
case '4-2':
this.go('/trials/trials-myinfo')
break
case '4-3':
this.logout()
break
case '4-4':
this.go('/dashboard/list')
break
case '4-5':
// this.go('/dashboard/list')
// console.log('')
this.$store.dispatch('user/getUserInfo').then((res) => {
this.toggleRoleVisible = true
})
break
case '1':
this.go('/trials/trials-workbench')
break
case '2':
if (~this.$route.path.indexOf('/trials/trials-panel')) {
return
}
var lastWorkbench = zzSessionStorage.getItem("lastWorkbench");
var lastWorkbench = zzSessionStorage.getItem('lastWorkbench')
if (lastWorkbench) {
this.go(lastWorkbench);
this.go(lastWorkbench)
} else {
this.go("/trials/trials-list");
this.go('/trials/trials-list')
}
break;
case "3":
this.go("/trials/trials-notice");
break;
break
case '3':
this.go('/trials/trials-notice')
break
}
},
toggleSideBar() {
this.$store.dispatch("app/toggleSideBar");
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
await this.$store.dispatch("user/logout");
this.$router.push(`/login`);
this.$i18n.locale = "zh";
this.setLanguage("zh");
this.$updateDictionary();
await this.$store.dispatch('user/logout')
this.$router.push(`/login`)
this.$i18n.locale = 'zh'
this.setLanguage('zh')
this.$updateDictionary()
},
go(value) {
this.$router.push({ path: value });
this.$router.push({ path: value })
},
account() {
this.$router.push({ name: "Account" });
this.$router.push({ name: 'Account' })
},
loginByRole(userRoleId) {
if (this.$store.state.user.userId === userRoleId) {
this.toggleRoleVisible = false
this.toggleRoleLoading = false
return false
}
this.toggleRoleLoading = true
this.$store
.dispatch('user/loginByRole', { userRoleId })
.then((res) => {
if (res) {
this.$store
.dispatch('permission/generateRoutes')
.then(async (res) => {
if (res && res.length > 0) {
await this.$store.dispatch('global/getNoticeList')
this.$router.addRoutes(res)
this.toggleRoleLoading = false
if (this.loginType === 'DevOps') {
this.$router.replace({ path: res[0].path })
return
}
if (this.hasPermi(['role:radmin'])) {
this.$router.replace({ path: res[0].path })
return
}
if (
this.hasPermi([
'role:air',
'role:rpm',
'role:rcrc',
'role:rir',
])
) {
this.$router.replace({ path: '/trials/trials-list' })
} else {
this.$router.replace({ path: '/trials' })
}
window.location.reload()
} else {
//
this.toggleRoleLoading = false
this.$message.warning(this.$t('login:message:login2'))
}
})
.catch((err) => {
this.toggleRoleLoading = false
})
} else {
this.toggleRoleLoading = false
}
})
.catch(() => {
this.toggleRoleLoading = false
})
},
},
};
}
</script>
<style lang="scss" scoped>

View File

@ -108,6 +108,35 @@
{{ $t('trials:trials-myinfo:button:update') }}
</el-button>
</el-form-item>
<el-form-item
:label="$t('trials:trials-myinfo:form:toggleRole')"
style="position: relative"
prop="VerificationCode"
v-if="hasRole"
>
<el-radio-group v-model="userRoleId" class="roles" v-if="hasRole">
<el-radio
v-for="item in roles"
:key="item.Id"
:label="item.Id"
:disabled="item.isUserRoleDisabled"
style="margin-bottom: 10px"
>
{{ item.UserTypeShortName }}
</el-radio>
</el-radio-group>
<!-- 修改 -->
<el-button
:disabled="!userRoleId"
class="saveBtn"
:loading="toggleRoleLoading"
type="primary"
size="small"
@click="toggleRole"
>
{{ $t('trials:trials-myinfo:button:toggleRole') }}
</el-button>
</el-form-item>
</el-form>
</div>
<password />
@ -142,6 +171,8 @@ export default {
data() {
return {
userForm: {},
userRoleId: null,
toggleRoleLoading: false,
sendDisabled: true,
sendTitle: this.$t('trials:trials-myinfo:button:getVCode'),
rule: {
@ -174,7 +205,35 @@ export default {
},
}
},
created() {
this.userRoleId = zzSessionStorage.getItem('userId')
},
computed: {
roles() {
return this.$store.state.user.roles
},
hasRole() {
return this.roles && this.roles.length > 1
},
},
methods: {
//
toggleRole() {
if (
this.userRoleId === zzSessionStorage.getItem('userId') ||
this.toggleRoleLoading
)
return false
this.toggleRoleLoading = true
this.$store
.dispatch('user/loginByRole', { userRoleId: this.userRoleId })
.then((res) => {
window.location.reload()
})
.catch(() => {
this.toggleRoleLoading = false
})
},
setNewEmail() {
setNewEmail(this.userForm.EMail, this.userForm.VerificationCode).then(
() => {

View File

@ -107,11 +107,11 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.07)',
})
getUser(this.userId)
getUser()
.then(async (res) => {
this.user = res.Result
/* eslint-disable */
zzSessionStorage.setItem('realName', this.user.RealName)
zzSessionStorage.setItem('Name', this.user.FullName)
await store.dispatch('user/updateInfo')
loading.close()
})

View File

@ -82,7 +82,7 @@
</div>
</template>
<script>
import { updateUser } from "@/api/admin.js";
import { updateUserBasicInfo } from "@/api/admin.js";
export default {
name: "mine",
props: {
@ -179,7 +179,7 @@ export default {
// this.user.OrganizationName = 'ZhiZhun'
// }
if (this.user.Id) {
updateUser(this.user)
updateUserBasicInfo(this.user)
.then((res) => {
this.isDisabled = false;
this.$message.success(

View File

@ -109,15 +109,13 @@ export default {
this.TrialSiteId = row.TrialSiteId
this.config.title = this.$t(
'trials:trials-panel:setting:personnel-manage:dicomAETitle'
).replace('xxx', `${row.TrialSiteCode}${row.TrialSiteAliasName}`)
)
.replace('xxx', `${row.TrialSiteCode}`)
.replace('yyy', `${row.TrialSiteAliasName}`)
this.siteData = row
this.config.visible = true
this.getList()
console.log(
this.hasPermi([
'trials:trials-panel:setting:personnel-manage:edit-site',
])
)
},
// dicomAE
async getList() {

View File

@ -47,26 +47,26 @@
:disabled="loading"
@click="config.visible = false"
>
{{ $t("common:button:cancel") }}
{{ $t('common:button:cancel') }}
</el-button>
<el-button type="primary" size="small" :loading="loading" @click="save">
{{ $t("common:button:save") }}
{{ $t('common:button:save') }}
</el-button>
</template>
</base-model>
</template>
<script>
import { addOrUpdateTrialSiteDicomAE } from "@/api/trials";
import BaseModel from "@/components/BaseModel";
import { addOrUpdateTrialSiteDicomAE } from '@/api/trials'
import BaseModel from '@/components/BaseModel'
export default {
name: "dicomForm",
name: 'dicomForm',
components: { BaseModel },
data() {
return {
config: {
visible: false,
title: null,
width: "600px",
width: '600px',
appendToBody: true,
},
form: {
@ -80,128 +80,127 @@ export default {
CallingAE: [
{
required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{
pattern: /[a-zA-Z0-9]/,
message: this.$t("common:ruleMessage:CallingAEPattern"),
trigger: "blur",
message: this.$t('common:ruleMessage:CallingAEPattern'),
trigger: 'blur',
},
{
min: 1,
max: 16,
message: this.$t("common:ruleMessage:CallingAEPattern"),
trigger: "blur",
message: this.$t('common:ruleMessage:CallingAEPattern'),
trigger: 'blur',
},
],
Ip: [
{
required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{
validator: (rule, value, callback) => {
if (
value === "" ||
typeof value === "undefined" ||
value === '' ||
typeof value === 'undefined' ||
value == null
) {
callback(new Error(this.$t("common:ruleMessage:ipPattern")));
callback(new Error(this.$t('common:ruleMessage:ipPattern')))
} else {
const reg =
/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
if (!reg.test(value) && value !== "") {
callback(new Error(this.$t("common:ruleMessage:ipPattern")));
/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
if (!reg.test(value) && value !== '') {
callback(new Error(this.$t('common:ruleMessage:ipPattern')))
} else {
callback();
callback()
}
}
},
message: this.$t("common:ruleMessage:ipPattern"),
trigger: "blur",
message: this.$t('common:ruleMessage:ipPattern'),
trigger: 'blur',
},
],
Port: [
{
required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{
type: "number",
type: 'number',
min: 0,
max: 65535,
message: this.$t("common:ruleMessage:portPattern"),
trigger: "blur",
message: this.$t('common:ruleMessage:portPattern'),
trigger: 'blur',
},
{
validator: (rule, value, callback) => {
if (
value &&
(String(value).includes(".") ||
(String(value).includes('.') ||
new RegExp(/\D/g).test(String(value)))
) {
callback(new Error(this.$t("common:ruleMessage:portPattern")));
callback(new Error(this.$t('common:ruleMessage:portPattern')))
} else {
callback();
callback()
}
},
trigger: "blur",
trigger: 'blur',
},
],
},
siteData: {},
loading: false,
status: "add",
};
status: 'add',
}
},
methods: {
open(siteData, data = null, status = "add") {
this.siteData = siteData;
this.status = status;
open(siteData, data = null, status = 'add') {
this.siteData = siteData
this.status = status
Object.keys(this.form).forEach((key) => {
this.form[key] = null;
});
if (data && status === "edit") {
this.form[key] = null
})
if (data && status === 'edit') {
Object.keys(this.form).forEach((key) => {
this.form[key] = data[key];
});
this.form.Ip = data.IP;
this.form[key] = data[key]
})
this.form.Ip = data.IP
}
this.config.title = this.$t(
"trials:trials-panel:setting:personnel-manage:dicomAETitle"
).replace(
"xxx",
`${siteData.TrialSiteCode}${siteData.TrialSiteAliasName}`
);
this.config.visible = true;
'trials:trials-panel:setting:personnel-manage:dicomAETitle'
)
.replace('xxx', `${siteData.TrialSiteCode}`)
.replace('yyy', `${siteData.TrialSiteAliasName}`)
this.config.visible = true
},
//
async save() {
try {
let validate = await this.$refs.dicomForm.validate();
if (!validate) return false;
this.loading = true;
this.form.TrialSiteId = this.siteData.TrialSiteId;
this.form.TrialId = this.$route.query.trialId;
let res = await addOrUpdateTrialSiteDicomAE(this.form);
this.loading = false;
let validate = await this.$refs.dicomForm.validate()
if (!validate) return false
this.loading = true
this.form.TrialSiteId = this.siteData.TrialSiteId
this.form.TrialId = this.$route.query.trialId
let res = await addOrUpdateTrialSiteDicomAE(this.form)
this.loading = false
if (res.IsSuccess) {
this.status === "add"
? this.$t("common:message:savedSuccessfully")
: this.$t("common:message:savedFail");
this.$emit("getList");
this.$emit("save");
this.config.visible = false;
this.status === 'add'
? this.$t('common:message:savedSuccessfully')
: this.$t('common:message:savedFail')
this.$emit('getList')
this.$emit('save')
this.config.visible = false
}
} catch (err) {
console.log(err);
this.loading = false;
console.log(err)
this.loading = false
}
},
},
};
}
</script>
<style lang="scss" scoped></style>

View File

@ -150,12 +150,7 @@
min-width="100"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.UserCount > 0"
size="small"
type="text"
@click="getCrcList(scope.row)"
>
<el-button size="small" type="text" @click="getCrcList(scope.row)">
{{
scope.row.UserNameList.length > 0
? scope.row.UserNameList.join(', ')
@ -412,7 +407,7 @@
>
<!-- 姓名 -->
<el-table-column
prop="UserRealName"
prop="FullName"
:label="$t('trials:internalStaff:table:name')"
min-width="100"
show-overflow-tooltip

View File

@ -16,7 +16,12 @@
<el-select v-model="listQuery.UserTypeId" clearable class="mr">
<el-option
v-for="item of userTypeOptions"
v-show="item.UserTypeEnum !== 8 && item.UserTypeEnum !== 31 && item.UserTypeEnum !== 26 && item.UserTypeEnum !== 27"
v-show="
item.UserTypeEnum !== 8 &&
item.UserTypeEnum !== 31 &&
item.UserTypeEnum !== 26 &&
item.UserTypeEnum !== 27
"
:key="item.Id"
:label="item.UserTypeShortName"
:value="item.Id"
@ -32,8 +37,13 @@
<!-- 状态 -->
<el-form-item :label="$t('trials:staff:table:status')">
<el-select v-model="listQuery.IsDeleted" clearable class="mr">
<el-option v-for="item of $d.IsUserExitTrial" :label="item.label" :value="item.value" :key="item.id" />
<!-- <el-option label="加入" :value="false" />-->
<el-option
v-for="item of $d.IsUserExitTrial"
:label="item.label"
:value="item.value"
:key="item.id"
/>
<!-- <el-option label="加入" :value="false" />-->
</el-select>
</el-form-item>
<el-form-item>
@ -42,14 +52,20 @@
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
<el-button
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t('common:button:reset') }}
</el-button>
<!-- 添加系统用户 -->
<el-button
v-hasPermi="['trials:trials-panel:setting:personnel-manage:add-internal-staff']"
v-hasPermi="[
'trials:trials-panel:setting:personnel-manage:add-internal-staff',
]"
type="primary"
style="margin-left:10px"
style="margin-left: 10px"
icon="el-icon-plus"
@click="handleAdd('Add')"
>
@ -57,7 +73,9 @@
</el-button>
<!-- 添加外部人员 -->
<el-button
v-hasPermi="['trials:trials-panel:setting:personnel-manage:add-external-staff']"
v-hasPermi="[
'trials:trials-panel:setting:personnel-manage:add-external-staff',
]"
type="primary"
icon="el-icon-plus"
@click="handleAdd('External')"
@ -88,7 +106,7 @@
<el-table-column type="index" width="50" />
<!-- 姓名 -->
<el-table-column
prop="UserRealName"
prop="FullName"
:label="$t('trials:staff:table:name')"
show-overflow-tooltip
sortable
@ -109,7 +127,24 @@
show-overflow-tooltip
sortable
width="140"
/>
>
<template slot-scope="scope">
<el-button
v-if="
Array.isArray(scope.row.TrialUserRoleList) &&
scope.row.TrialUserRoleList.length > 0
"
type="text"
@click.stop="openRoleList(scope.row)"
>
<span>{{
scope.row.TrialUserRoleList.map(
(item) => item.UserTypeShortName
).join(',')
}}</span>
</el-button>
</template>
</el-table-column>
<!-- 联系电话 -->
<el-table-column
prop="Phone"
@ -143,8 +178,12 @@
min-width="40"
>
<template slot-scope="scope">
<el-tag v-if="scope.row.IsDeleted" type="danger">{{ $fd('IsUserExitTrial', scope.row.IsDeleted) }}</el-tag>
<el-tag v-else>{{ $fd('IsUserExitTrial', scope.row.IsDeleted) }}</el-tag>
<el-tag v-if="scope.row.IsDeleted" type="danger">{{
$fd('IsUserExitTrial', scope.row.IsDeleted)
}}</el-tag>
<el-tag v-else>{{
$fd('IsUserExitTrial', scope.row.IsDeleted)
}}</el-tag>
</template>
</el-table-column>
<!-- 加入日期 -->
@ -156,7 +195,11 @@
width="160"
>
<template slot-scope="scope">
{{ scope.row.JoinTime?moment(scope.row.JoinTime).format('YYYY-MM-DD'):'' }}
{{
scope.row.JoinTime
? moment(scope.row.JoinTime).format('YYYY-MM-DD')
: ''
}}
</template>
</el-table-column>
<!-- 退出日期 -->
@ -168,25 +211,29 @@
width="160"
>
<template slot-scope="scope">
{{ scope.row.RemoveTime? moment(scope.row.RemoveTime).format('YYYY-MM-DD'):'' }}
{{
scope.row.RemoveTime
? moment(scope.row.RemoveTime).format('YYYY-MM-DD')
: ''
}}
</template>
</el-table-column>
<!-- 授权时间 -->
<el-table-column
<!-- <el-table-column
prop="CreateTime"
:label="$t('trials:staff:table:authorizationTime')"
show-overflow-tooltip
sortable
width="180"
/>
/> -->
<!-- 禁用时间 -->
<el-table-column
<!-- <el-table-column
prop="DeletedTime"
:label="$t('trials:staff:table:disableTime')"
show-overflow-tooltip
sortable
min-width="60"
/>
/> -->
<el-table-column
v-if="hasPermi(['trials:trials-panel:setting:personnel-manage:status'])"
@ -199,7 +246,9 @@
circle
:title="$t('trials:staff:action:status')"
icon="el-icon-edit-outline"
:disabled="hasPermi(['role:pm']) && scope.row.UserTypeEnum*1===1"
:disabled="
hasPermi(['role:pm']) && scope.row.UserTypeEnum * 1 === 1
"
@click="handleStatus(scope.row)"
/>
</template>
@ -207,30 +256,60 @@
</el-table>
<!-- 分页组件 -->
<div class="pagination" style="text-align:right">
<pagination :total="total" :page.sync="listQuery.PageIndex" :limit.sync="listQuery.PageSize" @pagination="getList" />
<div class="pagination" style="text-align: right">
<pagination
:total="total"
:page.sync="listQuery.PageIndex"
:limit.sync="listQuery.PageSize"
@pagination="getList"
/>
</div>
<!-- 分配参与人员模态框 -->
<base-model v-if="staff_model.visible" :config="staff_model">
<template slot="dialog-body">
<StaffForm v-if="isAdd == 'Add'" @closeDialog="closeDialog" />
<StaffExternalForm v-else @closeDialog="closeDialog" @getList="getList" />
<StaffExternalForm
v-else
@closeDialog="closeDialog"
@getList="getList"
/>
</template>
</base-model>
<!-- 修改参与者人员状态 -->
<base-model v-if="status_model.visible" :config="status_model">
<template slot="dialog-body">
<el-form ref="statusForm" :model="statusForm" label-width="110px" size="small" :rules="statusRules">
<el-form
ref="statusForm"
:model="statusForm"
label-width="110px"
size="small"
:rules="statusRules"
>
<!-- Status -->
<el-form-item :label="$t('trials:staff:table:status')" prop="isDeleted">
<el-radio-group v-model="statusForm.isDeleted" @change="handleIsDeletedChanged">
<el-radio v-for="item of $d.IsUserExitTrial" :label="item.value" :key="item.id">{{ item.label }}</el-radio>
<el-form-item
:label="$t('trials:staff:table:status')"
prop="isDeleted"
>
<el-radio-group
v-model="statusForm.isDeleted"
@change="handleIsDeletedChanged"
>
<el-radio
v-for="item of $d.IsUserExitTrial"
:label="item.value"
:key="item.id"
>{{ item.label }}</el-radio
>
</el-radio-group>
</el-form-item>
<!-- 退出日期 -->
<el-form-item v-if="statusForm.isDeleted" :label="$t('trials:staff:table:exitTime')" prop="removeTime">
<el-form-item
v-if="statusForm.isDeleted"
:label="$t('trials:staff:table:exitTime')"
prop="removeTime"
>
<el-date-picker
v-model="statusForm.removeTime"
type="date"
@ -240,7 +319,11 @@
/>
</el-form-item>
<!-- 加入日期 -->
<el-form-item v-else :label="$t('trials:staff:table:joinTime')" prop="joinTime">
<el-form-item
v-else
:label="$t('trials:staff:table:joinTime')"
prop="joinTime"
>
<el-date-picker
v-model="statusForm.joinTime"
type="date"
@ -250,21 +333,114 @@
/>
</el-form-item>
</el-form>
</template>
<template slot="dialog-footer">
<el-button :disabled="btnLoading" size="small" type="primary" @click="status_model.visible = false">
<el-button
:disabled="btnLoading"
size="small"
type="primary"
@click="status_model.visible = false"
>
{{ $t('common:button:cancel') }}
</el-button>
<el-button size="small" type="primary" :loading="btnLoading" @click="saveStatus">
<el-button
size="small"
type="primary"
:loading="btnLoading"
@click="saveStatus"
>
{{ $t('common:button:save') }}
</el-button>
</template>
</base-model>
<!-- 修改参与者人员角色 -->
<base-model v-if="role_model.visible" :config="role_model">
<template slot="dialog-body">
<el-table :data="roleList" style="width: 100%" max-height="300px">
<el-table-column type="index" width="40" />
<el-table-column
prop="UserTypeShortName"
:label="
$t(
'trials:trials-panel:setting:personnel-manage:table:UserTypeShortName'
)
"
/>
<el-table-column
prop="IsDeleted"
:label="
$t(
'trials:trials-panel:setting:personnel-manage:table:IsUserRoleDisabled'
)
"
>
<template slot-scope="scope">
<span> {{ $fd('IsEnable', !scope.row.IsDeleted) }}</span>
</template>
</el-table-column>
<el-table-column
prop="IsDeleted"
:label="
$t(
'trials:trials-panel:setting:personnel-manage:table:enableTime'
)
"
min-width="120px"
>
<template slot-scope="scope">
<span v-if="!scope.row.IsDeleted">
{{ scope.row.UpdateTime }}
</span>
</template>
</el-table-column>
<el-table-column
prop="IsDeleted"
:label="
$t(
'trials:trials-panel:setting:personnel-manage:table:forbiddenTime'
)
"
min-width="120px"
>
<template slot-scope="scope">
<span v-if="scope.row.IsDeleted">
{{ scope.row.UpdateTime }}
</span>
</template>
</el-table-column>
<el-table-column :label="$t('common:action:action')" width="120px">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
:disabled="scope.row.IsDeleted"
@click.stop="changeRoleStatus(scope.row, true)"
>
{{ $fd('IsEnable', false) }}
</el-button>
<el-button
size="mini"
type="text"
:disabled="!scope.row.IsDeleted"
@click.stop="changeRoleStatus(scope.row, false)"
>
{{ $fd('IsEnable', true) }}
</el-button>
</template>
</el-table-column>
</el-table>
</template>
</base-model>
</div>
</template>
<script>
import { getMaintenanceList, getTrialUserTypeList, updateTrialUser, trialUserListExport } from '@/api/trials'
import {
getMaintenanceList,
getTrialUserTypeList,
updateTrialUser,
trialUserListExport,
updateTrialUserRole,
} from '@/api/trials'
import Pagination from '@/components/Pagination'
import StaffForm from './staffForm'
import StaffExternalForm from './staffExternalForm'
@ -278,7 +454,7 @@ const getListQueryDefault = () => {
OrganizationName: '',
IsDeleted: null,
PageIndex: 1,
PageSize: 20
PageSize: 20,
}
}
export default {
@ -290,8 +466,16 @@ export default {
listQuery: getListQueryDefault(),
listLoading: false,
total: 0,
staff_model: { visible: false, title: this.$t('trials:staff:dialogTitle:add'), width: '1200px' },
status_model: { visible: false, title: this.$t('trials:staff:dialogTitle:status'), width: '500px' },
staff_model: {
visible: false,
title: this.$t('trials:staff:dialogTitle:add'),
width: '1200px',
},
status_model: {
visible: false,
title: this.$t('trials:staff:dialogTitle:status'),
width: '500px',
},
userTypeOptions: [],
isAdd: 'Add',
staffStatus: null,
@ -301,14 +485,33 @@ export default {
moment,
statusForm: { isDeleted: false, removeTime: '', joinTime: '' },
statusRules: {
removeTime: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur'] }],
joinTime: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur'] }]
removeTime: [
{
required: true,
message: this.$t('common:ruleMessage:select'),
trigger: ['blur'],
},
],
joinTime: [
{
required: true,
message: this.$t('common:ruleMessage:select'),
trigger: ['blur'],
},
],
},
pickerOption: {
disabledDate: time => {
disabledDate: (time) => {
return time.getTime() > Date.now()
}
}
},
},
roleList: [],
role_model: {
visible: false,
title: this.$t('trials:staff:dialogTitle:role'),
width: '800px',
},
}
},
mounted() {
@ -317,15 +520,48 @@ export default {
this.getList()
},
methods: {
//
async changeRoleStatus(row, status) {
try {
let message = this.$t('trials:staff:comfirm:changeRoleStatus').replace(
'xxx',
this.$fd('IsEnable', !status)
)
let comfirm = await this.$confirm(message)
if (!comfirm) return false
let data = {
IdList: [row.Id],
IsDeleted: status,
}
let res = await updateTrialUserRole(data)
if (res.IsSuccess) {
row.IsDeleted = status
this.$message.success(
this.$t('trials:trials-myinfo:message:updateSuccessfully')
)
this.getList()
}
} catch (err) {
console.log(err)
}
},
openRoleList(row) {
this.roleList = row.TrialUserRoleList
this.role_model.visible = true
},
//
getList() {
this.listLoading = true
this.listQuery.TrialId = this.trialId
getMaintenanceList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
}).catch(() => { this.listLoading = false })
getMaintenanceList(this.listQuery)
.then((res) => {
this.listLoading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
this.listLoading = false
})
},
//
handleAdd(type) {
@ -347,7 +583,7 @@ export default {
},
//
saveStatus() {
this.$refs.statusForm.validate(valid => {
this.$refs.statusForm.validate((valid) => {
if (!valid) return
this.btnLoading = true
const param = {
@ -355,17 +591,18 @@ export default {
trialId: this.trialId,
isDeleted: this.statusForm.isDeleted,
removeTime: this.statusForm.removeTime,
joinTime: this.statusForm.joinTime
joinTime: this.statusForm.joinTime,
}
updateTrialUser(param)
.then(res => {
.then((res) => {
this.btnLoading = false
if (res.IsSuccess) {
this.status_model.visible = false
this.getList()
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
}).catch(() => {
})
.catch(() => {
this.btnLoading = false
})
})
@ -408,39 +645,43 @@ export default {
handleExport() {
this.listLoading = true
this.listQuery.TrialId = this.trialId
trialUserListExport({ ...this.listQuery }).then((data) => {
this.listLoading = false
}).catch(() => { this.listLoading = false })
trialUserListExport({ ...this.listQuery })
.then((data) => {
this.listLoading = false
})
.catch(() => {
this.listLoading = false
})
},
//
getUserType() {
getTrialUserTypeList().then(res => {
getTrialUserTypeList().then((res) => {
this.userTypeOptions = res.Result
})
}
}
},
},
}
</script>
<style lang="scss">
.participant-list{
.filter-box{
.participant-list {
.filter-box {
display: flex;
padding: 5px;
.base-search-form{
.el-form-item{
.base-search-form {
.el-form-item {
margin-bottom: 0px;
}
}
.mr{
.mr {
margin-right: 5px;
width: 120px;
width: 120px;
}
}
.el-dialog__header{
padding:10px;
.el-dialog__header {
padding: 10px;
}
.el-dialog__body{
padding:10px;
.el-dialog__body {
padding: 10px;
}
}
</style>

View File

@ -19,8 +19,12 @@
<el-button size="mini" type="primary" icon="el-icon-refresh-left" @click="handleReset">
{{ $t('common:button:reset') }}
</el-button>
<!-- 权限配置 -->
<el-button type="primary" size="mini" style="margin-left:auto" :loading="assignLoadStatus" @click="openPermission">
{{ $t('trials:staff:button:permissionConfiguration') }}
</el-button>
<!-- 发送邮件 -->
<el-button type="primary" size="mini" style="margin-left:auto" :disabled="selectArr.length === 0" :loading="assignLoadStatus" icon="el-icon-message" @click="sendEmail">
<el-button type="primary" size="mini" style="margin-left:10px" :disabled="selectArr.length === 0" :loading="assignLoadStatus" icon="el-icon-message" @click="sendEmail">
{{ $t('trials:staff:button:sendEmail') }}
</el-button>
<!-- 添加 -->
@ -113,12 +117,52 @@
</div>
</el-main>
<StaffExternalAdd ref="StaffExternalAdd" :user-type-options="userTypeOptions" @getList="refeshList" />
<base-model v-if="model_config.visible" :config="model_config">
<template slot="dialog-body">
<el-form :model="permission" :rules="permissionRole" ref="permissionForm" label-width="140px" class="demo-ruleForm">
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinReReadingApproval')" prop="IsSPMJoinReReadingApproval">
<el-radio-group v-model="permission.IsSPMJoinReReadingApproval">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinReviewerSelect')" prop="IsSPMJoinReviewerSelect">
<el-radio-group v-model="permission.IsSPMJoinReviewerSelect">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('trials:externalStaff:form:IsSPMJoinSiteSurvey')" prop="IsSPMJoinSiteSurvey">
<el-radio-group v-model="permission.IsSPMJoinSiteSurvey">
<el-radio v-for="item in $d.YesOrNo" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
<template slot="dialog-footer">
<el-button
:disabled="assignLoadStatus"
size="small"
type="primary"
@click="model_config.visible = false"
>
{{ $t('common:button:cancel') }}
</el-button>
<el-button
size="small"
type="primary"
:loading="assignLoadStatus"
@click="savePermission"
>
{{ $t('common:button:save') }}
</el-button>
</template>
</base-model>
</el-container>
</template>
<script>
import { getTrialExternalUserList, addTrialUsers, getUserTypeList, sendExternalUserJoinEmail } from '@/api/trials'
import { getTrialExternalUserList, addTrialUsers, getUserTypeList, sendExternalUserJoinEmail, getTrialConfigInfo, configTrialSPMInfo } from '@/api/trials'
import { deleteTrialExternalUser } from '@/api/trials/setting.js'
import StaffExternalAdd from './staffExternalAdd'
import BaseModel from '@/components/BaseModel'
const getListQueryDefault = () => {
return {
Phone: '',
@ -127,7 +171,7 @@ const getListQueryDefault = () => {
}
}
export default {
components: { StaffExternalAdd },
components: { StaffExternalAdd,BaseModel },
data() {
return {
list: [],
@ -135,10 +179,19 @@ export default {
listQuery: getListQueryDefault(),
selectArr: [],
assignLoadStatus: false,
isAdmin: JSON.parse(zzSessionStorage.getItem('IsAdmin')),
// isAdmin: JSON.parse(zzSessionStorage.getItem('IsAdmin')),
userTypeOptions: [],
stateList: ['WaitSent', 'HasSend', 'UserConfirmed', 'UserReject', 'OverTime'],
trialId: ''
trialId: '',
model_config:{
visible: false, title: this.$t('trials:staff:dialogTitle:permissionConfiguration'), width: '500px', appendToBody: true
},
permission:{
IsSPMJoinReReadingApproval: false,
IsSPMJoinReviewerSelect: false,
IsSPMJoinSiteSurvey: false,
},
permissionRole:{}
}
},
mounted() {
@ -147,6 +200,46 @@ export default {
this.getList()
},
methods: {
//
async getPermission(){
try{
let res = await getTrialConfigInfo(this.trialId);
if(res.IsSuccess){
Object.keys(this.permission).forEach(key=>{
this.permission[key] = res.Result[key]
})
}
}catch(err){
console.log(err)
}
},
//
async openPermission(){
try{
await this.getPermission();
this.model_config.visible = true;
}catch(err){
console.log(err);
}
},
//
async savePermission(){
try{
let validate =await this.$refs.permissionForm.validate();
if(!validate) return false;
this.assignLoadStatus = true;
let data = Object.assign({ Id: this.trialId },this.permission)
let res = await configTrialSPMInfo(data);
this.assignLoadStatus = false;
if(res.IsSuccess){
this.model_config.visible = false;
this.$message.success(this.$t("common:message:updatedSuccessfully"))
}
}catch(err){
this.assignLoadStatus = false;
console.log(err)
}
},
refeshList() {
this.getList()
this.$emit('getList')

View File

@ -1,19 +1,39 @@
<template>
<el-container class="participant-container">
<el-header style="height:50px">
<el-header style="height: 50px">
<div class="filter-container">
<!-- 姓名 -->
<span>{{ $t('trials:staff:table:name') }}:</span>
<el-input v-model="listQuery.UserRealName" size="mini" class="mr" clearable />
<el-input
v-model="listQuery.UserRealName"
size="mini"
class="mr"
clearable
/>
<!-- 用户名 -->
<span>{{ $t('trials:staff:table:uid') }}:</span>
<el-input v-model="listQuery.UserName" size="mini" class="mr" clearable />
<el-input
v-model="listQuery.UserName"
size="mini"
class="mr"
clearable
/>
<!-- 单位 -->
<span>{{ $t('trials:staff:table:organization') }}:</span>
<el-input v-model="listQuery.OrganizationName" size="mini" class="mr" clearable />
<el-input
v-model="listQuery.OrganizationName"
size="mini"
class="mr"
clearable
/>
<!-- 用户类型 -->
<span>{{ $t('trials:staff:table:userType') }}:</span>
<el-select v-model="listQuery.UserTypeEnum" size="mini" clearable class="mr">
<el-select
v-model="listQuery.UserTypeEnum"
size="mini"
clearable
class="mr"
>
<el-option
v-for="item of userTypeOptions"
:key="item.Id"
@ -24,15 +44,33 @@
</el-option>
</el-select>
<!-- 查询 -->
<el-button type="primary" size="mini" icon="el-icon-search" @click="handleSearch">
<el-button
type="primary"
size="mini"
icon="el-icon-search"
@click="handleSearch"
>
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button size="mini" type="primary" icon="el-icon-refresh-left" @click="handleReset">
<el-button
size="mini"
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t('common:button:reset') }}
</el-button>
<el-button type="primary" size="mini" style="margin-left:auto" :disabled="selectArr.length === 0" :loading="assignLoadStatus" icon="el-icon-plus" @click="handleAssign">
<el-button
type="primary"
size="mini"
style="margin-left: auto"
:disabled="selectArr.length === 0"
:loading="assignLoadStatus"
icon="el-icon-plus"
@click="handleAssign"
>
{{ $t('common:button:add') }}
</el-button>
</div>
@ -55,7 +93,7 @@
<el-table-column type="index" width="50" />
<!-- 姓名 -->
<el-table-column
prop="UserRealName"
prop="FullName"
:label="$t('trials:staff:table:name')"
show-overflow-tooltip
sortable="custom"
@ -95,23 +133,31 @@
/>
<!-- 用户类型 -->
<el-table-column
prop="UserType"
prop="UserTypeShortName"
:label="$t('trials:staff:table:userType')"
show-overflow-tooltip
sortable="custom"
min-width="100"
/>
</el-table>
</div>
</el-main>
<div class="pagination" style="text-align: right;margin-top:5px;">
<pagination :total="total" :page.sync="listQuery.PageIndex" :limit.sync="listQuery.PageSize" @pagination="getList" />
<div class="pagination" style="text-align: right; margin-top: 5px">
<pagination
:total="total"
:page.sync="listQuery.PageIndex"
:limit.sync="listQuery.PageSize"
@pagination="getList"
/>
</div>
</el-container>
</template>
<script>
import { getTrialUserScreeningList, addTrialUsers, getUserTypeList } from '@/api/trials'
import {
getTrialUserScreeningList,
addTrialUsers,
getUserTypeList,
} from '@/api/trials'
import Pagination from '@/components/Pagination'
const getListQueryDefault = () => {
return {
@ -120,7 +166,7 @@ const getListQueryDefault = () => {
OrganizationName: '',
UserTypeEnum: '',
PageIndex: 1,
PageSize: 20
PageSize: 20,
}
}
export default {
@ -132,9 +178,9 @@ export default {
listQuery: getListQueryDefault(),
selectArr: [],
assignLoadStatus: false,
isAdmin: JSON.parse(zzSessionStorage.getItem('IsAdmin')),
// isAdmin: JSON.parse(zzSessionStorage.getItem('IsAdmin')),
userTypeOptions: [],
trialId: ''
trialId: '',
}
},
mounted() {
@ -147,40 +193,44 @@ export default {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true
lock: true,
})
this.listQuery.TrialId = this.trialId
getTrialUserScreeningList(this.listQuery).then(res => {
loading.close()
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
}).catch(() => { loading.close() })
getTrialUserScreeningList(this.listQuery)
.then((res) => {
loading.close()
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
loading.close()
})
},
handleAssign() {
this.$confirm(this.$t('trials:staff:message:addStaff'), {
type: 'warning',
distinguishCancelAndClose: true
})
.then(() => {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true
})
this.assignLoadStatus = true
addTrialUsers(this.selectArr)
.then(res => {
this.assignLoadStatus = false
loading.close()
if (res.IsSuccess) {
this.$emit('closeDialog')
this.$message.success(this.$t('common:message:addedSuccessfully'))
}
}).catch(() => {
loading.close()
this.assignLoadStatus = false
})
distinguishCancelAndClose: true,
}).then(() => {
const loading = this.$loading({
target: document.querySelector('.participant-table-list'),
fullscreen: false,
lock: true,
})
this.assignLoadStatus = true
addTrialUsers(this.selectArr)
.then((res) => {
this.assignLoadStatus = false
loading.close()
if (res.IsSuccess) {
this.$emit('closeDialog')
this.$message.success(this.$t('common:message:addedSuccessfully'))
}
})
.catch(() => {
loading.close()
this.assignLoadStatus = false
})
})
},
handleSearch() {
this.listQuery.PageIndex = 1
@ -211,34 +261,34 @@ export default {
}
},
getUserType() {
getUserTypeList(2).then(res => {
getUserTypeList(2).then((res) => {
this.userTypeOptions = res.Result
})
}
}
},
},
}
</script>
<style lang="scss" scoped>
.participant-container{
.participant-container {
height: 100%;
.el-header{
.filter-container{
.el-header {
.filter-container {
display: flex;
align-items: center;
span{
font-size:13px;
margin-right:5px;
span {
font-size: 13px;
margin-right: 5px;
}
.mr{
.mr {
margin-right: 5px;
width: 120px;
}
}
}
.el-main{
.el-main {
padding: 0px;
}
.el-footer{
.el-footer {
padding: 0 20px;
}
}

View File

@ -471,7 +471,6 @@ export default {
...mapState('user', ['isTestUser'])
},
mounted() {
console.log('isTestUser: ',this.isTestUser)
this.getUserTobeDoneRecord()
this.getNeedSignTrialDocTrialIdList()
this.getUserInfo()
@ -491,7 +490,7 @@ export default {
},
methods: {
getUserInfo() {
getUser(this.userId).then(async res => {
getUser().then(async res => {
this.user = res.Result
}).catch(() => { loading.close() })
},
@ -507,7 +506,6 @@ export default {
},
getNeedSignTrialDocTrialIdList() {
getNeedSignTrialDocTrialIdList().then(res => {
console.log(res)
this.trialIdList = res.Result
this.$nextTick(() => {
var list = document.querySelectorAll('div[tab-data]')

View File

@ -17,36 +17,78 @@
<!-- 用户基本信息 -->
{{ $t('trials:trials-myinfo:title:basicInfo') }}
</div>
<el-form ref="userForm" label-position="right" :model="user" :rules="userFormRules" label-width="120px">
<el-form
ref="userForm"
label-position="right"
:model="user"
:rules="userFormRules"
label-width="120px"
>
<el-form-item v-if="user.Code" label="ID: " prop="Code">
<el-input v-model="user.Code" disabled />
</el-form-item>
<!-- -->
<el-form-item :disabled="user.UserTypeEnum === 8" :label="$t('trials:trials-myinfo:form:surname')" prop="LastName">
<el-input v-model="user.LastName" :placeholder="$t('trials:trials-myinfo:form:surname')"/>
<el-form-item
:disabled="user.UserTypeEnum === 8"
:label="$t('trials:trials-myinfo:form:surname')"
prop="LastName"
>
<el-input
v-model="user.LastName"
:placeholder="$t('trials:trials-myinfo:form:surname')"
/>
</el-form-item>
<!-- -->
<el-form-item :disabled="user.UserTypeEnum === 8" :label="$t('trials:trials-myinfo:form:givenname')" prop="FirstName">
<el-input v-model="user.FirstName" :placeholder="$t('trials:trials-myinfo:form:givenname')"/>
<el-form-item
:disabled="user.UserTypeEnum === 8"
:label="$t('trials:trials-myinfo:form:givenname')"
prop="FirstName"
>
<el-input
v-model="user.FirstName"
:placeholder="$t('trials:trials-myinfo:form:givenname')"
/>
</el-form-item>
<!-- 性别 -->
<el-form-item :label="$t('trials:trials-myinfo:form:gender')" prop="Sex" style="margin-right:40px;">
<el-form-item
:label="$t('trials:trials-myinfo:form:gender')"
prop="Sex"
style="margin-right: 40px"
>
<el-radio-group v-model="user.Sex">
<el-radio :label="1">Male</el-radio>
<el-radio :label="0">Female</el-radio>
</el-radio-group>
</el-form-item>
<!-- 单位 -->
<el-form-item :label="$t('trials:trials-myinfo:form:organization')" prop="OrganizationName">
<el-input v-model="user.OrganizationName" :placeholder="$t('trials:trials-myinfo:form:organization')"/>
<el-form-item
:label="$t('trials:trials-myinfo:form:organization')"
prop="OrganizationName"
>
<el-input
v-model="user.OrganizationName"
:placeholder="$t('trials:trials-myinfo:form:organization')"
/>
</el-form-item>
<!-- 部门 -->
<el-form-item :label="$t('trials:trials-myinfo:form:department')" prop="DepartmentName">
<el-input v-model="user.DepartmentName" :placeholder="$t('trials:trials-myinfo:form:organization')"/>
<el-form-item
:label="$t('trials:trials-myinfo:form:department')"
prop="DepartmentName"
>
<el-input
v-model="user.DepartmentName"
:placeholder="$t('trials:trials-myinfo:form:organization')"
/>
</el-form-item>
<!-- 职位 -->
<el-form-item :label="$t('trials:trials-myinfo:form:position')" prop="PositionName">
<el-input v-model="user.PositionName" :placeholder="$t('trials:trials-myinfo:form:position')"/>
<el-form-item
:label="$t('trials:trials-myinfo:form:position')"
prop="PositionName"
>
<el-input
v-model="user.PositionName"
:placeholder="$t('trials:trials-myinfo:form:position')"
/>
</el-form-item>
</el-form>
<!-- 保存 -->
@ -68,39 +110,97 @@
</div>
<el-form label-position="right" label-width="180px">
<!-- 用户名 -->
<el-form-item :label="$t('trials:trials-myinfo:form:userName')" style="margin-bottom: 5px;" prop="UserName">
<el-form-item
:label="$t('trials:trials-myinfo:form:userName')"
style="margin-bottom: 5px"
prop="UserName"
>
<span>{{ user.UserName }}</span>
</el-form-item>
<el-form-item label="" style="position: relative" prop="UserName">
<el-input v-model="userForm.UserName" :placeholder="$t('trials:trials-myinfo:form:userName')"/>
<el-input
v-model="userForm.UserName"
:placeholder="$t('trials:trials-myinfo:form:userName')"
/>
<!-- 修改 -->
<el-button :disabled="!userForm.UserName" class="saveBtn" type="primary" size="small" @click="setNewUserName">
<el-button
:disabled="!userForm.UserName"
class="saveBtn"
type="primary"
size="small"
@click="setNewUserName"
>
{{ $t('trials:trials-myinfo:button:update') }}
</el-button>
</el-form-item>
<!-- 电话 -->
<el-form-item :label="$t('trials:trials-myinfo:form:phone')" style="margin-bottom: 5px;" prop="UserName">
<el-form-item
:label="$t('trials:trials-myinfo:form:phone')"
style="margin-bottom: 5px"
prop="UserName"
>
<span>{{ user.Phone }}</span>
</el-form-item>
<el-form-item label="" style="position: relative" prop="UserName">
<el-input v-model="userForm.Phone" :placeholder="$t('trials:trials-myinfo:form:phone')"/>
<el-input
v-model="userForm.Phone"
:placeholder="$t('trials:trials-myinfo:form:phone')"
/>
<!-- 修改 -->
<el-button :disabled="!userForm.Phone" class="saveBtn" type="primary" size="small" @click="setNewPhone">
<el-button
:disabled="!userForm.Phone"
class="saveBtn"
type="primary"
size="small"
@click="setNewPhone"
>
{{ $t('trials:trials-myinfo:button:update') }}
</el-button>
</el-form-item>
<!-- 邮箱 -->
<el-form-item :label="$t('trials:trials-myinfo:form:email')" style="margin-bottom: 5px;" prop="UserName">
<el-form-item
:label="$t('trials:trials-myinfo:form:email')"
style="margin-bottom: 5px"
prop="UserName"
>
<span>{{ user.EMail }}</span>
</el-form-item>
<el-form-item label="" style="margin-bottom: 10px;position: relative" prop="EMail">
<el-input v-model="userForm.EMail" @input="handleEmailChange" :placeholder="$t('trials:trials-myinfo:form:email')"/>
<el-button class="sendCode" :disabled="sendDisabled" type="primary" size="mini" @click="sendVerificationCode">{{ sendTitle }}</el-button>
<el-form-item
label=""
style="margin-bottom: 10px; position: relative"
prop="EMail"
>
<el-input
v-model="userForm.EMail"
@input="handleEmailChange"
:placeholder="$t('trials:trials-myinfo:form:email')"
/>
<el-button
class="sendCode"
:disabled="sendDisabled"
type="primary"
size="mini"
@click="sendVerificationCode"
>{{ sendTitle }}</el-button
>
</el-form-item>
<el-form-item label="" style="position: relative" prop="VerificationCode">
<el-input v-model="userForm.VerificationCode" :placeholder="$t('trials:researchForm:form:verifyCode')"/>
<el-form-item
label=""
style="position: relative"
prop="VerificationCode"
>
<el-input
v-model="userForm.VerificationCode"
:placeholder="$t('trials:researchForm:form:verifyCode')"
/>
<!-- 修改 -->
<el-button :disabled="!userForm.EMail || !userForm.VerificationCode" class="saveBtn" type="primary" size="small" @click="setNewEmail">
<el-button
:disabled="!userForm.EMail || !userForm.VerificationCode"
class="saveBtn"
type="primary"
size="small"
@click="setNewEmail"
>
{{ $t('trials:trials-myinfo:button:update') }}
</el-button>
</el-form-item>
@ -111,18 +211,52 @@
<!-- 修改密码 -->
{{ $t('trials:trials-myinfo:title:updatePaasord') }}
</div>
<el-form ref="passwordForm" label-position="right" :model="password" :rules="passwordFormRules" label-width="180px">
<el-form
ref="passwordForm"
label-position="right"
:model="password"
:rules="passwordFormRules"
label-width="180px"
>
<!-- 旧密码 -->
<el-form-item :label="$t('recompose:form:oldPassword')" prop="OldPassWord">
<el-input v-model="password.OldPassWord" type="password" show-password auto-complete="new-password" :placeholder="$t('recompose:form:oldPassword')"/>
<el-form-item
:label="$t('recompose:form:oldPassword')"
prop="OldPassWord"
>
<el-input
v-model="password.OldPassWord"
type="password"
show-password
auto-complete="new-password"
:placeholder="$t('recompose:form:oldPassword')"
/>
</el-form-item>
<!-- 新密码 -->
<el-form-item class="my_new_pwd" :label="$t('recompose:form:newPassword')" prop="NewPassWord">
<el-input v-model="password.NewPassWord" type="password" show-password auto-complete="new-password" :placeholder="$t('recompose:form:newPassword')"/>
<el-form-item
class="my_new_pwd"
:label="$t('recompose:form:newPassword')"
prop="NewPassWord"
>
<el-input
v-model="password.NewPassWord"
type="password"
show-password
auto-complete="new-password"
:placeholder="$t('recompose:form:newPassword')"
/>
</el-form-item>
<!-- 确认密码 -->
<el-form-item :label="$t('recompose:form:confirmPassword')" prop="ConfirmPassWord">
<el-input v-model="password.ConfirmPassWord" type="password" show-password auto-complete="new-password" :placeholder="$t('recompose:form:confirmPassword')"/>
<el-form-item
:label="$t('recompose:form:confirmPassword')"
prop="ConfirmPassWord"
>
<el-input
v-model="password.ConfirmPassWord"
type="password"
show-password
auto-complete="new-password"
:placeholder="$t('recompose:form:confirmPassword')"
/>
</el-form-item>
</el-form>
<el-button
@ -139,13 +273,23 @@
</template>
<script>
import { getUserTypeList, getUser, updateUser, modifyPassword } from '@/api/admin.js'
import { sendVerificationCode, setNewEmail, setNewPhone, setNewUserName } from '@/api/system/user.js'
import {
getUserTypeList,
getUser,
updateUser,
modifyPassword,
} from '@/api/admin.js'
import {
sendVerificationCode,
setNewEmail,
setNewPhone,
setNewUserName,
} from '@/api/system/user.js'
import md5 from 'js-md5'
var timer = ''
var countdown = 60
import store from '@/store'
import {mapGetters, mapMutations} from 'vuex'
import { mapGetters, mapMutations } from 'vuex'
export default {
name: 'TrialsMyinfo',
@ -158,38 +302,102 @@ export default {
sendDisabled: true,
sendTitle: this.$t('trials:trials-myinfo:button:getVCode'),
userFormRules: {
UserName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
UserTypeId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
IsZhiZhun: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
OrganizationName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
LastName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, { max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }],
FirstName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, { max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }],
Sex: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
Status: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }]
UserName: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
],
UserTypeId: [
{
required: true,
message: this.$t('common:ruleMessage:select'),
trigger: ['blur', 'change'],
},
],
IsZhiZhun: [
{
required: true,
message: this.$t('common:ruleMessage:select'),
trigger: ['blur', 'change'],
},
],
OrganizationName: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
],
LastName: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` },
],
FirstName: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` },
],
Sex: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
],
Status: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
],
},
passwordFormRules: {
OldPassWord: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
OldPassWord: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
],
NewPassWord: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{
required: true,
trigger: 'blur',
validator: this.$validatePassword
validator: this.$validatePassword,
},
],
ConfirmPassWord: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: 'blur',
},
{
required: true,
trigger: 'blur',
validator: this.$validatePassword
validator: this.$validatePassword,
},
]
}
],
},
}
},
computed: {
...mapGetters(['userId', 'name'])
...mapGetters(['userId', 'name']),
},
mounted() {
this.getUserInfo()
@ -198,7 +406,7 @@ export default {
methods: {
...mapMutations({ setLanguage: 'lang/setLanguage' }),
handleSave() {
this.$refs.userForm.validate(valid => {
this.$refs.userForm.validate((valid) => {
console.log(valid)
if (valid) {
this.isDisabled = true
@ -212,17 +420,24 @@ export default {
// this.user.OrganizationName = 'ZhiZhun'
// }
if (this.user.Id) {
updateUser(this.user).then(res => {
this.isDisabled = false
this.$message.success(this.$t('trials:trials-myinfo:message:updateSuccessfully'))
this.getUserInfo()
}).catch(() => { this.isDisabled = false })
updateUser(this.user)
.then((res) => {
this.isDisabled = false
this.$message.success(
this.$t('trials:trials-myinfo:message:updateSuccessfully')
)
this.getUserInfo()
})
.catch(() => {
this.isDisabled = false
})
}
}
})
},
handleEmailChange() {
var reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
var reg =
/^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/
if (this.userForm.EMail && reg.test(this.userForm.EMail)) {
this.sendDisabled = false
} else {
@ -233,11 +448,13 @@ export default {
sendVerificationCode(this.userForm.EMail).then(() => {
this.settime(this)
//
this.$message.success(this.$t('trials:trials-myinfo:message:sendSuccessfully'))
this.$message.success(
this.$t('trials:trials-myinfo:message:sendSuccessfully')
)
})
},
save() {
this.$refs.passwordForm.validate(valid => {
this.$refs.passwordForm.validate((valid) => {
if (valid) {
if (this.password.NewPassWord !== this.password.ConfirmPassWord) {
this.$alert(this.$t('passwordReset:formRule:passwordsDiffer'))
@ -246,12 +463,14 @@ export default {
const param = {
UserId: this.userId,
NewPassWord: md5(this.password.NewPassWord),
OldPassWord: md5(this.password.OldPassWord)
OldPassWord: md5(this.password.OldPassWord),
}
modifyPassword(param).then(res => {
modifyPassword(param).then((res) => {
if (res.IsSuccess) {
// ,
this.$message.success(this.$t('trials:trials-myinfo:message:modifyPWSuccessfully'))
this.$message.success(
this.$t('trials:trials-myinfo:message:modifyPWSuccessfully')
)
setTimeout(() => {
this.logout()
}, 1000)
@ -261,26 +480,36 @@ export default {
})
},
setNewEmail() {
setNewEmail(this.userForm.EMail, this.userForm.VerificationCode).then(() => {
this.userForm.EMail = ''
this.userForm.VerificationCode = ''
this.$message.success(this.$t('trials:trials-myinfo:message:updateSuccessfully'))
this.getUserInfo()
})
setNewEmail(this.userForm.EMail, this.userForm.VerificationCode).then(
() => {
this.userForm.EMail = ''
this.userForm.VerificationCode = ''
this.$message.success(
this.$t('trials:trials-myinfo:message:updateSuccessfully')
)
this.getUserInfo()
}
)
},
setNewUserName() {
setNewUserName(this.userForm.UserName).then(() => {
this.$store.dispatch('user/changeUserName', this.userForm.UserName).then((res) => {
this.userForm.UserName = ''
this.$message.success(this.$t('trials:trials-myinfo:message:updateSuccessfully'))
this.getUserInfo()
})
this.$store
.dispatch('user/changeUserName', this.userForm.UserName)
.then((res) => {
this.userForm.UserName = ''
this.$message.success(
this.$t('trials:trials-myinfo:message:updateSuccessfully')
)
this.getUserInfo()
})
})
},
setNewPhone() {
setNewPhone(this.userForm.Phone).then(() => {
this.userForm.Phone = ''
this.$message.success(this.$t('trials:trials-myinfo:message:updateSuccessfully'))
this.$message.success(
this.$t('trials:trials-myinfo:message:updateSuccessfully')
)
this.getUserInfo()
})
},
@ -290,36 +519,42 @@ export default {
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.07)'
background: 'rgba(0, 0, 0, 0.07)',
})
getUser(this.userId).then(async res => {
this.user = res.Result
/* eslint-disable */
zzSessionStorage.setItem('realName', this.user.RealName)
await store.dispatch('user/updateInfo')
loading.close()
}).catch(() => { loading.close() })
getUser()
.then(async (res) => {
this.user = res.Result
/* eslint-disable */
zzSessionStorage.setItem('Name', this.user.FullName)
await store.dispatch('user/updateInfo')
loading.close()
})
.catch(() => {
loading.close()
})
},
settime(obj) {
if (countdown === 0) {
obj.sendDisabled = false
obj.sendTitle = this.$t('trials:trials-myinfo:button:getVCode')// ''
obj.sendTitle = this.$t('trials:trials-myinfo:button:getVCode') // ''
countdown = 60
clearTimeout(timer)
return
} else {
obj.sendDisabled = true
obj.sendTitle = `${this.$t('trials:trials-myinfo:button:wait')}(${countdown}s)`
obj.sendTitle = `${this.$t(
'trials:trials-myinfo:button:wait'
)}(${countdown}s)`
countdown--
// eslint-disable-next-line no-self-assign
countdown = countdown
timer = setTimeout(function() {
timer = setTimeout(function () {
obj.settime(obj)
}, 1000)
}
},
getUserTypeList() {
getUserTypeList().then(res => {
getUserTypeList().then((res) => {
if (res.IsSuccess) {
this.userTypeOptions = res.Result
}
@ -337,56 +572,93 @@ export default {
this.$i18n.locale = 'zh'
this.setLanguage('zh')
this.$updateDictionary()
}
}
},
},
}
</script>
<style lang="scss" scoped>
.trial-myinfo{
.trial-myinfo {
background: #f3f3f3;
flex: 1;overflow: auto;display: flex;flex-direction: row;justify-content: space-around;
.trial-myinfo-head{
position: absolute;top: 40px;left: -10%;font-size: 14px;
flex: 1;
overflow: auto;
display: flex;
flex-direction: row;
justify-content: space-around;
.trial-myinfo-head {
position: absolute;
top: 40px;
left: -10%;
font-size: 14px;
}
.trial-myinfo-left{
.trial-myinfo-left {
overflow: auto;
background: #fff;width: calc(50% - 9px);margin: 6px 0;
background: #fff;
width: calc(50% - 9px);
margin: 6px 0;
padding-bottom: 50px;
.trial-myinfo-left-top{
width: 70%;padding-top: 100px;position: relative;margin: 0 auto;margin-bottom: 10px;
.trial-myinfo-body{
width:160px;height:160px;border-radius: 50%;background: #428bca;display: flex;justify-content: center;align-items: center;
div{
color:#fff;font-size: 30px;
.trial-myinfo-left-top {
width: 70%;
padding-top: 100px;
position: relative;
margin: 0 auto;
margin-bottom: 10px;
.trial-myinfo-body {
width: 160px;
height: 160px;
border-radius: 50%;
background: #428bca;
display: flex;
justify-content: center;
align-items: center;
div {
color: #fff;
font-size: 30px;
}
}
}
}
.saveBtn{
position: absolute;right: -10px;top:2px;transform: translateX(100%)
.saveBtn {
position: absolute;
right: -10px;
top: 2px;
transform: translateX(100%);
}
.trial-info-btn{
position: absolute;bottom: -60px;left: calc(100% + 10px);min-width: 97px;
.trial-info-btn {
position: absolute;
bottom: -60px;
left: calc(100% + 10px);
min-width: 97px;
}
.trial-myinfo-left-bottom{
width: 70%;padding-top: 100px;position: relative;margin: 0 auto;
.trial-myinfo-left-bottom {
width: 70%;
padding-top: 100px;
position: relative;
margin: 0 auto;
}
.trial-myinfo-right{
.trial-myinfo-right {
overflow: auto;
background: #fff;width: calc(50% - 9px);margin: 6px 0;
background: #fff;
width: calc(50% - 9px);
margin: 6px 0;
padding-bottom: 50px;
.sendCode {
position: absolute;right: -10px;top: 50%;transform: translate(100%, -50%);
position: absolute;
right: -10px;
top: 50%;
transform: translate(100%, -50%);
}
.trial-myinfo-right-box{
width: 70%;padding-top: 100px;position: relative;margin: 0 auto;
.trial-myinfo-right-box {
width: 70%;
padding-top: 100px;
position: relative;
margin: 0 auto;
}
}
}
</style>
<style scoped>
/deep/ .is-error.my_new_pwd{
::v-deep .is-error.my_new_pwd {
margin-bottom: 40px;
}
</style>