|
@@ -5,13 +5,13 @@
|
|
<div class="container">
|
|
<div class="container">
|
|
<div class="selectContainer">
|
|
<div class="selectContainer">
|
|
<article style="margin-right: 20px">
|
|
<article style="margin-right: 20px">
|
|
- <span class="label">产品:</span>
|
|
|
|
|
|
+ <span class="label">产品:</span>
|
|
<el-select v-model="product" filterable @change="handleChange">
|
|
<el-select v-model="product" filterable @change="handleChange">
|
|
<el-option v-for="item in productOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
<el-option v-for="item in productOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</article>
|
|
</article>
|
|
<article>
|
|
<article>
|
|
- <span class="label">配置格式:</span>
|
|
|
|
|
|
+ <span class="label">配置格式:</span>
|
|
<el-select v-model="currentConfig.configFormat" filterable>
|
|
<el-select v-model="currentConfig.configFormat" filterable>
|
|
<el-option v-for="item in configTypeOptions" :key="item.key" :label="item.key" :value="item.key"> </el-option>
|
|
<el-option v-for="item in configTypeOptions" :key="item.key" :label="item.key" :value="item.key"> </el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -33,16 +33,9 @@
|
|
<el-switch v-model="onlineOpen" active-color="#13ce66" inactive-color="#ddd"></el-switch>
|
|
<el-switch v-model="onlineOpen" active-color="#13ce66" inactive-color="#ddd"></el-switch>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
-<!-- <div style="border: 1px solid #ccc; border-top: none">-->
|
|
|
|
|
|
+ <!-- <div style="border: 1px solid #ccc; border-top: none">-->
|
|
<div style="border-top: none">
|
|
<div style="border-top: none">
|
|
- <codeEditor
|
|
|
|
- class="params flex1"
|
|
|
|
- ref="mirrorRef"
|
|
|
|
- mode=""
|
|
|
|
- :onchange="onchange"
|
|
|
|
- :readOnly="true"
|
|
|
|
- :content="currentConfig.configContent"
|
|
|
|
- :cursorBlinkRate="-1"></codeEditor>
|
|
|
|
|
|
+ <codeEditor class="params flex1" ref="mirrorRef" :mode="currentConfig.configFormat" :onchange="onchange" :readOnly="true" :content="currentConfig.configContent" :cursorBlinkRate="-1"></codeEditor>
|
|
</div>
|
|
</div>
|
|
<div class="btnContainer">
|
|
<div class="btnContainer">
|
|
<div v-if="!onlineOpen">
|
|
<div v-if="!onlineOpen">
|
|
@@ -55,12 +48,7 @@
|
|
<div v-else><el-button type="primary" @click="updateDialogVisible = true">批量更新</el-button></div>
|
|
<div v-else><el-button type="primary" @click="updateDialogVisible = true">批量更新</el-button></div>
|
|
</div>
|
|
</div>
|
|
<h2>配置版本记录</h2>
|
|
<h2>配置版本记录</h2>
|
|
- <el-table :data="tableData.data"
|
|
|
|
- style="width: 100%"
|
|
|
|
- row-key="id"
|
|
|
|
- default-expand-all
|
|
|
|
- :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
|
- v-loading="tableData.loading">
|
|
|
|
|
|
+ <el-table :data="tableData.data" style="width: 100%" row-key="id" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" v-loading="tableData.loading">
|
|
<el-table-column prop="configNumber" label="编号" width="200"> </el-table-column>
|
|
<el-table-column prop="configNumber" label="编号" width="200"> </el-table-column>
|
|
<el-table-column prop="gmtCreate" label="版本更新时间"></el-table-column>
|
|
<el-table-column prop="gmtCreate" label="版本更新时间"></el-table-column>
|
|
<el-table-column label="操作" width="200">
|
|
<el-table-column label="操作" width="200">
|
|
@@ -86,10 +74,10 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <span class="dialog-footer">
|
|
|
|
- <el-button @click="updateDialogHandle" type="primary">确认更新</el-button>
|
|
|
|
- <el-button @click="updateDialogVisible = false">取消</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="updateDialogHandle" type="primary">确认更新</el-button>
|
|
|
|
+ <el-button @click="updateDialogVisible = false">取消</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<el-dialog v-model="saveDialogVisible" width="40%">
|
|
<el-dialog v-model="saveDialogVisible" width="40%">
|
|
@@ -104,27 +92,21 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <span class="dialog-footer">
|
|
|
|
- <el-button @click="saveHandle" type="primary">确认</el-button>
|
|
|
|
- <el-button @click="saveDialogVisible = false">取消</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="saveHandle" type="primary">确认</el-button>
|
|
|
|
+ <el-button @click="saveDialogVisible = false">取消</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<el-dialog v-model="lookDialogVisible" width="40%">
|
|
<el-dialog v-model="lookDialogVisible" width="40%">
|
|
<div class="saveDialogContainer" v-if="lookDialogVisible">
|
|
<div class="saveDialogContainer" v-if="lookDialogVisible">
|
|
- <codeEditor class="params flex1"
|
|
|
|
- ref="mirrorRefDialog"
|
|
|
|
- mode=""
|
|
|
|
- :onchange="onchange"
|
|
|
|
- :readOnly="true"
|
|
|
|
- :content="tableData.data[lookIndex!].content"
|
|
|
|
- :cursorBlinkRate="-1"></codeEditor>
|
|
|
|
|
|
+ <codeEditor class="params flex1" ref="mirrorRefDialog" mode="" :onchange="onchange" :readOnly="true" :content="tableData.data[lookIndex!].content" :cursorBlinkRate="-1"></codeEditor>
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <span class="dialog-footer">
|
|
|
|
- <el-button @click="lookSureDialogVisible = true" type="primary">恢复至此版本</el-button>
|
|
|
|
- <el-button @click="lookDialogVisible = false">取消</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="lookSureDialogVisible = true" type="primary">恢复至此版本</el-button>
|
|
|
|
+ <el-button @click="lookDialogVisible = false">取消</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<el-dialog v-model="lookSureDialogVisible" width="40%">
|
|
<el-dialog v-model="lookSureDialogVisible" width="40%">
|
|
@@ -140,10 +122,10 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <span class="dialog-footer">
|
|
|
|
- <el-button @click="sureRestore" type="primary">确认</el-button>
|
|
|
|
- <el-button @click="lookSureDialogVisible = false">取消</el-button>
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
+ <el-button @click="sureRestore" type="primary">确认</el-button>
|
|
|
|
+ <el-button @click="lookSureDialogVisible = false">取消</el-button>
|
|
|
|
+ </span>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
@@ -166,11 +148,11 @@ export default defineComponent({
|
|
const onlineOpen = ref(false)
|
|
const onlineOpen = ref(false)
|
|
const mirrorRef = ref<any>() // 编辑器
|
|
const mirrorRef = ref<any>() // 编辑器
|
|
const mirrorRefDialog = ref<any>()
|
|
const mirrorRefDialog = ref<any>()
|
|
- const configTypeOptions = [{ key: 'json' }, { key: 'yaml' }]
|
|
|
|
|
|
+ const configTypeOptions = [{ key: 'application/json' }, { key: 'text/yaml' }]
|
|
const selectProduct = ref(); // 选中产品名称
|
|
const selectProduct = ref(); // 选中产品名称
|
|
const currentConfig = ref({
|
|
const currentConfig = ref({
|
|
configContent: '',
|
|
configContent: '',
|
|
- configFormat: 'json',
|
|
|
|
|
|
+ configFormat: 'application/json',
|
|
configNumber: '',
|
|
configNumber: '',
|
|
gmtCreate: '',
|
|
gmtCreate: '',
|
|
id: '',
|
|
id: '',
|
|
@@ -205,17 +187,17 @@ export default defineComponent({
|
|
const saveDialogVisible = ref(false)
|
|
const saveDialogVisible = ref(false)
|
|
const updateDialogVisible = ref(false)
|
|
const updateDialogVisible = ref(false)
|
|
watch(
|
|
watch(
|
|
- () => onlineOpen.value,
|
|
|
|
- () => {
|
|
|
|
- //初始化 然后由false变为 true 不用管
|
|
|
|
- // 这里是 由false变为true
|
|
|
|
- if (!onlineOpen.value) {
|
|
|
|
- canSave.value = false
|
|
|
|
- mirrorRef.value.setOption('readOnly', true)
|
|
|
|
- // 隐藏光标
|
|
|
|
- mirrorRef.value.setOption('cursorBlinkRate', -1);
|
|
|
|
- }
|
|
|
|
|
|
+ () => onlineOpen.value,
|
|
|
|
+ () => {
|
|
|
|
+ //初始化 然后由false变为 true 不用管
|
|
|
|
+ // 这里是 由false变为true
|
|
|
|
+ if (!onlineOpen.value) {
|
|
|
|
+ canSave.value = false
|
|
|
|
+ mirrorRef.value.setOption('readOnly', true)
|
|
|
|
+ // 隐藏光标
|
|
|
|
+ mirrorRef.value.setOption('cursorBlinkRate', -1);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
)
|
|
)
|
|
watch(() => product.value, () => {
|
|
watch(() => product.value, () => {
|
|
//product.value 就是那个key options里面转化了
|
|
//product.value 就是那个key options里面转化了
|
|
@@ -245,9 +227,9 @@ export default defineComponent({
|
|
currentConfig.value = res.remoteconf[0]
|
|
currentConfig.value = res.remoteconf[0]
|
|
mirrorRef.value.setValue(currentConfig.value.configContent)
|
|
mirrorRef.value.setValue(currentConfig.value.configContent)
|
|
}
|
|
}
|
|
- }).catch((error: any) => {
|
|
|
|
- ElMessage.error(error)
|
|
|
|
- })
|
|
|
|
|
|
+ }).catch((error: any) => {
|
|
|
|
+ ElMessage.error(error)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
const size = ref('0')
|
|
const size = ref('0')
|
|
|
|
|
|
@@ -301,8 +283,9 @@ export default defineComponent({
|
|
lookDialogVisible.value = true
|
|
lookDialogVisible.value = true
|
|
lookIndex.value = index
|
|
lookIndex.value = index
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- mirrorRefDialog.value.setValue(tableData.data[index].configContent)
|
|
|
|
- }, 4)
|
|
|
|
|
|
+ mirrorRefDialog.value.setMode(tableData.data[lookIndex.value!].configFormat)
|
|
|
|
+ mirrorRefDialog.value.setValue(tableData.data[lookIndex.value!].configContent)
|
|
|
|
+ }, 0)
|
|
}
|
|
}
|
|
const sureRestore = () => {
|
|
const sureRestore = () => {
|
|
lookDialogVisible.value = false
|
|
lookDialogVisible.value = false
|
|
@@ -349,57 +332,70 @@ export default defineComponent({
|
|
.selectContainer {
|
|
.selectContainer {
|
|
display: flex;
|
|
display: flex;
|
|
}
|
|
}
|
|
|
|
+
|
|
.label {
|
|
.label {
|
|
display: inline-block;
|
|
display: inline-block;
|
|
padding-right: 12px;
|
|
padding-right: 12px;
|
|
}
|
|
}
|
|
|
|
+
|
|
h2 {
|
|
h2 {
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
article {
|
|
article {
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
.container :deep(.ql-toolbar.ql-snow) {
|
|
.container :deep(.ql-toolbar.ql-snow) {
|
|
display: none;
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
+
|
|
.editorTitle {
|
|
.editorTitle {
|
|
width: 100%;
|
|
width: 100%;
|
|
//border: 1px solid #ccc;
|
|
//border: 1px solid #ccc;
|
|
padding: 10px;
|
|
padding: 10px;
|
|
- height: 50px
|
|
|
|
- //background-color: #eee;
|
|
|
|
|
|
+ height: 50px //background-color: #eee;
|
|
}
|
|
}
|
|
|
|
+
|
|
.leftLabel {
|
|
.leftLabel {
|
|
float: left;
|
|
float: left;
|
|
height: 32px;
|
|
height: 32px;
|
|
line-height: 32px;
|
|
line-height: 32px;
|
|
font-weight: 600;
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
|
|
+
|
|
.rightLabel {
|
|
.rightLabel {
|
|
float: right;
|
|
float: right;
|
|
|
|
+
|
|
span {
|
|
span {
|
|
display: inline-block;
|
|
display: inline-block;
|
|
margin: 0 10px;
|
|
margin: 0 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
.icon {
|
|
.icon {
|
|
float: left;
|
|
float: left;
|
|
margin-top: 6px;
|
|
margin-top: 6px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.btnContainer {
|
|
.btnContainer {
|
|
width: 200px;
|
|
width: 200px;
|
|
margin: 10px auto;
|
|
margin: 10px auto;
|
|
display: flex;
|
|
display: flex;
|
|
}
|
|
}
|
|
|
|
+
|
|
.saveDialogContainer {
|
|
.saveDialogContainer {
|
|
display: flex;
|
|
display: flex;
|
|
|
|
+
|
|
h2 {
|
|
h2 {
|
|
color: #333;
|
|
color: #333;
|
|
}
|
|
}
|
|
|
|
+
|
|
p {
|
|
p {
|
|
color: #999;
|
|
color: #999;
|
|
margin: 8px 0;
|
|
margin: 8px 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
.icon {
|
|
.icon {
|
|
margin: 2px 10px;
|
|
margin: 2px 10px;
|
|
}
|
|
}
|