Commit fdd9d524 authored by 赵伟庚's avatar 赵伟庚

update:废弃setup()写法替换为<script setup>

parent 2436494d
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
<div class="filter-group" v-if="showFlag"> <div class="filter-group" v-if="showFlag">
<slot name="filter_group"></slot> <slot name="filter_group"></slot>
</div> </div>
</div> </div>
</template> </template>
......
...@@ -15,54 +15,48 @@ ...@@ -15,54 +15,48 @@
</div> </div>
</template> </template>
<script> <script setup>
export default { const props = defineProps({
name: "pagination", small: {
props: { type: Boolean,
small: { default: () => false
type: Boolean,
default: () => false
},
page: {
type: Number,
default: 1
},
size: {
type: Number,
default: 10,
},
pageSizes: {
type: Array,
default: [10,50,100]
},
total: {
type: Number,
default: 0
},
layout: {
type: String,
default: "total, sizes, prev, pager, next, jumper"
},
background: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
}, },
setup(props, context) { page: {
const changePage = (val) => { type: Number,
context.emit("change-page",val) default: 1
}
const changeSize = (val) => {
context.emit("change-size",val)
}
return {
changePage,
changeSize
}
}, },
size: {
type: Number,
default: 10,
},
pageSizes: {
type: Array,
default: [10,50,100]
},
total: {
type: Number,
default: 0
},
layout: {
type: String,
default: "total, sizes, prev, pager, next, jumper"
},
background: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['change-page','change-size'])
const changePage = (val) => {
emit("change-page",val)
}
const changeSize = (val) => {
emit("change-size",val)
} }
</script> </script>
<template> <template>
<div style="border: 1px solid #ccc;z-index: 100;"> <div style="border: 1px solid #ccc;z-index: 100;">
<Toolbar <Toolbar
style="border-bottom: 1px solid #ccc" style="border-bottom: 1px solid #ccc"
:editor="editorRef" :editor="editorRef"
:defaultConfig="toolbarConfig" :defaultConfig="toolbarConfig"
:mode="mode" :mode="mode"
/> />
<Editor <Editor
style="height: 500px; overflow-y: hidden;" style="height: 500px; overflow-y: hidden;"
v-model="valueHtml" v-model="valueHtml"
@onChange="handleChange" @onChange="handleChange"
@onBlur="handleBlur" @onBlur="handleBlur"
:defaultConfig="editorConfig" :defaultConfig="editorConfig"
:mode="mode" :mode="mode"
@onCreated="handleCreated" @onCreated="handleCreated"
/> />
</div> </div>
</template> </template>
<script> <script setup>
import '@wangeditor/editor/dist/css/style.css' // 引入 css import '@wangeditor/editor/dist/css/style.css' // 引入 css
import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue' import { onBeforeUnmount, ref, shallowRef, onMounted, watch } from 'vue'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue' import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { import {
useFormItem, useFormItem,
} from 'element-plus' } from 'element-plus'
const props = defineProps({
export default { modelValue: {
components: { Editor, Toolbar }, type: String,
props: { default: '',
modelValue: {
type: String,
default: '',
},
disabled:{
type:Boolean,
default:false
}
}, },
emits: ['update:modelValue','change','blur'], disabled:{
watch:{ type:Boolean,
modelValue(n,o){ default:false
this.valueHtml = n
}
}, },
setup(props,{ emit }) { mode: {
//引入form-item type: String,
const { formItem } = useFormItem() default: 'default'
// 编辑器实例,必须用 shallowRef }
const editorRef = shallowRef() })
// 内容 HTML
const valueHtml = ref('')
// 模拟 ajax 异步获取内容
onMounted(() => {
setTimeout(()=>{
valueHtml.value = props.modelValue
// console.log(valueHtml.value);
})
})
const toolbarConfig = {} const emit = defineEmits(['update:modelValue','change','blur'])
const editorConfig = { placeholder: '请输入内容...' }
// watch( const valueHtml = ref('')
// props,modelValue,
// (n,o) => {
// }
// )
// 组件销毁时,也及时销毁编辑器 const { formItem } = useFormItem()
onBeforeUnmount(() => {
const editor = editorRef.value
if (editor == null) return
editor.destroy()
})
const handleCreated = (editor) => { const editorRef = shallowRef()
editorRef.value = editor // 记录 editor 实例,重要!
if(props.disabled){
editor.disable()
}
}
const handleChange = ()=>{ onMounted(() => {
emit("update:modelValue", valueHtml.value); setTimeout(()=>{
// formItem?.validate?.('change').catch((err) => debugWarn(err)) valueHtml.value = props.modelValue
} })
})
const handleBlur = ()=>{ const toolbarConfig = {}
formItem?.validate?.('blur').catch((err) => console.warn(err)) const editorConfig = { placeholder: '请输入内容...' }
}
return { onBeforeUnmount(() => {
editorRef, const editor = editorRef.value
valueHtml, if (editor == null) return
mode: 'default', // 或 'simple' editor.destroy()
toolbarConfig, })
editorConfig, const handleCreated = (editor) => {
handleCreated, editorRef.value = editor // 记录 editor 实例,重要!
handleChange, if(props.disabled){
handleBlur, editor.disable()
};
} }
} }
const handleChange = ()=>{
emit("update:modelValue", valueHtml.value);
}
const handleBlur = ()=>{
formItem?.validate?.('blur').catch((err) => console.warn(err))
}
watch(
() => props.modelValue,
(n,o) => {
valueHtml.value = n
}
)
</script> </script>
\ No newline at end of file
<template> <template>
<el-table <el-table
:height="height"
ref="table" ref="table"
class="bg-table" class="bg-table"
:data="rows" :data="rows"
...@@ -31,10 +32,10 @@ ...@@ -31,10 +32,10 @@
<!-- checkbox --> <!-- checkbox -->
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="isIndex" v-if="isIndex"
type="index" type="index"
:label="indexLabel" :label="indexLabel"
width="54" width="54"
align="left" align="left"
> >
<!-- 序号 --> <!-- 序号 -->
...@@ -66,148 +67,134 @@ ...@@ -66,148 +67,134 @@
</el-table> </el-table>
</template> </template>
<script> <script setup>
import { watch, ref, } from 'vue'
import { selectTableMixin } from './hook/mixin-select-table' import { selectTableMixin } from './hook/mixin-select-table'
export default { let {
name: "BgTable", nowSelectData,
setup() { allSelectData,
const { selectData,
nowSelectData, initSelectTableData,
allSelectData, runPage,
selectData, dealSelectData
initSelectTableData, } = selectTableMixin()
runPage,
dealSelectData
} = selectTableMixin()
return { const props = defineProps({
nowSelectData, height: {
allSelectData, type: [Number, String],
selectData, default: 'auto'
initSelectTableData,
runPage,
dealSelectData
}
}, },
props: { headers: {
headers: { type: Array,
type: Array, require: true,
require: true,
},
rows: {
type: Array,
default: () => [],
},
select: {
type: Boolean,
default: false,
},
// selectable: {
// type: Function,
// },
isIndex: {
type: Boolean,
default: false
},
indexLabel: {
type: String,
default: "序号"
},
stripe: {
type: Boolean,
default: false
},
paddingLeft: {
type: [Number, String],
default: () => 12,
},
canEdit: {
type: Boolean,
default: false
}, // 多选框是否禁用
canEditFlag: {
typr : Boolean,
default: ""
}, // 决定多选框是否禁用的字段
}, },
/* filters: { rows: {
ellipsis(value, max) { type: Array,
if (!value) { default: () => [],
return ""; },
} else if (max && value.length > max) { select: {
return value.slice(0, max - 1) + "..."; type: Boolean,
} else { default: false,
return value; },
} // selectable: {
}, // type: Function,
}, */ // },
watch:{ isIndex: {
rows(n,o){ type: Boolean,
if(n.length&&this.select){ default: false
this.runPage() },
this.initSelectTableData(n).then((selectData)=>{ indexLabel: {
if(selectData.length){ type: String,
setTimeout(()=>{ default: "序号"
this.toggleRowArrSelection(selectData) },
}) stripe: {
} type: Boolean,
}) default: false
}
}
}, },
created(){ paddingLeft: {
console.log(this.$attrs) type: [Number, String],
default: () => 12,
}, },
methods: { canEdit: {
toggleRowSelection(row, flag = true) { type: Boolean,
this.$refs.table.toggleRowSelection(row, flag); default: false
}, }, // 多选框是否禁用
selectAction(selection) { canEditFlag: {
this.$emit("selectAc", {allLength:Object.keys(this.allSelectData).length+this.nowSelectData.length,selection}); typr : Boolean,
}, default: ""
clearSelection() { }, // 决定多选框是否禁用的字段
this.$refs.table.clearSelection(); })
this.$emit("select", {allLength:Object.keys(this.allSelectData).length+this.nowSelectData.length,selection:[]});
}, const table = ref(null)
setSelectedRow(row) {
this.$refs.table.toggleRowSelection(row); const emit = defineEmits(['selectAc','select'])
}, watch(
toggleRowArrSelection(arr, flag = true){ () => props.rows,
arr.forEach(e => { (n,o) => {
this.$refs.table.toggleRowSelection(e, flag); if (n.length && props.select) {
}); runPage()
}, initSelectTableData(n).then((selectData)=>{
selectActionRow(selection,row){ if(selectData.length){
this.selectData(selection) setTimeout(()=>{
this.$emit("select", {allLength:Object.keys(this.allSelectData).length+this.nowSelectData.length,selection}); toggleRowArrSelection(selectData)
}, })
selectActionAll(selection){
this.selectData(selection)
this.$emit("select", {allLength:Object.keys(this.allSelectData).length+this.nowSelectData.length,selection});
},
clearTable(){//清除选中数据,在页面状态更新时使用
this.allSelectData={}
this.nowSelectData=[]
this.clearSelection();
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 0) {
return "white-row";
} else {
return "stripe-row";
}
},
selectable(row,index) {
if (this.canEdit) {
if (row[this.canEditFlag] && row[this.canEditFlag] == 1) {
return false
}else {
return true
} }
}else { })
return true
}
} }
}, }
}; )
const toggleRowSelection = (row, flag = true) => {
table.value.toggleRowSelection(row, flag);
}
const selectAction = (selection) => {
emit("selectAc", {allLength:Object.keys(allSelectData).length+nowSelectData.length,selection});
}
const clearSelection = () => {
table.value.clearSelection();
emit("select", {allLength:Object.keys(allSelectData).length+nowSelectData.length,selection:[]});
}
const setSelectedRow = (row) => {
toggleRowSelection(row);
}
const toggleRowArrSelection = (arr, flag = true) => {
arr.forEach(e => {
toggleRowSelection(e, flag);
});
}
const selectActionRow = (selection,row) => {
selectData(selection)
emit("select", {allLength:Object.keys(allSelectData).length+nowSelectData.length,selection});
}
const selectActionAll = (selection) => {
selectData(selection)
emit("select", {allLength:Object.keys(allSelectData).length+nowSelectData.length,selection});
}
const clearTable = () => {//清除选中数据,在页面状态更新时使用
allSelectData={}
nowSelectData=[]
clearSelection();
}
const tableRowClassName = ({ row, rowIndex }) => {
if (rowIndex % 2 == 0) {
return "white-row";
} else {
return "stripe-row";
}
}
const selectable = (row,index) => {
if (props.canEdit) {
if (row[props.canEditFlag] && row[props.canEditFlag] == 1) {
return false
}else {
return true
}
}else {
return true
}
}
defineExpose({
clearTable,
toggleRowSelection,
})
</script> </script>
<template>
<div class="base-info" v-if="data">
<div class="info-icon" v-if="data.ability_logo">
<img :src="data.ability_logo" />
</div>
<div class="info-detail">
<h3>
<span>{{ data.ability_name }}</span>
<span class="openness" v-if="data.openness_name != ''">{{ data.openness_name }}</span>
</h3>
<p>{{ data.synopsis }}</p>
<ul>
<li class="text-clip">
<bg-icon icon="#bg-ic-layers" />
<span>业务类型:</span>
<span>{{ data.business_type_name }}</span>
</li>
<li class="text-clip">
<bg-icon icon="#bg-ic-user" />
<span>联系人:&emsp;</span>
<span>{{ data.contact_person }}</span>
</li>
<li class="text-clip">
<bg-icon icon="#bg-ic-time" />
<span>发布时间:&emsp;&emsp;</span>
<span>{{ data.created_time }}</span>
</li>
<li class="text-clip">
<bg-icon icon="#bg-ic-layout-4" />
<span>业务领域:</span>
<span>{{ data.sectors_name }}</span>
</li>
<li class="text-clip">
<bg-icon icon="#bg-ic-phone-call" />
<span>联系电话:</span>
<span>{{ data.contact_phone }}</span>
</li>
<li class="text-clip">
<bg-icon icon="#bg-ic-time" />
<span>最后更新时间:</span>
<span>{{ data.updated_time }}</span>
</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "BaseInfo",
props: {
data: {
type: Object,
default: () => null,
},
},
};
</script>
<style lang="scss" scoped>
.base-info {
padding: 24px;
background-color: #fff;
box-shadow: 0px 1px 4px 0px rgba(0, 7, 101, 0.15);
border-radius: 6px;
margin-bottom: 16px;
display: flex;
justify-content: flex-start;
align-items: flex-start;
> .info-icon {
flex: 0 0 144px;
height: 144px;
background-color: #f5f6fa;
border-radius: 4px;
overflow: hidden;
margin-right: 24px;
> img {
width: 100%;
height: 100%;
}
}
> .info-detail {
flex: 1;
> h3 {
font-weight: bold;
font-size: 16px;
line-height: 32px;
color: #202531;
.openness {
margin-left: 10px;
display: inline-block;
border: 1px solid #9ad5c8;
background-color: #f1f9f7;
border-radius: 3px;
font-size: 12px;
line-height: 1;
padding: 3px 6px;
color: #429e8a;
font-weight: normal;
}
}
> p {
font-size: 14px;
line-height: 20px;
color: #202531;
}
> ul {
padding: 16px;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
background-color: #f5f6fa;
border-radius: 4px;
overflow: hidden;
margin-top: 16px;
> li {
width: 30%;
margin-right: 16px;
> .bg-icon {
margin-right: 8px;
}
> span {
font-size: 14px;
line-height: 34px;
color: #616f94;
> :nth-child(2) {
color: #202531;
}
}
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="folder-info">
<div class="left-part" :class="include_mock_service? '' : 'padding-reset'">
<bg-btns v-model="type" :options="types" v-if="!mockDetail && include_mock_service" />
<el-tree
:data="data"
node-key="code"
default-expand-all
@node-click="handleNodeClick"
>
<template #default="{ data }">
<div class="custom-tree-node" pointer-events="none">
<template v-if="data.node_type === 0">
<bg-icon
icon="#bg-ic-s-folder-opened"
v-if="fileOpenState[data.code] !== false"
/>
<bg-icon icon="#bg-ic-s-folder" v-else />
</template>
<template v-else>
<el-tooltip
effect="dark"
:content="testStateTexts[data.test_state]"
placement="top"
>
<bg-icon
v-if="data.service_type != 'cda56bb2-d00d-436d-9fc2-0508737fe503'"
:class="`state-${data.test_state}`"
:icon="testStateIcons[data.test_state]"
/>
</el-tooltip>
</template>
<span :style="data.service_type != 'cda56bb2-d00d-436d-9fc2-0508737fe503' ? {} : { marginLeft: '20px' }">{{ data.node_name }}</span>
</div>
</template>
</el-tree>
</div>
<div class="right-part" v-if="nodeDetail">
<folder
class="folder-detail"
:data="nodeDetail"
:disabled="true"
v-if="nodeDetail.node_type == 0"
:showTip="false"
/>
<file :data="nodeDetail" :disabled="true" :detailMock="type == 'configMock' && !mockDetail" v-else />
</div>
</div>
</template>
<script>
import { reactive, toRefs, watch, onBeforeMount } from "vue";
import Folder from "@/page/main/ability-register/step2/folder.vue";
import File from "@/page/main/ability-register/step2/file/index.vue";
import axios from "@/request/http.js";
export default {
name: "BaseInfo",
components: { Folder, File },
props: {
id: {
type: String,
required: true,
},
// 是否为mock服务详情
mockDetail: {
type: Boolean,
default: false
}
},
setup(props) {
const state = reactive({
type: "",
data: [],
types: [
{
name: "真实能力",
value: "",
},
{
name: "mock能力",
value: "configMock",
},
],
fileOpenState: {},
nodeDetail: null,
testStateTexts: [
"未测试",
"测试成功",
"测试失败",
"其中有服务未测试",
"其中有服务测试未通过",
],
testStateIcons: [
"#bg-ic-s-circle-warning",
"#bg-ic-s-circle-check",
"#bg-ic-s-circle-close",
"#bg-ic-s-circle-question",
"#bg-ic-s-circle-question",
],
include_mock_service: false, // 真实能力中是否配置mock服务
});
const getTreeData = () => {
state.data = [];
state.nodeDetail = null;
axios
.get(`/apaas/service/v5/ability/info`, {
params: {
id: props.id,
queryType: props.mockDetail ? "" : state.type,
},
})
.then(({ data }) => {
if (data.code == 200) {
state.data = data.data.folder;
state.include_mock_service = data.data.ability_info.include_mock_service || false
console.log(state.include_mock_service)
}
});
};
const handleNodeClick = (data) => {
state.nodeDetail = null;
if (data.children) {
let flag = state.fileOpenState[data.code] !== false;
state.fileOpenState[data.code] = !flag;
}
if (data.node_type === 0) {
setTimeout(() => {
state.nodeDetail = { ...data, children: undefined };
}, 50);
} else {
axios
.get(`/apaas/service/v5/service/detail?treeCode=${data.code}`)
.then(({ data }) => {
if (data.code == 200) {
state.nodeDetail = data.data;
}
});
}
};
watch(
() => state.type,
() => {
getTreeData();
}
);
onBeforeMount(() => {
// 如果是mock能力详情,给type赋值后会触发watch然后去获取树形 所以不需要初始化时请求该接口
if (props.mockDetail) {
state.type = "configMock"
}else {
getTreeData();
}
});
return {
...toRefs(state),
handleNodeClick,
};
},
};
</script>
<style lang="scss" scoped>
.folder-info {
display: flex;
justify-content: flex-start;
align-items: stretch;
overflow: hidden;
> .left-part {
flex: 0 0 281px;
padding: 24px 0;
border-right: 1px solid #ebedf2;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
> .bg-btns {
margin: 0 auto;
}
> .el-tree {
width: 100%;
margin-top: 16px;
:deep() {
.el-icon.el-tree-node__expand-icon {
display: none;
}
}
}
}
> .padding-reset {
padding: 8px 0 24px;
}
> .right-part {
// flex: 1 1 calc(100% - 281px);
flex: 1;
// padding: 16px;
box-sizing: border-box;
.folder-detail {
width: 100%;
margin: 0;
display: flex;
:deep() {
.left-span {
width: 80px;
padding-top: 68px !important;
}
.right-container {
padding: 12px 0;
// float: none;
// width: 100%;
// .tips {
// display: none;
// }
}
}
}
}
}
.custom-tree-node {
padding: 0 16px;
> .bg-icon {
font-size: 12px;
margin-right: 8px;
&.state-0 {
color: #dd6955;
}
&.state-1 {
color: #48ad97;
}
&.state-2 {
color: #dd6955;
}
&.state-3 {
color: #dd6955;
}
&.state-4 {
color: #dd6955;
}
}
}
</style>
\ No newline at end of file
<!-- grpc -->
<template>
<!-- 去掉操作 -->
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
dialogClose()
}"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="dialogClose">取 消</el-button>
<el-button type="primary" @click="dialogClose">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const emit = defineEmits(["dialogClose"])
const router = useRouter()
const route = useRoute()
const state = reactive({data1:1})
const {data1} = toRefs(state)
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 112
},
{
name: "调用地址",
value: "",
nameWidth: 112
},
{
name: "是否TLS协议",
value: "",
full: true,
nameWidth: 112
},
], // 基本信息
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.req_url
detailData.apiBaseInfo[2].value = ['',''][detail.tls_protocol]
}
const serviceTest = () => {
let params = {
interface_type: 2,
url: detail.req_url,
id: detail.id.toString()
}
$axios
.post(`/apaas/service/v5/service/test`,params)
.then((res) => {
if (res.data.code !== 200) {
$message.error(res.data.data)
} else {
detailData.showDialog = true
if (res.data.data.response_code == 200) {
detailData.dialogInfo = {
msg: "该服务地址正常",
state: true
}
}else {
detailData.dialogInfo = {
msg: "该服务地址异常",
state: false
}
}
}
})
}
const dialogClose = () => {
detailData.showDialog = false
emit("refresh",detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<!-- mobileSDK -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const router = useRouter()
const route = useRoute()
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
full: true,
nameWidth: 104
},
{
name: "支持类型",
value: "",
nameWidth: 104,
},
{
name: "支持系统",
value: "",
nameWidth: 104,
},
{
name: "SDK包",
value: "",
nameWidth: 104,
download: true,
url: ""
},
{
name: "SDK版本号",
value: "",
nameWidth: 104,
},
{
name: "承诺书",
value: "",
full: true,
nameWidth: 104,
download: true,
url: ""
},
], // 基本信息
detail_data: {},
res_body_open: true,
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
let sdkFile = detail.msdk_file ? JSON.parse(detail.msdk_file) : []
let commitment = detail.commitment ? JSON.parse(detail.commitment) : []
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = ['','Android','IOS','其它'][detail.msdk_type]
detailData.apiBaseInfo[2].value = detail.msdk_system
detailData.apiBaseInfo[3].value = sdkFile[0].name
detailData.apiBaseInfo[3].url = sdkFile[0].url
detailData.apiBaseInfo[4].value = detail.sdk_version
detailData.apiBaseInfo[5].value = commitment[0].name
detailData.apiBaseInfo[5].url = commitment[0].url
}
const {
apiBaseInfo,
detail_data,
res_body_open,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
}
.dialog_info {
padding: 27px 0 17px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<!-- MQ -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
Topic
<span class="after_icon" @click="topic_open=!topic_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="topic_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="topic_open">
<div class="topic_box" v-if="topicInfo && topicInfo.length > 0">
<div class="left">
<div class="items">
<div
v-for="(item,idx) in topicInfo"
:key="idx"
class="topic_item"
:class="currentTopic.id == item.id ? 'current' : ''"
@click="changeCurrentTopic(item)"
>
<el-tooltip
effect="dark"
:content="iconTipInfo[item.test_state]"
placement="top"
>
<bg-icon
class="tree-icon"
:class="classArr[item.test_state]"
:icon="iconArr[item.test_state]"
></bg-icon>
</el-tooltip>
{{item.name}}
</div>
</div>
</div>
<div class="right">
{{currentTopic.desc}}
</div>
</div>
<div class="no_data" v-else>
<img src="../../assets/imgs/img-no-data.png" alt="">
<div class="text">无参数</div>
</div>
</div>
<p class="input-title mt">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
dialogClose()
}
"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="dialogClose">取 消</el-button>
<el-button type="primary" @click="dialogClose">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const emit = defineEmits(["dialogClose"])
const router = useRouter()
const route = useRoute()
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 104
},
{
name: "调用地址",
value: "",
nameWidth: 104
},
{
name: "平台协议",
value: "",
nameWidth: 104
},
{
name: "平台版本号",
value: "",
nameWidth: 104,
},
{
name: "用户名",
value: "",
nameWidth: 104
},
{
name: "密码",
value: "",
nameWidth: 104,
password: true,
realValue: "",
},
], // 基本信息
topicInfo: [],
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
topic_open: true,
currentTopic: {},
classArr: [
"question",
"success",
"close",
],
iconArr: [
"#bg-ic-s-circle-question",
"#bg-ic-s-circle-check",
"#bg-ic-s-circle-close"
],
iconTipInfo: [
"该主题还未进行测试",
"该主题测试通过",
"该主题测试不通过"
],
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.req_url
detailData.apiBaseInfo[2].value = ["","kafka","rocketMQ","rabbitMQ"][detail.mq_protocol]
detailData.apiBaseInfo[3].value = detail.mq_version
detailData.apiBaseInfo[4].value = detail.mq_user_name
detailData.apiBaseInfo[5].value = "***************"
detailData.apiBaseInfo[5].realValue = detail.mq_password
detailData.topicInfo = detail.mq_topic || []
detailData.currentTopic = detailData.topicInfo[0] || {}
}
const changeCurrentTopic = (item) => {
detailData.currentTopic = item
}
const serviceTest = () => {
let params = {
interface_type: 4,
url: detail.req_url,
mq_protocol: detail.mq_protocol,
mq_exchange: detailData.currentTopic.name,
mq_password: detail.mq_password,
mq_user: detail.mq_user,
mq_id: detailData.currentTopic.id,
id: detail.id.toString()
}
$axios
.post(`/apaas/service/v5/service/test`,params)
.then((res) => {
if (res.data.code !== 200) {
$message.error(res.data.data)
} else {
detailData.showDialog = true
if (res.data.data.response_code == 200) {
detailData.dialogInfo = {
msg: "该服务地址正常",
state: true
}
}else {
detailData.dialogInfo = {
msg: "该服务地址异常",
state: false
}
}
}
})
}
const dialogClose = () => {
detailData.showDialog = false
emit("refresh",detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
topicInfo,
topic_open,
currentTopic,
classArr,
iconArr,
iconTipInfo,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.mt {
margin-top: 24px;
}
.no_data {
text-align: center;
.text {
font-size: 16px;
color: #616f94;
line-height: 1;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
.topic_box {
display: flex;
.left {
width: 200px;
margin-right: 16px;
font-size: 14px;
color: #202531;
.items {
border: 1px solid #dadee7;
padding: 4px 0;
.topic_item {
height: 34px;
line-height: 34px;
padding: 0 8px;
cursor: pointer;
display: flex;
align-items: center;
.tree-icon {
font-size: 12px;
color: #909bb6;
margin-right: 6px;
}
.success {
color: #48ad97;
}
.close {
color: #dd6955;
}
}
.current {
background-color: #eff2fa;
color: #3759be;
}
}
}
.right {
flex: 1;
height: 332px;
background-color: #fafafa;
border-radius: 4px;
padding: 15px 24px;
}
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
This diff is collapsed.
<!-- socket -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
dialogClose()
}"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="dialogClose">取 消</el-button>
<el-button type="primary" @click="dialogClose">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const emit = defineEmits(["dialogClose"])
const router = useRouter()
const route = useRoute()
const state = reactive({data1:1})
const {data1} = toRefs(state)
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 104
},
{
name: "调用地址",
value: "",
nameWidth: 104
},
], // 基本信息
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.req_url
}
const serviceTest = () => {
let params = {
interface_type: 2,
url: detail.req_url,
id: detail.id.toString()
}
$axios
.post(`/apaas/service/v5/service/test`,params)
.then((res) => {
if (res.data.code !== 200) {
$message.error(res.data.data)
} else {
detailData.showDialog = true
if (res.data.data.response_code == 200) {
detailData.dialogInfo = {
msg: "该服务地址正常",
state: true
}
}else {
detailData.dialogInfo = {
msg: "该服务地址异常",
state: false
}
}
}
})
}
const dialogClose = () => {
detailData.showDialog = false
emit("refresh",detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<!-- MQ -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" class="refresh_btn" @click="refresh" v-if="showRefreshBtn">
<bg-icon style="font-size: 10px; color: #fff; margin-right: 10px" icon="#bg-ic-refresh"></bg-icon>
刷新
</el-button>
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
主题
<span class="after_icon" @click="topic_open=!topic_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="topic_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="topic_open">
<div class="topic_box" v-if="uiInfo && uiInfo.length > 0">
<div class="left">
<div class="items">
<div
v-for="(item,idx) in uiInfo"
:key="idx"
class="topic_item"
:class="currentUi.id == item.id ? 'current' : ''"
@click="changeCurrentTopic(item)"
>
<el-tooltip
effect="dark"
:content="iconTipInfo[item.test_state]"
placement="top"
>
<bg-icon
class="tree-icon"
:class="classArr[item.test_state]"
:icon="iconArr[item.test_state]"
></bg-icon>
</el-tooltip>
{{item.theme}}
</div>
</div>
</div>
<div class="right">
<img :src="currentUi.image[0].url" alt="">
</div>
</div>
<div class="no_data" v-else>
<img src="../../assets/imgs/img-no-data.png" alt="">
<div class="text">无参数</div>
</div>
</div>
<p class="input-title mt">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
showDialog = false;
}
"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="showDialog = false">取 消</el-button>
<el-button type="primary" @click="showDialog = false">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const router = useRouter()
const route = useRoute()
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 104
},
{
name: "调用地址",
value: "",
nameWidth: 104
},
], // 基本信息
uiInfo: [],
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
topic_open: true,
currentUi: {},
classArr: [
"question",
"success",
"close",
],
iconArr: [
"#bg-ic-s-circle-question",
"#bg-ic-s-circle-check",
"#bg-ic-s-circle-close"
],
iconTipInfo: [
"该主题还未进行测试",
"该主题测试通过",
"该主题测试不通过"
],
showRefreshBtn: false
})
const emit = defineEmits(['refresh'])
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.req_url
detailData.uiInfo = detail.ui_theme || []
if (detailData.uiInfo.length > 0) {
detailData.uiInfo.forEach(e => {
e.image = JSON.parse(e.image)
})
}
detailData.currentUi = detailData.uiInfo[0] || {}
}
const changeCurrentTopic = (item) => {
detailData.currentUi = item
}
const serviceTest = () => {
let params = {
ui_id: detailData.currentUi.id,
id: detail.id.toString(),
url: detail.req_url,
parameters: detailData.currentUi.parameters
}
localStorage.setItem('params',JSON.stringify(params))
let routeData = router.resolve({
path: "/ui-example",
});
window.open(routeData.href, "_blank");
detailData.showRefreshBtn = true
}
const refresh = () => {
emit('refresh',detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
uiInfo,
topic_open,
currentUi,
classArr,
iconArr,
iconTipInfo,
showRefreshBtn,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
.refresh_btn {
background-color: #404a62;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.mt {
margin-top: 24px;
}
.no_data {
text-align: center;
.text {
font-size: 16px;
color: #616f94;
line-height: 1;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
.topic_box {
display: flex;
.left {
width: 200px;
margin-right: 16px;
font-size: 14px;
color: #202531;
.items {
border: 1px solid #dadee7;
padding: 4px 0;
.topic_item {
height: 34px;
line-height: 34px;
padding: 0 8px;
cursor: pointer;
display: flex;
align-items: center;
.tree-icon {
font-size: 12px;
color: #909bb6;
margin-right: 6px;
}
.success {
color: #48ad97;
}
.close {
color: #dd6955;
}
}
.current {
background-color: #eff2fa;
color: #3759be;
}
}
}
.right {
flex: 1;
height: 332px;
img {
width: 100%;
height: 100%;
}
}
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<!-- webSDK -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
使用示例
<span class="after_icon" @click="example_open=!example_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="example_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="example_open">
<video id="video" style="width: 100%" controls autoplay>
<source :src="wsdk_use_doc" />
</video>
</div>
<p class="input-title">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
dialogClose()
}
"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="dialogClose">取 消</el-button>
<el-button type="primary" @click="dialogClose">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const emit = defineEmits(["dialogClose"])
const router = useRouter()
const route = useRoute()
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 104
},
{
name: "版本号",
value: "",
nameWidth: 104
},
{
name: "调用地址",
value: "",
full: true,
nameWidth: 104
},
{
name: "安全密钥",
value: "",
nameWidth: 104,
full: true,
password: true,
realValue: "",
},
], // 基本信息
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
example_open: true,
wsdk_use_doc: ""
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.sdk_version
detailData.apiBaseInfo[2].value = detail.req_url
detailData.apiBaseInfo[3].value = "***************"
detailData.apiBaseInfo[3].realValue = detail.wsdk_secret_key
detailData.wsdk_use_doc = detail.wsdk_use_doc
}
const serviceTest = () => {
let params = {
interface_type: 1,
method: 1,
url: detail.req_url,
id: detail.id.toString()
}
$axios
.post(`/apaas/service/v5/service/test`,params)
.then((res) => {
if (res.data.code !== 200) {
$message.error(res.data.data)
} else {
detailData.showDialog = true
if (res.data.data.response_code == 200) {
detailData.dialogInfo = {
msg: "该服务地址正常",
state: true
}
}else {
detailData.dialogInfo = {
msg: "该服务地址异常",
state: false
}
}
}
})
}
const dialogClose = () => {
detailData.showDialog = false
emit("refresh",detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
example_open,
wsdk_use_doc,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
<!-- websocket -->
<template>
<div>
<div class="baseInfo_box">
<div class="baseInfo">
<bg-info :data="apiBaseInfo" />
</div>
<div class="apaas_button test_btn">
<el-button type="primary" @click="serviceTest">
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
服务测试
</el-button>
</div>
</div>
<div class="req_box">
<p class="input-title">
<span class="before_title"></span>
接口文档介绍
<span class="after_icon" @click="res_body_open=!res_body_open">
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-up" v-if="res_body_open"></bg-icon>
<bg-icon style="font-size: 8px; color: #000;" icon="#bg-ic-arrow-down" v-else></bg-icon>
</span>
</p>
<div v-if="res_body_open">
<div v-html="detail_data.doc_desc" class="doc_desc"></div>
</div>
</div>
<!-- 测试结果弹窗 -->
<el-dialog
class="dialog_box result_box"
title="提示"
v-model="showDialog"
width="400px"
:before-close="
() => {
dialogClose()
}
"
>
<div class="dialog_info">
<bg-icon v-if="dialogInfo.state" style="font-size: 26px; color: #429e8a; margin-right: 10px" icon="#bg-ic-circle-check"></bg-icon>
<bg-icon v-else style="font-size: 26px; color: #d75138; margin-right: 10px" icon="#bg-ic-circle-close"></bg-icon>
<span>{{dialogInfo.msg}}</span>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button @click="dialogClose">取 消</el-button>
<el-button type="primary" @click="dialogClose">确 定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs,getCurrentInstance } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy
const props = defineProps({
data: {
type: Object,
default: null
}
})
const emit = defineEmits(["dialogClose"])
const router = useRouter()
const route = useRoute()
const state = reactive({data1:1})
const {data1} = toRefs(state)
const detailData = reactive({
apiBaseInfo: [
{
name: "能力名称",
value: "",
nameWidth: 104
},
{
name: "调用地址",
value: "",
nameWidth: 104
},
{
name: "通信协议",
value: "",
full: true,
nameWidth: 104
},
], // 基本信息
detail_data: {},
res_body_open: true,
showDialog: false,
dialogInfo: {
msg: "该服务地址正常",
state: true
},
})
const detail = props.data
detailData.detail_data = props.data
if (detail) {
detailData.apiBaseInfo[0].value = detail.service_name
detailData.apiBaseInfo[1].value = detail.req_url
detailData.apiBaseInfo[2].value = ['','ws','wss'][detail.ws_protocol]
}
const serviceTest = () => {
let params = {
interface_type: 3,
url: detail.req_url,
id: detail.id.toString()
}
$axios
.post(`/apaas/service/v5/service/test`,params)
.then((res) => {
if (res.data.code !== 200) {
$message.error(res.data.data)
} else {
detailData.showDialog = true
if (res.data.data.response_code == 200) {
detailData.dialogInfo = {
msg: "该服务地址正常",
state: true
}
}else {
detailData.dialogInfo = {
msg: "该服务地址异常",
state: false
}
}
}
})
}
const dialogClose = () => {
detailData.showDialog = false
emit("refresh",detail.ability_tree_code)
}
const {
apiBaseInfo,
detail_data,
res_body_open,
showDialog,
dialogInfo,
} = toRefs(detailData)
</script>
<style lang="scss" scoped>
.baseInfo_box {
width: 100%;
display: flex;
justify-content: space-between;
.baseInfo {
width: 872px;
}
}
.req_box {
width: 872px;
margin-top: 30px;
.input-title {
font-size: 16px;
color: #202531;
margin-top: 9px;
margin-bottom: 15px;
font-weight: 700;
line-height: 1;
.before_title {
display: inline-block;
width: 4px;
height: 14px;
background-color: #2b4695;
margin-right: 8px;
border-radius: 2px;
}
.after_icon {
float: right;
cursor: pointer;
}
}
.doc_desc {
width: 100%;
height: 406px;
padding: 16px 24px;
background-color: #fafafa;
border-radius: 4px;
color: #202531;
font-size: 14px;
}
}
.dialog_info {
padding: 27px 0 11px;
display: flex;
align-items: center;
justify-content: center;
}
</style>
\ No newline at end of file
...@@ -44,77 +44,76 @@ ...@@ -44,77 +44,76 @@
<script> <script setup>
import { reactive, toRefs, onBeforeMount } from 'vue' import { reactive, toRefs, onBeforeMount } from 'vue'
export default {
props: { const props = defineProps({
show_header: { show_header: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
selectValue: { selectValue: {
type: [String,Number], type: [String,Number],
default: "" default: ""
}, },
selectArr: { selectArr: {
type: Array, type: Array,
default: () => { default: () => {
return []; return [];
},
},
buttons_arr: {
type: Array,
default: () => {
return [];
},
},
bgIcon: {
type: String,
default: ""
},
title: {
type: String,
default: "",
},
background_color: {
type: String,
default: "#fff"
}, // header条背景色
showLeft: {
type: Boolean,
default: true
}, },
noPadding: { },
type: Boolean, buttons_arr: {
default: false type: Array,
default: () => {
return [];
}, },
}, },
bgIcon: {
setup(props,{ emit }) { type: String,
const state = reactive({ default: ""
currentSelectValue: null, },
active_button: 0 title: {
}) type: String,
const selectChange = (val) => { default: "",
state.currentSelectValue = val; },
emit('selectChange', val); background_color: {
} type: String,
const changeButton = (index) => { default: "#fff"
if (state.active_button != index) { }, // header条背景色
state.active_button = index; showLeft: {
emit("changeButton", index); type: Boolean,
} default: true
} },
onBeforeMount(() => { noPadding: {
state.currentSelectValue = props.selectValue type: Boolean,
}) default: false
return {
...toRefs(state),
selectChange,
changeButton,
}
}, },
})
const emit = defineEmits(['selectChange','changeButton'])
const state = reactive({
currentSelectValue: null,
active_button: 0
})
const selectChange = (val) => {
state.currentSelectValue = val;
emit('selectChange', val);
} }
const changeButton = (index) => {
if (state.active_button != index) {
state.active_button = index;
emit("changeButton", index);
}
}
onBeforeMount(() => {
state.currentSelectValue = props.selectValue
})
const {
currentSelectValue,
active_button,
} = toRefs(state)
</script> </script>
<style scoped> <style scoped>
......
<template>
<div>
<span @click="getTableData1">login</span>
<span @click="getSelect">select</span>
<bg-table ref="bgTable" :headers="headers" :rows="tableRows" :select="true" height="100%"></bg-table>
</div>
</template>
<script>
import { reactive, toRefs,onBeforeMount,onMounted,ref } from 'vue'
export default {
setup(){
const bgTable = ref(null)
const state = reactive({
bgTable,
headers:[
{
label: "类型",
prop: "certificateTypeDesc",
},
{
label: "业务ID",
prop: "businessId",
},
{
label: "申请主体",
prop: "businessId1",
}
],
dataTable:[
{
certificateTypeDesc:111,
businessId:111,
businessId1:111,
id:1,
},
{
certificateTypeDesc:111,
businessId:111,
businessId1:111,
id:2,
},
{
certificateTypeDesc:111,
businessId:111,
businessId1:111,
id:3,
},
{
certificateTypeDesc:111,
businessId:111,
businessId1:111,
id:4,
},
{
certificateTypeDesc:111,
businessId:111,
businessId1:111,
id:5,
},
{
certificateTypeDesc:222,
businessId:22,
businessId1:222,
id:6,
},
{
certificateTypeDesc:2222,
businessId:2222,
businessId1:2222,
id:7,
},
{
certificateTypeDesc:2222,
businessId:2222,
businessId1:2222,
id:8,
},
{
certificateTypeDesc:2222,
businessId:2222,
businessId1:2222,
id:9,
},
{
certificateTypeDesc:2222,
businessId:2222,
businessId1:2222,
id:10,
},
],
tableRows:[],
nowPage:1
})
onBeforeMount(() => {
getTableData()
})
onMounted(() => {
console.log(state.bgTable);
})
const getTableData=()=>{
state.tableRows=[]
state.dataTable.forEach((e,idx) => {
if(idx>=(state.nowPage-1)*5&&idx<state.nowPage*5){
state.tableRows.push(e)
}
});
}
const getTableData1=()=>{
console.log(1111);
if(state.nowPage==1){
state.nowPage = 2
}else{
state.nowPage = 1
}
getTableData()
}
const getSelect=()=>{
let select = state.bgTable.dealSelectData()
console.log(select);
}
return {
...toRefs(state),
getTableData,
getTableData1,
getSelect,
}
}
};
</script>
<style scoped>
</style>
...@@ -387,6 +387,7 @@ const distribute_user = (row) => { ...@@ -387,6 +387,7 @@ const distribute_user = (row) => {
const getUserList = () => { const getUserList = () => {
nextTick(() => { nextTick(() => {
console.log(userTable)
clearUserSelection() clearUserSelection()
}) })
let params = { let params = {
...@@ -407,6 +408,7 @@ const getUserList = () => { ...@@ -407,6 +408,7 @@ const getUserList = () => {
nextTick(() => { nextTick(() => {
userState.userRows.forEach(e => { userState.userRows.forEach(e => {
if(e.is_bind == 1) { if(e.is_bind == 1) {
console.log(userTable)
userTable.value.toggleRowSelection(e,true) userTable.value.toggleRowSelection(e,true)
} }
}) })
...@@ -445,6 +447,7 @@ const clearAction = (type) => { ...@@ -445,6 +447,7 @@ const clearAction = (type) => {
} }
const clearUserSelection = () => { const clearUserSelection = () => {
console.log(userTable.value)
userTable.value.clearTable() userTable.value.clearTable()
} }
......
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