ソースを参照

feat:画像忽略操作功能联调

Signed-off-by: tsz <2417024719@qq.com>
tsz 2 年 前
コミット
47720729eb

+ 31 - 0
src/api/modules/crmApplication.js

@@ -0,0 +1,31 @@
+import request from '@/api'
+// 忽略操作
+export function ajaxIgnoreOperate (data) {
+  // data = qs.stringify(data)
+  return request({
+    baseURL: '/jyapi',
+    url: '/crmApplication/ignore/operate',
+    method: 'post',
+    data
+  })
+}
+
+// 收录操作
+export function ajaxEmployOperate (data) {
+  return request({
+    baseURL: '/jyapi',
+    url: '/crmApplication/employ/operate',
+    method: 'post',
+    data
+  })
+}
+
+// 收录情况
+export function ajaxEmployInfo (data) {
+  return request({
+    baseURL: '/jyapi',
+    url: '/crmApplication/employ/info',
+    method: 'post',
+    data
+  })
+}

+ 1 - 0
src/api/modules/index.js

@@ -25,3 +25,4 @@ export * from './placeOrder'
 export * from './order'
 export * from './course'
 export * from './jyMerge'
+export * from './crmApplication'

+ 89 - 6
src/components/crm-info/crmAction.vue

@@ -1,9 +1,11 @@
 <template>
   <div class="crm-action">
     <!-- 收录 -->
-    <div class="action-content" v-for="(item, i) in list" :key="i">
+    <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="iconfont" :class="[ 'icon-' + item['icon-' + item.active] , {'checked': !!item.active }]"></i>
+        <i class="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>
@@ -12,29 +14,95 @@
 
 <script>
 import '@/assets/style/iconfont.css'
+import { ajaxIgnoreOperate, ajaxEmployOperate, ajaxEmployInfo } from '@/api/modules/'
 export default {
   name: 'crm-action',
+  props: {
+    params: {
+      type: Object,
+      default () {
+        return {
+          employType: 3,
+          idArr: ''
+        }
+      }
+    }
+  },
   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': 'chuangjiankehu', 'icon-1': 'chuangjiankehu', class: 'add-custom', active: 0 }
-      ]
+        { title: '创建客户', 'icon-0': 'chuangjiankehu', 'icon-1': 'chuangjiankehu', class: 'custom', active: 0, msg: 0 }
+      ],
+      employInfo: {}
     }
   },
+  computed: {
+    getList () {
+      if (this.list[0].active === 0) {
+        return this.list.slice(0, 1)
+      } else {
+        return this.list
+      }
+    }
+  },
+  created () {
+    this.getEmployEvent()
+  },
   methods: {
+    // 收录情况
+    async getEmployEvent () {
+      const { data, error_code: code } = await ajaxEmployInfo(this.params)
+      if (code === 0 && Array.from(data) && data.length > 0) {
+        this.employInfo = data
+        // 收录情况
+        this.list[0].active = data[0].isEmploy ? 1 : 0
+        // 忽略情况
+        this.list[1].active = data[0].isIgnore ? 1 : 0
+      }
+    },
     setActionEvent (data) {
       switch (data.class) {
         case 'employ':
-          data.active = data.active === 0 ? 1 : 0
+          this.setEmployEvent(data)
           break
         case 'ignore':
-          data.active = data.active === 0 ? 1 : 0
+          this.setIgnoreEvent(data)
           break
         default:
           break
       }
+    },
+    // 收录操作
+    async setEmployEvent (item) {
+      const info = this.employInfo[0]
+      const params = {
+        idArr: this.params.idArr,
+        isEmploy: !info.isEmploy,
+        employType: this.params.employType
+      }
+      const { data, error_code: code } = await ajaxEmployOperate(params)
+      if (code === 0) {
+        if (data.status) {
+          item.active = item.active === 0 ? 1 : 0
+        }
+      }
+    },
+    // 忽略操作
+    async setIgnoreEvent (item) {
+      const info = this.employInfo[0]
+      const params = {
+        idArr: this.params.idArr,
+        isIgnore: !info.isIgnore,
+        employType: this.params.employType
+      }
+      const { data, error_code: code } = await ajaxIgnoreOperate(params)
+      if (code === 0) {
+        if (data.status) {
+          item.active = item.active === 0 ? 1 : 0
+        }
+      }
     }
   }
 }
@@ -49,6 +117,7 @@ export default {
     cursor: pointer;
   }
   .iconfont{
+    position: relative;
     margin-right: 4px;
     font-size: 20px;
     color: #AAA;
@@ -61,6 +130,20 @@ export default {
     &.icon-a-Property1yihulve {
       color: #FF9F40;
     }
+    .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;
+    }
   }
 }
 </style>

+ 7 - 1
src/views/portrayal/EntPortrayal.vue

@@ -16,7 +16,7 @@
         </div>
       </div>
       <div class="ent_option" v-else>
-        <crm-action></crm-action>
+        <crm-action :params="crmParams"></crm-action>
       </div>
     </div>
     <div class="ent-content" v-loading="loading">
@@ -285,6 +285,12 @@ export default {
     // 是否是BI嵌入页面
     isBIPage () {
       return this.$route.query.type
+    },
+    crmParams () {
+      return {
+        employType: 2,
+        idArr: this.$route.params.eId
+      }
     }
   },
   created () {

+ 17 - 2
src/views/portrayal/EntSearchPortrayal.vue

@@ -2,7 +2,7 @@
   <Layout class="ent-portrayal">
     <div class="ent-header">
       <h1 class="name">{{ entName }}</h1>
-      <div class="ent_option">
+      <div class="ent_option" v-if="!isBIPage">
         <div class="u-follow" style="margin-right:10px;" @click="openShare" v-if="loginFlag">
           <span class="icon_share"></span>
           <span class="follow_text">转给同事</span>
@@ -15,6 +15,9 @@
           </div>
         </div>
       </div>
+      <div class="ent_option" v-else>
+        <crm-action :params="crmParams"></crm-action>
+      </div>
     </div>
     <div class="ent-content" v-loading="loading">
       <div class="tab-header bg-white" :class="{ 'fixed-nav': navFixed }" id="entTabNav">
@@ -117,6 +120,7 @@ import EntHistoryForm from './components/EntHistoryForm'
 import Layout from '@/components/common/ContentLayout.vue'
 import MaskCard from '@/components/mask-card/MaskCard.vue'
 import FreeExpBanner from './components/FreeExpBanner.vue'
+import crmAction from '@/components/crm-info/crmAction'
 import ContactList from '@/components/contact-info/ContactInfo'
 import CollectInfo from '@/components/collect-info/CollectInfo.vue'
 import DynamicList from './components/DynamicList'
@@ -161,7 +165,8 @@ export default {
     EntFollowStar,
     DynamicList,
     AsideNewscards,
-    shareBox
+    shareBox,
+    crmAction
   },
   data () {
     return {
@@ -402,6 +407,16 @@ export default {
     },
     hasTrailPower () { // 有此权限,可查看中标分析
       return this.freeTrialStatus
+    },
+    // 是否是BI嵌入页面
+    isBIPage () {
+      return this.$route.query.type
+    },
+    crmParams () {
+      return {
+        employType: 2,
+        idArr: this.$route.params.eId
+      }
     }
   },
   provide () {

+ 7 - 1
src/views/portrayal/UnitPortrayal.vue

@@ -22,7 +22,7 @@
             </div>
           </template>
           <template v-if="isBIPage">
-            <crm-action></crm-action>
+            <crm-action :params="crmParams"></crm-action>
           </template>
         </div>
         <div class="u-type">
@@ -567,6 +567,12 @@ export default {
     isBIPage () {
       return this.$route.query.type
     },
+    crmParams () {
+      return {
+        employType: 3,
+        idArr: this.info.buyerName,
+      }
+    }
   },
   created () {
     window.$noIntercept = true