Commit ad389081 by zhengxiaokui

amtpanl

parent fdb6386a
<template> <template>
<el-select <el-select
:id="id" v-model="model" v-bind="attrs" :id="id"
v-on="$listeners" v-bind:disabled="isDisable" :clearable="clearable" @click.native="handleClick" > v-model="model"
<slot></slot> 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> </el-select>
</template> </template>
...@@ -11,61 +26,66 @@ export default { ...@@ -11,61 +26,66 @@ export default {
props: { props: {
value: { value: {
type: [String, Array, Number], type: [String, Array, Number],
default: undefined default: undefined,
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
clearable: { clearable: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
id: { id: {
type: String, type: String,
default: undefined default: undefined,
} },
code: {
type: Array,
default: function () {
return [];
},
},
}, },
computed: { computed: {
model: { model: {
get() { get() {
return this.value return this.value;
}, },
set(newVal) { set(newVal) {
this.$emit('input', newVal) this.$emit("input", newVal);
} },
}, },
mode() { mode() {
return this.$store.state.Status.mode return this.$store.state.Status.mode;
}, },
isDisable: { isDisable: {
get() { get() {
return this.mode === 'display' || this.disabled return this.mode === "display" || this.disabled;
} },
}, },
highlight () { highlight() {
return this.$store.state.Status.highlights.indexOf(this.id) !== -1 return this.$store.state.Status.highlights.indexOf(this.id) !== -1;
}, },
attrs(){ attrs() {
if(this.mode === 'display' || this.disabled) if (this.mode === "display" || this.disabled) {
{ let { placeholder, ...rest } = this.$attrs;
let {placeholder,...rest} = this.$attrs rest = { placeholder: " ", ...rest };
rest = {placeholder:" ",...rest} return rest;
return rest
} }
return this.$attrs return this.$attrs;
} },
}, },
methods: { methods: {
handleClick: function (e) { handleClick: function (e) {
let ev = new Event("click", {"bubbles": true}) let ev = new Event("click", { bubbles: true });
let node = e.target let node = e.target;
if (node.parentElement) { if (node.parentElement) {
node.parentElement.dispatchEvent(ev) node.parentElement.dispatchEvent(ev);
} }
} },
} },
} };
</script> </script>
<style> <style>
......
...@@ -4,55 +4,55 @@ import Utils from "~/utils" ...@@ -4,55 +4,55 @@ import Utils from "~/utils"
* Bdtudp Check规则 * Bdtudp Check规则
*/ */
let checkObj = { let checkObj = {
"bddgrp.tag72add" :null, "bddgrp.tag72add": null,
"liaall.misamt" :null, "liaall.misamt": null,
"liaall.limmod.limpts.oth.pts.extkey" :null, "liaall.limmod.limpts.oth.pts.extkey": null,
"bddgrp.acb.adrelc" :null, "bddgrp.acb.adrelc": null,
"bddgrp.rec.disdat" :null, "bddgrp.rec.disdat": null,
"bdtp.oth.pts.extkey" :null, "bdtp.oth.pts.extkey": null,
"liaall.limmod.ownref" :null, "liaall.limmod.ownref": null,
"liaall.limmod.ecifno" :null, "liaall.limmod.ecifno": null,
"bddgrp.beb.pts.extkey" :null, "bddgrp.beb.pts.extkey": null,
"bddgrp.beb.pts.adrblk" :null, "bddgrp.beb.pts.adrblk": null,
"liaall.limmod.othp.ptsget.sdamod.dadsnd" :null, "liaall.limmod.othp.ptsget.sdamod.dadsnd": null,
"bddgrp.rec.docflg" :null, "bddgrp.rec.docflg": null,
"bdtp.furide" :null, "bdtp.furide": null,
"bddgrp.blk.docdis" :null, "bddgrp.blk.docdis": null,
"setmod.dspflg" :null, "setmod.dspflg": null,
"bddgrp.prb.pts.ref" :null, "bddgrp.prb.pts.ref": null,
"bddgrp.acb.pts.extkey" :null, "bddgrp.acb.pts.extkey": null,
"bddgrp.blk.accrmk" :null, "bddgrp.blk.accrmk": null,
"bddgrp.prb.pts.extkey" :null, "bddgrp.prb.pts.extkey": null,
"bddgrp.rec.expdat" :null, "bddgrp.rec.expdat": null,
"bddgrp.beb.adrelc" :null, "bddgrp.beb.adrelc": null,
"bddgrp.shp.namelc" :null, "bddgrp.shp.namelc": null,
"liaall.liaccv.totcovamt" :null, "liaall.liaccv.totcovamt": null,
"aamset.utlamt2" :null, "aamset.utlamt2": null,
"bddgrp.acb.pts.adrblk" :null, "bddgrp.acb.pts.adrblk": null,
"bddgrp.acb.namelc" :null, "bddgrp.acb.namelc": null,
"bddgrp.beb.namelc" :null, "bddgrp.beb.namelc": null,
"bddgrp.rec.rcvdat" :null, "bddgrp.rec.rcvdat": null,
"bddgrp.shp.pts.adrblk" :null, "bddgrp.shp.pts.adrblk": null,
"liaall.limmod.limpts.wrk.pts.extkey" :null, "liaall.limmod.limpts.wrk.pts.extkey": null,
"bdtp.acbp.ptsget.sdamod.dadsnd" :null, "bdtp.acbp.ptsget.sdamod.dadsnd": null,
"bddgrp.blk.comcon" :null, "bddgrp.blk.comcon": null,
"bddgrp.prb.pts.bankno" :null, "bddgrp.prb.pts.bankno": null,
"bddgrp.rec.reltyp" :null, "bddgrp.rec.reltyp": null,
"bddgrp.rec.relgodflg" :null, "bddgrp.rec.relgodflg": null,
"bdtp.shpp.ptsget.sdamod.dadsnd" :null, "bdtp.shpp.ptsget.sdamod.dadsnd": null,
"mtabut.coninf.conexedat" :null, "mtabut.coninf.conexedat": null,
"bdtp.recget.sdamod.dadsnd" :null, "bdtp.recget.sdamod.dadsnd": null,
"liaall.limmod.limpts.nonrevflg1" :null, "liaall.limmod.limpts.nonrevflg1": null,
"bddgrp.shp.adrelc" :null, "bddgrp.shp.adrelc": null,
"liaall.limmod.wrkp.ptsget.sdamod.dadsnd" :null, "liaall.limmod.wrkp.ptsget.sdamod.dadsnd": null,
"setmod.docamt" :null, "setmod.docamt": null,
"bdtp.bebp.ptsget.sdamod.dadsnd" :null, "bdtp.bebp.ptsget.sdamod.dadsnd": null,
"liaall.liaccv.cshpct" :null, "liaall.liaccv.cshpct": null,
"bdtp.oth.pts.bankno" :null, "bdtp.oth.pts.bankno": null,
"bdtp.didget.sdamod.dadsnd" :null, "bdtp.didget.sdamod.dadsnd": null,
"bddgrp.shp.pts.extkey" :null, "bddgrp.shp.pts.extkey": null,
"bddgrp.rec.trpdocnum" :null, "bddgrp.rec.trpdocnum": null,
"liaall.liaccv.relcshpct" :null, "liaall.liaccv.relcshpct": null,
} }
for (const key in checkObj) { for (const key in checkObj) {
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
{ max: 3, message: "长度不能超过3" } { max: 3, message: "长度不能超过3" }
], ],
"didgrp.cbs.opn1.amt": [ "didgrp.cbs.opn1.amt": [
{ required: false, message: "必输项" }, { required: true, message: "必输项" },
{ max: 18, message: "整数位不能超过14位" }, { max: 18, message: "整数位不能超过14位" },
{ pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" } { pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" }
], ],
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
], ],
"bddgrp.cbs.max.amt": [ "bddgrp.cbs.max.amt": [
{ required: false, message: "必输项" }, { required: true, message: "必输项" },
{ max: 18, message: "整数位不能超过14位" }, { max: 18, message: "整数位不能超过14位" },
{ pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" } { 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 @@ ...@@ -12,40 +12,6 @@
</el-form-item> </el-form-item>
</c-col> </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 <c-amtpanl
:model="model" :model="model"
:message="{ :message="{
...@@ -79,56 +45,25 @@ ...@@ -79,56 +45,25 @@
<c-row> <c-row>
<c-col :span="12"> <c-col :span="12">
<c-row> <c-row>
<c-col :span="24"> <c-amtpanl
<c-col :span="12"> :model="model"
<el-form-item label="单据金额" prop="bddgrp.cbs.max.cur"> :span="24"
<c-select :message="{
v-model="model.bddgrp.cbs.max.cur" title: '单据金额',
style="width: 100%" cur: 'bddgrp.cbs.max.cur',
placeholder="请选择单据币种" amt: 'bddgrp.cbs.max.amt',
> }"
</c-select> ></c-amtpanl>
</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-col :span="24"> <c-amtpanl
<c-col :span="12"> :model="model"
<el-form-item label="单据余额" prop="bddgrp.cbs.opn1.cur"> :span="24"
<c-select :message="{
v-model="model.bddgrp.cbs.opn1.cur" title: '单据余额',
maxlength="3" cur: 'bddgrp.cbs.opn1.cur',
placeholder="请选择单据余额" amt: 'bddgrp.cbs.opn1.amt',
></c-select> }"
</el-form-item> ></c-amtpanl>
</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-row> </c-row>
</c-col> </c-col>
...@@ -245,55 +180,25 @@ ...@@ -245,55 +180,25 @@
</el-form-item> </el-form-item>
</c-col> </c-col>
<c-col :span="24"> <c-amtpanl
<c-col :span="12"> :span="24"
<el-form-item label="承兑金额" prop="setmod.doccur"> :model="model"
<c-select :message="{
v-model="model.setmod.doccur" title: '承兑金额',
maxlength="3" cur: 'setmod.doccur',
placeholder="请选择承兑币种" amt: 'setmod.docamt',
></c-select> }"
</el-form-item> ></c-amtpanl>
</c-col>
<c-col :span="12"> <c-amtpanl
<el-form-item :model="model"
label="" :span="24"
style="margin-left: -230px !important" :message="{
prop="setmod.docamt" title: '单据金额',
> cur: 'bddgrp.cbs.opn2.cur',
<c-input amt: 'aamset.utlamt',
v-model="model.setmod.docamt" }"
placeholder="请输入承兑金额" ></c-amtpanl>
></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-row> </c-row>
</c-col> </c-col>
...@@ -312,30 +217,14 @@ ...@@ -312,30 +217,14 @@
<c-row> <c-row>
<c-col :span="12"> <c-col :span="12">
<c-row> <c-row>
<c-col :span="24"> <c-amtpanl
<c-col :span="12"> :model="model"
<el-form-item label="附加金额" prop="bddgrp.cbs.opn2.cur"> :message="{
<c-select title: '附加金额',
v-model="model.bddgrp.cbs.opn2.cur" cur: 'bddgrp.cbs.opn2.cur',
maxlength="3" amt: 'aamset.utlamt2',
placeholder="请选择附加金额币种" }"
></c-select> ></c-amtpanl>
</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-col :span="24"> <c-col :span="24">
<el-form-item label="发送承付电" prop="sftmt"> <el-form-item label="发送承付电" prop="sftmt">
......
<template> <template>
<div class="eibs-tab"> <div class="eibs-tab">
<c-col :span="12"> <c-col :span="span">
<c-col :span="12"> <c-col :span="12">
<el-form-item :label="message.title" :prop="message.cur"> <el-form-item :label="message.title" :prop="message.cur">
<c-select <c-select
v-model="model[message.cur]" v-model="cur"
maxlength="3" maxlength="3"
:code="code" :code="code"
@change="curChange"
placeholder="请选择币种" placeholder="请选择币种"
></c-select> ></c-select>
</el-form-item> </el-form-item>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
:prop="message.amt" :prop="message.amt"
> >
<c-input <c-input
v-model="model[message.amt]" v-model="amt"
@change="amtChanged" @change="amtChanged"
@input="amtInput" @input="amtInput"
:placeholder="'请输入' + message.title" :placeholder="'请输入' + message.title"
...@@ -32,29 +33,56 @@ ...@@ -32,29 +33,56 @@
<script> <script>
import CommonProcess from "~/mixin/CommonProcess"; import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable"; import CodeTable from "~/config/CodeTable";
import _ from "~/utils/Lodash.js";
export default { export default {
inject: ["root"], inject: ["root"],
mixins: [CommonProcess], 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() { data() {
return { return {
code: [...CodeTable.cur], code: [...CodeTable.cur],
data: [], amt: this.amtGet(),
cur: this.curGet(),
}; };
}, },
methods: { methods: {
//金额格式化,默认保留三位小数
amtChanged(newamt) { amtChanged(newamt) {
if (newamt === "" || newamt === undefined || newamt === null) { if (newamt === "" || newamt === undefined || newamt === null) {
this.model[this.message.amt] = ""; _.set(this.model, this.message.amt, "");
this.amt = "";
return; return;
} }
newamt = newamt.replace(/^0+\./, "0."); newamt = newamt.replace(/^0+\./, "0.");
if (newamt === "" || newamt === undefined || newamt === null) { if (newamt === "" || newamt === undefined || newamt === null) {
this.model[this.message.amt] = ""; _.set(this.model, this.message.amt, "");
this.amt = "";
return; return;
} }
newamt = newamt.replace(/^0+([0-9])/, "$1"); newamt = newamt.replace(/^0+([0-9])/, "$1");
let fix = this.message.fix || 2; let fix = this.message.fix || 3;
let idx = newamt.indexOf("."); let idx = newamt.indexOf(".");
let segs = undefined; let segs = undefined;
if (idx > -1) segs = newamt.split("."); if (idx > -1) segs = newamt.split(".");
...@@ -71,19 +99,35 @@ export default { ...@@ -71,19 +99,35 @@ export default {
if (i && (1 + i) % 3 == 0 && i != preseg.length - 1) if (i && (1 + i) % 3 == 0 && i != preseg.length - 1)
npreseg = "," + npreseg; 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) { amtInput(newamt) {
if (newamt === "" || newamt === undefined || newamt === null) { let am = newamt.replace(/[^\d.]/g, "");
this.model[this.message.amt] = ""; _.set(this.model, this.message.amt, am);
return; this.amt = am;
} },
this.model[this.message.amt] = newamt.replace(/[^\d.]/g, "");
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: {}, watch: {},
// methods: { ...Event }, // methods: { ...Event },
created: function () {}, created: function () {
},
}; };
</script> </script>
<style> <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