popUpFillIn.vue
14.5 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<template>
<view>
<u-popup :show="show" mode="bottom" @open="open" @close="close" :customStyle="{width:'100vw',borderRadius:'30rpx'}"
round="15" safeAreaInsetBottom closeable>
<u-form labelPosition="left" errorType="toast" :model="model" :rules="rules" ref="uForm">
<view class="popCss">
<view class="padding-lr">
<view class="padding-top text-lg text-left">
{{title}}
</view>
<!-- 点火维护 -->
<u-form-item v-if="type==='dhwh'" required label="是否已点火" labelWidth="100">
<view class="flex justify-between margin-tb w100">
<u-radio-group activeColor="#CF000D" placement="row" v-model="radiovalueDHWH" @change="DHchange">
<u-radio class="margin-right" name="是">是</u-radio>
<u-radio name="否">否</u-radio>
</u-radio-group>
</view>
</u-form-item>
<!-- 工程维护 -->
<u-form-item v-if="type==='gcwh'" required label="是否竣工" labelWidth="100">
<view class="flex justify-between margin-tb w100">
<u-radio-group activeColor="#CF000D" placement="row" v-model="radiovalueGCWH" @change="GCchange">
<u-radio class="margin-right" name="是">是</u-radio>
<u-radio name="否">否</u-radio>
</u-radio-group>
</view>
</u-form-item>
<!-- 运营维护 -->
<u-form-item v-if="type==='yywh'" required label="是否通气到表前" labelWidth="120">
<view class="flex justify-between margin-tb w100">
<u-radio-group activeColor="#CF000D" placement="row" v-model="radiovalueYYWH" @change="YYchange">
<u-radio class="margin-right" name="是">是</u-radio>
<u-radio name="否">否</u-radio>
</u-radio-group>
</view>
</u-form-item>
<view class="usuallyCard padding margin-bottom-sm">
<view class="margin-tb text-lg">
基本维护
</view>
<!-- 点火维护 -->
<u-form-item v-if="type==='dhwh'" required label="用户编号" labelWidth="100" borderBottom>
<u-input type="number" maxlength="10" v-model="model.userCode" placeholder="请输入" border="none"></u-input>
<!-- <u-icon slot="right" name="calendar" size="20" @click="datetimeShow = true"></u-icon> -->
</u-form-item>
<u-form-item v-if="type==='dhwh' && dhShow" required label="点火时间" labelWidth="100" borderBottom>
<u-input v-model="model.ignTime" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="calendar" size="20" @click="datetimeShow = true"></u-icon>
</u-form-item>
<u-form-item v-if="type==='dhwh' && !dhShow" required label="未点火原因" labelWidth="100" borderBottom>
<u-input v-model="model.nIgnRsn" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="arrow-down" size="20"
@click="handleIgnition('sys_mc_ignition_rsn')"></u-icon>
</u-form-item>
<!-- 工程维护 -->
<u-form-item v-if="type==='gcwh'" required label="市场派单时间" labelWidth="100" borderBottom>
<u-input v-model="model.assignmentTime" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="calendar" size="20" @click="multipleChange('assignmentTime')"></u-icon>
</u-form-item>
<u-form-item v-if="type==='gcwh' && gcShow" required label="竣工时间" labelWidth="100" borderBottom>
<u-input v-model="model.completionTime" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="calendar" size="20" @click="multipleChange('completionTime')"></u-icon>
</u-form-item>
<u-form-item v-if="type==='gcwh' && !gcShow" required label="未竣工原因" labelWidth="100" borderBottom>
<u-input v-model="model.nonNcmpRsn" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="arrow-down" size="20"
@click="handleIgnition('sys_mc_construction_kb_rsn')"></u-icon>
</u-form-item>
<!-- 运营维护 -->
<u-form-item v-if="type==='yywh'" required label="市场派单时间" labelWidth="100" borderBottom>
<u-input v-model="model.assignmentTime" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="calendar" size="20" @click="multipleChange('assignmentTime')"></u-icon>
</u-form-item>
<u-form-item v-if="type==='yywh' && yyShow" required label="通气到到表前时间" labelWidth="130" borderBottom>
<u-input v-model="model.gctMtrrisTime" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="calendar" size="20" @click="multipleChange('gctMtrrisTime')"></u-icon>
</u-form-item>
<u-form-item v-if="type==='yywh' && !yyShow" required label="未完成原因" labelWidth="100" borderBottom>
<u-input v-model="model.gctNcmpRsn" placeholder="请选择" disabled disabledColor="#fff"
border="none"></u-input>
<u-icon slot="right" name="arrow-down" size="20"
@click="handleIgnition('sys_mc_construction_yy_rsn')"></u-icon>
</u-form-item>
</view>
</view>
<view class="flex justify-between bg-white padding-tb-xs padding-lr">
<view class="w48" @click="close">
<u-button :customStyle="{color:'#CF000D'}">取消</u-button>
</view>
<view class="w48" @click="confirm">
<u-button color="#CF000D">确定</u-button>
</view>
</view>
</view>
</u-form>
</u-popup>
<u-picker :show="pickerShow" :columns="columns" keyName="label" @close="pickerShow = false" closeOnClickOverlay
@cancel="pickerShow = false" @confirm="pickerConfirm"></u-picker>
<!-- <u-calendar :show="calendarShow" @close="closeCalender" @confirm="confirmCalender"></u-calendar> -->
<u-datetime-picker :show="datetimeShow" v-model="dataTimeValue" closeOnClickOverlay @confirm="dateConfirm"
@cancel="datetimeShow = false" @close="datetimeShow = false" mode="date"></u-datetime-picker>
</view>
</template>
<script>
import {
mcIgnitionMaintenance,
mcConstructionEngineering,
mcConstructionOperation
} from "@/api/charge.js"
export default {
name: "popUpComponent",
props: {
title: {
type: String,
default: ""
},
type: {
type: String,
default: ""
},
itemData: {
type: Object
},
},
data() {
return {
show: false,
calendarShow: false,
datetimeShow: false,
dataTimeValue: Number(new Date()),
radiovalueDHWH: "",
radiovalueGCWH: "",
radiovalueYYWH: "",
model: {
// ignTime: "",
// nIgnRsn: ""
},
rules: {},
pickerShow: false,
columns: [],
dhShow: true,
gcShow: true,
yyShow: true,
currentName: "",
};
},
methods: {
open() {
if (this.itemData.assignmentTime) {
this.model.assignmentTime = this.itemData.assignmentTime.slice(0, -9);
}
if (this.itemData.userCode) {
this.model.userCode = this.itemData.userCode;
}
this.model = {...this.model};
this.show = true;
},
close() {
console.log("close")
this.show = false;
this.model = {};
this.radiovalueDHWH = "";
this.radiovalueGCWH = "";
this.radiovalueYYWH = "";
},
handleIgnition(dict) {
let dictArr = this.getDictDatas(dict);
this.columns = [dictArr];
console.log("未点火原因", this.columns);
this.pickerShow = true;
},
async confirm() {
console.log(this.radiovalueDHWH);
if (this.type === 'dhwh') {
if (!this.radiovalueDHWH) {
uni.$u.toast('请选择是否点火');
return
}
if (!this.model.ignTime && this.radiovalueDHWH === '是') {
uni.$u.toast('请选择点火时间');
return
}
if (!this.model.nIgnRsn && this.radiovalueDHWH === '否') {
uni.$u.toast('请选择未点火原因');
return
}
this.submitDh()
}
if (this.type === 'gcwh') {
if (!this.radiovalueGCWH) {
uni.$u.toast('请选择是否竣工');
return
}
if (!this.model.assignmentTime && this.radiovalueGCWH === '是') {
uni.$u.toast('选择市场派单时间');
return
}
if (!this.model.completionTime && this.radiovalueGCWH === '是') {
uni.$u.toast('请选择市场竣工时间');
return
}
if (!this.model.nonNcmpRsn && this.radiovalueGCWH === '否') {
uni.$u.toast('请选择竣工原因');
return
}
this.submitGc()
}
if (this.type === 'yywh') {
if (!this.radiovalueYYWH) {
uni.$u.toast('请选择是否通气到列表前');
return
}
if (!this.model.assignmentTime && this.radiovalueYYWH === '是') {
uni.$u.toast('选择市场派单时间');
return
}
if (this.model.gctMtrrisTime === 'W' && this.radiovalueYYWH === '是') {
uni.$u.toast('请选择通气到表前时间');
return
}
if (!this.model.gctNcmpRsn && this.radiovalueYYWH === '否') {
uni.$u.toast('请选择未完成原因');
return
}
this.submitYy()
}
this.show = false;
},
async submitDh() {
let data = {
id: this.itemData.id,
ignCnfStatusCode: this.radiovalueDHWH === '是' ? 'Y' : 'N',
nIgnRsn: this.model.nIgnRsn,
userCode: this.model.userCode,
ignTime: this.radiovalueDHWH === '是' ? this.model.ignTime + ' 00:00:00' : ''
}
console.log(this.radiovalueGCWH);
console.log("点火数据", data);
const result = await mcIgnitionMaintenance(data);
if (result.code === 200) {
uni.$u.toast('提交成功');
this.$emit('getList');
this.model = {}
} else {
uni.$u.toast(result.msg)
}
},
async submitGc() {
let data = {
id: this.itemData.id,
isCompleted: this.radiovalueGCWH === '是' ? 'Y' : 'N',
assignmentTime: this.radiovalueGCWH === '是' ? this.model.assignmentTime + ' 00:00:00' : "",
completionTime: this.radiovalueGCWH === '是' ? this.model.completionTime + ' 00:00:00' : "",
nonNcmpRsn: this.model.nonNcmpRsn
}
console.log(this.radiovalueGCWH);
console.log("工程数据", data);
const result = await mcConstructionEngineering(data);
if (result.code === 200) {
uni.$u.toast('提交成功');
this.$emit('getList');
this.model = {}
} else {
uni.$u.toast(result.msg)
}
},
async submitYy() {
let data = {
id: this.itemData.id,
gasConnMtrRis: this.radiovalueYYWH === '是' ? 'Y' : 'N',
assignmentTime: this.radiovalueYYWH === '是' ? this.model.assignmentTime + ' 00:00:00' : "",
gctMtrrisTime: this.radiovalueYYWH === '是' ? this.model.gctMtrrisTime + ' 00:00:00' : "",
gctNcmpRsn: this.model.gctNcmpRsn
}
console.log("运营数据", data);
const result = await mcConstructionOperation(data);
if (result.code === 200) {
uni.$u.toast('提交成功');
this.$emit('getList');
this.model = {}
} else {
uni.$u.toast(result.msg)
}
},
DHchange(e) {
console.log(e);
if (e === '是') {
this.dhShow = true
} else {
this.dhShow = false;
// this.model = {}
}
},
GCchange(e) {
if (e === '是') {
this.gcShow = true;
this.model.nonNcmpRsn = "";
} else {
this.gcShow = false;
// this.model = {}
this.model.completionTime = "";
}
},
YYchange(e) {
if (e === '是') {
this.yyShow = true
} else {
this.yyShow = false;
// this.model = {}
}
},
multipleChange(name) {
this.currentName = name;
this.datetimeShow = true;
},
pickerConfirm(e) {
console.log(e);
let data = e.value[0].value;
if (this.type === 'dhwh') {
this.model.nIgnRsn = data;
}
if (this.type === 'gcwh') {
this.model.nonNcmpRsn = data;
}
if (this.type === 'yywh') {
this.model.gctNcmpRsn = data;
}
this.pickerShow = false;
},
confirmCalender(e) {
console.log(e);
this.model.ignTime = e[0];
this.calendarShow = false;
},
dateConfirm(e) {
let time = this.$u.timeFormat(e.value, 'yyyy-mm-dd');
if (this.type === 'dhwh') {
this.model.ignTime = time;
}
if (this.type === 'gcwh') {
this.model[this.currentName] = time;
// this.model.nonNcmpRsn = data;
}
if (this.type === 'yywh') {
this.model[this.currentName] = time;
// this.model.gctNcmpRsn = data;
}
this.datetimeShow = false;
},
closeCalender() {
this.calendarShow = false;
},
}
}
</script>
<style lang="scss">
.popCss {
background: #F6F6F6;
border-radius: 30rpx;
// text-align: center;
}
.usuallyCard {
border-radius: 15rpx;
}
/deep/.u-form-item__body {
padding: 10px;
}
</style>