Ver Código Fonte

[FE]修改考勤规则部门列表渲染的数据结构

luoxu5 4 anos atrás
pai
commit
132d70affa

+ 2 - 1
security-protection-platform/src/api/common/index.js

@ -18,7 +18,7 @@ const api = {
18 18
    return $default.get('/sp/workEmployee/queryAllOrganize').then((resp) => {
19 19
      const data = resp.data.data
20 20
      if (!Array.isArray(data)) return resp
21
      console.log(data)
21
22 22
      // eslint-disable-next-line one-var
23 23
      // const newData = [],
24 24
      //   map = {},
@ -42,6 +42,7 @@ const api = {
42 42
      // console.log(newData)
43 43
      // console.log('queryAllOrganize', resp)
44 44
      resp.data = nest(data)
45
      console.log(resp.data)
45 46
      // resp.data = keysMappingReverse(nest(data), mapping)
46 47
      return resp
47 48
    })

+ 15 - 3
security-protection-platform/src/modules/system/attendance/components/AttendancePanel/index.vue

@ -229,7 +229,8 @@ export default {
229 229
      if (data.length > 0) {
230 230
        data.forEach(item => {
231 231
          arr.push({
232
            id: item.id + '',
232
            orgId: item.id + '',
233
            id: item.code,
233 234
            label: item.name,
234 235
            pid: item.parentCode
235 236
          })
@ -244,8 +245,6 @@ export default {
244 245
      this.loadDepts = true
245 246
      commonapi.getDepartments().then(resp => {
246 247
        const data = []
247
        // console.log(resp.data)
248
249 248
        // resp.data.forEach(item => {
250 249
        //   const orgId = item.id + ''
251 250
        //   data.push({
@ -282,6 +281,19 @@ export default {
282 281
            delete item.pid
283 282
          }
284 283
        })
284
        // 深拷贝data
285
        const data1 = JSON.parse(JSON.stringify(data))
286
        // 用部门真的id映射关系代替code与parentCode父子映射关系
287
        data.forEach(item => {
288
          item.id = item.orgId
289
          data1.some((item1) => {
290
            if (item.pid === item1.id) {
291
              item.pid = item1.orgId
292
            } else {
293
              return false
294
            }
295
          })
296
        })
285 297
        this.treeData = data
286 298
      }).finally(() => {
287 299
        this.loadDepts = false