apply-clients 3.5.6-21 → 3.5.6-23
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/build/dev-server.js +5 -5
- package/package.json +1 -1
- package/src/components/android/Process/AppServiceControl.vue +1760 -1760
- package/src/components/product/Function/Service/FunctionServiceControl.vue +497 -497
- package/src/components/product/Install/ContractCharge.vue +210 -210
- package/src/filiale/dingcheng/android/AppInstallationDetails.vue +477 -477
- package/src/filiale/dingcheng/pc/InstallationDetails.vue +607 -607
- package/src/filiale/fugou/android/AppAddMaterialScience.vue +444 -444
- package/src/filiale/fugou/android/AppAddReplacement.vue +512 -512
- package/src/filiale/fugou/android/AppDevicesManagement.vue +516 -516
- package/src/filiale/fugou/android/AppInstallationDetails.vue +541 -541
- package/src/filiale/fugou/android/AppZhihuanManagement.vue +242 -242
- package/src/filiale/fugou/pc/AddReplacement.vue +511 -511
- package/src/filiale/fugou/pc/ApplyChargeList.vue +554 -554
- package/src/filiale/fugou/pc/Applybatchdispatch.vue +754 -754
- package/src/filiale/fugou/pc/InstallationDetails.vue +646 -646
- package/src/filiale/fugou/pc/ServiceControl.vue +1741 -1741
- package/src/filiale/fugou/pc/addMaterialScience.vue +481 -481
- package/src/filiale/fugou/pc.js +19 -19
- package/src/filiale/gongyi/pc/addressAndUserinfoManagement.vue +187 -187
- package/src/filiale/gongyi/pc/chargeManagement.vue +765 -765
- package/src/filiale/gongyi/pc.js +25 -25
- package/src/filiale/hongda/pc/addMaterialScience.vue +723 -723
- package/src/filiale/jinhuang/android/AppAddMaterialScience.vue +635 -635
- package/src/filiale/jinhuang/android/AppServiceControl.vue +1842 -1842
- package/src/filiale/jinhuang/android.js +7 -7
- package/src/filiale/jinhuang/pc/Applybatchdispatch.vue +770 -770
- package/src/filiale/jinhuang/pc/ContractList.vue +222 -222
- package/src/filiale/jinhuang/pc/ExplorationSelect.vue +511 -511
- package/src/filiale/jinhuang/pc/ServiceControl.vue +2016 -2016
- package/src/filiale/jinhuang/pc/SupervisoryList.vue +478 -478
- package/src/filiale/jinhuang/pc/addMaterialScience.vue +638 -638
- package/src/filiale/jinhuang/pc.js +13 -13
- package/src/filiale/qianneng/pc/Applybatchdispatch.vue +786 -786
- package/src/filiale/qianneng/pc/ServiceControl.vue +1387 -1387
- package/src/filiale/ruihua/pc/ServiceControl.vue +1973 -1973
- package/src/filiale/shexian/android/AppServiceControl.vue +1786 -1786
- package/src/filiale/shexian/android/AppSign.vue +152 -152
- package/src/filiale/yangchunboneng/android/AppChargeManagement.vue +527 -527
- package/src/filiale/yangchunboneng/android/AppContractCharge.vue +222 -222
- package/src/filiale/yangchunboneng/android/AppInstallationMaterial.vue +1144 -1144
- package/src/filiale/yangchunboneng/android/AppOtherChargeList.vue +281 -281
- package/src/filiale/yangchunboneng/android/AppServiceControl.vue +1883 -1883
- package/src/filiale/yangchunboneng/android/MaterIialOne.vue +179 -176
- package/src/filiale/yangchunboneng/android.js +22 -22
- package/src/filiale/yangchunboneng/pc/ApplyUpload.vue +392 -392
- package/src/filiale/yangchunboneng/pc/ExplorationSelect.vue +622 -622
- package/src/filiale/yangchunboneng/pc/InstallInfoSelect.vue +400 -400
- package/src/filiale/yangchunboneng/pc/ServiceControl.vue +2118 -2118
- package/src/filiale/yangchunboneng/pc/SupervisoryControl.vue +141 -141
- package/src/filiale/yangchunboneng/pc/SupervisoryList.vue +652 -644
- package/src/filiale/yangchunboneng/pc/buildOrderList.vue +421 -421
- package/src/filiale/yangchunboneng/pc/chargeManagement.vue +1060 -1060
- package/src/filiale/yangchunboneng/pc/printBuildOrder.vue +175 -175
- package/src/filiale/yangchunboneng/pc.js +29 -29
- package/src/main.js +3 -3
|
@@ -1,511 +1,511 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<data-grid :model="onetomany" class="list_area table_sy">
|
|
4
|
-
<template partial='head'>
|
|
5
|
-
<tr>
|
|
6
|
-
<th class="textNoLineBreak">记录人</th>
|
|
7
|
-
<th class="textNoLineBreak">添加日期</th>
|
|
8
|
-
<th class="textNoLineBreak">设备</th>
|
|
9
|
-
<th class="textNoLineBreak">内容</th>
|
|
10
|
-
<th class="textNoLineBreak" >
|
|
11
|
-
<button v-if="$parent.$parent.mark === 0" type="button" class="btn btn-primary" @click="$parent.$parent.openMaterialModal()">添加
|
|
12
|
-
</button>
|
|
13
|
-
</th>
|
|
14
|
-
</tr>
|
|
15
|
-
</template>
|
|
16
|
-
<template partial='body'>
|
|
17
|
-
<tr>
|
|
18
|
-
<td style="text-align: center;">
|
|
19
|
-
<nobr>{{row.f_operator}}</nobr>
|
|
20
|
-
</td>
|
|
21
|
-
<td style="text-align: center;">
|
|
22
|
-
<nobr>{{row.f_operation_date}}</nobr>
|
|
23
|
-
</td>
|
|
24
|
-
<td style="text-align: center;">
|
|
25
|
-
<nobr>{{row.f_content}}</nobr>
|
|
26
|
-
</td>
|
|
27
|
-
<td style="text-align: center;">
|
|
28
|
-
<nobr>
|
|
29
|
-
{{$parent.$parent.toArry(row.f_content_value)}}
|
|
30
|
-
</nobr>
|
|
31
|
-
</td>
|
|
32
|
-
<td style="text-align: center;">
|
|
33
|
-
<button v-if="$parent.$parent.mark === 0" type="button" class="button_delete button_spacing" @click="$parent.$parent.deletelogs(row)">删除
|
|
34
|
-
</button>
|
|
35
|
-
</td>
|
|
36
|
-
</tr>
|
|
37
|
-
</template>
|
|
38
|
-
</data-grid>
|
|
39
|
-
<modal v-if="showMaterialModal" :show.sync="showMaterialModal" v-ref:modal :large="true"
|
|
40
|
-
:backdrop="false" :title="title">
|
|
41
|
-
<header slot="modal-header" class="modal-header">
|
|
42
|
-
<button type="button" class="close" @click="closeMaterials"><span>×</span></button>
|
|
43
|
-
<h4 class="modal-title">{{title}}</h4>
|
|
44
|
-
</header>
|
|
45
|
-
<article slot="modal-body" class="modal-body clearfix">
|
|
46
|
-
<div class="form-group col-sm-6">
|
|
47
|
-
<label class="col-sm-4 control-label">设备:</label>
|
|
48
|
-
<div class="col-sm-8">
|
|
49
|
-
<input-select
|
|
50
|
-
class="select select_list"
|
|
51
|
-
:value.sync="device"
|
|
52
|
-
v-model="device"
|
|
53
|
-
:options="logOptions"
|
|
54
|
-
:disable="mark === 1"
|
|
55
|
-
@change="changeDevice()"
|
|
56
|
-
:valueSingle="true"></input-select>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
<div v-for="(i,item) in materials" class="form-group col-sm-12 panel panel-info">
|
|
60
|
-
<div class="panel-body">
|
|
61
|
-
<div class="row">
|
|
62
|
-
<div class="form-group col-sm-6">
|
|
63
|
-
<label class="col-sm-4 control-label">内容:</label>
|
|
64
|
-
<div class="col-sm-8">
|
|
65
|
-
<input-select
|
|
66
|
-
class="select select_list"
|
|
67
|
-
:value.sync="item.f_content"
|
|
68
|
-
v-model="item.f_content"
|
|
69
|
-
:options="Options"
|
|
70
|
-
:disable="mark === 1"
|
|
71
|
-
@change="updateContentValue(item)"
|
|
72
|
-
:valueSingle="true"></input-select>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
<div class="form-group col-sm-6">
|
|
76
|
-
<label class="col-sm-4 control-label">值:</label>
|
|
77
|
-
<div class="col-sm-8">
|
|
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>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<div v-if="mark !== 1 && materials.length > 1" class="form-group col-sm-12 text-center">
|
|
111
|
-
<button type="button" class="btn btn-danger" @click="removeMaterial(i)">
|
|
112
|
-
<i class="fa fa-minus"></i> 移除
|
|
113
|
-
</button>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
<div v-if="mark !== 1" class="form-group col-sm-12 text-center">
|
|
119
|
-
<button type="button" class="btn btn-success" @click="addMaterial()">
|
|
120
|
-
<i class="fa fa-plus"></i> 添加
|
|
121
|
-
</button>
|
|
122
|
-
</div>
|
|
123
|
-
</article>
|
|
124
|
-
<footer slot="modal-footer" class="modal-footer">
|
|
125
|
-
<template v-if="mark!== 1">
|
|
126
|
-
<button type="button" class="btn btn-primary" v-if="title==='新增'" @click="addlogs()"
|
|
127
|
-
:disabled="!$v.valid">确认
|
|
128
|
-
</button>
|
|
129
|
-
</template>
|
|
130
|
-
</footer>
|
|
131
|
-
</modal>
|
|
132
|
-
</div>
|
|
133
|
-
</template>
|
|
134
|
-
|
|
135
|
-
<script>
|
|
136
|
-
import {HttpResetClass} from 'vue-client'
|
|
137
|
-
export default {
|
|
138
|
-
name: 'replacement',
|
|
139
|
-
components: {
|
|
140
|
-
},
|
|
141
|
-
props: {
|
|
142
|
-
selectdata: {
|
|
143
|
-
type: Object
|
|
144
|
-
},
|
|
145
|
-
mark: {
|
|
146
|
-
type: Number,
|
|
147
|
-
default: 0
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
data() {
|
|
151
|
-
return {
|
|
152
|
-
onetomany: {
|
|
153
|
-
rows: []
|
|
154
|
-
},
|
|
155
|
-
logOptions: this.$appdata.getParam('置换设备'),
|
|
156
|
-
Options:[],
|
|
157
|
-
device:'',
|
|
158
|
-
title: '新增',
|
|
159
|
-
deviceArry:[],
|
|
160
|
-
showMaterialModal: false,
|
|
161
|
-
materials: [
|
|
162
|
-
{
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
meterialOptions: [],
|
|
167
|
-
row: {},
|
|
168
|
-
bjqChecklag:[],
|
|
169
|
-
fmaterialname:{},
|
|
170
|
-
zhihuanConfig: null,
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
ready() {
|
|
174
|
-
this.getzhihuanOptions()
|
|
175
|
-
this.getOnetoManyData()
|
|
176
|
-
},
|
|
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
|
-
`/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
|
-
},
|
|
241
|
-
toArry(row){
|
|
242
|
-
//将row放进数组中
|
|
243
|
-
if (!row) return "无";
|
|
244
|
-
try {
|
|
245
|
-
// 添加方括号使其成为有效的JSON数组
|
|
246
|
-
const jsonStr = '[' + row + ']';
|
|
247
|
-
// 尝试解析字符串为JSON数组
|
|
248
|
-
const jsonArray = JSON.parse(jsonStr);
|
|
249
|
-
// 将解析后的数据保存到deviceArry中
|
|
250
|
-
this.deviceArry = jsonArray;
|
|
251
|
-
|
|
252
|
-
// 格式化显示数据
|
|
253
|
-
let result = '';
|
|
254
|
-
for (let i = 0; i < this.deviceArry.length; i++) {
|
|
255
|
-
const item = this.deviceArry[i];
|
|
256
|
-
result += `${item.f_content}:${item.f_content_value}`;
|
|
257
|
-
if (i < this.deviceArry.length - 1) {
|
|
258
|
-
result += ',';
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return result;
|
|
262
|
-
} catch (err) {
|
|
263
|
-
console.error('解析JSON数据失败:', err);
|
|
264
|
-
return "无";
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
look(row){
|
|
268
|
-
this.title = '查看'
|
|
269
|
-
this.materials = [
|
|
270
|
-
{
|
|
271
|
-
id: row.id,
|
|
272
|
-
f_log_type:row.f_log_type,
|
|
273
|
-
f_log_content:row.f_log_content
|
|
274
|
-
}
|
|
275
|
-
],
|
|
276
|
-
this.showMaterialModal = true
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
changelogs(){
|
|
280
|
-
let http = new HttpResetClass()
|
|
281
|
-
let data = {
|
|
282
|
-
data: {
|
|
283
|
-
id: this.materials[0].id,
|
|
284
|
-
f_process_id:this.selectdata.f_process_id,
|
|
285
|
-
f_log_type:this.materials[0].f_log_type,
|
|
286
|
-
f_log_content:this.materials[0].f_log_content,
|
|
287
|
-
user:this.$login.f
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
http.load(
|
|
291
|
-
'POST',
|
|
292
|
-
`/rs/logic/addLogs`,
|
|
293
|
-
data,
|
|
294
|
-
{resolveMsg: '修改成功', rejectMsg: '添加失败'}
|
|
295
|
-
).then(res => {
|
|
296
|
-
this.closeMaterials()
|
|
297
|
-
})
|
|
298
|
-
},
|
|
299
|
-
addlogs(){
|
|
300
|
-
let value=[]
|
|
301
|
-
let http = new HttpResetClass()
|
|
302
|
-
this.materials.forEach(material => {
|
|
303
|
-
let obj={}
|
|
304
|
-
obj.f_content=material.f_content
|
|
305
|
-
obj.f_content_value=material.f_content_value
|
|
306
|
-
//obj转为字符串
|
|
307
|
-
obj = JSON.stringify(obj)
|
|
308
|
-
value.push(obj)
|
|
309
|
-
});
|
|
310
|
-
let s = {
|
|
311
|
-
f_process_id: this.selectdata.f_process_id,
|
|
312
|
-
f_operation_date: new Date().Format('yyyy-MM-dd HH:mm:ss'),
|
|
313
|
-
f_content_value:`${value}` ,
|
|
314
|
-
f_content: this.device,
|
|
315
|
-
f_operator: this.$login.f.name,
|
|
316
|
-
f_operator_id: this.$login.f.id
|
|
317
|
-
}
|
|
318
|
-
let data = {
|
|
319
|
-
tableName: 't_replacement',
|
|
320
|
-
model: s
|
|
321
|
-
}
|
|
322
|
-
http.load(
|
|
323
|
-
'POST',
|
|
324
|
-
`/rs/logic/entitySingleTable`,
|
|
325
|
-
data,
|
|
326
|
-
{resolveMsg: null, rejectMsg: '添加失败'}
|
|
327
|
-
).then(res => {
|
|
328
|
-
this.getOnetoManyData()
|
|
329
|
-
this.showMaterialModal=false
|
|
330
|
-
})
|
|
331
|
-
},
|
|
332
|
-
deletelogs(row){
|
|
333
|
-
let http = new HttpResetClass()
|
|
334
|
-
this.$showMessage('删除后不可恢复,确认删除吗?', ['confirm', 'cancel']).then((res) => {
|
|
335
|
-
if (res === 'confirm') {
|
|
336
|
-
let data = {
|
|
337
|
-
tableName:'t_replacement',
|
|
338
|
-
id:row.id
|
|
339
|
-
}
|
|
340
|
-
http.load(
|
|
341
|
-
'POST',
|
|
342
|
-
`/rs/logic/delentitySingleTable`,
|
|
343
|
-
data,
|
|
344
|
-
{resolveMsg: '删除成功', rejectMsg: '删除失败'}
|
|
345
|
-
).then(res => {
|
|
346
|
-
this.getOnetoManyData()
|
|
347
|
-
})
|
|
348
|
-
}
|
|
349
|
-
})
|
|
350
|
-
},
|
|
351
|
-
async getOnetoManyData () {
|
|
352
|
-
let http = new HttpResetClass()
|
|
353
|
-
let data = {
|
|
354
|
-
tablename: `t_replacement`,
|
|
355
|
-
condition: `f_process_id='${this.selectdata.f_process_id}'`
|
|
356
|
-
}
|
|
357
|
-
let res = await http.load(
|
|
358
|
-
'POST',
|
|
359
|
-
`/rs/sql/apply_singleTable?aaa=123`,
|
|
360
|
-
{data: data},
|
|
361
|
-
{resolveMsg: null, rejectMsg: 'onetomany查询失败'}
|
|
362
|
-
)
|
|
363
|
-
this.onetomany.rows = res.data
|
|
364
|
-
},
|
|
365
|
-
async openMaterialModal() {
|
|
366
|
-
this.title = '新增'
|
|
367
|
-
this.materials = [
|
|
368
|
-
{
|
|
369
|
-
f_devices: '',
|
|
370
|
-
f_content: '',
|
|
371
|
-
f_content_value: ''
|
|
372
|
-
}
|
|
373
|
-
];
|
|
374
|
-
// 如果有默认设备选项,则设置默认设备
|
|
375
|
-
if (this.logOptions && this.logOptions.length > 0) {
|
|
376
|
-
this.device = this.logOptions[0].value;
|
|
377
|
-
// 触发changeDevice方法加载对应的内容选项
|
|
378
|
-
this.changeDevice();
|
|
379
|
-
}
|
|
380
|
-
this.showMaterialModal = true
|
|
381
|
-
},
|
|
382
|
-
|
|
383
|
-
closeMaterials() {
|
|
384
|
-
this.getOnetoManyData()
|
|
385
|
-
this.showMaterialModal = false
|
|
386
|
-
},
|
|
387
|
-
removeMaterial(index) {
|
|
388
|
-
if (this.materials.length > 1) {
|
|
389
|
-
this.materials.splice(index, 1);
|
|
390
|
-
} else {
|
|
391
|
-
this.$showMessage('至少需要保留一组数据');
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
addMaterial() {
|
|
395
|
-
// 使用当前选择的设备值
|
|
396
|
-
const newMaterial = {
|
|
397
|
-
f_devices: this.device || '', // 使用当前选择的设备作为默认值
|
|
398
|
-
f_content: '',
|
|
399
|
-
f_content_value: ''
|
|
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
|
-
}
|
|
476
|
-
},
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
</script>
|
|
481
|
-
|
|
482
|
-
<style scoped>
|
|
483
|
-
.panel-info {
|
|
484
|
-
border: 1px solid #bce8f1;
|
|
485
|
-
margin-bottom: 15px;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.panel-heading {
|
|
489
|
-
background-color: #d9edf7;
|
|
490
|
-
border-bottom: 1px solid #bce8f1;
|
|
491
|
-
color: #31708f;
|
|
492
|
-
padding: 10px 15px;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.panel-body {
|
|
496
|
-
padding: 15px;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.form-group {
|
|
500
|
-
margin-bottom: 15px;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
.btn-success {
|
|
504
|
-
margin-top: 10px;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
.modal-body {
|
|
508
|
-
max-height: 500px;
|
|
509
|
-
overflow-y: auto;
|
|
510
|
-
}
|
|
511
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<data-grid :model="onetomany" class="list_area table_sy">
|
|
4
|
+
<template partial='head'>
|
|
5
|
+
<tr>
|
|
6
|
+
<th class="textNoLineBreak">记录人</th>
|
|
7
|
+
<th class="textNoLineBreak">添加日期</th>
|
|
8
|
+
<th class="textNoLineBreak">设备</th>
|
|
9
|
+
<th class="textNoLineBreak">内容</th>
|
|
10
|
+
<th class="textNoLineBreak" >
|
|
11
|
+
<button v-if="$parent.$parent.mark === 0" type="button" class="btn btn-primary" @click="$parent.$parent.openMaterialModal()">添加
|
|
12
|
+
</button>
|
|
13
|
+
</th>
|
|
14
|
+
</tr>
|
|
15
|
+
</template>
|
|
16
|
+
<template partial='body'>
|
|
17
|
+
<tr>
|
|
18
|
+
<td style="text-align: center;">
|
|
19
|
+
<nobr>{{row.f_operator}}</nobr>
|
|
20
|
+
</td>
|
|
21
|
+
<td style="text-align: center;">
|
|
22
|
+
<nobr>{{row.f_operation_date}}</nobr>
|
|
23
|
+
</td>
|
|
24
|
+
<td style="text-align: center;">
|
|
25
|
+
<nobr>{{row.f_content}}</nobr>
|
|
26
|
+
</td>
|
|
27
|
+
<td style="text-align: center;">
|
|
28
|
+
<nobr>
|
|
29
|
+
{{$parent.$parent.toArry(row.f_content_value)}}
|
|
30
|
+
</nobr>
|
|
31
|
+
</td>
|
|
32
|
+
<td style="text-align: center;">
|
|
33
|
+
<button v-if="$parent.$parent.mark === 0" type="button" class="button_delete button_spacing" @click="$parent.$parent.deletelogs(row)">删除
|
|
34
|
+
</button>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
37
|
+
</template>
|
|
38
|
+
</data-grid>
|
|
39
|
+
<modal v-if="showMaterialModal" :show.sync="showMaterialModal" v-ref:modal :large="true"
|
|
40
|
+
:backdrop="false" :title="title">
|
|
41
|
+
<header slot="modal-header" class="modal-header">
|
|
42
|
+
<button type="button" class="close" @click="closeMaterials"><span>×</span></button>
|
|
43
|
+
<h4 class="modal-title">{{title}}</h4>
|
|
44
|
+
</header>
|
|
45
|
+
<article slot="modal-body" class="modal-body clearfix">
|
|
46
|
+
<div class="form-group col-sm-6">
|
|
47
|
+
<label class="col-sm-4 control-label">设备:</label>
|
|
48
|
+
<div class="col-sm-8">
|
|
49
|
+
<input-select
|
|
50
|
+
class="select select_list"
|
|
51
|
+
:value.sync="device"
|
|
52
|
+
v-model="device"
|
|
53
|
+
:options="logOptions"
|
|
54
|
+
:disable="mark === 1"
|
|
55
|
+
@change="changeDevice()"
|
|
56
|
+
:valueSingle="true"></input-select>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<div v-for="(i,item) in materials" class="form-group col-sm-12 panel panel-info">
|
|
60
|
+
<div class="panel-body">
|
|
61
|
+
<div class="row">
|
|
62
|
+
<div class="form-group col-sm-6">
|
|
63
|
+
<label class="col-sm-4 control-label">内容:</label>
|
|
64
|
+
<div class="col-sm-8">
|
|
65
|
+
<input-select
|
|
66
|
+
class="select select_list"
|
|
67
|
+
:value.sync="item.f_content"
|
|
68
|
+
v-model="item.f_content"
|
|
69
|
+
:options="Options"
|
|
70
|
+
:disable="mark === 1"
|
|
71
|
+
@change="updateContentValue(item)"
|
|
72
|
+
:valueSingle="true"></input-select>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="form-group col-sm-6">
|
|
76
|
+
<label class="col-sm-4 control-label">值:</label>
|
|
77
|
+
<div class="col-sm-8">
|
|
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>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div v-if="mark !== 1 && materials.length > 1" class="form-group col-sm-12 text-center">
|
|
111
|
+
<button type="button" class="btn btn-danger" @click="removeMaterial(i)">
|
|
112
|
+
<i class="fa fa-minus"></i> 移除
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<div v-if="mark !== 1" class="form-group col-sm-12 text-center">
|
|
119
|
+
<button type="button" class="btn btn-success" @click="addMaterial()">
|
|
120
|
+
<i class="fa fa-plus"></i> 添加
|
|
121
|
+
</button>
|
|
122
|
+
</div>
|
|
123
|
+
</article>
|
|
124
|
+
<footer slot="modal-footer" class="modal-footer">
|
|
125
|
+
<template v-if="mark!== 1">
|
|
126
|
+
<button type="button" class="btn btn-primary" v-if="title==='新增'" @click="addlogs()"
|
|
127
|
+
:disabled="!$v.valid">确认
|
|
128
|
+
</button>
|
|
129
|
+
</template>
|
|
130
|
+
</footer>
|
|
131
|
+
</modal>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
134
|
+
|
|
135
|
+
<script>
|
|
136
|
+
import {HttpResetClass} from 'vue-client'
|
|
137
|
+
export default {
|
|
138
|
+
name: 'replacement',
|
|
139
|
+
components: {
|
|
140
|
+
},
|
|
141
|
+
props: {
|
|
142
|
+
selectdata: {
|
|
143
|
+
type: Object
|
|
144
|
+
},
|
|
145
|
+
mark: {
|
|
146
|
+
type: Number,
|
|
147
|
+
default: 0
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
data() {
|
|
151
|
+
return {
|
|
152
|
+
onetomany: {
|
|
153
|
+
rows: []
|
|
154
|
+
},
|
|
155
|
+
logOptions: this.$appdata.getParam('置换设备'),
|
|
156
|
+
Options:[],
|
|
157
|
+
device:'',
|
|
158
|
+
title: '新增',
|
|
159
|
+
deviceArry:[],
|
|
160
|
+
showMaterialModal: false,
|
|
161
|
+
materials: [
|
|
162
|
+
{
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
meterialOptions: [],
|
|
167
|
+
row: {},
|
|
168
|
+
bjqChecklag:[],
|
|
169
|
+
fmaterialname:{},
|
|
170
|
+
zhihuanConfig: null,
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
ready() {
|
|
174
|
+
this.getzhihuanOptions()
|
|
175
|
+
this.getOnetoManyData()
|
|
176
|
+
},
|
|
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
|
+
`/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
|
+
},
|
|
241
|
+
toArry(row){
|
|
242
|
+
//将row放进数组中
|
|
243
|
+
if (!row) return "无";
|
|
244
|
+
try {
|
|
245
|
+
// 添加方括号使其成为有效的JSON数组
|
|
246
|
+
const jsonStr = '[' + row + ']';
|
|
247
|
+
// 尝试解析字符串为JSON数组
|
|
248
|
+
const jsonArray = JSON.parse(jsonStr);
|
|
249
|
+
// 将解析后的数据保存到deviceArry中
|
|
250
|
+
this.deviceArry = jsonArray;
|
|
251
|
+
|
|
252
|
+
// 格式化显示数据
|
|
253
|
+
let result = '';
|
|
254
|
+
for (let i = 0; i < this.deviceArry.length; i++) {
|
|
255
|
+
const item = this.deviceArry[i];
|
|
256
|
+
result += `${item.f_content}:${item.f_content_value}`;
|
|
257
|
+
if (i < this.deviceArry.length - 1) {
|
|
258
|
+
result += ',';
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return result;
|
|
262
|
+
} catch (err) {
|
|
263
|
+
console.error('解析JSON数据失败:', err);
|
|
264
|
+
return "无";
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
look(row){
|
|
268
|
+
this.title = '查看'
|
|
269
|
+
this.materials = [
|
|
270
|
+
{
|
|
271
|
+
id: row.id,
|
|
272
|
+
f_log_type:row.f_log_type,
|
|
273
|
+
f_log_content:row.f_log_content
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
this.showMaterialModal = true
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
changelogs(){
|
|
280
|
+
let http = new HttpResetClass()
|
|
281
|
+
let data = {
|
|
282
|
+
data: {
|
|
283
|
+
id: this.materials[0].id,
|
|
284
|
+
f_process_id:this.selectdata.f_process_id,
|
|
285
|
+
f_log_type:this.materials[0].f_log_type,
|
|
286
|
+
f_log_content:this.materials[0].f_log_content,
|
|
287
|
+
user:this.$login.f
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
http.load(
|
|
291
|
+
'POST',
|
|
292
|
+
`/rs/logic/addLogs`,
|
|
293
|
+
data,
|
|
294
|
+
{resolveMsg: '修改成功', rejectMsg: '添加失败'}
|
|
295
|
+
).then(res => {
|
|
296
|
+
this.closeMaterials()
|
|
297
|
+
})
|
|
298
|
+
},
|
|
299
|
+
addlogs(){
|
|
300
|
+
let value=[]
|
|
301
|
+
let http = new HttpResetClass()
|
|
302
|
+
this.materials.forEach(material => {
|
|
303
|
+
let obj={}
|
|
304
|
+
obj.f_content=material.f_content
|
|
305
|
+
obj.f_content_value=material.f_content_value
|
|
306
|
+
//obj转为字符串
|
|
307
|
+
obj = JSON.stringify(obj)
|
|
308
|
+
value.push(obj)
|
|
309
|
+
});
|
|
310
|
+
let s = {
|
|
311
|
+
f_process_id: this.selectdata.f_process_id,
|
|
312
|
+
f_operation_date: new Date().Format('yyyy-MM-dd HH:mm:ss'),
|
|
313
|
+
f_content_value:`${value}` ,
|
|
314
|
+
f_content: this.device,
|
|
315
|
+
f_operator: this.$login.f.name,
|
|
316
|
+
f_operator_id: this.$login.f.id
|
|
317
|
+
}
|
|
318
|
+
let data = {
|
|
319
|
+
tableName: 't_replacement',
|
|
320
|
+
model: s
|
|
321
|
+
}
|
|
322
|
+
http.load(
|
|
323
|
+
'POST',
|
|
324
|
+
`/rs/logic/entitySingleTable`,
|
|
325
|
+
data,
|
|
326
|
+
{resolveMsg: null, rejectMsg: '添加失败'}
|
|
327
|
+
).then(res => {
|
|
328
|
+
this.getOnetoManyData()
|
|
329
|
+
this.showMaterialModal=false
|
|
330
|
+
})
|
|
331
|
+
},
|
|
332
|
+
deletelogs(row){
|
|
333
|
+
let http = new HttpResetClass()
|
|
334
|
+
this.$showMessage('删除后不可恢复,确认删除吗?', ['confirm', 'cancel']).then((res) => {
|
|
335
|
+
if (res === 'confirm') {
|
|
336
|
+
let data = {
|
|
337
|
+
tableName:'t_replacement',
|
|
338
|
+
id:row.id
|
|
339
|
+
}
|
|
340
|
+
http.load(
|
|
341
|
+
'POST',
|
|
342
|
+
`/rs/logic/delentitySingleTable`,
|
|
343
|
+
data,
|
|
344
|
+
{resolveMsg: '删除成功', rejectMsg: '删除失败'}
|
|
345
|
+
).then(res => {
|
|
346
|
+
this.getOnetoManyData()
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
})
|
|
350
|
+
},
|
|
351
|
+
async getOnetoManyData () {
|
|
352
|
+
let http = new HttpResetClass()
|
|
353
|
+
let data = {
|
|
354
|
+
tablename: `t_replacement`,
|
|
355
|
+
condition: `f_process_id='${this.selectdata.f_process_id}'`
|
|
356
|
+
}
|
|
357
|
+
let res = await http.load(
|
|
358
|
+
'POST',
|
|
359
|
+
`/rs/sql/apply_singleTable?aaa=123`,
|
|
360
|
+
{data: data},
|
|
361
|
+
{resolveMsg: null, rejectMsg: 'onetomany查询失败'}
|
|
362
|
+
)
|
|
363
|
+
this.onetomany.rows = res.data
|
|
364
|
+
},
|
|
365
|
+
async openMaterialModal() {
|
|
366
|
+
this.title = '新增'
|
|
367
|
+
this.materials = [
|
|
368
|
+
{
|
|
369
|
+
f_devices: '',
|
|
370
|
+
f_content: '',
|
|
371
|
+
f_content_value: ''
|
|
372
|
+
}
|
|
373
|
+
];
|
|
374
|
+
// 如果有默认设备选项,则设置默认设备
|
|
375
|
+
if (this.logOptions && this.logOptions.length > 0) {
|
|
376
|
+
this.device = this.logOptions[0].value;
|
|
377
|
+
// 触发changeDevice方法加载对应的内容选项
|
|
378
|
+
this.changeDevice();
|
|
379
|
+
}
|
|
380
|
+
this.showMaterialModal = true
|
|
381
|
+
},
|
|
382
|
+
|
|
383
|
+
closeMaterials() {
|
|
384
|
+
this.getOnetoManyData()
|
|
385
|
+
this.showMaterialModal = false
|
|
386
|
+
},
|
|
387
|
+
removeMaterial(index) {
|
|
388
|
+
if (this.materials.length > 1) {
|
|
389
|
+
this.materials.splice(index, 1);
|
|
390
|
+
} else {
|
|
391
|
+
this.$showMessage('至少需要保留一组数据');
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
addMaterial() {
|
|
395
|
+
// 使用当前选择的设备值
|
|
396
|
+
const newMaterial = {
|
|
397
|
+
f_devices: this.device || '', // 使用当前选择的设备作为默认值
|
|
398
|
+
f_content: '',
|
|
399
|
+
f_content_value: ''
|
|
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
|
+
}
|
|
476
|
+
},
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
</script>
|
|
481
|
+
|
|
482
|
+
<style scoped>
|
|
483
|
+
.panel-info {
|
|
484
|
+
border: 1px solid #bce8f1;
|
|
485
|
+
margin-bottom: 15px;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.panel-heading {
|
|
489
|
+
background-color: #d9edf7;
|
|
490
|
+
border-bottom: 1px solid #bce8f1;
|
|
491
|
+
color: #31708f;
|
|
492
|
+
padding: 10px 15px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.panel-body {
|
|
496
|
+
padding: 15px;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.form-group {
|
|
500
|
+
margin-bottom: 15px;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.btn-success {
|
|
504
|
+
margin-top: 10px;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.modal-body {
|
|
508
|
+
max-height: 500px;
|
|
509
|
+
overflow-y: auto;
|
|
510
|
+
}
|
|
511
|
+
</style>
|