Commit 329e6df2 authored by 仇晓婷's avatar 仇晓婷

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

parents 4a4ee0ca dafab4ae
This diff is collapsed.
<template>
<div class="h100">
<Tabs type="card" width="100">
<TabPane label="excel数据">
<TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" />
</TabPane>
<TabPane label="预览">
<Table border="true" :columns="columnsImport" :data="excelData" :height="tableHeight" ref="tableExcel" class="tableCommon"></Table>
</TabPane>
</Tabs>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "detailExcel",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
excelRows: 100,
tableHeight: '',
inputProps: {
rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里",
},
};
},
props: {
eid: Number,
},
created() {
this.excelRows = parseInt((window.innerHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.excelRows = parseInt((window.screenHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
})();
};
},
methods: {
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
downFile(path) {
//alert(path)
let truePath = path;
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");
}
}
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
<template>
<div class="content">
<div class="table-content">
<TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" v-show="showTablePaste" />
<DataGrid border :height="tdHeightExcel" :columns="columnsImport" :data="excelData" :page="false" :set="false">
<template slot="easySearch">
<div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<span>导入到</span>
......@@ -16,13 +16,6 @@
<FormItem>
<Button type="primary" @click="openInfoModal">导入</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Form inline>
<FormItem>
<Button @click="downFile">下载原始文件</Button>
</FormItem>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
......@@ -30,16 +23,43 @@
</Upload>
</div>
</FormItem>
</Form>
</div>
<div class="btns">
<Form inline>
<FormItem>
<a @click="downFile">
<Icon type="md-download" />{{entity.file}}
</a>
</FormItem>
<FormItem>
<a class="ml10 mr10" @click="resetTable">
<Icon type="md-eye" />预览
</a>
</FormItem>
<FormItem v-if="show">
<Button @click="openPaste" :type="btnType" :ghost="ghostStatus">{{btnTxt}}</Button>
</FormItem>
<FormItem>
<Button @click="resetTable">还原到原始文件</Button>
<RadioGroup value="0" type="button" @on-change="changeExcel">
<Radio label="0">
<Icon type="md-list" />列表
</Radio>
<Radio label="1">
<Icon type="md-clipboard" />Excel
</Radio>
</RadioGroup>
</FormItem>
</Form>
</template>
</DataGrid>
<FooterToolbar v-if="sheetNames.length>1">
</div>
</div>
<div class="table-main" ref="main">
<Table border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" ref="table" class="tableCommon" v-if="tableImport"></Table>
<component :is="detailExcel" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
......@@ -71,6 +91,8 @@ export default {
downUrl: fileUrlDown,
fileUrlPath: "",
disabled: false,
detailExcel: null,
tableImport: true,
columns0: [{
key: "userName",
title: this.l("userName"),
......@@ -424,7 +446,7 @@ export default {
useData.push(objTm);
});
//对列表里的数据字典项进行处理
//对列表里的部门及数据字典项进行处理
useData.forEach(eles => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if (
......@@ -551,10 +573,10 @@ export default {
pageChange(val) {
switch (val) {
case 0:
this.loadColum(this.columns0);
//this.loadColum(this.columns0);
break;
case 1:
this.loadColum(this.columns1);
//this.loadColum(this.columns1);
break;
case undefined:
if (this.dataType == 0) {
......@@ -564,7 +586,7 @@ export default {
}
break;
default:
this.loadColum(this.columns1);
//this.loadColum(this.columns1);
}
},
handleClose() {
......@@ -704,6 +726,16 @@ export default {
}
});
},
changeExcel(val) {
if (val == 1) {
this.tableImport = false
this.detailExcel = () => import("./detailExcel");
} else {
this.detailExcel = null;
this.tableImport = true
}
},
l(key) {
key = "user" + "." + key;
return this.$t(key);
......@@ -720,7 +752,54 @@ export default {
</script>
<style lang="less">
.content {
.table-content {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
.tip {
display: inline;
}
form {
display: inline-block;
.ivu-form-item {
margin: 0;
vertical-align: middle;
}
}
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
tr td .ivu-table-cell {
padding: 0 5px;
}
overflow-x: hidden;
}
.table-tools {
display: flex;
line-height: 50px;
.table-search {
flex-grow: 1;
}
.btns {
min-width: 200px;
text-align: right;
}
}
.table-footer {
line-height: 45px;
background: #f5f5f5;
......@@ -728,6 +807,7 @@ export default {
.ivu-footer-toolbar {
text-align: left;
background: #f5f5f5;
.ivu-footer-toolbar-right {
float: left;
......
This diff is collapsed.
......@@ -40,7 +40,7 @@ export const actions = {
if (res.result) {
util.cookies.set('uuid', res.result.userId);
util.cookies.set('tanantCode', res.result.tanantCode);
util.cookies.set('tenantCode', res.result.tenantCode );
util.cookies.set('token', res.result.accessToken);
sessionStorage.setItem('token', res.result.accessToken)
// // 设置 vuex 用户信息
......
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