Commit 593ae06a by fukai

完善stream组件,补充公共请求提示,修复content报错误问题

parent e487bf2b
......@@ -34,6 +34,10 @@
},
handleResize: (contentRef, height) => {
let content = document.getElementById(contentRef)
if(!content){
//切换顶部tab,会隐藏元素,所以有可能找不到
return
}
let clientHeight = `${document.documentElement.clientHeight}`
content.style.height = clientHeight - height + 'px'
}
......
......@@ -20,6 +20,7 @@
v-if="showSelection"
:reserve-selection="true"
></el-table-column>
<el-table-column
v-for="(item, key) in tableColumns"
:key="key"
......@@ -27,6 +28,9 @@
:label="item.label"
:width="item.width"
>
<template slot-scope="scope">
<span>{{!item.render?scope.row[item.prop]:item.render(item.prop,scope)}}</span>
</template>
</el-table-column>
<slot></slot>
<el-table-column fixed="right" width="48px" v-if="showButtonFlg" class-name="buttonColumn">
......@@ -185,6 +189,24 @@ export default {
const obj = {};
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if(typeof line === "object" ){
//如果是对象,支持自定义处理
//{width,position,index,label,pattern,render}
let {width,position,index,label,pattern,render,...rest} = line
position += ''
if (!obj[position]) {
obj[position] = [];
}
obj[position].push({
idx:index,
prop:label,
width:width+'px',
pattern,
render,
...rest
})
continue
}
if (etyReg.test(line)) {
const gs = line.match(etyReg);
const columnName = gs[1];
......@@ -205,14 +227,24 @@ export default {
if (Object.hasOwnProperty.call(obj, k)) {
const o = obj[k];
const tableColumn = o.map((item) => item.prop).join("\n");
columnArr.push({
let colInfo = {
prop: tableColumn,
label: tableColumn,
width: o[0].width,
// width: "auto",
index: k,
children: o,
});
}
//支持自定义处理
if(o.length == 1){
if(o[0].pattern && this[o[0].pattern]){
colInfo.render = this[o[0].pattern]
colInfo.code = o[0].code
}else if(o[0].render){
colInfo.render = o[0].render
}
}
columnArr.push(colInfo);
}
}
const arr = columnArr.sort((a, b) => {
......@@ -271,6 +303,29 @@ export default {
handleColumnChange() {
this.selectAll = this.tableColumnsOrigin.length === this.columnGroup.length;
},
//补充自定义列处理函数
date(prop,scope){
let value = scope.row[prop]
if(!value){
return ""
}
let idx = value.indexOf(" ")
if(idx > 0)
return value.substring(0,idx)
return value
},
code(prop,scope,code){
let value = scope.row[prop]
if(!value || !code){
return ""
}
let em = code.find(item=>item.value.trim() == value.trim())
if(!em){
return value
}
return em.label
}
}
};
</script>
......
......@@ -57,26 +57,42 @@ export default {
const tab = Utils.positioningErrorMsg(fieldErrors, fields);
return tab;
},
loading(text){
const loading = this.$loading({
lock: true,
text,
spinner: 'el-icon-loading',
background: 'rgba(200, 200, 200, 0.3)'
});
return loading
},
getRoot(){
return (this.root || this)
},
async init(params) {
const loading = this.loading("交易加载中")
let rtnmsg = await Api.post(this.declareParams.trnName + "/init", { params })
if(rtnmsg.respCode == SUCCESS){
this.updapteValueSet(rtnmsg.codeSet)
}
loading.close()
return rtnmsg
},
save(params) {
return Api.post(this.declareParams.trnName + "/saveData", this.wrapper(params))
async save(params) {
const loading = this.loading("正在保存交易")
let rtnmsg = await Api.post(this.declareParams.trnName + "/saveData", this.wrapper(params))
loading.close()
return rtnmsg
},
async executeCheck(rulePath,params){
const loading = this.loading("校验进行中")
let rtnmsg = await Api.post(this.declareParams.trnName+"/executeCheck/"+rulePath, this.wrapper(params))
if(rtnmsg.respCode == SUCCESS){
this.updapteValueSet(rtnmsg.codeSet)
this.showBackendErrors(rtnmsg.fieldErrors)
}
loading.close()
return rtnmsg
},
async executeDefault(rulePath, params) {
......@@ -88,29 +104,41 @@ export default {
return rtnmsg
},
async executeRule(rulePath, params,delayCb) {
const loading = this.loading("正在请求数据")
let rtnmsg = await Api.post(this.declareParams.trnName + "/executeRule/" + rulePath, this.wrapper(params,delayCb))
if(rtnmsg.respCode == SUCCESS){
this.updapteValueSet(rtnmsg.codeSet)
this.showBackendErrors(rtnmsg.fieldErrors)
}
loading.close()
return rtnmsg
},
async checkAll(params) {
const loading = this.loading("正在校验数据")
const rtnmsg = await Api.post(this.declareParams.trnName + "/checkAll", this.wrapper(params))
if(rtnmsg.respCode == SUCCESS){
this.updapteValueSet(rtnmsg.codeSet)
}
loading.close()
return rtnmsg
},
pedding(params) {
return Api.post(this.declareParams.trnName + "/pending", this.wrapper(params))
async pedding(params) {
const loading = this.loading("正在暂存数据")
const rtnmsg = await Api.post(this.declareParams.trnName + "/pending", this.wrapper(params))
if(rtnmsg.respCode == SUCCESS){
this.updapteValueSet(rtnmsg.codeSet)
}
loading.close()
return rtnmsg
},
async restoreDisplay() {
let inr = this.$route.query.trn
if (!inr)
return
const loading = this.loading("快照数据加载中")
let data = await Api.post("display/" + inr)
Utils.copyValueFromVO(this.model, JSON.parse(data.data))
loading.close()
},
async executeNotify(params) {
const rtnmsg = await Api.post(this.declareParams.trnName + "/executeNotify", this.wrapper(params))
......
......@@ -612,8 +612,10 @@ export default {
'9 6 "Beneficiary Party Number" 170',
'10 7 "Beneficiary" 150',
'11 8 "BIC" 150',
'4 9 "Opened" 150',
'5 10 "Expired" 150',
// '4 9 "Opened" 150',
{index:4,position:9,width:100,pattern:'date',label:'Opened'},
// '5 10 "Expired" 150',
{index:5,position:10,width:100,pattern:'date',label:'Expired'},
'6 11 "Closed" 100',
'12 12 "L/C Amt Cur" 100',
'13 13 "L/C Amount" 120',
......
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