批处理前端

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

@ -1,217 +1,200 @@
<template>
<div v-loading="loading">
<!--上传的清单内容预览-->
<div v-if="checkResult.checkTemplateResult == 'ok'">
<div :style="{height: msgHeight}" v-html="checkResult.resultMsg"></div>
<div>
<el-table
id='table'
:height="tableHeight"
:data="tableData"
border
size="medium"
style="width: 100%">
<el-table-column
prop='index'
label=''
align='center'
width=50px
>
</el-table-column>
<el-table-column
v-for="(item) in tableTitle"
:key=item
:prop=item
:label="item">
<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>
</span>
</template>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!--上传的清单校验失败时显示内容-->
<div v-if="checkResult.checkTemplateResult != 'ok'">
<div style="background-color:#F56C6C;padding: 10px;" v-html="checkResult.checkTemplateResultMsg"></div>
</div>
<div v-loading="loading">
<!--上传的清单内容预览-->
<div v-if="checkResult.checkTemplateResult == 'ok'">
<div :style="{height: msgHeight}" v-html="checkResult.resultMsg"></div>
<div>
<el-table
id='table'
:height="tableHeight"
:data="tableData"
border
size="medium"
style="width: 100%">
<!-- ExcelNo -->
<el-table-column
prop='excelNo'
label='1'
align='center'
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, index) in tableTitle"
:key=item
:prop=item
:label="item"
min-width="150">
<template slot-scope="scope">
<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>
<!--上传的清单校验失败时显示内容-->
<div v-if="checkResult.checkTemplateResult != 'ok'">
<div style="background-color:#F56C6C;padding: 10px;" v-html="checkResult.checkTemplateResultMsg"></div>
</div>
</div>
</template>
<script>
import awsuiAxios from "../../awsuiAxios";
import awsuiAxios from "../../awsuiAxios";
export default {
name: "check-process",
props: {
fileName: {//
type: String,
default: ''
},
totalHeight: {
type: String,
default: 0
}
},
data() {
return {
loading: false,
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
msgHeight: '20px',
tableHeight: parseInt(this.totalHeight) - 20 + 'px',
tableTitle: [],
tableData: [],
checkResult: {
okData: [],
errData: [],
existData: [],
excelExistData: [],
resultMsg: '正在校验...',
chheckDone: false,
checkTemplateResult: 'ok',
checkTemplateResultMsg: '',
}
}
},
mounted() {
this.initData();
},
methods: {
initData() {
const that = this;
that.loading = true;
const params = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_process_data_check",
wsId: that.wsId,
teamId: that.teamId,
type: 'processList',
fileValue: that.processFileValue,
fileName: that.fileName
}
};
awsuiAxios.post(params).then(function (ro) {
that.loading = false;
if (ro.result == 'ok') {
//
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>条记录';
if (okCount > 0) {
if (totalCount == okCount) {
result += ',全部校验通过';
} else {
result += ',校验通过<span style="font-weight:bold;">' + okCount + '</span>条';
}
}
if (errCount > 0) {
result += ',校验失败<span style="color:red;font-weight:bold;">' + errCount + '</span>条';
}
if (existCount > 0) {
result += ',重复数据<span style="color:red;font-weight:bold;">' + existCount + '</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.checkResult.chheckDone = true;
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {// excel
// that.$message.error(ro.msg);
that.checkResult.checkTemplateResult = 'error';
that.checkResult.checkTemplateResultMsg = ro.msg;
}
}).catch(error=>{
console.log(error);
})
}
}
export default {
name: "check-process",
props: {
fileName: {//
type: String,
default: ''
},
totalHeight: {
type: String,
default: 0
}
},
data() {
return {
loading: false,
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
methodCategory: methodCategory,
msgHeight: '20px',
tableHeight: parseInt(this.totalHeight) - 20 + 'px',
tableTitle: [],
tableData: [],
checkResult: {
okData: [],
errData: [],
existData: [],
excelExistData: [],
resultMsg: '正在校验...',
chheckDone: false,
checkTemplateResult: 'ok',
checkTemplateResultMsg: '',
totalCount: 0,
okCount: 0,
repeatCount: 0,
blankCount: 0,
errCount: 0,
noMatchCount: 0
}
}
},
mounted() {
this.initData();
},
methods: {
initData() {
const that = this;
that.loading = true;
const params = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_process_data_check",
wsId: that.wsId,
teamId: that.teamId,
type: 'processList',
fileValue: that.processFileValue,
fileName: that.fileName,
methodCategory: methodCategory
}
};
awsuiAxios.post(params).then(function (ro) {
that.loading = false;
if (ro.result == 'ok') {
//
that.tableTitle = ro.data.data.titleRow;
//
const data = ro.data.data.data;
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 += ',全部校验通过';
} else {
result += ',通过<span style="font-weight:bold;">' + okCount + '</span>条';
}
}
if (errCount > 0) {
result += ',失败<span style="color:red;font-weight:bold;">' + errCount + '</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;
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'});
} else {// excel
// that.$message.error(ro.msg);
that.checkResult.checkTemplateResult = 'error';
that.checkResult.checkTemplateResultMsg = ro.msg;
}
}).catch(error => {
console.log(error);
})
}
}
}
</script>
<style scoped>

