Commit ad389081 by zhengxiaokui

amtpanl

parent fdb6386a
<template>
<el-select
:id="id" v-model="model" v-bind="attrs"
v-on="$listeners" v-bind:disabled="isDisable" :clearable="clearable" @click.native="handleClick" >
<slot></slot>
:id="id"
v-model="model"
v-bind="attrs"
v-on="$listeners"
v-bind:disabled="isDisable"
:clearable="clearable"
@click.native="handleClick"
>
<template v-if="code.length > 0">
<el-option
v-for="item in code"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</template>
<slot v-else></slot>
</el-select>
</template>
......@@ -11,61 +26,66 @@ export default {
props: {
value: {
type: [String, Array, Number],
default: undefined
default: undefined,
},
disabled: {
type: Boolean,
default: false
default: false,
},
clearable: {
type: Boolean,
default: true
default: true,
},
id: {
type: String,
default: undefined
}
default: undefined,
},
code: {
type: Array,
default: function () {
return [];
},
},
},
computed: {
model: {
get() {
return this.value
return this.value;
},
set(newVal) {
this.$emit('input', newVal)
}
this.$emit("input", newVal);
},
},
mode() {
return this.$store.state.Status.mode
return this.$store.state.Status.mode;
},
isDisable: {
get() {
return this.mode === 'display' || this.disabled
}
return this.mode === "display" || this.disabled;
},
},
highlight () {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1
highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1;
},
attrs(){
if(this.mode === 'display' || this.disabled)
{
let {placeholder,...rest} = this.$attrs
rest = {placeholder:" ",...rest}
return rest
attrs() {
if (this.mode === "display" || this.disabled) {
let { placeholder, ...rest } = this.$attrs;
rest = { placeholder: " ", ...rest };
return rest;
}
return this.$attrs
}
},
return this.$attrs;
},
},
methods: {
handleClick: function (e) {
let ev = new Event("click", {"bubbles": true})
let node = e.target
let ev = new Event("click", { bubbles: true });
let node = e.target;
if (node.parentElement) {
node.parentElement.dispatchEvent(ev)
node.parentElement.dispatchEvent(ev);
}
}
}
}
},
},
};
</script>
<style>
......
......@@ -4,55 +4,55 @@ import Utils from "~/utils"
* Bdtudp Check规则
*/
let checkObj = {
"bddgrp.tag72add" :null,
"liaall.misamt" :null,
"liaall.limmod.limpts.oth.pts.extkey" :null,
"bddgrp.acb.adrelc" :null,
"bddgrp.rec.disdat" :null,
"bdtp.oth.pts.extkey" :null,
"liaall.limmod.ownref" :null,
"liaall.limmod.ecifno" :null,
"bddgrp.beb.pts.extkey" :null,
"bddgrp.beb.pts.adrblk" :null,
"liaall.limmod.othp.ptsget.sdamod.dadsnd" :null,
"bddgrp.rec.docflg" :null,
"bdtp.furide" :null,
"bddgrp.blk.docdis" :null,
"setmod.dspflg" :null,
"bddgrp.prb.pts.ref" :null,
"bddgrp.acb.pts.extkey" :null,
"bddgrp.blk.accrmk" :null,
"bddgrp.prb.pts.extkey" :null,
"bddgrp.rec.expdat" :null,
"bddgrp.beb.adrelc" :null,
"bddgrp.shp.namelc" :null,
"liaall.liaccv.totcovamt" :null,
"aamset.utlamt2" :null,
"bddgrp.acb.pts.adrblk" :null,
"bddgrp.acb.namelc" :null,
"bddgrp.beb.namelc" :null,
"bddgrp.rec.rcvdat" :null,
"bddgrp.shp.pts.adrblk" :null,
"liaall.limmod.limpts.wrk.pts.extkey" :null,
"bdtp.acbp.ptsget.sdamod.dadsnd" :null,
"bddgrp.blk.comcon" :null,
"bddgrp.prb.pts.bankno" :null,
"bddgrp.rec.reltyp" :null,
"bddgrp.rec.relgodflg" :null,
"bdtp.shpp.ptsget.sdamod.dadsnd" :null,
"mtabut.coninf.conexedat" :null,
"bdtp.recget.sdamod.dadsnd" :null,
"liaall.limmod.limpts.nonrevflg1" :null,
"bddgrp.shp.adrelc" :null,
"liaall.limmod.wrkp.ptsget.sdamod.dadsnd" :null,
"setmod.docamt" :null,
"bdtp.bebp.ptsget.sdamod.dadsnd" :null,
"liaall.liaccv.cshpct" :null,
"bdtp.oth.pts.bankno" :null,
"bdtp.didget.sdamod.dadsnd" :null,
"bddgrp.shp.pts.extkey" :null,
"bddgrp.rec.trpdocnum" :null,
"liaall.liaccv.relcshpct" :null,
"bddgrp.tag72add": null,
"liaall.misamt": null,
"liaall.limmod.limpts.oth.pts.extkey": null,
"bddgrp.acb.adrelc": null,
"bddgrp.rec.disdat": null,
"bdtp.oth.pts.extkey": null,
"liaall.limmod.ownref": null,
"liaall.limmod.ecifno": null,
"bddgrp.beb.pts.extkey": null,
"bddgrp.beb.pts.adrblk": null,
"liaall.limmod.othp.ptsget.sdamod.dadsnd": null,
"bddgrp.rec.docflg": null,
"bdtp.furide": null,
"bddgrp.blk.docdis": null,
"setmod.dspflg": null,
"bddgrp.prb.pts.ref": null,
"bddgrp.acb.pts.extkey": null,
"bddgrp.blk.accrmk": null,
"bddgrp.prb.pts.extkey": null,
"bddgrp.rec.expdat": null,
"bddgrp.beb.adrelc": null,
"bddgrp.shp.namelc": null,
"liaall.liaccv.totcovamt": null,
"aamset.utlamt2": null,
"bddgrp.acb.pts.adrblk": null,
"bddgrp.acb.namelc": null,
"bddgrp.beb.namelc": null,
"bddgrp.rec.rcvdat": null,
"bddgrp.shp.pts.adrblk": null,
"liaall.limmod.limpts.wrk.pts.extkey": null,
"bdtp.acbp.ptsget.sdamod.dadsnd": null,
"bddgrp.blk.comcon": null,
"bddgrp.prb.pts.bankno": null,
"bddgrp.rec.reltyp": null,
"bddgrp.rec.relgodflg": null,
"bdtp.shpp.ptsget.sdamod.dadsnd": null,
"mtabut.coninf.conexedat": null,
"bdtp.recget.sdamod.dadsnd": null,
"liaall.limmod.limpts.nonrevflg1": null,
"bddgrp.shp.adrelc": null,
"liaall.limmod.wrkp.ptsget.sdamod.dadsnd": null,
"setmod.docamt": null,
"bdtp.bebp.ptsget.sdamod.dadsnd": null,
"liaall.liaccv.cshpct": null,
"bdtp.oth.pts.bankno": null,
"bdtp.didget.sdamod.dadsnd": null,
"bddgrp.shp.pts.extkey": null,
"bddgrp.rec.trpdocnum": null,
"liaall.liaccv.relcshpct": null,
}
for (const key in checkObj) {
......
......@@ -19,7 +19,7 @@ export default {
{ max: 3, message: "长度不能超过3" }
],
"didgrp.cbs.opn1.amt": [
{ required: false, message: "必输项" },
{ required: true, message: "必输项" },
{ max: 18, message: "整数位不能超过14位" },
{ pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" }
],
......@@ -41,7 +41,7 @@ export default {
],
"bddgrp.cbs.max.amt": [
{ required: false, message: "必输项" },
{ required: true, message: "必输项" },
{ max: 18, message: "整数位不能超过14位" },
{ pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" }
],
......
export default {
set(object, path, value) {
if (typeof object !== "object") return object;
this.basePath(path).reduce((o, k, i, _) => {
if (i === _.length - 1) {
// 若遍历结束直接赋值
o[k] = value;
return null;
} else if (k in o) {
// 若存在对应路径,则返回找到的对象,进行下一次遍历
return o[k];
} else {
// 若不存在对应路径,则创建对应对象,若下一路径是数字,新对象赋值为空数组,否则赋值为空对象
o[k] = /^[0-9]{1,}$/.test(_[i + 1]) ? [] : {};
return o[k];
}
}, object);
// 返回object
return object;
},
basePath(path) {
// 若是数组,则直接返回
if (Array.isArray(path)) return path;
// 若有 '[',']',则替换成将 '[' 替换成 '.',去掉 ']'
return path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
},
get(object, path, defaultValue) {
// 判断 object 是否是数组或者对象,否则直接返回默认值 defaultValue
if (typeof object !== "object") return defaultValue;
// 沿着路径寻找到对应的值,未找到则返回默认值 defaultValue
return (
this.basePath(path).reduce((o, k) => (o || {})[k], object) || defaultValue
);
}
}
\ No newline at end of file
......@@ -12,40 +12,6 @@
</el-form-item>
</c-col>
<!-- <c-col :span="12">
<c-col :span="12">
<el-form-item label="信用证余额" prop="didgrp.cbs.opn1.cur">
<c-select
disabled
v-model="model.didgrp.cbs.opn1.cur"
style="width: 100%"
placeholder="请选择币种"
@keyup.enter.native="nom1CurEvent"
>
<el-option
v-for="item in codes.cur"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="didgrp.cbs.opn1.amt"
>
<c-input
v-model="model.didgrp.cbs.opn1.amt"
style="text-align: left; width: 100%"
placeholder="请输入信用证余额"
></c-input>
</el-form-item>
</c-col>
</c-col> -->
<c-amtpanl
:model="model"
:message="{
......@@ -79,56 +45,25 @@
<c-row>
<c-col :span="12">
<c-row>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="单据金额" prop="bddgrp.cbs.max.cur">
<c-select
v-model="model.bddgrp.cbs.max.cur"
style="width: 100%"
placeholder="请选择单据币种"
>
</c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="bddgrp.cbs.max.amt"
>
<c-input
v-model="model.bddgrp.cbs.max.amt"
placeholder="请输入单据金额"
></c-input>
</el-form-item>
</c-col>
</c-col>
<c-amtpanl
:model="model"
:span="24"
:message="{
title: '单据金额',
cur: 'bddgrp.cbs.max.cur',
amt: 'bddgrp.cbs.max.amt',
}"
></c-amtpanl>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="单据余额" prop="bddgrp.cbs.opn1.cur">
<c-select
v-model="model.bddgrp.cbs.opn1.cur"
maxlength="3"
placeholder="请选择单据余额"
></c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="bddgrp.cbs.opn1.amt"
>
<c-input
v-model="model.bddgrp.cbs.opn1.amt"
placeholder="请输入单据余额"
></c-input>
</el-form-item>
</c-col>
</c-col>
<c-amtpanl
:model="model"
:span="24"
:message="{
title: '单据余额',
cur: 'bddgrp.cbs.opn1.cur',
amt: 'bddgrp.cbs.opn1.amt',
}"
></c-amtpanl>
</c-row>
</c-col>
......@@ -245,55 +180,25 @@
</el-form-item>
</c-col>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="承兑金额" prop="setmod.doccur">
<c-select
v-model="model.setmod.doccur"
maxlength="3"
placeholder="请选择承兑币种"
></c-select>
</el-form-item>
</c-col>
<c-amtpanl
:span="24"
:model="model"
:message="{
title: '承兑金额',
cur: 'setmod.doccur',
amt: 'setmod.docamt',
}"
></c-amtpanl>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="setmod.docamt"
>
<c-input
v-model="model.setmod.docamt"
placeholder="请输入承兑金额"
></c-input>
</el-form-item>
</c-col>
</c-col>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="单据金额" prop="bddgrp.cbs.opn2.cur">
<c-select
v-model="model.bddgrp.cbs.opn2.cur"
maxlength="3"
placeholder="请选择单据币种"
></c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="aamset.utlamt"
>
<c-input
v-model="model.aamset.utlamt"
placeholder="请输入单据金额"
></c-input>
</el-form-item>
</c-col>
</c-col>
<c-amtpanl
:model="model"
:span="24"
:message="{
title: '单据金额',
cur: 'bddgrp.cbs.opn2.cur',
amt: 'aamset.utlamt',
}"
></c-amtpanl>
</c-row>
</c-col>
......@@ -312,30 +217,14 @@
<c-row>
<c-col :span="12">
<c-row>
<c-col :span="24">
<c-col :span="12">
<el-form-item label="附加金额" prop="bddgrp.cbs.opn2.cur">
<c-select
v-model="model.bddgrp.cbs.opn2.cur"
maxlength="3"
placeholder="请选择附加金额币种"
></c-select>
</el-form-item>
</c-col>
<c-col :span="12">
<el-form-item
label=""
style="margin-left: -230px !important"
prop="aamset.utlamt2"
>
<c-input
v-model="model.aamset.utlamt2"
placeholder="请输入附加金额"
></c-input>
</el-form-item>
</c-col>
</c-col>
<c-amtpanl
:model="model"
:message="{
title: '附加金额',
cur: 'bddgrp.cbs.opn2.cur',
amt: 'aamset.utlamt2',
}"
></c-amtpanl>
<c-col :span="24">
<el-form-item label="发送承付电" prop="sftmt">
......
<template>
<div class="eibs-tab">
<c-col :span="12">
<c-col :span="span">
<c-col :span="12">
<el-form-item :label="message.title" :prop="message.cur">
<c-select
v-model="model[message.cur]"
v-model="cur"
maxlength="3"
:code="code"
@change="curChange"
placeholder="请选择币种"
></c-select>
</el-form-item>
......@@ -19,7 +20,7 @@
:prop="message.amt"
>
<c-input
v-model="model[message.amt]"
v-model="amt"
@change="amtChanged"
@input="amtInput"
:placeholder="'请输入' + message.title"
......@@ -32,29 +33,56 @@
<script>
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import _ from "~/utils/Lodash.js";
export default {
inject: ["root"],
mixins: [CommonProcess],
props: ["model", "message"],
//props: ["model", "message","span"],
props: {
model: {
type: Object,
default: undefined,
},
message: {
type: Object,
default: function () {
return {
title: "金额", //金额名称
cur: "cur", //币种字段路劲
amt: "amt", //金额字段路劲
fix: 3, //小数点位数
};
},
},
span: {
type: Number,
default: 12, //宽度,默认12
},
},
data() {
return {
code: [...CodeTable.cur],
data: [],
amt: this.amtGet(),
cur: this.curGet(),
};
},
methods: {
//金额格式化,默认保留三位小数
amtChanged(newamt) {
if (newamt === "" || newamt === undefined || newamt === null) {
this.model[this.message.amt] = "";
_.set(this.model, this.message.amt, "");
this.amt = "";
return;
}
newamt = newamt.replace(/^0+\./, "0.");
if (newamt === "" || newamt === undefined || newamt === null) {
this.model[this.message.amt] = "";
_.set(this.model, this.message.amt, "");
this.amt = "";
return;
}
newamt = newamt.replace(/^0+([0-9])/, "$1");
let fix = this.message.fix || 2;
let fix = this.message.fix || 3;
let idx = newamt.indexOf(".");
let segs = undefined;
if (idx > -1) segs = newamt.split(".");
......@@ -71,19 +99,35 @@ export default {
if (i && (1 + i) % 3 == 0 && i != preseg.length - 1)
npreseg = "," + npreseg;
}
this.model[this.message.amt] = `${segs[0] ? segs[0] : 0}.${segs[1]}`;
let amt = `${segs[0] ? segs[0] : 0}.${segs[1]}`;
_.set(this.model, this.message.amt, amt);
this.amt = amt;
},
//禁止输入非数字
amtInput(newamt) {
if (newamt === "" || newamt === undefined || newamt === null) {
this.model[this.message.amt] = "";
return;
}
this.model[this.message.amt] = newamt.replace(/[^\d.]/g, "");
let am = newamt.replace(/[^\d.]/g, "");
_.set(this.model, this.message.amt, am);
this.amt = am;
},
amtGet() {
return _.get(this.model, this.message.amt, "");
},
//cur改变
curChange() {
_.set(this.model, this.message.cur, this.cur);
},
curGet() {
return _.get(this.model, this.message.cur, "");
},
},
computed: {},
watch: {},
// methods: { ...Event },
created: function () {},
created: function () {
},
};
</script>
<style>
......
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