Commit dc74abdc by yuwei

2.0.0项目初始化

parent d0b02276
......@@ -8,7 +8,7 @@
</el-button-group>
</div>
<div :style="classCardbody">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" disabled>
<el-form ref="form" :model="form" label-width="80px" disabled>
<el-form-item label="数据API" prop="apiId">
<el-select v-model="form.apiId" placeholder="请选择数据API">
<el-option
......@@ -161,6 +161,8 @@ export default {
return item.resParams
})
this.form.rules.forEach(rule => {
console.log(rule)
console.log(this.resParamList)
let fieldParamIndex = this.resParamList.findIndex((param) => {
return param.fieldName === rule.fieldName
})
......
......@@ -18,6 +18,7 @@
<el-col :span="8">请求类型:{{form.reqMethod}}</el-col>
<el-col :span="8">返回格式:{{form.resType}}</el-col>
</el-row>
<el-divider content-position="left">请求数据</el-divider>
<el-row>
<el-col :span="24">
<el-tabs type="border-card" v-model="activeTabName">
......@@ -30,11 +31,11 @@
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<el-table-column prop="authorization" label="Authorization" align="center" show-overflow-tooltip >
<el-table-column prop="KEY" label="键" align="center" show-overflow-tooltip >
</el-table-column>
<el-table-column prop="apiKey" label="api_key" align="center" show-overflow-tooltip >
<el-table-column prop="VALUE" label="值" align="center" show-overflow-tooltip >
</el-table-column>
<el-table-column prop="secretKey" label="secret_key" align="center" show-overflow-tooltip >
<el-table-column prop="DESCRIPTION" label="描述" align="center" show-overflow-tooltip >
</el-table-column>
</el-table>
</el-tab-pane>
......@@ -52,14 +53,14 @@
</el-table-column>
<el-table-column prop="nullable" label="是否允许为空" align="center" show-overflow-tooltip >
<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" disabled ></el-checkbox>
</template>
</el-table-column>
<el-table-column prop="remark" label="描述" align="center" show-overflow-tooltip >
</el-table-column>
<el-table-column prop="paramType" label="参数类型" align="center" show-overflow-tooltip >
<template slot-scope="scope">
<el-select v-model="scope.row.paramType" placeholder="请选择参数类型">
<el-select v-model="scope.row.paramType" placeholder="请选择参数类型" disabled >
<el-option
v-for="dict in paramTypeOptions"
:key="dict.id"
......@@ -71,7 +72,7 @@
</el-table-column>
<el-table-column prop="whereType" label="操作符" align="center" show-overflow-tooltip >
<template slot-scope="scope">
<el-select v-model="scope.row.whereType" placeholder="请选择操作符">
<el-select v-model="scope.row.whereType" placeholder="请选择操作符" disabled >
<el-option
v-for="dict in whereTypeOptions"
:key="dict.id"
......@@ -165,7 +166,7 @@ export default {
activeTabName: 'table0',
form: {},
rules: {
paramValue: [{ required: true, message: "参数值不能为空", trigger: "blur" }]
paramValue: [{ required: true, message: '参数值不能为空', trigger: 'blur' }]
},
apiHeader: {},
apiHeaderList: [],
......@@ -215,8 +216,9 @@ export default {
let data = response.data
this.apiHeader = data
let token = storage.ss.get('vue_template_token')
data.authorization = 'Bearer ' + token
this.apiHeaderList.push(data)
this.apiHeaderList.push({ 'KEY': 'Authorization', 'VALUE': 'Bearer ' + token, 'DESCRIPTION': '' })
this.apiHeaderList.push({ 'KEY': 'api_key', 'VALUE': this.apiHeader.apiKey, 'DESCRIPTION': '' })
this.apiHeaderList.push({ 'KEY': 'secret_key', 'VALUE': this.apiHeader.secretKey, 'DESCRIPTION': '' })
}
})
},
......
......@@ -425,30 +425,30 @@ export default {
getDbTableColumns(this.form2.sourceId, this.form2.tableName).then(response => {
if (response.success) {
this.fieldParamList = response.data
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
}
})
}
})
}
})
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
}
})
}
if (this.form2.configType === '2') {
this.$refs.sqleditor.editor.setValue(this.form2.sqlText)
......
......@@ -454,27 +454,6 @@ export default {
} 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.colComment || undefined
json.paramType = undefined
json.whereType = undefined
json.exampleValue = undefined
json.defaultValue = item.dataDefault || 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 = undefined
return json
})
}
this.active++
}
})
......@@ -568,26 +547,26 @@ export default {
getDbTableColumns(this.form2.sourceId, this.form2.tableName).then(response => {
if (response.success) {
this.fieldParamList = response.data
}
})
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
}
})
}
})
}
......
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