Commit 2144c7b6 by 莫晓莉

值映射

parent 06acfadb
......@@ -1121,10 +1121,27 @@
:scriptFormSend="outPutFormData16"
></sqlScriptDialog>
<!-- 转换-脚本-javascript -->
<javaScriptDialog ref="refJavaScript" :javaScriptVisible.sync="javaScriptVisible" :saveOutputDialog="saveOutputDialog" :doubleClickCell="doubleClickCell" :javaScriptFormSend="outPutFormData6" ></javaScriptDialog>
<javaScriptDialog ref="refJavaScript" :javaScriptVisible.sync="javaScriptVisible" :saveOutputDialog="saveOutputDialog" :doubleClickCell="doubleClickCell" :javaScriptFormSend="javaScriptFormData" ></javaScriptDialog>
<!-- 脚本弹窗组件end -->
<!-- 转换弹窗组件start -->
<!-- 值映射 -->
<valueDialog
ref="refValue"
:valueVisible.sync="valueVisible"
:saveOutputDialog="saveOutputDialog"
:doubleClickCell="doubleClickCell"
:formSend="valueFormData"
></valueDialog>
<!-- <valueDialog
ref="refValue"
:valueVisible.sync="valueVisible"
:saveOutputDialog="saveOutputDialog"
:doubleClickCell="doubleClickCell"
:deleteFormSend="outPutFormData6"
:getXmlVal="getXmlVal"
></valueDialog> -->
<!-- 字段选择value -->
<!-- <columnChoose
ref="insertOrdate"
:columnVisible.sync="columnVisible"
......@@ -1256,6 +1273,7 @@ import javaScriptDialog from "../../../script-dialog/java-script";//转换-脚
// 脚本弹窗组件end-----------------------
// 转换弹窗组件start----------
import valueDialog from "../../../trans-dialog/value";//值映射
// 转换弹窗组件end------------
import mxgraph from "@/utils/mxgraph";
......@@ -1311,6 +1329,8 @@ export default {
outPutFormData14: {}, //作业---成功
outPutFormData: {}, //输出弹窗组件的表单值
// 转换33start---------
javaScriptFormData:{},//转换--javascript代码
valueFormData:{},//值映射
// 转换3end------------
outPutFormData16: {}, //脚本--执行sql脚本
doubleClickCell: {},
......@@ -1371,6 +1391,7 @@ export default {
javaScriptVisible:false,
scriptVisible: false,
// 脚本组件end-----
valueVisible:false,//值映射
// 输入模块
file: [],
......@@ -1482,10 +1503,11 @@ export default {
// 脚本弹窗组件---
sqlScriptDialog,
javaScriptDialog
javaScriptDialog,
// 脚本弹窗组件---
// 转换弹窗组件start---
valueDialog,//值映射
// 转换弹窗组件end-----
},
//自定义指令 https://www.jb51.net/article/108047.htm
......@@ -2559,11 +2581,20 @@ export default {
}else if((this.curFileType=="transformation" && cell.ids == "step106") || cell.value.attributes.ctype.value == "ScriptValueMod" ){
//脚本 --javaScript代码
this.javaScriptVisible = !this.javaScriptVisible;
this.outPutFormData6 = this.showDataFunc()
this.javaScriptFormData = this.showDataFunc()
setTimeout(() => {
this.$refs.refJavaScript.clickFun(this.graph);//向子组件传递画布
}, 500);
return;
}else if((this.curFileType=="transformation" && cell.ids == "step52") || cell.value.attributes.ctype.value == "ValueMapper" ){
//转换 --值映射
this.valueVisible = !this.valueVisible;
this.valueFormData = this.showDataFunc()
setTimeout(() => {
// this.$refs.refJavaScript.clickFun(this.graph);//向子组件传递画布
this.$refs.refValue.clickFun(this.graph); //向子组件传递画布
}, 500);
return;
}
});
......
<template>
<div>
<el-dialog
title="值映射"
:visible.sync="valueVisible"
width="800px"
:before-close="handleClose"
top="10%"
>
<el-form ref="delForm" :model="myForm" label-width="200px">
<el-form-item label="步骤名称:">
<el-input v-model="myForm.label"></el-input>
</el-form-item>
<div style="border:1px solid #99BBE8;padding:15px 15px;margin-bottom:15px;">
<el-form-item label="使用的字段名:">
<el-row :gutter="10">
<el-col :span="23">
<el-select v-model="myForm.field_to_use" style="width: 100%" @focus="inputOutputFields">
<el-option v-for="(item,index) in fieldsList2" :key="index" :label="item.name" :value="item.name"></el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="目标字段名:">
<el-row :gutter="10">
<el-col :span="23">
<el-input v-model="myForm.target_field"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="不匹配时的默认值:">
<el-row :gutter="10">
<el-col :span="23">
<el-input v-model="myForm.non_match_default"></el-input>
</el-col>
</el-row>
</el-form-item>
</div>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>字段值</span>
<el-button style="padding: 3px 0;margin-left:50px;" type="text" @click="fieldClick(true)">新增字段</el-button>
<el-button style="padding: 3px 0" type="text" @click="deleteFields">删除全部</el-button>
</div>
<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="form1" :model="fieldForm" label-width="80px">
<el-form-item label="源值:">
<el-input v-model="fieldForm.source_value"></el-input>
</el-form-item>
<el-form-item label="目标值:">
<el-input v-model="fieldForm.target_value"></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-card>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="valueVisible = false">取 消</el-button>
<el-button type="primary" @click="confirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import mxgraph from "@/utils/mxgraph";
const {
mxGraph,
mxUtils,
mxEvent,
mxKeyHandler,
mxRubberband,
mxConstants,
mxStencilRegistry,
mxStencil,
mxCodec,
mxGraphModel,
mxGeometry,
} = mxgraph
import {
tableFields,
inputOutputFields,//获取表输出
} from "@/api/kettle/file";
export default ({
data(){
return{
myForm:{},//解决子组件改变父组件传递props属性报错
newGraph:{},
fieldsList1:[],
fieldsList2:[],
field:false,//编辑弹窗
editDia:false,//编辑表字段
fieldForm:{},//编辑弹窗
stepName:{name:'删除'},
activeName:'content',
// deleteForm:{
// commit: "100",
// connection: "",
// key:"[]",
// label:"删除",
// schema: "",
// table: "",
// },
// 查询字段--start------------
fieldsList:[],//字段获取
keyConditionList:[{value: '=', text: '='},
{value: '<>', text: '<>'},
{value: '<', text: '<'},
{value: '<=', text: '<='},
{value: '>', text: '>'},
{value: '>=', text: '>='},
{value: 'LIKE', text: 'LIKE'},
{value: 'BETWEEN', text: 'BETWEEN'},
{value: 'IS NULL', text: 'IS NULL'},
{value: 'IS NOT NULL', text: 'IS NOT NULL'}],
// 表头数据
tableHead:[
{
column_name: "source_value",column_comment:"源值"
},
{
column_name: "target_value",column_comment:"目标值"
},
],
// 表格数据
tableData: [
// {
// field: '3',
// condition: '鞠婧祎',
// name: '女',
// name2:'1',
// },
// {
// field: '31',
// condition: '鞠婧祎',
// name: '女',
// name2:'1',
// },
// {
// field: '32',
// condition: '鞠婧祎',
// name: '女',
// name2:'1',
// },
],
// 查询字段--end------------
}
},
// watch:{
// deleteForm(n,o){
// console.log("回显的表单数据===",n);
// if(n){
// var ny=JSON.parse(n.key);
// this.tableData=ny;
// }
// }
// },
watch:{
// 解决子组件改变父组件传进来的变量的属性不报错start------
formSend(val){
console.log("回显的表单数据===",val);
this.myForm=val;
if(this.myForm.key){
var ny=JSON.parse(this.myForm.key);
this.tableData=ny;
}
},
// 解决子组件改变父组件传进来的变量的属性不报错start------
},
props:["valueVisible","doubleClickCell","saveOutputDialog","formSend",],
mounted(){
},
methods:{
clickFun(graph){
console.log(graph,'双击获取值')
this.newGraph = graph;
},
handleClose(){
this.$emit("update:valueVisible", false);
},
confirm(){
this.myForm.fields=JSON.stringify(this.tableData);//字段复值
console.log('弹窗数据:===',this.myForm);
this.saveOutputDialog(this.myForm);
this.handleClose();//关闭弹窗
},
//新增或者编辑弹窗
fieldClick(state, val) {
this.field = !this.field;
this.dataState = state;
if (state) {
this.fieldForm = {};
} else {
this.fieldForm = val;
}
},
//关闭编辑的弹窗
handleCloseEdit(){
this.field = !this.field;
},
// 字段
addField() {
this.field = !this.field;
console.log('添加的字段===',this.fieldForm);
if (this.dataState) {
this.tableData.push(this.fieldForm);
}
},
//获取表输出
inputOutputFields(par){
if(this.doubleClickCell){
// var title=this.doubleClickCell.title;
var title=this.doubleClickCell.value.attributes.label.value
}
console.log('获取cell888888===',this.doubleClickCell);
let pamer = new FormData(); // 创建form对象
pamer.append("stepName", encodeURIComponent(title));
// pamer.append("graphXml", this.getXmlVal);
// 画布xml转码
const codec = new mxCodec();
const encodedModel = codec.encode(this.newGraph.getModel());//xml对象
console.log("获取字段的画布详情:", encodedModel);
var myXmlVal = mxUtils.getXml(encodedModel);//xml字符串
pamer.append("graphXml", myXmlVal);
pamer.append("before", true);
pamer.append("query", '');
inputOutputFields(pamer).then(res=>{
console.log('字段',res);
// if(par=="get"){
// var newArray=[];
// res.forEach(item => {
// var newObj={};
// newObj.field=item.name;
// newObj.condition="=";
// newObj.name=item.name;
// newObj.name2="";
// newArray.push(newObj);
// });
// this.tableData=newArray;
// }else{
this.fieldsList2=res;
// }
})
},
//删除全部
deleteFields(){
this.tableData=[];
},
}
})
</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