Commit 09108f8e by 李耀琨

拆分字段,字符串操作

parent 45efa79b
<template>
<div class="getSystemInformation">
<el-dialog
title="拆分字段"
:visible.sync="splitFieldsDialog"
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-select v-model="fiel.splitfield" style="width: 100%" clearable>
<el-option
v-for="item in fieName"
:key="item.index"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item label="分隔符:">
<el-input v-model="form.delimiter"></el-input>
</el-form-item>
<el-form-item label="Enclosure:">
<el-input v-model="form.enclosure"></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="id" label="ID"> </el-table-column>
<el-table-column prop="idrem" label="移除ID?"> </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="format" label="格式"> </el-table-column>
<el-table-column prop="group" label="分组符号"> </el-table-column>
<el-table-column prop="decimal" label="小数点符号">
</el-table-column>
<el-table-column prop="currency" label="货币符号">
</el-table-column>
<el-table-column prop="nullif" label="Nullif"> </el-table-column>
<el-table-column prop="ifnull" label="缺省"> </el-table-column>
<el-table-column prop="trimtype" label="去除空格类型">
<template slot-scope="scope">
{{ scope.row.trimtype == "none" ? "不去掉空格" : scope.row.trimtype == "left" ? "去掉左空格" : scope.row.trimtype == "right" ? "去掉右空格" : scope.row.trimtype == "both" ? "去掉左右两端空格" : ""}}
</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="ID:">
<el-input v-model="fiel.id"></el-input>
</el-form-item>
<el-form-item label="移除ID?">
<el-select v-model="fiel.idrem" style="width: 100%">
<el-option label="Y" value="Y"></el-option>
<el-option label="N" value="N"></el-option>
</el-select>
</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-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.format"></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.decimal"></el-input>
</el-form-item>
<el-form-item label="货币符号:">
<el-input v-model="fiel.currency"></el-input>
</el-form-item>
<el-form-item label="Nullif:">
<el-input v-model="fiel.nullif"></el-input>
</el-form-item>
<el-form-item label="缺省:">
<el-input v-model="fiel.ifnull"></el-input>
</el-form-item>
<el-form-item label="去除空格类型:">
<el-select v-model="fiel.trimtype" 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>
<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,
inputOutputFields,
} from "@/api/kettle/link";
export default {
props: ["form", "splitFieldsDialog", "saveOutputDialog", "nodeData"],
data() {
return {
addField: false,
fields: [],
type: {},
dataStatus: false,
fiel: {},
fieldFormat: [],
fieldType: [],
fieName: [],
};
},
created() {
this.systemDataTypesFun();
},
methods: {
inputFun() {
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.fieName = res;
});
},
clickFun(graph, val) {
console.log(graph, "双击获取值");
this.newGraph = graph;
console.log(val, "拿到form");
this.fields = JSON.parse(val.fields);
this.inputFun();
},
handleCloseFun() {
this.$emit("update:splitFieldsDialog", 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>
......@@ -314,6 +314,9 @@
<el-table-column prop="group" label="组"> </el-table-column>
<el-table-column prop="trim_type" label="去除空格类型">
<template slot-scope="scope">
{{ scope.row.trimtype == "none" ? "不去掉空格" : scope.row.trimtype == "left" ? "去掉左空格" : scope.row.trimtype == "right" ? "去掉右空格" : scope.row.trimtype == "both" ? "去掉左右两端空格" : ""}}
</template>
</el-table-column>
<el-table-column prop="repeat" label="重复"> </el-table-column>
......
......@@ -479,6 +479,9 @@
<el-table-column prop="precision" label="精度"> </el-table-column>
<el-table-column prop="trim_type" label="去除空格类型">
<template slot-scope="scope">
{{ scope.row.trimtype == "none" ? "不去掉空格" : scope.row.trimtype == "left" ? "去掉左空格" : scope.row.trimtype == "right" ? "去掉右空格" : scope.row.trimtype == "both" ? "去掉左右两端空格" : ""}}
</template>
</el-table-column>
<el-table-column prop="repeat" label="重复"> </el-table-column>
......
......@@ -460,6 +460,9 @@
<el-table-column prop="precision" label="精度"> </el-table-column>
<el-table-column prop="trim_type" label="去除空格类型">
<template slot-scope="scope">
{{ scope.row.trimtype == "none" ? "不去掉空格" : scope.row.trimtype == "left" ? "去掉左空格" : scope.row.trimtype == "right" ? "去掉右空格" : scope.row.trimtype == "both" ? "去掉左右两端空格" : ""}}
</template>
</el-table-column>
<el-table-column prop="repeat" label="重复"> </el-table-column>
......
......@@ -476,6 +476,9 @@
<el-table-column prop="precision" label="精度"> </el-table-column>
<el-table-column prop="trim_type" label="去除空格类型">
<template slot-scope="scope">
{{ scope.row.trimtype == "none" ? "不去掉空格" : scope.row.trimtype == "left" ? "去掉左空格" : scope.row.trimtype == "right" ? "去掉右空格" : scope.row.trimtype == "both" ? "去掉左右两端空格" : ""}}
</template>
</el-table-column>
<el-table-column prop="repeat" label="重复"> </el-table-column>
......@@ -1007,6 +1010,26 @@
:saveOutputDialog="saveOutputDialog"
></addConstants>
<!-- 拆分字符串 -->
<splitFields
ref="splitFields"
:form="form"
:nodeData="nodeData"
:splitFieldsDialog.sync="splitFieldsDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></splitFields>
<!-- 字符串操作 -->
<stringOperation
ref="stringOperation"
:form="form"
:nodeData="nodeData"
:stringOperationDialog.sync="stringOperationDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></stringOperation>
<!-- 增加序列 -->
<addSequence
ref="addSequence"
......@@ -1040,6 +1063,17 @@
></rowToColumn>
<!-- 行转列 -->
<columnToRow
ref="columnToRow"
:form="form"
:nodeData="nodeData"
:columnToRowDialog.sync="columnToRowDialog"
:doubleClickCell="doubleClickCell"
:saveOutputDialog="saveOutputDialog"
></columnToRow>
<!-- 替换NULL值 -->
<replaceNull
ref="replaceNull"
......@@ -1339,8 +1373,11 @@ import addSequence from "../appBulletFrame/addSequence"; //增加序列
import importXmlFile from "../appBulletFrame/importXmlFile"; //导出资源库到XML文件
import grouping from "../appBulletFrame/grouping"; //分组
import addConstants from "../appBulletFrame/addConstants"; //增加常量
import splitFields from "../appBulletFrame/splitFields";//拆分字符串
import stringOperation from "../appBulletFrame/stringOperation" //字符串操作
import streamQuery from "../appBulletFrame/streamQuery"; //流查询
import rowToColumn from "../appBulletFrame/rowToColumn";//行转列
import columnToRow from "../appBulletFrame/columnToRow";//列转行
import replaceNull from "../appBulletFrame/replaceNull"; //替换null值
import sendMail from "../appBulletFrame/sendMail"; //发送邮件
......@@ -1478,8 +1515,11 @@ export default {
groupingDialog: false, //分组
stringSubstitutionDialog: false, //字符串替换
addConstantsDialog: false, //增加常量
splitFieldsDialog:false,//拆分字符串
stringOperationDialog:false,//字符串操作
addSequenceDialog: false, //增加序列
rowToColumnDialog:false,//行转列
columnToRowDialog:false,//列转行
streamQueryDialog: false, //流查询
replaceNullDialog: false, //替换Null值
sendMailDialog: false, //发送邮件
......@@ -1597,9 +1637,12 @@ export default {
importXmlFile, //导出资源库到XML文件
grouping, //分组
addConstants, //增加常量
splitFields,//拆分字符串
stringOperation,//字符串操作
addSequence, //增加序列
streamQuery, //流查询
rowToColumn,//行转列
columnToRow,//列转行
replaceNull, //替换null值
sendMail, //发送邮件
// 作业弹簧组件end----------------------
......@@ -2291,6 +2334,33 @@ export default {
this.fieldFormat = res;
});
if (
(this.curFileType == "transformation" && cell.dis == "step65") ||
cell.value.attributes.ctype.value == "FieldSplitter"
) {
this.splitFieldsDialog = !this.splitFieldsDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.splitFields.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step62") ||
cell.value.attributes.ctype.value == "StringOperations"
) {
this.stringOperationDialog = !this.stringOperationDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.stringOperation.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step54") ||
cell.value.attributes.ctype.value == "Denormaliser"
) {
this.columnToRowDialog = !this.columnToRowDialog;
this.form = this.showDataFunc();
setTimeout(() => {
this.$refs.columnToRow.clickFun(this.graph, this.form);
}, 500);
} else if (
(this.curFileType == "transformation" && cell.dis == "step70") ||
cell.value.attributes.ctype.value == "Normaliser"
) {
......
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