根据登录用户角色过滤可展示角色

main
wangxiaoshuang 2024-04-25 17:07:28 +08:00
parent cf3bd7073f
commit 1932e26ad5
11 changed files with 114 additions and 25 deletions

View File

@ -64,7 +64,7 @@
<el-option <el-option
v-for="item of roleList" v-for="item of roleList"
:key="item.Id" :key="item.Id"
:label="item.UserTypeShortName" :label="item.UserTypeName"
:value="item.Id" :value="item.Id"
/> />
</el-select> </el-select>

View File

@ -62,7 +62,7 @@
<el-option <el-option
v-for="item of roleList" v-for="item of roleList"
:key="item.Id" :key="item.Id"
:label="item.UserTypeShortName" :label="item.UserTypeName"
:value="item.Id" :value="item.Id"
/> />
</el-select> </el-select>
@ -438,8 +438,18 @@ export default {
getUserTypeRoleList() { getUserTypeRoleList() {
getUserTypeRoleList({}) getUserTypeRoleList({})
.then((res) => { .then((res) => {
let arr = [];
if (this.hasPermi(["role:admin"])) {
arr = [1];
}
if (this.hasPermi(["role:oa"])) {
arr = [1, 2];
}
if (this.hasPermi(["role:pm"])) {
arr = [1, 2, 14];
}
this.roleList = res.Result.map((item) => { this.roleList = res.Result.map((item) => {
if ([4, 5, 8, 9, 12, 14].includes(item.UserTypeEnum)) { if (!arr.includes(item.UserTypeEnum)) {
return item; return item;
} }
}).filter((item) => item); }).filter((item) => item);

View File

@ -336,8 +336,23 @@ export default {
// //
async getInfo() { async getInfo() {
const res = await getUserTypeList(); const res = await getUserTypeList();
let arr = [];
if (this.hasPermi(["role:admin"])) {
arr = [1];
}
if (this.hasPermi(["role:oa"])) {
arr = [1, 2];
}
if (this.hasPermi(["role:pm"])) {
arr = [1, 2, 14];
}
let roleList = res.Result.map((item) => {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);
const index = this.findItemIndex("UserType"); const index = this.findItemIndex("UserType");
this.$set(this.searchForm[index], "options", res.Result); this.$set(this.searchForm[index], "options", roleList);
}, },
handleAddUser() { handleAddUser() {
this.$router.push({ path: "/system/user/add" }); this.$router.push({ path: "/system/user/add" });

View File

@ -352,6 +352,7 @@ export default {
let params = { let params = {
PatientId: this.Patient.PatientId, PatientId: this.Patient.PatientId,
SubjectId: this.submitMessage.SubjectId, SubjectId: this.submitMessage.SubjectId,
TrialId:this.submitMessage.TrialId
}; };
this.btnLoading = true; this.btnLoading = true;
let res = await deleteSubjectPatientBinding(params); let res = await deleteSubjectPatientBinding(params);

View File

@ -17,7 +17,7 @@
<el-option <el-option
v-for="item of userTypeOptions" v-for="item of userTypeOptions"
:key="item.Id" :key="item.Id"
:label="item.UserTypeShortName" :label="item.UserType"
:value="item.Id" :value="item.Id"
> >
</el-option> </el-option>
@ -522,8 +522,18 @@ export default {
// //
getUserType() { getUserType() {
getUserTypeListByUserType(0).then((res) => { getUserTypeListByUserType(0).then((res) => {
let arr = [];
if (this.hasPermi(["role:admin"])) {
arr = [1];
}
if (this.hasPermi(["role:oa"])) {
arr = [1, 2];
}
if (this.hasPermi(["role:pm"])) {
arr = [1, 2, 14];
}
this.userTypeOptions = res.Result.map((item) => { this.userTypeOptions = res.Result.map((item) => {
if ([4, 5, 8, 9, 12].includes(item.UserTypeEnum)) { if (!arr.includes(item.UserTypeEnum)) {
return item; return item;
} }
}).filter((item) => item); }).filter((item) => item);

View File

@ -31,7 +31,7 @@
<el-option <el-option
v-for="item of userTypeOptions" v-for="item of userTypeOptions"
:key="item.Id" :key="item.Id"
:label="item.UserTypeShortName" :label="item.UserType"
:value="item.Id" :value="item.Id"
> >
<!-- <span>{{ item.UserType }}</span> --> <!-- <span>{{ item.UserType }}</span> -->

View File

@ -38,10 +38,10 @@
class="mr" class="mr"
> >
<el-option <el-option
v-for="item of $d.UserType" v-for="item of userTypeOptions"
:key="item.id" :key="item.Id"
:label="item.label" :label="item.UserType"
:value="item.value" :value="item.UserTypeEnum"
> >
</el-option> </el-option>
</el-select> </el-select>

View File

@ -42,6 +42,7 @@
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
style="width: 100%" style="width: 100%"
value-format="YYYY-MM-DD"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -153,7 +154,7 @@ export default {
Object.keys(this.form).forEach((key) => { Object.keys(this.form).forEach((key) => {
data[key] = this.form[key]; data[key] = this.form[key];
}); });
data.BirthDate = data.BirthDate ? data.BirthDate.toISOString() : null; // data.BirthDate = data.BirthDate ? new Date(data.BirthDate).toISOString() : null;
delete data.PatientId; delete data.PatientId;
delete data.PatientList; delete data.PatientList;
addOrUpdateSubjectHir(data) addOrUpdateSubjectHir(data)

View File

@ -148,7 +148,13 @@
:label="$t('trials:inspection:table:birthdate')" :label="$t('trials:inspection:table:birthdate')"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> >
<template slot-scope="scope">
<span>{{
scope.row.BirthDate ? scope.row.BirthDate.split(" ")[0] : ""
}}</span>
</template>
</el-table-column>
<!-- 年龄 --> <!-- 年龄 -->
<el-table-column <el-table-column
prop="Age" prop="Age"

View File

@ -104,15 +104,15 @@
<!-- 角色 --> <!-- 角色 -->
<el-form-item :label="$t('trials:auditRecord:table:role')"> <el-form-item :label="$t('trials:auditRecord:table:role')">
<el-select <el-select
v-model="searchData.RoleName" v-model="searchData.UserTypeId"
style="width: 120px" style="width: 120px"
clearable clearable
> >
<el-option <el-option
v-for="item of $d.UserType" v-for="item of userTypeOptions"
:label="item.label" :key="item.Id"
:value="item.label" :label="item.UserType"
:key="`RoleName${item.value}`" :value="item.Id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -1240,6 +1240,7 @@ import Pagination from "@/components/Pagination";
import BaseContainer from "@/components/BaseContainer"; import BaseContainer from "@/components/BaseContainer";
import BaseModel from "@/components/BaseModel"; import BaseModel from "@/components/BaseModel";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { getUserTypeListByUserType } from "@/api/admin";
export default { export default {
components: { BaseContainer, Pagination, BaseModel }, components: { BaseContainer, Pagination, BaseModel },
@ -1269,10 +1270,11 @@ export default {
OpByUserName: null, OpByUserName: null,
BatchId: null, BatchId: null,
TrialReadingCriterionId: null, TrialReadingCriterionId: null,
RoleName: null, UserTypeId: null,
}; };
}; };
return { return {
userTypeOptions: [],
isViewer: true, isViewer: true,
otherData: [], otherData: [],
model_cfg: { model_cfg: {
@ -1343,8 +1345,29 @@ export default {
this.getVisitPlanOptions(); this.getVisitPlanOptions();
this.getTrialCriterionList(); this.getTrialCriterionList();
this.getList(); this.getList();
this.getUserType();
}, },
methods: { methods: {
//
getUserType() {
getUserTypeListByUserType(0).then((res) => {
let arr = [];
if (this.hasPermi(["role:admin"])) {
arr = [1];
}
if (this.hasPermi(["role:oa"])) {
arr = [1, 2];
}
if (this.hasPermi(["role:pm"])) {
arr = [1, 2, 14];
}
this.userTypeOptions = res.Result.map((item) => {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);
});
},
openImage(url) { openImage(url) {
console.log(url); console.log(url);

View File

@ -56,16 +56,15 @@
v-if="!isMine" v-if="!isMine"
> >
<el-select <el-select
v-model="searchData.LoginUserTypeEnum" v-model="searchData.UserTypeId"
clearable clearable
style="width: 120px" style="width: 120px"
> >
<el-option <el-option
v-for="item of $d.UserType" v-for="item of userTypeOptions"
v-show="item.value !== 1 && item.value !== 2" :key="item.Id"
:key="'UserType' + item.label" :label="item.UserType"
:value="item.value" :value="item.Id"
:label="item.label"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -188,6 +187,7 @@
</template> </template>
<script> <script>
import { getUserLogList } from "@/api/user"; import { getUserLogList } from "@/api/user";
import { getUserTypeListByUserType } from "@/api/admin";
import BaseContainer from "@/components/BaseContainer"; import BaseContainer from "@/components/BaseContainer";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import moment from "moment"; import moment from "moment";
@ -201,6 +201,7 @@ const searchDataDefault = () => {
EndDate: "", EndDate: "",
Asc: false, Asc: false,
SortField: "CreateTime", SortField: "CreateTime",
UserTypeId: null,
LoginUserName: null, LoginUserName: null,
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
@ -220,6 +221,7 @@ export default {
}, },
data() { data() {
return { return {
userTypeOptions: [],
moment, moment,
searchData: searchDataDefault(), searchData: searchDataDefault(),
list: [], list: [],
@ -230,8 +232,29 @@ export default {
}, },
mounted() { mounted() {
this.getList(); this.getList();
this.getUserType();
}, },
methods: { methods: {
//
getUserType() {
getUserTypeListByUserType(0).then((res) => {
let arr = [];
if (this.hasPermi(["role:admin"])) {
arr = [1];
}
if (this.hasPermi(["role:oa"])) {
arr = [1, 2];
}
if (this.hasPermi(["role:pm"])) {
arr = [1, 2, 14];
}
this.userTypeOptions = res.Result.map((item) => {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);
});
},
getList() { getList() {
this.loading = true; this.loading = true;
this.searchData.TrialId = this.$route.query.trialId; this.searchData.TrialId = this.$route.query.trialId;