|
|
@ -21,6 +21,18 @@ |
|
|
|
:prop="item.keyName" |
|
|
|
:rules="item.rules || []" |
|
|
|
> |
|
|
|
<template v-if="item.type == 'switch'"> |
|
|
|
<el-switch |
|
|
|
v-model="fmData[item.keyName]" |
|
|
|
size="small" |
|
|
|
:active-text="item.activeText || ''" |
|
|
|
:inactive-text="item.inactiveText || ''" |
|
|
|
:active-value="item.activeValue || true" |
|
|
|
:inactive-value="item.inactiveValue || false" |
|
|
|
> |
|
|
|
</el-switch> |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-if="item.type == 'input'"> |
|
|
|
<el-input |
|
|
|
v-if=" |
|
|
@ -106,10 +118,14 @@ |
|
|
|
size="small" |
|
|
|
clearable |
|
|
|
class="item-select" |
|
|
|
:multiple="item.multiple || false" |
|
|
|
:filterable="item.filterable || false" |
|
|
|
:allowCreate="item.allowCreate || false" |
|
|
|
@change="(e) => handleChangeSelect(e, item)" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="subItem in item.optionList" |
|
|
|
:key="subItem.value" |
|
|
|
v-for="(subItem, subIndex) in item.optionList" |
|
|
|
:key="subItem.value + subIndex" |
|
|
|
:label="subItem.label" |
|
|
|
:value="subItem.value" |
|
|
|
> |
|
|
@ -126,7 +142,7 @@ |
|
|
|
:show-all-levels="false" |
|
|
|
size="small" |
|
|
|
clearable |
|
|
|
style="width: 240px" |
|
|
|
class="item-select" |
|
|
|
@change="(e) => handleChangeCascader(e, item)" |
|
|
|
> |
|
|
|
</el-cascader> |
|
|
@ -143,9 +159,11 @@ |
|
|
|
:file-list="item.showList" |
|
|
|
:on-success="(res, file) => handleImgSuccess(res, file, item)" |
|
|
|
:on-remove="(res) => handleImgRemove(res, item)" |
|
|
|
:before-upload="beforeImgUpload" |
|
|
|
:before-upload="(file) => beforeImgUpload(file, item)" |
|
|
|
> |
|
|
|
<a |
|
|
|
><i class="el-icon-plus avatar-uploader-icon"></i> 点击上传</a |
|
|
|
> |
|
|
|
<a><i class="el-icon-plus avatar-uploader-icon"></i> 点击上传</a> |
|
|
|
</el-upload> |
|
|
|
</template> |
|
|
|
|
|
|
@ -384,8 +402,16 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
handleChangeCascader(vals, item) { |
|
|
|
this.fmData[item["keyName"]] = vals; |
|
|
|
if (typeof item.handleChangeFn == "function") { |
|
|
|
item.handleChangeFn(vals, item); |
|
|
|
item.handleChangeFn(vals, item, this); |
|
|
|
} |
|
|
|
}, |
|
|
|
handleChangeSelect(vals, item) { |
|
|
|
console.log(vals, item); |
|
|
|
this.fmData[item["keyName"]] = vals; |
|
|
|
if (typeof item.handleChangeFn == "function") { |
|
|
|
item.handleChangeFn(vals, item, this); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -398,7 +424,7 @@ export default { |
|
|
|
|
|
|
|
handleImgRemove(file, item) { |
|
|
|
console.log("handleImgRemove", file); |
|
|
|
let url = file.url || file.response.data.url; |
|
|
|
let url = file.response ? file.response.data.url : file.url; |
|
|
|
if (url) { |
|
|
|
let { fmData } = this; |
|
|
|
this.fmData[item.keyName] = fmData[item.keyName].filter( |
|
|
@ -411,7 +437,8 @@ export default { |
|
|
|
); |
|
|
|
} |
|
|
|
if (item.supKeys.length > 1) { |
|
|
|
this.fmData[item.supKeys[1]] = item.supValues[0][0] || ""; |
|
|
|
this.fmData[item.supKeys[1]] = |
|
|
|
this.fmData[item.supKeys[0]][0] || ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -420,13 +447,19 @@ export default { |
|
|
|
handleImgSuccess(res, file, item) { |
|
|
|
console.log("handleImgSuccess", res); |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
this.fmData[item.keyName].push({ |
|
|
|
let { fmData } = this; |
|
|
|
let picItem = { |
|
|
|
url: res.data.url, |
|
|
|
name: file.name, |
|
|
|
size: file.size, |
|
|
|
type: file.type, |
|
|
|
format: file.name.split(".").pop(), |
|
|
|
}); |
|
|
|
}; |
|
|
|
if (Array.isArray(this.fmData[item.keyName])) { |
|
|
|
this.fmData[item.keyName].push(picItem); |
|
|
|
} else { |
|
|
|
this.fmData[item.keyName] = [picItem]; |
|
|
|
} |
|
|
|
if (item.supKeys && Array.isArray(item.supKeys)) { |
|
|
|
if (item.supKeys.length > 0) { |
|
|
|
this.fmData[item.supKeys[0]] = fmData[item.keyName].map( |
|
|
@ -434,7 +467,8 @@ export default { |
|
|
|
); |
|
|
|
} |
|
|
|
if (item.supKeys.length > 1) { |
|
|
|
this.fmData[item.supKeys[1]] = item.supValues[0][0] || ""; |
|
|
|
this.fmData[item.supKeys[1]] = |
|
|
|
this.fmData[item.supKeys[0]][0] || ""; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
@ -688,7 +722,7 @@ export default { |
|
|
|
width: 450px; |
|
|
|
} |
|
|
|
.item-select { |
|
|
|
width: 225px; |
|
|
|
width: 450px; |
|
|
|
} |
|
|
|
.item-number { |
|
|
|
width: 225px; |
|
|
|