|
@@ -0,0 +1,540 @@
|
|
|
+<template>
|
|
|
+ <div class="content-bi-actions">
|
|
|
+ <div class="com-statusbar-BI" id="statusbar-BI" v-cloak>
|
|
|
+ <div class="crm-action">
|
|
|
+ <div class="action-content" v-for="(item, i) in getList" :key="i">
|
|
|
+ <div
|
|
|
+ @click="setActionEvent(item)"
|
|
|
+ class="action-list"
|
|
|
+ :class="'action-' + item.class"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="icon iconfont"
|
|
|
+ :class="[
|
|
|
+ 'icon-' + item['icon-' + item.active],
|
|
|
+ { checked: !!item.active }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <div class="msg" v-if="item.msg">${item.msg}</div>
|
|
|
+ </i>
|
|
|
+ <span> {{ item.active ? '已' : '' }}{{ item.title }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-dialog
|
|
|
+ custom-class="property-employ-dialog"
|
|
|
+ :visible.sync="showPropertyDialog"
|
|
|
+ >
|
|
|
+ <iframe
|
|
|
+ width="600"
|
|
|
+ height="650"
|
|
|
+ :src="IframeSrc"
|
|
|
+ frameborder="0"
|
|
|
+ ></iframe>
|
|
|
+ </el-dialog>
|
|
|
+ <div class="Iframe-dialog">
|
|
|
+ <el-dialog :visible.sync="dialogVisible" width="70%" height="80%">
|
|
|
+ <iframe
|
|
|
+ :src="IframeSrc"
|
|
|
+ width="100%"
|
|
|
+ height="80%"
|
|
|
+ frameborder="0"
|
|
|
+ ></iframe>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: 'ContentBIActions',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ title: '收录',
|
|
|
+ 'icon-0': 'a-Property1shoulu',
|
|
|
+ 'icon-1': 'a-Property1yishoulu',
|
|
|
+ class: 'employ',
|
|
|
+ active: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '忽略',
|
|
|
+ 'icon-0': 'a-Property1hulve',
|
|
|
+ 'icon-1': 'a-Property1yihulve',
|
|
|
+ class: 'ignore',
|
|
|
+ active: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建销售线索',
|
|
|
+ 'icon-0': 'chuangjianxiaoshouxiansuo',
|
|
|
+ 'icon-1': 'chuangjianxiaoshouxiansuo',
|
|
|
+ class: 'xiansuo',
|
|
|
+ active: 0,
|
|
|
+ msg: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建销售机会',
|
|
|
+ 'icon-0': 'chuangjianxiaoshoujihui',
|
|
|
+ 'icon-1': 'chuangjianxiaoshoujihui',
|
|
|
+ class: 'jihui',
|
|
|
+ active: 0,
|
|
|
+ msg: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建客户',
|
|
|
+ 'icon-0': 'chuangjiankehu',
|
|
|
+ 'icon-1': 'chuangjiankehu',
|
|
|
+ class: 'custom',
|
|
|
+ active: 0,
|
|
|
+ msg: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ pageType: '', // 营销专版参数
|
|
|
+ porperty: '', // 物业专版参数
|
|
|
+ fromJhfp: '', // 判断是从机会复盘还是从招标搜索进
|
|
|
+ employInfo: [], // 收录情况
|
|
|
+ dialogVisible: false,
|
|
|
+ IframeSrc: '',
|
|
|
+ getEntData: {},
|
|
|
+ showPropertyDialog: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getEntInfo()
|
|
|
+ this.getParams()
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ id: {
|
|
|
+ type: String,
|
|
|
+ required: true,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ getList() {
|
|
|
+ if (this.list[0].active === 0) {
|
|
|
+ return this.list.slice(0, 1)
|
|
|
+ } else if (this.property === 'BIProperty') {
|
|
|
+ this.list = this.list.filter((v) => {
|
|
|
+ return v.title !== '创建销售线索'
|
|
|
+ })
|
|
|
+ return this.list
|
|
|
+ } else {
|
|
|
+ return this.list
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ dialogVisible(newval) {
|
|
|
+ if (!newval) {
|
|
|
+ this.getEmployData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ const _this = this
|
|
|
+ window.addEventListener('storage', function (event) {
|
|
|
+ console.log(event.storageArea)
|
|
|
+ if (event.storageArea === sessionStorage) {
|
|
|
+ if (event.key === 'Op-upState') {
|
|
|
+ sessionStorage.removeItem('Op-upState', '0')
|
|
|
+ _this.dialogVisible = false
|
|
|
+ _this.showPropertyDialog = false
|
|
|
+ _this.getEmployData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getacount(bidamount, budget) {
|
|
|
+ if (
|
|
|
+ typeof bidamount != 'undefined' &&
|
|
|
+ bidamount != null &&
|
|
|
+ bidamount != ''
|
|
|
+ ) {
|
|
|
+ return bidamount
|
|
|
+ }
|
|
|
+ if (typeof budget != 'undefined' && budget != null && budget != '') {
|
|
|
+ return budget
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
+ //金额转化 金额:0-万元以下单位为元 ,万元以上至亿元以下单位为万元 ,亿元以上单位为亿元。保留 小数点后 2 位,不进行四舍五入。
|
|
|
+ conversionMoeny(money) {
|
|
|
+ var m = '' + money
|
|
|
+ var m_arr = m.split('.')
|
|
|
+ var m_1 = m_arr[0]
|
|
|
+ var len_m1 = m_1.length
|
|
|
+ if (len_m1 >= 9) {
|
|
|
+ m =
|
|
|
+ m_1.substring(0, len_m1 - 8) +
|
|
|
+ '.' +
|
|
|
+ m_1.substring(len_m1 - 8, len_m1 - 6) +
|
|
|
+ '亿元'
|
|
|
+ } else if (len_m1 >= 5) {
|
|
|
+ m =
|
|
|
+ m_1.substring(0, len_m1 - 4) +
|
|
|
+ '.' +
|
|
|
+ m_1.substring(len_m1 - 4, len_m1 - 2) +
|
|
|
+ '万元'
|
|
|
+ } else {
|
|
|
+ if (m_arr.length == 1) {
|
|
|
+ return m + '.00元'
|
|
|
+ }
|
|
|
+ var m_2 = m_arr[1]
|
|
|
+ if (m_2.length > 1) {
|
|
|
+ m_2 = m_2.substring(0, 2)
|
|
|
+ } else {
|
|
|
+ m_2 = m_2.substring(0, 1) + '0'
|
|
|
+ }
|
|
|
+ m = m_1 + '.' + m_2 + '元'
|
|
|
+ }
|
|
|
+ return m
|
|
|
+ },
|
|
|
+ getParams() {
|
|
|
+ const urlParams = new URLSearchParams(window.location.search)
|
|
|
+ this.pageType = urlParams.get('resource')
|
|
|
+ this.property = urlParams.get('property')
|
|
|
+ this.fromJhfp = urlParams.get('from')
|
|
|
+ if (this.pageType === 'BI' || this.property === 'BIProperty') {
|
|
|
+ $('.com-tagsbar').hide()
|
|
|
+ $('.com-statusbar').hide()
|
|
|
+ this.getEmployData()
|
|
|
+ } else {
|
|
|
+ $('#statusbar-BI').hide()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setActionEvent(data) {
|
|
|
+ var employInfoItem = this.employInfo[0]
|
|
|
+ var employId = ''
|
|
|
+ if (employInfoItem) {
|
|
|
+ employId = employInfoItem.employId
|
|
|
+ }
|
|
|
+ const isHavaRoot =
|
|
|
+ this.getEntData.niche_dis === 1 || this.getEntData.niche_dis === 2
|
|
|
+ switch (data.class) {
|
|
|
+ case 'employ':
|
|
|
+ // 收录
|
|
|
+ if (this.property === 'BIProperty') {
|
|
|
+ this.IframeSrc = `${
|
|
|
+ location.origin
|
|
|
+ }/succbi/crm_system/app/crm.app/%E9%80%9A%E7%94%A8%E5%88%9B%E5%BB%BA/create_intelligence.spg?t=${new Date().getTime()}`
|
|
|
+ const { bidamount, budget, title, area, buyer } =
|
|
|
+ window.goTemplateData.params.obj
|
|
|
+ const propertyData = {
|
|
|
+ _id: this.id,
|
|
|
+ title: title,
|
|
|
+ buyer: buyer,
|
|
|
+ area: area,
|
|
|
+ bidamount: bidamount,
|
|
|
+ budget: budget
|
|
|
+ }
|
|
|
+ // 将propertyData存入本地,用于BI创建情报回显数据
|
|
|
+ localStorage.setItem('property-data', JSON.stringify(propertyData))
|
|
|
+ this.setOpEvent(data)
|
|
|
+ } else {
|
|
|
+ this.setEmployEvent(data)
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'ignore':
|
|
|
+ // 忽略
|
|
|
+ this.setIgnoreEvent(data)
|
|
|
+ break
|
|
|
+ case 'custom':
|
|
|
+ // 创建客户
|
|
|
+ this.isCanAdd('more_create_custom').then((res) => {
|
|
|
+ if (res.data.status === 1) {
|
|
|
+ if (!isHavaRoot) {
|
|
|
+ sessionStorage.setItem('Op-upState', '0')
|
|
|
+ this.IframeSrc = `${
|
|
|
+ location.origin
|
|
|
+ }/succbi/crm_system/app/crm.app/%E9%80%9A%E7%94%A8%E5%88%9B%E5%BB%BA/create_customer.spg?E_employ_info_id=${
|
|
|
+ this.employInfo[0].employId
|
|
|
+ }&E_create_type=1&t=${new Date().getTime()}`
|
|
|
+ this.dialogVisible = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break
|
|
|
+ case 'xiansuo':
|
|
|
+ // 创建销售线索
|
|
|
+ this.isCanAdd('more_create_clue').then((res) => {
|
|
|
+ if (res.data.status === 1) {
|
|
|
+ if (!isHavaRoot) {
|
|
|
+ sessionStorage.setItem('Op-upState', '0')
|
|
|
+ this.IframeSrc = `${
|
|
|
+ location.origin
|
|
|
+ }/succbi/crm_system/app/crm.app/%E9%80%9A%E7%94%A8%E5%88%9B%E5%BB%BA/create_clues.spg?E_employ_info_id=${
|
|
|
+ this.employInfo[0].employId
|
|
|
+ }&t=${new Date().getTime()}`
|
|
|
+ this.dialogVisible = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break
|
|
|
+ case 'jihui':
|
|
|
+ // 创建销售机会
|
|
|
+ this.isCanAdd('more_create_chance').then((res) => {
|
|
|
+ if (res.data.status === 1) {
|
|
|
+ if (!isHavaRoot) {
|
|
|
+ sessionStorage.setItem('Op-upState', '0')
|
|
|
+ this.IframeSrc = `${
|
|
|
+ location.origin
|
|
|
+ }/succbi/crm_system/app/crm.app/%E9%80%9A%E7%94%A8%E5%88%9B%E5%BB%BA/create_%20%20opportunity.spg?E_employ_info_id=${
|
|
|
+ this.employInfo[0].employId
|
|
|
+ }&M_source_id=${
|
|
|
+ this.employInfo[0].id
|
|
|
+ }&t=${new Date().getTime()}`
|
|
|
+ this.dialogVisible = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast(res.error_msg, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 判断是否能创建
|
|
|
+ isCanAdd(type) {
|
|
|
+ const url = '/jyapi/crmApplication/info/canAdd'
|
|
|
+ const params = {
|
|
|
+ employInfoId: Number(this.employInfo[0].employId),
|
|
|
+ employCustomId: 0,
|
|
|
+ key: type
|
|
|
+ }
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.ajaxComponent(url, params)
|
|
|
+ .then((res) => {
|
|
|
+ resolve(res)
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ reject(err)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查询企业信息
|
|
|
+ getEntInfo() {
|
|
|
+ const url = '/entbase/ent/entinfo'
|
|
|
+ this.ajaxComponent(url).then((res) => {
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ this.getEntData = res.data
|
|
|
+ // niche_dis: 0:销售 1:企业资讯分配 2:部门资讯分配 3:企业资讯分配+销售 4:部门资讯分配+销售
|
|
|
+ if (res.data.niche_dis === 1 || res.data.niche_dis === 2) {
|
|
|
+ this.list.splice(1, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查询收录情况
|
|
|
+ getEmployData() {
|
|
|
+ const url = '/jyapi/crmApplication/employ/info'
|
|
|
+ const params = {
|
|
|
+ employType: 1,
|
|
|
+ idArr: this.id,
|
|
|
+ from: this.fromJhfp ? this.fromJhfp : ''
|
|
|
+ }
|
|
|
+ this.ajaxComponent(url, params).then((res) => {
|
|
|
+ console.info(res)
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ this.employInfo = res.data
|
|
|
+ var employItem = res.data[0]
|
|
|
+ const filteredList = []
|
|
|
+ if (employItem.isEmploy) {
|
|
|
+ this.list.forEach((v, index) => {
|
|
|
+ if (v.class === 'employ') {
|
|
|
+ v.active = employItem.isEmploy ? 1 : 0
|
|
|
+ filteredList.push(v)
|
|
|
+ }
|
|
|
+ if (v.class === 'ignore') {
|
|
|
+ v.active = employItem.isIgnore ? 1 : 0
|
|
|
+ filteredList.push(v)
|
|
|
+ }
|
|
|
+ if (v.class === 'jihui') {
|
|
|
+ v.msg = employItem.chanceCount
|
|
|
+ if (employItem.type === 2 || employItem.type === 1) {
|
|
|
+ filteredList.push(v)
|
|
|
+ }
|
|
|
+ } else if (v.class === 'xiansuo') {
|
|
|
+ v.msg = employItem.clueCount
|
|
|
+ if (employItem.type === 1) {
|
|
|
+ filteredList.push(v)
|
|
|
+ }
|
|
|
+ } else if (v.class === 'custom') {
|
|
|
+ v.msg = employItem.customCount
|
|
|
+ if (employItem.type !== 3) {
|
|
|
+ filteredList.push(v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.list = filteredList
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 物业专版收录操作
|
|
|
+ setOpEvent(item) {
|
|
|
+ let url = '/jyapi/crmApplication/employ/operate'
|
|
|
+ let info = this.employInfo[0]
|
|
|
+ let params = {
|
|
|
+ idArr: this.id,
|
|
|
+ isEmploy: !info.isEmploy,
|
|
|
+ sourceType: 1,
|
|
|
+ employType: 1
|
|
|
+ }
|
|
|
+ if (item.active && this.fromJhfp) {
|
|
|
+ params.from = this.fromJhfp
|
|
|
+ }
|
|
|
+ if (!item.active) {
|
|
|
+ url = '/jyNewApi/property/information/exist'
|
|
|
+ info = this.employInfo[0]
|
|
|
+ params = {
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ this.ajaxComponent(url, params).then((res) => {
|
|
|
+ if (!item.active) {
|
|
|
+ if (res.code === 2) {
|
|
|
+ // 已经创建情报信息,直接收录
|
|
|
+ item.active = 1
|
|
|
+ } else if (res.code === 1) {
|
|
|
+ // 未创建情报信息,需要手动创建
|
|
|
+ this.showPropertyDialog = true
|
|
|
+ } else {
|
|
|
+ this.$toast(res.msg, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.ajaxComponent(url, params).then((res) => {
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ if (res.data.status) {
|
|
|
+ item.active = item.active === 0 ? 1 : 0
|
|
|
+ } else {
|
|
|
+ this.$toast(res.data.msg, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.getEmployData()
|
|
|
+ console.info(this.list)
|
|
|
+ },
|
|
|
+ // 收录操作
|
|
|
+ setEmployEvent(item) {
|
|
|
+ const url = '/jyapi/crmApplication/employ/operate'
|
|
|
+ const info = this.employInfo[0]
|
|
|
+ const params = {
|
|
|
+ idArr: this.id,
|
|
|
+ isEmploy: !info.isEmploy,
|
|
|
+ sourceType: 1,
|
|
|
+ employType: 1
|
|
|
+ }
|
|
|
+ this.ajaxComponent(url, params).then((res) => {
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ if (res.data.status) {
|
|
|
+ item.active = item.active === 0 ? 1 : 0
|
|
|
+ } else {
|
|
|
+ this.$toast(res.data.msg, 1000)
|
|
|
+ }
|
|
|
+ this.getEmployData()
|
|
|
+ console.info(this.list)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 忽略操作
|
|
|
+ setIgnoreEvent(item) {
|
|
|
+ var info = this.employInfo[0]
|
|
|
+ var params = {
|
|
|
+ idArr: this.id,
|
|
|
+ isIgnore: !info.isIgnore,
|
|
|
+ employType: 1
|
|
|
+ }
|
|
|
+ var url = '/jyapi/crmApplication/ignore/operate'
|
|
|
+ this.ajaxComponent(url, params).then((res) => {
|
|
|
+ if (res && res.error_code === 0) {
|
|
|
+ if (res.data && res.data.status) {
|
|
|
+ item.active = item.active === 0 ? 1 : 0
|
|
|
+ } else {
|
|
|
+ this.$toast(res.data.msg, 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 封装公共ajax
|
|
|
+ ajaxComponent(url, params) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: url,
|
|
|
+ contentType: 'application/json',
|
|
|
+ data: JSON.stringify(params) || {},
|
|
|
+ success: function (res) {
|
|
|
+ resolve(res)
|
|
|
+ },
|
|
|
+ error: function (err) {
|
|
|
+ reject(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.content-bi-actions {
|
|
|
+ .com-statusbar-BI {
|
|
|
+ margin-top: 16px;
|
|
|
+ }
|
|
|
+ .crm-action {
|
|
|
+ float: right;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ .action-content {
|
|
|
+ margin-left: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .action-content .iconfont {
|
|
|
+ position: relative;
|
|
|
+ font-size: 20px;
|
|
|
+ font-style: normal;
|
|
|
+ color: #2abed1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-content .iconfont .msg {
|
|
|
+ position: absolute;
|
|
|
+ top: -8px;
|
|
|
+ right: -6px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ background: #ff3a20;
|
|
|
+ border-radius: 50%;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-employ .iconfont,
|
|
|
+ .action-ignore .iconfont {
|
|
|
+ color: #aaa;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-employ .iconfont.checked {
|
|
|
+ color: #2abed1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-ignore .iconfont.checked {
|
|
|
+ color: #ff9f40;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|