批处理前端
This commit is contained in:
parent
508ad75146
commit
61a94211fc
@ -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>
|
||||
|
||||
@ -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)"></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)"></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)"></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)"></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>
|
||||
@ -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"); // 这里引入的模式的js,根据设置的mode引入,一定要引入!!
|
||||
import awsuiAxios from "../../awsuiAxios";
|
||||
import {codemirror} from 'vue-codemirror'
|
||||
import "codemirror/theme/ambiance.css"; // 这里引入的是主题样式,根据设置的theme的主题引入,一定要引入!!
|
||||
require("codemirror/mode/javascript/javascript"); // 这里引入的模式的js,根据设置的mode引入,一定要引入!!
|
||||
|
||||
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>
|
||||
Loading…
Reference in New Issue
Block a user