|
@@ -1,15 +1,17 @@
|
|
|
<template>
|
|
|
- <div class="shade">
|
|
|
- <switchingEnterprise :list="list" :defaultChoose="defaultChoose" @change="entChange" @createClick="createClick">
|
|
|
+ <div class="shade" @click.self="outclick">
|
|
|
+ <switchingEnterprise :list="list" :defaultChoose="defaultChoose" @change="entChange" @createClick="createClick"
|
|
|
+ ref="switchingEnterprise" v-show="entshow" v-loading="loading">
|
|
|
</switchingEnterprise>
|
|
|
- <createEnterprise :show.sync="createShow" @next="next"></createEnterprise>
|
|
|
- <inviteDialog :show.sync="inviteShow"></inviteDialog>
|
|
|
+ <createEnterprise :show.sync="createShow" @next="next" ref="createEnterprise"></createEnterprise>
|
|
|
+ <inviteDialog :show.sync="inviteShow" ref="inviteDialog"></inviteDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import switchingEnterprise from '@/components/switchingEnterprise/switchingEnterprise.vue'
|
|
|
import inviteDialog from '@/components/inviteDialog/inviteDialog.vue'
|
|
|
import createEnterprise from '@/components/inviteDialog/createEnterprise.vue'
|
|
|
+import { chatShare, entAdd, identityList, identitySwitch } from '@/api/modules/'
|
|
|
export default {
|
|
|
name: 'shareBox',
|
|
|
components: { switchingEnterprise, inviteDialog, createEnterprise },
|
|
@@ -18,12 +20,23 @@ export default {
|
|
|
return {
|
|
|
inviteShow: false,
|
|
|
createShow: false,
|
|
|
+ entshow: false,
|
|
|
val: '',
|
|
|
defaultChoose: '',
|
|
|
- list: []
|
|
|
+ list: [],
|
|
|
+ shareData: null,
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
- created () { },
|
|
|
+ created () {
|
|
|
+ try {
|
|
|
+ this.shareData = window.parent.$shareBox.shareData
|
|
|
+ console.log(this.shareData)
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e)
|
|
|
+ }
|
|
|
+ this.getIdentitylist()
|
|
|
+ },
|
|
|
mounted () { },
|
|
|
beforeDestroy () { },
|
|
|
filters: {},
|
|
@@ -32,16 +45,88 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
entChange (val) {
|
|
|
- this.$toast('切换成功,当前身份:')
|
|
|
- this.inviteShow = true
|
|
|
+ this.loading = true
|
|
|
+ const params = new FormData()
|
|
|
+ params.append('token', val.token)
|
|
|
+ identitySwitch(params).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.data === 1) {
|
|
|
+ this.$toast('切换成功,当前身份:' + val.name)
|
|
|
+ try {
|
|
|
+ window.parent.location.reload()
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
createClick () { // 创建企业
|
|
|
-
|
|
|
+ this.createShow = true
|
|
|
+ },
|
|
|
+ next (val) { // 下一步
|
|
|
+ this.$refs.createEnterprise.loading = true
|
|
|
+ entAdd({ name: val }).then(res => {
|
|
|
+ this.$refs.createEnterprise.loading = false
|
|
|
+ if (res.data.status === 1) {
|
|
|
+ this.createShow = false
|
|
|
+ this.$refs.inviteDialog.getEntInfo()
|
|
|
+ this.inviteShow = true
|
|
|
+ this.getIdentitylist()
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- next () { // 下一步
|
|
|
+ outclick () {
|
|
|
+ try { // 关闭父级窗口
|
|
|
+ window.parent.$shareBox.close()
|
|
|
+ } catch (e) {
|
|
|
+ console.warn(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getIdentitylist () {
|
|
|
+ identityList().then(res => {
|
|
|
+ const list = res.data
|
|
|
+ list.forEach(ele => {
|
|
|
+ ele.id = ele.entId
|
|
|
+ if (ele.checked === 1) {
|
|
|
+ this.defaultChoose = ele.entId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.list = list
|
|
|
+ const isPersonage = this.list.some((ele) => ele.positionType === 0 && ele.checked === 1)
|
|
|
+ const isEnterprise = this.list.some((ele) => ele.positionType === 1 && ele.checked === 1)
|
|
|
+ if (isPersonage) { // 个人身份
|
|
|
+ this.entshow = true
|
|
|
+ }
|
|
|
+ if (isEnterprise) { // 当前身份为企业调分享弹框
|
|
|
+ this.getchatShare()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getchatShare () {
|
|
|
+ const params = {}
|
|
|
+ if (this.shareData.code === 1) { // 标讯详情
|
|
|
+ params.type = 1
|
|
|
+ params.stype = this.shareData.stype
|
|
|
+ params.id = this.shareData.id
|
|
|
+ } else if (this.shareData.code === 2) { // 项目详情
|
|
|
+ params.type = 2
|
|
|
+ params.sid = this.shareData.sid
|
|
|
+ params.fid = this.shareData.fid
|
|
|
+ } else if (this.shareData.code === 3) { // 企业画像
|
|
|
+ params.type = 3
|
|
|
+ params.entId = this.shareData.entId
|
|
|
+ } else if (this.shareData.code === 4) { // 采购单位画像
|
|
|
+ params.type = 4
|
|
|
+ params.params = this.shareData.params
|
|
|
+ }
|
|
|
+ chatShare(params).then(res => {
|
|
|
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|