<template>
|
<div class="authorityManagement_box" v-loading.fullscreen.lock="fullscreenLoading"
|
element-loading-spinner="el-icon-loading"
|
element-loading-background="rgba(0, 0, 0, 0.8)">
|
<My-bread
|
:list="[
|
`${$t('dataManage.dataManage')}`,
|
`${$t('dataManage.datawarehousing')}`,
|
]"
|
></My-bread>
|
<el-divider />
|
<div class="updateContent">
|
<el-tabs v-model="activeTabName" @tab-click="handleTabClick">
|
<el-tab-pane :label="$t('dataManage.dataUpObj.uploaddata')" name="first">
|
|
<div class="contentIquery">
|
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
<el-form-item :label="$t('dataManage.dataUpObj.catalogue')">
|
<el-cascader
|
v-model="formInline.dirid"
|
:options="catalogOption"
|
@change="catalogChange"
|
:props="cascader"
|
></el-cascader>
|
</el-form-item>
|
<el-form-item :label="$t('dataManage.dataUpObj.company')">
|
<el-cascader
|
v-model="formInline.depid"
|
:options="companyOption"
|
@change="companyChange"
|
:props="cascader"
|
></el-cascader>
|
</el-form-item>
|
<el-form-item :label="$t('dataManage.dataUpObj.versionNo')">
|
<el-select v-model="formInline.verid" :placeholder="$t('common.choose')">
|
<el-option
|
v-for="item in verOption"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item>
|
<input id="uploadfile" @change= "handleFileChange" type="file" name="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.shp.zip,.gdb.zip" style="display: none"></input>
|
<!-- <el-button icon="el-icon-document-add" @click="fileSelect" class="primary">{{
|
$t('common.file')
|
}}</el-button> -->
|
|
<el-input v-model="formInline.fileName" disabled>
|
<template slot="append">
|
<el-button v-if="formInline.fileName == '未选择文件'"
|
type="info"
|
@click="fileSelect">
|
选择文件
|
</el-button>
|
<el-button
|
v-else
|
type="info"
|
@click="clearFileSelect"
|
>
|
重置
|
</el-button>
|
</template>
|
</el-input>
|
|
|
|
</el-form-item>
|
<br />
|
<el-form-item :label="$t('dataManage.dataUpObj.describe')">
|
<el-input
|
type="textarea"
|
v-model="formInline.descr"
|
maxlength="50"
|
class="nm-skin-pretty"
|
show-word-limit
|
:rows="2" resize='none'
|
style="width: 460px"
|
></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button icon="el-icon-upload" @click="setFileUpload"
|
type="success">{{
|
$t('common.upload')
|
}}</el-button>
|
|
<el-button
|
icon="el-icon-delete"
|
type="danger"
|
@click="setFileDelete"
|
|
:disabled="tableData.length == 0 ? true : false"
|
>{{ $t('common.delete') }}</el-button
|
>
|
<el-button
|
icon="el-icon-data-line"
|
type="info"
|
disabled
|
>{{ $t('common.quayTest') }}</el-button
|
>
|
<el-button
|
icon="el-icon-folder-add"
|
type="warning"
|
@click="setFileWare"
|
:disabled="tableData.length == 0 ? true : false"
|
>{{ $t('common.Warehousin') }}</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="contentTable">
|
<el-table
|
:data="tableData"
|
style="width: 100%"
|
height="99%"
|
@selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" />
|
<el-table-column
|
align="center"
|
type="index"
|
:label="$t('common.index')"
|
width="70px"
|
fixed
|
/>
|
<el-table-column
|
align="center"
|
prop="name"
|
:label="$t('common.name')"
|
fixed
|
/>
|
</el-table>
|
</div>
|
</el-tab-pane>
|
<el-tab-pane :label="$t('dataManage.dataUpObj.receiptdata')" name="second">
|
<div class="contentIquery" style="padding-bottom: 0% !important;">
|
<el-form :inline="true" :model="formWarehousing" class="demo-form-inline">
|
<el-form-item :label="$t('dataManage.dataUpObj.describe')">
|
<el-input v-model="formWarehousing.name" placeholder="请输入内容"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button icon="el-icon-upload" @click="setWarehouseSearch"
|
class="primary">{{
|
$t('common.iquery')
|
}}</el-button>
|
<el-button @click="setWarehouseReset"
|
icon="el-icon-folder-add"
|
type="info"
|
>{{ $t('common.reset') }}</el-button
|
>
|
<el-button @click="setWarehouseDel"
|
icon="el-icon-folder-delete"
|
type="danger"
|
>{{ $t('common.delete') }}</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="contentTable" style="height:500px">
|
<el-table
|
:data="waretableData"
|
|
style="width:99%"
|
height="92%"
|
@selection-change="handleDelteChange"
|
>
|
<el-table-column
|
type="selection"
|
|
width="55">
|
</el-table-column>
|
<el-table-column
|
align="center"
|
type="index"
|
:label="$t('common.index')"
|
width="70px"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="name"
|
:label="$t('common.name')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="dirName"
|
:label="$t('dataManage.dataUpObj.catalogue')"
|
|
|
/>
|
<el-table-column
|
align="center"
|
prop="depName"
|
:label="$t('dataManage.dataUpObj.company')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="verName"
|
:label="$t('dataManage.dataUpObj.versionNo')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="type"
|
:label="$t('common.type')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="sizes"
|
:label="$t('common.size')"
|
|
:formatter="changeSizeFile"
|
/>
|
<el-table-column
|
align="center"
|
:label="$t('dataManage.dataUpObj.tableName')"
|
|
>
|
<template slot-scope="scope">
|
<a @click="detail(scope.row)" >{{
|
scope.row.tab
|
}}</a>
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
align="center"
|
prop="rows"
|
:label="$t('common.lineNuber')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="desc"
|
:label="$t('dataManage.dataUpObj.describe')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="uname"
|
:label="$t('dataManage.vmobj.createonuser')"
|
|
/>
|
<el-table-column
|
align="center"
|
prop="createTime"
|
:label="$t('dataManage.vmobj.createontime')"
|
:formatter="changetimeFile"
|
/>
|
</el-table>
|
|
<div style="margin-top: 10px" class="pagination_box">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listData.pageIndex"
|
:page-sizes="[10, 20, 30, 40]"
|
:page-size="listData.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</el-tab-pane>
|
|
</el-tabs>
|
|
|
</div>
|
<!-- -->
|
<el-dialog
|
:title="$t('dataManage.datawarehousing')"
|
:visible.sync="dialogWarehousing"
|
width="70%"
|
:before-close="handleWareClose"
|
>
|
<div class="dialogBox">
|
<div class="transFarBox">
|
<ul>
|
<li @click="singleElection(item)" v-for="(item, i) in tableWareOne" :class="{ active: activeName == item.tab }">{{item.tab}} ({{item.type}})</li>
|
</ul>
|
</div>
|
<div class="tarnsbtton">
|
<div><div style="padding:2%"> <el-link><i class="el-icon-plus"></i></el-link></div></div>
|
|
|
</div>
|
<div class="transFarBox">
|
<ul>
|
<li @click="singleElection2(item)" v-for="(item, i) in tableWareTwo" :class="{ active: activeName2 == item.entity }">{{item.tabDesc}} ( {{item.ns}}.{{item.tab}})</li>
|
</ul>
|
</div>
|
<div class="tarnsbtton">
|
<div><div style="padding:2%"> <el-link @click="setWareTableChangeLeft" ><i class="el-icon-d-arrow-left"></i></el-link></div><br/> <div style="padding:2%">
|
<el-link><i class="el-icon-d-arrow-right" @click="setWareTableChangeRight"></i></el-link></div></div>
|
</div>
|
<div class="transFarBox">
|
<ul>
|
<li @click="singleElection3(i)" v-for="(item, i) in tableWareThree" :class="{ active: activeName3 ==( item.tab+i)}">{{item.tab}} ( {{item.tabDesc}} {{item.ns}}.{{item.tabs}} )</li>
|
</ul>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button class="primary" @click="autoMatchWare">自动匹配</el-button>
|
<el-button @click="setInsrtWareTableClose ">取 消</el-button>
|
<el-button class="primary" @click="setInsrtWareTable">确 定</el-button>
|
</span>
|
</el-dialog>
|
|
<el-dialog
|
:title="$t('common.details')"
|
:visible.sync="dialogVisible"
|
width="70%"
|
>
|
<div style="height:600px">
|
<el-table
|
ref="filterTable"
|
:data="dbTableData"
|
height="90%"
|
border
|
style="width: 100%"
|
>
|
<el-table-column width="60" type="index" :label="$t('common.index')" />
|
<el-table-column
|
v-for="(item, index) in attributeData"
|
:key="index"
|
:label="item.alias"
|
:prop="item.field"
|
show-overflow-tooltip
|
align="center"
|
></el-table-column>
|
</el-table>
|
<div style="margin-top: 10px" class="pagination_box">
|
<el-pagination
|
@size-change="handleLoaderSizeChange"
|
@current-change="handleLoaderCurrentChange"
|
:current-page="listLoader.pageIndex"
|
:page-sizes="[10, 20, 30, 40]"
|
:page-size="listLoader.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count1"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import $ from 'jquery';
|
import MyBread from '../../components/MyBread.vue';
|
import { getToken } from '@/utils/auth';
|
import {
|
dataLoader_selectDirAll,
|
dataLoader_selectDepAll,
|
dataLoader_selectPath,
|
dataLoader_selectVerByDirid,
|
dataLoader_selectFiles,
|
dataUploadDeleteFiles,
|
dataLoader_InsertFiles,
|
dataLoader_selectMappers,
|
dataLoader_SelectTabs,
|
dataLoader_selectByPageForUpload,
|
dataLoader_deleteMetas,
|
dataLoader_selectFields,
|
dataLoader_selectDbData
|
} from '../../api/api';
|
export default {
|
name: 'dataUpdata',
|
components: {
|
MyBread,
|
},
|
data() {
|
return {
|
|
formWarehousing: {
|
name: '',
|
|
},
|
waretableData: [],
|
activeTabName: 'first',
|
wareStatus: false,
|
dialogWarehousing: false,
|
btnStatus: 0,
|
count: 0,
|
formInline: {
|
verid: '',
|
gather: '',
|
fileName:'未选择文件'
|
},
|
tableWareOne: [],
|
tableWareTwo: [],
|
catalogOption: [],
|
companyOption: [],
|
tableData: [],
|
listTableWare: [],
|
tableWareThree: [],
|
multipleSelection: [],
|
fullscreenLoading: false,
|
listData: {
|
pageIndex: 1,
|
pageSize: 10,
|
name: ''
|
},
|
pickerOptions: {
|
disabledDate(time) {
|
return time.getTime() > Date.now();
|
},
|
selectableRange: '00:00:00 - 23:59:59',
|
},
|
verOption: [],
|
cascader: {
|
label: 'name',
|
value: 'id',
|
children: 'children',
|
checkStrictly: true,
|
emitPath: false,
|
},
|
wareSelectOne: null,
|
wareSelectTwo: null,
|
listWare: [],
|
activeName: '',
|
activeName2: '',
|
activeName3: '',
|
wareTableFlag: null,
|
multipleDelete: [],
|
dialogVisible: false,
|
attributeData: [],
|
listLoader: {
|
id: null,
|
pageSize: 1,
|
pageSize: 10,
|
},
|
count1: 0,
|
dbTableData: [],
|
};
|
},
|
|
mounted() {
|
this.getSelectdirTab();
|
this.getQueryDepTree();
|
this.timeDefault();
|
this.getFilePath();
|
|
},
|
watch: {
|
'detailData.gather': {
|
handler(newValue, oldValue) {
|
if (newValue) {
|
let date = new Date();
|
let min = date.getMinutes();
|
date.setMinutes(min + 1); //这里加1分钟,是为了解决值改变后,系统秒数就过期限制了,无法点击“此刻”按钮, 如果监听 “系统时间”的改变,则会影响性能。
|
let nowDate = moment(date).format('HH:mm:ss');
|
let st = '';
|
if (
|
moment(date).format('yyyy-MM-DD') ===
|
moment(newValue).format('yyyy-MM-DD')
|
) {
|
let hh1 = moment(newValue).format('HH:mm:ss');
|
if (hh1 > nowDate) {
|
this.detailData.gather = new Date();
|
}
|
st = nowDate;
|
} else {
|
st = '23:59:59';
|
}
|
this.pickerOptions.selectableRange = '00:00:00 - ' + st;
|
this.pickerOptions = this.pickerOptions;
|
}
|
},
|
deep: true,
|
immediate: true,
|
|
},
|
},
|
|
methods: {
|
async detail(res) {
|
var val = res.tab.split(".");
|
const data = await dataLoader_selectFields({
|
ns: val[0],
|
tab: val[1]
|
})
|
if (data.code != 200) {
|
this.$message.error('字段列表调用失败');
|
return
|
}
|
var val_data= data.result;
|
for(var i in val_data){
|
if(val_data[i].alias.indexOf('ID') != -1){
|
val_data[i].alias = val_data[i].alias.replace('ID','')
|
}
|
}
|
this.dialogVisible = true;
|
this.attributeData = val_data;
|
|
this.listLoader = {
|
id: res.id,
|
pageIndex: 1,
|
pageSize: 10,
|
}
|
this.getDataLoaderSelectDbData();
|
},
|
async getDataLoaderSelectDbData() {
|
const data1 = await dataLoader_selectDbData(this.listLoader);
|
if (data1.code != 200) {
|
this.$message.error('字段列表调用失败');
|
return
|
}
|
var val = data1.result;
|
for(var i in val){
|
val[i].createuser = val[i].createName;
|
val[i].depid= val[i].depName;
|
val[i].dirid= val[i].dirName;
|
val[i].verid= val[i].verName;
|
val[i].updateuser= val[i].updateName;
|
if(val[i].createtime != null){
|
val[i].createtime= this.changetimeLayer(val[i].createtime )
|
}
|
if(val[i].updatetime != null){
|
val[i].updatetime= this.changetimeLayer(val[i].updatetime )
|
}
|
}
|
this.dbTableData = data1.result;
|
this.count1 = data1.count;
|
},
|
handleLoaderSizeChange(val) {
|
this.listLoader.pageIndex = 1;
|
this.listLoader.pageSize = val;
|
this.getDataLoaderSelectDbData();
|
},
|
handleLoaderCurrentChange(val) {
|
this.listLoader.pageIndex = val;
|
this.getDataLoaderSelectDbData();
|
},
|
|
changetimeLayer(res){
|
var time = new Date(res );
|
var y = time.getFullYear();
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
var h = time.getHours();
|
var mm = time.getMinutes();
|
var s = time.getSeconds();
|
return (
|
y +
|
'-' +
|
this.add0(m) +
|
'-' +
|
this.add0(d) +
|
' ' +
|
h +
|
':' +
|
mm +
|
':' +
|
s
|
);
|
},
|
|
changetimeFile(res) {
|
return this.changetimeLayer(res.createTime)
|
},
|
//格式化时间
|
add0(m) {
|
return m < 10 ? '0' + m : m;
|
},
|
setWarehouseSearch() {
|
|
this.listData = {
|
pageIndex: 1,
|
pageSize: 10,
|
name: this.formWarehousing.name,
|
}
|
this.getAllWareTable();
|
},
|
async setWarehouseDel() {
|
var std = [];
|
for (var i in this.multipleDelete) {
|
std.push(this.multipleDelete[i].id);
|
}
|
const res = await dataLoader_deleteMetas({ ids: std.toString() })
|
if (res.code != 200) {
|
this.$message.error('删除失败');
|
} else {
|
this.$message({
|
message: '删除成功',
|
type: 'success'
|
});
|
this.listData.pageIndex = 1;
|
this.listData.pageSize = 10;
|
this.getAllWareTable();
|
}
|
},
|
handleDelteChange(val) {
|
this.multipleDelete = val;
|
},
|
setWarehouseReset() {
|
this.formWarehousing.name = '';
|
this.listData = {
|
pageIndex: 1,
|
pageSize: 10,
|
name: null,
|
}
|
this.getAllWareTable();
|
},
|
handleTabClick(tab, event) {
|
if (this.activeTabName == 'second') {
|
this.setWarehouseReset();
|
}
|
},
|
handleSizeChange(val) {
|
this.listData.pageIndex = 1;
|
this.listData.pageSize = val;
|
this.getAllWareTable();
|
},
|
handleCurrentChange(val) {
|
this.listData.pageIndex = val;
|
this.getAllWareTable();
|
},
|
//获取入库数据列表
|
async getAllWareTable() {
|
|
const res = await dataLoader_selectByPageForUpload(this.listData);
|
if (res.code != 200) {
|
this.$message.error('列表数据获取失败');
|
return;
|
}
|
|
this.count = res.count;
|
this.waretableData = res.result;
|
},
|
//大小值改變
|
changeSizeFile(row, column, cellValue, index) {
|
|
if (cellValue >= 1024) {
|
return parseFloat(cellValue / 1204).toFixed(3) + "GB"
|
} else {
|
return cellValue + "MB"
|
}
|
},
|
setInsrtWareTableClose() {
|
this.dialogWarehousing = false;
|
this.setClearAttartch();
|
},
|
async setInsrtWareTable() {
|
var obj = {
|
metaEntity: this.formInline,
|
fileEntities: this.tableData,
|
tabEntities: this.tableWareThree
|
};
|
const res = await dataLoader_InsertFiles(JSON.stringify(obj));
|
|
if (res.code != 200) {
|
this.$message.error('数据入库失败');
|
return;
|
} else {
|
|
this.$message({
|
message: '数据入库成功',
|
type: 'success'
|
});
|
this.dialogWarehousing = false;
|
this.getFileLength();
|
this.setClearAttartch();
|
}
|
|
},
|
setClearAttartch() {
|
this.activeName = '';
|
this.activeName2 = '';
|
this.activeName3 = '';
|
this.tableWareThree = [];
|
this.tableWareTwo = [];
|
this.tableWareOne = [];
|
},
|
autoMatchWare() {
|
var val1 = this.tableWareOne;
|
var val2 = this.tableWareTwo;
|
var std = [];
|
for (var i = 0; i < val1.length; i++) {
|
|
const stdTab = this.setSplitWare(val1[i].tab)
|
for (var j = 0; j < val2.length; j++) {
|
if (val2[j].tab == stdTab) {
|
std.push(val1[i].tab)
|
val1[i].entity = val2[j].entity;
|
val1[i].tabDesc = val2[j].tabDesc;
|
val1[i].tabs=val2[j].tab;
|
val1[i].ns=val2[j].ns;
|
|
this.tableWareThree.push(val1[i]);
|
}
|
}
|
}
|
std.forEach(item => {
|
this.tableWareOne = this.tableWareOne.filter(items => items.tab !== item);
|
});
|
|
},
|
setSplitWare(res) {
|
if (res.indexOf(".shp") != -1) {
|
return res.split(".shp").join("");
|
} else if (res.indexOf(".mdb") != -1) {
|
return res.split(".mdb").join("");
|
} else if (res.indexOf(".gdb") != -1) {
|
return res.split(".gdb").join("");
|
} else {
|
return res;
|
}
|
},
|
handleWareClose(done) {
|
this.$confirm('确认关闭?')
|
.then(_ => {
|
done();
|
this.setClearAttartch();
|
})
|
.catch(_ => { });
|
},
|
setWareTableChangeLeft() {
|
var res = this.wareTableFlag;
|
var value1 = this.tableWareThree[res];
|
value1.entity = null;
|
value1.tabDesc = null;
|
if (this.tableWareOne.indexOf(value1) != -1) {
|
|
} else {
|
this.tableWareOne.push(value1);
|
this.tableWareThree.splice(res, 1)
|
this.activeName = '';
|
this.activeName2 = '';
|
this.activeName3 = '';
|
}
|
|
},
|
setWareTableChangeRight() {
|
|
this.wareSelectOne.entity = this.wareSelectTwo.entity;
|
this.wareSelectOne.tabDesc = this.wareSelectTwo.tabDesc;
|
if (this.tableWareThree.indexOf(this.wareSelectOne) != -1) {
|
|
} else {
|
this.tableWareThree.push(this.wareSelectOne)
|
this.tableWareOne.forEach((value, index, array) => {
|
if (value.tab == this.wareSelectOne.tab) {
|
this.tableWareOne.splice(index, 1)
|
}
|
})
|
this.activeName = '';
|
this.activeName2 = '';
|
this.activeName3 = '';
|
}
|
},
|
singleElection(row) {
|
this.wareSelectOne = row;
|
this.activeName = row.tab
|
|
},
|
singleElection2(row) {
|
this.wareSelectTwo = row;
|
this.activeName2 = row.entity
|
|
},
|
singleElection3(res) {
|
|
this.wareTableFlag = res;
|
this.activeName3 = this.tableWareThree[res].tab + res;
|
|
},
|
|
//查询所有的表
|
async getDataLoaderSelectTabs() {
|
const res = await dataLoader_SelectTabs();
|
if (res.code != 200) {
|
this.$message.error('数据请求失败');
|
return;
|
}
|
this.tableWareTwo = res.result;
|
},
|
//查询映射
|
async getDataLoaderSelectMappers(res) {
|
const data = await dataLoader_selectMappers(res);
|
|
if (data.code != 200) {
|
this.$message.error('数据请求失败');
|
return;
|
}
|
|
this.tableWareOne = data.result;
|
},
|
//数据删除
|
async setFileDelete() {
|
this.handlerLoading(true);
|
var data = JSON.stringify(this.multipleSelection);
|
const res = await dataUploadDeleteFiles(data);
|
if (res.code != 200) {
|
this.$message.error('删除失败');
|
this.handlerLoading(false);
|
return;
|
}
|
this.getFileLength();
|
this.handlerLoading(false);
|
|
|
|
},
|
//数据入库
|
async setFileWare() {
|
this.tableWareThree = [];
|
this.listTableWare = [];
|
this.getDataLoaderSelectTabs();
|
this.getDataLoaderSelectMappers(this.formInline.path);
|
this.dialogWarehousing = true;
|
// if(this.multipleSelection.length==0){
|
// this.$message.error('请选择要入库的数据');
|
// return
|
// }
|
// var obj = {
|
// metaEntity: this.formInline,
|
// fileEntities: this.multipleSelection
|
// };
|
|
// const res = await dataLoader_InsertFiles(JSON.stringify(obj));
|
|
// if (res.code != 200) {
|
// this.$message.error('文件入库失败');
|
// return;
|
// }
|
|
//
|
|
},
|
|
//显示表格数据
|
setViewTable() {
|
var index = this.listData.pageIndex - 1;
|
var start = index * this.listData.pageSize;
|
var size = (this.listData.pageSize) + (index * this.listData.pageSize);
|
var std = [];
|
for (var i = start; i < size; i++) {
|
if (this.listTable[i] != null) {
|
std.push(this.listTable[i])
|
}
|
}
|
this.tableData = std;
|
},
|
//文件上传
|
setFileUpload() {
|
this.handlerLoading(true);
|
var token = getToken();
|
var formData = new FormData();
|
|
|
var fs = document.getElementById("uploadfile");
|
for (var i = 0, c = fs.files.length; i < c; i++) {
|
formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file
|
}
|
|
|
$.ajax(BASE_URL + "/dataLoader/uploadFiles?token=" + token + "&path=" + this.formInline.path, {
|
type: "post",
|
data: formData,
|
async: true,
|
cache: false,
|
processData: false,
|
contentType: false,
|
success: (rs) => {
|
|
this.getFileLength();
|
|
this.$message({
|
message: '数据上传成功',
|
type: 'success'
|
});
|
this.clearFileSelect();
|
},
|
error: (rs) => {
|
this.$message.error('数据上传失败');
|
this.clearFileSelect();
|
}
|
});
|
|
this.handlerLoading(false);
|
},
|
//获取文件上传数据
|
async getFileLength() {
|
const res = await dataLoader_selectFiles(this.formInline.path);
|
if (res.code != 200) {
|
this.$message.error('文件上传数据获取失败');
|
return;
|
}
|
|
if (res.result == null) {
|
this.count = 0;
|
this.setClearTableData();
|
} else {
|
this.count = res.result.length;
|
this.tableData = res.result;
|
}
|
|
|
// this.listData.pageIndex = 1;
|
// this.listData.pageSize = 10;
|
// this.setViewTable();
|
},
|
//清除表格信息
|
setClearTableData() {
|
this.tableData = [];
|
this.listTable = [];
|
},
|
|
|
// //分页控制
|
// handleSizeChange(res) {
|
// this.listData.pageIndex = 1;
|
// this.listData.pageSize = res;
|
// this.setViewTable();
|
// },
|
// handleCurrentChange(res) {
|
// this.listData.pageIndex = res;
|
// this.setViewTable();
|
// },
|
//表格选中事件
|
handleSelectionChange(res) {
|
this.multipleSelection = res;
|
},
|
//文件获取
|
fileSelect() {
|
$("#uploadfile").click();
|
},
|
handleFileChange(event) {
|
|
// var fs = document.getElementById("uploadfile");
|
var f = event.currentTarget.files[0]
|
this.formInline.fileName = f.name;
|
|
},
|
clearFileSelect(){
|
this.formInline.fileName="未选择文件";
|
document.getElementById("uploadfile").value = "";
|
},
|
//当前时间获取
|
timeDefault() {
|
var date = new Date();
|
var hour = date.getHours(); // 时
|
var minutes = date.getMinutes(); // 分
|
var seconds = date.getSeconds(); //秒
|
var sign2 = ':';
|
var s1 =
|
date.getFullYear() +
|
'-' +
|
(date.getMonth() + 1) +
|
'-' +
|
date.getDate() +
|
' ' +
|
hour +
|
sign2 +
|
minutes +
|
sign2 +
|
seconds;
|
this.formInline.gather = s1;
|
},
|
|
//Loading显隐
|
handlerLoading(res) {
|
this.fullscreenLoading = res;
|
},
|
//目录切换
|
catalogChange(value) {
|
this.formInline.dirid = value;
|
this.getselectVerByDirid();
|
},
|
//单位切换
|
companyChange(value) {
|
this.formInline.depid = value;
|
},
|
//获取文件上传路径
|
async getFilePath() {
|
const res = await dataLoader_selectPath();
|
if (res.code != 200) {
|
this.$message.error('单位列表获取失败');
|
return;
|
}
|
this.formInline.path = res.result;
|
},
|
//单位列表获取
|
async getQueryDepTree() {
|
const res = await dataLoader_selectDepAll();
|
if (res.code != 200) {
|
this.$message.error('单位列表获取失败');
|
return;
|
}
|
this.formInline.depid = 1;
|
this.companyOption = this.treeData(res.result);
|
},
|
//版本号获取
|
async getselectVerByDirid() {
|
this.verOption = [];
|
this.formInline.verid = "";
|
const res = await dataLoader_selectVerByDirid({ dirid: this.formInline.dirid });
|
|
if (res.code != 200) {
|
this.$message.error('版本列表获取失败');
|
return;
|
}
|
this.verOption = res.result;
|
this.formInline.verid = res.result[0].id;
|
},
|
|
|
//目录列表获取
|
async getSelectdirTab() {
|
const res = await dataLoader_selectDirAll();
|
if (res.code != 200) {
|
this.$message.error('目录列表获取失败');
|
return;
|
}
|
this.formInline.dirid = 1;
|
this.catalogOption = this.treeData(res.result);
|
this.getselectVerByDirid()
|
},
|
//树列表生成
|
treeData(source) {
|
let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
|
return cloneData.filter((father) => {
|
// 循环所有项
|
let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
|
branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值
|
return father.pid == 0; // 返回一级菜单
|
});
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.authorityManagement_box {
|
width: 100%;
|
height: 100%;
|
position: relative;
|
box-sizing: border-box;
|
|
.updateContent {
|
width: 100%;
|
height: 670px;
|
|
position: relative;
|
.contentIquery {
|
width: 98%;
|
height: 16%;
|
border: 1px solid white;
|
padding: 1%;
|
border-radius: 5px;
|
}
|
.contentTable {
|
width: 97%;
|
height: 400px;
|
border: 1px solid white;
|
padding: 1%;
|
border-radius: 5px;
|
margin-top: 1%;
|
/*修改table 表体的背景颜色和文字颜色*/
|
/deep/ .el-table {
|
background-color: transparent;
|
|
th,
|
td {
|
background-color: transparent;
|
}
|
.el-table__expanded-cell {
|
background-color: transparent !important;
|
}
|
|
// 表头背景色
|
th.el-table__cell {
|
background-color: #303030;
|
color: #fff;
|
}
|
tr > td {
|
background-color: #303030;
|
color: #fff;
|
}
|
|
// hover效果
|
tr:hover > td {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
}
|
|
tbody tr:hover {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
// text-align: center;
|
}
|
|
// 滚动条宽高
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
height: 5px;
|
}
|
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
/*滚动条宽度*/
|
height: 5px;
|
/*滚动条高度*/
|
}
|
/*定义滚动条轨道 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-track {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
/*滚动条的背景区域的内阴影*/
|
border-radius: 10px;
|
}
|
|
/*定义滑块 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-thumb {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
border-radius: 6px;
|
background-color: #216fe6;
|
}
|
}
|
}
|
.primary {
|
background: #409eff;
|
border: #409eff;
|
color: white;
|
}
|
}
|
|
/deep/.el-form-item__label {
|
color: white;
|
}
|
// 设置输入框的背景色、字体颜色、边框属性设置;
|
/deep/.el-input__inner {
|
background-color: transparent !important ;
|
color: #fff;
|
border: 1px solid;
|
}
|
/deep/ .popper__arrow::after {
|
border-top-color: rgba(43, 45, 55, 0.8);
|
}
|
/deep/ .el-select .el-input__inner {
|
border-color: #fff !important;
|
}
|
/deep/.el-cascader .el-input__inner {
|
border-color: #fff !important;
|
}
|
/deep/.el-textarea__inner {
|
background: transparent;
|
border-color: #fff !important;
|
color: white;
|
}
|
/deep/.el-textarea .el-input__count {
|
background: transparent;
|
color: #fff !important;
|
}
|
/deep/.el-loading-spinner i {
|
color: #1890ff !important;
|
}
|
/deep/ .el-dialog {
|
background: #303030;
|
}
|
/deep/.el-range-editor.is-active,
|
.el-range-editor.is-active:hover,
|
.el-select .el-input.is-focus .el-input__inner {
|
border: 1px solid;
|
}
|
/deep/.el-dialog__title {
|
color: white;
|
}
|
.dialogBox {
|
width: 100%;
|
height: 500px;
|
display: flex;
|
justify-content: space-between;
|
.transFarBox {
|
width: 30%;
|
height: 100%;
|
border: 1px solid white;
|
border-radius: 5px;
|
max-height: 500px;
|
overflow-y: auto;
|
li {
|
color: white;
|
border-bottom: 1px solid white;
|
line-height: 30px;
|
text-align: center;
|
}
|
li:hover {
|
background: rgba(255, 255, 255, 0.3);
|
}
|
.active {
|
color: #409eff;
|
}
|
}
|
.tarnsbtton {
|
width: 6%;
|
height: 100%;
|
|
/*flex 布局*/
|
display: flex;
|
/*实现垂直居中*/
|
align-items: center;
|
/*实现水平居中*/
|
justify-content: center;
|
}
|
}
|
.el-icon-d-arrow-right {
|
color: white;
|
}
|
.el-icon-d-arrow-left {
|
color: #fff;
|
}
|
.el-icon-plus {
|
color: white;
|
}
|
/*修改table 表体的背景颜色和文字颜色*/
|
/deep/ .el-table {
|
background-color: transparent;
|
|
th,
|
td {
|
background-color: transparent;
|
}
|
.el-table__expanded-cell {
|
background-color: transparent !important;
|
}
|
|
// 表头背景色
|
th.el-table__cell {
|
background-color: #303030 !important;
|
color: #fff;
|
}
|
tr > td {
|
background-color: #303030 !important;
|
color: #fff;
|
}
|
|
// hover效果
|
tr:hover > td {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
}
|
|
tbody tr:hover {
|
background-color: rgba(255, 255, 255, 0.3) !important;
|
// text-align: center;
|
}
|
|
// 滚动条宽高
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
height: 5px;
|
}
|
|
.el-table__body-wrapper::-webkit-scrollbar {
|
width: 5px;
|
/*滚动条宽度*/
|
height: 5px;
|
/*滚动条高度*/
|
}
|
/*定义滚动条轨道 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-track {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
/*滚动条的背景区域的内阴影*/
|
border-radius: 10px;
|
}
|
|
/*定义滑块 内阴影+圆角*/
|
.el-table__body-wrapper::-webkit-scrollbar-thumb {
|
box-shadow: 0px 1px 3px #216fe6 inset;
|
border-radius: 6px;
|
background-color: #216fe6;
|
}
|
}
|
/deep/.el-tabs__active-bar {
|
background: #409eff;
|
}
|
/deep/ .el-tabs__item {
|
color: #409eff;
|
}
|
.pagination_box {
|
margin-top: 20px;
|
/deep/.el-input__inner {
|
background-color: transparent !important;
|
border: 1px solid;
|
color: white;
|
}
|
/deep/.el-pagination__total {
|
color: white;
|
}
|
/deep/.el-pagination__jump {
|
color: white;
|
}
|
/deep/.el-pager li.active {
|
color: #409eff;
|
}
|
/deep/.el-pager li {
|
color: white;
|
background: transparent;
|
}
|
/deep/.el-pager li {
|
color: white;
|
}
|
/deep/.btn-prev {
|
background: transparent;
|
}
|
/deep/.btn-next {
|
background: transparent;
|
}
|
/deep/.btn-next i {
|
color: white;
|
}
|
/deep/.btn-prev i {
|
color: white;
|
}
|
}
|
}
|
</style>
|