CaractInfoForm.vue
12.8 KB
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="12">
<a-form-model-item label="前置地标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="frontLandmark">
<a-input-number v-model="model.frontLandmark" placeholder="请输入前置地标" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="当前地标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="landmark">
<a-input-number v-model="model.landmark" placeholder="请输入当前地标" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="后置地标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="behindLandmark">
<a-input-number v-model="model.behindLandmark" placeholder="请输入后置地标" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="距离" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="distance">
<a-input-number v-model="model.distance" placeholder="请输入距离" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="站点类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stationType">
<j-dict-select-tag
placeholder="请选择站点类型"
dictCode="station_type"
v-model="model.stationType"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="站点停车" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="waitPark">
<a-input-number v-model="model.waitPark" placeholder="请输入站点停车" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="停靠方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stopWay">
<j-dict-select-tag
placeholder="请选择停靠方式"
dictCode="stop_way"
v-model="model.stopWay"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="插销动作" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bolt">
<a-input-number v-model="model.bolt" placeholder="请输入插销动作" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="充电" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeFlag">
<a-input-number v-model="model.chargeFlag" placeholder="请输入充电" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="运行方向" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="direction">
<j-dict-select-tag
placeholder="请选择运行方向"
dictCode="direction"
v-model="model.direction"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="雷达区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="radar">
<a-input-number v-model="model.radar" placeholder="请输入雷达区" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="扬声器" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="speaker">
<a-input-number v-model="model.speaker" placeholder="请输入扬声器" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="警示灯" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lamp">
<a-input-number v-model="model.lamp" placeholder="请输入警示灯" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="黄色警示灯" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yellowLamp">
<a-input-number v-model="model.yellowLamp" placeholder="请输入黄色警示灯" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="速度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="speed">
<a-input-number v-model="model.speed" placeholder="请输入速度" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="充电时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="charge">
<a-input-number v-model="model.charge" placeholder="请输入充电时间" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="旋转" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom1">
<a-input-number v-model="model.custom1" placeholder="请输入自定义1" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="宽窄" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom2">
<a-input-number v-model="model.custom2" placeholder="请输入自定义2" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="皮带运转" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom3">
<a-input-number v-model="model.custom3" placeholder="请输入自定义3" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义4" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom4">
<a-input-number v-model="model.custom4" placeholder="请输入自定义4" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义5" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom5">
<a-input-number v-model="model.custom5" placeholder="请输入自定义5" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义6" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom6">
<a-input-number v-model="model.custom6" placeholder="请输入自定义6" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义7" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom7">
<a-input-number v-model="model.custom7" placeholder="请输入自定义7" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义8" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom8">
<a-input-number v-model="model.custom8" placeholder="请输入自定义8" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="自定义9" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custom9">
<a-input-number v-model="model.custom9" placeholder="请输入自定义9" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="岔道" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="loads">
<a-input-number v-model="model.loads" placeholder="请输入岔道" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="区域" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="region">
<a-input-number v-model="model.region" placeholder="请输入区域" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="对接标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jointSignal">
<a-input-number v-model="model.jointSignal" placeholder="请输入对接标识" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="举升高度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="liftHeight">
<a-input-number v-model="model.liftHeight" placeholder="请输入举升高度" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="X坐标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coordX">
<a-input-number v-model="model.coordX" placeholder="请输入X坐标" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="Y坐标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coordY">
<a-input-number v-model="model.coordY" placeholder="请输入Y坐标" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="W角度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="angleW">
<a-input-number v-model="model.angleW" placeholder="请输入W角度" style="width: 100%" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CaractInfoForm',
components: {
},
props: {
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
frontLandmark: [
{ required: true, message: '请输入前置地标!'},
],
landmark: [
{ required: true, message: '请输入当前地标!'},
],
behindLandmark: [
{ required: true, message: '请输入后置地标!'},
],
stationType: [
{ required: true, message: '请选择站点类型!'},
],
direction: [
{ required: true, message: '请输入运行方向!'},
],
region: [
{ required: true, message: '请输入区域!'},
],
coordX: [
{ required: true, message: '请输入X坐标!'},
],
coordY: [
{ required: true, message: '请输入Y坐标!'},
],
},
url: {
add: "/caract/info/add",
edit: "/caract/info/edit",
queryById: "/caract/info/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>