|
|
|
|
@ -54,6 +54,7 @@ export default {
|
|
|
|
|
props: {
|
|
|
|
|
label: i.name,
|
|
|
|
|
prop: i.field,
|
|
|
|
|
required: i.validation instanceof Array ? !!i.validation.find(i => i === 'required') : false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[
|
|
|
|
|
@ -61,6 +62,9 @@ export default {
|
|
|
|
|
domMap.get(i.edit_input),
|
|
|
|
|
{
|
|
|
|
|
ref: `elEdit_${i.field}`,
|
|
|
|
|
style: {
|
|
|
|
|
width: '100%'
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
...addPropsMap.get(i.edit_input),
|
|
|
|
|
...this.extraProps(i),
|
|
|
|
|
@ -152,26 +156,14 @@ export default {
|
|
|
|
|
|
|
|
|
|
//渲染一些组件内部需要选项等
|
|
|
|
|
optionsRender(h, info) {
|
|
|
|
|
if (info.edit_input === "radio") {
|
|
|
|
|
if (info.edit_input === "checkbox" || info.edit_input === "radio") {
|
|
|
|
|
return info._paramters && info._paramters instanceof Array
|
|
|
|
|
? info._paramters.map((i) =>
|
|
|
|
|
h(
|
|
|
|
|
"el-radio",
|
|
|
|
|
{ props: { label: i.id } },
|
|
|
|
|
i.name || i.no || i.value || i.id
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
: [];
|
|
|
|
|
}
|
|
|
|
|
if (info.edit_input === "checkbox") {
|
|
|
|
|
return info._paramters && info._paramters instanceof Array
|
|
|
|
|
? info._paramters.map((i) =>
|
|
|
|
|
h(
|
|
|
|
|
"el-checkbox",
|
|
|
|
|
{ props: { label: i.id } },
|
|
|
|
|
i.name || i.no || i.value || i.id
|
|
|
|
|
)
|
|
|
|
|
h(
|
|
|
|
|
"el-option",
|
|
|
|
|
{ props: { label: i.name || i.no || i.value || i.id , value : i.id } }
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
: [];
|
|
|
|
|
}
|
|
|
|
|
if (info.edit_input === "file" || info.edit_input === "files") {
|
|
|
|
|
@ -330,7 +322,7 @@ export default {
|
|
|
|
|
newVal.forEach((i) => {
|
|
|
|
|
if (i.field) {
|
|
|
|
|
this.form[i.field] = "";
|
|
|
|
|
if (i.validation instanceof Array && i.validation.length > 0) {
|
|
|
|
|
if (i.validation instanceof Array && i.validation.length > 0 && !!i.validation.find(i => i === 'required')) {
|
|
|
|
|
this.rules[i.field] = [
|
|
|
|
|
{ required: true, message: `请填写${i.name}` },
|
|
|
|
|
];
|
|
|
|
|
@ -355,6 +347,7 @@ export default {
|
|
|
|
|
this.$nextTick(() => this.getDetail());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.file = {};
|
|
|
|
|
this.id = "";
|
|
|
|
|
this.type = "";
|
|
|
|
|
this.init();
|
|
|
|
|
|