批处理前端

This commit is contained in:
446052889@qq.com 2022-07-14 19:11:37 +08:00
parent 508ad75146
commit 61a94211fc
3 changed files with 831 additions and 825 deletions

View File

@ -11,32 +11,60 @@
border
size="medium"
style="width: 100%">
<!-- ExcelNo -->
<el-table-column
prop='index'
label=''
prop='excelNo'
label='1'
align='center'
width=50px
width=100px
>
<template slot-scope="scope">
{{scope.row.excelNo + 1}}
</template>
</el-table-column>
<!-- 策略 -->
<el-table-column
prop='result'
label='策略'
align='center'
width=100px
fiexd="left"
>
<template slot-scope="scope">
<p :style="{color: scope.row.isRowOk ? '#009688' : '#ff0000'}">
<span v-if="scope.row.result == 'add'">新增</span>
<span v-else-if="scope.row.result == 'update'">更新</span>
<span v-else-if="(scope.row.result == 'repeat' || scope.row.result == 'blank' || scope.row.result == 'noMatch')">忽略</span>
<span v-else></span>
</p>
</template>
</el-table-column>
<el-table-column
v-for="(item) in tableTitle"
v-for="(item, index) in tableTitle"
:key=item
:prop=item
:label="item">
:label="item"
min-width="150">
<template slot-scope="scope">
<template v-if="scope.row[item] != undefined">
{{scope.row[item].value}}
<!--警告类提示上传可忽略-->
<span v-if="!scope.row[item].isRowOk && item == '名称'" style="color: #E6A23C">
<br/><b>{{scope.row[item].rowMsg}}</b>
</span>
<!--错误类提示不能上传-->
<span v-if="!scope.row[item].isOk" style="color: #ff0000">
<br/><b>{{scope.row[item].msg}}</b>
<template v-if="scope.row.row[index] != undefined">
{{ scope.row.row[index].value }}
<span v-if="!scope.row.row[index].isOk" style="color: #ff0000">
<br/>{{ scope.row.row[index].msg }}
</span>
</template>
</template>
</el-table-column>
<!-- 匹配路径 -->
<el-table-column
prop='matchPath'
label='匹配路径'
align='left'
width=500px
>
<template slot-scope="scope">
{{scope.row.pathName}}
</template>
</el-table-column>
</el-table>
</div>
</div>
@ -68,6 +96,7 @@
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
methodCategory: methodCategory,
msgHeight: '20px',
tableHeight: parseInt(this.totalHeight) - 20 + 'px',
tableTitle: [],
@ -81,6 +110,12 @@
chheckDone: false,
checkTemplateResult: 'ok',
checkTemplateResultMsg: '',
totalCount: 0,
okCount: 0,
repeatCount: 0,
blankCount: 0,
errCount: 0,
noMatchCount: 0
}
}
},
@ -99,7 +134,8 @@
teamId: that.teamId,
type: 'processList',
fileValue: that.processFileValue,
fileName: that.fileName
fileName: that.fileName,
methodCategory: methodCategory
}
};
awsuiAxios.post(params).then(function (ro) {
@ -109,95 +145,42 @@
that.tableTitle = ro.data.data.titleRow;
//
const data = ro.data.data.data;
//
let totalCount = 0;//
let okCount = 0;//
let existCount = 0;//
let errCount = 0;//
let errRowIndexArr = [];//
for (let i = 0; i < data.length; i++) {
let isOk = true;
let rowData = [];
let isExist = false;//
let isExcelExist = false;// excel
let excelExistRow = 0;// excel
let isRowErr = false;// excel
for (let j = 0; j < data[i].length; j++) {
let cell = data[i][j];
//
if (j == 0) {//
if (cell.isExist) {//
isExist = true;
} else if (cell.isExcelExist) {// excel
isExcelExist = true;
excelExistRow = cell.excelExistRow;
}
}
data[i][j].isRowOk = true;//
data[i][j].rowMsg = '';//
if (isExist) {
isOk = false;
data[i][j].isRowOk = false;
data[i][j].rowMsg = '资产库中已存在该流程';
} else if (isExcelExist) {
isOk = false;
data[i][j].isRowOk = false;
data[i][j].rowMsg = '流程与第' + excelExistRow + '行重复';
} else {
if (cell.isOk) {//
} else {
isOk = false;
isRowErr = true;
}
}
}
if (isRowErr) {
errRowIndexArr.push(i);
}
// tableData.push(rowData);
totalCount++;
if (isExist) {//
that.checkResult.existData.push(data[i]);
existCount++;
} else if (isExcelExist) {// excel
that.checkResult.excelExistData.push(data[i]);
existCount++;
} else if (isOk) {// excel
that.checkResult.okData.push(JSON.parse(JSON.stringify(data[i])));
okCount++;
} else {//
that.checkResult.errData.push(data[i]);
errCount++;
}
}
let result = '清单共<span style="font-weight:bold;">' + totalCount + '</span>条记录';
let totalCount = data.totalCount;//
that.checkResult.totalCount = totalCount;
let okCount = data.okCount;//
that.checkResult.okCount = okCount;
let repeatCount = data.repeatCount;// Excel
that.checkResult.repeatCount = repeatCount;
let blankCount = data.blankCount;//
that.checkResult.blankCount = blankCount;
let errCount = data.errCount;//
that.checkResult.errCount = errCount;
let noMatchCount = data.noMatchCount;//
that.checkResult.noMatchCount = noMatchCount;
let result = '共<span style="font-weight:bold;">' + totalCount + '</span>条';
if (okCount > 0) {
if (totalCount == okCount) {
result += ',全部校验通过';
result += ',全部校验通过';
} else {
result += ',校验通过<span style="font-weight:bold;">' + okCount + '</span>条';
result += ',通过<span style="font-weight:bold;">' + okCount + '</span>条';
}
}
if (errCount > 0) {
result += ',校验失败<span style="color:red;font-weight:bold;">' + errCount + '</span>条';
result += ',失败<span style="color:red;font-weight:bold;">' + errCount + '</span>条';
}
if (existCount > 0) {
result += ',重复数据<span style="color:red;font-weight:bold;">' + existCount + '</span>条(上传时忽略)';
if (blankCount > 0) {
result += ',名称、上级名称或文件类型缺失<span style="color:red;font-weight:bold;">' + blankCount + '</span>条';
}
if (repeatCount > 0) {
result += ',重复<span style="color:red;font-weight:bold;">' + repeatCount + '</span>条';
}
if (noMatchCount > 0) {
result += ',不匹配<span style="color:red;font-weight:bold;">' + noMatchCount + '</span>条';
}
that.checkResult.resultMsg = result;
const tableData = [];
for (let i = 0; i < data.length; i++) {
const row = {};
const rowArr = data[i];
for (let j = 0; j < rowArr.length; j++) {
row[rowArr[j].name2] = rowArr[j];
}
row.index = i + 1;// 便
tableData.push(row);
}
that.tableData = tableData;
that.tableData = data.result;
that.checkResult.okData = that.tableData;
that.checkResult.chheckDone = true;
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});

View File

@ -11,25 +11,31 @@
<!-- 上传 -->
<div v-if="this.active == 1" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}">
<awsui-tabs v-model="uploadStep.activeName">
<awsui-tab-pane label="批量创建流程清单" name="processList">
<awsui-tab-pane label="批量创建模型清单" name="processList">
<div v-loading="uploadStep.loading">
<!-- 文件上传功能 -->
<div v-show="uploadStep.processUpload.status == 0" style="text-align: center;padding-top: 220px;">
<awsui-button type="primary" class="button-general-color" style="margin: 0;" @click="uploadFile('process')">上传Excel文件</awsui-button>
<awsui-button type="primary" class="button-general-color" style="margin: 0;"
@click="uploadFile('process')">上传Excel文件
</awsui-button>
<div style="padding-top: 30px;">
<span class="text-linker-color" style="cursor: pointer;" @click.stop="downloadTemplate('processList')">下载Excel模板</span>
<span class="text-linker-color" style="cursor: pointer;"
@click.stop="downloadTemplate('processList')">下载Excel模板</span>
</div>
</div>
<!-- 已上传文件删除 -->
<div v-show="uploadStep.processUpload.status == 1" style="text-align: center;">
<div style="padding-top: 220px;">
<div style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE">
<div
style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE">
已上传文件
</div>
</div>
<div style="padding-top: 30px;">
<span class="text-linker-color" style="cursor: pointer;" @click="downLoadUploaded(processFileValue, uploadStep.processUpload.data.name)">{{uploadStep.processUpload.data.name}}</span>
<i class="awsui-iconfont" style="cursor: pointer;" @click="deleteUploaded(processFileValue, uploadStep.processUpload.data.name)">&#xe626;</i>
<span class="text-linker-color" style="cursor: pointer;"
@click="downLoadUploaded(processFileValue, uploadStep.processUpload.data.name)">{{ uploadStep.processUpload.data.name }}</span>
<i class="awsui-iconfont" style="cursor: pointer;"
@click="deleteUploaded(processFileValue, uploadStep.processUpload.data.name)">&#xe626;</i>
</div>
</div>
<div v-show="false">
@ -50,7 +56,9 @@
accept=".xlsx"
:file-list="uploadStep.processUpload.fileList">
<div style="display: none;">
<awsui-button id="selectProcessFileButton" style="width: 130px;" class="button-general-color" type="primary">本地文件上传</awsui-button>
<awsui-button id="selectProcessFileButton" style="width: 130px;" class="button-general-color"
type="primary">本地文件上传
</awsui-button>
</div>
</pal-upload>
</div>
@ -60,21 +68,27 @@
<div v-loading="uploadStep.loading">
<!-- 文件上传功能 -->
<div v-show="uploadStep.shapeUpload.status == 0" style="text-align: center;padding-top: 220px;">
<awsui-button type="primary" class="button-general-color" style="margin: 0;" @click="uploadFile('shape')">上传Excel文件</awsui-button>
<awsui-button type="primary" class="button-general-color" style="margin: 0;"
@click="uploadFile('shape')">上传Excel文件
</awsui-button>
<div style="padding-top: 30px;">
<span class="text-linker-color" style="cursor: pointer;" @click="openRepositoryTreeDlg">下载Excel模板</span>
<span class="text-linker-color" style="cursor: pointer;"
@click="openRepositoryTreeDlg">下载Excel模板</span>
</div>
</div>
<!-- 已上传文件删除 -->
<div v-show="uploadStep.shapeUpload.status == 1" style="text-align: center;">
<div style="padding-top: 220px;">
<div style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE">
<div
style="display:inline-block;height: 28px;width:119px;line-height: 28px;vertical-align: middle;background-color: #DEDEDE">
已上传文件
</div>
</div>
<div style="padding-top: 30px;">
<span class="text-linker-color" style="cursor: pointer;" @click="downLoadUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)">{{uploadStep.shapeUpload.data.name}}</span>
<i class="awsui-iconfont" style="cursor: pointer;" @click="deleteUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)">&#xe626;</i>
<span class="text-linker-color" style="cursor: pointer;"
@click="downLoadUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)">{{ uploadStep.shapeUpload.data.name }}</span>
<i class="awsui-iconfont" style="cursor: pointer;"
@click="deleteUploaded(shapeFileValue, uploadStep.shapeUpload.data.name)">&#xe626;</i>
</div>
</div>
<div v-show="false">
@ -95,7 +109,9 @@
accept=".xlsx"
:file-list="uploadStep.shapeUpload.fileList">
<div style="display: none;">
<awsui-button id="selectShapeFileButton" style="width: 130px;" class="button-general-color" type="primary">本地文件上传</awsui-button>
<awsui-button id="selectShapeFileButton" style="width: 130px;" class="button-general-color"
type="primary">本地文件上传
</awsui-button>
</div>
</pal-upload>
</div>
@ -118,7 +134,8 @@
<!-- 校验 -->
<div v-if="this.active == 2" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}">
<template v-if="checkStep.type == 'processList'">
<check-process ref="processListCheck" :file-name="uploadStep.processUpload.data.name" :totalHeight="mainHeight"/>
<check-process ref="processListCheck" :file-name="uploadStep.processUpload.data.name"
:totalHeight="mainHeight"/>
</template>
<template v-if="checkStep.type == 'shapeList'">
<check-shape ref="shapeListCheck" :file-name="uploadStep.shapeUpload.data.name" :totalHeight="mainHeight"/>
@ -132,7 +149,8 @@
<awsui-footer>
<div style="float: right;">
<awsui-button v-if="this.active == 2" style="margin-top: 12px;" @click="prev">上一步</awsui-button>
<awsui-button v-if="this.active == 1 || this.active == 2" style="margin-top: 12px;" @click="next">下一步</awsui-button>
<awsui-button v-if="this.active == 1 || this.active == 2" style="margin-top: 12px;" @click="next">下一步
</awsui-button>
<template v-if="this.active == 3">
<awsui-button style="margin-top: 12px;" @click="downloadLog">导出报告</awsui-button>
<awsui-button style="margin-top: 12px;" @click="success">完成</awsui-button>
@ -150,6 +168,7 @@
import checkShape from './check-shape';
import save from './save';
import Save from './save.vue';
export default {
name: "create",
components: {palUpload, createTree, checkProcess, checkShape, save},
@ -224,11 +243,11 @@ import Save from './save.vue';
this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'});
return;
}
if (result.errData.length > 0) {
if (result.okCount != result.totalCount) {
this.$message({message: '校验未通过', type: 'warning'});
return;
}
if (result.okData.length == 0) {
if (result.totalCount.length == 0) {
this.$message({message: '上传文件无数据', type: 'warning'});
return;
}
@ -290,7 +309,8 @@ import Save from './save.vue';
cmd: "com.actionsoft.apps.coe.pal.batch_create_download_template",
wsId: that.wsId,
type: type,
versionIds : versionIds
versionIds: versionIds,
methodCategory: methodCategory
}
};
awsuiAxios.post(data).then(function (ro) {

View File

@ -38,6 +38,7 @@
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
methodCategory: methodCategory,
msgHeight: '20px',
mainHeight: parseInt(this.totalHeight) + 'px',
curCode: '正在导入',
@ -73,7 +74,8 @@
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_data_save",
param : JSON.stringify(that.param)
param: JSON.stringify(that.param),
methodCategory: methodCategory
}
};
awsuiAxios.post(data).then(function (ro) {
@ -178,6 +180,7 @@
background-color: #2c2c2c;
color: #58A0F0;
}
#mycode >>> .CodeMirror {
height: auto !important;
}