用户列表添加已有用户进入课题组入口
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3d1dfe9812
commit
fc0533c7d9
|
@ -7,7 +7,13 @@ export function getUserList(param) {
|
|||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserByEmail(params) {
|
||||
return request({
|
||||
url: '/User/getUserByEmail',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function getUserTypeList() {
|
||||
return request({
|
||||
url: `/UserTypeRole/getUserTypeList/0`,
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<box-content>
|
||||
<div class="search" style="position: relative">
|
||||
<SearchForm size="mini" :that="this" :search-data="searchData" :search-form="searchForm"
|
||||
:search-handle="searchHandle" @search="handleSearch" @reset="handleReset" @new="handleAddUser" />
|
||||
:search-handle="searchHandle" @search="handleSearch" @reset="handleReset" @new="handleAddUser"
|
||||
@group="hadleAddGroup" />
|
||||
</div>
|
||||
<base-table v-loading="loading" :columns="columns" :list="users" :search-data="searchData" :total="total"
|
||||
@getList="getList" @editCb="handleEditUser" @deleteCb="handleDeleteUser" @sortByColumn="sortByColumn">
|
||||
|
@ -64,16 +65,81 @@
|
|||
}}
|
||||
</template>
|
||||
</base-table>
|
||||
<base-model v-if="config.visible" :config="config">
|
||||
<template slot="dialog-body">
|
||||
<el-form :inline="true" class="base-search-form">
|
||||
<el-form-item :label="$t('system:userlist:table:Email')">
|
||||
<el-input v-model="EMail" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:Email')" v-show="false">
|
||||
<el-input v-model="EMail" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- 查询 -->
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleGroupSearch">
|
||||
{{ $t('common:button:search') }}
|
||||
</el-button>
|
||||
<!-- 重置 -->
|
||||
<el-button type="primary" icon="el-icon-refresh-left" @click="handleGroupReset">
|
||||
{{ $t('common:button:reset') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form v-loading="groupLoading" size="small" :model="userInfo" label-width="80px" style="margin-top: 30px;"
|
||||
v-show="userInfo.Id">
|
||||
<el-form-item :label="$t('system:userlist:table:UserName')">
|
||||
<span>{{ userInfo.UserName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:LastName')">
|
||||
<span>{{ userInfo.LastName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:FirstName')">
|
||||
<span>{{ userInfo.FirstName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:Email')">
|
||||
<span>{{ userInfo.Email }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:Phone')">
|
||||
<span>{{ userInfo.Phone }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:UserType')">
|
||||
<span>{{
|
||||
Array.isArray(userInfo.AccountList) ? userInfo.AccountList.map(item =>
|
||||
item.UserTypeShortName).join(",") : ''
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('system:userlist:table:HospitalGroupIdList')">
|
||||
<el-select v-model="userInfo.HospitalGroupIdList" size="small" placeholder="Please select" multiple
|
||||
style="width: 100%">
|
||||
<template v-for="group of hospitalGroupList">
|
||||
<el-option :key="group.Id" :label="group.Name" :value="group.Id" />
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<template slot="dialog-footer">
|
||||
<!-- 取消 -->
|
||||
<el-button size="small" type="primary" @click="config.visible = false">
|
||||
{{ $t("common:button:cancel") }}
|
||||
</el-button>
|
||||
<!-- 保存 -->
|
||||
<el-button size="small" type="primary" @click="addGroup" :loading="groupLoading" :disabled="!userInfo.Id">
|
||||
{{ $t("common:button:confirm") }}
|
||||
</el-button>
|
||||
</template>
|
||||
</base-model>
|
||||
</box-content>
|
||||
</template>
|
||||
<script>
|
||||
import { getUserList, getUserTypeList, deleteSysUser, getHospitalGroupList } from "@/api/admin";
|
||||
import { getUserList, getUserTypeList, deleteSysUser, getHospitalGroupList, getUserByEmail, updateUserHospitalGroupInfo } from "@/api/admin";
|
||||
// import { searchForm, searchHandle, columns } from './list'
|
||||
import BoxContent from "@/components/BoxContent";
|
||||
import SearchForm from "@/components/BaseForm/search-form";
|
||||
import BaseTable from "@/components/BaseTable";
|
||||
import tableMixins from "@/mixins/table";
|
||||
import moment from 'moment'
|
||||
import BaseModel from '@/components/BaseModel'
|
||||
// 用户列表查询表单配置信息
|
||||
// 用户列表查询表单事件配置信息
|
||||
const searchDataDefault = () => {
|
||||
|
@ -96,11 +162,21 @@ const searchDataDefault = () => {
|
|||
};
|
||||
export default {
|
||||
name: "UserList",
|
||||
components: { BoxContent, SearchForm, BaseTable },
|
||||
components: { BoxContent, SearchForm, BaseTable, BaseModel },
|
||||
mixins: [tableMixins],
|
||||
data() {
|
||||
return {
|
||||
searchData: searchDataDefault(),
|
||||
config: {
|
||||
visible: false,
|
||||
title: this.$t('system:userlist:dialogTitle:addGroup'),
|
||||
width: '800px',
|
||||
appendToBody: true
|
||||
},
|
||||
EMail: '',
|
||||
userInfo: {},
|
||||
hospitalGroupList: [],
|
||||
groupLoading: false,
|
||||
columns: [
|
||||
{ type: 'tip', slot: 'tip-slot' },
|
||||
{ type: 'index' },
|
||||
|
@ -389,6 +465,11 @@ export default {
|
|||
type: 'primary',
|
||||
emitKey: 'new',
|
||||
},
|
||||
{
|
||||
label: this.$t('system:userlist:button:addGroup'),
|
||||
type: 'primary',
|
||||
emitKey: 'group',
|
||||
},
|
||||
],
|
||||
userTypeOptions: [],
|
||||
loading: false,
|
||||
|
@ -402,6 +483,65 @@ export default {
|
|||
this.getHospitalGroupList()
|
||||
},
|
||||
methods: {
|
||||
async addGroup() {
|
||||
try {
|
||||
let HospitalGroupList = []
|
||||
if (Array.isArray(this.userInfo.HospitalGroupIdList) && this.userInfo.HospitalGroupIdList.length > 0) {
|
||||
this.hospitalGroupList.forEach(item => {
|
||||
if (this.userInfo.HospitalGroupIdList.includes(item.Id)) {
|
||||
HospitalGroupList.push({
|
||||
Id: item.Id,
|
||||
IsDisabled: false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
let data = {
|
||||
Id: this.userInfo.Id,
|
||||
HospitalGroupList: HospitalGroupList,
|
||||
}
|
||||
this.groupLoading = true
|
||||
let res = await updateUserHospitalGroupInfo(data)
|
||||
this.groupLoading = false
|
||||
if (res.IsSuccess) {
|
||||
this.$message.success(this.$t('common:message:updatedSuccessfully'))
|
||||
this.config.visible = false
|
||||
this.getList()
|
||||
}
|
||||
} catch (err) {
|
||||
this.groupLoading = false
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
async handleGroupSearch() {
|
||||
try {
|
||||
let params = {
|
||||
EMail: this.EMail,
|
||||
PageSize: 1000,
|
||||
PageIndex: 1,
|
||||
}
|
||||
this.userInfo = {}
|
||||
this.groupLoading = true
|
||||
let res = await getUserByEmail(params)
|
||||
this.groupLoading = false
|
||||
if (res.IsSuccess) {
|
||||
this.userInfo = res.Result
|
||||
this.userInfo.HospitalGroupIdList = []
|
||||
}
|
||||
} catch (err) {
|
||||
this.groupLoading = false
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
handleGroupReset() {
|
||||
this.EMail = ''
|
||||
this.handleGroupSearch()
|
||||
},
|
||||
hadleAddGroup() {
|
||||
this.userInfo = {}
|
||||
this.EMail = ''
|
||||
this.config.visible = true
|
||||
},
|
||||
diffTime(time) {
|
||||
return moment(new Date()).diff(time, 'days')
|
||||
},
|
||||
|
@ -409,9 +549,9 @@ export default {
|
|||
try {
|
||||
let res = await getHospitalGroupList({})
|
||||
if (res.IsSuccess) {
|
||||
let hospitalGroupList = res.Result
|
||||
this.hospitalGroupList = res.Result
|
||||
const index = this.findItemIndex("HospitalGroupId");
|
||||
this.$set(this.searchForm[index], "options", hospitalGroupList);
|
||||
this.$set(this.searchForm[index], "options", this.hospitalGroupList);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
|
|
Loading…
Reference in New Issue