Commit a2b8c029 by wangguangchao
parents 5f7aaca2 d8abe43e
<template>
<el-dialog :title="title" :visible.sync="show"
custom-class="grid-ety"
:highlight-current-row="true"
width="60%"
:before-close="beforeClose">
<el-table :data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
border
@row-dblclick="selectEty">
<el-table-column v-for="(item,idx) in tableColumn" :key="idx"
:property="item.prop"
:label="item.label"
:width="item.width">
</el-table-column>
</el-table>
<el-pagination
layout="prev, pager, next, total, jumper"
:total="tableData.length"
:page-sizes="pageSizes"
:page-size="pageSize"
:current-page="currentPage"
@current-change="currentChange"
>
</el-pagination>
</el-dialog>
</template>
<script>
export default {
props: ["title", "columnStr", "data", "type", "rulePath"],
data() {
return {
show: false,
currentPage: 1,
pageSizes: [5, 10, 20, 30, 40, 50, 100],
pageSize: 5
}
},
computed: {
tableColumn() {
if (this.type === "extkey") {
return this.dealExtKeyTableColumn()
} else if (this.type === "bankno") {
return this.dealBanknoTableColumn()
}
return []
},
tableData() {
if (this.type === "extkey") {
return this.dealExtKeyTableData()
} else if (this.type === "bankno") {
return this.dealBanknoTableData()
}
return []
}
},
methods: {
dealExtKeyTableColumn() {
const columnArr = []
const lines = this.columnStr.split("\r\n")
// 1 7:1 QuoteBranch codeQuote 150 50\r\n
const etyReg = /Quote(\w*\s?\w*)Quote/
const obj = {}
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (etyReg.test(line)) {
const gs = line.match(etyReg)
const columnName = gs[1]
const newLine = line.replace(gs[0], "_")
const colPropArr = newLine.split(" ")
const positionArr = colPropArr[1].split(":")
if (!obj[positionArr[0]]) {
obj[positionArr[0]] = []
}
obj[positionArr[0]].push({
idx: colPropArr[0],
prop: columnName,
width: colPropArr[3]
})
}
}
for (const k in obj) {
if (Object.hasOwnProperty.call(obj, k)) {
const o = obj[k];
const tableColumn = o.map(item => item.prop).join("\n")
columnArr.push({
prop: tableColumn,
label: tableColumn,
// width: o[0].width,
width: "auto",
index: k,
children: o
})
}
}
return columnArr.sort((a,b) => {
return parseInt(a.index) - parseInt(b.index)
})
},
dealExtKeyTableData() {
const arr = []
for (let i = 0; i < this.data.length; i++) {
const d = this.data[i];
const items = d.split("\t")
const it = {}
for (let j = 0; j < this.tableColumn.length; j++) {
const column = this.tableColumn[j];
it[column['prop']] = column.children.map(c => items[c['idx']] || " ").join("\n")
}
it['IDX'] = i
arr.push(it)
}
return arr
},
dealBanknoTableColumn() {
const columnArr = []
const lines = this.columnStr.split("\r\n")
// 0 1 \"联行行号\"120\r\n
const etyReg = /\"([^\"]*)\"/
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (etyReg.test(line)) {
const gs = line.match(etyReg)
const columnName = gs[1]
const newLine = line.replace(gs[0], "_ ")
const colPropArr = newLine.split(" ")
columnArr.push({
idx: colPropArr[0],
prop: columnName,
label: columnName,
// width: colPropArr[3],
width: "auto",
})
}
}
return columnArr
},
dealBanknoTableData() {
const arr = []
for (let i = 0; i < this.data.length; i++) {
const d = this.data[i];
const items = d.split("\t")
const it = {}
for (let j = 0; j < this.tableColumn.length; j++) {
const column = this.tableColumn[j];
it[column['prop']] = items[column['idx']]
}
it['IDX'] = i
arr.push(it)
}
return arr
},
currentChange(currentPage) {
this.currentPage = currentPage;
},
selectEty(row, column, event) {
const str = this.data[row.IDX]
let v = "";
if (this.type === 'extkey') {
v = str.split("\t")[4].trim()
} else if (this.type === 'bankno') {
v = str.split("\t")[0].trim()
}
this.$emit("select-ety", v, this.rulePath)
this.show = false;
this.currentPage = 1;
},
beforeClose(done) {
this.show = false;
this.currentPage = 1;
done()
}
}
}
</script>
<style>
.grid-ety .el-table .cell{
white-space: pre-wrap;
}
</style>
\ No newline at end of file
......@@ -180,4 +180,7 @@ export default {
.el-table .success-row {
background: #f0f9eb;
}
.eContainer-table thead tr th.is-leaf{
border-bottom: transparent;
}
</style>
\ No newline at end of file
......@@ -11,6 +11,7 @@ import Checkbox from './Checkbox.vue'
import Table from "./Table"
import IStreamTable from "./IStreamTable.vue"
import IStreamTableDocpan from "./IStreamTableDocpan.vue"
import GridEtyPromptDialog from "./GridEtyPromptDialog.vue"
import Radio from "./Radio"
import InputNumber from "./InputNumber"
import PrintButton from "./PrintButton"
......@@ -51,6 +52,7 @@ export default {
Vue.component("c-table", Table)
Vue.component("c-istream-table", IStreamTable)
Vue.component("c-istream-table-docpan", IStreamTableDocpan)
Vue.component("c-grid-ety-prompt-dialog", GridEtyPromptDialog)
Vue.component("c-radio", Radio)
Vue.component("c-input-number", InputNumber)
Vue.component("c-print-button", PrintButton)
......
......@@ -823,7 +823,7 @@ function checkDidgrpApcPtsDihdigN1002(rule, value, callback) {
*/
function checkDidgrpAdvPtsExtkeyN100(rule, value, callback) {
const that = this;
that.executeRule("didgrp.adv.pts.extkey").then(res => {
that.exeuteCheck("didgrp.adv.pts.extkey").then(res => {
//TODO
callback()
})
......@@ -959,6 +959,7 @@ function checkDidgrpRecTenmaxdayN1000(rule, value, callback) {
const that = this;
that.exeuteCheck("didgrp.rec.tenmaxday").then(res => {
//TODO
Utils.copyValueFromVO(this.model, res.data)
callback()
})
}
......
......@@ -347,7 +347,7 @@ function defaultDidgrpRecTenmaxday(rule, value, callback) {
const that = this;
that.executeDefault("didgrp.blk.defdet").then(res => {
//TODO
that.model.didgrp.blk.defdet = res.data.didgrp_blk_defdet;
Utils.copyValueFromVO(this.model, res.data)
callback()
})
}
......
......@@ -284,8 +284,8 @@ export default {
"didgrp.rec.tenmaxday": [
{ type: "string", required: true, message: "必输项", trigger: "blur" },
{ max: 3, message: "长度不能超过3", trigger: "blur" }
{ type: 'number', required: true, message: "必输项", trigger: "blur" },
// { max: 3, message: "长度不能超过3", trigger: "blur" },
],
......
......@@ -11,7 +11,7 @@
</el-form-item>
<el-form-item label="付款期限" prop="didgrp.rec.tenmaxday" @keyup.enter.native="recTenmaxdayEvent">
<c-input :disabled="model.didgrp.rec.avbby == 'P'" v-model="model.didgrp.rec.tenmaxday" placeholder="请输入" style="width:15%"></c-input>
<c-input :disabled="model.didgrp.rec.avbby == 'P'" v-model.number="model.didgrp.rec.tenmaxday" placeholder="请输入" style="width:15%" maxlength="3"></c-input>
</el-form-item>
<el-form-item label="远期付款指示" prop="didgrp.blk.defdet">
......
......@@ -681,6 +681,15 @@
</el-form-item>
</el-col>
</el-col>
<c-grid-ety-prompt-dialog ref="etyDialog"
:title="gridPromptDialog.title"
:columnStr="gridPromptDialog.columnStr"
:data="gridPromptDialog.data"
:type="gridPromptDialog.type"
:rulePath="gridPromptDialog.rulePath"
v-on:select-ety="selectEty"
>
</c-grid-ety-prompt-dialog>
</el-row>
</template>
<script>
......@@ -705,6 +714,13 @@ export default {
},
jigomcFlag:false,
trade: "",
gridPromptDialog: {
title: '',
columnStr: '',
data: [],
type: '',
rulePath: ''
}
};
},
methods: {
......@@ -715,7 +731,16 @@ export default {
if (res.respCode = "AAAAAA"){
//失去焦点,避免多次触发
document.getElementById('extkey').blur();
Utils.copyValueFromVO(this.model, res.data);
if (res.data.params) {
Utils.copyValueFromVO(this.model, res.data);
} else {
this.$refs.etyDialog.show = true
this.gridPromptDialog.title = res.data.title
this.gridPromptDialog.columnStr = res.data.columns
this.gridPromptDialog.data = res.data.vals.rows
this.gridPromptDialog.type = 'extkey'
this.gridPromptDialog.rulePath = 'didgrp.apl.pts.extkey'
}
}
}
);
......@@ -723,8 +748,17 @@ export default {
benExtkeyEvent() {
Api.post("ditopn/executeRule/didgrp.ben.pts.extkey", Utils.getRequestDataFn.call(this)).then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
if (res.respCode = "AAAAAA"){
if (res.data.params) {
Utils.copyValueFromVO(this.model, res.data);
} else {
this.$refs.etyDialog.show = true
this.gridPromptDialog.title = res.data.title
this.gridPromptDialog.columnStr = res.data.columns
this.gridPromptDialog.data = res.data.vals.rows
this.gridPromptDialog.type = 'extkey'
this.gridPromptDialog.rulePath = 'didgrp.ben.pts.extkey'
}
}
}
);
......@@ -738,15 +772,15 @@ export default {
Api.post("ditopn/executeRule/didgrp.beb.pts.bankno", Utils.getRequestDataFn.call(this)).then(
(res) => {
if (res.respCode = "AAAAAA"){
if (JSON.stringify(res.fieldErrors) != '{}'){
this.$notify({
title: '提示',
message: res.fieldErrors['didgrp.beb.pts.bankno'],
type: 'error'
});
}else{
this.jigomcFlag = true;
Utils.copyValueFromVO(this.model, res.data);
if (res.data.params) {
Utils.copyValueFromVO(this.model, res.data);
} else {
this.$refs.etyDialog.show = true
this.gridPromptDialog.title = res.data.title
this.gridPromptDialog.columnStr = res.data.columns
this.gridPromptDialog.data = res.data.vals.rows
this.gridPromptDialog.type = 'bankno'
this.gridPromptDialog.rulePath = 'didgrp.beb.pts.bankno'
}
}
}
......@@ -772,6 +806,19 @@ export default {
}
);
},
selectEty(val, rulePath) {
const props = rulePath.replaceAll(".", "_")
const obj = {}
obj[props] = val;
Utils.copyValueFromVO(this.model, obj);
Api.post(`ditopn/executeRule/${rulePath}`, Utils.getRequestDataFn.call(this)).then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
}
}
);
}
},
created: function () {},
computed:{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment