进入portal

点击“租赁应收单”进入

对应的连接地址是

http://10.10.169.63/iwebap/pages/20060RBR/F0-Cxx-D32/0/1001H210000000ZKRH2C/0001H210000000000IGL/0001Z010000000079UJJ/0/simpchn/arapcard.html?tradetype=F0-Cxx-D32&nodecode=20060RBR&pk_org=0001H210000000000IGL&templateName=%25E7%25A7%259F%25E8%25B5%2581%25E5%25BA%2594%25E6%2594%25B6%25E5%258D%2595#/add

当鼠标指针聚焦在“财务组织”文本框中的时候,前端会往后端发送请求,其中如下请求是获取全部数据的

Request URL:http://10.10.169.63/iwebap/iref_ctr/commonRefsearch/
Request Method:POST
Status Code:200 OK
Remote Address:10.10.169.63:80

Request Headers

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Form Data

有几个字段内容太多了,放在附件中了:

filterPks: (attachments)
pk_org:
refName:%25E8%25B4%25A2%25E5%258A%25A1%25E7%25BB%2584%25E7%25BB%2587
refModelClassName:
refModelHandlerClass:
cfgParam:{"isMultiSelectedEnabled":false}
clientParam: (attachments)
refClientPageInfo.pageSize:-1
refClientPageInfo.currPageIndex:-1

Response

(内容太多了,放在附件财务组织导出数据(格式化后)中了)

从respones中抽取一个item

这是根节点

    {
      "refcode": "bgy",
      "pk_group": "0001H210000000000IGL",
      "id": "0001H2100000000022LJ",
      "pid": "null",
      "pk_corp": "0001H2100000000022LJ",
      "enablestate": "2",
      "refname": "碧桂园集团",
      "refpk": "0001H2100000000022LJ"
    }

这是一个子节点,可以发现通过pid关联到parent上。

    {
      "refcode": "1",
      "pk_group": "0001H210000000000IGL",
      "id": "0001H2100000000022YK",
      "pid": "0001H2100000000022LJ",
      "pk_corp": "0001H2100000000022YK",
      "enablestate": "2",
      "refname": "集团总部",
      "refpk": "0001H2100000000022YK"
    },

所以形成tree的关键就是idpid了。

将此扁平化数据变成树(也就是unflatten操作),参照代码https://gist.github.com/xxd3vin/2dc682f6996ac962bbfbfd7977ef6c1a