qymljy 8 місяців тому
батько
коміт
9c43337f7e

+ 58 - 0
src/HDrpManagement/contactData/components/btnSelectInfo.vue

@@ -0,0 +1,58 @@
+<template>
+  <div>
+    <el-button-group>
+      <el-button v-for="item in btnTitle" :key="item.index" :type="item === dateType ?'primary':''" size="small" @click="btnClick(item)">{{$t(item)}}</el-button>
+    </el-button-group>
+    <el-date-picker
+        style="margin-left: 10px"
+        v-model="dateData"
+        size="small"
+        type="daterange"
+        :range-separator="$t('至')"
+        :start-placeholder="$t(`开始月份`)"
+        :end-placeholder="$t(`结束月份`)">
+    </el-date-picker>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "btnSelectInfo",
+  props:{
+    btnTitle: Array,
+    dateType:''
+  },
+  data(){
+    return {
+      dateData:[]
+    }
+  },
+  methods:{
+    btnClick(data){
+      if (data == '本年'){
+        let year = new Date().getFullYear()
+        let begdate = year + '-01'
+        let enddate = year + '-12'
+        this.dateData = [begdate,enddate]
+      }else if (data == '本季'){
+        const now = new Date();
+        const quarterStartMonth = Math.floor(now.getMonth() / 3) * 3;
+        const quarterStartDate = new Date(now.getFullYear(), quarterStartMonth);
+        const quarterEndDate = new Date(now.getFullYear(), quarterStartMonth + 3);
+        this.dateData = [quarterStartDate,quarterEndDate]
+      }else if (this.value == '本月'){
+        const now = new Date();
+        const monthStartDate = new Date(now.getFullYear(), now.getMonth());
+        this.dateData = [monthStartDate,monthStartDate]
+      }
+    }
+  },
+  mounted() {
+    this.btnClick(this.dateType)
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 158 - 0
src/HDrpManagement/contactData/components/depStatus.vue

@@ -0,0 +1,158 @@
+<template>
+  <div>
+    <div class="inline-16">
+      <label  class="search__label" >{{$t('部门')}}:</label>
+      <el-cascader class="inline-16" placement="bottom" ref="selectdep" size="small" v-model="depment" :options="deplist" :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}"  @change="selectDep" clearable></el-cascader>
+    </div>
+    <div class="inline-16">
+      <label  class="search__label" >{{$t('业务员')}}:</label>
+      <el-select v-model="person" filterable :placeholder="$t('请选择')" size="small" clearable @change="selectPerson">
+        <el-option
+            v-for="item in personnelList"
+            :key="item.index"
+            :label="$t(item.name)"
+            :value="item.userid">
+        </el-option>
+      </el-select>
+    </div>
+    <div class="mt-10 inline-16">
+      <p class="search__label">{{$t('状态')}}:</p>
+      <el-select v-model="isleave" clearable style="margin-right:10px" size="small" :placeholder="$t('请选择状态')" @change="leaveChange" >
+        <el-option :label="$t('在职')" value="1"></el-option>
+        <el-option :label="$t('离职')" value="2"></el-option>
+      </el-select>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "depStatus",
+  data(){
+    return {
+      depment:'',
+      person:'',
+      isleave:'1',
+      deplist:[],
+      personnelList:[],
+      depmentParam:{
+        "id": 20230620102004,
+        "content": {
+          "isleave":1
+        }
+      },
+    }
+  },
+  methods:{
+    /*部门人员列表*/
+    async departmentrtment() {
+      const res = await this.$api.requested(this.depmentParam)
+      this.deplist = this.createMenu(res.data.dep)
+      this.personnelList = res.data.hr
+      this.depment = ''
+      this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
+      const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
+    },
+    /*部门结构处理*/
+    createMenu (array) {
+      var that = this
+      let arr = []
+      function convertToElementTree(node) {
+        // 新节点
+        if (node.subdep.length === 0){
+          var elNode = {
+            label: node["depname"],
+            parentid:node['parentid'],
+            parentname:node['parentname'],
+            departmentid:node["departmentid"],
+            value:node["departmentid"],
+            remarks:node["remarks"],
+            isused:node["isused"],
+            changedate:node['changedate'],
+            changeby:node['changeby'],
+            createdate:node['createdate'],
+            createby:node['createby'],
+            depno:node['depno'],
+            disabled:that.pageOnlyRead,
+          }
+        }else {
+          var elNode = {
+            label: node["depname"],
+            parentid:node['parentid'],
+            parentname:node['parentname'],
+            departmentid:node["departmentid"],
+            value:node["departmentid"],
+            remarks:node["remarks"],
+            isused:node["isused"],
+            changedate:node['changedate'],
+            changeby:node['changeby'],
+            createdate:node['createdate'],
+            createby:node['createby'],
+            depno:node['depno'],
+            disabled:that.pageOnlyRead,
+            children: []
+          }
+        }
+        if (node.subdep && node.subdep.length > 0) {
+          // 如果存在子节点
+          for (var index = 0; index < node.subdep.length; index++) {
+            // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
+            elNode.children.push(convertToElementTree(node.subdep[index]));
+          }
+        }
+        return elNode;
+      }
+      array.forEach((element) => {
+        arr.push(convertToElementTree(element))
+      });
+      return arr
+    },
+    /*选择部门*/
+    selectDep(val) {
+      console.log(val,'val2222')
+      if (val.length === 0){
+        const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
+        console.log(JSON.parse(sessionStorage.getItem('active_account')).userid)
+        this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
+        this.$emit(`depData`,userid,'0')
+      }else {
+        this.person = ''
+        this.departmentid = val[val.length -1]
+        this.$emit(`depData`,this.departmentid,'1',this.isleave)
+      }
+    },
+    /*选择人员*/
+    selectPerson(val){
+      this.depment = ''
+      this.departmentid = ''
+      this.dataid = val
+      this.$emit(`personData`,val,'0',this.isleave)
+    },
+    /*选择在职状态*/
+    leaveChange(){
+      this.person = ''
+      const type = this.depment?'1':'0'
+      const dataid = type == 0?-1:this.departmentid
+      this.$emit(`leaveData`,dataid,type,this.isleave,'状态')
+      this.personData()
+    },
+    /*获取新的业务员列表*/
+    async personData(){
+      let param = {
+        id: 20230620102004,
+        content: {
+          isleave:this.isleave
+        },
+      }
+      const res = await this.$api.requested(param)
+      this.personnelList = res.data.hr
+    },
+  },
+  mounted() {
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 98 - 5
src/HDrpManagement/contactData/components/salesContribution.vue

@@ -1,10 +1,32 @@
 <template>
   <div>
-    <dataTemPlate heightNew="300px">
+    <dataTemPlate >
       <template slot="content">
         <el-tabs v-model="activeName" @tab-click="handleClick">
-          <el-tab-pane :label="$t(`关联客户`)" name="first">{{(`联系人关联客户销售TOP10`)}}</el-tab-pane>
-          <el-tab-pane :label="$t(`关联项目`)" name="second">联系人关联项目销售TOP10</el-tab-pane>
+          <el-tab-pane :label="$t(`联系人关联客户销售TOP10`)" name="关联客户">
+            <depStatus class="inline-16" ref="depStatusCusRef" @depData="listData" @personData="listData" @leaveData="listData"></depStatus>
+            <btnSelect class="inline-16" :btnTitle="['本年','本季','本月']" dateType="本年"></btnSelect>
+            <tableDetail :layout="tablecols" :data="list" :opwidth="200" :custom="true">
+              <template v-slot:customcol="scope">
+                <div v-if="scope.column.columnname === 'amount'">
+                  {{tool.formatAmount(scope.column.data[scope.column.columnname])}}
+                </div>
+                <div v-else>{{scope.column.data[scope.column.columnname]||scope.column.columnname ==='operation'?scope.column.data[scope.column.columnname] : '--'}}</div>
+              </template>
+            </tableDetail>
+          </el-tab-pane>
+          <el-tab-pane :label="$t(`联系人关联项目销售TOP10`)" name="关联项目">
+            <depStatus class="inline-16"  ref="depStatusProRef" @depData="listData" @personData="listData" @leaveData="listData"></depStatus>
+            <btnSelect class="inline-16" :btnTitle="['本年','本季','本月']" dateType="本年"></btnSelect>
+            <tableDetail :layout="tablecols" :data="list" :opwidth="200" :custom="true">
+              <template v-slot:customcol="scope">
+                <div v-if="scope.column.columnname === 'amount'">
+                  {{tool.formatAmount(scope.column.data[scope.column.columnname])}}
+                </div>
+                <div v-else>{{scope.column.data[scope.column.columnname]||scope.column.columnname ==='operation'?scope.column.data[scope.column.columnname] : '--'}}</div>
+              </template>
+            </tableDetail>
+          </el-tab-pane>
         </el-tabs>
       </template>
     </dataTemPlate>
@@ -13,18 +35,89 @@
 
 <script>
 import dataTemPlate from '@/components/dataTemplate/index'
+import depStatus from './depStatus'
+import btnSelect from "./btnSelectInfo"
 export default {
   name: "salesContribution",
-  components:{dataTemPlate},
+  components:{dataTemPlate,depStatus,btnSelect},
   data(){
     return {
-      activeName: 'second'
+      activeName: '关联客户',
+      /*获取关联客户数据*/
+      paramCus:{
+        "id": 2025072410065502,
+        "content": {
+          "type": 1,
+          "dataid": 54,
+          "dateType": "本年",
+          "where": {
+            "begdate": "",
+            "enddate": "",
+            "condition": "",
+            "isleave": ""
+          },
+          "pageSize": 10,
+          "pageNumber": 1
+        },
+      },
+      /*获取关联项目数据*/
+      paramPro:{
+        "id": 2025072410070302,
+        "content": {
+          "type": 1,
+          "dataid": 54,
+          "dateType": "本年",
+          "where": {
+            "begdate": "",
+            "enddate": "",
+            "condition": "",
+            "isleave": ""
+          },
+          "pageSize": 10,
+          "pageNumber": 1
+        },
+      },
+      list:[],
+      tablecols:[],
+      currentPage:0,
+      total:0
     }
   },
   methods:{
+    queryList(id,type,isleave,state){
+      if (this.activeName == '关联客户') {
+        this.paramCus.content.pageNumber = 1
+      }else if (this.activeName == '关联项目'){
+        this.paramPro.content.pageNumber = 1
+      }
+      this.listData(id,type,isleave,state)
+    },
+    async listData(id,type,isleave,state){
+      if (this.activeName == '关联客户') {
+        this.paramCus.content.dataid = id
+        this.paramCus.content.type = type
+        this.paramCus.content.where.isleave = isleave
+      }else if (this.activeName == '关联项目'){
+        this.paramPro.content.dataid = id
+        this.paramPro.content.type = type
+        this.paramPro.content.where.isleave = isleave
+      }
+      const res = await this.$api.requested(this.activeName == '关联客户'?this.paramCus:this.paramPro)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
     handleClick(tab, event) {
       console.log(tab, event);
+      if (tab == '关联客户'){
+        this.tablecols = this.tool.tabelCol(this.$route.name).associatedCustomers.tablecols
+      }else {
+        this.tablecols = this.tool.tabelCol(this.$route.name).associatedProject.tablecols
+      }
     }
+  },
+  created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).associatedCustomers.tablecols
   }
 }
 </script>

