|
@@ -32,21 +32,18 @@
|
|
collapse-tags
|
|
collapse-tags
|
|
filterable
|
|
filterable
|
|
></el-cascader>
|
|
></el-cascader>
|
|
- <el-button type="primary" @click="search">查询</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="search" >查询</el-button>
|
|
|
|
|
|
<download-excel
|
|
<download-excel
|
|
class="export-excel-wrapper"
|
|
class="export-excel-wrapper"
|
|
:data="tableData"
|
|
:data="tableData"
|
|
:fields="json_fields"
|
|
:fields="json_fields"
|
|
:name="excelTitle"
|
|
:name="excelTitle"
|
|
- :disabled="disabled"
|
|
|
|
|
|
+ :disabled='disabled'
|
|
>
|
|
>
|
|
<!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
|
|
<!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
|
|
<el-button type="primary">导出EXCEL</el-button>
|
|
<el-button type="primary">导出EXCEL</el-button>
|
|
</download-excel>
|
|
</download-excel>
|
|
- <el-button type="primary" @click="Formdialog = true"
|
|
|
|
- >保存到数据库</el-button
|
|
|
|
- >
|
|
|
|
</div>
|
|
</div>
|
|
<el-table :data="tableData" style="width: 100%">
|
|
<el-table :data="tableData" style="width: 100%">
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -58,19 +55,6 @@
|
|
>
|
|
>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
- <el-dialog title="选择数据库表" :visible.sync="Formdialog" width="45%">
|
|
|
|
- <el-select v-model="value2" placeholder="请选择" filterable>
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in tableList"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- >
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- <el-button type="primary" @click="saveUnionTable">确认保存</el-button>
|
|
|
|
- <el-button @click="Formdialog = false">取消</el-button>
|
|
|
|
- </el-dialog>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
@@ -78,16 +62,14 @@ import XLSX from "xlsx";
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- Formdialog: false,
|
|
|
|
- disabled: true,
|
|
|
|
- excelTitle: "" || "excel",
|
|
|
|
|
|
+ disabled:true,
|
|
|
|
+ excelTitle:'' || 'excel',
|
|
props: { multiple: true },
|
|
props: { multiple: true },
|
|
tableData: [{}],
|
|
tableData: [{}],
|
|
excelData: [],
|
|
excelData: [],
|
|
arr: [],
|
|
arr: [],
|
|
value: "",
|
|
value: "",
|
|
value1: "",
|
|
value1: "",
|
|
- value2: "",
|
|
|
|
tableList: [],
|
|
tableList: [],
|
|
options: [],
|
|
options: [],
|
|
json_fields: {},
|
|
json_fields: {},
|
|
@@ -162,16 +144,16 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.arr = arr;
|
|
this.arr = arr;
|
|
- console.log(arr);
|
|
|
|
|
|
+ console.log(arr)
|
|
var cluHead = {};
|
|
var cluHead = {};
|
|
- for (let i in arr) {
|
|
|
|
- cluHead[arr[i]] = arr[i];
|
|
|
|
|
|
+ for(let i in arr){
|
|
|
|
+ cluHead[arr[i]] = arr[i]
|
|
}
|
|
}
|
|
- console.log(cluHead);
|
|
|
|
- this.json_fields = cluHead;
|
|
|
|
|
|
+ console.log(cluHead)
|
|
|
|
+ this.json_fields = cluHead
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.tableData = json;
|
|
this.tableData = json;
|
|
- this.disabled = false;
|
|
|
|
|
|
+ this.disabled = false
|
|
});
|
|
});
|
|
})
|
|
})
|
|
.catch(function (error) {
|
|
.catch(function (error) {
|
|
@@ -180,7 +162,7 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
handleChange(file, fileList) {
|
|
handleChange(file, fileList) {
|
|
- this.excelTitle = file.name;
|
|
|
|
|
|
+ this.excelTitle = file.name
|
|
const fileReader = new FileReader();
|
|
const fileReader = new FileReader();
|
|
fileReader.onload = (ev) => {
|
|
fileReader.onload = (ev) => {
|
|
try {
|
|
try {
|
|
@@ -200,26 +182,6 @@ export default {
|
|
};
|
|
};
|
|
fileReader.readAsBinaryString(file.raw);
|
|
fileReader.readAsBinaryString(file.raw);
|
|
},
|
|
},
|
|
- saveUnionTable() {
|
|
|
|
- this.$http
|
|
|
|
- .post("UnionTable/saveData", this.value2 )
|
|
|
|
- .then((res) => {
|
|
|
|
- console.log(res.data);
|
|
|
|
- if (res.data == "保存成功") {
|
|
|
|
- this.$message({
|
|
|
|
- type: "success",
|
|
|
|
- message: "保存成功!",
|
|
|
|
- });
|
|
|
|
- this.Formdialog = false;
|
|
|
|
- } else {
|
|
|
|
- this.$message({
|
|
|
|
- type: "fail",
|
|
|
|
- message: "保存失败!",
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- this.Formdialog = false;
|
|
|
|
- },
|
|
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|