Commit 8da81b6a by yuwei

2.0.0项目初始化

parent d13791ea
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 弹出层标题 // 弹出层标题
title: "脱敏规则配置" title: '脱敏规则配置'
} }
} }
}, },
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
let fieldRuleIndex = this.form.rules.findIndex((item) => { let fieldRuleIndex = this.form.rules.findIndex((item) => {
return item.fieldName === this.form2.fieldName return item.fieldName === this.form2.fieldName
}) })
if (fieldRuleIndex != -1) { if (fieldRuleIndex !== -1) {
// 当返回-1时,则说明数组中没有 // 当返回-1时,则说明数组中没有
this.form.rules.splice(fieldRuleIndex, 1) this.form.rules.splice(fieldRuleIndex, 1)
} }
......
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
let fieldParamIndex = this.resParamList.findIndex((param) => { let fieldParamIndex = this.resParamList.findIndex((param) => {
return param.fieldName === rule.fieldName return param.fieldName === rule.fieldName
}) })
if (fieldParamIndex != -1) { if (fieldParamIndex !== -1) {
let cipher = this.cipherTypeOptions.find((item) => { let cipher = this.cipherTypeOptions.find((item) => {
return item.itemText === rule.cipherType return item.itemText === rule.cipherType
}) })
......
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 弹出层标题 // 弹出层标题
title: "脱敏规则配置" title: '脱敏规则配置'
} }
} }
}, },
...@@ -233,7 +233,7 @@ export default { ...@@ -233,7 +233,7 @@ export default {
let fieldParamIndex = this.resParamList.findIndex((param) => { let fieldParamIndex = this.resParamList.findIndex((param) => {
return param.fieldName === rule.fieldName return param.fieldName === rule.fieldName
}) })
if (fieldParamIndex != -1) { if (fieldParamIndex !== -1) {
let cipher = this.cipherTypeOptions.find((item) => { let cipher = this.cipherTypeOptions.find((item) => {
return item.itemText === rule.cipherType return item.itemText === rule.cipherType
}) })
......
...@@ -177,18 +177,18 @@ ...@@ -177,18 +177,18 @@
</el-table-column> </el-table-column>
<el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip > <el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="nullable" label="是否必传" align="center" show-overflow-tooltip > <el-table-column prop="nullable" label="是否允许为空" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox> <el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip > <el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip > <el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.whereType" placeholder="请选择操作符"> <el-select v-model="scope.row.paramType" placeholder="请选择参数类型">
<el-option <el-option
v-for="dict in whereTypeOptions" v-for="dict in paramTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
...@@ -196,11 +196,11 @@ ...@@ -196,11 +196,11 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip > <el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.paramType" placeholder="请选择参数类型"> <el-select v-model="scope.row.whereType" placeholder="请选择操作符">
<el-option <el-option
v-for="dict in paramTypeOptions" v-for="dict in whereTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
...@@ -433,7 +433,7 @@ export default { ...@@ -433,7 +433,7 @@ export default {
let json = {} let json = {}
json.paramName = item.colName json.paramName = item.colName
json.nullable = item.nullable || '0' json.nullable = item.nullable || '0'
json.remark = item.remark || undefined json.remark = item.colComment || undefined
json.paramType = item.paramType || undefined json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined json.exampleValue = item.exampleValue || undefined
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
</el-form> </el-form>
<el-form ref="form2" :model="form2" :rules="rules2" label-width="80px" v-if="active == 2" disabled> <el-form ref="form2" :model="form2" :rules="rules2" label-width="80px" v-if="active == 2" disabled>
<el-form-item label="配置方式" prop="configType"> <el-form-item label="配置方式" prop="configType">
<el-select v-model="form2.configType" placeholder="请选择配置方式" @change="configTypeSelectChanged"> <el-select v-model="form2.configType" placeholder="请选择配置方式">
<el-option <el-option
v-for="dict in configTypeOptions" v-for="dict in configTypeOptions"
:key="dict.id" :key="dict.id"
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据源" prop="sourceId"> <el-form-item label="数据源" prop="sourceId">
<el-select v-model="form2.sourceId" placeholder="请选择数据源" @change="sourceSelectChanged"> <el-select v-model="form2.sourceId" placeholder="请选择数据源">
<el-option <el-option
v-for="source in sourceOptions" v-for="source in sourceOptions"
:key="source.id" :key="source.id"
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据库表" prop="tableName" v-if="form2.configType === '1'"> <el-form-item label="数据库表" prop="tableName" v-if="form2.configType === '1'">
<el-select v-model="form2.tableName" placeholder="请选择数据库表" @change="tableNameSelectChanged"> <el-select v-model="form2.tableName" placeholder="请选择数据库表">
<el-option <el-option
v-for="item in tableNameOptions" v-for="item in tableNameOptions"
:key="item.tableName" :key="item.tableName"
...@@ -155,14 +155,11 @@ ...@@ -155,14 +155,11 @@
<sql-editor <sql-editor
ref="sqleditor" ref="sqleditor"
:value="form2.sqlText" :value="form2.sqlText"
@changeTextarea="changeTextarea($event)" :readOnly="true"
style="height: 300px;margin: 10px 10px;" style="height: 300px;margin: 10px 10px;"
></sql-editor> ></sql-editor>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item v-if="form2.configType === '2'">
<el-button size="mini" type="primary" @click="sqlParse">SQL解析</el-button>
</el-form-item>
</el-form> </el-form>
<el-form ref="form3" :model="form3" :rules="rules3" label-width="80px" v-if="active == 3" disabled> <el-form ref="form3" :model="form3" :rules="rules3" label-width="80px" v-if="active == 3" disabled>
<el-form-item label="请求参数"> <el-form-item label="请求参数">
...@@ -176,18 +173,18 @@ ...@@ -176,18 +173,18 @@
</el-table-column> </el-table-column>
<el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip > <el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="nullable" label="是否必传" align="center" show-overflow-tooltip > <el-table-column prop="nullable" label="是否允许为空" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox> <el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip > <el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip > <el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.whereType" placeholder="请选择操作符"> <el-select v-model="scope.row.paramType" placeholder="请选择参数类型">
<el-option <el-option
v-for="dict in whereTypeOptions" v-for="dict in paramTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
...@@ -195,11 +192,11 @@ ...@@ -195,11 +192,11 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip > <el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.paramType" placeholder="请选择参数类型"> <el-select v-model="scope.row.whereType" placeholder="请选择操作符">
<el-option <el-option
v-for="dict in paramTypeOptions" v-for="dict in whereTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
...@@ -250,7 +247,7 @@ ...@@ -250,7 +247,7 @@
</template> </template>
<script> <script>
import { getDataApi, sqlParse } from '@/api/market/dataapi' import { getDataApi } from '@/api/market/dataapi'
import { listDataSource, getDbTables, getDbTableColumns } from '@/api/factory/datasource' import { listDataSource, getDbTables, getDbTableColumns } from '@/api/factory/datasource'
import SqlEditor from '@/components/SqlEditor' import SqlEditor from '@/components/SqlEditor'
...@@ -414,114 +411,12 @@ export default { ...@@ -414,114 +411,12 @@ export default {
}, },
/** 步骤条下一步 */ /** 步骤条下一步 */
handleNextStep () { handleNextStep () {
if (this.active === 1) { this.active++
this.$refs['form1'].validate(valid => {
if (valid) {
this.active++
}
})
} else if (this.active === 2) {
this.$refs['form2'].validate(valid => {
if (valid) {
if (this.form2.configType && this.form2.configType === '1') {
this.form3.reqParams = this.fieldParamList.filter(item => item.reqable).map(function (item) {
let json = {}
json.paramName = item.colName
json.nullable = item.nullable || '0'
json.remark = item.remark || undefined
json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined
json.defaultValue = item.defaultValue || undefined
return json
})
this.form3.resParams = this.fieldParamList.filter(item => item.resable).map(function (item) {
let json = {}
json.fieldName = item.colName
json.remark = item.colComment || undefined
json.dataType = item.dataType || undefined
json.exampleValue = item.exampleValue || undefined
return json
})
}
this.active++
}
})
}
}, },
/** 步骤条上一步 */ /** 步骤条上一步 */
handleLastStep () { handleLastStep () {
this.active-- this.active--
}, },
changeTextarea (val) {
this.form2.sqlText = val
},
configTypeSelectChanged (val) {
if (this.form2.configType === '1' && this.form2.sourceId && this.tableNameOptions.length <= 0) {
getDbTables(this.form2.sourceId).then(response => {
if (response.success) {
this.tableNameOptions = response.data
this.fieldParamList = []
}
})
}
},
sourceSelectChanged (val) {
if (this.form2.configType && this.form2.configType === '1') {
getDbTables(val).then(response => {
if (response.success) {
this.tableNameOptions = response.data
this.fieldParamList = []
}
})
}
},
tableNameSelectChanged (val) {
getDbTableColumns(this.form2.sourceId, val).then(response => {
if (response.success) {
this.fieldParamList = response.data
}
})
},
sqlParse () {
if (!this.form2.sourceId) {
this.$message.error('数据源不能为空')
return
}
if (!this.form2.sqlText) {
this.$message.error('解析SQL不能为空')
return
}
let data = {}
data.sqlText = this.form2.sqlText
sqlParse(data).then(response => {
if (response.success) {
const { data } = response
let reqParams = data.reqParams
let resParams = data.resParams
this.form3.reqParams = reqParams.map(function (item) {
let json = {}
json.paramName = item.paramName
json.nullable = item.nullable || '0'
json.remark = item.remark || undefined
json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined
json.defaultValue = item.defaultValue || undefined
return json
})
this.form3.resParams = resParams.map(function (item) {
let json = {}
json.fieldName = item.fieldName
json.remark = item.remark || undefined
json.dataType = item.dataType || undefined
json.exampleValue = item.exampleValue || undefined
return json
})
this.$message.success('解析成功,请进行下一步')
}
})
},
/** 获取详情 */ /** 获取详情 */
getDataApi: function (id) { getDataApi: function (id) {
getDataApi(id).then(response => { getDataApi(id).then(response => {
......
...@@ -177,18 +177,18 @@ ...@@ -177,18 +177,18 @@
</el-table-column> </el-table-column>
<el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip > <el-table-column prop="paramName" label="参数名称" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="nullable" label="是否必传" align="center" show-overflow-tooltip > <el-table-column prop="nullable" label="是否允许为空" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox> <el-checkbox v-model="scope.row.nullable" true-label="1" false-label="0"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip > <el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip > <el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.whereType" placeholder="请选择操作符"> <el-select v-model="scope.row.paramType" placeholder="请选择参数类型">
<el-option <el-option
v-for="dict in whereTypeOptions" v-for="dict in paramTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
...@@ -196,11 +196,11 @@ ...@@ -196,11 +196,11 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip > <el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.paramType" placeholder="请选择参数类型"> <el-select v-model="scope.row.whereType" placeholder="请选择操作符">
<el-option <el-option
v-for="dict in paramTypeOptions" v-for="dict in whereTypeOptions"
:key="dict.id" :key="dict.id"
:label="dict.itemValue" :label="dict.itemValue"
:value="dict.itemText" :value="dict.itemText"
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
}, },
created () { created () {
console.log('id:' + this.data.id) console.log('id:' + this.data.id)
this.getDicts('sys_common_status').then(response => { this.getDicts('sys_job_status').then(response => {
if (response.success) { if (response.success) {
this.statusOptions = response.data this.statusOptions = response.data
} }
......
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
}, },
created () { created () {
console.log('id:' + this.data.id) console.log('id:' + this.data.id)
this.getDicts('sys_common_status').then(response => { this.getDicts('sys_job_status').then(response => {
if (response.success) { if (response.success) {
this.statusOptions = response.data this.statusOptions = response.data
} }
......
...@@ -316,6 +316,7 @@ export default { ...@@ -316,6 +316,7 @@ export default {
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = true this.showOptions.showAdd = true
this.showOptions.showEdit = false this.showOptions.showEdit = false
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
...@@ -324,6 +325,7 @@ export default { ...@@ -324,6 +325,7 @@ export default {
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
...@@ -332,6 +334,7 @@ export default { ...@@ -332,6 +334,7 @@ export default {
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
}, },
/** 暂停任务按钮操作 */ /** 暂停任务按钮操作 */
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
}, },
created () { created () {
console.log('id:' + this.data.id) console.log('id:' + this.data.id)
this.getDicts('sys_common_status').then(response => { this.getDicts('sys_normal_status').then(response => {
if (response.success) { if (response.success) {
this.statusOptions = response.data this.statusOptions = response.data
} }
......
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