<template>
  <div class="account-other-status">
    <cy-info-title>账户其它状态</cy-info-title>
    <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      :rules="rules"
      label-position="top"
      label-width="150px"
      class="rule-form-orange"
    >
      <el-form-item label="收支管控标志">
        <el-input
          v-model="ruleForm.iaeCtlFlg"
          placeholder="请输入收支管控标志"
          disabled
        />
      </el-form-item>
      <el-form-item label="收入管控">
        <el-input
          v-model="ruleForm.incFlg"
          placeholder="请输入收入管控"
          disabled
        />
      </el-form-item>
      <el-form-item label="支出管控">
        <el-input
          v-model="ruleForm.payFlg"
          placeholder="请输入支出管控"
          disabled
        />
      </el-form-item>
      <el-form-item label="取现标志">
        <el-input
          v-model="ruleForm.dwcFlg"
          placeholder="请输入取现标志"
          disabled
        />
      </el-form-item>
      <el-form-item label="归属机构">
        <el-input
          v-model="ruleForm.belongInstitution"
          placeholder="请输入归属机构"
          disabled
        />
      </el-form-item>

      <!-- <el-form-item label="激活状态">
        <el-input
          v-model="ruleForm.atvSts"
          placeholder="请输入激活状态"
          disabled
        />
      </el-form-item> -->
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    detailsInfo: {
      type: Object,
      default: () => {}
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      ruleForm: {
        iaeCtlFlg: '',
        incFlg: '',
        payFlg: '',
        dwcFlg: '',
        belongInstitution: '',
        atvSts: ''
      },
      rules: {}
    }
  },
  watch: {
    detailsInfo: {
      handler(val) {
        if (val && Object.keys(val).length) {
          this.ruleForm = val

          if (val.incFlg) {
            this.ruleForm.incFlg = this.getFlgDesc(val.incFlg)
          }

          if (val.iaeCtlFlg !== null && val.iaeCtlFlg !== '') {
            this.ruleForm.iaeCtlFlg = val.iaeCtlFlg === 0 ? '否' : '是'
          }

          if (val.dwcFlg !== null && val.dwcFlg !== '') {
            this.ruleForm.dwcFlg = val.dwcFlg === 0 ? '否' : '是'
          }

          if (val.payFlg !== null && val.payFlg !== '') {
            this.ruleForm.payFlg = this.getPayFlg(val.payFlg)
          }

          if (val.atvSts !== null && val.atvSts !== '') {
            this.ruleForm.atvSts = val.atvSts === 0 ? '否' : '是'
          }
        }
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    getFlgDesc(status) {
      const map = {
        1: '无收入管控',
        2: '仅对外收入',
        3: '仅对内收入',
        4: '禁止收入'
      }
      if (status) {
        return map[status] || ''
      }
      return ''
    },
    getPayFlg(status) {
      const map = {
        1: '无支出管控',
        2: '仅对外支出',
        3: '仅对内支出',
        4: '禁止支出'
      }
      if (status) {
        return map[status] || ''
      }
      return ''
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
