Commit 07a50d43 authored by 徐一鸣's avatar 徐一鸣

Merge branch 'dev' of cloud.wodcloud.com:apaas/apaas-v3-ui into dev

parents 72863503 99e79be3
<template> <template>
<div> <div>
<div v-if="type == 'cropper'"> <div v-if="type == 'cropper'">
<cropper :max="max" :readOnly="readOnly" :fileArray="fileArray" :fit="fit" @getNewUrl="getNewUrl"></cropper> <cropper
:max="max"
:readOnly="readOnly"
:fileArray="fileArray"
:fit="fit"
@getNewUrl="getNewUrl"
></cropper>
</div> </div>
<div v-else> <div v-else>
<el-upload <el-upload
...@@ -38,50 +44,54 @@ ...@@ -38,50 +44,54 @@
import cropper from "@/components/general/cropper"; import cropper from "@/components/general/cropper";
export default { export default {
components: { components: {
cropper cropper,
}, },
data() { data() {
return { return {
hideUpload: false, hideUpload: false,
fileArray: [], fileArray: [],
anotherData: { anotherData: {
directory: "file" directory: "file",
} },
}; };
}, },
props: { props: {
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
directory: { directory: {
type: String, type: String,
default: '' default: "",
}, },
max: { max: {
type: Number, type: Number,
default: 1 default: 1,
}, },
list: { list: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
type: { type: {
type: String, type: String,
default: "" default: "",
}, },
readOnly: { readOnly: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
fit: { fit: {
type: String, type: String,
default: "" default: "",
}, },
drag: { drag: {
type: Boolean, type: Boolean,
default: false default: false,
} },
unique: {
type: Boolean,
default: false,
},
}, },
watch: { watch: {
list(value) { list(value) {
...@@ -90,19 +100,20 @@ export default { ...@@ -90,19 +100,20 @@ export default {
for (var i = 0; i < value.length; i++) { for (var i = 0; i < value.length; i++) {
getListImg.push({ getListImg.push({
name: value[i], name: value[i],
url: value[i] url: value[i],
}); });
} }
} }
this.fileArray = [...getListImg]; this.fileArray = [...getListImg];
this.hideUpload = this.fileArray.length >= this.max; this.hideUpload = this.fileArray.length >= this.max;
} },
}, },
created(){ created() {
if(this.directory){ if (this.directory) {
this.anotherData={ this.anotherData = {
directory: this.directory directory: this.directory,
} "unique-code": this.unique ? "" : false,
};
} }
}, },
methods: { methods: {
...@@ -128,7 +139,6 @@ export default { ...@@ -128,7 +139,6 @@ export default {
} }
return isJPG && isLt10M; return isJPG && isLt10M;
} else { } else {
} }
}, },
handleAvatarSuccess(response, file, fileList) { handleAvatarSuccess(response, file, fileList) {
...@@ -137,7 +147,7 @@ export default { ...@@ -137,7 +147,7 @@ export default {
if (response.success == 1) { if (response.success == 1) {
this.fileArray.push({ this.fileArray.push({
url: response.data, url: response.data,
name: file.name name: file.name,
}); });
} }
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
...@@ -146,7 +156,7 @@ export default { ...@@ -146,7 +156,7 @@ export default {
this.fileArray.push({ this.fileArray.push({
url: response.data, url: response.data,
name: file.name, name: file.name,
size: file.size size: file.size,
}); });
} }
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
...@@ -154,7 +164,7 @@ export default { ...@@ -154,7 +164,7 @@ export default {
if (response.success == 1) { if (response.success == 1) {
this.fileArray.push({ this.fileArray.push({
url: response.data, url: response.data,
name: file.name name: file.name,
}); });
} }
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
...@@ -181,21 +191,24 @@ export default { ...@@ -181,21 +191,24 @@ export default {
} }
}); });
} }
this.hideUpload = fileList.length >= this.max; this.hideUpload = fileList.length >= this.max;
this.$emit("getNewList", this.fileArray); this.$emit("getNewList", this.fileArray);
}, },
remove_pic(){ remove_pic() {
document.querySelector('.eeupload').querySelector('.el-upload-list__item-delete').click(); document
setTimeout(()=>{ .querySelector(".eeupload")
document.querySelector('.eeupload').querySelector('.el-upload').click(); .querySelector(".el-upload-list__item-delete")
},1000) .click();
setTimeout(() => {
document.querySelector(".eeupload").querySelector(".el-upload").click();
}, 1000);
}, },
getNewUrl(val) { getNewUrl(val) {
let fileObj = [{ name: val, url: val }]; let fileObj = [{ name: val, url: val }];
this.$emit("getNewList", fileObj); this.$emit("getNewList", fileObj);
} },
} },
}; };
</script> </script>
<style> <style>
......
...@@ -232,6 +232,7 @@ ...@@ -232,6 +232,7 @@
<info-list :list_arr="docTemplate" class="doc_template"></info-list> <info-list :list_arr="docTemplate" class="doc_template"></info-list>
<upload-file <upload-file
:multiple="false" :multiple="false"
:unique="false"
:max="1" :max="1"
type="zip" type="zip"
:readOnly="false" :readOnly="false"
...@@ -509,6 +510,7 @@ ...@@ -509,6 +510,7 @@
<info-list :list_arr="docTemplate" class="doc_template"></info-list> <info-list :list_arr="docTemplate" class="doc_template"></info-list>
<upload-file <upload-file
:multiple="false" :multiple="false"
:unique="false"
:max="1" :max="1"
type="zip" type="zip"
:readOnly="false" :readOnly="false"
......
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
} }
}, },
data: () => ({ data: () => ({
selectValue: "0" selectValue: 0
}), }),
mounted() { mounted() {
this.selectValue = this.item; this.selectValue = this.item;
......
...@@ -408,8 +408,8 @@ export default { ...@@ -408,8 +408,8 @@ export default {
align: "left", align: "left",
width: 100, width: 100,
selectArr: [ selectArr: [
{ label: "", value: "1" }, { label: "", value: 1 },
{ label: "", value: "0" } { label: "", value: 0 }
], ],
hasDefault: true hasDefault: true
}, },
......
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