From 05658fff7f3df5a19638e1e3cc19782b7175d5a9 Mon Sep 17 00:00:00 2001 From: liudianxin Date: Mon, 18 May 2020 10:04:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/index.css | 9 ++- src/components/codes.vue | 9 ++- src/components/table-select.vue | 32 +++++--- src/components/table-um.vue | 7 ++ src/pages/fwzc_fwcs.vue | 136 ++++++++++++++++++++++++++++---- static/data.json | 54 ++++++++++++- 6 files changed, 215 insertions(+), 32 deletions(-) diff --git a/src/assets/css/index.css b/src/assets/css/index.css index 4ac5b2b..2dfb729 100644 --- a/src/assets/css/index.css +++ b/src/assets/css/index.css @@ -404,8 +404,11 @@ width: 620px!important; .el-button { border-radius: 8px; } -/* 下拉选样式 */ -/* .el-select-dropdown { +/* + 下拉选样式 + 此处勿删,apaasV3下拉选择样式统一用这个 + */ +.el-select-dropdown { border-radius: 8px; } .el-select-dropdown__list { @@ -437,7 +440,7 @@ width: 620px!important; } .el-popper[x-placement^=top] .popper__arrow::after { border-top-color: transparent; -} */ +} /* 单选激活样式 */ .el-radio__input.is-checked .el-radio__inner { border-color: #838383; diff --git a/src/components/codes.vue b/src/components/codes.vue index cf64cf7..c31bf4e 100644 --- a/src/components/codes.vue +++ b/src/components/codes.vue @@ -30,7 +30,9 @@ export default { tabSize: 4, highlightActiveLine: false }); - this.getValue(); + if (this.url) { + this.getValue(); + } }, watch: {}, methods: { @@ -38,7 +40,7 @@ export default { this.$http .get(this.url) .then(response => { - this.aceEditor.setValue(JSON.stringify(response.data, null, "\t")); + this.aceEditor.setValue(response.data); }) .catch(function(response) { console.log(response); @@ -46,6 +48,9 @@ export default { }, parentHandleclick() { this.$emit("getEditValue", this.aceEditor.getValue()); + }, + getCodesVal() { + return this.aceEditor.getValue(); } } }; diff --git a/src/components/table-select.vue b/src/components/table-select.vue index fb6759c..ae7d78d 100644 --- a/src/components/table-select.vue +++ b/src/components/table-select.vue @@ -2,19 +2,25 @@
- - + +
@@ -23,9 +29,11 @@ import helper from "@/services/helper"; export default { props: { - selectArr:{ + selectArr: { type: Array, - default: [] + default: () => { + []; + } }, item: { type: String, @@ -42,7 +50,7 @@ export default { couldNotEdit: { type: Boolean, default: false - }, + } }, data: () => ({ selectValue: "" @@ -78,6 +86,6 @@ export default { border-radius: 4px; } .table_in_s .el-input.is-disabled .el-input__inner { - color: #70747C; + color: #70747c; } \ No newline at end of file diff --git a/src/components/table-um.vue b/src/components/table-um.vue index 11a67c8..1aa76d4 100644 --- a/src/components/table-um.vue +++ b/src/components/table-um.vue @@ -367,6 +367,10 @@ export default { type: Boolean, default: true, }, + datas: { + type: Array, + default: null, + }, }, data() { return { @@ -444,6 +448,9 @@ export default { // console.log(this.emptyText); // the if statement is to choose which data could be show, only used for test and template this.selectedTabsPage = []; + if (this.datas) { + this.selectedTabsPage = this.datas; + } this.pagination.total = 0; if (this.autoAdd) { this.addRow(); diff --git a/src/pages/fwzc_fwcs.vue b/src/pages/fwzc_fwcs.vue index a096b56..2c93be3 100644 --- a/src/pages/fwzc_fwcs.vue +++ b/src/pages/fwzc_fwcs.vue @@ -73,7 +73,7 @@
JSON
- + @@ -120,7 +120,8 @@ size="mini" :border="true" :headers="sjfw_qqcstx" - url="qqcstx" + url + :datas="datas" :searchShow="false" :addRowBtn="false" :autoAdd="false" @@ -140,7 +141,8 @@ size="mini" :border="true" :headers="sjfw_fhcstx" - url="fhcstx" + url + :datas="datas" :searchShow="false" :addRowBtn="false" :autoAdd="false" @@ -285,10 +287,10 @@ export default { { label: "请求值", prop: "requestValue", type: "input", align: "left" } ], sjfw_qqcstx: [ - { label: "字段编码", prop: "unicode", type: "", align: "left" }, - { label: "示例值", prop: "examples", type: "input", align: "left" }, - { label: "字段类型", prop: "type", type: "", align: "left" }, - { label: "字段名称", prop: "name", type: "input", align: "left" }, + { label: "字段编码", prop: "name", type: "", align: "left" }, + { label: "示例值", prop: "example", type: "input", align: "left" }, + { label: "字段类型", prop: "field_type", type: "", align: "left" }, + { label: "字段名称", prop: "label", type: "input", align: "left" }, { label: "是否必须", prop: "needable", @@ -296,18 +298,18 @@ export default { align: "left", width: 100 }, - { label: "字段说明", prop: "explanation", type: "input", align: "left" } + { label: "字段说明", prop: "descript", type: "input", align: "left" } ], sjfw_fhcstx: [ - { label: "字段编码", prop: "unicode", type: "", align: "left" }, - { label: "字段类型", prop: "type", type: "popover", align: "left" }, - { label: "字段名称", prop: "name", type: "input", align: "left" }, - { label: "字段说明", prop: "explanation", type: "input", align: "left" } + { label: "字段编码", prop: "name", type: "", align: "left" }, + { label: "字段类型", prop: "field_type", type: "popover", align: "left" }, + { label: "字段名称", prop: "label", type: "input", align: "left" }, + { label: "字段说明", prop: "descript", type: "input", align: "left" } ], url: "", emptyText: "暂时没数据", resultShow: false, - optionsSq: [{ label: "Bearer Token", value: "Bearer Token" }], + optionsSq: [{ label: "Bearer Token", value: "Bearer" }], sqfsVal: "", tokenVal: "", sjfwQqt: "JSON", @@ -351,7 +353,65 @@ export default { { label: "教育机构", value: 9 }, { label: "其他", value: 10 } ], - optionsOrganization: [] + optionsOrganization: [], + datas: [ + { + id: 123134445, + name: "name", + field_type: "string", + label: "", + descript: "", + example: "lisi", + children: null + }, + { + id: 1213445, + name: "age", + field_type: "float", + label: "", + descript: "", + example: "22.00", + children: null + }, + { + id: 12313444, + name: "childs", + field_type: "array", + label: "", + descript: "", + example: "", + children: [ + { + id: 1231345, + name: "", + field_type: "object", + label: "", + descript: "", + example: "", + children: [ + { + id: 123344445, + name: "name", + field_type: "string", + label: "", + descript: "", + example: "lili", + children: null + }, + { + id: 11344445, + name: "age", + field_type: "float", + label: "", + descript: "", + example: "2.00", + children: null + } + ] + } + ] + } + ] }), computed: {}, watch: {}, @@ -362,6 +422,54 @@ export default { }, clickFwcs() { this.resultShow = true; + let aothorization = {}; + if (this.sqfsVal != "") { + aothorization[this.sqfsVal] = this.tokenVal; + } + let request = this.$refs.fwcs_sjfw_qq.getTableData(); + console.log(request); + let requestData = {}; + for (let i = 0; i < request.length; i++) { + if ( + request[i] && + request[i].requestEncoding && + request[i].requestValue && + request[i].requestEncoding != "" && + request[i].requestValue != "" + ) { + if ( + Object.keys(requestData).indexOf(request[i].requestEncoding) == -1 + ) { + requestData[request[i].requestEncoding] = []; + requestData[request[i].requestEncoding][0] = + request[i].requestValue; + } else { + requestData[request[i].requestEncoding].push( + request[i].requestValue + ); + } + } + } + let url = `/apaas/service/v3/service/manager/test`; + let query = { + method: this.select, + url: this.input3, + Authorization: aothorization, + params: requestData, + body: this.$refs.jsonCodes.getCodesVal() + }; + this.$http + .post(url, query) + .then(response => { + if (response.data.success == 1) { + this.l4 = response.data.data; + } else { + console.log(response.data.console.error); + } + }) + .catch(function(response) { + console.log("unkonw error"); + }); }, clickTab() {}, clickNext() { diff --git a/static/data.json b/static/data.json index 6fa4a31..a8f30d5 100644 --- a/static/data.json +++ b/static/data.json @@ -540,6 +540,58 @@ "name": "王小虎", "explanation": "上海市普陀区金沙江路 1516 弄" } + ], + "body_fields": [ + { + "name": "name", + "field_type": "string", + "label": "", + "descript": "", + "example": "lisi", + "children": null + }, + { + "name": "age", + "field_type": "float", + "label": "", + "descript": "", + "example": "22.00", + "children": null + }, + { + "name": "childs", + "field_type": "array", + "label": "", + "descript": "", + "example": "", + "children": [ + { + "name": "", + "field_type": "object", + "label": "", + "descript": "", + "example": "", + "children": [ + { + "name": "name", + "field_type": "string", + "label": "", + "descript": "", + "example": "lili", + "children": null + }, + { + "name": "age", + "field_type": "float", + "label": "", + "descript": "", + "example": "2.00", + "children": null + } + ] + } + ] + } ] } -} +} \ No newline at end of file -- 2.26.0