用户列表添加已有用户进入课题组入口
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
|
data: param
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getUserByEmail(params) {
|
||||||
|
return request({
|
||||||
|
url: '/User/getUserByEmail',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
export function getUserTypeList() {
|
export function getUserTypeList() {
|
||||||
return request({
|
return request({
|
||||||
url: `/UserTypeRole/getUserTypeList/0`,
|
url: `/UserTypeRole/getUserTypeList/0`,
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<box-content>
|
<box-content>
|
||||||
<div class="search" style="position: relative">
|
<div class="search" style="position: relative">
|
||||||
<SearchForm size="mini" :that="this" :search-data="searchData" :search-form="searchForm"
|
<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>
|
</div>
|
||||||
<base-table v-loading="loading" :columns="columns" :list="users" :search-data="searchData" :total="total"
|
<base-table v-loading="loading" :columns="columns" :list="users" :search-data="searchData" :total="total"
|
||||||
@getList="getList" @editCb="handleEditUser" @deleteCb="handleDeleteUser" @sortByColumn="sortByColumn">
|
@getList="getList" @editCb="handleEditUser" @deleteCb="handleDeleteUser" @sortByColumn="sortByColumn">
|
||||||
|
@ -64,16 +65,81 @@
|
||||||
}}
|
}}
|
||||||
</template>
|
</template>
|
||||||
</base-table>
|
</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>
|
</box-content>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<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 { searchForm, searchHandle, columns } from './list'
|
||||||
import BoxContent from "@/components/BoxContent";
|
import BoxContent from "@/components/BoxContent";
|
||||||
import SearchForm from "@/components/BaseForm/search-form";
|
import SearchForm from "@/components/BaseForm/search-form";
|
||||||
import BaseTable from "@/components/BaseTable";
|
import BaseTable from "@/components/BaseTable";
|
||||||
import tableMixins from "@/mixins/table";
|
import tableMixins from "@/mixins/table";
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import BaseModel from '@/components/BaseModel'
|
||||||
// 用户列表查询表单配置信息
|
// 用户列表查询表单配置信息
|
||||||
// 用户列表查询表单事件配置信息
|
// 用户列表查询表单事件配置信息
|
||||||
const searchDataDefault = () => {
|
const searchDataDefault = () => {
|
||||||
|
@ -96,11 +162,21 @@ const searchDataDefault = () => {
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
name: "UserList",
|
name: "UserList",
|
||||||
components: { BoxContent, SearchForm, BaseTable },
|
components: { BoxContent, SearchForm, BaseTable, BaseModel },
|
||||||
mixins: [tableMixins],
|
mixins: [tableMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchData: searchDataDefault(),
|
searchData: searchDataDefault(),
|
||||||
|
config: {
|
||||||
|
visible: false,
|
||||||
|
title: this.$t('system:userlist:dialogTitle:addGroup'),
|
||||||
|
width: '800px',
|
||||||
|
appendToBody: true
|
||||||
|
},
|
||||||
|
EMail: '',
|
||||||
|
userInfo: {},
|
||||||
|
hospitalGroupList: [],
|
||||||
|
groupLoading: false,
|
||||||
columns: [
|
columns: [
|
||||||
{ type: 'tip', slot: 'tip-slot' },
|
{ type: 'tip', slot: 'tip-slot' },
|
||||||
{ type: 'index' },
|
{ type: 'index' },
|
||||||
|
@ -389,6 +465,11 @@ export default {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
emitKey: 'new',
|
emitKey: 'new',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('system:userlist:button:addGroup'),
|
||||||
|
type: 'primary',
|
||||||
|
emitKey: 'group',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
userTypeOptions: [],
|
userTypeOptions: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -402,6 +483,65 @@ export default {
|
||||||
this.getHospitalGroupList()
|
this.getHospitalGroupList()
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
diffTime(time) {
|
||||||
return moment(new Date()).diff(time, 'days')
|
return moment(new Date()).diff(time, 'days')
|
||||||
},
|
},
|
||||||
|
@ -409,9 +549,9 @@ export default {
|
||||||
try {
|
try {
|
||||||
let res = await getHospitalGroupList({})
|
let res = await getHospitalGroupList({})
|
||||||
if (res.IsSuccess) {
|
if (res.IsSuccess) {
|
||||||
let hospitalGroupList = res.Result
|
this.hospitalGroupList = res.Result
|
||||||
const index = this.findItemIndex("HospitalGroupId");
|
const index = this.findItemIndex("HospitalGroupId");
|
||||||
this.$set(this.searchForm[index], "options", hospitalGroupList);
|
this.$set(this.searchForm[index], "options", this.hospitalGroupList);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
|
Loading…
Reference in New Issue