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