|
@@ -0,0 +1,221 @@
|
|
|
+<template>
|
|
|
+ <div style="background: #f8f8f8;">
|
|
|
+ <normal-layout>
|
|
|
+ <template #refresh>
|
|
|
+ <el-button size="mini" type="text" style="margin-right: 15px;color: #3874f6;font-size: 14px" @click="toTop">{{ $t('返回顶部') }}</el-button>
|
|
|
+ </template>
|
|
|
+ <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>
|
|
|
+ <btnSelect :btn-title="['全部','本年','本季','本月','上月','去年']" :date-type="dateType" @btnClick="btnClick"></btnSelect>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <dataBoard title="联系人数据概况" :mainData="mainData"></dataBoard>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </normal-layout>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import normalLayout from '@/components/normal-basic-layout/normalNew'
|
|
|
+import btnSelect from "@/components/btn_select/btnSelect";
|
|
|
+import dataBoard from '@/components/dataBoard/index'
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ components:{normalLayout,btnSelect,dataBoard},
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ scrollData:'',
|
|
|
+ depment:'',
|
|
|
+ person:'',
|
|
|
+ isleave:'1',
|
|
|
+ deplist:[],
|
|
|
+ personnelList:[],
|
|
|
+ depmentParam:{
|
|
|
+ "id": 20230620102004,
|
|
|
+ "content": {
|
|
|
+ "isleave":1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dateType:'本年',
|
|
|
+ windowWidth: document.documentElement.clientWidth, //实时屏幕宽度
|
|
|
+ userName:JSON.parse(window.sessionStorage.getItem('active_account')).name,
|
|
|
+ mainData:'',
|
|
|
+ paramMain:{
|
|
|
+ "id": 2025072114302202,
|
|
|
+ "content": {
|
|
|
+ "type": 1,
|
|
|
+ "dataid": 58,
|
|
|
+ "dateType": "全部",
|
|
|
+ "where": {
|
|
|
+ "isleave": "1"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ windowWidth (val) {
|
|
|
+ console.log("实时屏幕宽度:",val );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ /*返回顶部*/
|
|
|
+ toTop(){
|
|
|
+ this.$refs.rollRef.scrollTop = 0
|
|
|
+ },
|
|
|
+
|
|
|
+ /*滚动条*/
|
|
|
+ handleScroll(){
|
|
|
+ this.scrollData = this.$refs.rollRef.scrollTop
|
|
|
+ },
|
|
|
+
|
|
|
+ /*部门人员列表*/
|
|
|
+ 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) {
|
|
|
+ if (val.length === 0){
|
|
|
+ const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
|
|
|
+ }else {
|
|
|
+ this.person = ''
|
|
|
+ this.departmentid = val[val.length -1]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /*选择人员*/
|
|
|
+ selectPerson(val){
|
|
|
+ this.depment = ''
|
|
|
+ this.departmentid = ''
|
|
|
+ this.dataid = val
|
|
|
+ },
|
|
|
+ /*选择在职状态*/
|
|
|
+ leaveChange(){
|
|
|
+ this.person = ''
|
|
|
+ const type = this.depment?'1':'0'
|
|
|
+ const dataid = type == 0?-1:this.departmentid
|
|
|
+ this.personData()
|
|
|
+ },
|
|
|
+ /*获取新的业务员列表*/
|
|
|
+ async personData(){
|
|
|
+ let param = {
|
|
|
+ id: 20230620102004,
|
|
|
+ content: {
|
|
|
+ isleave:this.isleave
|
|
|
+ },
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested(param)
|
|
|
+ this.personnelList = res.data.hr
|
|
|
+ },
|
|
|
+ /*切换时间*/
|
|
|
+ btnClick(data){
|
|
|
+ this.dateType = data
|
|
|
+ },
|
|
|
+ /*联系人数据概况*/
|
|
|
+ queryMainData(){
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.departmentrtment()
|
|
|
+
|
|
|
+ var that = this;
|
|
|
+ // <!--把window.onresize事件挂在到mounted函数上-->
|
|
|
+ window.onresize = () => {
|
|
|
+ return (() => {
|
|
|
+ window.fullWidth = document.documentElement.clientWidth;
|
|
|
+ that.windowWidth = window.fullWidth; // 宽
|
|
|
+ })()
|
|
|
+ };
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|