|
|
|
@ -1,63 +1,124 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { useTaskStore } from '@/store/modules/task';
|
|
|
|
|
import { debounce } from 'lodash-es';
|
|
|
|
|
import { computed, ref, unref, watch } from 'vue';
|
|
|
|
|
import CustomFieldModal from '../modal/CustomFieldModal.vue';
|
|
|
|
|
import { useTaskStore } from "@/store/modules/task";
|
|
|
|
|
import { debounce } from "lodash-es";
|
|
|
|
|
import { computed, onMounted, ref, unref, watch } from "vue";
|
|
|
|
|
import CustomFieldModal from "../modal/CustomFieldModal.vue";
|
|
|
|
|
|
|
|
|
|
import { useUser } from "@/store/modules/user";
|
|
|
|
|
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
|
|
|
|
|
|
|
|
|
|
import TaskList from './TaskList.vue';
|
|
|
|
|
import TaskList from "./TaskList.vue";
|
|
|
|
|
|
|
|
|
|
const CustomFieldModalRef = ref(null)
|
|
|
|
|
const collapse = ref(false)
|
|
|
|
|
const taskStore = useTaskStore()
|
|
|
|
|
const taskListRef = ref<HTMLDivElement | null>(null)
|
|
|
|
|
const CustomFieldModalRef = ref(null);
|
|
|
|
|
const collapse = ref(false);
|
|
|
|
|
const taskStore = useTaskStore();
|
|
|
|
|
const taskListRef = ref<HTMLDivElement | null>(null);
|
|
|
|
|
// 展示字段
|
|
|
|
|
const showFieldList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
function collapseHandler() {
|
|
|
|
|
collapse.value = !collapse.value
|
|
|
|
|
collapse.value = !collapse.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const asideWidth = computed(() => {
|
|
|
|
|
return collapse.value ? 0 : 308
|
|
|
|
|
})
|
|
|
|
|
return collapse.value ? 0 : 308;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const asideStyle = computed(() => {
|
|
|
|
|
return {
|
|
|
|
|
width: `${asideWidth.value}px`,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const collapseIcon = computed(() => {
|
|
|
|
|
return collapse.value ? 'expand-cir' : 'collapse-cir'
|
|
|
|
|
})
|
|
|
|
|
return collapse.value ? "expand-cir" : "collapse-cir";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const asideEnter = ref(false)
|
|
|
|
|
const asideEnter = ref(false);
|
|
|
|
|
|
|
|
|
|
const showCollapse = computed(() => {
|
|
|
|
|
return collapse.value ? true : asideEnter.value
|
|
|
|
|
})
|
|
|
|
|
return collapse.value ? true : asideEnter.value;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(() => taskStore.immersion, () => {
|
|
|
|
|
collapse.value = true
|
|
|
|
|
})
|
|
|
|
|
watch(
|
|
|
|
|
() => taskStore.immersion,
|
|
|
|
|
() => {
|
|
|
|
|
collapse.value = true;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
function showFilter() {
|
|
|
|
|
const modal = unref(CustomFieldModalRef)! as any
|
|
|
|
|
modal.showModal()
|
|
|
|
|
const modal = unref(CustomFieldModalRef)! as any;
|
|
|
|
|
modal.showModal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showSearch = ref(false)
|
|
|
|
|
const showSearch = ref(false);
|
|
|
|
|
|
|
|
|
|
function setShowSearch(value: boolean) {
|
|
|
|
|
showSearch.value = value
|
|
|
|
|
showSearch.value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const inputHandler = debounce((word) => {
|
|
|
|
|
(taskListRef.value as any).search(word)
|
|
|
|
|
}, 500)
|
|
|
|
|
(taskListRef.value as any).search(word);
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
const reviewType = 2;
|
|
|
|
|
async function getshowFieldList() {
|
|
|
|
|
showFieldList.value = [];
|
|
|
|
|
const userStore = useUser();
|
|
|
|
|
const userInfo = userStore.getUserInfo;
|
|
|
|
|
let res;
|
|
|
|
|
res = await getAllfieldList(reviewType); //所有筛选项目
|
|
|
|
|
const allList = res.data;
|
|
|
|
|
res = await getfieldList(reviewType, userInfo.id); //当前用户选择的项目
|
|
|
|
|
const useList = res.data;
|
|
|
|
|
/**
|
|
|
|
|
* name 标题
|
|
|
|
|
* id 键值
|
|
|
|
|
* fix 是否默认
|
|
|
|
|
* checked 是否选中
|
|
|
|
|
*/
|
|
|
|
|
if (useList.userFieldFixed) {
|
|
|
|
|
useList.userFieldFixed?.split(",").map((v) => {
|
|
|
|
|
let item = allList.find((v2) => v2.name == v);
|
|
|
|
|
if (item) {
|
|
|
|
|
item = {
|
|
|
|
|
name: item.fieldDesc,
|
|
|
|
|
id: item.name,
|
|
|
|
|
fix: item.isrequired == 2,
|
|
|
|
|
checked: true,
|
|
|
|
|
};
|
|
|
|
|
showFieldList.value.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 若为首次获取 则赋默认值
|
|
|
|
|
allList.map((v) => {
|
|
|
|
|
if (v.isrequired == 2) {
|
|
|
|
|
let item = {
|
|
|
|
|
name: v.fieldDesc,
|
|
|
|
|
id: v.name,
|
|
|
|
|
fix: v.isrequired == 2,
|
|
|
|
|
checked: true,
|
|
|
|
|
};
|
|
|
|
|
showFieldList.value.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getshowFieldList();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="aside" :style="asideStyle" @mouseenter="asideEnter = true" @mouseleave="asideEnter = false">
|
|
|
|
|
<div
|
|
|
|
|
class="aside"
|
|
|
|
|
:style="asideStyle"
|
|
|
|
|
@mouseenter="asideEnter = true"
|
|
|
|
|
@mouseleave="asideEnter = false"
|
|
|
|
|
>
|
|
|
|
|
<div v-show="showCollapse" class="aside-collapse">
|
|
|
|
|
<div class="aside-collapse-btn" @click="collapseHandler">
|
|
|
|
|
<SvgIcon :name="collapseIcon" size="40" />
|
|
|
|
@ -67,27 +128,52 @@ const inputHandler = debounce((word) => {
|
|
|
|
|
<div v-show="!showSearch" class="warpper">
|
|
|
|
|
<div class="left">
|
|
|
|
|
<svg-icon name="all-worksheet" size="32" />
|
|
|
|
|
<span style="margin-left: 8px;">所有请求</span>
|
|
|
|
|
<span style="margin-left: 8px">所有请求</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right">
|
|
|
|
|
<SvgIcon
|
|
|
|
|
style="cursor: pointer;margin-left: 10px;" size="18" name="magnifying-1"
|
|
|
|
|
style="cursor: pointer; margin-left: 10px"
|
|
|
|
|
size="18"
|
|
|
|
|
name="magnifying-1"
|
|
|
|
|
@click="setShowSearch(true)"
|
|
|
|
|
/>
|
|
|
|
|
<SvgIcon style="cursor: pointer;margin-left: 10px;" size="18" name="filter" @click="showFilter" />
|
|
|
|
|
<SvgIcon
|
|
|
|
|
style="cursor: pointer; margin-left: 10px"
|
|
|
|
|
size="18"
|
|
|
|
|
name="filter"
|
|
|
|
|
@click="showFilter"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-show="showSearch" class="warpper">
|
|
|
|
|
<n-input style="flex: 1;height: 32px;" placeholder="请输入你需要搜索的内容" @input="inputHandler">
|
|
|
|
|
<n-input
|
|
|
|
|
style="flex: 1; height: 32px"
|
|
|
|
|
placeholder="请输入你需要搜索的内容"
|
|
|
|
|
@input="inputHandler"
|
|
|
|
|
>
|
|
|
|
|
<template #suffix>
|
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
|
</template>
|
|
|
|
|
</n-input>
|
|
|
|
|
<SvgIcon size="16px" style="margin-left: 6px;cursor: pointer;" name="clear" @click="setShowSearch(false)" />
|
|
|
|
|
<SvgIcon
|
|
|
|
|
size="16px"
|
|
|
|
|
style="margin-left: 6px; cursor: pointer"
|
|
|
|
|
name="clear"
|
|
|
|
|
@click="setShowSearch(false)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<TaskList ref="taskListRef" style="height: calc(100vh - 146px);" class="work-sheet-list" />
|
|
|
|
|
<CustomFieldModal ref="CustomFieldModalRef" :reviewType="2" />
|
|
|
|
|
<TaskList
|
|
|
|
|
ref="taskListRef"
|
|
|
|
|
:showFieldList="showFieldList"
|
|
|
|
|
style="height: calc(100vh - 146px)"
|
|
|
|
|
class="work-sheet-list"
|
|
|
|
|
/>
|
|
|
|
|
<CustomFieldModal
|
|
|
|
|
ref="CustomFieldModalRef"
|
|
|
|
|
:reviewType="reviewType"
|
|
|
|
|
@onOk="getshowFieldList"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -96,7 +182,7 @@ const inputHandler = debounce((word) => {
|
|
|
|
|
display: flex;
|
|
|
|
|
position: relative;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
background: #FFF;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border: 1px solid rgb(239, 239, 245);
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|