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

uat_us
caiyiling 2024-12-26 16:07:52 +08:00
commit 47c6b30d4a
12 changed files with 148 additions and 39 deletions

View File

@ -325,3 +325,12 @@ export function useUserIDGetDoctorID(data) {
data data
}) })
} }
// 管理端修改用户角色
export function updateUserRoleInfo(data) {
return request({
url: `/User/updateUserRoleInfo`,
method: 'put',
data
})
}

View File

@ -19,7 +19,7 @@
v-for="item in roles" v-for="item in roles"
:key="item.Id" :key="item.Id"
:label="item.Id" :label="item.Id"
:disabled="item.isUserRoleDisabled" :disabled="item.IsUserRoleDisabled"
style="margin-bottom: 10px" style="margin-bottom: 10px"
> >
{{ item.UserTypeShortName }} {{ item.UserTypeShortName }}

View File

@ -293,6 +293,7 @@ async function VueInit() {
}() }()
_vm.$forceUpdate() _vm.$forceUpdate()
} }
Vue.prototype.$EventBus = new Vue()
Vue.prototype.$path = [] Vue.prototype.$path = []
var t = function (key) { var t = function (key) {
if (!~Vue.prototype.$path.indexOf(key)) { if (!~Vue.prototype.$path.indexOf(key)) {

View File

@ -189,6 +189,7 @@ const actions = {
commit('SET_PERMISSIONS', permissions.Result) commit('SET_PERMISSIONS', permissions.Result)
zzSessionStorage.setItem('newTree', JSON.stringify(menuTree.Result)) zzSessionStorage.setItem('newTree', JSON.stringify(menuTree.Result))
zzSessionStorage.setItem('permissions', JSON.stringify(permissions.Result)) zzSessionStorage.setItem('permissions', JSON.stringify(permissions.Result))
zzSessionStorage.removeItem('lastWorkbench')
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
@ -272,6 +273,21 @@ const actions = {
console.log(e) console.log(e)
} }
}, },
async resetData({ commit, state }) {
try {
removeToken() // must remove token first
// await loginOut({
// UserRoleId: zzSessionStorage.getItem('userId'),
// IdentityUserId: zzSessionStorage.getItem('identityUserId'),
// })
resetRouter()
removeName()
zzSessionStorage.clear()
commit('RESET_STATE')
} catch (e) {
console.log(e)
}
},
setToken({ commit }, token) { setToken({ commit }, token) {
commit('SET_TOKEN', token) commit('SET_TOKEN', token)
}, },

View File

@ -138,7 +138,7 @@ export default {
...mapMutations({ setLanguage: 'lang/setLanguage' }), ...mapMutations({ setLanguage: 'lang/setLanguage' }),
async logout() { async logout() {
var loginType = zzSessionStorage.getItem('loginType') var loginType = zzSessionStorage.getItem('loginType')
await this.$store.dispatch('user/logout') await this.$store.dispatch('user/resetData')
if (loginType) { if (loginType) {
this.$router.push(`/login?loginType=${loginType}`) this.$router.push(`/login?loginType=${loginType}`)
} else { } else {

View File

@ -85,11 +85,32 @@
style="width: 100%" style="width: 100%"
:disabled="user.CanEditUserType === false || type === 1" :disabled="user.CanEditUserType === false || type === 1"
@change="handleChange" @change="handleChange"
v-if="type === 0"
> >
<template v-for="(userType, key) of userTypeOptions"> <template v-for="userType of userTypeOptions">
<el-option <el-option
v-if="userType.UserTypeEnum !== 20" v-if="userType.UserTypeEnum !== 20"
:key="key" :key="userType.Id"
:label="userType.UserType"
:value="userType.Id"
/>
</template>
</el-select>
<el-select
ref="userType"
v-model="Roles"
size="small"
placeholder="Please select"
multiple
style="width: 100%"
:disabled="user.CanEditUserType === false || type === 1"
@change="handleChange"
v-else
>
<template v-for="userType of userTypeOptions">
<el-option
v-if="userType.UserTypeEnum !== 20"
:key="userType.Id"
:label="userType.UserType" :label="userType.UserType"
:value="userType.Id" :value="userType.Id"
/> />
@ -162,9 +183,10 @@
<roleList <roleList
v-if="visible" v-if="visible"
:visible.sync="visible" :visible.sync="visible"
:list="user.UserRoleList" :userId="userId"
:roles.sync="user.Roles" :list="userRoleList"
:userTypeOptions="userTypeOptions" :userTypeOptions="userTypeOptions"
@getRoleList="getRoleList"
/> />
</el-form> </el-form>
</template> </template>
@ -193,6 +215,10 @@ export default {
}, },
methods: { methods: {
openRoleList() { openRoleList() {
this.userRoleList = []
this.user.UserRoleList.forEach((item) => {
this.userRoleList.push(Object.assign({}, item))
})
this.visible = true this.visible = true
}, },
handleChange(val) { handleChange(val) {
@ -274,10 +300,33 @@ export default {
IdentityUserId: this.userId, IdentityUserId: this.userId,
}).then((res) => { }).then((res) => {
this.user = res.Result this.user = res.Result
this.Roles = []
this.user.Roles = [] this.user.Roles = []
this.user.UserRoleList = [] this.user.UserRoleList = []
res.Result.AccountList.forEach((item) => { res.Result.AccountList.forEach((item) => {
if (!item.IsUserRoleDisabled) { 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.Roles.push(item.UserTypeId)
} }
this.user.UserRoleList.push({ this.user.UserRoleList.push({
@ -315,6 +364,8 @@ export default {
} }
} }
return { return {
userRoleList: [],
Roles: [],
user: { user: {
Roles: [], Roles: [],
UserRoleList: [], UserRoleList: [],

View File

@ -7,7 +7,6 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
append-to-body append-to-body
:show-close="false"
:title="$t('system:userlist:roleList:title')" :title="$t('system:userlist:roleList:title')"
:before-close="cancel" :before-close="cancel"
> >
@ -19,7 +18,12 @@
> >
{{ $t('common:button:new') }} {{ $t('common:button:new') }}
</el-button> </el-button>
<el-table :data="list" style="width: 100%" max-height="300px"> <el-table
:data="list"
style="width: 100%"
max-height="300px"
v-loading="loading"
>
<el-table-column type="index" width="40" /> <el-table-column type="index" width="40" />
<el-table-column <el-table-column
prop="UserTypeShortName" prop="UserTypeShortName"
@ -56,9 +60,13 @@
</el-table> </el-table>
<div slot="footer"> <div slot="footer">
<!-- 保存 --> <!-- 保存 -->
<el-button type="primary" size="small" @click="save"> <el-button type="primary" :loading="loading" size="small" @click="save">
{{ $t('common:button:confirm') }} {{ $t('common:button:confirm') }}
</el-button> </el-button>
<!-- 取消 -->
<el-button size="small" @click="cancel">
{{ $t('common:button:cancel') }}
</el-button>
</div> </div>
<el-dialog <el-dialog
v-if="addVisible" v-if="addVisible"
@ -103,9 +111,11 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { updateUserRoleInfo } from '@/api/admin.js'
export default { export default {
name: 'roleList', name: 'roleList',
props: { props: {
userId: { type: String, default: '' },
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -116,12 +126,6 @@ export default {
return [] return []
}, },
}, },
roles: {
type: Array,
default: () => {
return []
},
},
userTypeOptions: { userTypeOptions: {
type: Array, type: Array,
default: () => { default: () => {
@ -132,6 +136,7 @@ export default {
data() { data() {
return { return {
addVisible: false, addVisible: false,
loading: false,
form: { form: {
roles: [], roles: [],
}, },
@ -161,15 +166,24 @@ export default {
openAdd() { openAdd() {
this.addVisible = true this.addVisible = true
}, },
save() { async save() {
let roles = [] try {
this.list.forEach((item) => { let data = {
if (!item.IsUserRoleDisabled) { Id: this.userId,
roles.push(item.UserTypeId) UserRoleList: this.list,
} }
}) this.loading = true
this.$emit('update:roles', roles) let res = await updateUserRoleInfo(data)
this.$emit('update:visible', false) 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() { async saveAdd() {
try { try {

View File

@ -270,15 +270,16 @@ export default {
history.go(0) history.go(0)
// this.$router.replace({ path: '/trials/trials-list' }) // this.$router.replace({ path: '/trials/trials-list' })
} else { } else {
history.replaceState(null, null, '/trials') history.replaceState(null, null, '/trials/trials-workbench')
history.go(0) history.go(0)
// this.$router.replace({ path: '/trials/trials-workbench' }) // this.$router.replace({ path: '/trials/trials-workbench' })
} }
this.toggleRoleVisible = false this.toggleRoleVisible = false
this.toggleRoleLoading = false this.toggleRoleLoading = false
this.$nextTick(() => { this.$EventBus.$emit('reload')
window.location.reload() // this.$nextTick(() => {
}) // window.location.reload()
// })
} else { } else {
// //
this.toggleRoleLoading = false this.toggleRoleLoading = false

View File

@ -788,6 +788,11 @@ export default {
created() { created() {
this.initPage() this.initPage()
}, },
mounted(){
this.$EventBus.$on("reload", (data) => {
window.location.reload()
});
},
methods: { methods: {
initPage() { initPage() {
this.getList() this.getList()

View File

@ -525,7 +525,7 @@ export default {
.getElementsByTagName('canvas') .getElementsByTagName('canvas')
let a = document.createElement('a') let a = document.createElement('a')
a.href = qrCodeCanvas[0].toDataURL('image/url') a.href = qrCodeCanvas[0].toDataURL('image/url')
a.download = `${this.$t('trials:researchRecord:title:code')}.png` a.download = `${this.$route.query.researchProgramNo}${this.$t('trials:researchRecord:title:code')}.png`
a.click() a.click()
}, },
// //

View File

@ -632,10 +632,10 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:title="$t('trials:logincCfg:form:modality')" :title="$t('trials:logincCfg:form:modality')"
custom-class="base-dialog-wrapper" custom-class="base-dialog-wrapper"
width="900px" width="400px"
> >
<div class="base-dialog-body" style="height: 400px; text-align: center"> <div class="base-dialog-body">
<el-transfer <!-- <el-transfer
filterable filterable
:filter-method="filterMethod" :filter-method="filterMethod"
filter-placeholder="" filter-placeholder=""
@ -651,8 +651,8 @@
}" }"
:render-content="renderFunc" :render-content="renderFunc"
> >
</el-transfer> </el-transfer> -->
<!-- <el-table <el-table
ref="multipleTable" ref="multipleTable"
:data="$d.Modality" :data="$d.Modality"
stripe stripe
@ -671,7 +671,7 @@
prop="value" prop="value"
:label="$t('trials:logincCfg:form:modality')" :label="$t('trials:logincCfg:form:modality')"
/> />
</el-table> --> </el-table>
</div> </div>
<div <div
class="base-dialog-footer" class="base-dialog-footer"
@ -959,7 +959,8 @@ export default {
handleConfirmModality() { handleConfirmModality() {
this.form.ModalityList = Object.assign( this.form.ModalityList = Object.assign(
[], [],
this.selectedList.map((v) => v) // this.selectedList.map((v) => v)
this.selectedList.map((v) => v.value)
) )
let Modalitys = this.form.ModalityList.map((item) => { let Modalitys = this.form.ModalityList.map((item) => {
return this.$fd('Modality', item.trim()) return this.$fd('Modality', item.trim())
@ -984,12 +985,20 @@ export default {
}, },
handleSetModality() { handleSetModality() {
this.modalityListVisible = true this.modalityListVisible = true
var a = this.$d.Modality.filter((v) => { this.$nextTick(() => {
return !!this.form.ModalityList.find((v1) => { var a = this.$d.Modality.filter((v) => {
return v1 === v.value return !!this.form.ModalityList.find((v1) => {
return v1 === v.value
})
}) })
this.toggleSelection(a)
}) })
this.selectedList = a.map((item) => item.value) // var a = this.$d.Modality.filter((v) => {
// return !!this.form.ModalityList.find((v1) => {
// return v1 === v.value
// })
// })
// this.selectedList = a.map((item) => item.value)
}, },
handleBodyPartSelectionChange(val) { handleBodyPartSelectionChange(val) {
this.selectedBodyParts = val this.selectedBodyParts = val

View File

@ -487,6 +487,9 @@ export default {
hoursTip=this.$t('common:date:good evening') hoursTip=this.$t('common:date:good evening')
} }
this.hoursTip = hoursTip this.hoursTip = hoursTip
this.$EventBus.$on("reload", (data) => {
window.location.reload()
});
}, },
methods: { methods: {
getUserInfo() { getUserInfo() {