添加删除校验

This commit is contained in:
a0049873 2022-07-01 11:10:58 +08:00
parent e9031d0a45
commit 91c7e6c904
1 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,7 @@
<script setup> <script setup>
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import { ref, defineProps } from 'vue' import { ref, defineProps } from 'vue'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
const props = defineProps({ const props = defineProps({
@ -58,7 +59,11 @@
// //
const removeFunction = (data) => { const removeFunction = (data) => {
dataForm.value.map((val) => { dataForm.value.map((val) => {
val.arr = val.arr.filter((item) => item.id !== data.id) if (val.arr.length > 1) {
val.arr = val.arr.filter((item) => item.id !== data.id)
} else {
message.error('至少需要提交一条能力申请!')
}
}) })
dataForm.value = dataForm.value.filter((val) => val.arr.length !== 0) dataForm.value = dataForm.value.filter((val) => val.arr.length !== 0)
} }