<template>
  <div class="basic-content">
    <cy-info-title style="margin-top: 10px;">其他信息</cy-info-title>
    <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      label-position="top"
      label-width="150px"
      class="rule-form-orange"
    >
      <el-form-item label="添加人">
        <el-input
          v-model="ruleForm.createBy"
          :disabled="disabled"
          placeholder="请输入添加人"
        />
      </el-form-item>
      <el-form-item label="添加时间">
        <el-date-picker
          v-model="ruleForm.gmtCreate"
          value-format="yyyy-MM-dd"
          type="date"
          placeholder="请选择添加时间"
          style="width: 100%;"
          :disabled="disabled"
        />
      </el-form-item>
      <el-form-item label="更新人">
        <el-input
          v-model="ruleForm.updateBy"
          :disabled="disabled"
          placeholder="请输入更新人"
        />
      </el-form-item>
      <el-form-item label="更新时间">
        <el-date-picker
          v-model="ruleForm.gmtModified"
          value-format="yyyy-MM-dd"
          type="date"
          placeholder="请选择更新时间"
          style="width: 100%;"
          :disabled="disabled"
        />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    detailsInfo: {
      type: Object,
      default: () => {}
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      ruleForm: {
        createBy: '',
        updateBy: '',
        gmtCreate: '',
        gmtModified: ''
      }
    }
  },
  watch: {
    detailsInfo: {
      handler(newV) {
        if (newV && Object.keys(newV).length) {
          const {
            createBy,
            updateBy,
            gmtCreate,
            gmtModified
          } = newV
          this.ruleForm = {
            createBy,
            updateBy: updateBy || '--',
            gmtCreate,
            gmtModified
          }
        }
      },
      immediate: true,
      deep: true
    }
  }
}
</script>

<style lang="scss" scoped>
.basic-content {
    // padding: 10px 20px;
}
</style>
