import routerService from '@/common/services/router-service'
import SdTable from '@/common/components/sd-table.vue'
import asyncComponent from '@/common/services/async-component'
import flowService from '@/webflow/flow-service'

// @ts-ignore
const oldColumnsComputed = SdTable.computed.columnsComputed
// @ts-ignore
SdTable.computed.columnsComputed = function () {
  const obj = oldColumnsComputed
    .bind(this)()
    .find((i) => i.title === '序号')
  if (
    obj ||
    (this.$route?.path.indexOf('/sd-task-list') === -1 &&
      this.$route?.path.indexOf('/sd-business-list') === -1 &&
      this.$route?.path.indexOf('/law-check') === -1 &&
      this.$route?.path.indexOf('/law-team-list') === -1)
  ) {
    return [...oldColumnsComputed.bind(this)()]
  } else {
    const returnColumns = [...oldColumnsComputed.bind(this)()]
    if (returnColumns[0].scopedSlots?.customRender === 'id') {
      returnColumns.splice(1, 0, {
        dataIndex: 'xmindex',
        title: '序号',
        // @ts-ignore
        customRender: (text, record, index) => `${index + 1}`,
        width: '65px',
        show: true,
      })
      return returnColumns
    }
    return [
      {
        dataIndex: 'xmindex',
        title: '序号',
        // @ts-ignore
        customRender: (text, record, index) => `${index + 1}`,
        width: '65px',
        show: true,
      },
      ...oldColumnsComputed.bind(this)(),
    ]
  }
}

// 案由配置维护
routerService.routeInFrame('law-case-config', {
  component: './config/law-case-config.vue',
})

// 法律队伍管理
routerService.routeInFrame('law-team-list', {
  component: './team/law-team-list.vue',
})

// 法务-纠纷登记
flowService.addFlowForm('onl:5713a67680d34e73bd593844929e707a', './dispute/law-dispute-form.vue')

// 法务-纠纷进展
routerService.route('/law-progress-page/:type/:mode*/:id', {
  component: './dispute/law-progress-page.vue',
})

// 纠纷进展详情
flowService.addFlowForm(
  'onl:ee26925977dd4a2ea845006f2faa15a6',
  './dispute/law-progress-detail-form.vue'
)

// 纠纷结案详情
flowService.addFlowForm(
  'onl:084443d182d24d3ab87aabff6b17cf68',
  './dispute/law-dispute-finish-form.vue'
)

// 法务-纠纷查询
routerService.routeInFrame('law-dispute-search', {
  component: './dispute/law-dispute-search.vue',
})

// 律所选聘
flowService.addFlowForm('onl:22ef71fd1a3d464ba960723d25225624', './choose/law-choose-form.vue')

// 法律审查申请
flowService.addFlowForm(
  'onl:456a99135315473e823234d41aab5426',
  './lawcheckapply/law-check-apply-form.vue'
)

// 法律审查申请列表
routerService.routeInFrame('law-check-apply-list', {
  component: './lawcheckapply/law-check-apply-list.vue',
})

// 法律审查意见列表
routerService.routeInFrame('law-check-opinion-list', {
  component: './lawcheckapply/law-check-opinion-list.vue',
})

// 服务记录
flowService.addFlowForm('onl:283ca8d0103e46979b13894628b4797a', './record/law-record-form.vue')

//  服务记录评价
routerService.routeInFrame('law-record-eval', {
  component: './record/law-record-eval-form.vue',
})

// 律所管理
flowService.addFlowForm('onl:843f7ac3100d4ceaa75e8a50babcbf29', './firm/law-firm-form.vue')

// 案件结案
flowService.addFlowForm(
  'onl:6d9b334e035840fba7843dbdccfd6862',
  './casefinish/law-case-finish-form.vue'
)
// 执行结案
flowService.addFlowForm(
  'onl:bbde3783847c436cacf2c330adc12649',
  './casefinish/law-case-execute-finish-form.vue'
)

// 案件上报
flowService.addFlowForm('onl:d0bb8202233c48f0b5148776754461e1', './report/law-case-report-form.vue')

// 法务-案件进展
routerService.route('/case-progress-page/:type/:mode*/:id', {
  component: './case/law-case-progress-page.vue',
})

// 法务-案件进展-先予执行
flowService.addFlowForm(
  'onl:dbbcce1f78ac46a8b658f3c708880e3d',
  './case/progress/case-progress-xyzx-form.vue'
)

// 法务-案件进展-侦察
flowService.addFlowForm(
  'onl:11bedffdc8d644ef9571d917661e09cb',
  './case/progress/case-progress-zhencha-form.vue'
)

// 法务-案件进展-起诉
flowService.addFlowForm(
  'onl:5f4f71a26ca44da685510115cc43660b',
  './case/progress/case-progress-qisu-form.vue'
)

// 法务-案件进展-审理
flowService.addFlowForm(
  'onl:591ddcd210a3480d8fde8470d3364daa',
  './case/progress/case-progress-qisu-form.vue'
)

// 法务-执行程序-申请执行
flowService.addFlowForm(
  'onl:c7a574ca79f6490e9e7e377f8432bef2',
  './case/execute/case-execute-sqzx-form.vue'
)

// 律师管理
flowService.addFlowForm('onl:6c91e5a7ac4c4e099bb4749adaf58381', './lawyer/law-lawyer-page.vue')

// 案件大事记
routerService.route('/case-memorabilia-page/:id', {
  component: './case/memorabilia/case-memorabilia-page.vue',
})

// 法务-执行程序-强制执行
flowService.addFlowForm(
  'onl:9e0e67bdbea746b3bab84dcdbfddc477',
  './case/execute/case-execute-qzzx-form.vue'
)

// 法务-执行程序-执行恢复
flowService.addFlowForm(
  'onl:d419f5398b624b36824fac00fa4be109',
  './case/execute/case-execute-zxhf-form.vue'
)

// 法务-执行程序-执行和解
flowService.addFlowForm(
  'onl:39d653a4bc4348b58064021f54959df5',
  './case/execute/case-execute-zxhj-form.vue'
)

// 法务-执行程序-执行进展
flowService.addFlowForm(
  'onl:fc457c0500b945b1ad50d9a0d62b4b45',
  './case/execute/case-execute-zxjz-form.vue'
)

// 法务-执行程序-执行异议
flowService.addFlowForm(
  'onl:cde74d39cd074266b943a5c34889d180',
  './case/execute/case-execute-zxyy-form.vue'
)

// 法务-执行程序-执行终结
flowService.addFlowForm(
  'onl:3aa0be42a4874c3e85a673c7a161a199',
  './case/execute/case-execute-zxzj-form.vue'
)

// 法务-执行程序-执行中止
flowService.addFlowForm(
  'onl:435c1a4f24a54254b6e2ef384caf6798',
  './case/execute/case-execute-zxzz-form.vue'
)

// 法务-案件进展-诉讼终结
flowService.addFlowForm(
  'onl:476470a9520045708375b6eed1ce3f30',
  './case/progress/case-progress-sszj-form.vue'
)

// 法务-案件进展-讼前财产保全
flowService.addFlowForm(
  'onl:cad00f2158f04e0dbd576544f1a33d88',
  './case/progress/case-progress-sqccbq-form.vue'
)
// 法务-案件进展-讼前司法鉴定
flowService.addFlowForm(
  'onl:1f862be423b74628b1576bc68d39ca9e',
  './case/progress/case-progress-sqsfjd-form.vue'
)
// 案件数量统计
routerService.routeInFrame('law-case-statistics', {
  component: './statistics/law-casestatistics-form.vue',
})
// 诉讼地位统计
routerService.routeInFrame('law-ssdw-statistics', {
  component: './statistics/law-ssdwstatistics-form.vue',
})
// 案发单位统计
routerService.routeInFrame('law-incident-unit-statistics-form', {
  component: './statistics/law-incident-unit-statistics-form.vue',
})

// 法务-工作台配置
routerService.routeInFrame('law-work-bench-config', {
  component: './workbench/law-work-bench-config.vue',
})

// 法务-案件进展-诉讼恢复
flowService.addFlowForm(
  'onl:984478ed7dda40cd9cfffc8cd48f62d2',
  './case/progress/case-progress-sshf-form.vue'
)
// 法务-案件进展-诉讼中止
flowService.addFlowForm(
  'onl:6ba55896283c443b90fb6cbfc09dad1f',
  './case/progress/case-progress-sszz-form.vue'
)
// 法务-案件进展-反诉
flowService.addFlowForm(
  'onl:e709381701a841f6a0c07cf1f7079252',
  './case/progress/case-progress-fs-form.vue'
)
// 案件阶段统计
routerService.routeInFrame('law-casestage-statistics', {
  component: './statistics/law-casestage-statistics-form.vue',
})
// 案例库
routerService.routeInFrame('case-library-form', {
  component: './case/library/case-library-form.vue',
})
// 法务-案例库
flowService.addFlowForm(
  'onl:d83ec1be858c47ee999d79095836ded0',
  './case/library/case-library-form.vue'
)

// 法务-案件进展-开庭审理
flowService.addFlowForm(
  'onl:af8b1279cfa34ed186201addc4158496',
  './case/progress/case-progress-ktsl-form.vue'
)

// 法务-案件进展-审理结果
flowService.addFlowForm(
  'onl:5b7356da380445d3a33e24edbd988ab8',
  './case/progress/case-progress-sljg-form.vue'
)

// 法务-案件进展-上诉信息
flowService.addFlowForm(
  'onl:fe01b35002454aaea1da68dfdcf371ab',
  './case/progress/case-progress-ssxx-form.vue'
)

// 法务-案件进展-仲裁
flowService.addFlowForm(
  'onl:e20670a14b6946cb953abb8dd9d13fa7',
  './case/progress/case-progress-zc-form.vue'
)

// 法务-案件进展-行政复议
flowService.addFlowForm(
  'onl:2173f232013e44a0baba9c952e4399e8',
  './case/progress/case-progress-xzfy-form.vue'
)
// 案件查询
routerService.routeInFrame('law-case-query', {
  component: './case/casequery/law-case-query.vue',
})

// 案件阶段配置
routerService.routeInFrame('law-case-stage', {
  component: './config/law-case-stage-config.vue',
})

// 法务-案件进展-管辖权异议
flowService.addFlowForm(
  'onl:4485e94dacec4de48ea500bff112df31',
  './case/progress/case-progress-gxqyy-form.vue'
)

// 案件执行程序配置
routerService.routeInFrame('case-execute-procedure', {
  component: './case/execute/case-execute-procedure-form.vue',
})

// 案件受理机构管理列表
routerService.routeInFrame('law-case-accept-court', {
  component: './config/law-case-accept-court-config.vue',
})

// 案件执行程序配置列表
routerService.routeInFrame('law-case-execute-procedure', {
  component: './config/law-case-execute-procedure-config.vue',
})
// 已结案件
routerService.routeInFrame('law-case-finished-query', {
  component: './case/casefinishedquery/law-case-finished-query.vue',
})
