perf: 优化流水线页面切换回来不丢失查询条件

pull/243/head
xiaojunnuo 2024-11-08 10:51:41 +08:00
parent 028758c4e0
commit 4dcf6e87bc
5 changed files with 21 additions and 8 deletions

View File

@ -15,7 +15,8 @@ export const certdResources = [
path: "/certd/pipeline", path: "/certd/pipeline",
component: "/certd/pipeline/index.vue", component: "/certd/pipeline/index.vue",
meta: { meta: {
icon: "ion:analytics-sharp" icon: "ion:analytics-sharp",
cache: true
} }
}, },
{ {
@ -33,7 +34,8 @@ export const certdResources = [
path: "/certd/history", path: "/certd/history",
component: "/certd/history/index.vue", component: "/certd/history/index.vue",
meta: { meta: {
icon: "ion:timer-outline" icon: "ion:timer-outline",
cache: true
} }
}, },
{ {
@ -43,7 +45,8 @@ export const certdResources = [
component: "/certd/access/index.vue", component: "/certd/access/index.vue",
meta: { meta: {
icon: "ion:disc-outline", icon: "ion:disc-outline",
auth: true auth: true,
cache: true
} }
}, },
{ {

View File

@ -11,7 +11,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onMounted } from "vue"; import { defineComponent, onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { createAccessApi } from "/@/views/certd/access/api"; import { createAccessApi } from "/@/views/certd/access/api";
@ -26,6 +26,9 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(() => {
crudExpose.doRefresh();
});
return { return {
crudBinding, crudBinding,

View File

@ -14,7 +14,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from "vue"; import {onActivated, onMounted} from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
@ -47,5 +47,8 @@ const handleBatchDelete = () => {
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(() => {
crudExpose.doRefresh();
});
</script> </script>
<style lang="less"></style> <style lang="less"></style>

View File

@ -14,13 +14,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, onMounted } from "vue"; import { defineComponent, ref, onMounted, onActivated } from "vue";
import { useCrud, useFs } from "@fast-crud/fast-crud"; import { useCrud, useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { useExpose } from "@fast-crud/fast-crud"; import { useExpose } from "@fast-crud/fast-crud";
import PiCertdForm from "./certd-form/index.vue"; import PiCertdForm from "./certd-form/index.vue";
export default defineComponent({ export default defineComponent({
name: "PipelineManager1", name: "PipelineManager",
components: { PiCertdForm }, components: { PiCertdForm },
setup() { setup() {
const certdFormRef = ref(); const certdFormRef = ref();
@ -34,6 +34,10 @@ export default defineComponent({
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(() => {
crudExpose.doRefresh();
});
return { return {
crudBinding, crudBinding,
crudRef, crudRef,

View File

@ -37,7 +37,7 @@ export class PipelineController extends CrudController<PipelineService> {
const buildQuery = qb => { const buildQuery = qb => {
if (title) { if (title) {
qb.andWhere('title like :title', { title: `%${title}%` }); qb.andWhere('title like :title', { title: `%${title}%` }).orWhere('content like :content', { content: `%${title}%` });
} }
}; };
if (!body.sort || !body.sort?.prop) { if (!body.sort || !body.sort?.prop) {