feat: 高级筛选交互补全及逻辑优化

pull/45/head
刘释隆 2 years ago
parent d2d4e9cf90
commit 14f203c0ea

@ -147,7 +147,6 @@ function rowProps(row: RowData) {
} }
function handleCheck(rowKeys: DataTableRowKey[]) { function handleCheck(rowKeys: DataTableRowKey[]) {
console.log(rowKeys, selectionIds.value, "handleCheck");
selectionIds.value = rowKeys; selectionIds.value = rowKeys;
} }
@ -191,6 +190,7 @@ function deleteSelection(id = "") {
} }
deleteCondition({ ids: selectionIds.value.join(",") }).then(() => { deleteCondition({ ids: selectionIds.value.join(",") }).then(() => {
selectionIds.value = [];
query(pagination.page, pagination.pageSize); query(pagination.page, pagination.pageSize);
}); });
} }

@ -219,6 +219,7 @@ function deleteSelection(id = "") {
} }
deleteCondition({ ids: selectionIds.value.join(",") }).then(() => { deleteCondition({ ids: selectionIds.value.join(",") }).then(() => {
selectionIds.value = [];
query(pagination.page, pagination.pageSize); query(pagination.page, pagination.pageSize);
}); });
} }
@ -308,6 +309,10 @@ const inputHandler = debounce((word) => {
keyword.value = word; keyword.value = word;
query(1, 5); query(1, 5);
}, 300); }, 300);
const showSearch = computed(() => {
return selectionIds.value.length > 0;
});
</script> </script>
<template> <template>
@ -336,27 +341,49 @@ const inputHandler = debounce((word) => {
> >
</div> </div>
</div> </div>
<div class="wrapper-form">
<div class="wrapper-form" v-if="!showSearch">
<n-input <n-input
:style="{ width: '360px', border: '1px solid #cad2dd' }" :style="{ width: '360px', border: '1px solid #cad2dd' }"
placeholder="请输入过滤条件名称搜索" placeholder="请输入过滤条件名称搜索"
@input="inputHandler" @input="inputHandler"
> >
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1" color="#fff" /> <SvgIcon size="14px" name="magnifying-1" />
</template> </template>
</n-input> </n-input>
<n-button type="info" style="background: #507afd" @click="handleClick"> <n-button type="info" @click="handleClick">
创建 创建
<template #icon> <template #icon>
<img <SvgIcon size="14px" name="magnifying-1" />
src="../../../../../assets/images/addIcon.png"
style="width: 16px; height: 16px"
/>
</template> </template>
</n-button> </n-button>
</div> </div>
<div class="wrapper-form" v-else>
<div class="del_btn">
<n-button icon-placement="left" size="medium" @click="deleteSelection">
<template #icon>
<SvgIcon name="delete-history" size="16" />
</template>
删除</n-button
>
</div>
<div class="msg">
<span
>已选中
<span style="color: #507afd; font-size: 16px">{{
selectionIds.length
}}</span>
</span
>
<a @click="selectionIds = []">清空</a>
</div>
</div>
<div class="wrapper-table"> <div class="wrapper-table">
<NDataTable <NDataTable
ref="tableRef" ref="tableRef"
@ -372,6 +399,7 @@ const inputHandler = debounce((word) => {
@update-page-size="handlePageSizeChange" @update-page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck" @update:checked-row-keys="handleCheck"
@update:sorter="sortData" @update:sorter="sortData"
:checked-row-keys="selectionIds"
/> />
</div> </div>
</div> </div>

@ -178,11 +178,15 @@ function handleSubmit(e) {
const { data: userInfo } = await userStore.getInformation(); const { data: userInfo } = await userStore.getInformation();
message.destroyAll(); message.destroyAll();
const toPath = decodeURIComponent((route.query?.redirect || "/") as string); const toPath = decodeURIComponent((route.query?.redirect || "/") as string);
message.success("登录成功,即将进入系统");
if (route.name === LOGIN_NAME) if (route.name === LOGIN_NAME)
if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) {
message.success("登录成功,即将进入系统");
router.replace( router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/"
); );
} else {
message.error("用户无菜单权限,请联系管理员");
}
else router.replace(toPath); else router.replace(toPath);
} else { } else {
loginSuccess.value = false; loginSuccess.value = false;
@ -249,12 +253,18 @@ function handleSmsSubmit(e) {
const { data: userInfo } = await userStore.getInformation(); const { data: userInfo } = await userStore.getInformation();
message.destroyAll(); message.destroyAll();
const toPath = decodeURIComponent((route.query?.redirect || "/") as string); const toPath = decodeURIComponent((route.query?.redirect || "/") as string);
if (route.name === LOGIN_NAME) {
if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) {
message.success("登录成功,即将进入系统"); message.success("登录成功,即将进入系统");
if (route.name === LOGIN_NAME)
router.replace( router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/"
); );
else router.replace(toPath); } else {
message.error("用户无菜单权限,请联系管理员");
}
} else {
router.replace(toPath);
}
} else { } else {
message.destroyAll(); message.destroyAll();
message.info(msg || "登录失败"); message.info(msg || "登录失败");
@ -300,10 +310,10 @@ async function sendCode(value) {
phone: formSms.phone, phone: formSms.phone,
agentcode: formSms.agentcode, agentcode: formSms.agentcode,
}); });
if(res.code == 'OK'){ if (res.code == "OK") {
startCount(); startCount();
}else{ } else {
message.error(res.message) message.error(res.message);
} }
} }

@ -645,7 +645,7 @@ function switchBatch() {
@reject="rejectHandler" @reject="rejectHandler"
@approval="approvalHandler" @approval="approvalHandler"
/> />
<CustomSettingModal ref="CustomSettingModalRef" /> <CustomSettingModal ref="CustomSettingModalRef" @onOk="getDetail"/>
</div> </div>
</template> </template>

Loading…
Cancel
Save