Commit 5ce7025c authored by 周远喜's avatar 周远喜

ok

parent 3b288b5f
......@@ -36,6 +36,7 @@
</div>
</template>
<script>
import util from '@/libs/util';
export default {
name: "files",
model: {
......@@ -185,7 +186,7 @@ export default {
this.postUrl =
fileUrl +
"/upload/?token=Bearer " +
window.sessionStorage.getItem("token") +
util.cookies.get('token') +
"&" +
this.convertObj(this.parms);
//是否显示上传按钮
......
<!--一次只能上传一个文件 -->
<template>
<div>
<Input v-model="newName" style="height:30px;width:240px;float:left" placeholder="请选择上传文件" disabled />
<Input v-model="newName" placeholder="请选择上传文件">
<Button v-if="view" icon="ios-eye" slot="prepend"> </Button>
<Button type="primary" icon="ios-cloud-upload-outline" slot="append" @click="handler">上传</Button>
</Input>
<Upload
v-model="name"
:action="postUrl"
......@@ -16,36 +19,37 @@
:files="files"
:on-progress="onProgress"
>
<Button icon="ios-cloud-upload-outline">上传文件</Button>
<Button v-show="1==2" type="primary" ref="upload">上传</Button>
</Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro"/>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro" />
</div>
</template>
<script>
import util from "@/libs/util";
export default {
name: 'inputFile',
name: "inputFile",
model: {
prop: 'value',
event: 'on-change'
prop: "value",
event: "on-change"
},
data() {
return {
file: null,
name: this.value,
downUrl: fileUrlDown,
fileUrlPath: '',
fileUrlPath: "",
nameList: [],
postUrl:
fileUrl +
'/upload/?token=Bearer ' +
window.sessionStorage.getItem('token') +
'&' +
"/upload/?token=Bearer " +
util.cookies.get("token") +
"&" +
this.parms,
formatList: ['png', 'jpg', 'gif'],
newName: '',
formatList: ["png", "jpg", "gif"],
newName: "",
per: 0,
vshowPro: false
}
};
},
created() {},
props: {
......@@ -60,55 +64,58 @@ export default {
},
parms: {
type: String,
default: ''
default: ""
}
},
methods: {
onProgress(event, file, fileList) {
this.per = 0
this.vshowPro = true
this.per = 0;
this.vshowPro = true;
},
handler() {
this.$refs.upload.$el.click();
},
// change(event) {
// this.$emit('on-change', event.target.value)
// },
//上传成功文件
uploadSuccess(response, file, fileList) {
this.per = 60
this.vshowPro = true
const hbaseFileList = []
const filesList = []
this.per = 60;
this.vshowPro = true;
const hbaseFileList = [];
const filesList = [];
if (file.response.status == 0) {
let objImag = {}
objImag.fileName = file.response.data.fileName
objImag.filePath = file.response.data.downloadPath
filesList.push(objImag)
this.newName = file.response.data.fileName
this.$emit('on-change', JSON.stringify(filesList))
this.per = 100
let objImag = {};
objImag.fileName = file.response.data.fileName;
objImag.filePath = file.response.data.downloadPath;
filesList.push(objImag);
this.newName = file.response.data.downloadPath;
this.$emit("on-change", JSON.stringify(filesList));
this.per = 100;
setTimeout(() => {
this.per = 0
this.vshowPro = false
}, 2000)
this.per = 0;
this.vshowPro = false;
}, 2000);
} else {
this.$Message.error('上传失败,请重新上传!')
this.$Message.error("上传失败,请重新上传!");
}
},
//上传文件失败
uploadError(response, file, fileList) {
this.$Message.error('上传失败,请重新上传!')
this.$Message.error("上传失败,请重新上传!");
},
//文件大小验证返回
onExceededSize(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error(
'上传文件不能大于' + this.maxSize + 'k,请重新上传!'
)
"上传文件不能大于" + this.maxSize + "k,请重新上传!"
);
}
},
//文件格式验证
onFormatError(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error('上传文件格式不正确,请重新上传!')
this.$Message.error("上传文件格式不正确,请重新上传!");
}
},
//删除上传
......@@ -116,36 +123,39 @@ export default {
formatL() {
if (this.files) {
this.formatList = [
'pdf',
'docx',
'doc',
'xls',
'xlsx',
'txt',
'png',
'jpg',
'gif',
'zip',
'rar'
]
"pdf",
"docx",
"doc",
"xls",
"xlsx",
"txt",
"png",
"jpg",
"gif",
"zip",
"rar"
];
}
return this.formatList
return this.formatList;
}
},
mounted() {
this.formatL()
this.formatL();
},
computed: {
nativeInputValue() {
return this.value === null || this.value === undefined ? '' : this.value
return this.value === null || this.value === undefined ? "" : this.value;
},
view(){
return true
}
},
watch: {
value(v) {
this.name = v
this.name = v;
}
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -112,7 +112,8 @@
</Col>
<Col :span="24">
<FormItem :label="l('qualityTemplateName')" prop="qualityTemplateName">
<files ref="refFile" :parms="parms" files singleFile />
<!-- <files ref="refFile" :parms="parms" files singleFile /> -->
<InputFile v-model="entity.qualityTemplateName"/>
</FormItem>
</Col>
<!--
......
......@@ -7,6 +7,7 @@
<Input
placeholder="请输入检测要求/标准指标"
v-model="easySearch.keys.value"
v-width="200"
/>
</FormItem>
<FormItem>
......
......@@ -32,7 +32,7 @@ import clipboard from 'clipboard';
import radioButton from '@/components/page/radioButton.vue'
import InputIcon from '@/components/page/inputIcon.vue'
import checkBoxButton from '@/components/page/checkBoxButton.vue'
import inputFile from '@/components/page/inputFile.vue'
import InputFile from '@/components/page/inputFile.vue'
import imgUploadFile from '@/components/page/imgUploadFile.vue'
import files from '@/components/page/files.vue'
import FilesList from '@/components/page/filesList.vue'
......@@ -74,7 +74,7 @@ Vue.component("State", State)
Vue.component("Dictionary", Dictionary)
Vue.component("radioButton", radioButton)
Vue.component("checkBoxButton", checkBoxButton)
Vue.component("inputFile", inputFile)
Vue.component("InputFile", InputFile)
Vue.component("imgUploadFile", imgUploadFile)
Vue.component("InputIcon", InputIcon)
Vue.component("files", files)
......
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