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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<template>
<div class="eibs-tab">
<c-col :span="12" style="padding-right: 20px">
<c-col :span="24">
<el-form-item label="报文格式代码">
<c-select v-model="model.cod" placeholder="请输入报文格式代码" dbCode="APFCLA" :isShowKeyAndLabel="true" filterable :filterKey="['FAX','FMT','LET','SWT','TLX','CPY','ERX','ELC','GUA','TCO']"> </c-select>
</el-form-item>
</c-col>
</c-col>
<c-col :span="12" style="padding-left: 20px">
<c-col :span="24">
<el-form-item label="报文类型">
<c-select v-model="model.typ" placeholder="请输入报文类型" dbCode="APFTYP" :isShowKeyAndLabel="true" filterable> </c-select>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24">
<c-col :span="12" style="text-align: left">
<el-button type="primary" size="small" @click="apfAdd">新增</el-button>
</c-col>
<c-col :span="12" style="text-align: right">
<el-button size="small" @click="handleReset">重置</el-button>
<el-button type="primary" icon="el-icon-search" size="small" :loading="searchLoading" @click="onSearch()">查询
</el-button>
</c-col>
</c-col>
<c-col :span="24">
<c-paging-table :data="apfData" :columns="apfColumns" :pageNumber="model.pageNum" :pageSize="model.pageSize"
:total="model.total" v-on:queryFunc="queryFunc" :border="true">
<c-table-column fixed="right" prop="op" label="操作" width="180px">
<template slot-scope="{ scope }">
<c-button style="margin-left: 5px" size="small" type="primary" @click="apfEdit(scope.row)">修改</c-button>
<c-button size="small" style="margin-left: 5px" type="danger" @click="apfDelete(scope.row)">删除</c-button>
</template>
</c-table-column>
</c-paging-table>
<el-dialog :title="dialogNam[apftyp]" :visible.sync="dialogAdd" :modal-append-to-body="false"
:close-on-click-modal="false" center>
<el-form :model="form" ref="modelForm" label-suffix=":" :rules="rules">
<c-col :span="24">
<c-col :span="12" v-if="apftyp=='add'">
<c-col :span="16">
<el-form-item label="报文格式代码" :label-width="formLabelWidth" prop="codtxt">
<c-select v-model="form.codtxt" autocomplete="off" placeholder="请输入报文格式代码" dbCode="APFCLA" :isShowKeyAndLabel="true" filterable :filterKey="['FAX','FMT','LET','SWT','TLX','CPY','ERX','ELC','GUA','TCO']"
:disabled="apftyp=='edit'"></c-select>
</el-form-item>
</c-col>
<c-col :span="8">
<el-form-item label="" v-if="form.codtxt==''">
<c-input v-model="form.typtxt" autocomplete="off" placeholder="请输入报文格式代码" disabled=true></c-input>
</el-form-item>
</c-col>
<c-col :span="8">
<el-form-item label="" v-if="form.codtxt!=''" prop="typtxt">
<c-input v-model="form.typtxt" autocomplete="off" placeholder="请输入报文格式代码" @change="getCodDsc">
</c-input>
</el-form-item>
</c-col>
</c-col>
<c-col :span="12" v-if="apftyp=='edit'">
<el-form-item label="报文格式代码" :label-width="formLabelWidth" prop="cod">
<c-select v-model="form.cod" autocomplete="off" placeholder="请输入报文格式代码" dbCode="APFTYT" disabled=true>
</c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item label="纸张类型" :label-width="formLabelWidth" prop="tef">
<c-select v-model="form.tef" autocomplete="off" placeholder="请输入纸张类型" dbCode="TEFTYT"></c-select>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="格式描述" :label-width="formLabelWidth" prop="dsc">
<el-input v-model="form.dsc" autocomplete="off" placeholder="请输入格式描述"></el-input>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item label="可编辑标志" :label-width="formLabelWidth" prop="edtflg">
<el-radio v-model="form.edtflg" label="Y">是</el-radio>
<el-radio v-model="form.edtflg" label="X">否</el-radio>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="格式类型" :label-width="formLabelWidth" prop="typ">
<c-select v-model="form.typ" autocomplete="off" placeholder="请输入格式类型" dbCode="APFTYP"></c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item label="优先级" :label-width="formLabelWidth" prop="pri">
<c-input-number v-model="form.pri" autocomplete="off" placeholder="请输入优先级"></c-input-number>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="数量" :label-width="formLabelWidth" prop="cnt">
<c-input-number v-model="form.cnt" autocomplete="off" placeholder="请输入数量">
</c-input-number>
</el-form-item>
</c-col>
</c-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="commitAdd" v-if="apftyp=='add'">提 交</el-button>
<el-button type="primary" @click="commitEdit" v-if="apftyp=='edit'">提 交</el-button>
<el-button @click="dialogAdd = false">取 消</el-button>
</div>
</el-dialog>
</c-col>
</div>
</template>
<script>
import codes from "~/config/CodeTable";
import Utils from "~/utils";
import Apf, {
Pattern
} from "./Apf.js";
import {
queryByPage,
add,
edit,
deleteById,
checkPri,
checkTyp,
checkEditTyp,
checkEditPri,
queryById,
getDsc
} from "~/service/manage/apf.js";
import commonFunctions from "~/mixin/commonFunctions.js";
export default {
mixins: [commonFunctions],
name: "",
props: ["model"],
inject: ["root"],
data() {
return {
rules: Pattern,
apfData: [],
apfColumns: [{
label: "报文格式代码",
prop: "cod",
width: "auto"
},
{
label: "报文描述",
prop: "dsc",
width: "auto"
},
{
label: "报文类型",
prop: "typ",
width: "auto"
},
{
label: "数量",
prop: "cnt",
width: "auto"
},
{
label: "可编辑标志",
prop: "edtflg",
width: "auto"
},
{
label: "纸张类型",
prop: "tef",
width: "auto"
},
{
label: "优先级",
prop: "pri",
width: "auto"
},
],
dialogNam: {
'add': '报文格式信息新增',
'edit': '报文格式信息编辑',
},
dialogAdd: false,
form: new Apf().data,
apftyp: "",
formLabelWidth: "160px",
searchLoading: false,
};
},
computed: {},
activated() {
const {
update
} = this.$route.params;
if (update) {
this.onInfapfSearch();
}
},
watch: {
"form.codtxt": {
immediate: true,
handler(val, oldVal) {
if (this.form.codtxt == "") {
this.form.typtxt = "";
}
}
},
"form.typtxt": {
immediate: true,
handler(val, oldVal) {
if (this.form.typtxt == "") {
this.form.cod = "";
} else {
this.form.cod = this.form.codtxt + this.form.typtxt;
}
}
},
},
created() {
this.onInfapfSearch();
},
methods: {
handleReset() {
this.model.cod = "";
this.model.typ = "";
},
onSearch() {
this.model.pageSize = PageSize;
this.model.pageNum = 1;
this.onInfapfSearch();
},
getCodDsc() {
delete this.form.isModify;
delete this.form.modifySet;
getDsc(this.form).then((res) => {
if (res.respCode == SUCCESS) {
this.form.dsc = res.data;
}
});
},
onInfapfSearch() {
this.searchLoading = true;
delete this.model.isModify;
delete this.model.modifySet;
queryByPage(this.model).then((res) => {
if (res.respCode == SUCCESS) {
const list = res.data.list;
this.apfData = list;
this.model.pageNum = res.data.pageNumber;
this.model.pageSize = res.data.pageSize;
this.model.total = res.data.total;
this.searchLoading = false;
} else {
this.searchLoading = false;
this.$notify.error("查询失败");
}
});
},
queryFunc(pageNumber, pageSize) {
this.model.pageNum = pageNumber;
this.model.pageSize = pageSize;
this.onInfapfSearch();
},
commitAdd() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
delete this.form.isModify;
delete this.form.modifySet;
checkTyp(this.form).then((res) => {
if (res.respCode == SUCCESS && res.data) {
checkPri(this.form).then((res) => {
if (res.respCode == SUCCESS && res.data) {
add(this.form)
.then((res) => {
if (res.respCode == SUCCESS) {
this.$notify.success("新增成功!");
this.dialogAdd = false;
this.onInfapfSearch();
} else {
this.$notify.error("新增失败!");
}
})
.catch((err) => {
this.$notify.error("新增失败!");
});
} else {
this.$notify.error("报文类型代码和优先级组合重复已存在,请修改");
}
});
} else {
this.$notify.error("报文类型代码和格式类型组合重复已存在,请修改");
}
});
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
});
},
commitEdit() {
this.$refs.modelForm.validate((validated) => {
if (validated) {
delete this.form.isModify;
delete this.form.modifySet;
checkEditTyp(this.form).then((res) => {
if (res.respCode == SUCCESS && res.data) {
checkEditPri(this.form).then((res) => {
if (res.respCode == SUCCESS && res.data) {
edit(this.form)
.then((res) => {
if (res.respCode == SUCCESS) {
this.$notify.success("保存成功!");
this.dialogAdd = false;
this.onInfapfSearch();
} else {
this.$notify.error("保存失败!");
}
})
.catch((err) => {
this.$notify.error("保存失败!");
});
} else {
this.$notify.error("报文类型代码和优先级组合重复已存在,请修改");
}
});
} else {
this.$notify.error("报文类型代码和格式类型组合重复已存在,请修改");
}
});
} else {
Utils.formValidateTips(this.$refs.modelForm.fields)
}
});
},
apfAdd() {
this.dialogAdd = true;
this.form = new Apf().data;
this.apftyp = "add";
this.cod = "";
this.typ = "";
},
apfEdit(row) {
this.dialogAdd = true;
this.apftyp = "edit";
queryById(row).then((res) => {
if (res.respCode == SUCCESS) {
if (res.data.inr) {
this.form = res.data;
} else {
this.$notify.error("报文格式信息不存在")
}
}
});
},
apfDelete(row) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deleteById(row)
.then((res) => {
if (res.respCode == SUCCESS) {
this.$notify.success("删除成功!");
this.onInfapfSearch();
} else {
this.$notify.error("删除失败!");
}
})
.catch((err) => {
this.$notify.error("删除失败!");
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
},
};
</script>
<style scoped>
.table-button-item-list {
padding: 0;
margin: 0;
}
.table-button-item-list li {
list-style: none;
padding: 5px 0;
text-align: center;
color: #606266;
cursor: pointer;
}
</style>