View File

@ -1,457 +1,477 @@
<template>
<awsui-layout>
<awsui-header id="header">
<el-steps :active="active" align-center>
<el-step title="上传" icon="el-icon-upload"></el-step>
<el-step title="校验" icon="el-icon-warning"></el-step>
<el-step title="结果" icon="el-icon-success"></el-step>
</el-steps>
</awsui-header>
<awsui-main :style="{height: mainHeight, padding: '0'}">
<!-- 上传 -->
<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">
<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>
<div style="padding-top: 30px;">
<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>
</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>
</div>
</div>
<div v-show="false">
<pal-upload ref="processUpload" style="width: 100%;"
class="upload-demo"
:appId=appId
:repositoryName=repositoryName
:groupValue=groupValue
:fileValue=processFileValue
:on-preview="handleProcessPreview"
:on-success="handleProcessSuccess"
:on-remove="handleProcessRemove"
:on-error="handleProcessError"
:before-remove="beforeProcessRemove"
:before-upload="beforeProcessUpload"
:limit="1"
:on-exceed="handleProcessExceed"
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>
</div>
</pal-upload>
</div>
</div>
</awsui-tab-pane>
<awsui-tab-pane label="批量创建模型结构" name="shapeList">
<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>
<div style="padding-top: 30px;">
<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>
</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>
</div>
</div>
<div v-show="false">
<pal-upload ref="shapeUpload" style="width: 100%;"
class="upload-demo"
:appId=appId
:repositoryName=repositoryName
:groupValue=groupValue
:fileValue=shapeFileValue
:on-preview="handleShapePreview"
:on-success="handleShapeSuccess"
:on-remove="handleShapeRemove"
:on-error="handleShapeError"
:before-remove="beforeShapeRemove"
:before-upload="beforeShapeUpload"
:limit="1"
:on-exceed="handleShapeExceed"
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>
</div>
</pal-upload>
</div>
</div>
<create-tree
ref="createTree"
:visible.sync="uploadStep.shapeUpload.createTree.visible"
:wsId="wsId"
:teamId="teamId"
:categorys="methodCategory"
:multiple=true
v-on:cancel="uploadStep.shapeUpload.createTree.visible = false"
v-on:getResult="saveCreateTreeResult"
:title="uploadStep.shapeUpload.createTree.title"
></create-tree>
<awsui-layout>
<awsui-header id="header">
<el-steps :active="active" align-center>
<el-step title="上传" icon="el-icon-upload"></el-step>
<el-step title="校验" icon="el-icon-warning"></el-step>
<el-step title="结果" icon="el-icon-success"></el-step>
</el-steps>
</awsui-header>
<awsui-main :style="{height: mainHeight, padding: '0'}">
<!-- 上传 -->
<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">
<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>
<div style="padding-top: 30px;">
<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>
</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>
</div>
</div>
<div v-show="false">
<pal-upload ref="processUpload" style="width: 100%;"
class="upload-demo"
:appId=appId
:repositoryName=repositoryName
:groupValue=groupValue
:fileValue=processFileValue
:on-preview="handleProcessPreview"
:on-success="handleProcessSuccess"
:on-remove="handleProcessRemove"
:on-error="handleProcessError"
:before-remove="beforeProcessRemove"
:before-upload="beforeProcessUpload"
:limit="1"
:on-exceed="handleProcessExceed"
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>
</div>
</pal-upload>
</div>
</div>
</awsui-tab-pane>
<awsui-tab-pane label="批量创建模型结构" name="shapeList">
<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>
<div style="padding-top: 30px;">
<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>
</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>
</div>
</div>
<div v-show="false">
<pal-upload ref="shapeUpload" style="width: 100%;"
class="upload-demo"
:appId=appId
:repositoryName=repositoryName
:groupValue=groupValue
:fileValue=shapeFileValue
:on-preview="handleShapePreview"
:on-success="handleShapeSuccess"
:on-remove="handleShapeRemove"
:on-error="handleShapeError"
:before-remove="beforeShapeRemove"
:before-upload="beforeShapeUpload"
:limit="1"
:on-exceed="handleShapeExceed"
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>
</div>
</pal-upload>
</div>
</div>
<create-tree
ref="createTree"
:visible.sync="uploadStep.shapeUpload.createTree.visible"
:wsId="wsId"
:teamId="teamId"
:categorys="methodCategory"
:multiple=true
v-on:cancel="uploadStep.shapeUpload.createTree.visible = false"
v-on:getResult="saveCreateTreeResult"
:title="uploadStep.shapeUpload.createTree.title"
></create-tree>
</awsui-tab-pane>
</awsui-tabs>
</div>
<!-- 校验 -->
<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"/>
</template>
<template v-if="checkStep.type == 'shapeList'">
<check-shape ref="shapeListCheck" :file-name="uploadStep.shapeUpload.data.name" :totalHeight="mainHeight"/>
</template>
</div>
<!-- 结果 -->
<div v-if="this.active == 3" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}">
<save ref="save" :totalHeight="mainHeight" :param="saveData"/>
</div>
</awsui-main>
<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>
<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>
</template>
</div>
</awsui-footer>
</awsui-layout>
</awsui-tab-pane>
</awsui-tabs>
</div>
<!-- 校验 -->
<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"/>
</template>
<template v-if="checkStep.type == 'shapeList'">
<check-shape ref="shapeListCheck" :file-name="uploadStep.shapeUpload.data.name" :totalHeight="mainHeight"/>
</template>
</div>
<!-- 结果 -->
<div v-if="this.active == 3" :style="{height: parseInt(mainHeight) - 40 + 'px', width: '100%'}">
<save ref="save" :totalHeight="mainHeight" :param="saveData"/>
</div>
</awsui-main>
<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>
<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>
</template>
</div>
</awsui-footer>
</awsui-layout>
</template>
<script>
import palUpload from '../components/upload/index';
import awsuiAxios from "../../awsuiAxios";
import createTree from './components/createTree/index';
import checkProcess from './check-process';
import checkShape from './check-shape';
import save from './save';
import palUpload from '../components/upload/index';
import awsuiAxios from "../../awsuiAxios";
import createTree from './components/createTree/index';
import checkProcess from './check-process';
import checkShape from './check-shape';
import save from './save';
import Save from './save.vue';
export default {
name: "create",
components: {palUpload, createTree, checkProcess, checkShape, save},
data() {
return {
active: 1,
wsId: wsId,
teamId: teamId,
methodCategory: methodCategory,
appId: appId,
repositoryName: repositoryName,
groupValue: groupValue,
processFileValue: processFileValue,
shapeFileValue: shapeFileValue,
mainHeight: (document.documentElement.clientHeight) - 60 - 40 + 'px',
uploadStep: {
activeName: 'processList',
loading: false,
processUpload: {//
status: 0,
fileList: [],//
data: {},//
},
shapeUpload: {//
status: 0,
fileList: [],
data: {},
createTree : {
visible: false,
title: '请选择流程'
}
}
},
checkStep: {
type: ''
},
fileList: [],
saveData: {//
wsId: wsId,
teamId: teamId,
type: '',
fileValue: '',
fileName: '',
data: {
okData: []
}
}
};
export default {
name: "create",
components: {palUpload, createTree, checkProcess, checkShape, save},
data() {
return {
active: 1,
wsId: wsId,
teamId: teamId,
methodCategory: methodCategory,
appId: appId,
repositoryName: repositoryName,
groupValue: groupValue,
processFileValue: processFileValue,
shapeFileValue: shapeFileValue,
mainHeight: (document.documentElement.clientHeight) - 60 - 40 + 'px',
uploadStep: {
activeName: 'processList',
loading: false,
processUpload: {//
status: 0,
fileList: [],//
data: {},//
},
mounted() {
const that = this;
that.resize();
},
methods: {
prev() {//
if (this.active == 2) {
this.checkStep.type = '';
}
this.active--;
},
next() {//
if (this.active == 1) {//
if (!this.checkUploadFile()) {
this.$message({message: '请上传Excel文件', type: 'warning'});
return;
}
this.checkStep.type = this.uploadStep.activeName;
} else if (this.active == 2) {
if (this.checkStep.type == 'processList') {//
const result = this.$refs.processListCheck.checkResult;
if (!result.chheckDone) {
this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'});
return;
}
if (result.errData.length > 0) {
this.$message({message: '校验未通过', type: 'warning'});
return;
}
if (result.okData.length == 0) {
this.$message({message: '上传文件无数据', type: 'warning'});
return;
}
this.saveData.type = 'processList';
this.saveData.fileValue = this.processFileValue;
this.saveData.fileName = this.uploadStep.processUpload.data.name;
this.saveData.data.okData = result.okData;
} else {//
const result = this.$refs.shapeListCheck.checkResult;
if (!result.chheckDone) {
this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'});
return;
}
if (!result.isOk) {
this.$message({message: '校验未通过', type: 'warning'});
return;
}
this.saveData.type = 'shapeList';
this.saveData.fileValue = this.shapeFileValue;
this.saveData.fileName = this.uploadStep.shapeUpload.data.name;
this.saveData.data.okData = result.okData;
}
}
this.active++;
},
success() {//
parent.closeBatchCreateFn([]);
},
downloadLog() {//
this.$refs.save.downloadLog();
},
checkUploadFile() {//
if (this.uploadStep.activeName == 'processList') {
if (this.uploadStep.processUpload.status == 1) {
return true;
}
} else if (this.uploadStep.activeName == 'shapeList') {
if (this.uploadStep.shapeUpload.status == 1) {
return true;
}
}
return false;
},
uploadFile(type) {//
if (type == 'process') {//
this.$refs.processUpload.clearFiles();
document.getElementById("selectProcessFileButton").click();
} else {//
this.$refs.shapeUpload.clearFiles();
document.getElementById("selectShapeFileButton").click();
}
},
downloadTemplate(type, versionIds) { //
const that = this;
that.uploadStep.loading = true;
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_download_template",
wsId : that.wsId,
type : type,
versionIds : versionIds
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
window.open(ro.data.url);
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
},
downLoadUploaded(fileValue, name) {//
const that = this;
that.uploadStep.loading = true;
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_download",
fileValue : fileValue,
fileName : name
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
window.location.href = ro.data.url;
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
},
deleteUploaded(fileValue, name) {//
const that = this;
that.uploadStep.loading = true;
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_delete",
fileValue : fileValue,
fileName : name
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
if (that.uploadStep.activeName == 'processList') {//
that.$refs.processUpload.clearFiles();
that.uploadStep.processUpload.status = 0;
that.uploadStep.processUpload.data = {};
} else {//
that.$refs.shapeUpload.clearFiles();
that.uploadStep.shapeUpload.status = 0;
that.uploadStep.shapeUpload.data = {};
}
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
},
/******模型结构模板下载start*******/
openRepositoryTreeDlg () {//
this.uploadStep.shapeUpload.createTree.visible = true;
},
saveCreateTreeResult(data) {//
if (data.length == 0) {
this.$message({message: '未选择任何模型,下载模板被取消', type: 'warning'});
} else {
this.downloadTemplate('shapeList', data.join(','));
}
},
/******模型结构模板下载end*******/
/******模型清单模板上传start*********/
handleProcessRemove(file, fileList) {
this.uploadStep.processUpload.status = 0;
},
handleProcessPreview(file) {
},
handleProcessExceed(files, fileList) {
},
handleProcessError(err, file, fileList) {
},
beforeProcessUpload(file) {
//
if (file.size / 1024 / 1024 > 10) { //10M
this.$message.warning('文件不允许超过10M');
return false;
}
},
handleProcessSuccess(response, file, fileList) {
const that = this;
that.uploadStep.processUpload.status = 1;
that.uploadStep.processUpload.data = {
name: file.name,
size: file.size
};
},
beforeProcessRemove(file, fileList) {
},
/******模型清单模板上传end*********/
/******模型结构模板上传start*********/
handleShapeRemove(file, fileList) {
this.uploadStep.shapeUpload.status = 0;
},
handleShapePreview(file) {
},
handleShapeExceed(files, fileList) {
},
handleShapeError(err, file, fileList) {
},
beforeShapeUpload(file) {
//
if (file.size / 1024 / 1024 > 10) { //10M
this.$message.warning('文件不允许超过10M');
return false;
}
},
handleShapeSuccess(response, file, fileList) {
const that = this;
that.uploadStep.shapeUpload.status = 1;
that.uploadStep.shapeUpload.data = {
name: file.name,
size: file.size
};
},
beforeShapeRemove(file, fileList) {
},
/******模型结构模板上传end*********/
resize() {// window.resize
const that = this
let resizeTimer = null;
window.onresize = () => {
return (() => {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function(){
that.mainHeight = (document.documentElement.clientHeight) - 60 - 40 + 'px';
} , 400);
})()
}
},
shapeUpload: {//
status: 0,
fileList: [],
data: {},
createTree: {
visible: false,
title: '请选择流程'
}
}
}
},
checkStep: {
type: ''
},
fileList: [],
saveData: {//
wsId: wsId,
teamId: teamId,
type: '',
fileValue: '',
fileName: '',
data: {
okData: []
}
}
};
},
mounted() {
const that = this;
that.resize();
},
methods: {
prev() {//
if (this.active == 2) {
this.checkStep.type = '';
}
this.active--;
},
next() {//
if (this.active == 1) {//
if (!this.checkUploadFile()) {
this.$message({message: '请上传Excel文件', type: 'warning'});
return;
}
this.checkStep.type = this.uploadStep.activeName;
} else if (this.active == 2) {
if (this.checkStep.type == 'processList') {//
const result = this.$refs.processListCheck.checkResult;
if (!result.chheckDone) {
this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'});
return;
}
if (result.okCount != result.totalCount) {
this.$message({message: '校验未通过', type: 'warning'});
return;
}
if (result.totalCount.length == 0) {
this.$message({message: '上传文件无数据', type: 'warning'});
return;
}
this.saveData.type = 'processList';
this.saveData.fileValue = this.processFileValue;
this.saveData.fileName = this.uploadStep.processUpload.data.name;
this.saveData.data.okData = result.okData;
} else {//
const result = this.$refs.shapeListCheck.checkResult;
if (!result.chheckDone) {
this.$message({message: '正在校验或校验未通过,不支持此操作', type: 'warning'});
return;
}
if (!result.isOk) {
this.$message({message: '校验未通过', type: 'warning'});
return;
}
this.saveData.type = 'shapeList';
this.saveData.fileValue = this.shapeFileValue;
this.saveData.fileName = this.uploadStep.shapeUpload.data.name;
this.saveData.data.okData = result.okData;
}
}
this.active++;
},
success() {//
parent.closeBatchCreateFn([]);
},
downloadLog() {//
this.$refs.save.downloadLog();
},
checkUploadFile() {//
if (this.uploadStep.activeName == 'processList') {
if (this.uploadStep.processUpload.status == 1) {
return true;
}
} else if (this.uploadStep.activeName == 'shapeList') {
if (this.uploadStep.shapeUpload.status == 1) {
return true;
}
}
return false;
},
uploadFile(type) {//
if (type == 'process') {//
this.$refs.processUpload.clearFiles();
document.getElementById("selectProcessFileButton").click();
} else {//
this.$refs.shapeUpload.clearFiles();
document.getElementById("selectShapeFileButton").click();
}
},
downloadTemplate(type, versionIds) { //
const that = this;
that.uploadStep.loading = true;
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_download_template",
wsId: that.wsId,
type: type,
versionIds: versionIds,
methodCategory: methodCategory
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
window.open(ro.data.url);
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
},
downLoadUploaded(fileValue, name) {//
const that = this;
that.uploadStep.loading = true;
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_download",
fileValue: fileValue,
fileName: name
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
window.location.href = ro.data.url;
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
},
deleteUploaded(fileValue, name) {//
const that = this;
that.uploadStep.loading = true;
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_uploaded_file_delete",
fileValue: fileValue,
fileName: name
}
};
awsuiAxios.post(data).then(function (ro) {
that.uploadStep.loading = false;
if (ro.result == 'ok') {
if (that.uploadStep.activeName == 'processList') {//
that.$refs.processUpload.clearFiles();
that.uploadStep.processUpload.status = 0;
that.uploadStep.processUpload.data = {};
} else {//
that.$refs.shapeUpload.clearFiles();
that.uploadStep.shapeUpload.status = 0;
that.uploadStep.shapeUpload.data = {};
}
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
},
/******模型结构模板下载start*******/
openRepositoryTreeDlg() {//
this.uploadStep.shapeUpload.createTree.visible = true;
},
saveCreateTreeResult(data) {//
if (data.length == 0) {
this.$message({message: '未选择任何模型,下载模板被取消', type: 'warning'});
} else {
this.downloadTemplate('shapeList', data.join(','));
}
},
/******模型结构模板下载end*******/
/******模型清单模板上传start*********/
handleProcessRemove(file, fileList) {
this.uploadStep.processUpload.status = 0;
},
handleProcessPreview(file) {
},
handleProcessExceed(files, fileList) {
},
handleProcessError(err, file, fileList) {
},
beforeProcessUpload(file) {
//
if (file.size / 1024 / 1024 > 10) { //10M
this.$message.warning('文件不允许超过10M');
return false;
}
},
handleProcessSuccess(response, file, fileList) {
const that = this;
that.uploadStep.processUpload.status = 1;
that.uploadStep.processUpload.data = {
name: file.name,
size: file.size
};
},
beforeProcessRemove(file, fileList) {
},
/******模型清单模板上传end*********/
/******模型结构模板上传start*********/
handleShapeRemove(file, fileList) {
this.uploadStep.shapeUpload.status = 0;
},
handleShapePreview(file) {
},
handleShapeExceed(files, fileList) {
},
handleShapeError(err, file, fileList) {
},
beforeShapeUpload(file) {
//
if (file.size / 1024 / 1024 > 10) { //10M
this.$message.warning('文件不允许超过10M');
return false;
}
},
handleShapeSuccess(response, file, fileList) {
const that = this;
that.uploadStep.shapeUpload.status = 1;
that.uploadStep.shapeUpload.data = {
name: file.name,
size: file.size
};
},
beforeShapeRemove(file, fileList) {
},
/******模型结构模板上传end*********/
resize() {// window.resize
const that = this
let resizeTimer = null;
window.onresize = () => {
return (() => {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
that.mainHeight = (document.documentElement.clientHeight) - 60 - 40 + 'px';
}, 400);
})()
}
},
}
}
</script>
<style scoped>
#header >>> .el-step__title {
font-size: 14px;
#header >>> .el-step__title {
font-size: 14px;
}
</style>

