<template>
  <div>
    <el-form ref="shipForm" :model="shipObj" label-width="80px">
      <el-form-item label="状态">
        <el-radio-group v-model="shipObj.status">
          <el-radio v-for="item in status" :key="item.value" :label="item.value">{{item.label}}</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="配船时间" v-show="shipObj.status === '2'">
        <el-date-picker type="date" placeholder="请选择日期" v-model="shipObj.shipTime"></el-date-picker>
      </el-form-item>
    </el-form>

    <el-row class="operate-button">
      <el-button type="primary">保存</el-button>
      <el-button type="success" @click="onSubmit">提交</el-button>
      <el-button @click="cancel">关闭</el-button>
    </el-row>
  </div>
</template>

<script>
/**
 * 配船
 */
export default {
  name: "ship",
  data() {
    return {
      // 配船对象
      shipObj: {},
      // 状态
      status: [
        {
          value: "1",
          label: "免配",
        },
        {
          value: "2",
          label: "已配",
        },
      ],
    };
  },
  methods: {
    /** 提交 */
    onSubmit() {
      this.$refs["shipForm"].validate((valid) => {
        if (valid) {
          alert("submit!");
        }
      });
    },
    /** 取消 */
    cancel() {
      this.$emit("closeDialog");
    },
  },
};
</script>

<style lang="scss" scoped>
</style>
