mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-30 02:48:17 +08:00
🐞 fix(web): 修复 ts 错误
This commit is contained in:
parent
87d73b583f
commit
43159b08d3
@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-tag v-for="(data, key) in parameterMap" closable @close="delteParameters(key)" @click="handleEdit(key)">
|
||||
<a-tag
|
||||
v-for="(data, key) in parameterMap"
|
||||
:key="key"
|
||||
closable
|
||||
@close="delteParameters(key)"
|
||||
@click="handleEdit(key)"
|
||||
>
|
||||
<a-tooltip :title="parameterMap[key]">{{ key }}</a-tooltip>
|
||||
</a-tag>
|
||||
<a-tag
|
||||
@ -38,9 +44,11 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import Qs from 'qs'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { Rule } from 'ant-design-vue/es/form'
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: String
|
||||
value?: string
|
||||
}>(),
|
||||
{
|
||||
value: ''
|
||||
@ -48,11 +56,11 @@ const props = withDefaults(
|
||||
)
|
||||
const emit = defineEmits<{ (e: 'update:value', value: object): void }>()
|
||||
const useData = ref(props.value)
|
||||
|
||||
const parameterMap = ref<Record<String, any>>({})
|
||||
const { t: $t } = useI18n()
|
||||
const parameterMap = ref<Record<string, any>>({})
|
||||
|
||||
// 删除
|
||||
const delteParameters = (key: number) => {
|
||||
const delteParameters = (key: string) => {
|
||||
delete parameterMap.value[key]
|
||||
useData.value = Qs.stringify(parameterMap.value)
|
||||
}
|
||||
@ -60,7 +68,7 @@ const delteParameters = (key: number) => {
|
||||
watch(
|
||||
() => useData.value,
|
||||
(val) => {
|
||||
emit('update:value', val)
|
||||
emit('update:value', val as any)
|
||||
},
|
||||
{
|
||||
immediate: false
|
||||
@ -89,13 +97,17 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
const rules = ref({
|
||||
key: [{ required: true, message: this.$t('components.parameterWidget.index.1bb65976'), trigger: 'blur' }]
|
||||
const rules = ref<Record<string, Rule[]>>({
|
||||
key: [{ required: true, message: $t('components.parameterWidget.index.1bb65976') as string, trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const editVisible = ref(false)
|
||||
const editForm = ref()
|
||||
const temp = ref({
|
||||
const temp = ref<{
|
||||
key: string
|
||||
value: string
|
||||
oldKey?: string
|
||||
}>({
|
||||
key: '',
|
||||
value: ''
|
||||
})
|
||||
@ -105,7 +117,7 @@ const handleAdd = () => {
|
||||
temp.value = { key: '', value: '' }
|
||||
}
|
||||
|
||||
const handleEdit = (key) => {
|
||||
const handleEdit = (key: string) => {
|
||||
editVisible.value = true
|
||||
temp.value = { key: key, value: parameterMap.value[key], oldKey: key }
|
||||
}
|
||||
@ -114,7 +126,7 @@ const handleEditOk = () => {
|
||||
editForm.value.validate().then(() => {
|
||||
editVisible.value = false
|
||||
parameterMap.value[temp.value.key] = temp.value.value
|
||||
if (temp.value.key !== temp.value.oldKey) {
|
||||
if (temp.value.key !== temp.value.oldKey && temp.value.oldKey) {
|
||||
delete parameterMap.value[temp.value.oldKey]
|
||||
}
|
||||
})
|
||||
|
@ -196,6 +196,7 @@
|
||||
:confirm-loading="confirmLoading"
|
||||
:title="$t('pages.repository.repository-list.b3885a87')"
|
||||
:mask-closable="false"
|
||||
width="60%"
|
||||
@ok="handleEditOk"
|
||||
>
|
||||
<a-form ref="editForm" :rules="rules" :model="temp" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
|
||||
|
@ -22,25 +22,15 @@
|
||||
<a-form-item :label="$t('pages.system.assets.machine.free-script.243b7015')" name="path">
|
||||
<a-input v-model:value="temp.path" :placeholder="$t('pages.system.assets.machine.free-script.8eec4f88')" />
|
||||
</a-form-item>
|
||||
<!-- <a-form-item :wrapper-col="{ span: 14, offset: 2 }">
|
||||
<a-space>
|
||||
<a-button type="primary" danger :disabled="submitAble" @click="onSubmit(true)">保存并重启</a-button>
|
||||
</a-space>
|
||||
</a-form-item> -->
|
||||
</a-form>
|
||||
</a-col>
|
||||
<a-col :span="14">
|
||||
<log-view2 ref="logView" height="calc(100vh - 50px - 30px)">
|
||||
<template #before>
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="loading"
|
||||
:disabled="!temp.content"
|
||||
@click="onSubmit(false)"
|
||||
>{{ $t('pages.system.assets.machine.free-script.985968bf') }}</a-button
|
||||
>
|
||||
<a-button type="primary" size="small" :loading="loading" :disabled="!temp.content" @click="onSubmit()">{{
|
||||
$t('pages.system.assets.machine.free-script.985968bf')
|
||||
}}</a-button>
|
||||
<a-switch
|
||||
v-model:checked="temp.appendTemplate"
|
||||
:checked-children="$t('pages.system.assets.machine.free-script.f18e273b')"
|
||||
@ -54,8 +44,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import codeEditor from '@/components/codeEditor'
|
||||
import LogView2 from '@/components/logView/index2'
|
||||
import codeEditor from '@/components/codeEditor/index.vue'
|
||||
import LogView2 from '@/components/logView/index2.vue'
|
||||
import { getWebSocketUrl } from '@/api/config'
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@ -67,13 +57,14 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const socket = ref(null)
|
||||
const socketRef = ref<WebSocket>()
|
||||
const loading = ref(false)
|
||||
const logView = ref()
|
||||
const userStore_ = userStore()
|
||||
const temp = ref({
|
||||
appendTemplate: true,
|
||||
content: ''
|
||||
content: '',
|
||||
path: ''
|
||||
})
|
||||
|
||||
const socketUrl = computed(() => {
|
||||
@ -84,8 +75,7 @@ const socketUrl = computed(() => {
|
||||
})
|
||||
|
||||
const conentScript = () => {
|
||||
socket.vlaue?.close()
|
||||
socket.vlaue = null
|
||||
close()
|
||||
const socket_ = new WebSocket(socketUrl.value)
|
||||
logView.value.clearLogCache()
|
||||
// 连接成功后
|
||||
@ -111,7 +101,7 @@ const conentScript = () => {
|
||||
$message.warning($t('pages.system.assets.machine.free-script.8a2aae09'))
|
||||
// clearInterval(this.heart);
|
||||
}
|
||||
socket.value = socket_
|
||||
socketRef.value = socket_
|
||||
}
|
||||
|
||||
// console.log(socketUrl)
|
||||
@ -122,8 +112,9 @@ const onSubmit = () => {
|
||||
conentScript()
|
||||
}
|
||||
const close = () => {
|
||||
socket.vlaue?.close()
|
||||
socket.vlaue = null
|
||||
if (socketRef.value != null) {
|
||||
socketRef.value?.close()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user