Browse Source

feat: 新增BI任务按钮支持

zhangyuhan 1 year ago
parent
commit
9f8fccb950

+ 540 - 0
apps/bigmember_pc/src/views/article-content/components/ContentBIActions.vue

@@ -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>

+ 10 - 1
apps/bigmember_pc/src/views/article-content/components/ContentHeader.vue

@@ -16,6 +16,7 @@ import { useArticleStarModel } from '@/views/article-content/composables/useArti
 import BidrenewalDialog from '@/views/BidrenewalDialog/index.vue'
 import BidrenewalDialog from '@/views/BidrenewalDialog/index.vue'
 import { useQuickJoinBidModel } from '@/composables/quick-join-bid'
 import { useQuickJoinBidModel } from '@/composables/quick-join-bid'
 import WorkspaceButtonGroup from '@/components/dialog/WorkspaceButtonGroup.vue'
 import WorkspaceButtonGroup from '@/components/dialog/WorkspaceButtonGroup.vue'
+import ContentBIActions from '@/views/article-content/components/ContentBIActions.vue'
 
 
 const getters = useStore().getters
 const getters = useStore().getters
 const vt = computed(() => {
 const vt = computed(() => {
@@ -68,6 +69,11 @@ const bidCountdown = computed(() => {
 
 
 // 判断在哪个容器
 // 判断在哪个容器
 const InWhichContainer = window.parent !== window ? 'in-app' : 'in-web'
 const InWhichContainer = window.parent !== window ? 'in-app' : 'in-web'
+
+// 判断是否兼容BI
+const isUseBIActions =
+  useRoute().query.resource === 'BI' ||
+  useRoute().query.property === 'BIProperty'
 </script>
 </script>
 
 
 <template>
 <template>
@@ -92,7 +98,7 @@ const InWhichContainer = window.parent !== window ? 'in-app' : 'in-web'
     </div>
     </div>
     <div class="actions-info">
     <div class="actions-info">
       <div class="time-label">{{ ContentModel.time }}</div>
       <div class="time-label">{{ ContentModel.time }}</div>
-      <div class="actions">
+      <div class="actions" v-if="!isUseBIActions">
         <div class="action-item" @click="openDistribute" v-if="vt === 'q'">
         <div class="action-item" @click="openDistribute" v-if="vt === 'q'">
           <span class="iconfont icon-shoudongfenfa"></span>
           <span class="iconfont icon-shoudongfenfa"></span>
           <span class="text">分发</span>
           <span class="text">分发</span>
@@ -152,6 +158,9 @@ const InWhichContainer = window.parent !== window ? 'in-app' : 'in-web'
           ></article-star>
           ></article-star>
         </div>
         </div>
       </div>
       </div>
+      <div class="actions" v-if="isUseBIActions">
+        <content-b-i-actions :id="ContentId"></content-b-i-actions>
+      </div>
     </div>
     </div>
     <div class="expands-info">
     <div class="expands-info">
       <div class="join-bid-actions flex flex-(row items-center)">
       <div class="join-bid-actions flex flex-(row items-center)">

+ 6 - 6
apps/bigmember_pc/src/views/article-content/components/ContentSummary.vue

@@ -76,12 +76,12 @@ function getCellClassName({ row, column, rowIndex, columnIndex }) {
 // 单元格合并
 // 单元格合并
 function arraySpanMethod({ row, column, rowIndex, columnIndex }) {
 function arraySpanMethod({ row, column, rowIndex, columnIndex }) {
   // 合并空单元格
   // 合并空单元格
-  if (row[2].label === '') {
-    if (columnIndex === 1) {
-      return [1, 3]
-    }
-    if (columnIndex >= 2) return [0, 0]
-  }
+  // if (row[2].label === '') {
+  //   if (columnIndex === 1) {
+  //     return [1, 3]
+  //   }
+  //   if (columnIndex >= 2) return [0, 0]
+  // }
   // if (row[0].label === '中标金额(元)') {
   // if (row[0].label === '中标金额(元)') {
   //   if (columnIndex === 1) {
   //   if (columnIndex === 1) {
   //     return [1, 3]
   //     return [1, 3]