项目角色状态修改
continuous-integration/drone/push Build is running Details

uat_us
wangxiaoshuang 2024-12-25 14:47:12 +08:00
parent 9bdb8f64b3
commit b233535d95
2 changed files with 314 additions and 64 deletions

View File

@ -3923,3 +3923,12 @@ export function configTrialSPMInfo(data) {
data data
}) })
} }
// 项目添加角色修改权限
export function updateTrialUserRole(data) {
return request({
url: `/TrialMaintenance/updateTrialUserRole`,
method: 'put',
data
})
}

View File

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