Your Name
2022-05-10 30e36368e54581fcc0c581a004f1f68873c1e819
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<template>
        <el-dialog :title="title" :visible.sync="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="650px">
            <el-form   :model="dataForm" label-position="right" label-width="100px" style="margin-left:50px;width:600px;">
                <el-row  >
                    <el-col :span="20">
                        <el-form-item label="预约时间:" >
                            <el-date-picker
                                v-model="dataForm.appointment"
                                value-format="yyyy-MM-dd"
                                align="right"
                                type="date"
                                placeholder="选择日期"
                                :disabled="isView"
                                :picker-options="pickerOptions">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
 
                </el-row>
                <el-row  >
                    <el-col :span="10">
                        <el-form-item label="动火作业:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.fire" style="width: 100px" ></el-input-number>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="受限空间:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.space" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row  >
                    <el-col :span="10">
                        <el-form-item label="吊装作业:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.hoisting" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="动土作业:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.soild" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row  >
                    <el-col :span="10">
                        <el-form-item label="断路作业:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.breaks" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="高处作业:" >
                            <el-input-number :controls="false" :disabled="isView" :min="0" v-model="dataForm.high" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row  >
                    <el-col :span="10">
                        <el-form-item label="临时用电:" >
                            <el-input-number :controls="false"  :disabled="isView" :min="0" v-model="dataForm.electricity" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="盲板作业:" >
                            <el-input-number :controls="false"  :disabled="isView" :min="0" v-model="dataForm.blindboard" style="width: 100px"></el-input-number>
                        </el-form-item>
                    </el-col>
                </el-row>
 
            </el-form>
            <div  align="right" style="padding-right: 30px;margin-top: 10px;" v-if="!isView">
                <el-button @click="dialogVisible=false">取消</el-button>
                <el-button type="primary" @click="submit(title)" :disabled="isSending">确认</el-button>
            </div>
        </el-dialog>
</template>
 
<script>
import {reserveAdd,reserveMod} from '../../../../api/workPlan'
 
export default {
  name: 'index',
  data() {
    return {
      appointment: '',
      dialogVisible: false,
      isSending: false,
      title: '',
      isView: '',
      dataForm: {
        id: '',
        fire: '',
        space: '',
        hoisting: '',
        soild: '',
        breaks: '',
        high: '',
        electricity: '',
        blindboard: '',
        appointment: ''
 
      },
      pickerOptions: {
        shortcuts: [
          {
            text: '明天',
            onClick(picker) {
              const date = new Date()
              date.setTime(date.getTime() + 3600 * 1000 * 24)
              picker.$emit('pick', date)
            }
          },
          {
            text: '后天',
            onClick(picker) {
              const date = new Date()
              date.setTime(date.getTime() + 2 * 3600 * 1000 * 24)
              picker.$emit('pick', date)
            }
          },
          {
            text: '大后天',
            onClick(picker) {
              const date = new Date()
              date.setTime(date.getTime() + 3 * 3600 * 1000 * 24)
              picker.$emit('pick', date)
            }
          }
 
        ]
      }
 
    }
  },
  methods: {
    showAddDialog(title) {
      this.title = title
      this.isView = false
      this.dialogVisible = true
    },
    showViewDialog(row, title) {
      this.title = title
      this.isView = true
      this.dataForm.fire = row.fire
      this.dataForm.space = row.space
      this.dataForm.hoisting = row.hoisting
      this.dataForm.soild = row.soild
      this.dataForm.breaks = row.breaks
      this.dataForm.high = row.high
      this.dataForm.electricity = row.electricity
      this.dataForm.blindboard = row.blindboard
      this.dataForm.appointment = row.appointment
      this.dialogVisible = true
 
    },
    showUpdateDialog(row, title) {
      this.title = title
      this.isView = false
      this.dataForm.id = row.id
      this.dataForm.fire = row.fire
      this.dataForm.space = row.space
      this.dataForm.hoisting = row.hoisting
      this.dataForm.soild = row.soild
      this.dataForm.breaks = row.breaks
      this.dataForm.high = row.high
      this.dataForm.electricity = row.electricity
      this.dataForm.blindboard = row.blindboard
      this.dataForm.appointment = row.appointment
      this.dialogVisible = true
 
    },
    submit(title) {
      if ('新增' === title)
        this.post(reserveAdd)
      if ('编辑' === title)
        this.post(reserveMod)
    },
 
    post(func) {
      this.isSending = true
      func(this.dataForm)
        .then(res => {
          if (res.data.code === '200') {
            this.dialogVisible = false
            this.$emit('refresh')
            this.$message({
              message: '操作成功',
              type: 'success'
            })
          } else {
            this.$message({
              message: res.data.message,
              type: 'warning'
            })
          }
        })
        .finally(res => {
            this.isSending = false
          }
        )
    },
    reset() {
      this.dataForm = {
        id: '',
        fire: '',
        space: '',
        hoisting: '',
        soild: '',
        breaks: '',
        high: '',
        electricity: '',
        blindboard: '',
        appointment: ''
 
      }
    }
  }
}
</script>
<style scoped>
.basic_search{
    display:inline-block;
    padding-bottom: 10px;
}
</style>