<!--排版参数-->
<!--产品外观-->
<template>
  <div class="app-container">
    <!-- 添加或修改产品外观对话框 -->
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="模数" prop="modulus">
            <el-input v-model="form.modulus" type="number" :precision="2" placeholder="请输入模数" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="行数" prop="rowNum">
            <el-input v-model="form.rowNum" type="number" :precision="2" placeholder="请输入行数" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="列数" prop="columnNum">
            <el-input v-model="form.columnNum" type="number" :precision="2" placeholder="请输入列数" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="搭版数" prop="contactNum">
            <el-input v-model="form.contactNum" type="number" :precision="2" placeholder="请输入搭版数" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="行双刀位(mm)" prop="rowDoubleBlade">
            <el-input v-model="form.rowDoubleBlade" type="number" :precision="2" placeholder="请输入行双刀位(单位mm)" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="列双刀位(mm)" prop="columnDoubleBlade">
            <el-input v-model="form.columnDoubleBlade" type="number" :precision="2" placeholder="请输入列双刀位(单位mm)" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="派工倍数" prop="dispatchMultiple">
            <el-input v-model="form.dispatchMultiple" type="number" :precision="2" placeholder="请输入派工倍数" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="印张长度(cm)" prop="sheetLength">
            <el-input v-model="form.sheetLength" type="number" :precision="2" placeholder="请输入印张长度(单位cm)"/>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="印张宽度(cm)" prop="sheetWidth">
            <el-input v-model="form.sheetWidth" type="number" :precision="2" placeholder="请输入印张宽度(单位cm)" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import {getConf } from "@/api/mes/md/publishedConf";
export default {
  name: "Conf",
  dicts: ['sys_yes_no','product_shape'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        itemId: this.itemId
      },
      // 表单参数
      form: {
        modulus: '',
        rowNum: '',
        columnNum: '',
        contactNum: '',
        rowDoubleBlade: '',
        columnDoubleBlade: '',
        dispatchMultiple: '',
        sheetLength: '',
        sheetWidth: '',
        createBy: '',
        createTime: '',
        updateBy: '',
        updateTime: ''
      },
      // 表单校验
      rules: {
      }
    };
  },

  props: {
    optType: undefined,
    itemId: undefined
  },

  created() {
    this.getPublishedConf();
  },
  methods: {
    //获取产品参数配置表单数据
    async getPublishedConfData(){
      await this.submitForm()
      return this.form
    },

    //回显参数配置数据
    getPublishedConf(){
      getConf(this.itemId).then(res=>{
        Object.assign(this.form,res.data)
      })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        itemId: this.itemId,
        modulus: null,
        rowNum: null,
        columnNum: null,
        contactNum: null,
        rowDoubleBlade: null,
        columnDoubleBlade: null,
        dispatchMultiple: null,
        sheetLength: null,
        sheetWidth: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 提交按钮 */
    async submitForm() {
      return await this.$refs["form"].validate();
    },
  }
};
</script>
