<template>
  <a-form :model="DistInfo" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" ref="pblmDistInfoForm">
    <a-form-item label="整改文号" prop="zgWh">
      <a-input v-model:value="DistInfo.zgWh" />
    </a-form-item>
    <a-form-item label="文件名称" prop="zgWjName">
      <a-input v-model:value="DistInfo.zgWjName" />
    </a-form-item>
    <a-form-item label="备注" prop="zgMemo">
      <a-textarea v-model:value="DistInfo.zgMemo" :rows="8"/>
    </a-form-item>
    <a-form-item :wrapper-col="{ span: 18, offset: 6 }">
      <a-button type="primary" @click="savePblmDistInfo" :loading="loadingStat">{{ loadingStatText }}</a-button>
    </a-form-item>
  </a-form>
</template>

<script>
import { hostUrl } from '../../../utils/global_variable';
import request from '../../../utils/gw_ajax_request';
export default {
  data() {
    return {
      DistInfo: {
        zgWh: '',
        zgWjName: '',
        zgMemo: '',
        // zgDate: "",
      },
      loadingStat: false,
      loadingStatText: '提交',
      rules: {
        zgWh: [
          { required: false, message: '整改文号不能为空', trigger: 'blur' },
        ],
        // zgDate: [
        //   {required: true, message: '整改截止日期不能为空', trigger: 'blur'}
        // ],
        //  zgMemo: [
        //   {required: true, message: '备注不能为空', trigger: 'blur'}
        // ]
      },
    };
  },
  computed: {
    hostUrl() {
      return hostUrl;
    },
  },
  watch: {
    pblmId: () => {},
  },
  created() {},
  methods: {
    savePblmDistInfo() {
      this.$refs.pblmDistInfoForm.validate((valid) => {
        if (valid) {
          if (this.DistInfo.zgMemo === '') {
            this.DistInfo.zgMemo = '无备注';
          }
          this.$emit('savePblmDistInfo', this.DistInfo);
          this.$refs.pblmDistInfoForm.resetFields();
        } else {
          console.log('pblmDistInfoForm valid failed!!');
          return false;
        }
      });
    },
  },
};
</script>

<style lang='less' scoped>

</style>
