Commit 593ae06a by fukai

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

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