<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 CaseMixins from '../case-mixins.js'
import LawService from '../../law-service'
import components from './_import-components/case-progress-zhencha-form-import'

export default {
  name: 'CaseProgressZhenchaForm',
  metaInfo: {
    title: '案件进展-侦察详情',
  },
  components,
  mixins: [CaseMixins],
  data() {
    return {}
  },
  created() {
    this.type = 'progress'
  },
  mounted() {
    this.type = 'progress'
  },
  methods: {
    initDatap() {
      if (this.create) {
        this.initData()
        // 获取案件信息
        LawService.getBeanByFormId(
          this.$route.query.id,
          'onl:d0bb8202233c48f0b5148776754461e1'
        ).then((res) => {
          const obj = res.data.pageFormData.pageFieldInfos
          obj.forEach((item) => {
            if (item.name === 'CASE_USERS') {
              // 涉案人员赋值
              this.$refs.webflow.setFieldValue('CASE_USERS_NAME', item.value)
            }
          })
        })
      }
    },
  },
}
</script>

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