Commit eb14d451 authored by 张俊's avatar 张俊

服务详情页

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