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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
<template>
<div class="eibs-tab">
<c-col :span="24">
<c-col :span="6">
<el-form-item label-width="0px" style="margin-left:9px">
<c-button @click="excelUpload" size="small" type="primary">Excel导入</c-button>
<c-button @click="addRow" size="small" type="primary" style="margin-left:15px">
人工新增
</c-button>
<c-button @click="deleteRows" size="small" type="primary" style="margin-left:15px">
删除
</c-button>
</el-form-item>
</c-col>
<c-col :span="18">
<el-form-item prop="imgInvmod.checkTrue" label-width="0px" style="text-align:right">
<c-button @click="checkList" type="primary">
发票真伪核验
</c-button>
<c-button @click="checkRepeat" type="primary" style="margin-left:15px">
人行重复性核验
</c-button>
<c-button @click="updateStatus" size="small" type="primary" style="margin-left:15px">
更新状态
</c-button>
<c-button @click="addReg()" :disabled="model.imgInvmod.invlst.length == 0" type="primary" size="small" style="margin-left:15px">
<span style="position: relative">发票登记</span>
</c-button>
<c-button @click="exportExcel()" type="primary" size="small" style="margin-left:15px">导出Excel</c-button>
</el-form-item>
</c-col>
<!-- <c-col :span="2">
<el-form-item label-width="0px" style="margin-left:10px">
</el-form-item>
</c-col> -->
</c-col>
<c-col :span="24">
<el-form ref="invTable" :model="model" label-width="120px" label-position="right" size="small" :validate-on-rule-change="false">
<el-table max-height="300px" style="text-align: center;" @selection-change="changeSelection1" stripe :data="model.imgInvmod.pageTable.tableData" :row-class-name="tableRowClassName" @row-click="handleRowClick" :paginationShow="false" :border="true">
<el-table-column type="selection" align="left" min-width="50">
</el-table-column>
<el-table-column label="序号" width="80px">
<template slot-scope="scope">
<span>{{scope.$index + 1 + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)}}</span>
</template>
</el-table-column>
<el-table-column label="发票类型" sortable min-width="110px" prop="invtyp">
<template slot-scope="scope">
<!-- <el-form-item :prop="'imgInvmod.invlst.' + (scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)) + '.invtyp'" label-width="0" :rules="[{validator:(rule,value,callback) => validaInvtyp(rule,value,callback,scope.row),trigger:['blur','change']}]">
<c-select v-model="scope.row.invtyp" dbCode="typinv" :disabled="scope.row.state == '0'"></c-select>
</el-form-item> -->
<c-select v-model="scope.row.invtyp" dbCode="typinv" :disabled="scope.row.state == '0'"></c-select>
</template>
</el-table-column>
<el-table-column label="发票代码" sortable min-width="110px" prop="invcod">
<template slot-scope="scope">
<el-form-item :prop="'imgInvmod.invlst.' + (scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)) + '.invcod'" label-width="0" :rules="[{validator:(rule,value,callback) => validaInvcod(rule,value,callback,scope.row),trigger:['blur','change']}]">
<c-input v-model="scope.row.invcod" :disabled="scope.row.state == '0'">
</c-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="发票号码" sortable min-width="110px" prop="invnum">
<template slot-scope="scope">
<el-form-item :prop="'imgInvmod.invlst.' + (scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)) + '.invnum'" label-width="0" :rules="[{validator:(rule,value,callback) => validaInvnum(rule,value,callback,scope.row),trigger:['blur','change']}]">
<c-input v-model="scope.row.invnum" @input="inputInvnum((scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)))" :disabled="scope.row.state == '0'">
</c-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="开票日期" sortable min-width="110px" prop="invdat">
<template slot-scope="scope">
<c-date-picker v-model="scope.row.invdat" @change="changeInvdat((scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)))" :disabled="scope.row.state == '0'">
</c-date-picker>
</template>
</el-table-column>
<el-table-column label="校验码后六位" sortable min-width="130px" prop="checkcode">
<template slot-scope="scope">
<c-input v-model="scope.row.checkcode" :disabled="scope.row.state == '0'">
</c-input>
</template>
</el-table-column>
<el-table-column label="未税金额" sortable min-width="110px" prop="untamt">
<template slot-scope="scope">
<c-input-currency :precision="2" v-model="scope.row.untamt" @input="inputUntamt((scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)))" :disabled="scope.row.state == '0'">
</c-input-currency>
</template>
</el-table-column>
<el-table-column label="价税合计" sortable min-width="110px" prop="amounttax">
<template slot-scope="scope">
<c-input-currency :precision="2" v-model="scope.row.amounttax" @input="inputAmounttax((scope.$index + ((model.imgInvmod.pageTable.currentPage - 1) * model.imgInvmod.pageTable.pageSize)))" :disabled="scope.row.state == '0'">
</c-input-currency>
</template>
</el-table-column>
<!-- <el-table-column label="发票占用金额" sortable min-width="130px" prop="amountin">
<template slot-scope="scope">
<el-form-item :prop="'imgInvmod.invlst.' + (scope.$index + ((currentPage - 1) * 10)) + '.amountin'" label-width="0" :rules="[{validator:(rule,value,callback) => validaAmountin(rule,value,callback,scope.row),trigger:['blur','change']}]">
<c-input-currency :precision="2" v-model="scope.row.amountin" @input="inputAmountin((scope.$index + ((currentPage - 1) * 10)))">
</c-input-currency>
</el-form-item>
</template>
</el-table-column> -->
<el-table-column label="发票状态" sortable min-width="110px" prop="state">
<template slot-scope="scope">
{{getLabel(dbCodes.state,scope.row.state)}}
</template>
</el-table-column>
<el-table-column label="失败原因" sortable min-width="120px" prop="reason"></el-table-column>
<el-table-column label="有无发票信息" sortable min-width="160px" prop="isfnc">
<template slot-scope="scope">
{{getLabel(dbCodes.isfnc,scope.row.isfnc)}}
</template>
</el-table-column>
<el-table-column label="批注方编号" sortable min-width="120px" prop="annotacode"></el-table-column>
<el-table-column label="批注方名称" sortable min-width="120px" prop="annotaname"></el-table-column>
<el-table-column label="批注日期" sortable min-width="110px" prop="annotadate"></el-table-column>
<el-table-column label="批注描述" sortable min-width="110px" prop="annotadesc"></el-table-column>
<el-table-column label="发票批次号" sortable min-width="120px" prop="seqnum"></el-table-column>
<el-table-column label="影像ID" sortable min-width="100px" prop="imagid"></el-table-column>
<el-table-column label="有效标识" sortable min-width="110px" prop="valflg">
<template slot-scope="scope">
<c-select v-model="scope.row.valflg" dbCode="vldflg" :disabled="scope.row.state == '0'"></c-select>
</template>
</el-table-column>
<el-table-column label="销售方单位名称" sortable min-width="150px" prop="salesname"></el-table-column>
<el-table-column label="购买方名称" sortable min-width="120px" prop="purchasername"></el-table-column>
<el-table-column label="我行登记状态" sortable min-width="130px" prop="regsta">
<template slot-scope="scope">
{{getLabel(regsta,scope.row.regsta)}}
</template>
</el-table-column>
<el-table-column label="发票剩余金额" sortable min-width="150px" prop="balance"></el-table-column>
<el-table-column label="检核次数" sortable min-width="150px" prop="checktotal"></el-table-column>
<el-table-column label="本机构检核次数" sortable min-width="150px" prop="checkown"></el-table-column>
<el-table-column label="其他机构检核次数" sortable min-width="170px" prop="checkother"></el-table-column>
</el-table>
<el-pagination
:current-page="model.imgInvmod.pageTable.currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="model.imgInvmod.pageTable.pageSize"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
:total="model.imgInvmod.pageTable.total">
</el-pagination>
</el-form>
</c-col>
<c-col :span="24">
<el-form ref="refDj" :model="model" label-width="120px" label-position="right" size="small" :validate-on-rule-change="false">
<c-col :span="12" class="col-left">
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="业务类型" prop="imgInvmod.invp.bustyp" :rules="[{required: true, message: '必输项',trigger: ['blur', 'change']}]">
<c-select v-model="model.imgInvmod.invp.bustyp" dbCode='typbus' placeholder="请选择业务类型" />
</el-form-item>
</c-col>
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="批注编号" prop="imgInvmod.invp.antnum" :rules="[{required: true, message: '必输项',trigger: ['blur', 'change']},{ max: 40, message: '长度不能超过40',trigger: ['blur', 'change']}]">
<c-input v-model="model.imgInvmod.invp.antnum" placeholder="请输入批注编号"></c-input>
</el-form-item>
</c-col>
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="批注日期" prop="imgInvmod.invp.antdat" :rules="[{required: true, message: '必输项',trigger: ['blur', 'change']}]">
<c-date-picker type="date" v-model="model.imgInvmod.invp.antdat" style="width: 100%" placeholder="请选择批注日期" value-format="yyyy-MM-dd"></c-date-picker>
</el-form-item>
</c-col>
</c-col>
<c-col :span="12" class="col-right">
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="系统外其他业务描述" prop="imgInvmod.invp.busdcr" :rules="[{ max: 50, message: '长度不能超过50',trigger: ['blur', 'change']}]">
<c-input v-model="model.imgInvmod.invp.busdcr" placeholder="请选择系统外其他业务描述"></c-input>
</el-form-item>
</c-col>
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="批注方名称" prop="imgInvmod.invp.antnam" :rules="[{required: true, message: '必输项',trigger: ['blur', 'change']},{ max: 100, message: '长度不能超过100',trigger: ['blur', 'change']}]">
<c-input v-model="model.imgInvmod.invp.antnam" placeholder="请输入批注方名称"></c-input>
</el-form-item>
</c-col>
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item label="批注描述" prop="imgInvmod.invp.antdtl" :rules="[{required: true, message: '必输项',trigger: ['blur', 'change']},{ max: 50, message: '长度不能超过50',trigger: ['blur', 'change']}]">
<c-input v-model="model.imgInvmod.invp.antdtl" placeholder="请输入批注描述"></c-input>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24" v-if="model.imgInvmod.addRegFlg">
<el-form-item style="text-align:center">
<c-button @click="sendMsg()" type="primary" size="small">发送登记报文</c-button>
</el-form-item>
</c-col>
</el-form>
</c-col>
<el-dialog v-dialogDrag width="30%" title="Excel导入" :before-close="closeDialog" :visible.sync="detailsDialog" v-if="detailsDialog">
<c-col :span="4">
<el-form-item label-width="0px">
<!-- <el-upload action="#" :before-upload="beforeUpload" :show-file-list="false" accept=".xlsx, .xls, .csv">
<c-button slot="trigger" size="small" type="primary">选择文件</c-button>
</el-upload> -->
<el-upload action="/webapi/manager/invchk/upload" :limit="1" accept=".xlsx, .xls, .csv" :on-exceed="handleExceed"
:auto-upload="true" :on-success="uploadSucess" ref="uploadff">
<!--上传按钮-->
<el-button slot="trigger" size="mini" type="primary">选取文件</el-button>
</el-upload>
</el-form-item>
</c-col>
<c-col :span="4">
<el-form-item label-width="0px" style="margin-left:10px">
<c-button @click="downFiles()" type="primary" size="small">下载模板</c-button>
</el-form-item>
</c-col>
</el-dialog>
</div>
</template>
<script>
import event from "../event";
import moment from "moment";
export default {
props: ["model", "codes"],
mixins: [event],
data() {
return {
currentZcinvlstIndex: -1,
detailsDialog: false,
filesList: [],
errorMessage: "",
isError: false,
searchNum: "",
fileName: "",
requirea: false,
details: {},
tableData:[],
currentPage:1,
pageSize:10,
total:0,
dbCodes: {
state: [],
isfnc: [],
invtyp: [],
bustyp: []
},
isCheckRe: true,
selection1: [],
addRegFlg: false,
regsta:[
{ 'label': '登记成功', 'value': 'DJCG' },
{ 'label': '作废成功', 'value': 'YDEL' },
{ 'label': '处理中', 'value': 'YREG' },
{ 'label': '处理失败', 'value': 'YRFL' }
],
};
},
computed: {
isDengJi() {
let flg = this.model.imgInvmod.invlst.some(item => {
return item.isfnc == "Y" || item.isfnc == "N";
});
let flg1 = this.model.imgInvmod.invlst.some(i => {
return i.invtyp == "ECOM" || i.invtyp == "ESPE";
});
if (flg && flg1) {
return true;
} else {
return false;
}
}
},
methods: {
// 文件个数超出
handleExceed() {
this.$notify.error(`只允许上传1个文件`);
},
handleSizeChange(val){
this.model.imgInvmod.pageTable.pageSize=val;
this.model.imgInvmod.pageTable.tableData =this.paginate(this.model.imgInvmod.pageTable.currentPage,this.model.imgInvmod.pageTable.pageSize);
this.$refs['invTable'].validate()
},
handleCurrentChange(val) {
this.model.imgInvmod.pageTable.currentPage=val;
this.model.imgInvmod.pageTable.tableData =this.paginate(this.model.imgInvmod.pageTable.currentPage,this.model.imgInvmod.pageTable.pageSize);
this.$refs['invTable'].validate()
},
refresh(){
this.model.imgInvmod.pageTable.total=this.model.imgInvmod.invlst.length
this.model.imgInvmod.pageTable.tableData =this.paginate(this.model.imgInvmod.pageTable.currentPage,this.model.imgInvmod.pageTable.pageSize);
this.$refs['invTable'].validate()
},
uploadSucess(response) {
if (response.respCode == "AAAAAA") {
this.$notify.success("解析成功!");
this.model.imgInvmod.invlst=this.model.imgInvmod.invlst.concat(response.data);
this.model.imgInvmod.pageTable.total=this.model.imgInvmod.invlst.length
this.model.imgInvmod.pageTable.tableData = this.paginate(this.model.imgInvmod.pageTable.currentPage,this.model.imgInvmod.pageTable.pageSize);
} else {
this.$notify.error("上传失败!" + response.respMsg);
}
this.cancel();
},
/** 关闭上传弹框 */
cancel() {
this.detailsDialog = false;
},
changeDate(val){
let result = val.replace(/\//g,"-")
return result
},
beforeUpload(file) {
console.log(file, "--文件");
this.file2XLSX(file).then(res => {
let newData = res[0].sheet.map(item => ({
imagid: "00000000-0000-0000-0000-000000000000",
invcod: item.hasOwnProperty("发票代码")
? typeof item["发票代码"] === "number"
? item["发票代码"].toString().trim()
: item["发票代码"].trim()
: "",
invnum:
typeof item["发票号码"] === "number"
? item["发票号码"].toString().trim()
: item["发票号码"].trim(),
invdat:
this.changeDate(typeof item["开票日期(YYYY-MM-DD)"] === "number"
? moment("1900-01-01")
.add(item["开票日期(YYYY-MM-DD)"] - 2, "days")
.format("YYYY-MM-DD")
: item["开票日期(YYYY-MM-DD)"]),
amountin: 0.00,
untamt: item.hasOwnProperty("未税金额(小数点后两位)")
? item["未税金额(小数点后两位)"].toString().trim()
: "",
checkcode:
item.hasOwnProperty("校验码后六位") ? (typeof item["校验码后六位"] === "number"
? item["校验码后六位"].toString().trim()
: item["校验码后六位"].trim()) : "",
amounttax: item.hasOwnProperty("价税合计金额(小数点后两位)")
? item["价税合计金额(小数点后两位)"].toString().trim()
: "",
valflg: "VLID",
reason: ""
}));
this.model.imgInvmod.invlst = this.model.imgInvmod.invlst.concat(
newData
);
this.detailsDialog = false
});
return false;
},
changeSelection1(val) {
this.selection1 = val;
},
validaInvcod(rule, value, callback, row) {
if (this.isCheckRe) {
if (row.invnum.length == 20) {
if (value) {
return callback(new Error("全电发票不能录入发票代码"));
}
} else {
if (
!value ||
!row.invnum ||
!row.invdat ||
Number(row.untamt) == 0 ||
Number(row.amounttax) == 0
) {
return callback(
new Error("发票代码、发票号码、开票日期、未税金额、价税合计须同时有值")
);
}
}
} else {
if (row.invnum.length == 20 && value) {
return callback(new Error("全电发票不能输入发票代码"));
}
}
callback();
},
validaInvnum(rule, value, callback, row) {
if (this.isCheckRe) {
if (
value.length == 20 &&
(!value ||
!row.invdat ||
Number(row.untamt) == 0 ||
Number(row.amounttax) == 0)
) {
return callback(
new Error("发票号码、开票日期、未税金额和价税合计栏位须同时有值")
);
}
if (value && value.length != 8 && value.length != 20) {
return callback(new Error("发票号码不能为空,长度为8位或20位"));
}
}
callback();
},
// validaAmountin(rule,value,callback,row){
// if(this.isCheckRe){
// if(Number(value) > Number(row.amounttax)){
// return callback(new Error('占用金额不能大于价税合计'))
// }
// callback()
// }
// callback()
// },
validaCheckCode(rule, value, callback, row) {
if (this.isCheckRe) {
if(row.invnum.length == 8){
if (
(row.invtyp == "COMM" || row.invtyp == "ECOM") &&
!value &&
row.state != "0"
) {
return callback(new Error("校验码后六位必输"));
}
if (value && value.length != 6) {
return callback(new Error("校验码后六位长度固定六位"));
}
}else{
callback()
}
}
callback();
},
validaInvtyp(rule, value, callback, row) {
if (!this.isCheckRe) {
if (row.invnum.length == 20) {
if (!value || !row.invnum || !row.invdat) {
return callback(new Error("发票类型,发票号码,开票日期全必输"));
}
} else {
if (!value || !row.invnum || !row.invcod || !row.invdat) {
return callback(
new Error("发票类型,发票号码,发票代码,开票日期全必输")
);
}
}
}
callback();
},
// validaAmounttax(rule,value,callback,row){
// if(!row.invtyp && 'SPEC_MVSC_UCSC'.includes(row.invtyp)){
// return callback(new Error('价税合计必输'))
// }
// callback()
// }
},
mounted() {
this.getdbCode("invsta", "state");
this.getdbCode("isyn", "isfnc");
this.getdbCode("typinv", "invtyp");
this.getdbCode("typbus", "bustyp");
},
created() {}
};
</script>
<style scoped lang="less">
.eibs-tab{
/deep/ .el-dialog{
height: 200px!important;
margin-top: calc(50vh - 100px)!important;
}
/deep/ .el-dialog__body{
height: calc(100% - 65px);
}
}
</style>