Commit 1875b3bd by liuxin

补充xml格式展示

parent f4fef989
<template>
<el-input
:id="id"
ref="form-item"
v-model="value"
type="textarea"
v-bind="$attrs"
v-on="$listeners"
v-bind:disabled="isDisable"
:rows="maxRows"
resize="none"
@change="onChange"
/>
</template>
<script>
export default {
data: function () {
return {
value: "",
isXml: false,
};
},
props: {
maxRows: {
type: Number,
default: 3,
},
maxCols: {
type: Number,
default: 4,
},
disabled: {
type: Boolean,
default: false,
},
id: {
type: String,
default: undefined,
},
model: {
type: Object,
default: undefined,
},
},
computed: {
// model: {
// get() {
// let value = this.format(this.value);
// return value;
// },
// set(newVal) {
// this.$emit("input", newVal);
// },
// },
isDisable: {
get() {
return this.mode === "display" || this.disabled;
},
},
},
methods: {
show: function (rows) {
let strs = rows.length > 0 ? rows[0] : "";
var result = "";
if (strs.startsWith("<?xml")) {
this.isXml = true;
var pattern = /<tdfmt\s[^>]*>(.*)<\/tdfmt>/;
var temp = pattern.exec(strs);
if (temp != null) {
result = temp[1];
}
}
return result.replace(/<br\/>/g, "\n");
},
format: function (value) {
if(this.isXml){
var len = value.length;
value = value.replace(/\n/g, "<br/>")
var head = "<?xml version='1.0'?><tdfmt sel-start='" + len + "'>";
var tail = "</tdfmt>";
return head + value + tail;
}
return value;
},
onChange() {
if (this.model && this.model.rows) {
this.model["rows"][0] = this.format(this.value);
this.$emit("change", this.value);
}
},
},
watch: {
model: function () {
let rows = this.model["rows"] || [];
this.value = this.show(rows);
},
},
};
</script>
<style>
/* .el-input.highlight .el-input__inner{
border-color: red;
} */
</style>
\ No newline at end of file
......@@ -50,6 +50,7 @@ import InputSelect from "./InputSelect"
import Fullbox from "./Fullbox"
import CompareTable from "./CompareTable"
import InputXml from "./InputXml.vue"
export default {
install(Vue) {
......@@ -102,5 +103,6 @@ export default {
Vue.component("c-inputselect", InputSelect)
Vue.component("c-fullbox", Fullbox)
Vue.component("c-compare-table", CompareTable)
Vue.component("c-input-xml", InputXml)
}
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ export default {
],
"bedgrp.cbs.max.amt":[
{type: "strig", required: false, message: "必输项"},
{type: "string", required: false, message: "必输项"},
{max: 18,message:"整数位不能超过14位"},
{pattern: /(^\d+$)|(^\.\d{1,3}$)|(^\d+\.\d{1,3}$)/, message: "小数位不能超过3位" }
],
......
......@@ -5,14 +5,14 @@ export default class Mtabut {
oitinf: {
labinftxt: "", // Label for INFTXT .mtabut.coninf.oitinf.labinftxt
oit: {
inftxt: "", // Infotext .mtabut.coninf.oitinf.oit.inftxt
inftxt: {}, // Infotext .mtabut.coninf.oitinf.oit.inftxt
inflev: "", // Infotext Level .mtabut.coninf.oitinf.oit.inflev
},
},
oitset: {
labinftxt: "", // Label for INFTXT .mtabut.coninf.oitset.labinftxt
oit: {
inftxt: "", // Infotext .mtabut.coninf.oitset.oit.inftxt
inftxt: {}, // Infotext .mtabut.coninf.oitset.oit.inftxt
inflev: "", // Infotext Level .mtabut.coninf.oitset.oit.inflev
},
},
......
......@@ -7,16 +7,15 @@
label="General"
prop="mtabut.coninf.oitinf.oit.inftxt"
>
<i-stream-input
type="textarea"
rows="6"
<c-input-xml
:maxRows="6"
maxlength="60"
resize="none"
show-word-limit
placeholder="请输入Infotext"
@change="selectOrCheckboxRule('mtabut.coninf.oitinf.oit.inftxt')"
:model="model.mtabut.coninf.oitinf.oit.inftxt"
></i-stream-input>
></c-input-xml>
</el-form-item>
</c-col>
<c-col :span="7" :offset="1">
......@@ -41,16 +40,16 @@
label="Settlement"
prop="mtabut.coninf.oitset.oit.inftxt"
>
<i-stream-input
<c-input-xml
type="textarea"
rows="6"
:maxRows="6"
maxlength="60"
resize="none"
show-word-limit
placeholder="请输入Infotext"
@change="selectOrCheckboxRule('mtabut.coninf.oitset.oit.inftxt')"
:model="model.mtabut.coninf.oitset.oit.inftxt"
></i-stream-input>
></c-input-xml>
</el-form-item>
</c-col>
<c-col :span="7" :offset="1">
......
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