mirror of
https://gitee.com/xiaonuobase/snowy.git
synced 2026-03-22 02:37:16 +08:00
【优化】table组件查询取消选中、Editor校验修复
This commit is contained in:
@@ -434,14 +434,16 @@
|
|||||||
|
|
||||||
// 刷新
|
// 刷新
|
||||||
const refresh = (bool = false) => {
|
const refresh = (bool = false) => {
|
||||||
bool &&
|
if (bool) {
|
||||||
(data.localPagination = Object.assign(
|
data.localPagination = Object.assign(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: data.localPagination.pageSize
|
pageSize: data.localPagination.pageSize
|
||||||
}
|
}
|
||||||
))
|
)
|
||||||
|
clearSelected()
|
||||||
|
}
|
||||||
loadData()
|
loadData()
|
||||||
getTableProps()
|
getTableProps()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-popconfirm
|
|
||||||
title="删除此信息?"
|
|
||||||
:open="deleteVisible"
|
|
||||||
@openChange="deleteVisibleChange"
|
|
||||||
@confirm="deleteBatch"
|
|
||||||
>
|
|
||||||
<a-button danger>
|
|
||||||
<template #icon><delete-outlined /></template>
|
|
||||||
{{ props.buttonName }}
|
|
||||||
</a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup name="commonBatchDelete">
|
|
||||||
import { message } from 'ant-design-vue'
|
|
||||||
const deleteVisible = ref(false)
|
|
||||||
const emit = defineEmits({ batchDelete: null })
|
|
||||||
const props = defineProps({
|
|
||||||
buttonName: {
|
|
||||||
type: String,
|
|
||||||
default: () => '批量删除'
|
|
||||||
},
|
|
||||||
selectedRowKeys: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 参数校验
|
|
||||||
const deleteVisibleChange = () => {
|
|
||||||
if (deleteVisible.value) {
|
|
||||||
deleteVisible.value = false
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (props.selectedRowKeys.length < 1) {
|
|
||||||
message.warning('请选择一条或多条数据')
|
|
||||||
deleteVisible.value = false
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
deleteVisible.value = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 批量删除
|
|
||||||
const deleteBatch = () => {
|
|
||||||
const params = props.selectedRowKeys.map((m) => {
|
|
||||||
return {
|
|
||||||
id: m
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 发起方法调用,谁的谁来实现
|
|
||||||
emit('batchDelete', params)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -14,8 +14,9 @@
|
|||||||
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
||||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||||
import fileApi from '@/api/dev/fileApi'
|
import fileApi from '@/api/dev/fileApi'
|
||||||
|
import { Form } from 'ant-design-vue'
|
||||||
|
|
||||||
const emit = defineEmits(['update:value'])
|
const emit = defineEmits(['update:value', 'change', 'blur'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
@@ -41,6 +42,8 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const formItemContext = Form.useInjectFormItemContext()
|
||||||
|
|
||||||
// 编辑器实例,必须用 shallowRef
|
// 编辑器实例,必须用 shallowRef
|
||||||
const editorRef = shallowRef()
|
const editorRef = shallowRef()
|
||||||
const toolbarConfig = {}
|
const toolbarConfig = {}
|
||||||
@@ -105,7 +108,18 @@
|
|||||||
)
|
)
|
||||||
// 监听输入
|
// 监听输入
|
||||||
watch(contentValue, (newValue) => {
|
watch(contentValue, (newValue) => {
|
||||||
emit('update:value', newValue)
|
let value = newValue
|
||||||
|
// 校验是否为空,如果为空则设置为'',否则表单校验会认为有值
|
||||||
|
if (editorRef.value && editorRef.value.isEmpty()) {
|
||||||
|
value = ''
|
||||||
|
} else if (newValue === '<p><br></p>') {
|
||||||
|
value = ''
|
||||||
|
}
|
||||||
|
emit('update:value', value)
|
||||||
|
emit('change', value)
|
||||||
|
nextTick(() => {
|
||||||
|
formItemContext.onFieldChange()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
// 记录 editor 实例,重要!
|
// 记录 editor 实例,重要!
|
||||||
const handleCreated = (editor) => {
|
const handleCreated = (editor) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user