|
@@ -1,164 +1,167 @@
|
|
|
-<template>
|
|
|
- <div class="hui-flex hui-dialog select-project-index">
|
|
|
- <div class="hui-flex-box hui-dialog-content">
|
|
|
- <el-table :data="tableData" row-key="id" border height="100%">
|
|
|
- <el-table-column label="序号" width="50">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div style="text-align: center;">{{scope.$index + 1}}</div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="项目名称" prop="name"></el-table-column>
|
|
|
- <el-table-column label="所属企业" prop="organizationName"></el-table-column>
|
|
|
- <el-table-column label="项目身份">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="hui-table-tag" style="display: flex;align-items: center;">
|
|
|
- <div class="hui-tag hui-tag-success" v-for="(node,index) in scope.row.projectListIdentity"
|
|
|
- :key="index">
|
|
|
- {{node.name}}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" width="100">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="hui-table-operation">
|
|
|
- <span class="table-operation" @click="changeProject(scope.row)">
|
|
|
- 切换项目
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <template slot="empty">
|
|
|
- <empty description="暂无数据"></empty>
|
|
|
- </template>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
- <el-dialog custom-class="identity" title="选择身份" :visible.sync="visible" width="300px" :append-to-body="true">
|
|
|
- <div class="hui-flex hui-dialog">
|
|
|
- <div class="hui-flex-box hui-dialog-content">
|
|
|
- <el-radio-group v-model="indentity">
|
|
|
- <div class="select-identity-item" v-for="item in project.projectListIdentity" :key="item.id">
|
|
|
- <el-radio :label="item.id">{{item.name}}</el-radio>
|
|
|
- </div>
|
|
|
- </el-radio-group>
|
|
|
- </div>
|
|
|
- <div class="hui-dialog-submit">
|
|
|
- <el-button size="medium" @click="visible = false">取 消</el-button>
|
|
|
- <el-button size="medium" type="primary" @click="submit">确定</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import {
|
|
|
- selectProject,
|
|
|
- selectOrangaized
|
|
|
- } from '@/httpApi/loginRegister'
|
|
|
- import {
|
|
|
- getOrganizationDetailById
|
|
|
- } from '@/httpApi/organization'
|
|
|
- import {
|
|
|
- getProjectListByIdentity
|
|
|
- } from '@/httpApi/space'
|
|
|
- import {
|
|
|
- getIdentityResource
|
|
|
- } from '@/httpApi/system'
|
|
|
- import {
|
|
|
- setComment
|
|
|
- } from '@/uitls/auth';
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tableData: [],
|
|
|
- visible: false,
|
|
|
- indentity: '',
|
|
|
- project: {
|
|
|
- projectListIdentity: []
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.init();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- init() {
|
|
|
- getProjectListByIdentity().then(res => {
|
|
|
- if (res.state) {
|
|
|
- this.tableData = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- changeProject(item) {
|
|
|
- this.project = item;
|
|
|
- this.indentity = item.projectListIdentity[0].id;
|
|
|
- this.visible = true;
|
|
|
- },
|
|
|
- submit() {
|
|
|
- if (this.indentity == 6 || this.indentity == 3) {
|
|
|
- getOrganizationDetailById(this.project.organizationId).then(res => {
|
|
|
- if (res.state) {
|
|
|
- this.$store.dispatch('app/changeOrganization', res.data);
|
|
|
- selectOrangaized(res.data)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- selectProject(this.project.id).then(res => {
|
|
|
- if (res.state) {
|
|
|
- let user = res.data;
|
|
|
- this.$store.dispatch('app/changeIdentityId', this.indentity);
|
|
|
- this.$store.dispatch('projectBase/changeProject', this.project);
|
|
|
- localStorage.setItem('projectId', this.project.id);
|
|
|
- this.$store.dispatch('app/changeUser', user);
|
|
|
- if (this.indentity === 3 || user.userId === 1) {
|
|
|
- this.$store.dispatch('app/changeMenuData', user.resource ? JSON.parse(user.resource) :
|
|
|
- []);
|
|
|
- setComment(user.menu ? user.menu : JSON.stringify([]));
|
|
|
- this.$emit('callback');
|
|
|
- this.$router.push({
|
|
|
- path: '/',
|
|
|
- replace: true
|
|
|
- })
|
|
|
- this.$message.success('切换成功');
|
|
|
- } else {
|
|
|
- getIdentityResource({
|
|
|
- identityId: this.indentity.identityId,
|
|
|
- type: this.project.type
|
|
|
- }).then(node => {
|
|
|
- if (node.state) {
|
|
|
- let role = node.data[0] || {};
|
|
|
- this.$store.dispatch('app/changeMenuData', role
|
|
|
- .resource ? JSON.parse(role.resource) : []);
|
|
|
- setComment(role.menus ? role.menus : JSON.stringify(
|
|
|
- []));
|
|
|
- this.$emit('callback');
|
|
|
- this.$router.push({
|
|
|
- path: '/',
|
|
|
- replace: true
|
|
|
- })
|
|
|
- this.$message.success('切换成功');
|
|
|
- } else {
|
|
|
- this.$message.error('切换失败');
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('切换失败');
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
- .identity.el-dialog {
|
|
|
- height: 40vh;
|
|
|
- margin-top: 30vh !important;
|
|
|
-
|
|
|
- .select-identity-item {
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
+<template>
|
|
|
+ <div class="hui-flex hui-dialog select-project-index">
|
|
|
+ <div class="hui-flex-box hui-dialog-content">
|
|
|
+ <el-table :data="tableData" row-key="id" border height="100%">
|
|
|
+ <el-table-column label="序号" width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div style="text-align: center;">{{scope.$index + 1}}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="项目名称" prop="name"></el-table-column>
|
|
|
+ <el-table-column label="所属企业" prop="organizationName"></el-table-column>
|
|
|
+ <el-table-column label="项目身份">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-tag" style="display: flex;align-items: center;">
|
|
|
+ <div class="hui-tag hui-tag-success" style="margin:0 5px;"
|
|
|
+ v-for="(node,index) in scope.row.projectListIdentity" :key="index">
|
|
|
+ {{node.name}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-operation">
|
|
|
+ <span class="table-operation" @click="changeProject(scope.row)">
|
|
|
+ 切换项目
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <template slot="empty">
|
|
|
+ <empty description="暂无数据"></empty>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <el-dialog custom-class="identity" title="选择身份" :visible.sync="visible" width="300px" :append-to-body="true">
|
|
|
+ <div class="hui-flex hui-dialog">
|
|
|
+ <div class="hui-flex-box hui-dialog-content">
|
|
|
+ <el-radio-group v-model="indentity">
|
|
|
+ <div class="select-identity-item" v-for="item in project.projectListIdentity" :key="item.id">
|
|
|
+ <el-radio :label="item.id">{{item.name}}</el-radio>
|
|
|
+ </div>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ <div class="hui-dialog-submit">
|
|
|
+ <el-button size="medium" @click="visible = false">取 消</el-button>
|
|
|
+ <el-button size="medium" type="primary" @click="submit">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ selectProject,
|
|
|
+ selectOrangaized,
|
|
|
+ refresh
|
|
|
+ } from '@/httpApi/loginRegister'
|
|
|
+ import {
|
|
|
+ getOrganizationDetailById
|
|
|
+ } from '@/httpApi/organization'
|
|
|
+ import {
|
|
|
+ getProjectListByIdentity
|
|
|
+ } from '@/httpApi/space'
|
|
|
+ import {
|
|
|
+ getIdentityResource
|
|
|
+ } from '@/httpApi/system'
|
|
|
+ import {
|
|
|
+ setComment
|
|
|
+ } from '@/uitls/auth';
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tableData: [],
|
|
|
+ visible: false,
|
|
|
+ indentity: '',
|
|
|
+ project: {
|
|
|
+ projectListIdentity: []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ refresh().then(res => {
|
|
|
+ getProjectListByIdentity().then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.tableData = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeProject(item) {
|
|
|
+ this.project = item;
|
|
|
+ this.indentity = item.projectListIdentity[0].id;
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ if (this.indentity == 6 || this.indentity == 3) {
|
|
|
+ getOrganizationDetailById(this.project.organizationId).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.$store.dispatch('app/changeOrganization', res.data);
|
|
|
+ selectOrangaized(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ selectProject(this.project.id).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ let user = res.data;
|
|
|
+ this.$store.dispatch('app/changeIdentityId', this.indentity);
|
|
|
+ this.$store.dispatch('projectBase/changeProject', this.project);
|
|
|
+ localStorage.setItem('projectId', this.project.id);
|
|
|
+ this.$store.dispatch('app/changeUser', user);
|
|
|
+ if (this.indentity === 3 || user.userId === 1) {
|
|
|
+ this.$store.dispatch('app/changeMenuData', user.resource ? JSON.parse(user.resource) :
|
|
|
+ []);
|
|
|
+ setComment(user.menu ? user.menu : JSON.stringify([]));
|
|
|
+ this.$emit('callback');
|
|
|
+ this.$router.push({
|
|
|
+ path: '/',
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
+ this.$message.success('切换成功');
|
|
|
+ } else {
|
|
|
+ getIdentityResource({
|
|
|
+ identityId: this.indentity.identityId,
|
|
|
+ type: this.project.type
|
|
|
+ }).then(node => {
|
|
|
+ if (node.state) {
|
|
|
+ let role = node.data[0] || {};
|
|
|
+ this.$store.dispatch('app/changeMenuData', role
|
|
|
+ .resource ? JSON.parse(role.resource) : []);
|
|
|
+ setComment(role.menus ? role.menus : JSON.stringify(
|
|
|
+ []));
|
|
|
+ this.$emit('callback');
|
|
|
+ this.$router.push({
|
|
|
+ path: '/',
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
+ this.$message.success('切换成功');
|
|
|
+ } else {
|
|
|
+ this.$message.error('切换失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('切换失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .identity.el-dialog {
|
|
|
+ height: 40vh;
|
|
|
+ margin-top: 30vh !important;
|
|
|
+
|
|
|
+ .select-identity-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|