<!--
 * @Author: zwq
 * @Date: 2023-01-04 10:29:40
 * @LastEditors: zwq
 * @LastEditTime: 2023-06-30 14:53:49
 * @Description: 
-->
<template>
  <el-form :model="dataForm" ref="dataForm" label-width="120px">
    <el-form-item prop="title" :label="$t('code.title')">
      <el-input v-model="dataForm.title" :placeholder="$t('code.title')" clearable></el-input>
    </el-form-item>
    <el-form-item prop="customId" label="客户">
      <el-select v-model="dataForm.customId" filterable clearable placeholder="请选择客户">
        <el-option
          v-for="item in this.urlOptions.optionArr.arr0"
          :key="item.id"
          :label="item.customerName"
          :value="item.id"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item prop="productId" label="产品">
      <el-select v-model="dataForm.productId" filterable clearable placeholder="请选择产品">
        <el-option
          v-for="item in this.urlOptions.optionArr.arr1"
          :key="item.id"
          :label="item.productName"
          :value="item.id"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item prop="eightDisciplineStatus" label="步骤">
      <el-select
        v-model="dataForm.eightDisciplineStatus"
        filterable
        clearable
        placeholder="请选择步骤"
      >
        <el-option
          v-for="item in eightDisciplineStatusArr"
          :key="item.id"
          :label="item.name"
          :value="item.id"
        >
        </el-option>
      </el-select>
    </el-form-item>
    <el-form-item prop="occurrenceDate" label="发生时间">
      <el-date-picker
        v-model="dataForm.occurrenceDate"
        type="date"
        :style="{ width: '100%' }"
        format="yyyy-MM-dd"
        valueFormat="yyyy-MM-ddTHH:mm:ss"
        placeholder="选择日期"
      >
      </el-date-picker>
    </el-form-item>
  </el-form>
</template>

<script>
import basicAdd from "@/mixins/basic-add";

const eightDisciplineStatusArr = [
  {
    name: "D0",
    id: 0,
  },
  {
    name: "D1",
    id: 1,
  },
  {
    name: "D2",
    id: 2,
  },
  {
    name: "D3",
    id: 3,
  },
  {
    name: "D4",
    id: 4,
  },
  {
    name: "D5",
    id: 5,
  },
  {
    name: "D6",
    id: 6,
  },
  {
    name: "D7",
    id: 7,
  },
  {
    name: "D8",
    id: 8,
  },
];
export default {
  mixins: [basicAdd],
  data() {
    return {
      urlOptions: {
        optionArrUrl: ["/basic/qmsCustomer/page", "/basic/qmsProduct/page"],
      },
      visible: false,
      eightDisciplineStatusArr,
      dataForm: {
        title: "",
        eightDisciplineStatus: "",
        occurrenceDate: "",
        customId: "",
        productId: "",
      },
    };
  },
  computed: {
    dataRule() {
      return {
        // paramCode: [
        //   {
        //     required: true,
        //     message: this.$t("validate.required"),
        //     trigger: "blur",
        //   },
        // ],
      };
    },
  },
  methods: {
    init() {
      this.visible = true;
      this.$nextTick(() => {
        this.$refs["dataForm"].resetFields();
        this.getArr();
      });
    },
    dataFormSubmit() {
      this.$emit("refreshDataList", this.dataForm);
    },
  },
};
</script>
