apply-clients 3.5.5-77 → 3.5.5-78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
v-model="device"
|
|
53
53
|
:options="logOptions"
|
|
54
54
|
:disable="mark === 1"
|
|
55
|
+
@change="changeDevice()"
|
|
55
56
|
:valueSingle="true"></input-select>
|
|
56
57
|
</div>
|
|
57
58
|
</div>
|
|
@@ -67,19 +68,43 @@
|
|
|
67
68
|
v-model="item.f_content"
|
|
68
69
|
:options="Options"
|
|
69
70
|
:disable="mark === 1"
|
|
71
|
+
@change="updateContentValue(item)"
|
|
70
72
|
:valueSingle="true"></input-select>
|
|
71
73
|
</div>
|
|
72
74
|
</div>
|
|
73
75
|
<div class="form-group col-sm-6">
|
|
74
76
|
<label class="col-sm-4 control-label">值:</label>
|
|
75
77
|
<div class="col-sm-8">
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
<!-- 根据type类型显示不同的控件 -->
|
|
79
|
+
<template v-if="getOptionType(item.f_content) === 'input'">
|
|
80
|
+
<input
|
|
81
|
+
class="form-control"
|
|
82
|
+
v-model="item.f_content_value"
|
|
83
|
+
:value.sync="item.f_content_value"
|
|
84
|
+
rows="3"
|
|
85
|
+
:readonly="mark === 1"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
88
|
+
<template v-if="getOptionType(item.f_content) === 'select'">
|
|
89
|
+
<v-select
|
|
90
|
+
width="100%"
|
|
91
|
+
class="select select_list"
|
|
92
|
+
:value.sync="item.f_content_value"
|
|
93
|
+
v-model="item.f_content_value"
|
|
94
|
+
:options='getOptionValues(item.f_content)'
|
|
95
|
+
:valueSingle="true"></v-select>
|
|
96
|
+
</template>
|
|
97
|
+
<template v-if="getOptionType(item.f_content) === 'datepicker'">
|
|
98
|
+
<datepicker
|
|
99
|
+
:value.sync="item.f_content_value"
|
|
100
|
+
:format="'yyyy-MM-dd HH:mm:ss'"
|
|
101
|
+
:default="true"
|
|
102
|
+
v-model="item.f_content_value"
|
|
103
|
+
:readonly="true"
|
|
104
|
+
:disabled="true"
|
|
105
|
+
:show-reset-button="reset">
|
|
106
|
+
</datepicker>
|
|
107
|
+
</template>
|
|
83
108
|
</div>
|
|
84
109
|
</div>
|
|
85
110
|
<div v-if="mark !== 1 && materials.length > 1" class="form-group col-sm-12 text-center">
|
|
@@ -111,6 +136,8 @@
|
|
|
111
136
|
import {HttpResetClass} from 'vue-client'
|
|
112
137
|
export default {
|
|
113
138
|
name: 'replacement',
|
|
139
|
+
components: {
|
|
140
|
+
},
|
|
114
141
|
props: {
|
|
115
142
|
selectdata: {
|
|
116
143
|
type: Object
|
|
@@ -126,7 +153,7 @@
|
|
|
126
153
|
rows: []
|
|
127
154
|
},
|
|
128
155
|
logOptions: this.$appdata.getParam('置换设备'),
|
|
129
|
-
Options:
|
|
156
|
+
Options:[],
|
|
130
157
|
device:'',
|
|
131
158
|
title: '新增',
|
|
132
159
|
deviceArry:[],
|
|
@@ -139,13 +166,78 @@
|
|
|
139
166
|
meterialOptions: [],
|
|
140
167
|
row: {},
|
|
141
168
|
bjqChecklag:[],
|
|
142
|
-
fmaterialname:{}
|
|
169
|
+
fmaterialname:{},
|
|
170
|
+
zhihuanConfig: null,
|
|
143
171
|
}
|
|
144
172
|
},
|
|
145
173
|
ready() {
|
|
174
|
+
this.getzhihuanOptions()
|
|
146
175
|
this.getOnetoManyData()
|
|
147
176
|
},
|
|
148
177
|
methods: {
|
|
178
|
+
async getzhihuanOptions () {
|
|
179
|
+
let datarow = {
|
|
180
|
+
workname: 'zhihuan'
|
|
181
|
+
}
|
|
182
|
+
let http = new HttpResetClass()
|
|
183
|
+
let row = await http.load(
|
|
184
|
+
'POST',
|
|
185
|
+
`${this.$androidUtil.getProxyUrl()}/rs/logic/ApplyGetConfigs`,
|
|
186
|
+
{data: datarow},
|
|
187
|
+
{resolveMsg: null, rejectMsg: '配置数据获取失败!!!'}
|
|
188
|
+
)
|
|
189
|
+
if (row && row.data && row.data['置换']) {
|
|
190
|
+
this.zhihuanConfig = row.data['置换']
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
changeDevice(){
|
|
194
|
+
// 更新内容选项
|
|
195
|
+
if(this.device=='调压箱' && this.zhihuanConfig && this.zhihuanConfig['调压箱']){
|
|
196
|
+
// 从API获取的配置中提取调压箱的选项
|
|
197
|
+
this.Options = this.zhihuanConfig['调压箱'].map(item => {
|
|
198
|
+
return {
|
|
199
|
+
label: item.label,
|
|
200
|
+
value: item.label,
|
|
201
|
+
type: item.type,
|
|
202
|
+
options: item.options,
|
|
203
|
+
default: item.default
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
else if(this.device=='球阀井' && this.zhihuanConfig && this.zhihuanConfig['球阀井']){
|
|
208
|
+
// 从API获取的配置中提取球阀井的选项
|
|
209
|
+
this.Options = this.zhihuanConfig['球阀井'].map(item => {
|
|
210
|
+
return {
|
|
211
|
+
label: item.label,
|
|
212
|
+
value: item.label,
|
|
213
|
+
type: item.type,
|
|
214
|
+
options: item.options,
|
|
215
|
+
default: item.default
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
}
|
|
219
|
+
else if(this.device=='阀门井'){
|
|
220
|
+
this.Options = this.$appdata.getParam('阀门井置换内容')
|
|
221
|
+
}
|
|
222
|
+
else{
|
|
223
|
+
this.Options = this.$appdata.getParam('置换内容')
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// 重置材料列表中的内容选项
|
|
227
|
+
if (this.materials && this.materials.length > 0) {
|
|
228
|
+
this.materials.forEach(item => {
|
|
229
|
+
item.f_content = '';
|
|
230
|
+
item.f_content_value = '';
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// 如果有选项,为第一个材料设置默认内容
|
|
234
|
+
if (this.Options && this.Options.length > 0 && this.materials[0]) {
|
|
235
|
+
this.materials[0].f_content = this.Options[0].value;
|
|
236
|
+
// 触发updateContentValue方法设置默认值
|
|
237
|
+
this.updateContentValue(this.materials[0]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
149
241
|
toArry(row){
|
|
150
242
|
//将row放进数组中
|
|
151
243
|
if (!row) return "无";
|
|
@@ -279,6 +371,12 @@
|
|
|
279
371
|
f_content_value: ''
|
|
280
372
|
}
|
|
281
373
|
];
|
|
374
|
+
// 如果有默认设备选项,则设置默认设备
|
|
375
|
+
if (this.logOptions && this.logOptions.length > 0) {
|
|
376
|
+
this.device = this.logOptions[0].value;
|
|
377
|
+
// 触发changeDevice方法加载对应的内容选项
|
|
378
|
+
this.changeDevice();
|
|
379
|
+
}
|
|
282
380
|
this.showMaterialModal = true
|
|
283
381
|
},
|
|
284
382
|
|
|
@@ -294,14 +392,87 @@
|
|
|
294
392
|
}
|
|
295
393
|
},
|
|
296
394
|
addMaterial() {
|
|
297
|
-
//
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
this.materials.push({
|
|
301
|
-
f_devices: lastDevice, // 复制上一个设备的值
|
|
395
|
+
// 使用当前选择的设备值
|
|
396
|
+
const newMaterial = {
|
|
397
|
+
f_devices: this.device || '', // 使用当前选择的设备作为默认值
|
|
302
398
|
f_content: '',
|
|
303
399
|
f_content_value: ''
|
|
304
|
-
}
|
|
400
|
+
};
|
|
401
|
+
this.materials.push(newMaterial);
|
|
402
|
+
},
|
|
403
|
+
// 日期格式化方法
|
|
404
|
+
customFormatter(date) {
|
|
405
|
+
// 格式化日期为 yyyy-MM-dd HH:mm:ss
|
|
406
|
+
const pad = (num) => num < 10 ? `0${num}` : num;
|
|
407
|
+
|
|
408
|
+
const year = date.getFullYear();
|
|
409
|
+
const month = pad(date.getMonth() + 1);
|
|
410
|
+
const day = pad(date.getDate());
|
|
411
|
+
const hours = pad(date.getHours());
|
|
412
|
+
const minutes = pad(date.getMinutes());
|
|
413
|
+
const seconds = pad(date.getSeconds());
|
|
414
|
+
|
|
415
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
// 获取选项的类型(input、select、datepicker等)
|
|
419
|
+
getOptionType(contentName) {
|
|
420
|
+
if (!this.zhihuanConfig || !this.device) return 'input';
|
|
421
|
+
|
|
422
|
+
// 确保zhihuanConfig中有该设备的配置
|
|
423
|
+
const deviceConfig = this.zhihuanConfig[this.device];
|
|
424
|
+
if (!deviceConfig) return 'input';
|
|
425
|
+
|
|
426
|
+
// 查找与contentName匹配的选项
|
|
427
|
+
const option = deviceConfig.find(item => item.label === contentName);
|
|
428
|
+
|
|
429
|
+
// 如果找到选项并且有type属性,则返回type,否则返回默认值'input'
|
|
430
|
+
return option ? option.type: 'input';
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
// 获取选项的可选值(用于select类型)
|
|
434
|
+
getOptionValues(contentName) {
|
|
435
|
+
if (!this.zhihuanConfig || !this.device) return [];
|
|
436
|
+
|
|
437
|
+
// 确保zhihuanConfig中有该设备的配置
|
|
438
|
+
const deviceConfig = this.zhihuanConfig[this.device];
|
|
439
|
+
if (!deviceConfig) return [];
|
|
440
|
+
|
|
441
|
+
// 查找与contentName匹配的选项
|
|
442
|
+
const option = deviceConfig.find(item => item.label === contentName);
|
|
443
|
+
|
|
444
|
+
// 如果找到选项并且有options属性,则返回options,否则返回空数组
|
|
445
|
+
return option && option.options ? option.options : [];
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
// 当用户选择内容时,根据配置设置默认值
|
|
449
|
+
updateContentValue(item) {
|
|
450
|
+
if (!this.zhihuanConfig || !this.device) return;
|
|
451
|
+
|
|
452
|
+
const deviceConfig = this.zhihuanConfig[this.device];
|
|
453
|
+
if (!deviceConfig) return;
|
|
454
|
+
|
|
455
|
+
const option = deviceConfig.find(opt => opt.label === item.f_content);
|
|
456
|
+
if (!option) return;
|
|
457
|
+
|
|
458
|
+
// 如果选项有默认值,则设置默认值
|
|
459
|
+
if (option.default) {
|
|
460
|
+
// 处理特殊的默认值
|
|
461
|
+
if (option.default === "this.$login.f.name") {
|
|
462
|
+
item.f_content_value = this.$login.f.name;
|
|
463
|
+
} else {
|
|
464
|
+
item.f_content_value = option.default;
|
|
465
|
+
}
|
|
466
|
+
} else if (option.type === 'select' && option.options && option.options.length > 0) {
|
|
467
|
+
// 如果是select类型,并且有选项,则设置第一个选项的值为默认值
|
|
468
|
+
item.f_content_value = option.options[0].value;
|
|
469
|
+
} else if (option.type === 'datepicker') {
|
|
470
|
+
// 如果是datepicker类型,则设置当前日期为默认值
|
|
471
|
+
item.f_content_value = new Date().Format('yyyy-MM-dd HH:mm:ss');
|
|
472
|
+
} else {
|
|
473
|
+
// 其他情况,清空值
|
|
474
|
+
item.f_content_value = '';
|
|
475
|
+
}
|
|
305
476
|
},
|
|
306
477
|
}
|
|
307
478
|
}
|