+ 44 - 26
src/HDrpManagement/contactData/index.vue

@@ -7,30 +7,31 @@
       <template #content>
         <div style="overflow: auto;height: calc(100vh - 220px)" ref="rollRef" @scroll="handleScroll">
           <div style="display: flex;justify-content: space-between;margin: 10px 24px 20px 24px;">
-            <div>
-              <div class="inline-16">
-                <label  class="search__label" >{{$t('部门')}}:</label>
-                <el-cascader class="inline-16" placement="bottom" ref="selectdep" size="small" v-model="depment" :options="deplist" :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}"  @change="selectDep" clearable></el-cascader>
-              </div>
-              <div class="inline-16">
-                <label  class="search__label" >{{$t('业务员')}}:</label>
-                <el-select v-model="person" filterable :placeholder="$t('请选择')" size="small" clearable @change="selectPerson">
-                  <el-option
-                      v-for="item in personnelList"
-                      :key="item.index"
-                      :label="$t(item.name)"
-                      :value="item.userid">
-                  </el-option>
-                </el-select>
-              </div>
-              <div class="mt-10 inline-16">
-                <p class="search__label">{{$t('状态')}}:</p>
-                <el-select v-model="isleave" clearable style="margin-right:10px" size="small" :placeholder="$t('请选择状态')" @change="leaveChange" >
-                  <el-option :label="$t('在职')" value="1"></el-option>
-                  <el-option :label="$t('离职')" value="2"></el-option>
-                </el-select>
-              </div>
-            </div>
+<!--            <div>-->
+<!--              <div class="inline-16">-->
+<!--                <label  class="search__label" >{{$t('部门')}}:</label>-->
+<!--                <el-cascader class="inline-16" placement="bottom" ref="selectdep" size="small" v-model="depment" :options="deplist" :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}"  @change="selectDep" clearable></el-cascader>-->
+<!--              </div>-->
+<!--              <div class="inline-16">-->
+<!--                <label  class="search__label" >{{$t('业务员')}}:</label>-->
+<!--                <el-select v-model="person" filterable :placeholder="$t('请选择')" size="small" clearable @change="selectPerson">-->
+<!--                  <el-option-->
+<!--                      v-for="item in personnelList"-->
+<!--                      :key="item.index"-->
+<!--                      :label="$t(item.name)"-->
+<!--                      :value="item.userid">-->
+<!--                  </el-option>-->
+<!--                </el-select>-->
+<!--              </div>-->
+<!--              <div class="mt-10 inline-16">-->
+<!--                <p class="search__label">{{$t('状态')}}:</p>-->
+<!--                <el-select v-model="isleave" clearable style="margin-right:10px" size="small" :placeholder="$t('请选择状态')" @change="leaveChange" >-->
+<!--                  <el-option :label="$t('在职')" value="1"></el-option>-->
+<!--                  <el-option :label="$t('离职')" value="2"></el-option>-->
+<!--                </el-select>-->
+<!--              </div>-->
+<!--            </div>-->
+            <depStatus ref="allDepRef" @depData="depData" @personData="depData" @leaveData="depData"></depStatus>
             <div>
               <btnSelect :btn-title="['全部','本年','本季','本月','上月','去年']" :date-type="dateType" @btnClick="btnClick"></btnSelect>
             </div>
