Commit 76a32afb authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 317317e0 5e178bdc
+ eslint-plugin-node@11.1.0
added 3 packages from 2 contributors, updated 1 package and moved 1 package in 24.979s
<template> <template>
<div> <div>
<Input v-model="newName" placeholder="请选择上传文件" disabled> <Input v-model="newName" placeholder="请选择上传文件" disabled>
<Button v-if="view" icon="md-download" slot="prepend" @click="downFile(newName)"> </Button> <Button v-if="view" icon="md-download" slot="prepend" @click="downFile(newName)"> </Button>
<Button type="primary" icon="ios-cloud-upload-outline" slot="append" @click="handler">上传</Button> <Button type="primary" icon="ios-cloud-upload-outline" slot="append" @click="handler">上传</Button>
</Input> </Input>
<Upload <Upload v-model="name" :action="postUrl" :on-success="uploadSuccess" :on-error="uploadError" :on-remove="removeFile" :format="formatList" :max-size="maxSize" :on-exceeded-size="onExceededSize" :on-format-error="onFormatError" :show-upload-list="false" :files="files" :on-progress="onProgress">
v-model="name" <Button v-show="1==2" type="primary" ref="upload">上传</Button>
:action="postUrl"
:on-success="uploadSuccess"
:on-error="uploadError"
:on-remove="removeFile"
:format="formatList"
:max-size="maxSize"
:on-exceeded-size="onExceededSize"
:on-format-error="onFormatError"
:show-upload-list="false"
:files="files"
:on-progress="onProgress"
>
<Button v-show="1==2" type="primary" ref="upload">上传</Button>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro" /> <Progress :percent="per" :stroke-width="5" v-show="vshowPro" />
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
name: "inputExcel", name: "inputExcel",
model: { model: {
prop: "value", prop: "value",
event: "on-change" event: "on-change"
},
data() {
return {
file: null,
name: this.value,
downUrl: fileUrlDown,
fileUrlPath: "",
nameList: [],
postUrl:
fileUrl +
"/upload/?token=Bearer " +
util.cookies.get("token") +
"&" +
this.parms,
formatList: ["xlsx", "xls"],
newName: "",
newPath: "",
per: 0,
vshowPro: false
};
},
created() {},
props: {
value: [String, Number, Array, Object],
maxSize: {
type: Number,
default: 10240
}, },
files: { data() {
type: Boolean, return {
default: false file: null,
name: this.value,
downUrl: fileUrlDown,
fileUrlPath: "",
nameList: [],
postUrl: fileUrl +
"/upload/?token=Bearer " +
util.cookies.get("token") +
"&" +
this.parms,
formatList: ["xlsx", "xls", "jpg", "gif", "png", "pdf", "docx", "doc", "txt", "rar", "zip"],
newName: "",
newPath: "",
per: 0,
vshowPro: false
};
}, },
parms: { created() {},
type: String, props: {
default: "" value: [String, Number, Array, Object],
}, maxSize: {
showButton: { type: Number,
type: Boolean, default: 10240
default: true },
} files: {
}, type: Boolean,
methods: { default: false
onProgress(event, file, fileList) { },
this.per = 0; parms: {
this.vshowPro = true; type: String,
}, default: ""
handler() { },
this.$refs.upload.$el.click(); showButton: {
}, type: Boolean,
// change(event) { default: true
// this.$emit('on-change', event.target.value) }
// },
//上传成功文件
uploadSuccess(response, file, fileList) {
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.newPath = file.response.data.downloadPath;
this.$emit("on-change", JSON.stringify(filesList));
this.per = 100;
setTimeout(() => {
this.per = 0;
this.vshowPro = false;
}, 2000);
} else {
this.$Message.error("上传失败,请重新上传!");
}
},
//上传文件失败
uploadError(response, file, fileList) {
this.$Message.error("上传失败,请重新上传!");
},
//文件大小验证返回
onExceededSize(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error(
"上传文件不能大于" + this.maxSize + "k,请重新上传!"
);
}
}, },
//文件格式验证 methods: {
onFormatError(file, fileList) { onProgress(event, file, fileList) {
if (Object.keys(file).length == 0) { this.per = 0;
this.$Message.error("上传文件格式不正确,请重新上传!"); 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 = [];
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.newPath = file.response.data.downloadPath;
this.$emit("on-change", JSON.stringify(filesList));
this.per = 100;
setTimeout(() => {
this.per = 0;
this.vshowPro = false;
}, 2000);
} else {
this.$Message.error("上传失败,请重新上传!");
}
},
//上传文件失败
uploadError(response, file, fileList) {
this.$Message.error("上传失败,请重新上传!");
},
//文件大小验证返回
onExceededSize(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error(
"上传文件不能大于" + this.maxSize + "k,请重新上传!"
);
}
},
//文件格式验证
onFormatError(file, fileList) {
if (Object.keys(file).length == 0) {
this.$Message.error("上传文件格式不正确,请重新上传!");
}
},
//删除上传
removeFile(file, fileList) {},
formatL() {
if (this.files) {
this.formatList = [
"pdf",
"docx",
"doc",
"xls",
"xlsx",
"txt",
"png",
"jpg",
"gif",
"zip",
"rar"
];
}
return this.formatList;
},
downFile(path) {
let truePath = path.trim();
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
}
}, },
//删除上传 mounted() {
removeFile(file, fileList) {}, this.formatL();
formatL() {
if (this.files) {
this.formatList = [
"pdf",
"docx",
"doc",
"xls",
"xlsx",
"txt",
"png",
"jpg",
"gif",
"zip",
"rar"
];
}
return this.formatList;
}, },
downFile(path) { computed: {
let truePath = path.trim(); nativeInputValue() {
if (truePath.length > 2) { return this.value === null || this.value === undefined ? "" : this.value;
if ( },
truePath.substring(0, 7).toLowerCase() == "http://" || view() {
truePath.substring(0, 8).toLowerCase() == "https://" return true
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
} }
}
}
},
mounted() {
this.formatL();
},
computed: {
nativeInputValue() {
return this.value === null || this.value === undefined ? "" : this.value;
}, },
view(){ watch: {
return true value(v) {
} this.name = v;
}, }
watch: {
value(v) {
this.name = v;
} }
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
This diff is collapsed.
...@@ -25,11 +25,8 @@ ...@@ -25,11 +25,8 @@
"gantt-elastic": "^1.0.11", "gantt-elastic": "^1.0.11",
"gantt-elastic-header": "^0.1.11", "gantt-elastic-header": "^0.1.11",
"gojs": "^2.1.19", "gojs": "^2.1.19",
"iview-loader": "^1.3.0",
"iview-pro": "file:./iview-pro", "iview-pro": "file:./iview-pro",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"lodash.chunk": "^4.2.0", "lodash.chunk": "^4.2.0",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
...@@ -69,9 +66,11 @@ ...@@ -69,9 +66,11 @@
"@vue/test-utils": "^1.0.0-beta.28", "@vue/test-utils": "^1.0.0-beta.28",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.0.1", "babel-jest": "^23.0.1",
"eslint": "^7.7.0",
"eslint-plugin-node": "^11.1.0",
"iview-loader": "^1.3.0", "iview-loader": "^1.3.0",
"less": "^2.7.3", "less": "^3.12.2",
"less-loader": "^4.1.0", "less-loader": "^5.0.0",
"lint-staged": "^7.2.0", "lint-staged": "^7.2.0",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"svg-sprite-loader": "^3.8.0", "svg-sprite-loader": "^3.8.0",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" /> <TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" />
</TabPane> </TabPane>
<TabPane label="预览"> <TabPane label="预览">
<Table border="true" :columns="columnsImport" :data="excelData" :height="tableHeight" ref="tableExcel" class="tableCommon"></Table> <Table :border="true" :columns="columnsImport" :data="excelData" :height="tableHeight" ref="tableExcel" class="tableCommon"></Table>
</TabPane> </TabPane>
</Tabs> </Tabs>
...@@ -27,6 +27,8 @@ export default { ...@@ -27,6 +27,8 @@ export default {
rows: 10, rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里", placeholder: "请从Excel复制一段表格数据,粘贴在这里",
}, },
columnsImport: [],
excelData: []
}; };
}, },
...@@ -51,14 +53,6 @@ export default { ...@@ -51,14 +53,6 @@ export default {
}; };
}, },
methods: { methods: {
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
...@@ -77,10 +71,44 @@ export default { ...@@ -77,10 +71,44 @@ export default {
} }
} }
}, },
l(key) { //粘贴excel成功
key = "import_center" + "." + key; handleSuccess(tableData) {
return this.$t(key); //初始化数据
this.excelData = [];
this.columnsImport = [];
//处理colum和data
let tabColum = tableData.columns
let tabData = tableData.data
let arrData = []
tabData.forEach(ele => {
let objData = {}
tabColum.forEach(el => {
objData[el.title] = ele[el.key]
})
arrData.push(objData)
})
//处理title和key一致
tabColum.forEach(el => {
el.key = el.title
})
this.columnsImport = tabColum;
this.columnsImport.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
this.excelData = arrData;
this.$emit("on-datalength", this.excelData.length)
},
//粘贴excel失败
handleError(tableData, errorIndex) {
//console.log(tableData, errorIndex);
this.$Message.error("表格数据有误");
}, },
//粘贴excel相关end
}, },
watch: { watch: {
eid(v) { eid(v) {
......
This diff is collapsed.
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<Form inline> <Form inline>
<FormItem> <FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick"> <Tabs :animated="false" :value="0" @on-click="sheetClick">
<TabPane :label="item" v-for="(item,index) in sheetNames"></TabPane> <TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
</Tabs> </Tabs>
</FormItem> </FormItem>
</Form> </Form>
......
+ eslint@7.7.0
added 51 packages from 29 contributors, removed 3 packages, updated 12 packages and moved 7 packages in 48.231s
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