Commit eb14d451 authored by 张俊's avatar 张俊

服务详情页

parent 0278c8e3
...@@ -17,7 +17,7 @@ import ace from "ace-builds"; ...@@ -17,7 +17,7 @@ import ace from "ace-builds";
import "ace-builds/webpack-resolver"; // 在 webpack 环境中使用必须要导入 import "ace-builds/webpack-resolver"; // 在 webpack 环境中使用必须要导入
import "ace-builds/src-noconflict/mode-json"; // 默认设置的语言模式 import "ace-builds/src-noconflict/mode-json"; // 默认设置的语言模式
export default { export default {
props: ["url"], props: ["url","datas"],
data() { data() {
return { return {
aceEditor: null, aceEditor: null,
...@@ -39,6 +39,9 @@ export default { ...@@ -39,6 +39,9 @@ export default {
if (this.url) { if (this.url) {
this.getValue(); this.getValue();
} }
if (this.datas) {
this.aceEditor.setValue(this.datas);
}
}, },
watch: {}, watch: {},
methods: { methods: {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<span class="right underline" v-if="data.yydetail" @click="subevent(2)" title="申请下线至开发者应用">申请下线</span> <span class="right underline" v-if="data.yydetail" @click="subevent(2)" title="申请下线至开发者应用">申请下线</span>
<span class="right undersell" v-if="data.yydetail" @click="subevent(3)">申请下架</span> <span class="right undersell" v-if="data.yydetail" @click="subevent(3)">申请下架</span>
<span class="right undersell undermy" v-if="data.bsdetail" @click="subevent(4)">申请密钥</span> <span class="right undersell undermy" v-if="data.bsdetail" @click="subevent(4)">申请密钥</span>
<span class="info_fix" v-if="data.fixed">我要修改</span> <span class="info_fix" v-if="data.fixed" @click="goto_page(data.fixedurl)">我要修改</span>
</p> </p>
<div class="info_detail"> <div class="info_detail">
<p> <p>
...@@ -63,6 +63,9 @@ export default { ...@@ -63,6 +63,9 @@ export default {
}else if(val == 4){ }else if(val == 4){
this.$emit('applymy',1) this.$emit('applymy',1)
} }
},
goto_page(url){
this.$router.push(url)
} }
}, },
}; };
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
default: "" default: ""
}, },
id: { id: {
type: String, type: [String,Number],
default: "" default: ""
}, },
name: { name: {
......
...@@ -32,7 +32,6 @@ export default { ...@@ -32,7 +32,6 @@ export default {
} }
}, },
item: { item: {
type: String,
default: "" default: ""
}, },
header: { header: {
...@@ -40,7 +39,7 @@ export default { ...@@ -40,7 +39,7 @@ export default {
default: "" default: ""
}, },
id: { id: {
type: String, type: [String,Number],
default: "" default: ""
}, },
name: { name: {
...@@ -61,7 +60,8 @@ export default { ...@@ -61,7 +60,8 @@ export default {
this.selectValue = this.item; this.selectValue = this.item;
if (this.selectValue == null || !this.selectValue || this.selectValue == "") { if (this.selectValue == null || !this.selectValue || this.selectValue == "") {
if (this.selectArr && this.selectArr.length != 0) { if (this.selectArr && this.selectArr.length != 0) {
this.selectValue = this.selectArr[0].value; this.selectValue = ""
// this.selectValue = this.selectArr[0].value;//去掉默认值
} else { } else {
this.selectValue = ""; this.selectValue = "";
} }
......
...@@ -653,6 +653,7 @@ export default { ...@@ -653,6 +653,7 @@ export default {
arr.forEach(item => { arr.forEach(item => {
newRow[item.prop] = "" newRow[item.prop] = ""
}) })
newRow.flag = true //新增标记
newRow.id = newRow.id =
parseInt(Math.random() * 100000, 10) + parseInt(Math.random() * 100000, 10) +
"" + "" +
......
...@@ -26,11 +26,10 @@ ...@@ -26,11 +26,10 @@
> >
<table-um <table-um
:headers="header_arr" :headers="header_arr"
:url="responseParamUrl" :datas="res_data"
:paginationShow="true"
slot="zd_table" slot="zd_table"
></table-um> ></table-um>
<v-apaas-code :url="codeExampleUrl" slot="zd_code"></v-apaas-code> <v-apaas-code :datas="code_arr" slot="zd_code"></v-apaas-code>
</info-list> </info-list>
<div v-show="now_service == 2"> <div v-show="now_service == 2">
<p class="service_title"><span></span>服务运行概况</p> <p class="service_title"><span></span>服务运行概况</p>
...@@ -89,16 +88,16 @@ ...@@ -89,16 +88,16 @@
<table-um <table-um
:stripe="true" :stripe="true"
:headers="service_size_arr" :headers="service_size_arr"
url="service_size_arr" :datas="service_size_data"
></table-um> ></table-um>
<p style="color: #8890a7;">购买方式:</p> <p style="color: #8890a7;">购买方式:</p>
<p style="color: #242c43;margin:10px 0px;">按月购买&按年购买</p> <p style="color: #242c43;margin:10px 0px;">{{buy_type==1?'按月购买':buy_type==2?'按年购买':'按月购买&按年购买'}}</p>
<div class="editbtn" v-if="now_user == 1">编辑</div> <div class="editbtn" v-if="now_user == 1" @click="sizeset_flag=true">编辑</div>
<p v-if="now_user == 1" style="color: #8890a7;margin-bottom:10px;"> <p v-if="now_user == 1&&sizeset_flag" style="color: #8890a7;margin-bottom:10px;">
规格设置: 规格设置:
</p> </p>
<table-um <table-um
v-if="now_user == 1" v-if="now_user == 1&&sizeset_flag"
:headers="edit_size_arr" :headers="edit_size_arr"
headerCellClassName="th_pink" headerCellClassName="th_pink"
:border="true" :border="true"
...@@ -106,27 +105,28 @@ ...@@ -106,27 +105,28 @@
:couldNotEdit="false" :couldNotEdit="false"
:radius="true" :radius="true"
:isIndex="true" :isIndex="true"
url="service_size_arr" :datas="service_size_data"
@changeTable="now_size_data"
> >
</table-um> </table-um>
<p v-if="now_user == 1" style="color: #8890a7;margin:10px 0;"> <p v-if="now_user == 1&&sizeset_flag" style="color: #8890a7;margin:10px 0;">
购买方式: 购买方式:
</p> </p>
<el-button <el-button
v-if="now_user == 1" v-if="now_user == 1&&sizeset_flag"
:type="buy_style == 0 ? 'primary' : ''" :type="buy_style == 1 ? 'primary' : ''"
@click="buy_style = 0" @click="buy_style = 1"
>按月购买</el-button >按月购买</el-button
> >
<el-button <el-button
v-if="now_user == 1" v-if="now_user == 1&&sizeset_flag"
:type="buy_style == 1 ? 'primary' : ''" :type="buy_style == 2 ? 'primary' : ''"
@click="buy_style = 1" @click="buy_style = 2"
>按年购买</el-button >按年购买</el-button
> >
<div class="savebtn" v-if="now_user == 1"> <div class="savebtn" v-if="now_user == 1&&sizeset_flag">
<el-button>保存</el-button> <el-button @click="change_service_size">保存</el-button>
<el-button>取消</el-button> <el-button @click="sizeset_flag=false">取消</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -145,7 +145,7 @@ import exampleIcon from "@/pages/example/example_icon"; ...@@ -145,7 +145,7 @@ import exampleIcon from "@/pages/example/example_icon";
import Topology from "@/components/topology.vue"; import Topology from "@/components/topology.vue";
import serviceHeader from "@/components/service-header"; import serviceHeader from "@/components/service-header";
import dialogAction from "@/components/dialog-action"; import dialogAction from "@/components/dialog-action";
import { getRole } from "@/utils/common"; import { getRole,formatDateTime_date } from "@/utils/common";
export default { export default {
components: { components: {
infoList, infoList,
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
data() { data() {
return { return {
now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员 now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员
buy_style: 0, buy_style: 1,
responseParamUrl: "", responseParamUrl: "",
codeExampleUrl: "", codeExampleUrl: "",
yx_state: { yx_state: {
...@@ -171,11 +171,16 @@ export default { ...@@ -171,11 +171,16 @@ export default {
maxTraffic: "", maxTraffic: "",
memory: "", memory: "",
}, },
res_data:[],//响应参数
buy_type:'',
sizeset_flag:false,//规格设置是否显示
code_arr:'',
service_arr: [ service_arr: [
["服务基本信息", "接口详细信息", "服务运行状态"], ["服务基本信息", "接口详细信息", "服务运行状态"],
["服务基本信息", "接口详细信息", "服务运行状态", "服务计费规则"], ["服务基本信息", "接口详细信息", "服务运行状态", "服务计费规则"],
["服务基本信息", "接口详细信息", "服务运行状态", "服务规格"], ["服务基本信息", "接口详细信息", "服务运行状态", "服务规格"],
], ],
service_size_data:[],//服务规格数组
service_header_arr: { service_header_arr: {
url:'', url:'',
name: "", name: "",
...@@ -204,36 +209,37 @@ export default { ...@@ -204,36 +209,37 @@ export default {
} }
], ],
fixed: true, fixed: true,
fixedurl:''
}, },
now_service: 0, now_service: 0,
datas: {}, datas: {},
header_arr: [ header_arr: [
{ {
prop: "zdmc", prop: "name",
label: "字段名称", label: "字段名称",
minWidth: "20%", minWidth: "20%",
align: "left", align: "left",
}, },
{ {
prop: "zdbm", prop: "field_type",
label: "字段编码", label: "字段编码",
width: "100px", width: "100px",
align: "center", align: "center",
}, },
{ {
prop: "zdlx", prop: "show_type",
label: "字段类型", label: "字段类型",
width: "100px", width: "100px",
align: "center", align: "center",
}, },
{ {
prop: "zdsm", prop: "descript",
label: "字段说明", label: "字段说明",
minWidth: "30%", minWidth: "30%",
align: "left", align: "left",
}, },
{ {
prop: "zdsl", prop: "example",
label: "字段示例数值", label: "字段示例数值",
width: "120px", width: "120px",
align: "left", align: "left",
...@@ -279,19 +285,19 @@ export default { ...@@ -279,19 +285,19 @@ export default {
], ],
service_size_arr: [ service_size_arr: [
{ {
prop: "fwcs", prop: "count",
label: "访问次数(次/日)", label: "访问次数(次/日)",
minWidth: "33.33%", minWidth: "33.33%",
align: "center", align: "center",
}, },
{ {
prop: "fwl", prop: "pv",
label: "访问量(PV/日)", label: "访问量(PV/日)",
minWidth: "33.33%", minWidth: "33.33%",
align: "center", align: "center",
}, },
{ {
prop: "ggsm", prop: "des",
label: "规格说明", label: "规格说明",
minWidth: "33.33%", minWidth: "33.33%",
align: "left", align: "left",
...@@ -299,137 +305,137 @@ export default { ...@@ -299,137 +305,137 @@ export default {
], ],
edit_size_arr: [ edit_size_arr: [
{ {
prop: "fwcs", prop: "count",
label: "访问次数(次/日)", label: "访问次数(次/日)",
minWidth: "33.33%", minWidth: "33.33%",
align: "center", align: "center",
type: "select", type: "select",
selectArr: [ selectArr: [
{ {
label: 10, label: '10',
value: 10, value: 10,
}, },
{ {
label: 20, label: '20',
value: 20, value: 20,
}, },
{ {
label: 30, label: '30',
value: 30, value: 30,
}, },
{ {
label: 40, label: '40',
value: 40, value: 40,
}, },
{ {
label: 50, label: '50',
value: 50, value: 50,
}, },
{ {
label: 60, label: '60',
value: 60, value: 60,
}, },
{ {
label: 70, label: '70',
value: 70, value: 70,
}, },
{ {
label: 80, label: '80',
value: 80, value: 80,
}, },
{ {
label: 90, label: '90',
value: 90, value: 90,
}, },
{ {
label: 100, label: '100',
value: 100, value: 100,
}, },
{ {
label: 200, label: '200',
value: 200, value: 200,
}, },
{ {
label: 300, label: '300',
value: 300, value: 300,
}, },
{ {
label: 400, label: '400',
value: 400, value: 400,
}, },
{ {
label: 500, label: '500',
value: 500, value: 500,
}, },
], ],
}, },
{ {
prop: "fwl", prop: "pv",
label: "访问量(PV/日)", label: "访问量(PV/日)",
minWidth: "33.33%", minWidth: "33.33%",
align: "center", align: "center",
type: "select", type: "select",
selectArr: [ selectArr: [
{ {
label: 100, label: '100',
value: 100, value: 100,
}, },
{ {
label: 200, label: '200',
value: 200, value: 200,
}, },
{ {
label: 300, label: '300',
value: 300, value: 300,
}, },
{ {
label: 400, label: '400',
value: 400, value: 400,
}, },
{ {
label: 500, label: '500',
value: 500, value: 500,
}, },
{ {
label: 600, label: '600',
value: 600, value: 600,
}, },
{ {
label: 700, label: '700',
value: 700, value: 700,
}, },
{ {
label: 800, label: '800',
value: 800, value: 800,
}, },
{ {
label: 900, label: '900',
value: 900, value: 900,
}, },
{ {
label: 1000, label: '1000',
value: 1000, value: 1000,
}, },
{ {
label: 2000, label: '2000',
value: 2000, value: 2000,
}, },
{ {
label: 3000, label: '3000',
value: 3000, value: 3000,
}, },
{ {
label: 4000, label: '4000',
value: 4000, value: 4000,
}, },
{ {
label: 5000, label: '5000',
value: 5000, value: 5000,
}, },
], ],
}, },
{ {
prop: "ggsm", prop: "des",
label: "规格说明", label: "规格说明",
minWidth: "33.33%", minWidth: "33.33%",
align: "left", align: "left",
...@@ -449,6 +455,7 @@ export default { ...@@ -449,6 +455,7 @@ export default {
], ],
}, },
], ],
size_arr_down:[],
servicead_arr: [ servicead_arr: [
{ {
title: "请求方式:", title: "请求方式:",
...@@ -479,6 +486,11 @@ export default { ...@@ -479,6 +486,11 @@ export default {
solt_name: "zd_code", solt_name: "zd_code",
}, },
], ],
service_type_arr:['数据服务','时空服务','视频服务','感知服务','综合服务'],
scrvice_area_arr:['经济建设','城市建设','道路交通','环境资源','服务民生','空间地理','文化休闲','社会团体','教育机构','其他'],
open_arr:['共享','受限','敏感'],
service_state_arr:['已下架','上架中'],
request_arr:['GET','POST','PUT','DELETE'],
list_arr: [ list_arr: [
{ {
"title": "服务描述:", "title": "服务描述:",
...@@ -520,8 +532,6 @@ export default { ...@@ -520,8 +532,6 @@ export default {
this.now_user = data; this.now_user = data;
this.$store.commit("rolefun", data); this.$store.commit("rolefun", data);
this.getServiceInfo(); this.getServiceInfo();
this.getInterfaceInfo();
this.getServiceBaseInfo();
this.getServiceyxztInfo(); this.getServiceyxztInfo();
}); });
}, },
...@@ -538,70 +548,83 @@ export default { ...@@ -538,70 +548,83 @@ export default {
}, },
getServiceInfo() { getServiceInfo() {
this.$http this.$http
.get("/apaas/service/v3/service/manager?service_id=10") .get("/apaas/service/v3/service/manager?service_id="+this.$route.params.id)
.then((response) => { .then((response) => {
let data = response.data.data; let data = response.data.data;
console.log(data); console.log(data);
this.$set(this.service_header_arr, "name", data.name); this.$set(this.service_header_arr, "name", data.name);
this.$set(this.service_header_arr['first'][0], 'text', data.data_service_type1); this.$set(this.service_header_arr['first'][0], 'text', this.service_type_arr[data.data_service_type1-1]);
this.$set(this.service_header_arr['first'][1], 'text', data.apply_num); this.$set(this.service_header_arr['first'][1], 'text', data.apply_num);
this.$set(this.service_header_arr['first'][2], 'text', data.request_count); this.$set(this.service_header_arr['first'][2], 'text', data.request_count);
this.$set(this.service_header_arr['first'][3], 'text', data.state); this.$set(this.service_header_arr['first'][3], 'text', this.service_state_arr[data.state]);
this.$set(this.service_header_arr['second'][0], "text", data.req_url); this.$set(this.service_header_arr['second'][0], "text", data.req_url);
this.$set(this.service_header_arr, "url", data.cover); this.$set(this.service_header_arr, "url", data.cover);
this.$set(this.service_header_arr, "fixedurl", this.$route.path.replace('servicedetail','serviceedit'));
this.$set(this.list_arr[0], "info", data.descript); this.$set(this.list_arr[0], "info", data.descript);
this.$set(this.list_arr[1], "info", data.sectors); this.$set(this.list_arr[1], "info", this.scrvice_area_arr[data.sectors-1]);
this.$set(this.list_arr[2], "info", data.organization); this.$set(this.list_arr[2], "info", data.organization);
this.$set(this.list_arr[3], "info", data.data_service_type3); this.$set(this.list_arr[3], "info", data.openness_name);
this.$set(this.list_arr[4], "info", data.encode_method); this.$set(this.list_arr[4], "info", data.encode_method);
this.$set(this.list_arr[5], "info", data.create_time); this.$set(this.list_arr[5], "info", data.create_time.replace('T'," ").split('+')[0]);
this.$set(this.servicead_arr[0], "info", data.req_type); this.$set(this.servicead_arr[0], "info", this.request_arr[data.req_type-1]);
this.$set(this.servicead_arr[1], "info", data.req_query); this.$set(this.servicead_arr[1], "info", data.req_query?data.req_query:'');
this.$set(this.servicead_arr[2], "info", data.create_time); this.$set(this.servicead_arr[2], "info", data.req_fields);
this.$set(this.servicead_arr[3], "info", data.create_time); this.$set(this.servicead_arr[3], "info", data.encode_method);
this.code_arr = data.res_fields
this.res_data = JSON.parse(data.res_fields)
this.service_size_data = data.request_spcs_info
this.size_arr_down = data.request_spcs_info
this.buy_type = data.request_spcs_info[0].type
}) })
.catch(function(response) {}); .catch(function(response) {});
}, },
getInterfaceInfo() { now_size_data(val){
console.log(val);
this.size_arr_down = val
},
getsize_arr(){
this.$http this.$http
.get("/static/servicedetail1.json") .get("/apaas/service/v3/service/manager/request/spcs/list?service_id="+this.$route.params.id)
.then((response) => { .then((response) => {
let data = response.data.data; let data = response.data.data;
this.$set( console.log(data);
this.servicead_arr[0], this.service_size_data = data.data
"info", this.buy_type = data.data[0].type
data.serviceinterfaceinfo.type
);
this.$set(
this.servicead_arr[1],
"info",
data.serviceinterfaceinfo.requestParam
);
this.$set(
this.servicead_arr[2],
"info",
data.serviceinterfaceinfo.example
);
this.$set(
this.servicead_arr[3],
"info",
data.serviceinterfaceinfo.format
);
this.responseParamUrl = data.serviceinterfaceinfo.responseParamUrl;
this.codeExampleUrl = data.serviceinterfaceinfo.codeExampleUrl;
}) })
.catch(function(response) {}); .catch(function(response) {});
}, },
getServiceBaseInfo() { change_service_size(){
let temp = []
this.size_arr_down.forEach(e => {
if(e.pv&&e.count){
if(e.flag){
e.id = 0
}
e.type = this.buy_style
delete e.undefined
delete e.flag
temp.push(e)
}
});
this.$http this.$http
.get("/static/servicedetail1.json") .post("/apaas/service/v3/service/manager/request/spcs/save",{
service_id:parseInt(this.$route.params.id),
data:temp
})
.then((response) => { .then((response) => {
let data = response.data.data; console.log(response);
this.list_arr = data.servicebaseinfo; if(response.data.success){
this.$message.success('保存成功')
this.sizeset_flag = false
this.getsize_arr()
}else{
this.$message.success('保存失败')
}
}) })
.catch(function(response) {});
}, },
getServiceyxztInfo() { getServiceyxztInfo() {
this.$http this.$http
.get("/static/servicedetail1.json") .get("/static/servicedetail1.json")
......
function getRole(){ function getRole(){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
if(true){ if(true){
resolve(2) resolve(1)
}else{ }else{
reject('error') reject('error')
} }
}) })
} }
//时间戳转时间格式
var formatDateTime_date = function (date) {
debugger
var y = date.getFullYear();
var M = date.getMonth() + 1;
M = M < 10 ? ('0' + M) : M;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var m = date.getMinutes();
m = m < 10 ? ('0' + m) : m;
var s = date.getSeconds();
s = s < 10 ? ('0' + s) : s;
return y + '-' + M + '-' + d+' '+h + ':' + m + ':' + s;
};
export{ export{
getRole getRole,
formatDateTime_date
} }
\ No newline at end of file
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