优化 服务信息

This commit is contained in:
java110 2020-07-08 10:24:24 +08:00
parent 951b9807c9
commit 7d9c683f2f
5 changed files with 153 additions and 162 deletions

4
app.js
View File

@ -33,8 +33,8 @@ let opts = {
//app.use('/callComponent',proxy('https://app.demo.winqi.cn/',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012/',opts));
app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
//app.listen(3000);

View File

@ -7,18 +7,7 @@
<div class="ibox-content">
<div>
<div>
<!--<div class="form-group row">
<label class="col-sm-2 col-form-label">楼名称</label>
<div class="col-sm-10"><input v-model="addFloorInfo.name" type="text" placeholder="必填,请填写名称" class="form-control"></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">楼编号</label>
<div class="col-sm-10"><input v-model="addFloorInfo.floorNum" type="email" placeholder="必填,请填写编号" class="form-control"></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10"><input v-model="addFloorInfo.remark" type="tel" placeholder="可填,请填写备注" class="form-control"></div>
</div>-->
<div class="form-group row">
<label class="col-sm-2 col-form-label">服务名称</label>
@ -46,13 +35,14 @@
<div class="col-sm-10">
<select class="custom-select" v-model="addServiceInfo.isInstance">
<option selected disabled value="">必填,请填写是否实例</option>
<option value="T">微服务处理</option>
<option value="Y"></option>
<option value="N"></option>
<option value="NT">透传</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="form-group row" >
<label class="col-sm-2 col-form-label">调用地址</label>
<div class="col-sm-10">
<input v-model="addServiceInfo.url" type="text" placeholder="选填,请填写调用地址"

View File

@ -1,160 +1,160 @@
(function(vc){
(function (vc) {
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
callBackListener: vc.propTypes.string, //父组件名称
callBackFunction: vc.propTypes.string //父组件监听方法
},
data:{
addServiceInfo:{
serviceId:'',
name:'',
serviceCode:'',
businessTypeCd:'API',
seq:'1',
messageQueueName:'',
isInstance:'Y',
url:'http://order-service/orderApi/service',
method:'',
timeout:'60',
retryCount:'3',
provideAppId:'8000418002',
data: {
addServiceInfo: {
serviceId: '',
name: '',
serviceCode: '',
businessTypeCd: 'API',
seq: '1',
messageQueueName: '',
isInstance: 'T',
url: 'http://community-service',
method: '',
timeout: '60',
retryCount: '3',
provideAppId: '8000418002',
}
},
_initMethod:function(){
_initMethod: function () {
},
_initEvent:function(){
vc.on('addService','openAddServiceModal',function(){
},
_initEvent: function () {
vc.on('addService', 'openAddServiceModal', function () {
$('#addServiceModel').modal('show');
});
},
methods:{
addServiceValidate(){
methods: {
addServiceValidate() {
return vc.validate.validate({
addServiceInfo:vc.component.addServiceInfo
},{
'addServiceInfo.name':[
{
limit:"required",
param:"",
errInfo:"服务名称不能为空"
addServiceInfo: vc.component.addServiceInfo
}, {
'addServiceInfo.name': [
{
limit: "required",
param: "",
errInfo: "服务名称不能为空"
},
{
limit:"maxLength",
param:"50",
errInfo:"服务名称不能超过50"
{
limit: "maxLength",
param: "50",
errInfo: "服务名称不能超过50"
},
],
'addServiceInfo.serviceCode':[
{
limit:"required",
param:"",
errInfo:"服务编码不能为空"
'addServiceInfo.serviceCode': [
{
limit: "required",
param: "",
errInfo: "服务编码不能为空"
},
{
limit:"maxin",
param:"2,50",
errInfo:"服务编码必须在2至50字符之间"
{
limit: "maxin",
param: "2,50",
errInfo: "服务编码必须在2至50字符之间"
},
],
'addServiceInfo.businessTypeCd':[
{
limit:"required",
param:"",
errInfo:"秘钥不能为空"
'addServiceInfo.businessTypeCd': [
{
limit: "required",
param: "",
errInfo: "秘钥不能为空"
},
{
limit:"maxin",
param:"2,4",
errInfo:"业务类型必须为API"
{
limit: "maxin",
param: "2,4",
errInfo: "业务类型必须为API"
},
],
'addServiceInfo.seq':[
{
limit:"required",
param:"",
errInfo:"序列不能为空"
'addServiceInfo.seq': [
{
limit: "required",
param: "",
errInfo: "序列不能为空"
},
{
limit:"maxLength",
param:"1",
errInfo:"序列格式错误"
{
limit: "maxLength",
param: "1",
errInfo: "序列格式错误"
},
],
'addServiceInfo.messageQueueName':[
{
limit:"maxLength",
param:"50",
errInfo:"消息队列不能超过50"
'addServiceInfo.messageQueueName': [
{
limit: "maxLength",
param: "50",
errInfo: "消息队列不能超过50"
},
],
'addServiceInfo.isInstance':[
{
limit:"required",
param:"",
errInfo:"是否实例不能为空"
'addServiceInfo.isInstance': [
{
limit: "required",
param: "",
errInfo: "是否实例不能为空"
},
{
limit:"maxLength",
param:"50",
errInfo:"实例不能超过50"
{
limit: "maxLength",
param: "50",
errInfo: "实例不能超过50"
},
],
'addServiceInfo.url':[
{
limit:"maxLength",
param:"200",
errInfo:"调用地址不能超过200"
'addServiceInfo.url': [
{
limit: "maxLength",
param: "200",
errInfo: "调用地址不能超过200"
},
],
'addServiceInfo.method':[
{
limit:"required",
param:"",
errInfo:"调用方式不能为空"
'addServiceInfo.method': [
{
limit: "required",
param: "",
errInfo: "调用方式不能为空"
},
{
limit:"maxLength",
param:"50",
errInfo:"调用方式不能超过50"
{
limit: "maxLength",
param: "50",
errInfo: "调用方式不能超过50"
},
],
'addServiceInfo.timeout':[
{
limit:"required",
param:"",
errInfo:"超时时间不能为空"
'addServiceInfo.timeout': [
{
limit: "required",
param: "",
errInfo: "超时时间不能为空"
},
{
limit:"num",
param:"",
errInfo:"超时时间必须为数字"
{
limit: "num",
param: "",
errInfo: "超时时间必须为数字"
},
],
'addServiceInfo.retryCount':[
{
limit:"required",
param:"",
errInfo:"重试次数不能为空"
'addServiceInfo.retryCount': [
{
limit: "required",
param: "",
errInfo: "重试次数不能为空"
},
{
limit:"num",
param:"",
errInfo:"重试次数必须为数字"
{
limit: "num",
param: "",
errInfo: "重试次数必须为数字"
},
],
'addServiceInfo.provideAppId':[
{
limit:"required",
param:"",
errInfo:"提供服务不能为空"
'addServiceInfo.provideAppId': [
{
limit: "required",
param: "",
errInfo: "提供服务不能为空"
},
{
limit:"num",
param:"",
errInfo:"重试次数必须为数字"
{
limit: "num",
param: "",
errInfo: "重试次数必须为数字"
},
],
@ -163,62 +163,62 @@ provideAppId:'8000418002',
});
},
saveServiceInfo:function(){
if(!vc.component.addServiceValidate()){
saveServiceInfo: function () {
if (!vc.component.addServiceValidate()) {
vc.toast(vc.validate.errInfo);
return ;
return;
}
//vc.component.addServiceInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if(vc.notNull($props.callBackListener)){
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addServiceInfo);
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addServiceInfo);
$('#addServiceModel').modal('hide');
return ;
return;
}
vc.http.post(
'addService',
'save',
JSON.stringify(vc.component.addServiceInfo),
{
emulateJSON:true
},
function(json,res){
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if(res.status == 200){
if (res.status == 200) {
//关闭model
$('#addServiceModel').modal('hide');
vc.component.clearAddServiceInfo();
vc.emit('serviceManage','listService',{});
vc.emit('serviceManage', 'listService', {});
return ;
return;
}
vc.toast(json);
},
function(errInfo,error){
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
});
},
clearAddServiceInfo:function(){
clearAddServiceInfo: function () {
vc.component.addServiceInfo = {
name:'',
serviceCode:'',
businessTypeCd:'API',
seq:'1',
messageQueueName:'',
isInstance:'Y',
url:'http://order-service/orderApi/service',
method:'',
timeout:'60',
retryCount:'3',
provideAppId:'8000418002',
name: '',
serviceCode: '',
businessTypeCd: 'API',
seq: '1',
messageQueueName: '',
isInstance: 'Y',
url: 'http://order-service/orderApi/service',
method: '',
timeout: '60',
retryCount: '3',
provideAppId: '8000418002',
};
};
}
}
});

View File

@ -33,13 +33,14 @@
<div class="col-sm-10">
<select class="custom-select" v-model="editServiceInfo.isInstance">
<option selected disabled value="">必填,请填写是否实例</option>
<option value="T">微服务处理</option>
<option value="Y"></option>
<option value="N"></option>
<option value="NT">透传</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="form-group row" >
<label class="col-sm-2 col-form-label">调用地址</label>
<div class="col-sm-10">
<input v-model="editServiceInfo.url" type="text" placeholder="选填,请填写调用地址"

View File

@ -9,8 +9,8 @@
businessTypeCd: 'API',
seq: '1',
messageQueueName: '',
isInstance: 'Y',
url: 'http://order-service/orderApi/service',
isInstance: 'T',
url: 'http://community-service',
method: '',
timeout: '60',
retryCount: '3',