@@ -183,7 +184,7 @@
               </div>
             </template>
           </dataDetail>
-          <salesContribution></salesContribution>
+          <salesContribution class="mt-10" ref="salesContributionRef"></salesContribution>
         </div>
       </template>
     </normal-layout>
@@ -196,9 +197,10 @@ import btnSelect from "@/components/btn_select/btnSelect";
 import dataBoard from '@/components/dataBoard/index'
 import dataDetail from '@/template/dataDetail/index'
 import salesContribution from './components/salesContribution'
+import depStatus from './components/depStatus'
 export default {
   name: "index",
-  components:{normalLayout,btnSelect,dataBoard,dataDetail,salesContribution},
+  components:{normalLayout,btnSelect,dataBoard,dataDetail,salesContribution,depStatus},
   data(){
     return {
       scrollData:'',
@@ -346,9 +348,21 @@ export default {
     async departmentrtment() {
       const res = await this.$api.requested(this.depmentParam)
       this.deplist = this.createMenu(res.data.dep)
+      this.$refs.allDepRef.deplist = this.deplist
+      this.$refs.salesContributionRef.$refs.depStatusCusRef.deplist = this.deplist
+      this.$refs.salesContributionRef.$refs.depStatusProRef.deplist = this.deplist
       this.personnelList = res.data.hr
+      this.$refs.allDepRef.personnelList = this.personnelList
+      this.$refs.salesContributionRef.$refs.depStatusCusRef.personnelList = this.personnelList
+      this.$refs.salesContributionRef.$refs.depStatusProRef.personnelList = this.personnelList
       this.depment = ''
+      this.$refs.allDepRef.depment = this.depment
+      this.$refs.salesContributionRef.$refs.depStatusCusRef.depment = this.depment
+      this.$refs.salesContributionRef.$refs.depStatusProRef.depment = this.depment
       this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
+      this.$refs.allDepRef.person = this.person
+      this.$refs.salesContributionRef.$refs.depStatusCusRef.person = this.person
+      this.$refs.salesContributionRef.$refs.depStatusProRef.person = this.person
       const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
       this.otherMethod(userid)
     },
@@ -448,6 +462,10 @@ export default {
       this.dateType = data
       this.queryMainData(this.paramMain.content.dataid,data)
     },
+    /*选择部门*/
+    depData(id,type,isleave,state){
+      this.otherModel(id,type,isleave,state)
+    },
     /*其他页面首次调用*/
     otherMethod(dataid){
       const userName = JSON.parse(sessionStorage.getItem('active_account')).name