<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2022-12-16 09:28:44
 * @Description:
-->
<template>
  <el-dialog title="选择分析判读方案" :visible.sync="visible">
    <el-checkbox-group v-model="checkList">
      <el-checkbox
        style="width:100%;font-size:20px;margin:8px 5px"
        v-for="(item,index) in ruleArr"
        :key="item.number"
        :label="index"
        >{{ item.ruleKey.split("x")[0] }}
        <el-input
          v-show="item.ruleKey.split('x').length >= 2"
          v-model="item.arg1"
          style="width:60px"
        ></el-input>
        {{ item.ruleKey.split("x")[1] }}
        <el-input
          v-show="item.ruleKey.split('x').length >= 3"
          v-model="item.arg2"
          style="width:60px"
        ></el-input>
        {{ item.ruleKey.split("x")[2] }}
      </el-checkbox>
    </el-checkbox-group>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      checkList: [],
      ruleArr: [
        {
          number: 1,
          ruleKey: "规则一:有1点落在三倍标准差以外",
          arg1: null,
          arg2: null,
        },
        {
          number: 2,
          ruleKey: "规则二:连续x点落在管制中心线同一侧",
          arg1: 6,
          arg2: null,
        },
        {
          number: 3,
          ruleKey: "规则三:连续x点持续上升或下降",
          arg1: 6,
          arg2: null,
        },
        {
          number: 4,
          ruleKey: "规则四:连续x点交替上下跳动",
          arg1: 14,
          arg2: null,
        },
        {
          number: 5,
          ruleKey: "规则五:连续x点中有x点落在中心线同侧两倍标准差以外",
          arg1: 3,
          arg2: 2,
        },
        {
          number: 6,
          ruleKey: "规则六:连续x点中有x点落在中心线同侧一倍标准差以外",
          arg1: 5,
          arg2: 4,
        },
        {
          number: 7,
          ruleKey: "规则七:连续x点落在中心线两侧的一倍标准差以内",
          arg1: 15,
          arg2: null,
        },
        {
          number: 8,
          ruleKey: "规则八:连续x点落在中心线两侧但未在一倍标准差以内",
          arg1: 8,
          arg2: null,
        },
        {
          number: 9,
          ruleKey: "规则九:落在规格线以外",
          arg1: null,
          arg2: null,
        },
        {
          number: 10,
          ruleKey: "规则十:CPK小于目标值",
          arg1: null,
          arg2: null,
        },
      ],
    };
  },

  methods: {
    init() {
      this.visible = true;
    },
    dataFormSubmit(){
      let interpretationScheme = []
      this.checkList.forEach(item=>{
        interpretationScheme.push(this.ruleArr[item])
      })
      this.visible = false;
      this.$emit('setScheme',interpretationScheme)
    }
  },
};
</script>
