diff --git a/src/pages/workbench/fwzc_fwcs.vue b/src/pages/workbench/fwzc_fwcs.vue index 99f7823feea0976ee9a4503ff4a8cbae3a396d57..9dbd50c6d8badffe25e528e4a8721634c39a7b28 100644 --- a/src/pages/workbench/fwzc_fwcs.vue +++ b/src/pages/workbench/fwzc_fwcs.vue @@ -1528,35 +1528,35 @@ export default { (this.activeBtn == 4 && (this.zhyyVal == 22 || this.zhyyVal == 23)) ) { if (this.activeBtn == 2 || this.activeBtn == 3) { - if (this.jkwds.length == 0) { - this.$message.error("请上传接口文档"); + // if (this.jkwds.length == 0) { + // this.$message.error("请上传接口文档"); + // } else { + if ( + this.activeBtn == 2 || + (this.activeBtn == 4 && this.zhyyVal == 22) + ) { + this.request_fields = []; + this.response_fields = []; + this.jcxxtx = true; + this.getOrganization(); } else { - if ( - this.activeBtn == 2 || - (this.activeBtn == 4 && this.zhyyVal == 22) - ) { - this.request_fields = []; - this.response_fields = []; + let requestData = this.$refs.fwcs_sjfw_qqcs.getTableData(); + let responseData = this.$refs.fwcs_sjfw_fhcs.getTableData(); + this.requestRules = 0; + this.responseRules = 0; + this.checkTable(requestData, 0); + this.checkTable(responseData, 1); + if (this.requestRules == 0 && this.responseRules == 0) { + this.request_fields = requestData; + this.response_fields = responseData; this.jcxxtx = true; this.getOrganization(); - } else { - let requestData = this.$refs.fwcs_sjfw_qqcs.getTableData(); - let responseData = this.$refs.fwcs_sjfw_fhcs.getTableData(); - this.requestRules = 0; - this.responseRules = 0; - this.checkTable(requestData, 0); - this.checkTable(responseData, 1); - if (this.requestRules == 0 && this.responseRules == 0) { - this.request_fields = requestData; - this.response_fields = responseData; - this.jcxxtx = true; - this.getOrganization(); - } else if (this.requestRules != 0) { - this.$message.error("请完善请求参数信息中的字段名称"); - } else if (this.responseRules != 0) { - this.$message.error("请完善返回参数信息中的字段名称"); - } + } else if (this.requestRules != 0) { + this.$message.error("请完善请求参数信息中的字段名称"); + } else if (this.responseRules != 0) { + this.$message.error("请完善返回参数信息中的字段名称"); } + // } } } else { let requestData = this.$refs.fwcs_sjfw_qqcs.getTableData(); @@ -1788,93 +1788,93 @@ export default { registePt() { this.$refs.form.validate((valid) => { if (valid) { - if ( - (this.activeBtn == 0 && this.jkwds.length == 0) || - (this.activeBtn == 2 && this.jkwds.length == 0) || - (this.activeBtn == 3 && this.jkwds.length == 0) - ) { - this.$message.error("请上传接口文档"); - } else { - if (this.cover.length != 0) { - let contentType = ""; + // if ( + // (this.activeBtn == 0 && this.jkwds.length == 0) || + // (this.activeBtn == 2 && this.jkwds.length == 0) || + // (this.activeBtn == 3 && this.jkwds.length == 0) + // ) { + // this.$message.error("请上传接口文档"); + // } else { + if (this.cover.length != 0) { + let contentType = ""; + if ( + this.activeBtn == 1 && + !this.is_portal && + window.serviceConfig && + window.serviceConfig.state == "needLogin" + ) { + this.addPortalItem(); + } else { + this.fwR = true; if ( - this.activeBtn == 1 && - !this.is_portal && - window.serviceConfig && - window.serviceConfig.state == "needLogin" + this.activeBtn == 0 || + this.activeBtn == 2 || + this.activeBtn == 3 ) { - this.addPortalItem(); - } else { - this.fwR = true; - if ( - this.activeBtn == 0 || - this.activeBtn == 2 || - this.activeBtn == 3 - ) { - contentType = this.sjfwQqt; - } else if (this.activeBtn == 4) { - if (this.activeZh == "1") { - contentType = this.zhfwQqt; - } + contentType = this.sjfwQqt; + } else if (this.activeBtn == 4) { + if (this.activeZh == "1") { + contentType = this.zhfwQqt; } - let query = { - name: this.form.name, - sectors: this.form.area, - organization: this.form.origin, - cover: this.cover[0], - openness: this.form.resource, - descript: this.form.desc, - data_service_type1: this.btnList[this.activeBtn].id, - data_service_type2: - this.activeBtn == 0 - ? this.jczcfwQqt - : this.activeBtn == 1 - ? this.skfwQqt - : this.activeBtn == 4 - ? this.zhyyVal - : 0, - portal_id: this.portal_id, - encode_method: this.form.code, - doc_file: this.jkwds.length != 0 ? this.jkwds[0] : "", - urls: [ - { - name: "", - response_type: - this.activeBtn == 3 ? this.gz_fhsjgs : "JSON", - req_auth_mthod: this.sqfsVal, - req_auth_token: this.sqfsVal == 1 ? this.tokenVal : "", - req_auth_token_name: - this.sqfsVal == 1 ? this.tokenName : "", - method: this.select, - url: this.serviceUrl, - request_fields: - this.dataType == "body" - ? this.request_fields - : this.body_fields, - request_query_fields: - this.dataType == "param" - ? this.request_fields - : this.param_fields, - response_fields: this.response_fields, - content_type: contentType, - }, - ], - }; - this.$api.workbench.serviceAdd(query).then((response) => { - this.fwR = false; - if (response.data.success == 1) { - this.$message.success("服务注册成功"); - this.$router.push("/fwgl/" + this.$store.getters.level); - } else { - console.log(response.data.errMsg); - this.$message.error(response.data.errMsg); - } - }); } - } else { - this.$message.error("请上传服务封面"); + let query = { + name: this.form.name, + sectors: this.form.area, + organization: this.form.origin, + cover: this.cover[0], + openness: this.form.resource, + descript: this.form.desc, + data_service_type1: this.btnList[this.activeBtn].id, + data_service_type2: + this.activeBtn == 0 + ? this.jczcfwQqt + : this.activeBtn == 1 + ? this.skfwQqt + : this.activeBtn == 4 + ? this.zhyyVal + : 0, + portal_id: this.portal_id, + encode_method: this.form.code, + doc_file: this.jkwds.length != 0 ? this.jkwds[0] : "", + urls: [ + { + name: "", + response_type: + this.activeBtn == 3 ? this.gz_fhsjgs : "JSON", + req_auth_mthod: this.sqfsVal, + req_auth_token: this.sqfsVal == 1 ? this.tokenVal : "", + req_auth_token_name: + this.sqfsVal == 1 ? this.tokenName : "", + method: this.select, + url: this.serviceUrl, + request_fields: + this.dataType == "body" + ? this.request_fields + : this.body_fields, + request_query_fields: + this.dataType == "param" + ? this.request_fields + : this.param_fields, + response_fields: this.response_fields, + content_type: contentType, + }, + ], + }; + this.$api.workbench.serviceAdd(query).then((response) => { + this.fwR = false; + if (response.data.success == 1) { + this.$message.success("服务注册成功"); + this.$router.push("/fwgl/" + this.$store.getters.level); + } else { + console.log(response.data.errMsg); + this.$message.error(response.data.errMsg); + } + }); } + } else { + this.$message.error("请上传服务封面"); } + // } } else { this.$message.error("请完善服务基本信息"); }