<template>
  <sd-webflow
    ref="webflow"
    @afterDispatch="afterDispatch"
    @saveproject="save"
    @sdFormReady="initDatap"
    @actionBtnClick="actionBtnClick"
  >
    <template v-slot:form="{ model, FlowData }">
      <sd-form-by-builder ref="builderform" :form-data="FlowData.processFormData" />
    </template>
  </sd-webflow>
</template>

<script>
import LawService from '../../law-service'
import CaseMixins from '../case-mixins.js'
import components from './_import-components/case-progress-ssxx-form-import'

export default {
  name: 'caseProgressSsxxForm',
  metaInfo: {
    title: '案件进展-上诉信息',
  },
  components,
  mixins: [CaseMixins],
  data() {
    return {}
  },
  created() {
    this.type = 'progress'
  },
  mounted() {
    this.type = 'progress'
  },
  methods: {
    initDatap() {
      if (this.create) {
        this.initData()
        const caseId = this.$route.query.id
        // 获取案件信息
        LawService.findByCase(caseId).then((res) => {
          this.$refs.webflow.setFieldValue('CASE_NAME', res.data[0].CASE_NAME)
          this.$refs.webflow.setFieldValue('CASE_TYPE', res.data[0].CASE_TYPE)
          this.$refs.webflow.setFieldValue('COURT_TYPE', res.data[0].COURT_TYPE)
          this.$refs.webflow.setFieldValue('CASE_NO', res.data[0].CURRENTNUMBER)
          this.$refs.webflow.setFieldValue('COURT_ID', res.data[0].COURT_ID)
          this.$refs.webflow.setFieldValue('COURT_NAME', res.data[0].COURT)
        })
      }
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
