1.滚动条显示:style="overflow-x: auto; overflow-y: scroll;”
2.把<div>固定在页面:CSS position 属性 (w3school.com.cn)
3.调整一个table中内容的位置的时候,内外边距不生效的时候可以考虑改变<table>或者<td>的width
4.获取选择框中的数据:
<template>
<el-table @selection-change="dataListSelectionChangeHandle"><el-table>
</template>
export default {
data(){
return {
selectRow: "" //选中行
}
}
methods:{
// 获得复选框选中的数据
dataListSelectionChangeHandle(currentRow) {
this.selectRow = currentRow;
},
}
}
5.在消息提示框中添加html代码:
//预览电子协议
previewAgreementElec() {
//对可修改的数据进行校验
var target = this.checkTableData();
if( target == "0000"){
const h = this.$createElement; //创建一个元素 h(标签名,属性/样式,子标签)
const message = h('table', { style: 'text-align:left' }, [
h('tr', {}, [h('td', {}, '购烟商户名称: '), h('td', {}, this.tableData.merchantName)]),
h('tr', {}, [h('td', {}, '银行账户所有人(授权人): '), h('td', {}, this.tableData.authorizer)]),
h('tr', {}, [h('td', {}, '授权人身份证号码: '), h('td', {}, this.tableData.authorizerIdcard)]),
h('tr', {}, [h('td', {}, '银行账户所有人(或代理人)签章: '), h('td', {}, this.tableData.authorizerSignature)]),
h('tr', {}, [h('td', {}, '受托单位业务审核人: '), h('td', {}, this.tableData.verifierName)]),
]);
this.$confirm(message, '请核对信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true,
})
.then(() => {
this.createAgreementElec();
})
.catch(() => {});
}else{
this.$message({
type: 'info',
center:true,
message: target,
});
}
},
6.数据校验:
//校验可修改的数据是否合规,返回0000即合规,其他不合规
checkTableData(){
// 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
const idCard = /^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/;
if(this.tableData.authorizer == undefined || this.tableData.authorizer == null || this.tableData.authorizer == ""){
return "银行账户所有人(授权人) 不能为空";
};
if(this.tableData.authorizerSignature == undefined || this.tableData.authorizerSignature == null || this.tableData.authorizerSignature == ""){
return "银行账户所有人(授权人)签章 不能为空";
};
if(this.tableData.verifierName == undefined || this.tableData.verifierName == null || this.tableData.verifierName == ""){
return "受托单位业务审核人 不能为空";
};
if(this.tableData.authorizerIdcard == undefined || this.tableData.authorizerIdcard == null || this.tableData.authorizerIdcard == ""){
return "授权人身份证号码 不能为空";
}else if(!idCard.test(this.tableData.authorizerIdcard)){
return "授权人身份证号码 格式错误";
};
return "0000";
},
7.最小最大金额校验
validate : function(){
debugger;
//最小金额不能小于最大金额
var min = $J("Text_TradeMinAmount",namespace).getValue();
var max = $J("Text_TradeMaxAmount",namespace).getValue();
if(min!=null&&min!=""){
if(parseFloat(min)>999999999999999){
Tf2mUtil.showWarnMsg(payment_apply_list_i_0076, com_i_list_0004);
return false;
}
}
if(max!=null&&max!=""){
if(parseFloat(max)>999999999999999){
Tf2mUtil.showWarnMsg(payment_apply_list_i_0077, com_i_list_0004);
return false;
}
}
if(min!=null&&max!=null&&min!=""&&max!=""){
if(parseFloat(min)>parseFloat(max)){
//if(min>max){
Tf2mUtil.showWarnMsg(com_i_msg_0010, com_i_list_0004);
return false;
}
}
return true;
},