<template>
    <div>
        
        <el-card>

        <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px"
          label-position="left">
      <el-row :gutter="10">

          <el-col :span="12">
            <el-form-item label="项目名称" prop="field101">
              <el-input v-model="formData.field101" placeholder="点击选择项目" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="项目编码" prop="field102">
              <el-input v-model="formData.field102" placeholder="系统自动填写" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同编号" prop="field103">
              <el-input v-model="formData.field103" placeholder="系统自动编号" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同名称" prop="field104">
              <el-input v-model="formData.field104" placeholder="请输入合同名称" clearable :style="{width: '100%'}">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="供应商名称" prop="field105">
              <el-input v-model="formData.field105" placeholder="点击选择目项供应商" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="供应商编码" prop="field106">
              <el-input v-model="formData.field106" placeholder="系统自动填写" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同类型" prop="field107">
              <el-radio-group v-model="formData.field107" size="medium">
                <el-radio v-for="(item, index) in field107Options" :key="index" :label="item.value"
                  :disabled="item.disabled">{{item.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签订日期" prop="field108">
              <el-date-picker v-model="formData.field108" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{width: '100%'}" placeholder="请选择签订日期" clearable></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款方式" prop="field109">
              <el-radio-group v-model="formData.field109" size="medium">
                <el-radio v-for="(item, index) in field109Options" :key="index" :label="item.value"
                  :disabled="item.disabled">{{item.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="账期" prop="field110">
              <el-radio-group v-model="formData.field110" size="medium">
                <el-radio v-for="(item, index) in field110Options" :key="index" :label="item.value"
                  :disabled="item.disabled">{{item.label}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同金额" prop="field111">
              <el-input v-model="formData.field111" placeholder="系统自动计算" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="金额大写" prop="field112">
              <el-input v-model="formData.field112" placeholder="系统自动填写" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税率" prop="field113">
              <el-select v-model="formData.field113" placeholder="请选择税率" clearable :style="{width: '100%'}">
                <el-option v-for="(item, index) in field113Options" :key="index" :label="item.label"
                  :value="item.value" :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="不含税金额" prop="field114">
              <el-input v-model="formData.field114" placeholder="系统自动计算不" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="质保金比例(%)" prop="field116">
              <el-input v-model="formData.field116" placeholder="请输入质保金比例(%)" clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="质保金" prop="field117">
              <el-input v-model="formData.field117" placeholder="系统自动计算" :disabled='true' clearable
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" prop="field118">
              <el-input v-model="formData.field118" type="textarea" placeholder="请输入备注"
                :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="附件" prop="field119" required>
              <el-upload ref="field119" :file-list="field119fileList" :action="field119Action"
                :before-upload="field119BeforeUpload">
                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item size="large">
              <el-button type="primary" @click="submitForm">提交</el-button>
              <el-button @click="resetForm">重置</el-button>
            </el-form-item>
          </el-col>
      </el-row>
        </el-form>
    </el-card>




    
    </div>
  </template>
  <script>
  export default {
    components: {},
    props: [],
    data() {
      return {
        formData: {
          field101: undefined,
          field102: undefined,
          field103: undefined,
          field104: undefined,
          field105: undefined,
          field106: undefined,
          field107: 1,
          field108: null,
          field109: 1,
          field110: 1,
          field111: undefined,
          field112: undefined,
          field113: undefined,
          field114: undefined,
          field116: undefined,
          field117: undefined,
          field118: undefined,
          field119: null,
        },
        rules: {
          field101: [{
            required: true,
            message: '点击选择项目',
            trigger: 'blur'
          }],
          field102: [{
            required: true,
            message: '系统自动填写',
            trigger: 'blur'
          }],
          field103: [{
            required: true,
            message: '系统自动编号',
            trigger: 'blur'
          }],
          field104: [{
            required: true,
            message: '请输入合同名称',
            trigger: 'blur'
          }],
          field105: [{
            required: true,
            message: '点击选择目项供应商',
            trigger: 'blur'
          }],
          field106: [{
            required: true,
            message: '系统自动填写',
            trigger: 'blur'
          }],
          field107: [{
            required: true,
            message: '合同类型不能为空',
            trigger: 'change'
          }],
          field108: [{
            required: true,
            message: '请选择签订日期',
            trigger: 'change'
          }],
          field109: [],
          field110: [{
            required: true,
            message: '账期不能为空',
            trigger: 'change'
          }],
          field111: [],
          field112: [{
            required: true,
            message: '系统自动填写',
            trigger: 'blur'
          }],
          field113: [{
            required: true,
            message: '请选择税率',
            trigger: 'change'
          }],
          field114: [],
          field116: [{
            required: true,
            message: '请输入质保金比例(%)',
            trigger: 'blur'
          }],
          field117: [{
            required: true,
            message: '系统自动计算',
            trigger: 'blur'
          }],
          field118: [],
        },
        /*    “我被叫到这里来，不会是因为加图索家是校董会成员吧？”恺撒看着昂热，“进入卡塞尔学院时，我就说过这是我的个人选择，和家族无关。”*/

        field119Action: 'https://jsonplaceholder.typicode.com/posts/',
        field119fileList: [],
        field107Options: [{
          "label": "专业分包",
          "value": 1
        }, {
          "label": "劳务分包",
          "value": 2
        }],
        field109Options: [{
          "label": "承兑",
          "value": 1
        }, {
          "label": "电汇",
          "value": 2
        }, {
          "label": "支票",
          "value": 3
        }],
        field110Options: [{
          "label": "现结",
          "value": 1
        }, {
          "label": "月结",
          "value": 2
        }, {
          "label": "季度结",
          "value": 3
        }],
        field113Options: [{
          "label": "选项一",
          "value": 1
        }, {
          "label": "选项二",
          "value": 2
        }],
      }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
      submitForm() {
        this.$refs['elForm'].validate(valid => {
          if (!valid) return
          // TODO 提交表单
        })
      },
      resetForm() {
        this.$refs['elForm'].resetFields()
      },
      field119BeforeUpload(file) {
        let isRightSize = file.size / 1024 / 1024 < 2
        if (!isRightSize) {
          this.$message.error('文件大小超过 2MB')
        }
        return isRightSize
      },
    }
  }
  
  </script>
  <style>
  .el-upload__tip {
    line-height: 1.2;
  }
  
  </style>
  