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

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
v-for="item of roleList"
:key="item.Id"
:label="item.UserTypeShortName"
:label="item.UserTypeName"
:value="item.Id"
/>
</el-select>

View File

@ -62,7 +62,7 @@
<el-option
v-for="item of roleList"
:key="item.Id"
:label="item.UserTypeShortName"
:label="item.UserTypeName"
:value="item.Id"
/>
</el-select>
@ -438,8 +438,18 @@ export default {
getUserTypeRoleList() {
getUserTypeRoleList({})
.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) => {
if ([4, 5, 8, 9, 12, 14].includes(item.UserTypeEnum)) {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);

View File

@ -336,8 +336,23 @@ export default {
//
async getInfo() {
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");
this.$set(this.searchForm[index], "options", res.Result);
this.$set(this.searchForm[index], "options", roleList);
},
handleAddUser() {
this.$router.push({ path: "/system/user/add" });

View File

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

View File

@ -17,7 +17,7 @@
<el-option
v-for="item of userTypeOptions"
:key="item.Id"
:label="item.UserTypeShortName"
:label="item.UserType"
:value="item.Id"
>
</el-option>
@ -522,8 +522,18 @@ export default {
//
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 ([4, 5, 8, 9, 12].includes(item.UserTypeEnum)) {
if (!arr.includes(item.UserTypeEnum)) {
return item;
}
}).filter((item) => item);

View File

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

View File

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

View File

@ -42,6 +42,7 @@
type="date"
placeholder="选择日期"
style="width: 100%"
value-format="YYYY-MM-DD"
>
</el-date-picker>
</el-form-item>
@ -153,7 +154,7 @@ export default {
Object.keys(this.form).forEach((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.PatientList;
addOrUpdateSubjectHir(data)

View File

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

View File

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

View File

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