基础资料,表格刷新问题

main
GaoF 2024-08-02 09:25:37 +08:00
parent 8eff8f1952
commit 6e55926994
8 changed files with 40 additions and 18 deletions

View File

@ -25,7 +25,7 @@
class="s-tool-item" class="s-tool-item"
v-if="item.name === 'refresh' && props.toolConfig.refresh" v-if="item.name === 'refresh' && props.toolConfig.refresh"
> >
<component class="icons" :is="item.icon" @click="loadTreeData()"></component> <component class="icons" :is="item.icon" @click="handleRefresh"></component>
</a-tooltip> </a-tooltip>
</span> </span>
</div> </div>
@ -91,7 +91,7 @@
} }
}) })
const emit = defineEmits(['selectTree', 'delTree']) const emit = defineEmits(['selectTree', 'delTree', 'treeRefresh'])
const tool = [ const tool = [
{ {
@ -154,11 +154,15 @@
}) })
} }
const handleRefresh = () => {
loadTreeData()
emit('treeRefresh')
}
const loadTreeData = async () => { const loadTreeData = async () => {
try { try {
localLoading.value = true localLoading.value = true
const treeRes = await props.apiModel.getTree() const treeRes = await props.apiModel.getTree()
console.log(treeRes, 'treeRes')
if (Array.isArray(treeRes)) { if (Array.isArray(treeRes)) {
treeData.value[0].children = treeRes treeData.value[0].children = treeRes
} else { } else {
@ -168,7 +172,7 @@
if (selectedKeys.value.length > 0) { if (selectedKeys.value.length > 0) {
selectedKeys.value = [] selectedKeys.value = []
props.tableRef.refresh() // props.tableRef.refresh()
} }
if (treeRow.id) { if (treeRow.id) {

View File

@ -42,7 +42,7 @@
</a-menu> </a-menu>
</template> </template>
</a-dropdown> </a-dropdown>
<div v-if="setDrawer === 'true'" class="setting panel-item" @click="openSetting"> <div class="setting panel-item" @click="openSetting">
<layout-outlined /> <layout-outlined />
</div> </div>
</div> </div>

View File

@ -43,6 +43,7 @@
}" }"
@selectTree="selectTree" @selectTree="selectTree"
@delTree="delTree" @delTree="delTree"
@treeRefresh="treeRefresh"
></dynamic-tree> ></dynamic-tree>
</a-col> </a-col>
<a-col :span="18"> <a-col :span="18">
@ -228,6 +229,11 @@
tableRef.value.refresh() tableRef.value.refresh()
} }
const treeRefresh = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
}
const successful = () => { const successful = () => {
searchFormState.value.categoryId = null searchFormState.value.categoryId = null
tableRef.value.refresh() tableRef.value.refresh()

View File

@ -43,6 +43,7 @@
}" }"
@selectTree="selectTree" @selectTree="selectTree"
@delTree="delTree" @delTree="delTree"
@treeRefresh="treeRefresh"
></dynamic-tree> ></dynamic-tree>
</a-col> </a-col>
<a-col :span="18"> <a-col :span="18">
@ -178,6 +179,11 @@
tableRef.value.refresh() tableRef.value.refresh()
} }
const treeRefresh = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
}
const delTree = () => { const delTree = () => {
searchFormState.value.categoryId = null searchFormState.value.categoryId = null
tableRef.value.refresh() tableRef.value.refresh()

View File

@ -41,6 +41,7 @@
delTree: sysStoreApi.productionOrganizationDelete delTree: sysStoreApi.productionOrganizationDelete
}" }"
@selectTree="onSelectTree" @selectTree="onSelectTree"
@treeRefresh="treeRefresh"
:toolConfig="{ :toolConfig="{
plus: false, plus: false,
edit: false, edit: false,
@ -222,6 +223,11 @@
tableRef.value.refresh() tableRef.value.refresh()
} }
const treeRefresh = () => {
searchFormState.value.parentId = null
tableRef.value.refresh()
}
onMounted(() => { onMounted(() => {
dynamicTreeRef.value.loadTreeData() dynamicTreeRef.value.loadTreeData()
}) })

View File

@ -56,6 +56,7 @@
}" }"
@selectTree="onSelectTree" @selectTree="onSelectTree"
@delTree="delTree" @delTree="delTree"
@treeRefresh="treeRefresh"
:toolConfig="{ :toolConfig="{
plus: false, plus: false,
edit: false, edit: false,
@ -222,6 +223,11 @@
tableRef.value.refresh() tableRef.value.refresh()
} }
const treeRefresh = () => {
searchFormState.value.parentId = null
tableRef.value.refresh()
}
const successful = () => { const successful = () => {
searchFormState.value.parentId = null searchFormState.value.parentId = null
tableRef.value.refresh() tableRef.value.refresh()

View File

@ -23,11 +23,6 @@
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12">
<a-form-item label="字段类型:" name="fieldType">
<a-input v-model:value="formData.fieldType" placeholder="请输入字段名" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="展示形式:" name="showType"> <a-form-item label="展示形式:" name="showType">
<a-select <a-select
@ -54,7 +49,7 @@
<a-col <a-col
:span="24" :span="24"
v-if="formData.showType && formData.showType !== 'input' && formData.showType !== 'inputNumber'" v-if="formData.showType && formData.showType !== 'a-input' && formData.showType !== 'a-input-number'"
> >
<h3>扩展数据</h3> <h3>扩展数据</h3>
<div v-for="(item, index) in selectableData" :key="index" class="mb-2"> <div v-for="(item, index) in selectableData" :key="index" class="mb-2">
@ -139,15 +134,14 @@
// //
const formRules = { const formRules = {
name: [required('请输入名称')], name: [required('请输入名称')],
fieldType: [required('请输入类型')],
model: [required('请输入模块')] model: [required('请输入模块')]
} }
// //
const onSubmit = () => { const onSubmit = () => {
if ( if (
formData.value.showType === 'select' && formData.value.showType === 'a-select' &&
formData.value.showType === 'radio' && formData.value.showType === 'a-radio-group' &&
formData.value.showType === 'checkbox' && formData.value.showType === 'a-checkbox-group' &&
selectableData.value.length === 0 selectableData.value.length === 0
) { ) {
return message.error('请添加选项要展示的数据') return message.error('请添加选项要展示的数据')
@ -156,7 +150,7 @@
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
submitLoading.value = true submitLoading.value = true
const formDataParam = cloneDeep(formData.value) const formDataParam = cloneDeep(formData.value)
if (formDataParam.showType === 'input' || formDataParam.showType === 'inputNumber') { if (formDataParam.showType === 'a-input' || formDataParam.showType === 'a-input-number') {
formDataParam.showValues = '' formDataParam.showValues = ''
} else { } else {
formDataParam.showValues = JSON.stringify(selectableData.value) formDataParam.showValues = JSON.stringify(selectableData.value)

View File

@ -62,10 +62,10 @@
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<a-space> <a-space>
<a @click="formRef.onOpen(record)" v-if="hasPerm('extendFieldEdit')"></a> <a @click="formRef.onOpen(record)" v-if="hasPerm('extendFieldEdit')"></a>
<a-divider type="vertical" v-if="hasPerm(['extendFieldEdit', 'extendFieldDelete'], 'and')" /> <!-- <a-divider type="vertical" v-if="hasPerm(['extendFieldEdit', 'extendFieldDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteExtendField(record)"> <a-popconfirm title="确定要删除吗?" @confirm="deleteExtendField(record)">
<a-button type="link" danger size="small" v-if="hasPerm('extendFieldDelete')"></a-button> <a-button type="link" danger size="small" v-if="hasPerm('extendFieldDelete')"></a-button>
</a-popconfirm> </a-popconfirm>-->
</a-space> </a-space>
</template> </template>
</template> </template>