From 6156b0755e87006d06c3fd80da0e4e6d15a3aafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=AF=BA?= <1253070437@qq.com> Date: Sat, 22 Apr 2023 15:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=89=8D=E7=AB=AF=E6=9C=BA=E6=9E=84=E3=80=81=E8=81=8C?= =?UTF-8?q?=E4=BD=8D=E3=80=81=E8=A7=92=E8=89=B2=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=20=E9=80=89=E6=8B=A9=E5=99=A8=E7=9A=84=E5=86=85=E9=83=A8?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Selector/orgSelectorPlus.vue | 28 ++++++++------ .../components/Selector/posSelectorPlus.vue | 28 ++++++++------ .../components/Selector/roleSelectorPlus.vue | 38 ++++++++++--------- .../components/Selector/userSelectorPlus.vue | 28 ++++++++------ 4 files changed, 69 insertions(+), 53 deletions(-) diff --git a/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue b/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue index 20ce6076..3452f4d4 100644 --- a/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue +++ b/snowy-admin-web/src/components/Selector/orgSelectorPlus.vue @@ -27,12 +27,12 @@ - + - 查询 - 重置 + 查询 + 重置 @@ -134,7 +134,7 @@ // 选中表格的ref 名称 const selectedTable = ref() const tableRecordNum = ref() - let searchFormState = reactive({}) + const searchFormState = ref({}) const searchFormRef = ref() const cardLoading = ref(true) // 替换treeNode 中 title,key,children @@ -184,14 +184,11 @@ } // 查询主表格数据 const loadData = () => { - orgSelectorPlusApi.orgSelector(props.pageUrl, searchFormState).then((res) => { + orgSelectorPlusApi.orgSelector(props.pageUrl, searchFormState.value).then((res) => { // 总共多少条 tableRecordNum.value = res.length tableData.value = res - // 如果无查询条件,查询到已加载的 - if (JSON.stringify(searchFormState) === '{}') { - loadCheckedKey() - } + loadCheckedKey() }) } // 加载已选中的 @@ -254,9 +251,9 @@ // 点击树查询 const treeSelect = (selectedKeys) => { if (selectedKeys.length > 0) { - searchFormState.orgId = selectedKeys.toString() + searchFormState.value.orgId = selectedKeys.toString() } else { - delete searchFormState.orgId + delete searchFormState.value.orgId } loadData() } @@ -279,8 +276,15 @@ } handleClose() } + // 重置 + const reset = () => { + delete searchFormState.value.searchKey + loadData() + } const handleClose = () => { - searchFormState = reactive({}) + searchFormState.value = {} + tableRecordNum.value = 0 + tableData.value = [] visible = false } diff --git a/snowy-admin-web/src/components/Selector/posSelectorPlus.vue b/snowy-admin-web/src/components/Selector/posSelectorPlus.vue index 3b089483..0efc0cf9 100644 --- a/snowy-admin-web/src/components/Selector/posSelectorPlus.vue +++ b/snowy-admin-web/src/components/Selector/posSelectorPlus.vue @@ -27,12 +27,12 @@ - + - 查询 - 重置 + 查询 + 重置 @@ -134,7 +134,7 @@ // 选中表格的ref 名称 const selectedTable = ref() const tableRecordNum = ref() - let searchFormState = reactive({}) + const searchFormState = ref({}) const searchFormRef = ref() const cardLoading = ref(true) // 替换treeNode 中 title,key,children @@ -184,14 +184,11 @@ } // 查询主表格数据 const loadData = () => { - posSelectorPlusApi.posSelector(props.pageUrl, searchFormState).then((res) => { + posSelectorPlusApi.posSelector(props.pageUrl, searchFormState.value).then((res) => { // 总共多少条 tableRecordNum.value = res.length tableData.value = res - // 如果无查询条件,查询到已加载的 - if (JSON.stringify(searchFormState) === '{}') { - loadCheckedKey() - } + loadCheckedKey() }) } // 加载已选中的 @@ -254,9 +251,9 @@ // 点击树查询 const treeSelect = (selectedKeys) => { if (selectedKeys.length > 0) { - searchFormState.orgId = selectedKeys.toString() + searchFormState.value.orgId = selectedKeys.toString() } else { - delete searchFormState.orgId + delete searchFormState.value.orgId } loadData() } @@ -279,8 +276,15 @@ } handleClose() } + // 重置 + const reset = () => { + delete searchFormState.value.searchKey + loadData() + } const handleClose = () => { - searchFormState = reactive({}) + searchFormState.value = {} + tableRecordNum.value = 0 + tableData.value = [] visible = false } diff --git a/snowy-admin-web/src/components/Selector/roleSelectorPlus.vue b/snowy-admin-web/src/components/Selector/roleSelectorPlus.vue index 349fc925..32aea870 100644 --- a/snowy-admin-web/src/components/Selector/roleSelectorPlus.vue +++ b/snowy-admin-web/src/components/Selector/roleSelectorPlus.vue @@ -27,12 +27,12 @@ - + - 查询 - 重置 + 查询 + 重置 @@ -134,7 +134,7 @@ // 选中表格的ref 名称 const selectedTable = ref() const tableRecordNum = ref() - let searchFormState = reactive({}) + const searchFormState = ref({}) const searchFormRef = ref() const cardLoading = ref(true) // 替换treeNode 中 title,key,children @@ -229,16 +229,13 @@ const loadData = () => { // 如果不是用全局的,我们每次查询加上这个条件 if (!roleGlobal) { - searchFormState.category = 'ORG' + searchFormState.value.category = 'ORG' } - roleSelectorPlusApi.roleSelector(props.pageUrl, searchFormState).then((res) => { + roleSelectorPlusApi.roleSelector(props.pageUrl, searchFormState.value).then((res) => { // 总共多少条 tableRecordNum.value = res.length tableData.value = res - // 如果无查询条件,查询到已加载的 - if (JSON.stringify(searchFormState) === '{}') { - loadCheckedKey() - } + loadCheckedKey() }) } // 加载已选中的 @@ -302,15 +299,15 @@ const treeSelect = (selectedKeys) => { if (selectedKeys.length > 0) { if (selectedKeys[0] === 'GLOBAL') { - searchFormState.category = selectedKeys[0] - delete searchFormState.orgId + searchFormState.value.category = selectedKeys[0] + delete searchFormState.value.orgId } else { - searchFormState.orgId = selectedKeys.toString() - delete searchFormState.category + searchFormState.value.orgId = selectedKeys.toString() + delete searchFormState.value.category } } else { - delete searchFormState.category - delete searchFormState.orgId + delete searchFormState.value.category + delete searchFormState.value.orgId } loadData() } @@ -332,8 +329,15 @@ } handleClose() } + // 重置 + const reset = () => { + delete searchFormState.value.searchKey + loadData() + } const handleClose = () => { - searchFormState = reactive({}) + searchFormState.value = {} + tableRecordNum.value = 0 + tableData.value = [] visible = false } diff --git a/snowy-admin-web/src/components/Selector/userSelectorPlus.vue b/snowy-admin-web/src/components/Selector/userSelectorPlus.vue index f62936f2..df15e566 100644 --- a/snowy-admin-web/src/components/Selector/userSelectorPlus.vue +++ b/snowy-admin-web/src/components/Selector/userSelectorPlus.vue @@ -27,12 +27,12 @@ - + - 查询 - 重置 + 查询 + 重置 @@ -134,7 +134,7 @@ // 选中表格的ref 名称 const selectedTable = ref() const tableRecordNum = ref() - let searchFormState = reactive({}) + const searchFormState = ref({}) const searchFormRef = ref() const cardLoading = ref(true) // 替换treeNode 中 title,key,children @@ -184,14 +184,11 @@ } // 查询主表格数据 const loadData = () => { - userSelectorPlusApi.userSelector(props.pageUrl, searchFormState).then((res) => { + userSelectorPlusApi.userSelector(props.pageUrl, searchFormState.value).then((res) => { // 总共多少条 tableRecordNum.value = res.length tableData.value = res - // 如果无查询条件,查询到已加载的 - if (JSON.stringify(searchFormState) === '{}') { - loadCheckedKey() - } + loadCheckedKey() }) } // 加载已选中的 @@ -254,9 +251,9 @@ // 点击树查询 const treeSelect = (selectedKeys) => { if (selectedKeys.length > 0) { - searchFormState.orgId = selectedKeys.toString() + searchFormState.value.orgId = selectedKeys.toString() } else { - delete searchFormState.orgId + delete searchFormState.value.orgId } loadData() } @@ -279,8 +276,15 @@ } handleClose() } + // 重置 + const reset = () => { + delete searchFormState.value.searchKey + loadData() + } const handleClose = () => { - searchFormState = reactive({}) + searchFormState.value = {} + tableRecordNum.value = 0 + tableData.value = [] visible = false }