U select all

This commit is contained in:
zhenorzz 2023-03-06 10:41:13 +08:00
parent 7d2be71577
commit 217ff125b7
2 changed files with 19 additions and 4 deletions

View File

@ -175,7 +175,9 @@
style="width: 100%"
filterable
multiple
@change="serverChange"
>
<el-option :value="0" label="Select all" />
<el-option
v-for="server in serverOption"
:key="server.id"
@ -262,7 +264,7 @@ import { ref, computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n({ useScope: 'global' })
const name = ref('')
const serverIds = ref([])
const serverIds = ref<number[]>([])
const dialogVisible = ref(false)
const processDialogVisible = ref(false)
const processExecLoading = ref(false)
@ -418,6 +420,12 @@ function handlePageChange(val = 1) {
pagination.value.page = val
}
function serverChange(_serverIds: number[]) {
if (_serverIds.includes(0)) {
serverIds.value = _serverIds = serverOption.value.map((_) => _.id)
}
}
function submit() {
form.value?.validate((valid) => {
if (valid) {
@ -442,10 +450,11 @@ function add() {
.request()
.then(() => {
getList()
dialogVisible.value = false
ElMessage.success('Success')
})
.finally(() => {
formProps.value.disabled = dialogVisible.value = false
formProps.value.disabled = false
})
}
@ -458,10 +467,11 @@ function edit() {
.request()
.then(() => {
getList()
dialogVisible.value = false
ElMessage.success('Success')
})
.finally(() => {
formProps.value.disabled = dialogVisible.value = false
formProps.value.disabled = false
})
}

View File

@ -12,7 +12,7 @@
clearable
@change="serverChange"
>
<el-option :value="0" label="All" />
<el-option :value="0" label="Select all" />
<el-option
v-for="(item, index) in serverOption"
:key="index"
@ -402,6 +402,7 @@ function handleRun() {
.request()
.then((response) => {
let execRes = true
let firstTag!: ServerTag
for (const serverRes of response.data) {
Object.assign(serverTags.value[serverRes.serverId], {
isRun: true,
@ -410,7 +411,11 @@ function handleRun() {
if (execRes && serverRes.execRes == false) {
execRes = false
}
if (!firstTag) {
firstTag = serverTags.value[serverRes.serverId]
}
}
showExecRes(firstTag)
if (execRes) {
ElMessage.success('Success')
} else {