<template>
  <div class="">
    <component
      :is="!isMobile ? 'signaturePc' : 'signatureMobile'"
      :value="value"
      :belong="belong"
      :bo-sub-entity="boSubEntity"
      :field-path="fieldPath"
      :is-validate="isValidate"
      :is-mobile="isMobile"
      @input="inputMethods"
    ></component>
     <input
      v-model="value"
      v-validate="validateRules"
      :name="inputName"
      :data-vv-as="name"
      type="hidden"
    /> 
     <ht-field-tail
      v-if="permission != 'n' && ['subDiv', 'subTable'].includes(belong)"
      :field-name="inputName"
      :readonly="false"
      :input-value="value"
    /> 
  </div>
</template>

<script>
  import permissions from '@/mixins/permission.js'
  import inputName from '@/mixins/inputName.js'
  import mobileMode from '@/mixins/mobileMode.js'
  import signatureMobile from './signatureMobile.vue'
  import signaturePc from './signaturePc.vue'
  export default {
    name: 'HtSignature',
    components: { signaturePc, signatureMobile },
    mixins: [permissions, mobileMode, inputName],
    props: {
      value: {
        type: String,
        default: '',
      },
      fieldPath: {
        type: String,
        default: '',
      },
      belong: {
        //所属位置 main subDiv subTable
        type: String,
        default: 'main',
      },
      boSubEntity: {
        //所属表格名称
        type: String,
        default: '',
      },
      isValidate: {
        type: Boolean,
        default: false,
      },
    },
    data() {
      return {
        // valueChange: '', //校验的值
      }
    },
    computed: {
      validateRules() {
        return ['subDiv', 'subTable'].includes(this.belong) && this.isValidate
          ? this.inputValidate
          : ''
      },
    },
    watch: {},

    created() {},

    mounted() {},

    methods: {
      inputMethods(val) {
        if (!val || (val && val == '[]')) {
          this.$emit('input', '')
        } else this.$emit('input', val)
      },
    },
  }
</script>
<style lang="scss" scoped>
  .mobile-error-field-tail {
    position: absolute;
    bottom: 6px !important;
    width: 100%;
  }
  //@import url(); 引入公共css类
</style>
