zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
  <div>
    <a-list item-layout='horizontal' :data-source='infoList'>
      <a-list-item slot='renderItem' slot-scope='item, index'>
        <a-list-item-meta>
          <a slot='title'>{{ item.label }}</a>
          <template slot='description'>
            <div style='display: flex'>
              <div style='min-width: 100px'>
                总共:<span :class="item.subUserList.length  ? 'text-blue' : null">{{ item.subUserList.length ? item.subUserList.length : '-'   }}</span> 人
              </div>
              <div style='min-width: 100px'>
                <a-icon type='user' style='color: #1890FF;'  />
                在编:<span :class="item.bz.length  ? 'text-blue' : null">{{ item.bz.length ? item.bz.length : '-'   }}</span>  人
              </div>
              <div style='min-width: 100px'>
                <a-icon type='star' :class="item.yj.length  ? 'text-blue' : null"   theme='filled' />
                应届:<span :class="item.yj.length  ? 'text-blue' : null">{{ item.yj.length ? item.yj.length : '-'   }}</span> 人
              </div>
              <div style='min-width: 100px'>
                <a-icon type='golden':class="item.jd.length  ? 'text-blue' : null" theme='filled' />
                借调:<span :class="item.jd.length  ? 'text-blue' : null">{{ item.jd.length ? item.jd.length : '-'   }}</span> 人
              </div>
 
              <div style='min-width: 100px'>
                <a-icon type='thunderbolt' :class="item.sy.length  ? 'text-blue' : null" theme='filled' />
                试用:<span :class="item.sy.length  ? 'text-blue' : null">{{ item.sy.length ? item.sy.length : '-'   }}</span> 人
              </div>
              <div style='min-width: 100px'>
                <a-icon type='flag' :class="item.sx.length  ? 'text-blue' : null" theme='filled' />
                实习:<span :class="item.sx.length  ? 'text-blue' : null">{{ item.sx.length ? item.sx.length : '-'   }}</span> 人
              </div>
 
            </div>
 
          </template>
        </a-list-item-meta>
      </a-list-item>
    </a-list>
  </div>
</template>
 
<script>
 
export default {
  name: 'DepartInfoList',
  props: {
    data: {
      type: Object,
      required: true,
      default: {}
    }
  },
  watch: {
    data: {
      handler(newValue, oldValue) {
        // 回调函数逻辑
        this.parseData()
      },
      immediate: true
    }
  },
  data() {
    return {
      infoList: [
      ]
    }
  },
  methods: {
    parseData() {
      let result = []
      let temp = []
      temp.push(this.data)
      const fitData = (array) => {
        for (let i = 0; i < array.length; i++) {
          const item = array[i]
          let model = {}
          model.label = item.label
          const subUserList = item.subUserList
          //不是借调或实习生 = 编制人员
          const bz = subUserList.filter(item => item.staffing  == 1)
          //借调人员
          const jd = subUserList.filter(item => item.employStatu == 2)
          //应届生
          const yj = subUserList.filter(item => item.grad == 1)
          //试用期
          const sy = subUserList.filter(item => item.employ == 2)
          //实习生
          const sx = subUserList.filter(item => item.employ == 3)
          model.subUserList = subUserList
          model.bz = bz
          model.jd = jd
          model.yj = yj
          model.sy = sy
          model.sx = sx
          result.push(model)
          if (item.children) {
            fitData(item.children)
          }
        }
      }
      fitData(temp)
      this.infoList = result
 
    }
  }
}
</script>
 
<style lang='less' scoped>
/deep/ .ant-list-item {
  padding: 4px 0;
}
 
.text-blue{
  color:#1890FF;
}
 
</style>