Commit d5093a79 by 李耀琨

解决冲突

parents f0cb22fa 4febc18a
<template>
<div class="ef-flow-box" v-if="easyFlowVisible">
<div class="ef-flow-header">
<el-row>
<!--顶部工具菜单-->
<el-col :span="24">
<div class="ef-tooltar">
<el-link type="primary" :underline="false">{{
flowData.name
}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-tooltip
class="item"
effect="dark"
:open-delay="300"
content="保存流程图"
placement="bottom"
>
<el-button
type="text"
icon="el-icon-receiving"
size="large"
></el-button>
</el-tooltip>
<el-divider direction="vertical"></el-divider>
<el-tooltip
class="item"
effect="dark"
:open-delay="300"
content="生产流程图片"
placement="bottom"
>
<el-button
type="text"
icon="el-icon-picture"
size="large"
></el-button>
</el-tooltip>
<el-divider direction="vertical"></el-divider>
<el-tooltip
class="item"
effect="dark"
content="重新绘制"
placement="bottom"
>
<el-button
type="text"
icon="el-icon-refresh"
size="large"
></el-button>
</el-tooltip>
<el-divider direction="vertical"></el-divider>
<el-tooltip
class="item"
effect="dark"
content="点击删除"
placement="bottom"
>
<el-button
type="text"
icon="el-icon-delete"
size="large"
@click="deleteFlow"
></el-button>
</el-tooltip>
<el-divider direction="vertical"></el-divider>
<el-tooltip
class="item"
effect="dark"
content="设置"
placement="bottom"
>
<el-button
type="text"
icon="el-icon-setting"
size="large"
></el-button>
</el-tooltip>
</div>
</el-col>
</el-row>
</div>
<div class="ef-flow-main">
<!-- 画布start -->
<div class="mxgraphClass">
<div id="mxgraph" ref="container"></div>
</div>
</div>
<!-- 输入工具弹框 -->
<el-dialog
title="Excelt输入"
:visible.sync="excelLnput"
width="800px"
:before-close="handleClose"
>
<div id="ExcelInputDialog"></div>
<el-form ref="stepName" :model="stepName" label-width="120px">
<el-form-item label="步骤名称:">
<el-input v-model="stepName.name"></el-input>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" type="border-card" @tab-click="tapClick">
<el-tab-pane label="文件" name="file">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="表格类(引擎):">
<el-select v-model="form.engine" style="width: 100%">
<el-option
v-for="item in engine"
:key="item.code"
:label="item.desc"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="选中的文件:">
<el-button size="small" type="primary" @click="selectFilePath(1)"
>选择文件</el-button
>
<el-card class="box-card">
<el-table :data="ileListData" style="width: 100%">
<el-table-column prop="name" label="文件/目录" width="120">
</el-table-column>
<el-table-column prop="filemask" label="通配符">
</el-table-column>
<el-table-column
prop="exclude_filemask"
label="通配符号(排除)"
width="120"
>
</el-table-column>
<el-table-column prop="file_required" label="要求">
</el-table-column>
<el-table-column prop="include_subfolders" label="包含子目录">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="handleClick(scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteFile(scope.$index, ileListData)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-form-item>
</el-form>
<el-card class="box-card">
<el-form ref="form" :model="form" label-width="200px">
<el-form-item label="从前面的步骤获取文件名:">
<el-checkbox
v-model="form.checked"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="从哪个步骤读文件名:">
<el-select
v-model="form.wAccStep"
style="width: 100%"
:disabled="!form.checked || form.checked == 'N'"
>
<el-option
v-for="item in connectionNode"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="保存文件的字段:">
<el-select
v-model="form.wAccField"
style="width: 100%"
:disabled="!form.checked || form.checked == 'N'"
>
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
</el-form>
</el-card>
</el-tab-pane>
<el-tab-pane label="工作表" name="worksheet">
<h3>要读取的工作表列表</h3>
<el-button type="primary" @click="workClick(true)"
>添加工作表</el-button
>
<br />
<el-card class="box-card">
<el-table :data="worksheetList" style="width: 100%">
<el-table-column prop="name" label="工作表名称" width="120">
</el-table-column>
<el-table-column prop="startrow" label="起始行">
</el-table-column>
<el-table-column prop="startcol" label="起始列">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="workClick(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteRow(scope.$index, worksheetList)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="内容" name="content">
<el-form ref="form" :model="form" label-width="200px">
<el-form-item label="头部:">
<el-checkbox
v-model="form.header"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="没有空行:">
<el-checkbox
v-model="form.noempty"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="停在空白记录:">
<el-checkbox
v-model="form.stoponempty"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="限制:">
<el-input v-model="form.limit"></el-input>
</el-form-item>
<el-form-item label="编码:">
<el-select v-model="form.encoding" filterable style="width: 100%">
<el-option
v-for="item in codingType"
:key="item.index"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="添加文件名">
<el-checkbox
v-model="form.add_to_result_filenames"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="错误处理" name="handling">
<el-form ref="form" :model="form" label-width="130px">
<el-form-item label="严格类型:">
<el-checkbox
v-model="form.strict_types"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="忽略错误:">
<el-checkbox
v-model="form.ignore"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="跳过错误行:">
<el-checkbox
v-model="form.errorLineSkipped"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
true-label="Y"
false-label="N"
></el-checkbox>
</el-form-item>
<el-form-item label="告警文件目录:">
<el-row :gutter="10">
<el-col :span="8">
<el-input
v-model="form.bad_line_files_destination_directory"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">扩展名</el-col>
<el-col :span="8">
<el-input
v-model="form.warningFilesExtension"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
>变量</el-button
></el-col
>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
@click="selectFilePath(2)"
>浏览</el-button
></el-col
>
</el-row>
</el-form-item>
<el-form-item label="错误件目录:">
<el-row :gutter="10">
<el-col :span="8">
<el-input
v-model="form.errorFilesDestinationDirectory"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">扩展名</el-col>
<el-col :span="8">
<el-input
v-model="form.errorFilesExtension"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
>变量</el-button
></el-col
>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
@click="selectFilePath(3)"
>浏览</el-button
></el-col
>
</el-row>
</el-form-item>
<el-form-item label="失败行数文件目录:">
<el-row :gutter="10">
<el-col :span="8">
<el-input
v-model="form.lineNumberFilesDestinationDirectory"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">扩展名</el-col>
<el-col :span="8">
<el-input
v-model="form.lineNumberFilesExtension"
:disabled="!this.form.ignore || this.form.ignore == 'N'"
></el-input>
</el-col>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
>变量</el-button
></el-col
>
<el-col class="line" :span="2.5">
<el-button
:disabled="!this.form.ignore || this.form.ignore == 'N'"
size="mini"
@click="selectFilePath(4)"
>浏览</el-button
></el-col
>
</el-row>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="字段" name="field">
<el-button type="primary" @click="fieldClick(true)"
>添加字段</el-button
>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="名称"> </el-table-column>
<el-table-column prop="type" label="类型"> </el-table-column>
<el-table-column prop="length" label="长度"> </el-table-column>
<el-table-column prop="precision" label="精度"> </el-table-column>
<el-table-column prop="trim_type" label="去除空格类型">
</el-table-column>
<el-table-column prop="repeat" label="重复"> </el-table-column>
<el-table-column prop="format" label="格式"> </el-table-column>
<el-table-column prop="currency" label="货币"> </el-table-column>
<el-table-column prop="decimal" label="小数"> </el-table-column>
<el-table-column prop="group" label="分组"> </el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button
@click="fieldClick(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deletefield(scope.$index, tableData)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="其他输出字段" name="oher ">
<el-form ref="form" :model="form" label-width="150px">
<el-form-item label="文件名称字段:">
<el-input v-model="form.filefield"></el-input>
</el-form-item>
<el-form-item label="Sheet名称字段:">
<el-input v-model="form.sheetfield"></el-input>
</el-form-item>
<el-form-item label="Sheet的行号列:">
<el-input v-model="form.sheetrownumfield"></el-input>
</el-form-item>
<el-form-item label="行号列:">
<el-input v-model="form.rownumfield"></el-input>
</el-form-item>
<el-form-item label="文件名字段:">
<el-input v-model="form.shortFileFieldName"></el-input>
</el-form-item>
<el-form-item label="扩展名字段:">
<el-input v-model="form.extensionFieldName"></el-input>
</el-form-item>
<el-form-item label="路径字段:">
<el-input v-model="form.pathFieldName"></el-input>
</el-form-item>
<el-form-item label="文件大小字段:">
<el-input v-model="form.sizeFieldName"></el-input>
</el-form-item>
<el-form-item label="是否为隐藏文件字段:">
<el-input v-model="form.hiddenFieldName"></el-input>
</el-form-item>
<el-form-item label="最后修改时间字段:">
<el-input v-model="form.lastModificationTimeFieldName"></el-input>
</el-form-item>
<el-form-item label="Uri字段:">
<el-input v-model="form.uriNameFieldName"></el-input>
</el-form-item>
<el-form-item label="Root uri字段:">
<el-input v-model="form.rootUriNameFieldName"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<span slot="footer" class="dialog-footer">
<el-button @click="excelLnput = false">取 消</el-button>
<el-button type="primary" @click="excelLnput = false">确 定</el-button>
</span>
</el-dialog>
<!-- 修改-->
<el-dialog
title="编辑"
:visible.sync="edit"
width="500px"
:before-close="handleClose"
>
<el-form ref="form" :model="formFile" label-width="150px">
<el-form-item label="文件/目录:">
<el-input v-model="formFile.name" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="通配符:">
<el-input v-model="formFile.filemask"></el-input>
</el-form-item>
<el-form-item label="通配符号(排除):">
<el-input v-model="formFile.exclude_filemask"></el-input>
</el-form-item>
<el-form-item label="要求:">
<el-select v-model="formFile.file_required" style="width: 100%">
<el-option label="是" value="1"></el-option>
<el-option label="否" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="包含子目录:">
<el-select v-model="formFile.include_subfolders" style="width: 100%">
<el-option label="是" value="1"></el-option>
<el-option label="否" value="0"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="edit = false">取 消</el-button>
<el-button type="primary" @click="edit = false">确 定</el-button>
</span>
</el-dialog>
<!-- 工作添加/修改-->
<el-dialog
title="编辑"
:visible.sync="work"
width="500px"
:before-close="handleClose"
>
<el-form ref="form" :model="workForm" label-width="150px">
<el-form-item label="工作表名称:">
<el-input v-model="workForm.name"></el-input>
</el-form-item>
<el-form-item label="起始行:">
<el-input v-model="workForm.startLine"></el-input>
</el-form-item>
<el-form-item label="起始列:">
<el-input v-model="workForm.startColumn"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="work = false">取 消</el-button>
<el-button type="primary" @click="addWork">确 定</el-button>
</span>
</el-dialog>
<!-- 字段添加/修改-->
<el-dialog
title="编辑"
:visible.sync="field"
width="500px"
:before-close="handleClose"
>
<el-form ref="form" :model="fieldForm" label-width="120px">
<el-form-item label="名称:">
<el-input v-model="fieldForm.name"></el-input>
</el-form-item>
<el-form-item label="类型:">
<el-select v-model="fieldForm.type" style="width: 100%">
<el-option
v-for="item in fieldType"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item label="长度:">
<el-input v-model="fieldForm.length"></el-input>
</el-form-item>
<el-form-item label="精度:">
<el-input v-model="fieldForm.accuracy"></el-input>
</el-form-item>
<el-form-item label="去除空格类型:">
<el-select v-model="fieldForm.space" style="width: 100%">
<el-option label="不去掉空格" value="none"></el-option>
<el-option label="去掉左空格" value="left"></el-option>
<el-option label="去掉右空格" value="right"></el-option>
<el-option label="去掉左右两端空格" value="both"></el-option>
</el-select>
</el-form-item>
<el-form-item label="重复:">
<el-input v-model="fieldForm.repeat"></el-input>
</el-form-item>
<el-form-item label="格式:">
<el-select v-model="fieldForm.format" style="width: 100%">
<el-option
v-for="item in fieldFormat"
:key="item.index"
:label="item.name"
:value="item.name"
/></el-select>
</el-form-item>
<el-form-item label="货币:">
<el-input v-model="fieldForm.currency"></el-input>
</el-form-item>
<el-form-item label="小数:">
<el-input v-model="fieldForm.decimal"></el-input>
</el-form-item>
<el-form-item label="分组:">
<el-input v-model="fieldForm.grouping"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="field = false">取 消</el-button>
<el-button type="primary" @click="addField">确 定</el-button>
</span>
</el-dialog>
<!-- 表输入-->
<el-dialog
title="表输入"
:visible.sync="TableInputDialog"
width="800px"
:before-close="handleClose"
>
<tableInput
:disabled="true"
:connectionNode="connectionNode"
:stepName="stepName"
>
</tableInput>
<span slot="footer" class="dialog-footer">
<el-button @click="TableInputDialog = false">取 消</el-button>
<el-button type="primary" @click="TableInputDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 获取系统信息-->
<el-dialog
title="获取系统信息"
:visible.sync="SystemInfoDialog"
width="800px"
:before-close="handleClose"
>
<getSystemInformation :disabled="true"> </getSystemInformation>
<span slot="footer" class="dialog-footer">
<el-button @click="SystemInfoDialog = false">取 消</el-button>
<el-button type="primary" @click="SystemInfoDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 自定义常量数据-->
<el-dialog
title="自定义常量数据"
:visible.sync="ConstantDialog"
width="800px"
:before-close="handleClose"
>
<customConstant :disabled="true"> </customConstant>
<span slot="footer" class="dialog-footer">
<el-button @click="ConstantDialog = false">取 消</el-button>
<el-button type="primary" @click="ConstantDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 生成随机数-->
<el-dialog
title="生成随机数"
:visible.sync="RandomValueDialog"
width="800px"
:before-close="handleClose"
>
<randomNumber :disabled="true"> </randomNumber>
<span slot="footer" class="dialog-footer">
<el-button @click="RandomValueDialog = false">取 消</el-button>
<el-button type="primary" @click="RandomValueDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 生成记录-->
<el-dialog
title="生成记录"
:visible.sync="RowGeneratorDialog"
width="800px"
:before-close="handleClose"
>
<generatingRecords :disabed="true"></generatingRecords>
<span slot="footer" class="dialog-footer">
<el-button @click="RowGeneratorDialog = false">取 消</el-button>
<el-button type="primary" @click="RowGeneratorDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 文本文件输入-->
<el-dialog
title="文本文件输入"
:visible.sync="TextFileInputDialog"
width="800px"
:before-close="handleClose"
>
<textFileInput
:disabed="true"
:connectionNode="connectionNode"
></textFileInput>
<span slot="footer" class="dialog-footer">
<el-button @click="TextFileInputDialog = false">取 消</el-button>
<el-button type="primary" @click="TextFileInputDialog = false"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 文件浏览器-->
<el-dialog
title="文件浏览器"
:visible.sync="filePathSelection"
width="500px"
:before-close="handleClose"
>
<browseFiles :disabed="true" v-on:route="route"></browseFiles>
<span slot="footer" class="dialog-footer">
<el-button @click="filePathSelection = false">取 消</el-button>
<el-button type="primary" @click="addFilePathSelection"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 输出弹窗start=============== -->
<outDialog
ref="tableOutPut"
:tableOutPutVisible.sync="tableOutPutVisible"
@fathertrans="fathertrans"
></outDialog>
<insertOrUpdate
ref="insertOrdate"
:InsertOrUpdateVisible.sync="InsertOrUpdateVisible"
></insertOrUpdate>
<excelOutPutDialog
ref="excelOut"
:excelOutPutVisible.sync="excelOutPutVisible"
></excelOutPutDialog>
<updateDialog
ref="update"
:updateVisible.sync="updateVisible"
></updateDialog>
<synDialog ref="syn" :synVisible.sync="synVisible"></synDialog>
<delDialog ref="del" :deleteVisible.sync="deleteVisible"></delDialog>
<sqlDialog ref="sql" :sqlVisible.sync="sqlVisible"></sqlDialog>
<textFileDialog
ref="textFile"
:fileVisible.sync="fileVisible"
></textFileDialog>
<microDialog ref="mic" :microVisible.sync="microVisible"></microDialog>
<!-- 输出弹窗end================== -->
</div>
</template>
<script>
import draggable from "vuedraggable";
// 使用修改后的jsplumb
import lodash from "lodash"; //JavaScript 实用工具库
import {
excelSheetType,
previousSteps,
inputOutputFields,
availableCharsets,
valueFormat,
valueMeta,
save,
newStep
} from "@/api/kettle/link";
// 输入弹窗
import tableInput from "../appBulletFrame/tableInput";
import getSystemInformation from "../appBulletFrame/getSystemInformation";
import customConstant from "../appBulletFrame/customConstant";
import randomNumber from "../appBulletFrame/randomNumber";
import generatingRecords from "../appBulletFrame/generatingRecords";
import textFileInput from "../appBulletFrame/textFileInput";
import browseFiles from "../appBulletFrame/browseFiles";
// 输出弹窗start******************************************
import outDialog from "../../../output-dialog/table-out";
import insertOrUpdate from "../../../output-dialog/insertOrUpdate";
import excelOutPutDialog from "../../../output-dialog/Excel-output";
import updateDialog from "../../../output-dialog/update";
import synDialog from "../../../output-dialog/synchronize";
import delDialog from "../../../output-dialog/delete";
import sqlDialog from "../../../output-dialog/sqlFileOutput";
import textFileDialog from "../../../output-dialog/text-file-output";
import microDialog from "../../../output-dialog/micro-excel";
// 输出弹窗end********************************************
import {
mxGraph,
mxUtils,
mxEvent,
mxCell,
mxKeyHandler,
mxRubberband,
mxConstants,
mxStencilRegistry,
mxStencil,
mxCodec,
mxGraphModel,
mxGeometry,
} from "mxgraph-js";
// XML
// import {
// mxUtils as mxUtils,
// mxGraph as mxGraph,
// mxEvent as mxEvent,
// mxKeyHandler as mxKeyHandler,
// mxRubberband as mxRubberband,
// mxConstants as mxConstants,
// mxStencilRegistry as mxStencilRegistry,
// mxStencil as mxStencil,
// mxCodec as mxCodec,
// mxGraphModel as mxGraphModel,
// mxGeometry as mxGeometry,
// } from "mxgraph/javascript/mxClient";
export default {
// props: {
// dialogVisibleFourth: {
// type: Boolean,
// default: false,
// },
// },
props: ["blankCanvas"], //从父组件传过来的值
data() {
return {
keyHandler: null,
palettes: {},
graphXml: "",
xmlDocuments:"",//获取解码的xml
// mxl=================================
InsertOrUpdateVisible: false,
tableOutPutVisible: false,
excelOutPutVisible: false,
updateVisible: false,
synVisible: false,
deleteVisible: false,
sqlVisible: false,
fileVisible: false,
microVisible: false,
// mxl=================================
// 输入模块
ileListData: [],
worksheetList: [],
publicData: [], //全部连接
connectionNode: {},
codingType: [],
routeState: 0,
filePathSelection: false,
TextFileInputDialog: false,
RowGeneratorDialog: false,
TableInputDialog: false,
SystemInfoDialog: false,
ConstantDialog: false,
RandomValueDialog: false,
excelLnput: false,
dataState: false,
edit: false,
work: false,
field: false,
form: {},
formFile: {},
activeName: "file",
fieldType: [],
fieldFormat: [],
stepName: {},
tableData: [
{
filemask: "",
name: "王小虎",
exclude_filemask: "",
file_required: "0",
include_subfolders: "1",
},
],
engine: [],
// 画布模块
isShowIcon: false,
isLeftMenu: true,
isShowR: false,
// graph 实例
graph: null,
// 控制画布销毁
easyFlowVisible: true,
// 是否加载完毕标志位
loadEasyFlowFinish: false,
// 数据
flowData: {},
// 激活的元素、可能是节点、可能是连线
activeElement: {
// 可选值 node 、line
type: undefined,
// 节点ID
nodeId: undefined,
// 连线ID
sourceId: undefined,
targetId: undefined,
},
zoom: 0.5,
workForm: {},
fieldForm: {},
};
},
// 一些基础配置移动该文件中
// mixins: [easyFlowMixin],
components: {
tableInput,
draggable,
getSystemInformation,
generatingRecords,
customConstant,
randomNumber,
textFileInput,
browseFiles,
// FlowNodeForm
// 弹窗组件start***********************
outDialog, //表输出
insertOrUpdate, //插入或更新
excelOutPutDialog,
updateDialog,
synDialog,
delDialog,
sqlDialog,
textFileDialog,
microDialog,
// 弹窗组件end***********************
},
//自定义指令 https://www.jb51.net/article/108047.htm
directives: {
flowDrag: {
// bind(el, binding, vnode, oldNode) {
// if (!binding) {
// return;
// }
// el.onmousedown = (e) => {
// if (e.button == 2) {
// // 右键不管
// return;
// }
// // 鼠标按下,计算当前原始距离可视区的高度
// let disX = e.clientX;
// let disY = e.clientY;
// el.style.cursor = "move";
// document.onmousemove = function (e) {
// // 移动时禁止默认事件
// e.preventDefault();
// const left = e.clientX - disX;
// disX = e.clientX;
// el.scrollLeft += -left;
// const top = e.clientY - disY;
// disY = e.clientY;
// el.scrollTop += -top;
// };
// document.onmouseup = function (e) {
// el.style.cursor = "auto";
// document.onmousemove = null;
// document.onmouseup = null;
// };
// };
// },
},
},
mounted() {
this.createGraph();
this.initToolbar();
this.initGraph();
this.$refs.container.style.background = 'url("./mxgraph/images/grid.gif")';
},
methods: {
// 子组件发射回来的弹窗变量变为true
fathertrans(res) {
// this.dialogVisibleFourth=res;
this.$emit("update:dialogVisibleFourth", res);
console.log("发射回父组件====");
},
fileChnageInput(e) {
console.log(e);
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
deletefield(index, rows) {
rows.splice(index, 1);
},
deleteFile(index, rows) {
rows.splice(index, 1);
},
tapClick() {},
// 文件
handleClick(val) {
this.edit = !this.edit;
this.formFile = val;
},
// 字段
addField() {
this.field = !this.field;
if (this.dataState) {
this.tableData.push(this.fieldForm);
} else {
}
},
fieldClick(state, val) {
this.field = !this.field;
this.dataState = state;
if (state) {
this.fieldForm = {};
} else {
this.fieldForm = val;
}
},
// 工作表
workClick(state, val) {
this.work = !this.work;
this.dataState = state;
if (state) {
this.workForm = {};
} else {
this.workForm = val;
}
},
addWork() {
this.work = !this.work;
if (this.dataState) {
this.worksheetList.push(this.workForm);
} else {
}
},
// 关闭弹框
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
addFilePathSelection() {
this.filePathSelection = !this.filePathSelection;
if (this.routeState == 1) {
this.ileListData.push(this.localPath);
} else if (this.routeState == 2) {
this.form.bad_line_files_destination_directory = this.localPath.name;
} else if (this.routeState == 3) {
this.form.errorFilesDestinationDirectory = this.localPath.name;
} else if (this.routeState == 4) {
this.form.lineNumberFilesDestinationDirectory = this.localPath.name;
}
},
route(flowData) {
this.localPath = flowData;
console.log(this.localPath);
},
selectFilePath(tsate) {
this.routeState = tsate;
this.filePathSelection = !this.filePathSelection;
},
task() {
let domArr = document.querySelectorAll('[key-id="123"]');
this.createGraph();
this.initToolbar();
},
handleNodeClick(e, node, i) {
this.$forceUpdate();
},
//生成画布
createGraph() {
this.graph = new mxGraph(this.$refs.container);
},
// 转xml
encode(graph) {
const encoder = new mxCodec();
const result = encoder.encode(graph.getModel());
return mxUtils.getPrettyXml(result);
},
decode(graphXml, graph) {
window["mxGraphModel"] = mxGraphModel;
window["mxGeometry"] = mxGeometry;
// const xmlDocument = mxUtils.parseXml(graphXml);
// const decoder = new mxCodec(xmlDocument);
// const node = xmlDocument.documentElement;
// decoder.decode(node, graph.getModel());
var enc = new mxCodec(mxUtils.createXmlDocument(graphXml));
var node = enc.encode(graph.getModel());
console.log(mxUtils.getPrettyXml(node));
return mxUtils.getPrettyXml(node);
},
//初始化画布
initGraph() {
if (this.R.isNil(this.graph)) {
return;
}
this.graph.setConnectable(true); // 允许连线
this.graph.setCellsEditable(false); // 不可修改
this.graph.setTooltips(true);
this.graph.setPanning(true);
this.graph.setDropEnabled(true);
this.graph.setAllowDanglingEdges(false);
this.graph.setDisconnectOnMove(false);
this.graph.convertValueToString = (cell) => {
// 根据cell生成显示的标签
return this.R.prop("title", cell);
};
this.graph.addListener(mxEvent.DOUBLE_CLICK, (graph, evt) => {
console.log(evt);
// this.xmlDocuments = mxUtils.parseXml(decodeURIComponent(this.blankCanvas));
this.graphXml = this.encode(this.graph);
console.log(this.graphXml,this.xmlDocuments);
// 监听双击事件
const cell = this.R.pathOr([], ["properties", "cell"], evt);
console.info(cell); // 在控制台输出双击的cell
if (cell.ids == "step1") {
this.excelLnput = !this.excelLnput;
return;
} else if (cell.ids == "step7") {
this.TableInputDialog = !this.TableInputDialog;
return;
} else if (cell.ids == "step6") {
this.SystemInfoDialog = !this.SystemInfoDialog;
return;
} else if (cell.ids == "step5") {
this.ConstantDialog = !this.ConstantDialog;
return;
} else if (cell.ids == "step4") {
this.RandomValueDialog = !this.RandomValueDialog;
return;
} else if (cell.ids == "step3") {
this.RowGeneratorDialog = !this.RowGeneratorDialog;
return;
} else if (cell.ids == "step2") {
this.TextFileInputDialog = !this.TextFileInputDialog;
return;
} else if (cell.ids == "step16") {
//表输出
this.tableOutPutVisible = !this.tableOutPutVisible;
return;
} else if (cell.ids == "step15") {
//更新
this.updateVisible = !this.updateVisible;
return;
} else if (cell.ids == "step14") {
//文本文件输出
this.fileVisible = !this.fileVisible;
return;
} else if (cell.ids == "step13") {
//数据同步
this.synVisible = !this.synVisible;
return;
} else if (cell.ids == "step12") {
//插入、更新
this.InsertOrUpdateVisible = !this.InsertOrUpdateVisible;
return;
} else if (cell.ids == "step11") {
//删除
this.deleteVisible = !this.deleteVisible;
return;
} else if (cell.ids == "step10") {
//SQL文件输出
this.sqlVisible = !this.sqlVisible;
return;
} else if (cell.ids == "step9") {
//Excel输出
this.excelOutPutVisible = !this.excelOutPutVisible;
return;
}
});
this.graph.addListener(mxEvent.CLICK, (graph, evt) => {
// console.log(evt);
// 监听单击事件
const cell = this.R.pathOr([], ["properties", "cell"], evt);
// console.info(cell); // 在控制台输出单击的cell
});
},
addCell(toolItem, x, y) {
const { width, height } = toolItem;
const parent = this.graph.getDefaultParent();
this.graph.getModel().beginUpdate();
const styleObj = {
fillColor: 'transparent',
strokeColor: '#000000',
strokeWidth: '1',
shape: mxConstants.SHAPE_LABEL,
align: mxConstants.ALIGN_CENTER,
verticalAlign: mxConstants.ALIGN_BOTTOM,
imageAlign: mxConstants.ALIGN_CENTER,
imageVerticalAlign: mxConstants.ALIGN_TOP,
image:toolItem['icon']
}
const style = Object.keys(styleObj).map((attr) => `${attr}=${styleObj[attr]}`).join(';')
try {
let vertex = this.graph.insertVertex(
parent,
null,
null,
x,
y,
width,
height,
style
);
vertex.title = toolItem["title"];
vertex.ids = toolItem["id"];
vertex.pluginId = toolItem["pluginId"];
this.xmlDocuments = mxUtils.parseXml(decodeURIComponent(this.blankCanvas));
console.log(this.xmlDocuments,'拖拽');
var oSerializer = new XMLSerializer();
console.log(oSerializer.serializeToString(this.xmlDocuments));
let pameStep = new FormData(); // 创建form对象
pameStep.append("graphXml", oSerializer.serializeToString(this.xmlDocuments));
pameStep.append("pluginId", vertex.pluginId);
pameStep.append("name", vertex.title);
newStep(pameStep).then(res=>{
console.log(res,4564564564566456);
// this.graph.getModel().beginUpdate();
// try
// {
// var cell = this.graph.insertVertex(this.graph.getDefaultParent(), null, res.documentElement, x, y, width, height, "icon;image=" + node.attributes.dragIcon);
// this.graph.setSelectionCells([cell]);
// } finally
// {
// this.graph.getModel().endUpdate();
// }
// this.graph.container.focus();
})
} finally {
this.graph.getModel().endUpdate();
}
},
//选择
initToolbar() {
let domArr = document.querySelectorAll('[key-id="123"]');
domArr.forEach((dom, index) => {
let toolItemObj = {
title: dom.innerText,
id: dom.id,
width: 50,
height: 50,
icon:dom.attributes["icon"].nodeValue,
// value: dom.pluginId,
pluginId:dom.getAttribute("pluginId"),
};
const { width, height } = toolItemObj;
const dropHandler = (graph, evt, cell, x, y) => {
this.addCell(toolItemObj, x, y);
};
const createDragPreview = () => {
const elt = document.createElement("div");
elt.style.border = "1px dotted black";
elt.style.width = `${width}px`;
elt.style.height = `${height}px`;
return elt;
};
mxUtils.makeDraggable(
dom,
this.graph,
dropHandler,
createDragPreview(),
0,
0,
false,
true
);
});
},
// //设置
settingFlow() {
// console.log("按钮给我测试其他的功能--1", );
},
// // 删除激活的元素
deleteFlow() {
this.graph.removeCells(this.graph.getSelectionCells(), false); //删除选中节点
// if (this.activeElement.type === "node") {
// this.deleteNode(this.activeElement.nodeId);
// } else if (this.activeElement.type === "line") {
// this.$confirm("确定删除所点击的线吗?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(() => {
// var conn = this.graph.getConnections({
// source: this.activeElement.sourceId,
// target: this.activeElement.targetId,
// })[0];
// this.graph.deleteConnection(conn);
// })
// .catch(() => {});
// }
},
// // 删除线
// deleteLine(from, to) {
// delete this.publicData[to];
// this.flowData.lineList = this.flowData.lineList.filter(function (line) {
// if (line.from == from && line.to == to) {
// return false;
// }
// return true;
// });
// },
// // 改变连线
// changeLine(oldFrom, oldTo) {
// this.deleteLine(oldFrom, oldTo);
// },
// // 改变节点的位置
// changeNodeSite(flowData) {
// for (var i = 0; i < this.flowData.nodeList.length; i++) {
// let node = this.flowData.nodeList[i];
// if (node.id === flowData.nodeId) {
// node.left = flowData.left;
// node.top = flowData.top;
// }
// }
// },
// /**
// * 删除节点
// * @param nodeId 被删除节点的ID
// */
// deleteNode(nodeId) {
// this.$confirm("确定要删除节点" + nodeId + "?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// closeOnClickModal: false,
// })
// .then(() => {
// /**
// * 这里需要进行业务判断,是否可以删除
// */
// this.flowData.nodeList = this.flowData.nodeList.filter(function (
// node
// ) {
// if (node.id === nodeId) {
// // 伪删除,将节点隐藏,否则会导致位置错位
// // node.show = false
// return false;
// }
// return true;
// });
// this.$nextTick(function () {
// this.graph.removeAllEndpoints(nodeId);
// });
// })
// .catch(() => {});
// return true;
// },
// console.log("点击节点操作", node);
// // this.$emit("dialogVisibleFourth",true);
// // this.$emit('updata:dialogVisibleFourth',true); //触发showbox方法,true为向父组件传递的数据
// this.stepName = node;
// this.connectionNode = this.publicData[node.id];
// console.log(this.connectionNode);
// this.isShowR = true;
// this.activeElement.type = "node";
// this.activeElement.nodeId = node.id;
// // this.$refs.nodeForm.nodeInit(this.flowData, nodeId)
// let pamer = new FormData(); // 创建form对象
// pamer.append("query", "");
// excelSheetType(pamer).then((res) => {
// this.engine = res;
// });
// availableCharsets(pamer).then((res) => {
// this.codingType = res;
// });
// let pamer2 = new FormData(); // 创建form对象
// pamer2.append("valueType", "all");
// valueFormat(pamer2).then((res) => {
// this.fieldFormat = res;
// });
// valueMeta().then((res) => {
// this.fieldType = res;
// });
// previousSteps().then((res) => {});
// inputOutputFields().then((res) => {});
// if (node.ids == "step1") {
// this.excelLnput = !this.excelLnput;
// return;
// } else if (node.ids == "step7") {
// this.TableInputDialog = !this.TableInputDialog;
// return;
// } else if (node.ids == "step6") {
// this.SystemInfoDialog = !this.SystemInfoDialog;
// return;
// } else if (node.ids == "step5") {
// this.ConstantDialog = !this.ConstantDialog;
// return;
// } else if (node.ids == "step4") {
// this.RandomValueDialog = !this.RandomValueDialog;
// return;
// } else if (node.ids == "step3") {
// this.RowGeneratorDialog = !this.RowGeneratorDialog;
// return;
// } else if (node.ids == "step2") {
// this.TextFileInputDialog = !this.TextFileInputDialog;
// return;
// }
// if (node.ids == "step16") {
// this.tableOutPutVisible = !this.tableOutPutVisible;
// return;
// }
// // 是否具有该线
// hasLine(from, to) {
// for (var i = 0; i < this.flowData.lineList.length; i++) {
// var line = this.flowData.lineList[i];
// if (line.from === from && line.to === to) {
// return true;
// }
// }
// return false;
// },
// // 是否含有相反的线
// hashOppositeLine(from, to) {
// return this.hasLine(to, from);
// },
// nodeRightMenu(nodeId, evt) {
// console.log(88);
// this.menu.show = true;
// this.menu.curNodeId = nodeId;
// this.menu.left = evt.x + "px";
// this.menu.top = evt.y + "px";
// },
// repaintEverything() {
// this.graph.repaint();
// },
// // 加载流程图-不能删
// dataReload(flowData) {
// this.easyFlowVisible = false;
// this.flowData.nodeList = [];
// this.flowData.lineList = [];
// this.$nextTick(() => {
// flowData = lodash.cloneDeep(flowData);
// this.easyFlowVisible = true;
// this.flowData = flowData;
// // console.log(flowData, '渲染数据');
// this.$nextTick(() => {
// this.graph = graph.getInstance();
// this.$nextTick(() => {
// this.jsPlumbInit();
// });
// });
// });
// },
// // 保存流程图
saveFlow() {
// this.graphXml = this.encode(this.graph);
// console.log(this.graphXml);
// const that = this;
// let flowObj = Object.assign({}, that.flowData);
// // localStorage.setItem("data_test", JSON.stringify(flowObj))
// console.log("保存流程图", flowObj);
// // 保存
// let pamers = new FormData(); // 创建form对象
// pamers.append("graphXml", jsonxml);
// save(pamers).then((res) => {
// console.log(res);
// if (res.success) {
// that.$message.success("保存流程成功!暂时请查先看控制台。");
// } else {
// that.$message.error(res.errMsg);
// }
// });
// },
// // 转xml
// createGraph() {
// this.graph = new mxGraph(this.$refs.efContainer);
// },
// encode(graph) {
// const encoder = new mxCodec();
// const result = encoder.encode(graph.getModel());
// return mxUtils.getPrettyXml(result);
// },
// decode(graphXml, graph) {
// window["mxGraphModel"] = mxGraphModel;
// window["mxGeometry"] = mxGeometry;
// const xmlDocument = mxUtils.parseXml(graphXml);
// const decoder = new mxCodec(xmlDocument);
// const node = xmlDocument.documentElement;
// decoder.decode(node, graph.getModel());
},
// //重绘流程图
clearFlow() {
// let that = this;
// console.log("重绘流程图--1", that.flowData);
// that
// .$confirm("确定要重新绘制流程图吗?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// closeOnClickModal: false,
// })
// .then(() => {
// if (that.flowData.nodeList.length !== 0) {
// that.flowData.nodeList.forEach(function (node, index) {
// that.graph.remove(node.id);
// });
// that.flowData.nodeList = [];
// that.flowData.linkList = [];
// that.$message.success("设置成功");
// console.log("重绘流程图--002", that.flowData);
// }
// })
// .catch(() => {
// console.log("取消重绘流程图--1");
// that.$message.error("取消重制");
// });
// },
// //放小
// zoomSub() {
// let that = this;
// if (that.zoom <= 0) {
// return;
// }
// // setInterval(() => {
// that.zoom = that.zoom - 0.1;
// that.$refs.efContainer.style.transform = `scale(${that.zoom})`;
// that.graph.setZoom(that.zoom);
// // }, 1000)
// },
// //放大
// zoomAdd() {
// let that = this;
// if (that.zoom >= 1) {
// return;
// }
// // setInterval(() => {
// that.zoom = that.zoom + 0.1;
// // that.$refs.efContainer.style.transform = `scale(${that.zoom})`
// console.log(that.zoom);
// that.$refs.efContainer.style.transform = `scale(${that.zoom})`;
// that.graph.setZoom(that.zoom);
// // }, 1000)
},
// // 下载数据
downloadData() {
// this.$confirm("确定要下载该流程数据吗?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// closeOnClickModal: false,
// })
// .then(() => {
// var datastr =
// "data:text/json;charset=utf-8," +
// encodeURIComponent(JSON.stringify(this.flowData, null, "\t"));
// console.log(this.flowData);
// var downloadAnchorNode = document.createElement("a");
// downloadAnchorNode.setAttribute("href", datastr);
// downloadAnchorNode.setAttribute("download", "flowData.json");
// downloadAnchorNode.click();
// downloadAnchorNode.remove();
// this.$message.success("正在下载中,请稍后...");
// })
// .catch(() => {});
},
},
};
</script>
<style lang="scss" type="text/scss" scoped>
.mxgraphClass,
#mxgraph {
height: 100vh;
width: 100%;
}
.moveR-enter-active,
.moveR-leave-active {
transition: all 0.3s linear;
transform: translateX(0);
}
.moveR-enter,
.moveR-leave {
transform: translateX(100%);
}
.moveR-leave-to {
transform: translateX(100%);
}
.moveL-enter-active,
.moveL-leave-active {
transition: all 0.3s linear;
transform: translateX(0%);
}
.moveL-enter,
.moveL-leave {
transform: translateX(-100%);
}
.moveL-leave-to {
transform: translateX(-100%);
}
</style>
...@@ -218,6 +218,17 @@ export function imp(data) { ...@@ -218,6 +218,17 @@ export function imp(data) {
}) })
} }
//获取表输出
export function inputOutputFields(data) {
return request({
url: 'etlweb/trans/inputOutputFields',
data,
method: 'post'
})
}
......
...@@ -581,7 +581,7 @@ aside { ...@@ -581,7 +581,7 @@ aside {
// //
$svgUrl:'http://192.168.0.2:9888/ETLWEB-SERVER/etlweb'; $svgUrl:'http://192.168.0.44:9888/ETLWEB-SERVER/etlweb';
// $svgUrl:'http://192.168.0.44:9888/ETLWEB-SERVER/etlweb'; // $svgUrl:'http://192.168.0.44:9888/ETLWEB-SERVER/etlweb';
// $svgUrl:'http://192.168.0.44:9882/ETLWEB-SERVER/etlweb'; // $svgUrl:'http://192.168.0.44:9882/ETLWEB-SERVER/etlweb';
// .schema { background-image: url($svgUrl/ui/images/schema.svg?scale=16) !important;} // .schema { background-image: url($svgUrl/ui/images/schema.svg?scale=16) !important;}
......
...@@ -75,6 +75,8 @@ import * as R from 'ramda' ...@@ -75,6 +75,8 @@ import * as R from 'ramda'
Vue.prototype.R = R Vue.prototype.R = R
Vue.config.productionTip = false Vue.config.productionTip = false
const baseUrl = process.env.VUE_APP_BASE_API === '/' ? '' : process.env.VUE_APP_BASE_API
Vue.prototype.etlWeb = baseUrl+"ETLWEB-SERVER/etlweb/"
new Vue({ new Vue({
router, router,
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
}, },
data() { data() {
return { return {
prefix:'http://192.168.0.44:9882/etlweb/', prefix:this.etlWeb,
} }
}, },
computed: { computed: {
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<span> <span>
<img :src="prefix+data.icon" style="width:20px" width="" alt=""> <img :src="prefix+data.icon" style="width:20px" width="" alt="">
{{ node.label }} {{ node.label }}
</span> </span>
...@@ -88,7 +87,7 @@ export default { ...@@ -88,7 +87,7 @@ export default {
data() { data() {
return { return {
// prefix:'http://192.168.0.2:9700/etlweb/', // prefix:'http://192.168.0.2:9700/etlweb/',
prefix:'http://192.168.0.44:9882/etlweb/', prefix:this.etlWeb,
// 测试数据开始===== // 测试数据开始=====
jobTreeList: [ jobTreeList: [
{ {
......
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
class="custom-tree-node" class="custom-tree-node"
:key-id="data.children ? '' : 123" :key-id="data.children ? '' : 123"
:id="data.id" :id="data.id"
:icon="data.icon" :icon="prefix+data.icon"
:pluginId="data.pluginId" :pluginId="data.pluginId"
> >
<img :src="prefix+data.icon" style="width:20px" width="" alt="">
{{ data.text }} {{ data.text }}
</div> </div>
</div> </div>
...@@ -34,6 +35,7 @@ export default { ...@@ -34,6 +35,7 @@ export default {
pluginId:"pluginId", pluginId:"pluginId",
}, },
data: [], data: [],
prefix: this.etlWeb
}; };
}, },
components: {}, components: {},
......
...@@ -1293,6 +1293,18 @@ export default { ...@@ -1293,6 +1293,18 @@ export default {
const { width, height } = toolItem; const { width, height } = toolItem;
// const parent = this.graph.getDefaultParent(); // const parent = this.graph.getDefaultParent();
this.graph.getModel().beginUpdate(); this.graph.getModel().beginUpdate();
const styleObj = {
fillColor: 'transparent',
strokeColor: '#000000',
strokeWidth: '1',
shape: mxConstants.SHAPE_LABEL,
align: mxConstants.ALIGN_CENTER,
verticalAlign: mxConstants.ALIGN_BOTTOM,
imageAlign: mxConstants.ALIGN_CENTER,
imageVerticalAlign: mxConstants.ALIGN_TOP,
image:toolItem['icon']
}
const style = Object.keys(styleObj).map((attr) => `${attr}=${styleObj[attr]}`).join(';')
try { try {
// let vertex = this.graph.insertVertex( // let vertex = this.graph.insertVertex(
// parent, // parent,
...@@ -1311,10 +1323,6 @@ export default { ...@@ -1311,10 +1323,6 @@ export default {
// this.xmlDocuments = mxUtils.parseXml(
// decodeURIComponent(this.blankCanvas)
// );
// console.log(this.xmlDocuments, "拖拽");
// var oSerializer = new XMLSerializer(); // var oSerializer = new XMLSerializer();
// console.log(oSerializer.serializeToString(this.xmlDocuments)); // console.log(oSerializer.serializeToString(this.xmlDocuments));
...@@ -1338,7 +1346,8 @@ export default { ...@@ -1338,7 +1346,8 @@ export default {
this.graph.getModel().beginUpdate(); this.graph.getModel().beginUpdate();
try try
{ {
var cell = this.graph.insertVertex(this.graph.getDefaultParent(), null, res.documentElement, x, y, width, height,); var cell = this.graph.insertVertex(this.graph.getDefaultParent(), null, res.documentElement, x, y, width, height,style
);
cell.title = toolItem["title"]; cell.title = toolItem["title"];
cell.ids = toolItem["id"]; cell.ids = toolItem["id"];
cell.pluginId = toolItem["pluginId"]; cell.pluginId = toolItem["pluginId"];
...@@ -1366,20 +1375,21 @@ this.graph.getModel().beginUpdate(); ...@@ -1366,20 +1375,21 @@ this.graph.getModel().beginUpdate();
//选择 //选择
initToolbar() { initToolbar() {
let domArr = document.querySelectorAll('[key-id="123"]'); let domArr = document.querySelectorAll('[key-id="123"]');
console.log(domArr);
domArr.forEach((dom, index) => { domArr.forEach((dom, index) => {
// console.log(dom.pluginId); // console.log(dom.pluginId);
// console.log(dom); // console.log(dom);
let toolItemObj = { let toolItemObj = {
title: dom.innerHTML, title: dom.innerText,
id: dom.id, id: dom.id,
width: 60, width: 50,
height: 60, height: 50,
icon:dom.attributes["icon"].nodeValue,
// value: dom.pluginId, // value: dom.pluginId,
pluginId: dom.getAttribute("pluginId"), pluginId: dom.getAttribute("pluginId"),
icon: dom.getAttribute("icon"),
}; };
const { width, height } = toolItemObj; const { width, height } = toolItemObj;
......
...@@ -123,7 +123,7 @@ export default { ...@@ -123,7 +123,7 @@ export default {
// document.body.appendChild(link); // document.body.appendChild(link);
// link.click(); // link.click();
var url=`http://192.168.0.2:9888/ETLWEB-SERVER/etlweb/attachment/download?filePath=${res.message}&remove=true` var url=this.etlWeb+`attachment/download?filePath=${res.message}&remove=true`
window.open(url); window.open(url);
} else { } else {
......
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
// document.body.appendChild(link); // document.body.appendChild(link);
// link.click(); // link.click();
var url=`http://192.168.0.2:9888/ETLWEB-SERVER/etlweb/attachment/download?filePath=${res.message}&remove=true` var url=this.etlWeb+`attachment/download?filePath=${res.message}&remove=true`
window.open(url); window.open(url);
} else { } else {
......
import main from './main.vue'
export default main
\ No newline at end of file
<template>
<div>
<el-table :data="tableData" style="width: 100%">
<template v-for="(item,index) in tableHead">
<el-table-column :prop="item.column_name" :label="item.column_comment" :key="index"></el-table-column>
</template>
<el-table-column label="操作" width="100px">
<template slot-scope="scope">
<el-button
@click="editField(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deletefield(scope.$index, tableData)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getFileexplorer,getFilextension } from "@/api/kettle/file";
export default {
name: "table-list",
data() {
return {
fieldForm: {},
// field: false,
dataState: false,
fieldFormat: [],
fieldType: [],
// 表头数据
// tableHead2:[
// {
// column_name: "column_name",column_comment:"表字段"
// },
// {
// column_name: "column_age",column_comment:"流字段"
// },
// ],
// // 表格数据
// tableData2: [{
// column_age: '3',
// column_name: '鞠婧祎',
// },
// {
// column_age: '25',
// column_name: '魏大勋',
// },
// {
// column_age: '18',
// column_name: '关晓彤',
// }],
}
},
props: {
tableHead:Array,
tableData:Array,
field:Boolean,
fieldClick:Function
},
created() {
},
methods: {
editField(state, val) {
// this.field = !this.field;
this.$emit("update:field", true);
this.fieldClick(state, val);
// this.dataState = state;
// if (state) {
// this.fieldForm = {};
// } else {
// this.fieldForm = val;
// }
},
// handleClose(){},
deletefield(index, rows) {
rows.splice(index, 1);
},
// 字段
// addField() {
// this.field = !this.field;
// if (this.dataState) {
// this.tableData.push(this.fieldForm);
// } else {
// }
// },
},
};
</script>
<style>
.type-checked {
background-color: #8888ff;
color: #fff;
}
</style>
\ No newline at end of file
...@@ -391,7 +391,7 @@ props: ["dragItem"], ...@@ -391,7 +391,7 @@ props: ["dragItem"],
estabTitle:'转换',//新建转换弹窗提示 estabTitle:'转换',//新建转换弹窗提示
featureDialogVisible:false,//特征列表弹窗 featureDialogVisible:false,//特征列表弹窗
scanDialogVisible:false,//浏览弹窗 scanDialogVisible:false,//浏览弹窗
prefix:'http://192.168.0.2:9700/etlweb/', prefix:this.etlWeb,
inputValue:'',// 密码 inputValue:'',// 密码
// dropFunction,//删除数据库表 // dropFunction,//删除数据库表
deleteLink,//删除资源库模块的方法 deleteLink,//删除资源库模块的方法
......
...@@ -2,7 +2,7 @@ import mxgraph from './mx.js' ...@@ -2,7 +2,7 @@ import mxgraph from './mx.js'
import { steps } from '@/api/kettle/link' import { steps } from '@/api/kettle/link'
const MxConstants = mxgraph.mxConstants const MxConstants = mxgraph.mxConstants
const prefix = '192.168.0.2:9700/etlweb/' const prefix = this.etlWeb
const bar = [] const bar = []
const pamer = new FormData() // 创建form对象 const pamer = new FormData() // 创建form对象
......
...@@ -132,16 +132,58 @@ ...@@ -132,16 +132,58 @@
<el-tab-pane label="数据库字段" name="oher "> <el-tab-pane label="数据库字段" name="oher ">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-button style="padding: 3px 0" type="text">新增字段</el-button> <el-button style="padding: 3px 0" type="text" @click="fieldClick(true)">新增字段</el-button>
<el-button style="padding: 3px 0" type="text">删除字段</el-button> <el-button style="padding: 3px 0" type="text">删除字段</el-button>
<el-button style="padding: 3px 0" type="text">获取字段</el-button> <el-button style="padding: 3px 0" type="text">获取字段</el-button>
<el-button style="padding: 3px 0" type="text">输入字段映射</el-button> <el-button style="padding: 3px 0" type="text">输入字段映射</el-button>
</div> </div>
<el-table style="width: 100%" border :data="tableData2"> <!-- <el-table style="width: 100%" border :data="tableData2">
<template v-for="(item,index) in tableHead2"> <template v-for="(item,index) in tableHead2">
<el-table-column :prop="item.column_name" :label="item.column_comment" :key="index" v-if="item.column_name != 'id'"></el-table-column> <el-table-column :prop="item.column_name" :label="item.column_comment" :key="index" v-if="item.column_name != 'id'"></el-table-column>
</template> </template>
</el-table> </el-table> -->
<table-list ref="tableDia" :tableHead="tableHead" :tableData="tableData" :field.sync="editDia" :fieldClick="fieldClick"></table-list>
<!-- 编辑弹窗开始=========== -->
<el-dialog
title="编辑"
:visible.sync="field"
width="500px"
:before-close="handleCloseEdit"
append-to-body>
<el-form ref="form" :model="fieldForm" label-width="80px">
<!-- <el-checkbox-group v-model="checkedCities" style="width:100%;">
<el-checkbox > -->
<el-form-item label="表字段:">
<el-select v-model="fieldForm.column_name" style="width: 100%">
<el-option label="不去掉空格" value="none"></el-option>
<el-option label="去掉左空格" value="left"></el-option>
<el-option label="去掉右空格" value="right"></el-option>
<el-option label="去掉左右两端空格" value="both"></el-option>
</el-select>
</el-form-item>
<!-- </el-checkbox> -->
<!-- <el-checkbox > -->
<el-form-item label="流字段:">
<el-select v-model="fieldForm.stream_name" style="width: 100%">
<el-option label="不去掉空格" value="none"></el-option>
<el-option label="去掉左空格" value="left"></el-option>
<el-option label="去掉右空格" value="right"></el-option>
<el-option label="去掉左右两端空格" value="both"></el-option>
</el-select>
</el-form-item>
<!-- </el-checkbox>
</el-checkbox-group> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="field = false">取 消</el-button>
<el-button type="primary" @click="addField">确 定</el-button>
</span>
</el-dialog>
<!-- 编辑弹窗结束============ -->
</el-card> </el-card>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -155,9 +197,18 @@ ...@@ -155,9 +197,18 @@
</template> </template>
<script> <script>
import {
inputOutputFields,//获取表输出
} from "@/api/kettle/file";
export default ({ export default ({
data(){ data(){
return{ return{
field:false,//编辑弹窗
checkedCities: ['上海', '北京'],
editDia:false,//编辑表字段
fieldForm:{},//编辑弹窗
radioTreaty:'0', radioTreaty:'0',
tableOutForm:{ tableOutForm:{
commit: "1000", commit: "1000",
...@@ -191,6 +242,31 @@ export default ({ ...@@ -191,6 +242,31 @@ export default ({
include_subfolders: "1", include_subfolders: "1",
}, },
], ],
// 表头数据
tableHead:[
{
column_name: "column_name",column_comment:"表字段"
},
{
column_name: "stream_name",column_comment:"流字段"
},
],
// 表格数据
tableData: [{
stream_name: '3',
column_name: '鞠婧祎',
},
{
stream_name: '25',
column_name: '魏大勋',
},
{
stream_name: '18',
column_name: '关晓彤',
}],
// 表头数据 // 表头数据
tableHead2:[ tableHead2:[
{ {
...@@ -253,40 +329,50 @@ export default ({ ...@@ -253,40 +329,50 @@ export default ({
handleClose(){ handleClose(){
this.$emit("update:tableOutPutVisible", false); this.$emit("update:tableOutPutVisible", false);
}, },
//新建转换 //获取表输出
createTrans(){ inputOutputFields(){
var formData = new FormData(); // var enc = new mxCodec(mxUtils.createXmlDocument());
var formData = new FormData(); // var node = enc.encode(graph.getModel());
formData.append('dir', this.nodePath); // store.baseParams.stepName = encodeURIComponent(cell.getAttribute('label'));
formData.append('transName', this.inputValue); // store.baseParams.graphXml = mxUtils.getPrettyXml(node);
// console.log('新建提交参数==',params); // store.baseParams.before = true
createTrans(formData).then(res=>{ let pamer = new FormData(); // 创建form对象
if (res) { pamer.append("stepName", this.nodePath);
this.$message.success('创建成功!'); pamer.append("graphXml", "transformation");
this.explorer(''); pamer.append("before", true);
this.$emit("update:estabDialogVisible", false); pamer.append("query", '');
inputOutputFields(pamer).then(res=>{
console.log(res,'返回空白画布xml');
this.blankCanvas = res
})
},
}else { //新增或者编辑弹窗
this.$message.error(res.errMsg) fieldClick(state, val) {
this.field = !this.field;
this.dataState = state;
if (state) {
this.fieldForm = {};
} else {
this.fieldForm = val;
} }
})
}, },
// 上传 //关闭编辑的弹窗
handleChange(file, fileList) { handleCloseEdit(){
// console.log(file); this.field = !this.field;
this.fileList = fileList.slice(-3);
this.tableData.push({ name: file.name });
// console.log(this.tableData);
// this.getObjectURL(file.raw)
// console.log(this.getObjectURL(file.raw));
}, },
addSheet(){}, // 字段
fileChnageInput(e) { addField() {
console.log(e); this.field = !this.field;
console.log('添加的字段===',this.fieldForm);
if (this.dataState) {
this.tableData.push(this.fieldForm);
}
}, },
} }
}) })
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment