|
|
@@ -49,7 +49,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
-
|
|
|
<div v-if="current === 1" class="row">
|
|
|
<div>
|
|
|
<div>
|
|
|
@@ -67,7 +66,10 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<label>2.请选择需要导入的sheet</label>
|
|
|
- <select v-model="selectedIndex" class="form-control sheet-select">
|
|
|
+ <select
|
|
|
+ v-model="selectedIndex"
|
|
|
+ class="form-control sheet-select"
|
|
|
+ >
|
|
|
<option
|
|
|
v-for="(sheetItem, index) in sheetItems"
|
|
|
:key="index"
|
|
|
@@ -80,12 +82,28 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div v-if="current === 2" class="row">
|
|
|
<div>
|
|
|
<div class="form-inline">
|
|
|
<!-- <label>{{ $t("lang.DataImportPanel.stepThree") }}.</label> -->
|
|
|
- <div v-if="sheetItems.length > 0" class="form-group">
|
|
|
+ <div
|
|
|
+ v-if="sheetItems.length > 0"
|
|
|
+ class="form-group"
|
|
|
+ style="display: flex; align-items: center"
|
|
|
+ >
|
|
|
+ <span style="color: red">*</span>
|
|
|
+ <label style="margin-bottom: 0">导入行数:</label>
|
|
|
+ <a-input-number
|
|
|
+ v-model:value="lineCount"
|
|
|
+ style="width: 80px; margin-right: 8px"
|
|
|
+ />
|
|
|
+ <span style="color: red">*</span>
|
|
|
+ <label style="margin-bottom: 0">导入列数:</label>
|
|
|
+ <a-input-number
|
|
|
+ v-model:value="columnCount"
|
|
|
+ style="width: 80px; margin-right: 8px"
|
|
|
+ />
|
|
|
<button
|
|
|
type="button"
|
|
|
class="btn btn-primary btn-primary-1"
|
|
|
@@ -103,7 +121,7 @@
|
|
|
<button
|
|
|
type="button"
|
|
|
class="btn btn-primary btn-primary-1 btn-primary-import"
|
|
|
- @click="runProcessClear(selectedDataTemplateNo,false)"
|
|
|
+ @click="runProcessClear(selectedDataTemplateNo, false)"
|
|
|
>
|
|
|
3.{{ $t("lang.DataImportPanel.emptyImport") }}
|
|
|
</button>
|
|
|
@@ -113,9 +131,7 @@
|
|
|
class="btn btn-primary btn-primary-1 btn-primary-import"
|
|
|
@click="finishTask"
|
|
|
>
|
|
|
- {{
|
|
|
- $t("lang.DataImportPanel.completeTask")
|
|
|
- }}
|
|
|
+ {{ $t("lang.DataImportPanel.completeTask") }}
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -136,7 +152,7 @@
|
|
|
bordered
|
|
|
:columns="columns"
|
|
|
:data-source="dataSource"
|
|
|
- :scroll="{ y:900 }"
|
|
|
+ :scroll="{ y: 900 }"
|
|
|
size="small"
|
|
|
>
|
|
|
<a-table-column type="index" />
|
|
|
@@ -146,12 +162,14 @@
|
|
|
</template>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
-
|
|
|
+
|
|
|
<Loading v-if="loading" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="steps-action">
|
|
|
- <a-button v-if="current>0" class="prevBtn" @click="prev"> 上一步 </a-button>
|
|
|
+ <a-button v-if="current > 0" class="prevBtn" @click="prev">
|
|
|
+ 上一步
|
|
|
+ </a-button>
|
|
|
<a-button
|
|
|
v-if="current < steps.length - 1"
|
|
|
class="nextBtn"
|
|
|
@@ -188,7 +206,7 @@ export default {
|
|
|
SmileOutlined,
|
|
|
Navbar,
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
data: function () {
|
|
|
return {
|
|
|
current: 0,
|
|
|
@@ -220,8 +238,10 @@ export default {
|
|
|
dataTemplateNo: null,
|
|
|
taskId: null,
|
|
|
|
|
|
- columns: [], // 列定义
|
|
|
+ columns: [], // 列定义
|
|
|
dataSource: [], // 表格数据源
|
|
|
+ lineCount: null, // 导入行数
|
|
|
+ columnCount: null, // 导入列数
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -229,17 +249,15 @@ export default {
|
|
|
|
|
|
mounted: function () {
|
|
|
var _self = this;
|
|
|
- console.log('uploadFileInput::::',_self);
|
|
|
+ console.log('uploadFileInput::::', _self);
|
|
|
_self.initView();
|
|
|
|
|
|
_self.$nextTick(function () {
|
|
|
_self.canVisit();
|
|
|
-
|
|
|
});
|
|
|
if (_self.$route.query.dataTemplateNos) {
|
|
|
_self.dataTemplateNos = JSON.parse(_self.$route.query.dataTemplateNos);
|
|
|
- };
|
|
|
-
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
@@ -247,14 +265,14 @@ export default {
|
|
|
* 步骤条切换
|
|
|
*/
|
|
|
next() {
|
|
|
- console.log('selectedDataTemplateNo:::',this.selectedDataTemplateNo);
|
|
|
+ console.log('selectedDataTemplateNo:::', this.selectedDataTemplateNo);
|
|
|
if (!this.selectedDataTemplateNo) {
|
|
|
message.error('请选择导入模板');
|
|
|
- } else{
|
|
|
+ } else {
|
|
|
this.current++;
|
|
|
}
|
|
|
- if(this.current == 2){
|
|
|
- this.runProcessClear(this.selectedDataTemplateNo,true);
|
|
|
+ if (this.current == 2) {
|
|
|
+ this.runProcessClear(this.selectedDataTemplateNo, true);
|
|
|
}
|
|
|
},
|
|
|
prev() {
|
|
|
@@ -357,25 +375,25 @@ export default {
|
|
|
downloadTemplateButton: function () {
|
|
|
var _self = this;
|
|
|
//var url = window.location.origin;
|
|
|
- if(this.selectedDataTemplateNo){
|
|
|
-
|
|
|
-
|
|
|
+ if (this.selectedDataTemplateNo) {
|
|
|
for (var i = 0, len = _self.dataTemplates.length; i < len; i++) {
|
|
|
if (
|
|
|
- _self.selectedDataTemplateNo == _self.dataTemplates[i].dataTemplateNo
|
|
|
+ _self.selectedDataTemplateNo ==
|
|
|
+ _self.dataTemplates[i].dataTemplateNo
|
|
|
) {
|
|
|
- var realtivePath = _self.dataTemplates[i].dataTemplateFileRelativePath;
|
|
|
-
|
|
|
- var downloadUrl = '/api/dataImportResource/downloadTemplateFile?dataTemplateNo=' + _self.selectedDataTemplateNo;
|
|
|
-
|
|
|
- var fileName = (realtivePath != null)
|
|
|
- ? realtivePath
|
|
|
- : '导入模板.xls';
|
|
|
-
|
|
|
+ var realtivePath =
|
|
|
+ _self.dataTemplates[i].dataTemplateFileRelativePath;
|
|
|
+
|
|
|
+ var downloadUrl =
|
|
|
+ '/api/dataImportResource/downloadTemplateFile?dataTemplateNo=' +
|
|
|
+ _self.selectedDataTemplateNo;
|
|
|
+
|
|
|
+ var fileName = realtivePath != null ? realtivePath : '导入模板.xls';
|
|
|
+
|
|
|
DownloadService.downloadFile(downloadUrl, fileName);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
message.error('请先选择导入模板');
|
|
|
}
|
|
|
},
|
|
|
@@ -477,6 +495,7 @@ export default {
|
|
|
success: function (data) {
|
|
|
_self.importTable = data;
|
|
|
_self.showImportTable(data);
|
|
|
+ _self.columnCount = data.importFields.length;
|
|
|
},
|
|
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
@@ -522,6 +541,16 @@ export default {
|
|
|
testImportButton: function (isformalImport) {
|
|
|
var _self = this;
|
|
|
var sheetIndex = _self.selectedIndex;
|
|
|
+
|
|
|
+ if(_self.lineCount <= 0){
|
|
|
+ message.warning('请输入正确的导入行数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.columnCount <= 0){
|
|
|
+ message.warning('请输入正确的导入列数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (
|
|
|
_self.selectedDataTemplateNo == '' ||
|
|
|
_self.selectedDataTemplateNo == undefined
|
|
|
@@ -561,10 +590,11 @@ export default {
|
|
|
importTable: _self.importTable,
|
|
|
dataTemplateVersion: _self.selectedDataTemplate.version,
|
|
|
};
|
|
|
-
|
|
|
+ const lineCount = _self.lineCount;
|
|
|
+ const columnCount = _self.columnCount;
|
|
|
_self.loading = true;
|
|
|
$.ajax({
|
|
|
- url: Common.getApiURL('dataImportResource/saveImportModelData'),
|
|
|
+ url: Common.getApiURL(`dataImportResource/saveImportModelData?lineCount=${lineCount}&columnCount=${columnCount}`),
|
|
|
type: 'post',
|
|
|
dataType: 'json',
|
|
|
contentType: 'application/json',
|
|
|
@@ -656,7 +686,7 @@ export default {
|
|
|
|
|
|
data.forEach(function (item) {
|
|
|
_self.dataSource.push(item.data);
|
|
|
- console.log('dataSource:::',_self.dataSource);
|
|
|
+ console.log('dataSource:::', _self.dataSource);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
@@ -665,10 +695,20 @@ export default {
|
|
|
*/
|
|
|
runProcessImport: function (selectedDataTemplateNo) {
|
|
|
var _self = this;
|
|
|
+ if(_self.lineCount <= 0){
|
|
|
+ message.warning('请输入正确的导入行数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.columnCount <= 0){
|
|
|
+ message.warning('请输入正确的导入列数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
var no = selectedDataTemplateNo;
|
|
|
+ const lineCount = _self.lineCount;
|
|
|
+ const columnCount = _self.columnCount;
|
|
|
_self.loading = true;
|
|
|
$.ajax({
|
|
|
- url: Common.getApiURL('dataImportResource/formalDataImportByIds/') + no,
|
|
|
+ url: Common.getApiURL('dataImportResource/formalDataImportByIds/') + no + `?lineCount=${lineCount}&columnCount=${columnCount}`,
|
|
|
type: 'post',
|
|
|
dataType: 'json',
|
|
|
beforeSend: function (request) {
|
|
|
@@ -696,7 +736,7 @@ export default {
|
|
|
/**
|
|
|
* 运行清空流程
|
|
|
*/
|
|
|
- runProcessClear: function (selectedDataTemplateNo,flag) {
|
|
|
+ runProcessClear: function (selectedDataTemplateNo, flag) {
|
|
|
var _self = this;
|
|
|
var no = selectedDataTemplateNo;
|
|
|
_self.loading = true;
|
|
|
@@ -710,17 +750,20 @@ export default {
|
|
|
},
|
|
|
success: function (data) {
|
|
|
_self.loading = false;
|
|
|
- if(flag) {
|
|
|
- message.success(_self.$t('lang.DataImportPanel.describe9')+'!'+ data.processResult.result);
|
|
|
+ if (flag) {
|
|
|
+ message.success(
|
|
|
+ _self.$t('lang.DataImportPanel.describe9') +
|
|
|
+ '!' +
|
|
|
+ data.processResult.result,
|
|
|
+ );
|
|
|
} else {
|
|
|
- message.success(_self.$t('lang.DataImportPanel.describe9')+'!'+ data.processResult.result,10);
|
|
|
+ message.success(
|
|
|
+ _self.$t('lang.DataImportPanel.describe9') +
|
|
|
+ '!' +
|
|
|
+ data.processResult.result,
|
|
|
+ 10,
|
|
|
+ );
|
|
|
}
|
|
|
- // Notify.success(
|
|
|
- // _self.$t('lang.DataImportPanel.describe9'),
|
|
|
- // data.processResult.result,
|
|
|
- // false,
|
|
|
- // );
|
|
|
- // return;
|
|
|
},
|
|
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
_self.loading = false;
|
|
|
@@ -797,16 +840,16 @@ export default {
|
|
|
margin-top: 8px;
|
|
|
position: relative;
|
|
|
}
|
|
|
-.prevBtn{
|
|
|
+.prevBtn {
|
|
|
position: absolute;
|
|
|
left: 0px;
|
|
|
}
|
|
|
-.nextBtn{
|
|
|
+.nextBtn {
|
|
|
position: absolute;
|
|
|
right: 0px;
|
|
|
}
|
|
|
|
|
|
-.btn-primary-1{
|
|
|
+.btn-primary-1 {
|
|
|
color: #fff;
|
|
|
background: #1890ff;
|
|
|
border-color: #1890ff;
|
|
|
@@ -816,14 +859,11 @@ export default {
|
|
|
border-radius: 2px;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-.btn-primary-block{
|
|
|
+.btn-primary-block {
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-.btn-primary-import{
|
|
|
+.btn-primary-import {
|
|
|
margin-left: 5px;
|
|
|
}
|
|
|
-
|
|
|
</style>
|