后台管理可以添加课题组

main
wangxiaoshuang 2025-08-20 16:38:23 +08:00
parent 3138bbcb3b
commit 216182f48e
14 changed files with 988 additions and 335 deletions

View File

@ -279,6 +279,14 @@ export function batchAddInternationalization(param) {
data: param data: param
}) })
} }
// 管理端修改用户角色
export function updateUserRoleInfo(data) {
return request({
url: `/User/updateUserRoleInfo`,
method: 'put',
data
})
}
// 获取医院列表 // 获取医院列表
export function getHIRHospitalList(param) { export function getHIRHospitalList(param) {
return request({ return request({
@ -310,4 +318,42 @@ export function updateDefaultHospital(params) {
params params
}) })
} }
// 获取课题组列表-不分页
export function getHospitalGroupList(data) {
return request({
url: `/HospitalGroup/getHospitalGroupList`,
method: 'post',
data
})
}
// 获取课题组列表-分页
export function getHospitalGroupPageList(data) {
return request({
url: `/HospitalGroup/getHospitalGroupPageList`,
method: 'post',
data
})
}
// 新增或编辑课题组
export function addOrUpdateHospitalGroup(data) {
return request({
url: `/HospitalGroup/addOrUpdateHospitalGroup`,
method: 'post',
data
})
}
// 删除课题组
export function deleteHospitalGroup(id) {
return request({
url: `/HospitalGroup/deleteHospitalGroup/${id}`,
method: 'delete'
})
}
// 删除课题组
export function getGAUserList() {
return request({
url: `/HospitalGroup/getGAUserList`,
method: 'get'
})
}

View File

@ -106,7 +106,7 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('自定义上传组件', this) // console.log('', this)
}, },
data() { data() {
return { return {

View File

@ -248,6 +248,20 @@ async function VueInit() {
}() }()
_vm.$forceUpdate() _vm.$forceUpdate()
} }
Vue.prototype.$reg = () => {
// if (localStorage.getItem('CompanyInfo')) {
// let { EmailRegexStr } = JSON.parse(localStorage.getItem('CompanyInfo'))
// if (EmailRegexStr) {
// return { EmailRegexStr }
// }
// } else if (Vue.prototype.$companyInfo) {
// let { EmailRegexStr } = Vue.prototype.$companyInfo
// if (EmailRegexStr) {
// return { EmailRegexStr }
// }
// }
return { EmailRegexStr: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$' };
}
Vue.prototype.$path = [] Vue.prototype.$path = []
var t = function (key) { var t = function (key) {
// if (![Vue.prototype.toPath + '_' + key].includes(Vue.prototype.$path)) { // if (![Vue.prototype.toPath + '_' + key].includes(Vue.prototype.$path)) {

View File

@ -221,11 +221,11 @@ export const constantRoutes = [
hidden: true, hidden: true,
component: () => import('@/views/trials/trials-panel/setting/reading-unit/preview') component: () => import('@/views/trials/trials-panel/setting/reading-unit/preview')
}, },
// { {
// path: '/activate', path: '/activate',
// component: () => import('@/views/trials/trials-list/components/activate-page.vue'), component: () => import('@/views/trials/trials-list/components/activate-page.vue'),
// hidden: true hidden: true
// }, },
// { // {
// path: '/audit', // path: '/audit',
// name: 'audit', // name: 'audit',

View File

@ -3,10 +3,12 @@ const getters = {
device: state => state.app.device, device: state => state.app.device,
token: state => state.user.token, token: state => state.user.token,
name: state => state.user.name, name: state => state.user.name,
userTypeShortName: state => state.user.userTypeShortName,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
tree: state => state.user.tree, tree: state => state.user.tree,
userName: state => state.user.userName, userName: state => state.user.userName,
userId: state => state.user.userId, userId: state => state.user.userId,
identityUserId: state => state.user.identityUserId,
routes: state => state.permission.routes, routes: state => state.permission.routes,
asyncRoutes: state => state.permission.addRoutes, asyncRoutes: state => state.permission.addRoutes,
visitedViews: state => state.tagsView.visitedViews, visitedViews: state => state.tagsView.visitedViews,
@ -41,6 +43,7 @@ const getters = {
lastCanvasTaskId: state => state.reading.lastCanvasTaskId, lastCanvasTaskId: state => state.reading.lastCanvasTaskId,
imageQuality: state => state.reading.imageQuality, imageQuality: state => state.reading.imageQuality,
imageQualityIssues: state => state.reading.imageQualityIssues, imageQualityIssues: state => state.reading.imageQualityIssues,
currentLoadIns: state => state.reading.currentLoadIns,
language: state => state.lang.language, language: state => state.lang.language,
TotalNeedSignSystemDocCount: state => state.user.TotalNeedSignSystemDocCount, TotalNeedSignSystemDocCount: state => state.user.TotalNeedSignSystemDocCount,
TotalNeedSignTrialDocCount: state => state.user.TotalNeedSignTrialDocCount, TotalNeedSignTrialDocCount: state => state.user.TotalNeedSignTrialDocCount,

View File

@ -7,14 +7,17 @@ const getDefaultState = () => {
return { return {
token: getToken(), token: getToken(),
name: '', name: '',
userTypeShortName: '',
userName: '', userName: '',
userId: '', userId: '',
identityUserId: '',
avatar: '', avatar: '',
permissions: [], permissions: [],
tree: [], tree: [],
/* eslint-disable */ /* eslint-disable */
TotalNeedSignSystemDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0, TotalNeedSignSystemDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0,
TotalNeedSignTrialDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0, TotalNeedSignTrialDocCount: eval(process.env.VUE_APP_WORD_FOR_PERMISSION) ? null : 0,
IsFirstSysDocNeedSign: false,
TrialStatusStr: null, TrialStatusStr: null,
isTestUser: false, isTestUser: false,
roles: [] roles: []
@ -38,6 +41,9 @@ const mutations = {
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name
}, },
SET_USERTYPESHORTNAME: (state, userTypeShortName) => {
state.userTypeShortName = userTypeShortName
},
SET_USERNAME: (state, name) => { SET_USERNAME: (state, name) => {
state.userName = name state.userName = name
}, },
@ -53,9 +59,16 @@ const mutations = {
SET_USERID: (state, id) => { SET_USERID: (state, id) => {
state.userId = id state.userId = id
}, },
SET_IDENTITYUSERID: (state, id) => {
state.identityUserId = id
},
SET_ISTESTUSER: (state, isTestUser) => { SET_ISTESTUSER: (state, isTestUser) => {
state.isTestUser = eval(isTestUser) state.isTestUser = eval(isTestUser)
}, },
SET_IS_FIRST_SYSTEM_DOC_SIGN: (state, IsFirstSysDocNeedSign) => {
zzSessionStorage.setItem('IsFirstSysDocNeedSign', IsFirstSysDocNeedSign)
state.IsFirstSysDocNeedSign = IsFirstSysDocNeedSign
},
SET_NEED_SIGN_SYSTEM_DOC_COUNT: (state, TotalNeedSignSystemDocCount) => { SET_NEED_SIGN_SYSTEM_DOC_COUNT: (state, TotalNeedSignSystemDocCount) => {
/* eslint-disable */ /* eslint-disable */
if (eval(process.env.VUE_APP_WORD_FOR_PERMISSION) && !state.isTestUser) { if (eval(process.env.VUE_APP_WORD_FOR_PERMISSION) && !state.isTestUser) {
@ -219,6 +232,9 @@ const actions = {
setPermissions({ commit }, permissions) { setPermissions({ commit }, permissions) {
commit('SET_PERMISSIONS', permissions) commit('SET_PERMISSIONS', permissions)
}, },
setIsFirstSysDocNeedSign({ commit }, IsFirstSysDocNeedSign) {
commit('SET_IS_FIRST_SYSTEM_DOC_SIGN', IsFirstSysDocNeedSign)
},
setTotalNeedSignSystemDocCount({ commit }, TotalNeedSignSystemDocCount) { setTotalNeedSignSystemDocCount({ commit }, TotalNeedSignSystemDocCount) {
commit('SET_NEED_SIGN_SYSTEM_DOC_COUNT', TotalNeedSignSystemDocCount) commit('SET_NEED_SIGN_SYSTEM_DOC_COUNT', TotalNeedSignSystemDocCount)
}, },
@ -255,7 +271,7 @@ const actions = {
return user return user
}, },
updateInfo({ commit, state }) { updateInfo({ commit, state }) {
commit('SET_NAME', zzSessionStorage.getItem('realName')) commit('SET_NAME', zzSessionStorage.getItem('Name'))
}, },
// user logout // user logout
async logout({ commit, state }) { async logout({ commit, state }) {

View File

@ -1,69 +1,78 @@
<template> <template>
<div class="hospital"> <el-tabs v-model="activeTab" style="position: relative;height: 100%;">
<el-form ref="hospitalForm" size="small" :model="hospital" :rules="hospitalFormRules" label-width="150px" <el-tab-pane name="hospital" :label="$t('system:hospital:tab:hospital')">
style="width: 800px"> <div class="hospital">
<el-card class="Basic" shadow="never" size="small"> <el-form ref="hospitalForm" size="small" :model="hospital" :rules="hospitalFormRules"
<el-form-item :label="$t('system:hospital:name')" prop="HospitalName"> label-width="150px" style="width: 800px">
<el-input v-model.trim="hospital.HospitalName" :disabled="disabled" clearable /> <el-card class="Basic" shadow="never" size="small">
</el-form-item> <el-form-item :label="$t('system:hospital:name')" prop="HospitalName">
<el-form-item :label="$t('system:hospital:code')" prop="HospitalCode"> <el-input v-model.trim="hospital.HospitalName" :disabled="disabled" clearable />
<el-input v-model.trim="hospital.HospitalCode" :disabled="disabled || hasPermi(['role:oa'])" </el-form-item>
clearable /> <el-form-item :label="$t('system:hospital:code')" prop="HospitalCode">
</el-form-item> <el-input v-model.trim="hospital.HospitalCode" :disabled="disabled || hasPermi(['role:oa'])"
clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:aliasName')" prop="HospitalAliasName"> <el-form-item :label="$t('system:hospital:aliasName')" prop="HospitalAliasName">
<el-input v-model="hospital.HospitalAliasName" :disabled="disabled" clearable /> <el-input v-model="hospital.HospitalAliasName" :disabled="disabled" clearable />
</el-form-item> </el-form-item>
<el-form-item :label="$t('system:hospital:country')" prop="Country">
<el-input v-model="hospital.Country" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:province')" prop="Province">
<el-input v-model="hospital.Province" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:city')" prop="City">
<el-input v-model="hospital.City" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:address')" prop="Address">
<el-input v-model="hospital.Address" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:phone')" prop="Phone">
<el-input v-model="hospital.Phone" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:trialKeepCount')" prop="TrialKeepCount">
<el-input v-model="hospital.TrialKeepCount" :disabled="disabled || hasPermi(['role:oa'])"
type="number" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:isCanConnectInternet')"
v-hasPermi="['system:hospital:connectInternet']">
<el-switch v-model="hospital.IsCanConnectInternet" active-color="#13ce66"
inactive-color="#ff4949" active-text="是" inactive-text="否" :disabled="disabled">
</el-switch>
</el-form-item>
<el-form-item :label="$t('system:hospital:logo')" prop="HospitalLogoPath">
<upload-logo :path.sync="hospital.HospitalLogoPath" :disabled="disabled" />
</el-form-item>
</el-card>
<el-form-item v-if="status === 'default' && hasPermi(['system:hospital:edit'])">
<el-button type="primary" size="small" style="margin: 10px 15px" :loading="btnLoading"
:disabled="btnLoading" @click="handleSave">{{ $t("system:hospital:save") }}</el-button>
</el-form-item>
</el-form>
<div class="btnBox" v-if="status !== 'default'">
<el-button type="primary" size="small" style="margin: 10px 15px" :loading="btnLoading"
:disabled="btnLoading" @click="handleSave">{{ $t("system:hospital:save") }}</el-button>
<el-button type="primary" size="small" style="margin: 10px 15px" @click="handleCancel">{{
$t("common:button:cancel") }}</el-button>
</div>
</div>
</el-tab-pane>
<el-tab-pane name="group" :label="$t('system:hospital:tab:group')">
<group-list v-if="activeTab === 'group'" />
</el-tab-pane>
</el-tabs>
<el-form-item :label="$t('system:hospital:country')" prop="Country">
<el-input v-model="hospital.Country" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:province')" prop="Province">
<el-input v-model="hospital.Province" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:city')" prop="City">
<el-input v-model="hospital.City" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:address')" prop="Address">
<el-input v-model="hospital.Address" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:phone')" prop="Phone">
<el-input v-model="hospital.Phone" :disabled="disabled" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:trialKeepCount')" prop="TrialKeepCount">
<el-input v-model="hospital.TrialKeepCount" :disabled="disabled || hasPermi(['role:oa'])"
type="number" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:isCanConnectInternet')"
v-hasPermi="['system:hospital:connectInternet']">
<el-switch v-model="hospital.IsCanConnectInternet" active-color="#13ce66" inactive-color="#ff4949"
active-text="是" inactive-text="否" :disabled="disabled">
</el-switch>
</el-form-item>
<el-form-item :label="$t('system:hospital:logo')" prop="HospitalLogoPath">
<upload-logo :path.sync="hospital.HospitalLogoPath" :disabled="disabled" />
</el-form-item>
</el-card>
<el-form-item v-if="status === 'default' && hasPermi(['system:hospital:edit'])">
<el-button type="primary" size="small" style="margin: 10px 15px" :loading="btnLoading"
:disabled="btnLoading" @click="handleSave">{{ $t("system:hospital:save") }}</el-button>
</el-form-item>
</el-form>
<div class="btnBox" v-if="status !== 'default'">
<el-button type="primary" size="small" style="margin: 10px 15px" :loading="btnLoading"
:disabled="btnLoading" @click="handleSave">{{ $t("system:hospital:save") }}</el-button>
<el-button type="primary" size="small" style="margin: 10px 15px" @click="handleCancel">{{
$t("common:button:cancel") }}</el-button>
</div>
</div>
</template> </template>
<script> <script>
import { getHospital } from "@/api/hospital.js"; import { getHospital } from "@/api/hospital.js";
import { addOrUpdateHIRHospital } from '@/api/admin' import { addOrUpdateHIRHospital } from '@/api/admin'
import uploadLogo from "./uploadLogo.vue"; import uploadLogo from "./uploadLogo.vue";
import groupList from "./groupList.vue";
export default { export default {
name: "systemHospital", name: "systemHospital",
components: { "upload-logo": uploadLogo }, components: { "upload-logo": uploadLogo, groupList },
props: { props: {
status: { status: {
type: String, type: String,
@ -78,6 +87,7 @@ export default {
}, },
data() { data() {
return { return {
activeTab: 'hospital',
hospital: { hospital: {
HospitalName: null, HospitalName: null,
HospitalAliasName: null, HospitalAliasName: null,
@ -140,6 +150,11 @@ export default {
}, },
}, },
methods: { methods: {
clickTab(tab, event) {
this.activeTab = tab
console.log(this.activeTab)
// this.$router.push({ path: `/dictionary/template?tabActive=${tab.name}` });
},
async handleSave() { async handleSave() {
if (this.btnLoading) return; if (this.btnLoading) return;
try { try {
@ -184,6 +199,24 @@ export default {
margin-bottom: 40px; margin-bottom: 40px;
} }
::v-deep .el-tabs__header {
position: absolute;
top: 0;
left: 0;
z-index: 999;
width: 100%;
}
::v-deep .el-tabs__content {
padding-top: 50px;
height: 100%;
}
::v-deep .el-tab-pane {
height: 100%;
}
.hospital { .hospital {
width: 100%; width: 100%;
height: 100%; height: 100%;

View File

@ -0,0 +1,289 @@
<template>
<div class="groupList">
<div ref="leftContainer" class="left">
<el-form :inline="true">
<el-form-item :label="$t('system:hospital:group:Code')" prop="Code">
<el-input v-model="searchData.Code" size="small" clearable style="width:100px" />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:Name')" prop="Name">
<el-input v-model="searchData.Name" size="small" clearable style="width:100px" />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:Affiliation')" prop="Affiliation">
<el-input v-model="searchData.Affiliation" size="small" clearable style="width:100px" />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:ContactName')" prop="ContactName">
<el-input v-model="searchData.ContactName" size="small" clearable style="width:100px" />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:ContactPhone')" prop="ContactPhone">
<el-input v-model="searchData.ContactPhone" size="small" clearable style="width:100px" />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:State')" prop="IsEnable">
<el-select v-model="searchData.IsEnable" size="small" clearable style="width:100px">
<el-option v-for="item in $d.IsEnable" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">
查询
</el-button>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">
新增
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" v-adaptive="{ bottomOffset: 65 }" height="100" :data="list" class="table"
@sort-change="handleSortByColumn" :default-sort="{ prop: 'CreateTime', order: 'descending' }">
<el-table-column type="index" width="50" />
<el-table-column :label="$t('system:hospital:group:Code')" prop="Code" min-width="80"
show-overflow-tooltip sortable="custom" />
<el-table-column :label="$t('system:hospital:group:Name')" prop="Name" min-width="120"
show-overflow-tooltip sortable="custom" />
<el-table-column :label="$t('system:hospital:group:Affiliation')" prop="Affiliation" min-width="120"
show-overflow-tooltip sortable="custom" />
<el-table-column :label="$t('system:hospital:group:ContactName')" prop="ContactName" min-width="120"
show-overflow-tooltip sortable="custom" />
<el-table-column :label="$t('system:hospital:group:ContactPhone')" prop="ContactPhone" min-width="120"
show-overflow-tooltip sortable="custom" />
<el-table-column :label="$t('system:hospital:group:IdentityUserIdList')" prop="IdentityUserIdList"
min-width="80" show-overflow-tooltip sortable="custom">
<template slot-scope="scope">
<span>{{scope.row.GAUserList && scope.row.GAUserList.length > 0
? scope.row.GAUserList.map(item => item.UserName).join(", ") : ''}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('system:hospital:group:State')" prop="IsEnable" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag :type="!scope.row.IsEnable ? 'danger' : ''">
<span>{{ $fd("IsEnable", scope.row.IsEnable) }}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('system:hospital:table:createTime')" prop="CreateTime" min-width="150"
sortable="custom" show-overflow-tooltip />
<el-table-column :label="$t('system:hospital:table:updateTime')" prop="UpdateTime" min-width="150"
sortable="custom" show-overflow-tooltip />
<el-table-column :label="$t('common:action:action')" fixed="right" prop="" min-width="200"
show-overflow-tooltip>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleEdit(scope.row)">
{{ $t('common:button:edit') }}
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">
{{ $t('common:button:delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination" style="text-align: right; margin-top: 5px">
<pagination :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
@pagination="getList" />
</div>
</div>
<el-dialog top="3vh" :title="status === 'edit' ? '编辑' : '新增'" :visible.sync="visible" width="450px"
:append-to-body="true">
<el-form ref="hospitalGroupForm" size="small" :model="from" :rules="rules" label-width="100px">
<el-form-item :label="$t('system:hospital:group:Code')" prop="Code">
<el-input v-model.trim="from.Code" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:Name')" prop="Name">
<el-input v-model.trim="from.Name" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:Affiliation')" prop="Affiliation">
<el-input v-model="from.Affiliation" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:ContactName')" prop="ContactName">
<el-input v-model="from.ContactName" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:ContactPhone')" prop="ContactPhone">
<el-input v-model="from.ContactPhone" clearable />
</el-form-item>
<el-form-item :label="$t('system:hospital:group:IdentityUserIdList')" prop="IdentityUserIdList">
<el-select ref="userType" v-model="from.IdentityUserIdList" size="small" placeholder="Please select"
multiple style="width: 100%">
<template v-for="user of GAUserList">
<el-option :key="user.Id" :label="user.UserName" :value="user.Id" />
</template>
</el-select>
</el-form-item>
<el-form-item :label="$t('system:hospital:group:State')" prop="isEnable">
<el-switch v-model="from.isEnable" :active-value="true" :inactive-value="false" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCancel" size="small">{{ $t('common:button:cancel') }}</el-button>
<el-button type="primary" size="small" @click="handleSave" :loading="loading">{{
$t('common:button:save')
}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getHospitalGroupPageList, deleteHospitalGroup, addOrUpdateHospitalGroup, getGAUserList } from '@/api/admin'
import Pagination from '@/components/Pagination'
const searchDataDefault = () => {
return {
Name: null,
ContactPhone: null,
ContactName: null,
Code: null,
Affiliation: null,
Asc: false,
SortField: 'CreateTime',
PageIndex: 1,
PageSize: 20,
}
}
export default {
name: "groupList",
components: { Pagination },
data() {
return {
searchData: searchDataDefault(),
list: [],
total: 0,
loading: false,
visible: false,
from: {
Id: null,
Affiliation: null,
Code: null,
ContactName: null,
ContactPhone: null,
Name: null,
isEnable: true,
IdentityUserIdList: []
},
rules: {
Affiliation: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
Code: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
ContactName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
ContactPhone: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
Name: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
IdentityUserIdList: [
{ required: true, type: 'array', message: 'Please select', trigger: 'blur' },
],
},
GAUserList: [],
status: 'add'
}
},
mounted() {
this.getList()
},
methods: {
async handleSave() {
try {
let validate = await this.$refs.hospitalGroupForm.validate()
if (!validate) return false
this.loading = true
let res = await addOrUpdateHospitalGroup(this.from)
this.loading = false
if (res.IsSuccess) {
this.$message.success(this.$t("common:message:savedSuccessfully"))
this.handleCancel()
this.getList()
}
} catch (err) {
console.log(err)
this.loading = false
}
},
handleCancel() {
this.visible = false
Object.keys(this.from).forEach(key => {
this.from[key] = null
})
this.from.IdentityUserIdList = []
},
async getGAUserList() {
try {
let res = await getGAUserList()
if (res.IsSuccess) {
this.GAUserList = res.Result
}
} catch (err) {
console.log(err)
}
},
getList() {
this.loading = true
getHospitalGroupPageList(this.searchData)
.then((res) => {
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
this.loading = false
})
},
handleAdd() {
this.getGAUserList()
this.status = 'add'
this.visible = true
},
handleEdit(row) {
this.getGAUserList()
this.status = 'edit'
Object.keys(this.from).forEach(key => {
this.from[key] = row[key]
})
this.visible = true
},
//
handleReset() {
this.searchData = searchDataDefault()
this.getList()
},
//
handleDelete(row) {
this.$confirm('是否确认删除?', {
type: 'warning',
distinguishCancelAndClose: true,
}).then(() => {
this.loading = true
deleteHospitalGroup(row.Id)
.then((res) => {
this.loading = false
if (res.IsSuccess) {
this.getList()
this.$message.success(
this.$t('common:message:deletedSuccessfully')
)
}
})
.catch(() => {
this.loading = false
})
})
},
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
}
</script>
<style lang="scss" scoped></style>

View File

@ -84,10 +84,9 @@
@pagination="getList" /> @pagination="getList" />
</div> </div>
</div> </div>
<el-dialog top="3vh" :title="status === 'edit' ? '编辑' : '新增'" :visible.sync="visible" width="850px"> <el-dialog top="3vh" :title="status === 'edit' ? '编辑' : '新增'" :visible.sync="visible" :fullscreen="true">
<system-hospital v-if="visible" :status="status" :rowData="rowData" @getList="getList" @close="close" /> <system-hospital v-if="visible" :status="status" :rowData="rowData" @getList="getList" @close="close" />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -134,7 +133,7 @@ export default {
type: 'warning', type: 'warning',
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
}).then(async () => { }).then(async () => {
let res = await updateDefaultHospital({HirHospitalId:row.Id}) let res = await updateDefaultHospital({ HirHospitalId: row.Id })
if (res.IsSuccess) { if (res.IsSuccess) {
this.getList() this.getList()
} }

View File

@ -2,96 +2,100 @@
<el-form ref="userForm" size="small" :model="user" :rules="userFormRules" label-width="150px" style="width: 800px"> <el-form ref="userForm" size="small" :model="user" :rules="userFormRules" label-width="150px" style="width: 800px">
<el-card class="Basic" shadow="never" size="small"> <el-card class="Basic" shadow="never" size="small">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ $t("system:userlist:title:Information") }}</span> <span>{{ $t('system:userlist:title:Information') }}</span>
</div> </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-input v-model="user.UserCode" disabled />
</el-form-item> </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" clearable /> <el-input v-model="user.UserName" />
</el-form-item> </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" clearable /> <el-input v-model="user.LastName" />
</el-form-item> </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" clearable /> <el-input v-model="user.FirstName" />
</el-form-item> </el-form-item>
<!-- <el-form-item
:label="$t('system:userlist:table: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('system:userlist:table:Email')" prop="EMail"> <el-form-item :label="$t('system:userlist:table:Email')" prop="EMail">
<el-input v-model="user.EMail" clearable /> <el-input v-model="user.EMail" :disabled="!!user.UserCode" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('system:userlist:table:Phone')" prop="Phone"> <el-form-item :label="$t('system:userlist:table:Phone')" prop="Phone">
<el-input v-model="user.Phone" clearable /> <el-input v-model="user.Phone" />
</el-form-item> </el-form-item>
<el-form-item v-if="type == 1" :label="$t('system:userlist:table:Disable')"> <el-form-item :label="$t('system:userlist:table:HospitalGroupIdList')"
<el-switch v-model="user.Status" :active-value="1" :inactive-value="0" /> :prop="hasPermi(['role:ga']) ? 'HospitalGroupIdList' : ''">
<div style="display: flex; align-items: center">
<el-select ref="userType" v-model="user.HospitalGroupIdList" size="small" placeholder="Please select" multiple
style="width: 100%" :disabled="user.CanEditUserType === false">
<template v-for="group of hospitalGroupList">
<el-option :key="group.Id" :label="group.Name" :value="group.Id" />
</template>
</el-select>
</div>
</el-form-item> </el-form-item>
<!-- <el-form-item label="IsTestUser:"> <el-form-item :label="$t('system:userlist:table:UserType')" prop="Roles" v-if="type === 0">
<el-switch v-model="user.IsTestUser" /> <div style="display: flex; align-items: center">
</el-form-item> --> <el-select ref="userType" v-model="user.Roles" size="small" placeholder="Please select" multiple
<el-form-item :label="$t('system:userlist:table:UserType')" prop="UserTypeId"> style="width: 100%" :disabled="user.CanEditUserType === false || type === 1" @change="handleChange">
<el-select ref="userType" v-model="user.UserTypeId" size="small" placeholder="" style="width: 100%" <template v-for="userType of userTypeOptions">
:disabled="user.CanEditUserType === false" clearable @change="userTypeChange"> <el-option :key="userType.Id" :label="userType.UserType" :value="userType.Id" />
<template v-for="(userType, key) of userTypeOptions"> </template>
<el-option :key="key" :label="userType.UserType" :value="userType.Id" /> </el-select>
</template> </div>
</el-select> </el-form-item>
<el-form-item :label="$t('system:userlist:table:UserType')" prop="userTypeId" v-else>
<div style="display: flex; align-items: center">
<el-select ref="userType" v-model="Roles" size="small" placeholder="Please select" multiple
style="width: 100%" :disabled="user.CanEditUserType === false || type === 1" @change="handleChange">
<template v-for="userType of userTypeOptions">
<el-option :key="userType.Id" :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-form-item>
<el-form-item label=""> <el-form-item label="">
<span>{{ $t('system:userlist:tip:defaultPassword') }}</span> <span>{{ $t('system:userlist:tip:defaultPassword') }}</span>
</el-form-item> </el-form-item>
<!-- <el-form-item <el-form-item v-if="type == 1" :label="$t('system:userlist:table:Disable')">
:label="$t('trials:researchForm:form:checkCode')" <el-switch v-model="user.Status" :active-value="1" :inactive-value="0" />
prop="checkCode" </el-form-item>
v-if="!IsCanConnectInternet"
>
<el-input v-model="user.checkCode" type="number" />
<span style="color: red"
>请输入校验码用于用户首次登录重置密码时的校验</span
>
</el-form-item> -->
</el-card> </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"> <div slot="header" class="clearfix">
<span>{{ $t("system:userlist:title:Affiliation") }}</span> <span>{{ $t('system:userlist:title:Affiliation') }}</span>
</div> </div>
<el-form-item prop="IsZhiZhun"> <el-form-item prop="IsZhiZhun">
<el-radio-group v-model="user.IsZhiZhun" @change="OrgnizationTypeChanged" :disabled="IsZhiZhunDisabled"> <el-radio-group v-model="user.IsZhiZhun" @change="OrgnizationTypeChanged">
<el-radio :label="true">{{ <el-radio :label="true">{{
$t("system:userlist:title:Internal") $t('system:userlist:title:Internal')
}}</el-radio> }}</el-radio>
<el-radio :label="false">{{ <el-radio :label="false">{{
$t("system:userlist:title:External") $t('system:userlist:title:External')
}}</el-radio> }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item :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" :disabled="user.IsZhiZhun === true" clearable /> <el-input v-model="user.OrganizationName" />
</el-form-item> </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" clearable /> <el-input v-model="user.DepartmentName" />
</el-form-item> </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" clearable /> <el-input v-model="user.PositionName" />
</el-form-item> </el-form-item>
</el-card> </el-card>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" :disabled="isDisabled" style="margin: 10px 15px" @click="handleSave">{{ <el-button type="primary" size="small" :disabled="isDisabled" style="margin: 10px 15px" @click="handleSave">{{
$t("passwordReset:button:submit") }}</el-button> $t('common:button:save') }}</el-button>
</el-form-item> </el-form-item>
<roleList v-if="visible" :visible.sync="visible" :userId="userId" :list="userRoleList"
:userTypeOptions="userTypeOptions" @getRoleList="getRoleList" />
</el-form> </el-form>
</template> </template>
<script> <script>
@ -100,250 +104,292 @@ import {
addUser, addUser,
updateUser, updateUser,
getUserTypeListByUserType, getUserTypeListByUserType,
} from "@/api/admin.js"; getHospitalGroupList
import { getHospital } from "@/api/hospital.js"; } from '@/api/admin.js'
import roleList from './roleList.vue'
export default { export default {
name: "UserInfo", name: 'UserInfo',
props: { props: {
userId: { type: String, default: "" }, userId: { type: String, default: '' },
},
data() {
var validatePassword = (rule, value, callback) => {
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));
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."
)
);
} else {
callback();
}
};
return {
user: {
UserName: "",
LastName: "",
FirstName: "",
Sex: "9",
EMail: "",
Phone: "",
UserTypeId: "",
IsZhiZhun: "",
OrganizationName: "",
DepartmentName: "",
PositionName: "",
IsTestUser: false,
verifyCode: "",
checkCode: "",
},
userFormRules: {
checkCode: [
{
required: true,
message: "Please Input",
trigger: ["blur", "change"],
},
],
UserName: [
{ required: true, validator: validatePassword, trigger: "blur" },
],
UserTypeId: [
{
required: true,
message: "Please Select",
trigger: ["blur", "change"],
},
],
IsZhiZhun: [
{
required: true,
message: "Please Select",
trigger: ["blur", "change"],
},
],
OrganizationName: [
{ required: true, message: "Please specify", trigger: "blur" },
],
LastName: [
{ required: true, message: "Please specify", trigger: "blur" },
{ max: 50, message: "The maximum length is 50" },
],
FirstName: [
{ required: true, message: "Please specify", trigger: "blur" },
{ max: 50, message: "The maximum length is 50" },
],
Phone: [
{
max: 20,
min: 7,
message: "The length is 7 to 20",
trigger: ["blur"],
},
],
EMail: [
{
required: true,
message: "Please input the email address",
trigger: "blur",
},
{
type: "email",
message: "Please input the correct email address",
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" },
],
DepartmentName: [{ max: 50, message: "The maximum length is 50" }],
PositionName: [{ max: 50, message: "The maximum length is 50" }],
},
userTypeOptions: [],
isDisabled: false,
type: 0, // 10
IsCanConnectInternet: true, //
hospitalName: null, //
IsZhiZhunDisabled: false,
};
}, },
components: { roleList },
created() { created() {
if (this.userId !== "") { this.getUserTypeList()
this.type = 1; if (this.userId !== '') {
this.getUserInfo()
this.type = 1
} else { } else {
this.type = 0; this.type = 0
} }
this.getUserTypeList(); this.getHospitalGroupList()
this.getInfo();
}, },
methods: { methods: {
// async getHospitalGroupList() {
userTypeChange() {
this.AffiliationChange();
},
//
AffiliationChange(isFirstInfo = false) {
if (this.user.UserTypeId) {
let name = this.getUserType(this.user.UserTypeId);
if (["PM", "PI", "SR", "OA"].includes(name)) {
if (!isFirstInfo) {
this.user.IsZhiZhun = true;
this.user.OrganizationName = this.hospitalName;
}
if (this.user.IsZhiZhun) {
// this.IsZhiZhunDisabled = true;
}
return;
}
if (!isFirstInfo) {
this.user.IsZhiZhun = false;
this.user.OrganizationName = null;
}
this.IsZhiZhunDisabled = false;
}
},
getUserType(id) {
let obj = this.userTypeOptions.find((item) => item.Id === id);
return obj.UserTypeShortName;
},
//
async getInfo() {
try { try {
let res = await getHospital(); let res = await getHospitalGroupList({})
if (res.IsSuccess) { if (res.IsSuccess) {
this.IsCanConnectInternet = res.Result.IsCanConnectInternet; this.hospitalGroupList = res.Result
this.hospitalName = res.Result.HospitalName;
} }
} catch (err) { } catch (err) {
console.log(err); console.log(err)
}
},
openRoleList() {
this.userRoleList = []
this.user.UserRoleList.forEach((item) => {
this.userRoleList.push(Object.assign({}, item))
})
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 regex = new RegExp('([?&])' + param + '=.*?(&|$)')
let separator = url.indexOf('?') !== -1 ? '&' : '?'
//
if (regex.test(url)) {
return url.replace(regex, '$1' + param + '=' + newValue + '$2')
} else {
return url + separator + param + '=' + newValue
} }
}, },
handleSave() { handleSave() {
this.$refs.userForm.validate((valid) => { this.$refs.userForm.validate((valid) => {
if (valid) { if (valid) {
this.isDisabled = true; this.isDisabled = true
const selectedUserType = this.userTypeOptions.filter( const selectedUserType = this.userTypeOptions.filter(
(item) => item.Id === this.user.UserTypeId (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)
if (selectedUserType.length > 0) { if (selectedUserType.length > 0) {
this.user.UserTypeEnum = selectedUserType[0].UserTypeEnum; this.user.UserTypeEnum = selectedUserType[0].UserTypeEnum
} }
this.user.BaseUrl = `${location.protocol}//${location.host}/login`; this.user.BaseUrl = `${location.protocol}//${location.host}/login`
this.user.RouteUrl = `${location.protocol}//${location.host}/email-recompose`; this.user.RouteUrl = `${location.protocol}//${location.host}/email-recompose`
if (this.user.Id) { if (this.user.Id) {
if (this.user.IsZhiZhun) {
this.user.OrganizationName = this.hospitalName;
}
updateUser(this.user) updateUser(this.user)
.then((res) => { .then((res) => {
this.isDisabled = false; this.isDisabled = false
this.$message.success(this.$t('common:message:savedSuccessfully')); this.$message.success('Updated successfully')
}) })
.catch(() => { .catch(() => {
this.isDisabled = false; this.isDisabled = false
}); })
} else { } else {
addUser(this.user) addUser(this.user)
.then((res) => { .then((res) => {
this.isDisabled = false; this.isDisabled = false
this.user.Id = res.Result.Id; this.user.Id = res.Result.Id
this.user.UserCode = res.Result.UserCode; this.user.UserCode = res.Result.UserCode
this.$emit("getUserId", res.Result.Id); this.$emit('getUserId', res.Result.Id)
this.$message.success("Added successfully"); this.$message.success('Added successfully')
this.$router.push({ path: "/system/user/list" }); this.$router.push({ path: '/system/user/list' })
}) })
.catch(() => { .catch(() => {
this.isDisabled = false; this.isDisabled = false
}); })
} }
} }
}); })
}, },
getUserTypeList() { getUserTypeList() {
getUserTypeListByUserType(0).then((res) => { getUserTypeListByUserType(0).then((res) => {
let arr = [2, 4, 5, 8, 9, 12, 14, 35];
if (this.hasPermi(["role:oa"])) {
arr = [4, 5, 8, 9, 12, 14, 35];
}
if (this.hasPermi(["role:ga"])) {
arr = [4, 5, 8, 9, 12, 35];
}
if (res.IsSuccess) { if (res.IsSuccess) {
let arr = [2, 4, 5, 8, 9, 12, 14]; this.userTypeOptions = []
if (this.hasPermi(["role:oa"])) {
arr = [4, 5, 8, 9, 12, 14];
}
this.userTypeOptions = res.Result.map((item) => { this.userTypeOptions = res.Result.map((item) => {
if (arr.includes(item.UserTypeEnum)) { if (arr.includes(item.UserTypeEnum)) {
return item; return item;
} }
}).filter((item) => item); }).filter((item) => item);
if (this.type === 1) {
this.getUserInfo();
}
} }
}); })
}, },
getUserInfo() { getUserInfo() {
getUser(this.userId).then((res) => { getUser({
this.user = res.Result; IdentityUserId: this.userId,
this.user.Status = parseFloat(this.user.Status); }).then((res) => {
this.AffiliationChange(true); this.user = res.Result
}); this.Roles = []
this.user.Roles = []
this.user.UserRoleList = []
res.Result.AccountList.forEach((item) => {
if (!item.IsUserRoleDisabled) {
this.Roles.push(item.UserTypeId)
this.user.Roles.push(item.UserTypeId)
}
this.user.UserRoleList.push({
UserTypeEnum: item.UserTypeEnum,
UserTypeId: item.UserTypeId,
IsUserRoleDisabled: item.IsUserRoleDisabled,
UserTypeShortName: item.UserTypeShortName,
})
})
})
},
getRoleList() {
getUser({
IdentityUserId: this.userId,
}).then((res) => {
this.Roles = []
this.user.Roles = []
this.user.UserRoleList = []
res.Result.AccountList.forEach((item) => {
if (!item.IsUserRoleDisabled) {
this.Roles.push(item.UserTypeId)
this.user.Roles.push(item.UserTypeId)
}
this.user.UserRoleList.push({
UserTypeEnum: item.UserTypeEnum,
UserTypeId: item.UserTypeId,
IsUserRoleDisabled: item.IsUserRoleDisabled,
UserTypeShortName: item.UserTypeShortName,
})
})
})
}, },
OrgnizationTypeChanged(val) { OrgnizationTypeChanged(val) {
if (val) { this.user.OrganizationName = ''
this.user.OrganizationName = this.hospitalName;
} else {
this.user.OrganizationName = "";
}
}, },
}, },
}; data() {
var validatePassword = (rule, value, callback) => {
var lang = zzSessionStorage.getItem('lang')
? zzSessionStorage.getItem('lang')
: 'zh'
/* eslint-disable */
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.'
)
)
} else {
callback()
}
}
return {
userRoleList: [],
Roles: [],
user: {
Roles: [],
UserRoleList: [],
UserName: '',
LastName: '',
FirstName: '',
Sex: '',
EMail: '',
Phone: '',
UserTypeId: '',
IsZhiZhun: '',
OrganizationName: '',
DepartmentName: '',
PositionName: '',
HospitalGroupIdList: [],
IsTestUser: false,
},
visible: false,
userFormRules: {
UserName: [
{ required: true, validator: validatePassword, trigger: 'blur' },
],
Roles: [
{
required: true,
type: 'array',
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
HospitalGroupIdList: [
{
required: true,
type: 'array',
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
IsZhiZhun: [
{
required: true,
message: 'Please Select',
trigger: ['blur', 'change'],
},
],
OrganizationName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
],
LastName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' },
],
FirstName: [
{ required: true, message: 'Please specify', trigger: 'blur' },
{ max: 50, message: 'The maximum length is 50' },
],
Phone: [
{
max: 20,
min: 7,
message: 'The length is 7 to 20',
trigger: ['blur'],
},
],
EMail: [
{
required: true,
message: 'Please input the email address',
trigger: 'blur',
},
{
// type: 'email',
pattern: new RegExp(this.$reg().EmailRegexStr),
message: 'Please input the correct email address',
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' },
],
DepartmentName: [{ max: 50, message: 'The maximum length is 50' }],
PositionName: [{ max: 50, message: 'The maximum length is 50' }],
},
userTypeOptions: [],
hospitalGroupList: [],
isDisabled: false,
type: 0, // 10
}
},
}
</script> </script>
<style scoped> <style scoped>
::v-deep .is-error.my_new_pwd { ::v-deep .is-error.my_new_pwd {

View File

@ -0,0 +1,212 @@
<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('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"
v-loading="loading"
>
<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')" min-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" :loading="loading" size="small" @click="save">
{{ $t('common:button:confirm') }}
</el-button>
<!-- 取消 -->
<el-button size="small" @click="cancel">
{{ $t('common:button:cancel') }}
</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>
import { updateUserRoleInfo } from '@/api/admin.js'
export default {
name: 'roleList',
props: {
userId: { type: String, default: '' },
visible: {
type: Boolean,
default: false,
},
list: {
type: Array,
default: () => {
return []
},
},
userTypeOptions: {
type: Array,
default: () => {
return []
},
},
},
data() {
return {
addVisible: false,
loading: 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) && ![4, 6, 20].includes(item.UserTypeEnum)
)
},
},
methods: {
cancel() {
this.$emit('update:visible', false)
},
openAdd() {
this.form.roles = []
this.addVisible = true
},
async save() {
try {
let data = {
Id: this.userId,
UserRoleList: this.list,
}
this.loading = true
let res = await updateUserRoleInfo(data)
this.loading = false
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:updatedSuccessfully'))
this.$emit('update:visible', false)
this.$emit('getRoleList')
}
} catch (err) {
this.loading = false
console.log(err)
}
},
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

@ -1,34 +1,27 @@
<template> <template>
<box-content> <box-content>
<div class="search" style="position: relative"> <div class="search" style="position: relative">
<SearchForm <SearchForm size="mini" :that="this" :search-data="searchData" :search-form="searchForm"
size="mini" :search-handle="searchHandle" @search="handleSearch" @reset="handleReset" @new="handleAddUser" />
:that="this"
:search-data="searchData"
:search-form="searchForm"
:search-handle="searchHandle"
@search="handleSearch"
@reset="handleReset"
@new="handleAddUser"
/>
</div> </div>
<base-table <base-table v-loading="loading" :columns="columns" :list="users" :search-data="searchData" :total="total"
v-loading="loading" @getList="getList" @editCb="handleEditUser" @deleteCb="handleDeleteUser" @sortByColumn="sortByColumn">
:columns="columns"
:list="users"
:search-data="searchData"
:total="total"
@getList="getList"
@editCb="handleEditUser"
@deleteCb="handleDeleteUser"
@sortByColumn="sortByColumn"
>
<!-- 选择自定义slot --> <!-- 选择自定义slot -->
<template slot="genderSlot" slot-scope="{ scope }"> <template slot="genderSlot" slot-scope="{ scope }">
{{ scope.row.Sex ? "Male" : "Female" }} {{ scope.row.Sex ? "Male" : "Female" }}
</template> </template>
<template slot="UserTypeSlot" slot-scope="{ scope }">
{{
Array.isArray(scope.row.UserRoleList) &&
scope.row.UserRoleList.length > 0
? scope.row.UserRoleList.filter((item) => !item.IsUserRoleDisabled)
.map((item) => item.UserTypeShortName)
.join(', ')
: ''
}}
</template>
<template slot="roleSlot" slot-scope="{ scope }"> <template slot="roleSlot" slot-scope="{ scope }">
{{ scope.row.RoleNameList.map((role) => role.RoleName).join(",") }} {{scope.row.RoleNameList.map((role) => role.RoleName).join(",")}}
</template> </template>
<template slot="isZhiZhunSlot" slot-scope="{ scope }"> <template slot="isZhiZhunSlot" slot-scope="{ scope }">
{{ {{
@ -68,7 +61,7 @@ const searchDataDefault = () => {
return { return {
UserName: null, UserName: null,
Phone: null, Phone: null,
EMail:null, EMail: null,
OrganizationName: null, OrganizationName: null,
UserState: null, UserState: null,
UserType: null, UserType: null,
@ -145,6 +138,7 @@ export default {
prop: "UserType", prop: "UserType",
label: this.$t("system:userlist:table:UserType"), label: this.$t("system:userlist:table:UserType"),
minWidth: 100, minWidth: 100,
slot: 'UserTypeSlot',
sortable: "custom", sortable: "custom",
showOverflowTooltip: true, showOverflowTooltip: true,
}, },

View File

@ -61,7 +61,7 @@
$t('trials:trials-myinfo:title:accountInfo') $t('trials:trials-myinfo:title:accountInfo')
}}</el-menu-item> }}</el-menu-item>
<!-- 管理后台 --> <!-- 管理后台 -->
<el-menu-item v-if="hasPermi(['role:dev', 'role:oa', 'role:admin'])" index="4-4">{{ <el-menu-item v-if="hasPermi(['role:dev', 'role:oa', 'role:admin', 'role:ga'])" 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">{{ <el-menu-item index="4-5" v-if="hasRole">{{
@ -98,7 +98,7 @@ export default {
NODE_ENV: process.env.NODE_ENV, // process.env.NODE_ENV NODE_ENV: process.env.NODE_ENV, // process.env.NODE_ENV
activeIndex: '2', activeIndex: '2',
isReviewer: false, isReviewer: false,
userTypeShortName: zzSessionStorage.getItem('userTypeShortName'), // userTypeShortName: zzSessionStorage.getItem('userTypeShortName'),
notice: '', notice: '',
hospital: { hospital: {
HospitalLogoPath: null, HospitalLogoPath: null,
@ -116,6 +116,7 @@ export default {
'device', 'device',
'TotalNeedSignSystemDocCount', 'TotalNeedSignSystemDocCount',
'language', 'language',
'userTypeShortName'
]), ]),
roles() { roles() {
return this.$store.state.user.roles return this.$store.state.user.roles

View File

@ -90,7 +90,7 @@ export default {
.then(async (res) => { .then(async (res) => {
this.user = res.Result; this.user = res.Result;
/* eslint-disable */ /* eslint-disable */
zzSessionStorage.setItem("realName", this.user.RealName); zzSessionStorage.setItem("Name", this.user.FullName);
await store.dispatch("user/updateInfo"); await store.dispatch("user/updateInfo");
loading.close(); loading.close();
}) })