123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <div class="analysis-report-view">
- <div class="part-box part-box-pad">
- <el-button
- v-for="item in roles"
- :key="item.roleId"
- type="primary"
- class="auth-item"
- :disabled="loading"
- @click="toAuth(item)"
- >{{ item.roleName }}</el-button
- >
- </div>
- </div>
- </template>
- <script>
- import { autoSubmitForm } from "@/plugins/utils";
- import { ssoAnalysisLogin } from "../api";
- export default {
- name: "analysis-report-view",
- data() {
- return {
- user: {},
- roles: [],
- loading: false
- };
- },
- created() {
- this.user = this.$ls.get("user", {
- roleSource: [],
- loginName: "",
- role: "",
- orgName: ""
- });
- this.roles = this.user.roleSource.filter(
- item => item.roleSource === "ANALYSIS"
- );
- if (this.$route.query.trigger) {
- this.toAuth({ roleCode: this.$route.query.trigger });
- }
- },
- methods: {
- async toAuth(item) {
- if (this.loading) return;
- this.loading = true;
- const params = {
- loginName: this.user.loginName,
- role: item.roleCode,
- orgName: this.user.orgInfo.name,
- returnUrl: window.location.href
- };
- const data = await ssoAnalysisLogin(params).catch(() => {});
- this.loading = false;
- if (!data) return;
- console.log(data);
- // if (data) return;
- autoSubmitForm(data.redirectUrl, data);
- }
- }
- };
- </script>
|