1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<template>
  <a-modal :visible="visible" :width="800" title="拆分停机信息" @ok="handleSubmit" @cancel="handleCancel">
    <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:8}" :wrapperCol="{span:12}">
      <a-row>
        <a-col :span="10">
          <a-form-model-item prop="startTime" label="开始时间">
            <a-date-picker show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="model.startTime"/>
          </a-form-model-item>
        </a-col>
      </a-row>
 
      <div v-for="item in splitList" :key="item.title">
        <a-divider orientation="left">{{item.title}}</a-divider>
 
        <a-row>
          <a-col :span="10">
            <a-form-model-item prop="endTime" label="结束日期">
              <a-date-picker show-time value-format="YYYY-MM-DD HH:mm:ss" v-model="item.splitParams.endTime"/>
            </a-form-model-item>
          </a-col>
 
          <a-col :span="10">
            <a-form-model-item prop="closeReason" label="停机原因">
              <a-select v-model="item.splitParams.closeReason" placeholder="请选择停机原因">
                <a-select-option v-for="item in closeReasonList" :key="item.id">
                  {{item.label}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
 
          <a-col :span="4">
            <a-form-model-item label="选择">
              <a-checkbox @change="handleCheckboxChange(item,$event)"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </div>
    </a-form-model>
  </a-modal>
</template>
 
<script>
  export default {
    name: 'SplitShutdownInfoModal',
    data() {
      return {
        visible: false,
        model: {},
        validateRules: {
          startTime: [{ required: true, message: '请选择开始时间!', trigger: 'change' }]
        },
        closeReasonList: [
          {
            id: 1,
            label: '吃饭时间休息'
          },
          {
            id: 2,
            label: '工作时间休息'
          },
          {
            id: 3,
            label: '计划性停电'
          },
          {
            id: 4,
            label: '待料停机'
          },
          {
            id: 5,
            label: '首件调试'
          },
          {
            id: 6,
            label: '刀量具准备'
          }
        ],
        splitList: [
          {
            title: '拆分一段',
            splitParams: {}
          },
          {
            title: '拆分二段',
            splitParams: {}
          },
          {
            title: '拆分三段',
            splitParams: {}
          }
        ]
      }
    },
    methods: {
      handleCheckboxChange(record, event) {
        console.log('record', record)
        record.splitParams.checked = event.target.checked
      },
 
      handleSubmit() {
        this.$refs.form.validate(valid => {
          if (valid) {
 
          } else {
            return false
          }
        })
      },
 
      handleCancel() {
        this.$refs.form.clearValidate()
        this.visible = false
      }
    }
  }
</script>
 
<style scoped>
 
</style>