View File

@ -1,184 +1,187 @@
<template>
<div v-loading="loading" :style="{height: mainHeight, 'background-color': '#2c2c2c'}">
<codemirror
id="mycode"
ref="mycode"
style="height: auto"
v-model="curCode"
:options="cmOptions"
class="code"
/>
</div>
<div v-loading="loading" :style="{height: mainHeight, 'background-color': '#2c2c2c'}">
<codemirror
id="mycode"
ref="mycode"
style="height: auto"
v-model="curCode"
:options="cmOptions"
class="code"
/>
</div>
</template>
<script>
import awsuiAxios from "../../awsuiAxios";
import { codemirror } from 'vue-codemirror'
import "codemirror/theme/ambiance.css"; // theme
require("codemirror/mode/javascript/javascript"); // jsmode
import awsuiAxios from "../../awsuiAxios";
import {codemirror} from 'vue-codemirror'
import "codemirror/theme/ambiance.css"; // theme
require("codemirror/mode/javascript/javascript"); // jsmode
export default {
name: "check-process",
props: {
param: {//
type: Object,
default: function () {
return {}
}
},
totalHeight: {
type: String,
default: 0
}
},
components: {codemirror},
data() {
return {
loading: false,
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
msgHeight: '20px',
mainHeight: parseInt(this.totalHeight) + 'px',
curCode: '正在导入',
cmOptions: {
value:'',
mode:"text/html",
theme: "ambiance",
lineNumbers: false,
styleActiveLine: true,
tabSize: 4,
autofocus: true,
scrollbarStyle: "null",
readOnly:true,
},
result: {//
path: '',
type: '',
logId: '',
count: 0,
executeDone: false,
interval: null, //
timer:0, //
}
}
},
mounted() {
this.save();
},
methods: {
save() {//
const that = this;
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_data_save",
param : JSON.stringify(that.param)
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
//
that.result.path = ro.data.path;
that.result.logId = ro.data.logId;
that.result.type = ro.data.type;
that.result.count = 0;
that.getImportInfoEvent();
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
},
getImportInfoEvent() {//
this.result.interval = setInterval(this.queryLog, 1000)
},
queryLog() {
const that = this;
that.result.timer = new Date().getTime();
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_log_query",
type: that.result.type,
logId: that.result.logId,
path: that.result.path,
timer: that.result.timer
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
if (ro.data.timer == '') {
that.curCode = ro.data.content;
//
that.$nextTick(()=> {
that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1);
});
that.result.executeDone = true;
that.clearInterval();
} else if (parseInt(ro.data.timer) <= that.result.timer){// axios
that.curCode = ro.data.content;
//
that.$nextTick(()=> {
that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1);
});
}
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
},
clearInterval() {
clearInterval(this.result.interval);
},
downloadLog() {
const that = this;
if (that.result.path == '') {
that.$message({message: '获取报告失败', type: 'warning'});
return;
}
if (!that.result.executeDone) {
that.$message({message: '正在导入,请稍等', type: 'warning'});
return;
}
const data = {
url:'jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.batch_create_log_download",
type: that.result.type,
path: that.result.path
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
window.open(ro.data.url);
parent.closeBatchCreateFn([]);
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error=>{
console.log(error);
})
}
}
export default {
name: "check-process",
props: {
param: {//
type: Object,
default: function () {
return {}
}
},
totalHeight: {
type: String,
default: 0
}
},
components: {codemirror},
data() {
return {
loading: false,
wsId: wsId,
teamId: teamId,
processFileValue: processFileValue,
methodCategory: methodCategory,
msgHeight: '20px',
mainHeight: parseInt(this.totalHeight) + 'px',
curCode: '正在导入',
cmOptions: {
value: '',
mode: "text/html",
theme: "ambiance",
lineNumbers: false,
styleActiveLine: true,
tabSize: 4,
autofocus: true,
scrollbarStyle: "null",
readOnly: true,
},
result: {//
path: '',
type: '',
logId: '',
count: 0,
executeDone: false,
interval: null, //
timer: 0, //
}
}
},
mounted() {
this.save();
},
methods: {
save() {//
const that = this;
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_data_save",
param: JSON.stringify(that.param),
methodCategory: methodCategory
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
//
that.result.path = ro.data.path;
that.result.logId = ro.data.logId;
that.result.type = ro.data.type;
that.result.count = 0;
that.getImportInfoEvent();
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
},
getImportInfoEvent() {//
this.result.interval = setInterval(this.queryLog, 1000)
},
queryLog() {
const that = this;
that.result.timer = new Date().getTime();
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_log_query",
type: that.result.type,
logId: that.result.logId,
path: that.result.path,
timer: that.result.timer
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
if (ro.data.timer == '') {
that.curCode = ro.data.content;
//
that.$nextTick(() => {
that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1);
});
that.result.executeDone = true;
that.clearInterval();
} else if (parseInt(ro.data.timer) <= that.result.timer) {// axios
that.curCode = ro.data.content;
//
that.$nextTick(() => {
that.$refs.mycode.codemirror.scrollIntoView(that.$refs.mycode.codemirror.lineCount() - 1);
});
}
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
},
clearInterval() {
clearInterval(this.result.interval);
},
downloadLog() {
const that = this;
if (that.result.path == '') {
that.$message({message: '获取报告失败', type: 'warning'});
return;
}
if (!that.result.executeDone) {
that.$message({message: '正在导入,请稍等', type: 'warning'});
return;
}
const data = {
url: 'jd',
data: {
cmd: "com.actionsoft.apps.coe.pal.batch_create_log_download",
type: that.result.type,
path: that.result.path
}
};
awsuiAxios.post(data).then(function (ro) {
if (ro.result == 'ok') {
window.open(ro.data.url);
parent.closeBatchCreateFn([]);
} else if (ro.result == 'warning') {
that.$message({message: ro.msg, type: 'warning'});
} else {
that.$message.error(ro.msg);
}
}).catch(error => {
console.log(error);
})
}
}
}
</script>
<style scoped>
#mycode >>> .CodeMirror-lines {
background-color: #2c2c2c;
color: #58A0F0;
}
#mycode >>> .CodeMirror {
height: auto !important;
}
#mycode >>> .CodeMirror-lines {
background-color: #2c2c2c;
color: #58A0F0;
}
#mycode >>> .CodeMirror {
height: auto !important;
}
</style>