Commit 45efa79b by 李耀琨

行转列 增加序列 设置字段值 增加常量

parent d327393f
<template>
<div class="getSystemInformation">
<el-dialog
title="增加常量"
:visible.sync="addConstantsDialog"
width="800px"
:before-close="handleCloseFun"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="步骤名称:">
<el-input v-model="form.label"></el-input>
</el-form-item>
</el-form>
<el-form ref="form" :model="form" label-width="0px">
<el-button type="text" @click="addSheet(true)" style="margin: 10px"
>添加字段</el-button
>
<el-form-item>
<el-table :data="fields" 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="format" 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="currency" label="当前的"> </el-table-column>
<el-table-column prop="decimal" label="10进制的"> </el-table-column>
<el-table-column prop="group" label="组"> </el-table-column>
<el-table-column prop="nullif" label="值"> </el-table-column>
<el-table-column prop="set_empty_string" label="设为空串?">
<template slot-scope="scope">
{{ scope.row.set_empty_string == "Y" ? "是" : "否" }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="addSheet(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteRow(scope.$index, fields)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseFun">取 消</el-button>
<el-button type="primary" @click="SystemInfoDialogFun">确 定</el-button>
</span>
</el-dialog>
<el-dialog
:title="dataStatus ? '新增' : '修改'"
:visible.sync="addField"
width="500px"
:before-close="handleClose"
:modal="false"
>
<el-form ref="form" :model="fiel" label-width="160px">
<el-form-item label="名称:">
<el-input v-model="fiel.name"></el-input>
</el-form-item>
<el-form-item label="类型:">
<el-select v-model="fiel.type" style="width: 100%" clearable>
<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-select v-model="fiel.format" style="width: 100%" clearable>
<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="fiel.length"></el-input>
</el-form-item>
<el-form-item label="精确:">
<el-input v-model="fiel.precision"></el-input>
</el-form-item>
<el-form-item label="当前的:">
<el-input v-model="fiel.currency"></el-input>
</el-form-item>
<el-form-item label="10进制的:">
<el-input v-model="fiel.decimal"></el-input>
</el-form-item>
<el-form-item label="组:">
<el-input v-model="fiel.group"></el-input>
</el-form-item>
<el-form-item label="值:">
<el-input v-model="fiel.nullif"></el-input>
</el-form-item>
<el-form-item label="设为空串?">
<el-select
v-model="fiel.set_empty_string"
style="width: 100%"
clearable
>
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addField = false">取 消</el-button>
<el-button type="primary" @click="addFieldDetermine">确 定</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 { systemDataTypes, valueFormat, valueMeta } from "@/api/kettle/link";
export default {
props: ["form", "addConstantsDialog", "saveOutputDialog", "nodeData"],
data() {
return {
addField: false,
fields: [],
type: {},
dataStatus: false,
fiel: {},
fieldFormat: [],
fieldType: [],
};
},
created() {
this.systemDataTypesFun();
},
methods: {
clickFun(graph, val) {
console.log(graph, "双击获取值");
this.newGraph = graph;
console.log(val, "拿到form");
this.fields = JSON.parse(val.fields);
},
handleCloseFun() {
this.$emit("update:addConstantsDialog", false);
},
SystemInfoDialogFun() {
this.handleCloseFun();
this.form.fields = JSON.stringify(this.fields);
this.saveOutputDialog(this.form);
},
addFieldDetermine() {
this.addField = !this.addField;
if (this.dataStatus) {
this.fields.push(this.fiel);
} else {
}
},
// 关闭弹框
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
addSheet(state, val) {
this.valueFormatFun();
this.valueMetaFun();
this.addField = !this.addField;
this.dataStatus = state;
if (state) {
this.fiel = {};
} else {
this.fiel = val;
}
},
systemDataTypesFun() {
systemDataTypes().then((res) => {
this.type = res;
});
},
valueMetaFun() {
valueMeta().then((res) => {
this.fieldType = res;
});
},
valueFormatFun() {
let pamer2 = new FormData(); // 创建form对象
pamer2.append("valueType", "all");
valueFormat(pamer2).then((res) => {
this.fieldFormat = res;
});
},
},
};
</script>
<style lang="scss" scoped>
* {
outline: none;
}
</style>
<template>
<div class="getSystemInformation">
<el-dialog
title="增加序列"
:visible.sync="addSequenceDialog"
width="800px"
:before-close="handleCloseFun"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="步骤名称:">
<el-input v-model="form.label"></el-input>
</el-form-item>
<el-form-item label="值的名称:">
<el-input v-model="form.valuename"></el-input>
</el-form-item>
</el-form>
<el-card class="box-card">
<el-form ref="form" :model="form" label-width="200px">
<el-form-item label="使用数据库来生成序列" />
<el-form-item label="使用DB来获取sequence?">
<el-checkbox
v-model="form.use_database"
true-label="Y"
false-label="N"
@change="useDatabase"
></el-checkbox>
</el-form-item>
<el-form-item label="数据库连接">
<el-row :gutter="20">
<el-col :span="13">
<el-select
v-model="form.connection"
style="width: 100%"
@change="getField"
@focus="getGraphDataBases"
:disabled="form.use_database == 'N'"
clearable
>
<el-option
v-for="(item, index) in namesList"
:key="index"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-col>
<el-col :span="3">
<el-button @click.native="dialogVisibleFourthFun"
:disabled="form.use_database == 'N'"
>编辑</el-button
></el-col
>
<el-col :span="3">
<el-button @click.native="dialogVisibleFourthNew"
:disabled="form.use_database == 'N'"
>新建</el-button
></el-col
>
<el-col :span="3"> <el-button :disabled="form.use_database == 'N'">wizard...</el-button></el-col>
</el-row>
</el-form-item>
<el-form-item label="模式名称">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="form.schema" :disabled="form.use_database == 'N'"></el-input>
</el-col>
<el-col :span="3"> <el-button :disabled="form.use_database == 'N'">Schemas...</el-button></el-col>
</el-row>
</el-form-item>
<el-form-item label="Sequence名称">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="form.seqname" :disabled="form.use_database == 'N'"></el-input>
</el-col>
<el-col :span="3"> <el-button disabled>Sequences...</el-button></el-col>
</el-row>
</el-form-item>
</el-form>
</el-card>
<br>
<el-card class="box-card">
<el-form ref="form" :model="form" label-width="210px">
<el-form-item label="使用转换计算器来生成序列" />
<el-form-item label="使用计算器来计算sequence?">
<el-checkbox
v-model="form.use_counter"
true-label="Y"
false-label="N"
@change="useCounter"
></el-checkbox>
</el-form-item>
<el-form-item label="计算器名称(可选)">
<el-input v-model="form.counter_name" :disabled="form.use_counter == 'N'"></el-input>
</el-form-item>
<el-form-item label="初始值">
<el-input v-model="form.start_at" :disabled="form.use_counter == 'N'"></el-input>
</el-form-item>
<el-form-item label="增长根据">
<el-input v-model="form.increment_by" :disabled="form.use_counter == 'N'"></el-input>
</el-form-item>
<el-form-item label="最大值">
<el-input v-model="form.max_value" :disabled="form.use_counter == 'N'"></el-input>
</el-form-item>
</el-form>
</el-card>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseFun">取 消</el-button>
<el-button type="primary" @click="SystemInfoDialogFun">确 定</el-button>
</span>
</el-dialog>
<estab-dialog
ref="establishDia"
:dialogVisibleFourth.sync="dialogVisibleFourth"
@getSonValue="getSonValue"
:listNames="listNames"
:scanDialogVisible.sync="scanDialogVisible"
:chooseType="chooseType"
:chooseFlag.sync="chooseFlag"
:form.sync="form"
:getXmlVal="getXmlVal"
:noneRespository="noneRespository"
:graph.sync="newGraph"
></estab-dialog>
</div>
</template>
<script>
import mxgraph from "@/utils/mxgraph";
const {
mxGraph,
mxUtils,
mxEvent,
mxKeyHandler,
mxRubberband,
mxConstants,
mxStencilRegistry,
mxStencil,
mxCodec,
mxGraphModel,
mxGeometry,
} = mxgraph;
import { listNames } from "@/api/kettle/link";
export default {
props: ["form", "addSequenceDialog", "saveOutputDialog", "nodeData","getXmlVal"],
data() {
return {
dialogVisibleFourth: false,
scanDialogVisible: false,
chooseType: "表",
chooseFlag: false,
noneRespository: 1, //判断是保存画布还是传后台
namesList: [],
library: [],
addField: false,
fields: [],
type: {},
dataStatus: false,
fiel: {},
fieldFormat: [],
fieldType: [],
newGraph: {},
};
},
created() {
this.systemDataTypesFun();
},
methods: {
clickFun(graph, val) {
console.log(graph, "双击获取值");
this.newGraph = graph;
console.log(val, "拿到form");
},
handleCloseFun() {
this.$emit("update:addSequenceDialog", false);
},
SystemInfoDialogFun() {
this.handleCloseFun();
this.saveOutputDialog(this.form);
},
addFieldDetermine() {
this.addField = !this.addField;
if (this.dataStatus) {
this.fields.push(this.fiel);
} else {
}
},
// 关闭弹框
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
dialogVisibleFourthNew() {
this.dialogVisibleFourth = true;
// this.$refs.establishDia.database();
// this.$refs.establishDia.accessMethod(); //获取连接方式
this.$refs.establishDia.clickFun(this.newGraph); //先把画布传过去
this.$refs.establishDia.getTransDatabase();
this.$refs.establishDia.accessMethod(); //获取连接方式
},
useCounter(){
if (this.form.use_counter == "Y") {
this.form.use_database = "N"
}
},
useDatabase(){
if (this.form.use_database == "Y") {
this.form.use_counter = "N"
}
},
dialogVisibleFourthFun() {
this.dialogVisibleFourth = true;
// this.$refs.establishDia.database(this.connectionName);
this.$refs.establishDia.clickFun(this.newGraph); //先把画布传过去
if (this.form.connection) {
this.dialogVisibleFourth = true;
this.$refs.establishDia.getTransDatabase(this.form.connection);
this.$refs.establishDia.accessMethod(); //获取连接方式
}
// this.$refs.establishDia.database(this.selectName);
},
getSonValue(res) {
if (typeof res == "string") {
this.formDataBaseName = res;
console.log("接收子组件的值1111111----", this.formDataBaseName);
} else if (typeof res == "object") {
console.log("接收子组件的值55555----", res);
this.curNode = res; // DOM 更新后 // this.$nextTick(() => { //   this.form.text=this.curNode.data.text; //   // this.$refs.goal.values=this.curNode.data.text; //   // this.$refs.goal.refreshData(this.from) // }) // this.form.text=this.curNode.data.text;
//         this.$set(this.newForm,'text',this.curNode.data.text)
//         this.$forceUpdate()
console.log("chuanhuo=====", this.newForm);
} else if (typeof res == "boolean") {
this.dialogVisibleFourth = res;
console.log("接收子组件的值2222222----", this.dialogVisibleFourth);
}
},
listNames() {
listNames().then((res) => {
if (res) {
console.log("获取所有已经创建的数据库列表:", res);
this.namesList = res;
} else {
this.$message.error(res.errMsg);
}
});
},
getGraphDataBases() {
// var graph = this.getGraph();
var root = this.newGraph.getDefaultParent(),
data = [];
if (root.getAttribute("databases") != null)
data = JSON.parse(root.getAttribute("databases"));
console.log("获取到画布上的databases====", data);
this.namesList = data;
},
getField(val) {
this.library = this.namesList.find((e) => {
return e.name == val;
});
console.log(this.library, "////////////////////////");
this.connectionName = val;
},
},
};
</script>
<style lang="scss" scoped>
* {
outline: none;
}
</style>
......@@ -17,7 +17,7 @@
<el-button type="text" @click="getTheField">获取字段</el-button>
<el-table :data="fields" style="width: 100%">
<el-table-column prop="field_name" label="字段名称"> </el-table-column>g
<el-table-column prop="field_name" label="字段名称"> </el-table-column>
<el-table-column prop="variable_name" label="变量名"> </el-table-column>
......
<template>
<div class="getSystemInformation">
<el-dialog
title="行转列"
:visible.sync="rowToColumnDialog"
width="800px"
:before-close="handleCloseFun"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="步骤名称:">
<el-input v-model="form.label"></el-input>
</el-form-item>
</el-form>
<el-card class="box-card">
构成分组的字段:
<br />
<el-button type="text" @click="addSheetFun(true)" style="margin: 10px"
>添加字段</el-button
>
<el-button type="text" @click="getTheFieldFun">获取字段</el-button>
<el-table :data="group" style="width: 100%">
<el-table-column type="index" width="50"> </el-table-column>
<el-table-column prop="name" label="分组字段">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="addSheetFun(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteRow(scope.$index, group)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<br>
<el-card class="box-card">
目标字段
<br />
<el-button type="text" @click="addSheet(true)" style="margin: 10px"
>添加字段</el-button
>
<el-button type="text" @click="getTheField">获取字段</el-button>
<el-table :data="fields" style="width: 100%">
<el-table-column type="index" width="50"> </el-table-column>
<el-table-column prop="target_name" label="目标字段">
</el-table-column>
<el-table-column prop="field_name" label="数据字段">
</el-table-column>
<el-table-column prop="key_value" label="关键字值"> </el-table-column>
<el-table-column prop="target_type" label="类型"> </el-table-column>
<el-table-column prop="target_format" label="格式化">
</el-table-column>
<el-table-column prop="target_length" label="长度"> </el-table-column>
<el-table-column prop="target_precision" label="精度">
</el-table-column>
<el-table-column prop="target_currency_symbol" label="货币类型">
</el-table-column>
<el-table-column prop="target_decimal_symbol" label="10进制的">
</el-table-column>
<el-table-column prop="target_grouping_symbol" label="分组">
</el-table-column>
<el-table-column prop="target_null_string" label="Null if">
</el-table-column>
<el-table-column prop="target_aggregation_type" label="聚合">
<template slot-scope="scope">
{{ getTarget_aggregation_type(scope.row.target_aggregation_type)}}
</template>
</el-table-column>
<el-table-column label="操作" width="90px">
<template slot-scope="scope">
<el-button
@click="addSheet(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteRow(scope.$index, fields)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseFun">取 消</el-button>
<el-button type="primary" @click="SystemInfoDialogFun">确 定</el-button>
</span>
</el-dialog>
<el-dialog
:title="dataStatus ? '新增' : '修改'"
:visible.sync="addField"
width="500px"
:before-close="handleClose"
:modal="false"
>
<el-form ref="form" :model="fiel" label-width="160px">
<el-form-item label="目标字段:">
<el-input v-model="fiel.target_name"></el-input>
</el-form-item>
<el-form-item label="数据字段:">
<el-input v-model="fiel.field_name"></el-input>
</el-form-item>
<el-form-item label="关键字值:">
<el-input v-model="fiel.key_value"></el-input>
</el-form-item>
<el-form-item label="类型:">
<el-select v-model="fiel.target_type" style="width: 100%" clearable>
<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-select v-model="fiel.target_format" style="width: 100%" clearable>
<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="fiel.target_length"></el-input>
</el-form-item>
<el-form-item label="精确:">
<el-input v-model="fiel.target_precision"></el-input>
</el-form-item>
<el-form-item label="货币类型:">
<el-input v-model="fiel.target_currency_symbol"></el-input>
</el-form-item>
<el-form-item label="10进制的:">
<el-input v-model="fiel.target_decimal_symbol"></el-input>
</el-form-item>
<el-form-item label="分组:">
<el-input v-model="fiel.target_grouping_symbol"></el-input>
</el-form-item>
<el-form-item label="Null if:">
<el-input v-model="fiel.target_null_string"></el-input>
</el-form-item>
<el-form-item label="聚合:">
<el-select
v-model="fiel.target_aggregation_type"
style="width: 100%"
clearable
>
<el-option label="Sum" value="SUM"></el-option>
<el-option label="Average" value="AVERAGE"></el-option>
<el-option label="Minimum" value="MIN"></el-option>
<el-option label="Maximum" value="MAX"></el-option>
<el-option label="Number of Values" value="COUNT_ALL"></el-option>
<el-option label="Concatenate strings separated by ," value="CONCAT_COMMA"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addField = false">取 消</el-button>
<el-button type="primary" @click="addFieldDetermine">确 定</el-button>
</span>
</el-dialog>
<el-dialog
:title="groupStatus ? '新增' : '修改'"
:visible.sync="addGroup"
width="500px"
:before-close="handleClose"
:modal="false"
>
<el-form ref="form" :model="groupFiel" label-width="160px">
<el-form-item label="名称:">
<el-input v-model="groupFiel.name"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addGroup = false">取 消</el-button>
<el-button type="primary" @click="addGroupDetermine">确 定</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 {
systemDataTypes,
valueFormat,
valueMeta,
inputOutputFields,
} from "@/api/kettle/link";
export default {
props: ["form", "rowToColumnDialog", "saveOutputDialog", "nodeData"],
data() {
return {
addField: false,
fields: [],
type: {},
dataStatus: false,
fiel: {},
fieldFormat: [],
fieldType: [],
group:[],
groupFiel:{},
groupStatus:false,
addGroup:false,
};
},
created() {
this.systemDataTypesFun();
},
methods: {
clickFun(graph, val) {
console.log(graph, "双击获取值");
this.newGraph = graph;
console.log(val, "拿到form");
this.fields = JSON.parse(val.fields);
this.group = JSON.parse(val.group);
},
getTheFieldFun(){
console.log(this.nodeData);
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(this.newGraph.getModel());
this.graphXml = mxUtils.getPrettyXml(node);
// console.log( this.graphXml,"看着了");
let pamerFields = new FormData(); // 创建form对象
pamerFields.append(
"stepName",
this.nodeData.value.attributes.label.value
);
pamerFields.append("graphXml", this.graphXml);
pamerFields.append("before", true);
pamerFields.append("query", "");
inputOutputFields(pamerFields).then((res) => {
console.log(res, "yuiyuiyui");
this.group = res;
// this.fields.field_name = res.name
});
},
getTheField() {
console.log(this.nodeData);
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(this.newGraph.getModel());
this.graphXml = mxUtils.getPrettyXml(node);
// console.log( this.graphXml,"看着了");
let pamerFields = new FormData(); // 创建form对象
pamerFields.append(
"stepName",
this.nodeData.value.attributes.label.value
);
pamerFields.append("graphXml", this.graphXml);
pamerFields.append("before", true);
pamerFields.append("query", "");
inputOutputFields(pamerFields).then((res) => {
console.log(res, "yuiyuiyui");
let i = 0
res.forEach(item => {
i++
this.fields.push({
target_name:'字段'+ i,
field_name:item.name,
target_type:item.type,
target_format:item.conversionMask,
target_length:item.length,
target_precision:item.precision,
target_currency_symbol:item.currencyType,
target_grouping_symbol:item.group,
target_null_string:item.nullable
})
});
// this.fields.field_name = res.name
});
},
handleCloseFun() {
this.$emit("update:rowToColumnDialog", false);
},
SystemInfoDialogFun() {
this.handleCloseFun();
this.form.fields = JSON.stringify(this.fields);
this.form.group = JSON.stringify(this.group);
this.saveOutputDialog(this.form);
},
addFieldDetermine() {
this.addField = !this.addField;
if (this.dataStatus) {
this.fields.push(this.fiel);
} else {
}
},
addGroupDetermine() {
this.addGroup = !this.addGroup;
if (this.groupStatus) {
this.group.push(this.groupFiel);
} else {
}
},
// 关闭弹框
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
addSheet(state, val) {
this.valueFormatFun();
this.valueMetaFun();
this.addField = !this.addField;
this.dataStatus = state;
if (state) {
this.fiel = {};
} else {
this.fiel = val;
}
},
addSheetFun(state, val) {
this.addGroup = !this.addGroup;
this.groupStatus = state;
if (state) {
this.groupFiel = {};
} else {
this.groupFiel = val;
}
},
systemDataTypesFun() {
systemDataTypes().then((res) => {
this.type = res;
});
},
valueMetaFun() {
valueMeta().then((res) => {
this.fieldType = res;
});
},
valueFormatFun() {
let pamer2 = new FormData(); // 创建form对象
pamer2.append("valueType", "all");
valueFormat(pamer2).then((res) => {
this.fieldFormat = res;
});
},
// 判断伤残等级
getTarget_aggregation_type(type) {
// console.log(type, typeof type)
this.target_aggregation_type = type;
var category = "";
switch (type) {
case "SUM":
category = "Sum";
break;
case "AVERAGE":
category = "Average";
break;
case "MIN":
category = "Minimum";
break;
case "MAX":
category = "Maximum";
break;
case "COUNT_ALL":
category = "Number of Values";
break;
case "CONCAT_COMMA":
category = "Concatenate strings separated by ,";
break;
}
return category;
},
},
};
</script>
<style lang="scss" scoped>
* {
outline: none;
}
</style>
<template>
<div class="getSystemInformation">
<el-dialog
title="增加常量"
:visible.sync="setFieldValueDialog"
width="800px"
:before-close="handleCloseFun"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="步骤名称:">
<el-input v-model="form.label"></el-input>
</el-form-item>
</el-form>
<el-form ref="form" :model="form" label-width="0px">
<el-button type="text" @click="addSheet(true)" style="margin: 10px"
>添加字段</el-button
>
<el-button type="text" @click="getTheGroup">获取字段</el-button>
<el-form-item>
<el-table :data="fields" style="width: 100%">
<el-table-column prop="name" label="Field name"> </el-table-column>
<el-table-column prop="replaceby" label="Replace by value from field"> </el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="addSheet(false, scope.row)"
type="text"
size="small"
>编辑</el-button
>
<el-button
type="text"
size="small"
@click="deleteRow(scope.$index, fields)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCloseFun">取 消</el-button>
<el-button type="primary" @click="SystemInfoDialogFun">确 定</el-button>
</span>
</el-dialog>
<el-dialog
:title="dataStatus ? '新增' : '修改'"
:visible.sync="addField"
width="500px"
:before-close="handleClose"
:modal="false"
>
<el-form ref="form" :model="fiel" label-width="250px">
<el-form-item label="Field name">
<el-select v-model="fiel.name" style="width: 100%" clearable>
<el-option
v-for="item in fieldFormat"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item label="Replace by value from field">
<el-select v-model="fiel.replaceby" style="width: 100%" clearable>
<el-option
v-for="item in fieldFormat"
:key="item.index"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="addField = false">取 消</el-button>
<el-button type="primary" @click="addFieldDetermine">确 定</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 { inputOutputFields } from "@/api/kettle/link";
export default {
props: ["form", "setFieldValueDialog", "saveOutputDialog", "nodeData"],
data() {
return {
addField: false,
fields: [],
type: {},
dataStatus: false,
fiel: {},
fieldFormat: [],
fieldType: [],
};
},
created() {
this.systemDataTypesFun();
},
methods: {
clickFun(graph, val) {
console.log(graph, "双击获取值");
this.newGraph = graph;
console.log(val, "拿到form");
this.fields = JSON.parse(val.fields);
},
getTheGroup() {
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(this.newGraph.getModel());
this.graphXml = mxUtils.getPrettyXml(node);
let pamerFields = new FormData(); // 创建form对象
pamerFields.append(
"stepName",
this.nodeData.value.attributes.label.value
);
pamerFields.append("graphXml", this.graphXml);
pamerFields.append("before", true);
inputOutputFields(pamerFields).then((res) => {
this.fields = res;
console.log(res);
});
},
handleCloseFun() {
this.$emit("update:setFieldValueDialog", false);
},
SystemInfoDialogFun() {
this.handleCloseFun();
this.form.fields = JSON.stringify(this.fields);
this.saveOutputDialog(this.form);
},
addFieldDetermine() {
this.addField = !this.addField;
if (this.dataStatus) {
this.fields.push(this.fiel);
} else {
}
},
// 关闭弹框
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
deleteRow(index, rows) {
rows.splice(index, 1);
},
addSheet(state, val) {
this.getFun();
this.addField = !this.addField;
this.dataStatus = state;
if (state) {
this.fiel = {};
} else {
this.fiel = val;
}
},
getFun() {
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(this.newGraph.getModel());
this.graphXml = mxUtils.getPrettyXml(node);
let pamerFields = new FormData(); // 创建form对象
pamerFields.append(
"stepName",
this.nodeData.value.attributes.label.value
);
pamerFields.append("graphXml", this.graphXml);
pamerFields.append("before", true);
inputOutputFields(pamerFields).then((res) => {
this.fieldFormat = res;
console.log(res);
});
},
systemDataTypesFun() {
systemDataTypes().then((res) => {
this.type = res;
});
},
valueMetaFun() {
valueMeta().then((res) => {
this.fieldType = res;
});
},
valueFormatFun() {
let pamer2 = new FormData(); // 创建form对象
pamer2.append("valueType", "all");
valueFormat(pamer2).then((res) => {
this.fieldFormat = res;
});
},
},
};
</script>
<style lang="scss" scoped>
* {
outline: none;
}
</style>
......@@ -24,14 +24,7 @@
:value="item.name"
/>
</el-select>
<!-- <el-select v-model="form.connection" style="width: 100%" @change="getField()">
<el-option
v-for="item in ComboBox"
:key="item.id"
:label="item.name"
:value="item"
/>
</el-select> -->
</el-col>
<el-col class="line" :span="2">
<el-button size="mini" @click.native="dialogVisibleFourthFun"
......
......@@ -742,8 +742,6 @@
>
</getSystemInformation>
<!-- 字符串替换-->
<stringSubstitution
......@@ -793,7 +791,6 @@
</el-dialog> -->
<!-- 生成记录-->
<generatingRecords
ref="RowGenerator"
:disabed="true"
......@@ -803,8 +800,17 @@
:saveOutputDialog="saveOutputDialog"
></generatingRecords>
<!-- 文本文件输入-->
<!-- 数值范围-->
<setFieldValue
ref="setFieldValue"
:disabed="true"
:form="form"
:nodeData="nodeData"
:setFieldValueDialog.sync="setFieldValueDialog"
:saveOutputDialog="saveOutputDialog"
></setFieldValue>
<!-- 文本文件输入-->
<textFileInput
ref="TextFileInput"
:disabed="true"
......@@ -816,7 +822,6 @@
></textFileInput>
<!-- 排序记录-->
<sortRecord
ref="sortRecord"
:disabed="true"
......@@ -859,7 +864,6 @@
:saveOutputDialog="saveOutputDialog"
></mergeRecords>
<!-- 记录连接-->
<recordConnection
......@@ -992,6 +996,28 @@
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></grouping>
<!-- 增加常量 -->
<addConstants
ref="addConstants"
:form="form"
:nodeData="nodeData"
:addConstantsDialog.sync="addConstantsDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></addConstants>
<!-- 增加序列 -->
<addSequence
ref="addSequence"
:form="form"
:nodeData="nodeData"
:getXmlVal="getXmlVal"
:addSequenceDialog.sync="addSequenceDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></addSequence>
<!-- 流查询 -->
<streamQuery
ref="streamQuery"
......@@ -1000,6 +1026,20 @@
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></streamQuery>
<!-- 行转列 -->
<rowToColumn
ref="rowToColumn"
:form="form"
:nodeData="nodeData"
:rowToColumnDialog.sync="rowToColumnDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></rowToColumn>
<!-- 替换NULL值 -->
<replaceNull
ref="replaceNull"
......@@ -1007,7 +1047,8 @@
:nodeData="nodeData"
:replaceNullDialog.sync="replaceNullDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog">
:saveOutputDialog="saveOutputDialog"
>
</replaceNull>
<!-- 发送邮件 -->
......@@ -1160,7 +1201,13 @@
:scriptFormSend="outPutFormData16"
></sqlScriptDialog>
<!-- 转换-脚本-javascript -->
<javaScriptDialog ref="refJavaScript" :javaScriptVisible.sync="javaScriptVisible" :saveOutputDialog="saveOutputDialog" :doubleClickCell="doubleClickCell" :javaScriptFormSend="javaScriptFormData" ></javaScriptDialog>
<javaScriptDialog
ref="refJavaScript"
:javaScriptVisible.sync="javaScriptVisible"
:saveOutputDialog="saveOutputDialog"
:doubleClickCell="doubleClickCell"
:javaScriptFormSend="javaScriptFormData"
></javaScriptDialog>
<!-- 脚本弹窗组件end -->
<!-- 转换弹窗组件start -->
......@@ -1272,12 +1319,12 @@ import textFileDialog from "../../../output-dialog/text-file-output";
import microDialog from "../../../output-dialog/micro-excel";
// 输出弹窗end********************************************
import setFieldValue from "../appBulletFrame/setFieldValue"; //设置字段值
import sortRecord from "../appBulletFrame/sortRecord"; //排序记录
import setVariable from "../appBulletFrame/setVariable"; //设置变量
import getVariable from "../appBulletFrame/getVariable"; //获取变量
import mergeRecords from "../appBulletFrame/mergeRecords"; //合并记录
import recordConnection from '../appBulletFrame/recordConnection';//记录连接
import recordConnection from "../appBulletFrame/recordConnection"; //记录连接
import selectField from "../appBulletFrame/selectField"; //选择字段
import toRepeat from "../appBulletFrame/toRepeat"; //去除重复
import mapping from "../appBulletFrame/mapping"; //映射(子转换)
......@@ -1288,10 +1335,12 @@ import nullOperation from "../appBulletFrame/nullOperation"; //空操作
import stringSubstitution from "../appBulletFrame/stringSubstitution"; //字符串替换
import conversionSettings from "../appBulletFrame/conversionSettings"; //转换设置
import jobSettings from "../appBulletFrame/jobSettings"; //作业设置
import addSequence from "../appBulletFrame/addSequence"; //增加序列
import importXmlFile from "../appBulletFrame/importXmlFile"; //导出资源库到XML文件
import grouping from "../appBulletFrame/grouping"; //分组
import addConstants from "../appBulletFrame/addConstants"; //增加常量
import streamQuery from "../appBulletFrame/streamQuery"; //流查询
import rowToColumn from "../appBulletFrame/rowToColumn";//行转列
import replaceNull from "../appBulletFrame/replaceNull"; //替换null值
import sendMail from "../appBulletFrame/sendMail"; //发送邮件
......@@ -1309,12 +1358,12 @@ import switchDialog from "../../../stream-dialog/switch";
// 脚本弹窗组件start---------------------
import sqlScriptDialog from "../../../script-dialog/sql-script";
import javaScriptDialog from "../../../script-dialog/java-script";//转换-脚本-javaScript代码
import javaScriptDialog from "../../../script-dialog/java-script"; //转换-脚本-javaScript代码
// 脚本弹窗组件end-----------------------
// 转换弹窗组件start----------
import valueDialog from "../../../trans-dialog/value";//值映射
import cutStringDialog from "../../../trans-dialog/cut-string";//剪切字符串
import valueDialog from "../../../trans-dialog/value"; //值映射
import cutStringDialog from "../../../trans-dialog/cut-string"; //剪切字符串
// 转换弹窗组件end------------
......@@ -1371,9 +1420,9 @@ export default {
outPutFormData14: {}, //作业---成功
outPutFormData: {}, //输出弹窗组件的表单值
// 转换33start---------
javaScriptFormData:{},//转换--javascript代码
valueFormData:{},//值映射
cutStringFormData:{},//剪切字符串
javaScriptFormData: {}, //转换--javascript代码
valueFormData: {}, //值映射
cutStringFormData: {}, //剪切字符串
// 转换3end------------
outPutFormData16: {}, //脚本--执行sql脚本
doubleClickCell: {},
......@@ -1415,7 +1464,7 @@ export default {
setVariableDialog: false, //设置变量
getVariableDialog: false, //获取变量
mergeRecordsDialog: false, //合并记录
recordConnectionDialog:false,//记录连接
recordConnectionDialog: false, //记录连接
selectFieldDialog: false, //选择字段
conversionSettingsDialog: false, //转换设置
jobSettingsDialog: false, //作业设置
......@@ -1427,18 +1476,21 @@ export default {
xmlFileInputDialog: false, //xml文件输入
importXmlFileDialog: false, //导出资源库到XML文件
groupingDialog: false, //分组
stringSubstitutionDialog:false,//字符串替换
stringSubstitutionDialog: false, //字符串替换
addConstantsDialog: false, //增加常量
addSequenceDialog: false, //增加序列
rowToColumnDialog:false,//行转列
streamQueryDialog: false, //流查询
replaceNullDialog:false, //替换Null值
replaceNullDialog: false, //替换Null值
sendMailDialog: false, //发送邮件
// 流程弹窗组件start----------
// 流程弹窗组件end------------
// 脚本组件start-----
javaScriptVisible:false,
javaScriptVisible: false,
scriptVisible: false,
// 脚本组件end-----
valueVisible:false,//值映射
cutStringVisible:false,//剪切字符串
valueVisible: false, //值映射
cutStringVisible: false, //剪切字符串
// 输入模块
file: [],
sheets: [],
......@@ -1449,6 +1501,7 @@ export default {
filePathSelection: false,
TextFileInputDialog: false,
RowGeneratorDialog: false,
setFieldValueDialog: false,
TableInputDialog: false,
SystemInfoDialog: false,
ConstantDialog: false,
......@@ -1525,12 +1578,13 @@ export default {
successDialog,
homeworkDialog,
//
stringSubstitution,//字符串替换
setFieldValue, //设置字段值
stringSubstitution, //字符串替换
sortRecord, //排序记录
setVariable, //设置变量
getVariable, //获取变量
mergeRecords, //合并记录
recordConnection,// 记录连接
recordConnection, // 记录连接
selectField, //选择字段
conversionSettings, //转换设置
jobSettings, //作业设置
......@@ -1542,8 +1596,11 @@ export default {
xmlFileInput, //xml 文件输入
importXmlFile, //导出资源库到XML文件
grouping, //分组
addConstants, //增加常量
addSequence, //增加序列
streamQuery, //流查询
replaceNull,//替换null值
rowToColumn,//行转列
replaceNull, //替换null值
sendMail, //发送邮件
// 作业弹簧组件end----------------------
// 流程弹窗组件start---------
......@@ -1556,8 +1613,8 @@ export default {
// 脚本弹窗组件---
// 转换弹窗组件start---
valueDialog,//值映射
cutStringDialog,//剪切字符串
valueDialog, //值映射
cutStringDialog, //剪切字符串
// 转换弹窗组件end-----
},
//自定义指令 https://www.jb51.net/article/108047.htm
......@@ -1808,8 +1865,6 @@ export default {
// }
// },
copyNumberFun() {
console.log(this.form, "数据");
this.copyNumber = !this.copyNumber;
......@@ -2235,45 +2290,88 @@ export default {
valueFormat(pamer2).then((res) => {
this.fieldFormat = res;
});
if ((this.curFileType == "transformation" && cell.dis == "step63") ||
cell.value.attributes.ctype.value == "ReplaceString") {
this.stringSubstitutionDialog = !this.stringSubstitutionDialog
if (
(this.curFileType == "transformation" && cell.dis == "step70") ||
cell.value.attributes.ctype.value == "Normaliser"
) {
this.rowToColumnDialog = !this.rowToColumnDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.rowToColumn.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step59") ||
cell.value.attributes.ctype.value == "Sequence"
) {
this.addSequenceDialog = !this.addSequenceDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.addSequence.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step72") ||
cell.value.attributes.ctype.value == "SetValueField"
) {
this.setFieldValueDialog = !this.setFieldValueDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.stringSubstitution.clickFun(this.graph,this.form);
this.$refs.setFieldValue.clickFun(this.graph, this.form);
}, 500);
}else if ((this.curFileType == "transformation" && cell.dis == "step84") ||
cell.value.attributes.ctype.value == "IfNull") {
this.replaceNullDialog = !this.replaceNullDialog
} else if (
(this.curFileType == "transformation" && cell.dis == "step58") ||
cell.value.attributes.ctype.value == "Constant"
) {
this.addConstantsDialog = !this.addConstantsDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.replaceNull.clickFun(this.graph,this.form);
this.$refs.addConstants.clickFun(this.graph, this.form);
}, 500);
}else if ( (this.curFileType == "transformation" && cell.dis == "srep167") ||
cell.value.attributes.ctype.value == "MappingInput") {
this.mappingInputDialog = !this.mappingInputDialog
} else if (
(this.curFileType == "transformation" && cell.dis == "step63") ||
cell.value.attributes.ctype.value == "ReplaceString"
) {
this.stringSubstitutionDialog = !this.stringSubstitutionDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.mappingInput.clickFun(this.graph,this.form);
this.$refs.stringSubstitution.clickFun(this.graph, this.form);
}, 500);
}else if ( (this.curFileType == "transformation" && cell.dis == "srep168") ||
cell.value.attributes.ctype.value == "MappingOutput") {
this.mappingOutputDialog = !this.mappingOutputDialog
} else if (
(this.curFileType == "transformation" && cell.dis == "step84") ||
cell.value.attributes.ctype.value == "IfNull"
) {
this.replaceNullDialog = !this.replaceNullDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.mappingOutput.clickFun(this.graph,this.form);
this.$refs.replaceNull.clickFun(this.graph, this.form);
}, 500);
}else if (
} else if (
(this.curFileType == "transformation" && cell.dis == "srep167") ||
cell.value.attributes.ctype.value == "MappingInput"
) {
this.mappingInputDialog = !this.mappingInputDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.mappingInput.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "srep168") ||
cell.value.attributes.ctype.value == "MappingOutput"
) {
this.mappingOutputDialog = !this.mappingOutputDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.mappingOutput.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "srep133") ||
cell.value.attributes.ctype.value == "MergeJoin"
) {
this.recordConnectionDialog = !this.recordConnectionDialog
this.recordConnectionDialog = !this.recordConnectionDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.recordConnection.clickFun(this.graph,this.form);
this.$refs.recordConnection.clickFun(this.graph, this.form);
}, 500);
}else if (
} else if (
(this.curFileType == "transformation" && cell.dis == "srep98") ||
cell.value.attributes.ctype.value == "Dummy"
) {
......@@ -2282,7 +2380,6 @@ export default {
setTimeout(() => {
this.$refs.nullOperation.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step79") ||
cell.value.attributes.ctype.value == "Mail"
......@@ -2650,27 +2747,36 @@ export default {
this.$refs.importXmlFile.clickFun(this.graph, this.form); //向子组件传递画布
}, 500);
return;
}else if((this.curFileType=="transformation" && cell.ids == "step106") || cell.value.attributes.ctype.value == "ScriptValueMod" ){
} else if (
(this.curFileType == "transformation" && cell.ids == "step106") ||
cell.value.attributes.ctype.value == "ScriptValueMod"
) {
//脚本 --javaScript代码
this.javaScriptVisible = !this.javaScriptVisible;
this.javaScriptFormData = this.showDataFunc()
this.javaScriptFormData = this.showDataFunc();
setTimeout(() => {
this.$refs.refJavaScript.clickFun(this.graph);//向子组件传递画布
this.$refs.refJavaScript.clickFun(this.graph); //向子组件传递画布
}, 500);
return;
}else if((this.curFileType=="transformation" && cell.ids == "step52") || cell.value.attributes.ctype.value == "ValueMapper" ){
} else if (
(this.curFileType == "transformation" && cell.ids == "step52") ||
cell.value.attributes.ctype.value == "ValueMapper"
) {
//转换 --值映射
this.valueVisible = !this.valueVisible;
this.valueFormData = this.showDataFunc()
this.valueFormData = this.showDataFunc();
setTimeout(() => {
// this.$refs.refJavaScript.clickFun(this.graph);//向子组件传递画布
this.$refs.refValue.clickFun(this.graph); //向子组件传递画布
}, 500);
return;
}else if((this.curFileType=="transformation" && cell.ids == "step55") || cell.value.attributes.ctype.value == "StringCut" ){
} else if (
(this.curFileType == "transformation" && cell.ids == "step55") ||
cell.value.attributes.ctype.value == "StringCut"
) {
//转换 --剪切字符串
this.cutStringVisible = !this.cutStringVisible;
this.cutStringFormData = this.showDataFunc()
this.cutStringFormData = this.showDataFunc();
setTimeout(() => {
// this.$refs.refJavaScript.clickFun(this.graph);//向子组件传递画布
this.$refs.refCutString.clickFun(this.graph); //向子组件传递画布
......
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