<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 DisputeMixins from './dispute-mixins.js'
import components from './_import-components/law-progress-detail-form-import'

export default {
  name: 'LawProgressDetailForm',
  metaInfo: {
    title: '纠纷进展详情',
  },
  components,
  mixins: [DisputeMixins],
  data() {
    return {}
  },
  mounted() {
    this.type = 'jfProgress'

    const _this = this
    const ini = setInterval(() => {
      if (
        _this.$refs.webflow &&
        (_this.$refs.webflow.$refs.form || _this.$refs.webflow.$refs.sdForm)
      ) {
        clearInterval(ini)

        if (_this.$refs.webflow.getFieldValue('STEP_NAME')) {
          document.querySelector('.toptitle_sd-header_common').innerHTML =
            _this.$refs.webflow.getFieldValue('STEP_NAME')
        }
      }
    }, 100)
  },
  methods: {
    initDatap() {
      this.initData()
      const _this = this
      const ini = setInterval(() => {
        if (
          _this.$refs.webflow &&
          (_this.$refs.webflow.$refs.form || _this.$refs.webflow.$refs.sdForm)
        ) {
          clearInterval(ini)

          if (_this.$refs.webflow.getFieldValue('STEP_NAME')) {
            document.querySelector('.toptitle_sd-header_common').innerHTML =
              _this.$refs.webflow.getFieldValue('STEP_NAME')
          }
        }
      }, 1000)
    },
  },
}
</script>

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