Merge pull request 'feat: 样式补全及逻辑优化' (#207) from feat/allSearch_style into test

Reviewed-on: #207
pull/209/head
刘释隆 1 year ago
commit 2eccbba7d2

@ -1,17 +1,18 @@
<script lang="ts" setup>
import { dateZhCN, zhCN, NModalProvider } from "naive-ui";
import { computed, onMounted, nextTick, inject } from "vue";
import { AppProvider } from "@/components/Application";
import { lighten } from "@/utils/index";
import mouseTrapBind from "@/hooks/event/mouseTrapBind";
const mousetrap = inject("mousetrap") as any;
import { NModalProvider, dateZhCN, zhCN } from 'naive-ui'
import { computed, inject, nextTick, onMounted } from 'vue'
import { AppProvider } from '@/components/Application'
import { lighten } from '@/utils/index'
import mouseTrapBind from '@/hooks/event/mouseTrapBind'
const mousetrap = inject('mousetrap') as any
onMounted(() => {
mouseTrapBind(mousetrap);
});
mouseTrapBind(mousetrap)
})
const getThemeOverrides = computed(() => {
const theme = "#1980FF";
const lightenStr = lighten(theme, 6);
const theme = '#1980FF'
const lightenStr = lighten(theme, 6)
return {
common: {
@ -21,34 +22,34 @@ const getThemeOverrides = computed(() => {
primaryColorSuppl: theme,
},
Switch: {
railColorActive: "#07C984",
railColorActive: '#07C984',
},
Input: {
borderHover: "0px",
borderFocus: "0px",
boxShadowFocus: "#ff0000",
borderHover: '0px',
borderFocus: '0px',
boxShadowFocus: '#ff0000',
},
Tag: {
colorCheckedHover: "#507afd",
colorCheckedPressed: "#507afd",
colorCheckedHover: '#507afd',
colorCheckedPressed: '#507afd',
},
Slider: {
fillColor: "#1980FF",
dotBorderActive: "#1980FF",
fillColorHover: "#1980FF",
fillColor: '#1980FF',
dotBorderActive: '#1980FF',
fillColorHover: '#1980FF',
},
Card: {
padding: "0px",
padding: '0px',
},
Dropdown: {
optionColorHover: "#e8f2ff",
optionColorHover: '#e8f2ff',
},
Upload: {
draggerBorder: "1px dashed #1980FF",
draggerBorderHover: "1px dashed #1980FF",
draggerBorder: '1px dashed #1980FF',
draggerBorderHover: '1px dashed #1980FF',
},
};
});
}
})
</script>
<template>
@ -81,13 +82,13 @@ const getThemeOverrides = computed(() => {
::v-deep(.n-base-clear > .n-base-clear__clear) {
color: #c9c9c9 !important;
}
.n-form-item.n-form-item--top-labelled .n-form-item-label {
flex-direction: row-reverse !important;
justify-content: flex-end !important;
}
.n-form-item .n-form-item-label .n-form-item-label__asterisk {
transform: rotate(-90deg) !important;
}
// .n-form-item.n-form-item--top-labelled .n-form-item-label {
// flex-direction: row-reverse !important;
// justify-content: flex-end !important;
// }
// .n-form-item .n-form-item-label .n-form-item-label__asterisk {
// transform: rotate(-90deg) !important;
// }
.n-scrollbar-content {
padding: 0 7.97px 0 4px;
}

@ -1,10 +1,12 @@
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { defineEmits, reactive, ref } from 'vue'
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
import { debounce } from 'lodash-es'
import { queryNote, saveNote } from '@/api/home/main'
const emit = defineEmits(['close'])
const quillEditor = ref()
const cardStyle = {
@ -27,12 +29,14 @@ const options = reactive({
})
function initHandler() {
queryNote().then((res) => {
queryNote()
.then((res) => {
if (res.data)
note.value = res.data.notecontent
console.log('note:', note.value)
}).catch(e => console.log(e))
})
.catch(e => console.log(e))
}
const saveHandler = debounce(() => {
@ -44,9 +48,17 @@ const saveHandler = debounce(() => {
<template>
<div>
<n-card :style="cardStyle" :bordered="false" class="mt-4 proCard">
<div class="top_box">
<div class="title">
备注信息
</div>
<SvgIcon
size="24"
name="close-none-border"
class="close_box"
@click="emit('close')"
/>
</div>
<QuillEditor
ref="quillEditor"
v-model:content="note"
@ -62,15 +74,25 @@ const saveHandler = debounce(() => {
</template>
<style lang="less" scoped>
.title{
.top_box {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: space-between;
.close_box {
cursor: pointer;
margin-bottom: 25px;
}
}
.title {
font-size: 18px;
font-family: PingFang SC, PingFang SC-Medium;
font-weight: Medium;
color: #333333;
margin-bottom: 24px;
}
}
.ql-toolbar.ql-snow {
.ql-toolbar.ql-snow {
border-top: none;
border-left: none;
border-right: none;
@ -78,9 +100,9 @@ const saveHandler = debounce(() => {
margin-top: -10px;
background: #f8f8f8;
border: 1px solid #d8d8d8;
}
}
.ql-container.ql-snow {
.ql-container.ql-snow {
border: 1px solid #d8d8d8;
}
}
</style>

@ -91,6 +91,8 @@ function highlightText(text, query) {
}
onMounted(() => {
setTimeout(() => (value.value = ''))
handlerShowList()
handlerSearch('')
})
</script>
@ -114,7 +116,7 @@ onMounted(() => {
</div>
<div v-show="showList && (historyList.length || resultList.length)" class="list_box">
<div
v-if="historyList.length"
v-if="historyList.length && !value"
class="list_classfiy_item"
style="border-bottom: 1px solid #e4e4e4"
>

@ -24,11 +24,9 @@ defineExpose({
<template>
<div>
<n-modal v-model:show="show" transform-origin="center">
<Quill />
<Quill @close="show = false" />
</n-modal>
</div>
</template>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

@ -9,7 +9,9 @@ export function hideDownload(e: MouseEvent) {
const downloadEle: any = document.querySelector('.n-image-preview-toolbar')?.children[5]
const asideValue = unref(configStore.getAsideValue)
const download = asideValue?.izimgdownload
if (downloadEle && downloadEle.innerHTML === downloadSvg && download === false)
// TODO 判断条件调整
// if (downloadEle && downloadEle.innerHTML === downloadSvg && download === false)
if (downloadEle && !download)
downloadEle.style.display = 'none'
else
downloadEle.style.display = 'block'

@ -173,7 +173,8 @@ nextTick(() => {
Object.keys(config).forEach((key) => {
if (key.startsWith('iz') && asideMap[key] !== undefined) {
asideVisible[key]
= (showKeys.includes(key) || asideMap[key].isDefaultFilter) && config[key] === 'Y'
= (showKeys.includes(key) || asideMap[key].isDefaultFilter)
&& config[key] === 'Y'
}
})
if (customObjRef.value) {
@ -308,6 +309,7 @@ function inputChange(keyword) {
}
function handleOk(item: any) {
console.log('handleOk', item)
// .setCurrentlySelectedAdvanced(item.searchname)
if (item) {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname)
filterHandler(item.id)
@ -407,7 +409,7 @@ function updateComponent(key, e) {
width: 100%;
border-bottom: 1px solid #e8e8e8;
margin-bottom: 15px;
height: 58px
height: 58px;
}
&-divider {

@ -1,46 +1,51 @@
<script lang="ts" setup>
import { debounce, difference } from 'lodash-es'
import { computed, ref, watch, onMounted } from 'vue'
import { cloneDeep, debounce, difference, isEqual } from 'lodash-es'
import { computed, onMounted, ref, watch } from 'vue'
import { VueDraggable } from 'vue-draggable-plus'
import { setFilter } from '@/api/home/filter'
import { asideMap } from '@/config/final'
import { useFinal } from '@/store/modules/final'
import { cloneDeep, isEqual } from "lodash-es";
const show = ref(false)
const finalStore = useFinal()
const checkAll = ref(false)
const selectIds = ref<string[]>([])
const tempList = ref<string[]>([])
let extraCustomConfig :any = [];
const extraCustomConfig: any = []
//
const offList = ref<any[]>([])
//
const onList = ref<any[]>([])
const allCount = computed(() => {
return `全部筛选(共${offList.value.length}个)`
})
const selectCount = computed(() => {
return `已选筛选(共${onList.value.length}个)`
})
const offKeyword = ref('')
const onKeyword = ref('')
Object.keys(asideMap).forEach((key) => {
const { isDefaultFilter } = asideMap[key];
if (isDefaultFilter) {
extraCustomConfig.push(key);
}
});
const { isDefaultFilter } = asideMap[key]
if (isDefaultFilter)
extraCustomConfig.push(key)
})
function showModal() {
show.value = true
//
const config = finalStore.getSystemConfig
const customConfig = finalStore.getCustomConfig
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',config, customConfig)
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',tempList.value, finalStore.getFilterConfig)
if (config == null || customConfig == null)
return
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
return
const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList)
console.log("tempList.value开启了lllllllllllllllllll", showList, hideList);
if (tempList.value.length > 0)
finalStore.setFilterConfig(tempList.value)
onList.value = showList
offList.value = hideList
//
@ -51,22 +56,11 @@ function showModal() {
}
function closeModal() {
offKeyword.value = ''
onKeyword.value = ''
show.value = false
}
//
const offList = ref<any[]>([])
//
const onList = ref<any[]>([])
const allCount = computed(() => {
return `全部筛选(共${offList.value.length}个)`
})
const selectCount = computed(() => {
return `已选筛选(共${onList.value.length}个)`
})
defineExpose({
showModal,
})
@ -94,16 +88,13 @@ function generateDefaultList(config) {
function generatList(config, customConfig) {
const keys = Object.keys(config)
let onList: object[] = []
let offList: any = []
let showKeys = [];
const tempShowKeys = [...customConfig, ...extraCustomConfig];
tempShowKeys.map(item => {
if(!showKeys.includes(item)) {
showKeys.push(item);
}
});
console.log('原始筛选条件showKeys', showKeys)
console.log('原始筛选条件config customConfig', config, customConfig)
const offList: any = []
const showKeys = []
const tempShowKeys = [...customConfig, ...extraCustomConfig]
tempShowKeys.forEach((item) => {
if (!showKeys.includes(item))
showKeys.push(item)
})
// for (const key of keys) {
// if (!key.startsWith('iz') || config[key] === 'N' || asideMap[key] === undefined)
// continue
@ -125,7 +116,7 @@ function generatList(config, customConfig) {
// isChecked && selectIds.value.push(key)
// }
// }
Object.keys(asideMap).map(key => {
Object.keys(asideMap).forEach((key) => {
const name = asideMap[key]?.label
const isDefaultFilter = asideMap[key]?.isDefaultFilter
@ -161,43 +152,30 @@ function generatList(config, customConfig) {
return acc
}
}, [])
console.log('原始筛选条件onList', onList)
const fixedList = generateDefaultList(config)
// offList.unshift(...fixedList)
console.log('原始筛选条件fixedList', fixedList)
onList.unshift(...fixedList)
console.log('原始筛选条件customConfig', customConfig)
// onListcustomConfig
const tempOnList = cloneDeep(onList)
console.log('原始筛选条件tempOnList', tempOnList)
const sortKeyList: any = []
finalStore.getFilterConfig.map((item: any) => {
console.log("tFilterConfig item000000000000000", item);
finalStore.getFilterConfig.forEach((item: any) => {
sortKeyList.push(item.id)
})
console.log('原始筛选条件sortKeyList', sortKeyList)
console.log('原始筛选条件showKeys', showKeys)
const sortList: any = []
if (sortKeyList.length > 0) {
sortKeyList.map((key) => {
sortKeyList.forEach((key) => {
const tempItem = tempOnList.find(item => item.id == key)
if(tempItem) {
if (tempItem)
sortList.push(tempItem)
}
})
}
else {
showKeys.map((key) => {
showKeys.forEach((key) => {
const tempItem = tempOnList.find(item => item.id == key)
if(tempItem) {
if (tempItem)
sortList.push(tempItem)
}
})
}
console.log('原始筛选条件showList', sortList)
console.log('原始筛选条件hideList', offList)
console.log('原始筛选条件configStore.getFilterConfig', finalStore.getFilterConfig)
// return { showList: onList, hideList: offList }
return { showList: sortList, hideList: offList }
}
@ -208,48 +186,36 @@ finalStore.$subscribe(() => {
if (config == null || customConfig == null)
return
console.log('订阅tempList.value-----------', tempList.value)
console.log('订阅finalStore.getFilterConfig-----------', finalStore.getFilterConfig)
if (tempList.value.length > 0 && isEqual(tempList.value, finalStore.getFilterConfig))
return
const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList)
console.log('订阅克隆条件', tempList.value)
if (tempList.value.length > 0)
finalStore.setFilterConfig(tempList.value)
// setTimeout(() => {
// }, 500);
console.log('订阅showList, hideList-----------', showList, hideList)
onList.value = showList
offList.value = hideList
})
async function handleSumbit(e: MouseEvent) {
e.preventDefault()
const param = onList.value.map((item) => {
const param = onList.value
.map((item) => {
return item.id
}).join(',')
})
.join(',')
await setFilter({ searchcount: param, type: 1 })
const obj = await finalStore.fetchCustomConfig()
console.log('obj-------------------------------', obj)
const tempOnList = cloneDeep(onList.value)
console.log('提交筛选条件tempOnList', tempOnList)
const sortList: any = []
obj.map((key) => {
obj.forEach((key) => {
const tempItem = tempOnList.find(item => item.id == key)
if(tempItem) {
if (tempItem)
sortList.push(tempItem)
}
})
console.log('finalStore.sortList提交---------------', sortList)
// setTimeout(() => {
if (sortList.length > 0)
finalStore.setFilterConfig(sortList)
// }, 500);
closeModal()
}
@ -273,8 +239,7 @@ function onCheckChange(checked: any, item: any) {
if (index === -1 && checked)
selectIds.value.push(item.id)
else
index !== -1 && selectIds.value.splice(index, 1)
else index !== -1 && selectIds.value.splice(index, 1)
checkAll.value = offList.value.every(item => item.checked)
}
@ -292,7 +257,10 @@ watch(
return
const action = newVal > oldVal ? 'add' : 'remove'
const diff = action === 'add' ? difference(selectIds.value, showIds.value) : difference(showIds.value, selectIds.value)
const diff
= action === 'add'
? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value)
if (diff.length === 0)
return
@ -359,9 +327,6 @@ function removeHandler(id: string) {
onList.value.splice(index, 1)
}
const offKeyword = ref('')
const onKeyword = ref('')
const leftInputHandler = debounce((keyword) => {
offKeyword.value = keyword
}, 300)
@ -390,7 +355,13 @@ onMounted(() => {
<template>
<n-modal v-model:show="show" transform-origin="center" :mask-closable="false">
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
<n-card
class="cardstyle"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<div class="wrapper">
<span class="wrapper-title">自定义筛选</span>
<div class="wrapper-bar">
@ -402,7 +373,10 @@ onMounted(() => {
<n-grid cols="24" class="mt-4 proCard" responsive="screen" :x-gap="24">
<n-grid-item span="11">
<NCard
:title="allCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
:title="allCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<div class="input_wrap">
@ -411,17 +385,29 @@ onMounted(() => {
<SvgIcon size="14px" name="magnifying-1-color999" />
</template>
</n-input>
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;">
<n-scrollbar
style="max-height: 500px; border: 1px solid #cad2dd; border-radius: 2px"
>
<div class="draggable-ul">
<div class="draggable-li">
<n-checkbox v-model:checked="checkAll" label="全选" :indeterminate="!checkAll" @update:checked="onCheckAllChange" />
<n-checkbox
v-model:checked="checkAll"
label="全选"
:indeterminate="!checkAll"
@update:checked="onCheckAllChange"
/>
</div>
<div
v-for="item in offList" v-show="item.name.includes(offKeyword)" :key="item.id" :class="{ 'disable-check': item.fix }"
v-for="item in offList"
v-show="item.name.includes(offKeyword)"
:key="item.id"
:class="{ 'disable-check': item.fix }"
class="draggable-li"
>
<n-checkbox
v-model:checked="item.checked" :label="item.name" :disabled="item.fix"
v-model:checked="item.checked"
:label="item.name"
:disabled="item.fix"
@update:checked="onCheckChange($event, item)"
/>
</div>
@ -430,12 +416,15 @@ onMounted(() => {
</div>
</NCard>
</n-grid-item>
<n-grid-item style="display: flex;align-items: center;" span="2">
<n-grid-item style="display: flex; align-items: center" span="2">
<SvgIcon size="20" name="switchsvg" />
</n-grid-item>
<n-grid-item span="11">
<NCard
:title="selectCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
:title="selectCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<template #header-extra>
@ -447,14 +436,31 @@ onMounted(() => {
<SvgIcon size="14px" name="magnifying-1-color999" />
</template>
</n-input>
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;" class="scroll">
<VueDraggable v-model="onList" class="draggable-ul" :animation="150" group="shared">
<div v-for="item in onList" v-show="item.name.includes(onKeyword)" :key="item.id" :draggable="true" class="cursor-move draggable-li">
<n-scrollbar
style="max-height: 500px; border: 1px solid #cad2dd; border-radius: 2px"
class="scroll"
>
<VueDraggable
v-model="onList"
class="draggable-ul"
:animation="150"
group="shared"
>
<div
v-for="item in onList"
v-show="item.name.includes(onKeyword)"
:key="item.id"
:draggable="true"
class="cursor-move draggable-li"
>
<SvgIcon name="drag" size="24" />
<span class="ml-2">{{ item.name }}</span>
<SvgIcon
v-if="!item.fix" size="16px" style="display:block;margin-left: auto;cursor: pointer;"
name="clear" @click="removeHandler(item.id)"
v-if="!item.fix"
size="16px"
style="display: block; margin-left: auto; cursor: pointer"
name="clear"
@click="removeHandler(item.id)"
/>
</div>
</VueDraggable>
@ -469,7 +475,11 @@ onMounted(() => {
<n-button type="info" @click="handleSumbit">
确定
</n-button>
<n-button secondary style="margin-left:15px; border: 1px solid #CAD2DD;" @click="closeModal">
<n-button
secondary
style="margin-left: 15px; border: 1px solid #cad2dd"
@click="closeModal"
>
取消
</n-button>
</div>
@ -498,10 +508,10 @@ onMounted(() => {
&-footer {
display: flex;
justify-content: flex-end;
.n-button--info-type{
background: #507AFD !important;
.n-button--info-type {
background: #507afd !important;
}
.n-button--default-type{
.n-button--default-type {
background: #fff !important;
color: #333333;
}
@ -513,7 +523,7 @@ onMounted(() => {
font-size: 14px;
&:before {
background-color: #1980FF;
background-color: #1980ff;
content: "";
width: 5px;
border-radius: 2px;
@ -543,7 +553,7 @@ onMounted(() => {
.textbtnStyle {
cursor: pointer;
color: #1980FF;
color: #1980ff;
}
.draggable-ul {
@ -576,33 +586,33 @@ onMounted(() => {
--n-padding-top: 0px;
--n-padding-bottom: 12px;
}
::v-deep(.n-card > .n-card-header .n-card-header__main){
::v-deep(.n-card > .n-card-header .n-card-header__main) {
font-weight: lighter !important;
font-size: 14px;
color: #666;
}
::v-deep(.n-scrollbar){
::v-deep(.n-scrollbar) {
border-left: 1px solid #cad2dd !important;
border-right: 1px solid #cad2dd !important;
border-bottom: 1px solid #E8E8E8 !important;
border-top: 1px solid #E8E8E8 !important;
border-bottom: 1px solid #e8e8e8 !important;
border-top: 1px solid #e8e8e8 !important;
}
::v-deep(.n-card__content){
::v-deep(.n-card__content) {
padding: 20px 24px 0 24px !important;
}
::v-deep(.n-card__footer){
::v-deep(.n-card__footer) {
padding: 0 24px 16px 24px !important;
}
::v-deep(.n-input .n-input-wrapper){
::v-deep(.n-input .n-input-wrapper) {
height: 44px !important;
border: 1px solid #cad2dd !important;
border-bottom: none !important;
// margin-bottom: -3px;
.n-input__input input{
.n-input__input input {
height: 44px !important;
}
}
::v-deep(.n-button--info-type){
background: #507AFD !important;
::v-deep(.n-button--info-type) {
background: #507afd !important;
}
</style>

@ -1,5 +1,6 @@
<script lang="ts" setup>
import {
computed,
defineOptions,
h,
nextTick,
@ -8,97 +9,100 @@ import {
reactive,
ref,
unref,
computed,
} from "vue";
import { NDataTable } from "naive-ui";
import type { DataTableColumns, DataTableRowKey } from "naive-ui";
import type { SortableEvent } from "sortablejs";
import Sortable from "sortablejs";
import { debounce } from "lodash-es";
import Action from "@/views/home/aside/comp/Action.vue";
import { deleteCondition, getConditionList, sort } from "@/api/home/filter";
import type { FilterSearchParam } from "/#/api";
import SvgIcon from "@/components/Icon/SvgIcon.vue";
} from 'vue'
import { NButton, NDataTable, useModal } from 'naive-ui'
import type { DataTableColumns, DataTableRowKey } from 'naive-ui'
import type { SortableEvent } from 'sortablejs'
import Sortable from 'sortablejs'
import { debounce } from 'lodash-es'
import Action from '@/views/home/aside/comp/Action.vue'
import { deleteCondition, getConditionList, sort } from '@/api/home/filter'
import type { FilterSearchParam } from '/#/api'
import { useModal, NButton } from "naive-ui";
const modal = useModal();
import SvgIcon from '@/components/Icon/SvgIcon.vue'
defineOptions({ name: "FilterModal" });
defineOptions({ name: 'FilterModal' })
const emit = defineEmits<{
(e: "showNewFilter"): void;
(e: "editFilter", filter: any): void;
}>();
(e: 'showNewFilter'): void
(e: 'editFilter', filter: any): void
(e: 'handleOk', item: any): void
}>()
const show = ref(false);
const checkedRowKeys = ref([]);
const modal = useModal()
const show = ref(false)
const checkedRowKeys = ref([])
const $message = window.$message
const cardStyle = {
width: "800px",
height: "800px",
"--n-padding-bottom": "10px",
"--n-padding-left": "10px",
};
'width': '800px',
'height': '800px',
'--n-padding-bottom': '10px',
'--n-padding-left': '10px',
}
interface RowData {
id: string;
searchname: string;
createby: string;
createtime: string;
updateby: string;
updatetime: string;
id: string
searchname: string
createby: string
createtime: string
updateby: string
updatetime: string
}
const columns: DataTableColumns<RowData> = [
{
type: "selection",
type: 'selection',
},
{
title: "操作",
key: "action",
title: '操作',
key: 'action',
render(row) {
return h(Action, {
options: [
{ label: "编辑", key: 1 },
{ label: "删除", key: 2 },
{ label: '编辑', key: 1 },
{ label: '删除', key: 2 },
],
id: row.id,
select,
});
})
},
},
{
title: "名称",
key: "searchname",
title: '名称',
key: 'searchname',
},
{
title: "创建者",
key: "createby",
title: '创建者',
key: 'createby',
},
{
title: "创建时间",
key: "createtime",
title: '创建时间',
key: 'createtime',
renderSorterIcon: ({ order }) => {
if (order === false) return h(SvgIcon, { name: "sort-2" });
if (order === "ascend") return h(SvgIcon, { name: "sort-1" });
if (order === "descend") return h(SvgIcon, { name: "sort-3" });
if (order === false)
return h(SvgIcon, { name: 'sort-2' })
if (order === 'ascend')
return h(SvgIcon, { name: 'sort-1' })
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
},
sorter: (row1, row2) =>
new Date(row1?.createtime).getTime() - new Date(row2?.createtime).getTime(),
},
{
title: "更新者",
key: "updateby",
title: '更新者',
key: 'updateby',
},
{
title: "更新时间",
key: "updatetime",
title: '更新时间',
key: 'updatetime',
},
];
]
const loading = ref(true);
const total = ref(0);
const loading = ref(true)
const total = ref(0)
const pagination = reactive({
page: 1,
pageCount: 1,
@ -106,220 +110,232 @@ const pagination = reactive({
showSizePicker: true,
pageSizes: [
{
label: "10 每页",
label: '10 每页',
value: 10,
},
{
label: "15 每页",
label: '15 每页',
value: 15,
},
{
label: "30 每页",
label: '30 每页',
value: 30,
},
{
label: "50 每页",
label: '50 每页',
value: 50,
},
],
showQuickJumper: true,
prefix: () => `${total.value} 条数据`,
});
const tableData = ref<Array<RowData>>([]);
const keyword = ref("");
})
const tableData = ref<Array<RowData>>([])
const keyword = ref('')
async function query(page: number, pageSize: number) {
const searchParam: FilterSearchParam = {
search_searchname: { value: keyword.value, op: "like", type: "string" },
};
const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 1);
const { data, pageCount, total: totalCount } = result;
total.value = totalCount;
tableData.value = data;
pagination.page = page;
pagination.pageCount = pageCount;
loading.value = false;
search_searchname: { value: keyword.value, op: 'like', type: 'string' },
}
const result = await getConditionList({ pageNo: page, pageSize }, searchParam, 1)
const { data, pageCount, total: totalCount } = result
total.value = totalCount
tableData.value = data
pagination.page = page
pagination.pageCount = pageCount
loading.value = false
}
function afterLeave() {
pagination.page = 1;
pagination.pageCount = 1;
pagination.pageSize = 10;
pagination.page = 1
pagination.pageCount = 1
pagination.pageSize = 10
}
const selectionIds = ref<DataTableRowKey[]>([]);
const selectionIds = ref<DataTableRowKey[]>([])
const rowKey = (row: RowData) => row.id;
const rowKey = (row: RowData) => row.id
function rowProps(row: RowData) {
return {
"data-id": row.id,
};
'data-id': row.id,
}
}
function handleCheck(rowKeys: DataTableRowKey[]) {
selectionIds.value = rowKeys;
selectionIds.value = rowKeys
}
function select(key: number, id: string) {
switch (key) {
case 1:
editSelection(id);
break;
case 2:
if (key == 1) {
editSelection(id)
}
else {
const modalInst = modal.create({
title: "确认提示",
content: "确认删除该条过滤条件吗?",
positiveText: "确定",
negativeText: "取消",
preset: "dialog",
title: '确认提示',
content: '确认删除该条过滤条件吗?',
positiveText: '确定',
negativeText: '取消',
preset: 'dialog',
onPositiveClick: () => deleteSelection(id),
onNegativeClick: () => modalInst.destroy(),
});
break;
default:
break;
})
}
}
function editSelection(id = "") {
// eslint-disable-next-line dot-notation
function editSelection(id = '') {
// const $message = window["$message"];
// if (selectionIds.value.length === 0 || selectionIds.value.length > 1) {
// $message.error("");
// return;
// }
const selectedId = id;
const selectedId = id
const selectedFilter = tableData.value.find((item: any) => {
return item.id === selectedId;
});
return item.id === selectedId
})
emit("editFilter", selectedFilter);
closeModal();
emit('editFilter', selectedFilter)
closeModal()
}
function deleteSelection(id = "") {
// eslint-disable-next-line dot-notation
function deleteSelection(id = '') {
if (selectionIds.value.length === 0) {
deleteCondition({ ids: id }).then(() => {
query(pagination.page, pagination.pageSize);
});
return;
query(pagination.page, pagination.pageSize)
})
return
}
const modalInst = modal.create({
title: "确认提示",
content: "确认删除所选过滤条件吗?",
positiveText: "确定",
negativeText: "取消",
preset: "dialog",
title: '确认提示',
content: '确认删除所选过滤条件吗?',
positiveText: '确定',
negativeText: '取消',
preset: 'dialog',
onPositiveClick: () =>
deleteCondition({ ids: selectionIds.value.join(",") }).then(() => {
selectionIds.value = [];
query(pagination.page, pagination.pageSize);
deleteCondition({ ids: selectionIds.value.join(',') }).then(() => {
selectionIds.value = []
query(pagination.page, pagination.pageSize)
}),
onNegativeClick: () => modalInst.destroy(),
});
})
}
async function handlePageChange(currentPage) {
if (loading.value) return;
pagination.page = currentPage;
const { pageSize } = pagination;
await query(currentPage, pageSize);
if (loading.value)
return
pagination.page = currentPage
const { pageSize } = pagination
await query(currentPage, pageSize)
}
async function handlePageSizeChange(currentPageSize) {
if (loading.value) return;
if (loading.value)
return
const { page } = pagination;
pagination.pageSize = currentPageSize;
const { page } = pagination
pagination.pageSize = currentPageSize
await query(page, currentPageSize);
await query(page, currentPageSize)
}
function handleClick() {
emit("showNewFilter");
emit('showNewFilter')
// show.value = false;
closeModal();
closeModal()
}
let sortTable: Sortable | null = null;
const tableRef = ref<InstanceType<typeof NDataTable>>();
let sortTable: Sortable | null = null
const tableRef = ref<InstanceType<typeof NDataTable>>()
onMounted(() => {
nextTick(() => {
console.log(tableRef.value, "tableRef");
});
});
console.log(tableRef.value, 'tableRef')
})
})
async function showModal() {
show.value = true;
show.value = true
const { page, pageSize } = pagination;
await query(page, pageSize);
const { page, pageSize } = pagination
await query(page, pageSize)
nextTick(() => {
if (sortTable !== null) destory();
const el: HTMLDivElement = tableRef.value?.$el;
const tbody: HTMLElement | null = el.querySelector("tbody.n-data-table-tbody")!;
if (tbody) sortTable = Sortable.create(tbody, { onEnd, onMove });
});
if (sortTable !== null)
destory()
const el: HTMLDivElement = tableRef.value?.$el
const tbody: HTMLElement | null = el.querySelector('tbody.n-data-table-tbody')!
if (tbody)
sortTable = Sortable.create(tbody, { onEnd, onMove })
})
}
let relatedId = "";
let insertafter = false;
let relatedId = ''
let insertafter = false
// TODO: bug
function onEnd(event: SortableEvent) {
const data = unref(tableData);
const oldElem = data[event.oldIndex!];
data.splice(event.oldIndex!, 1);
data.splice(event.newIndex!, 0, oldElem);
const data = unref(tableData)
const oldElem = data[event.oldIndex!]
data.splice(event.oldIndex!, 1)
data.splice(event.newIndex!, 0, oldElem)
const dragId = oldElem.id;
const dragId = oldElem.id
const index = data.findIndex((item) => {
return item.id === relatedId;
});
return item.id === relatedId
})
// -1+1
const order = insertafter ? index - 1 : index + 1;
const order = insertafter ? index - 1 : index + 1
// console.log('dragid:', dragId, 'order:', order)
sort(dragId, order);
sort(dragId, order)
}
function onMove(evt: any) {
relatedId = evt.related?.dataset?.id;
insertafter = evt.willInsertAfter;
relatedId = evt.related?.dataset?.id
insertafter = evt.willInsertAfter
// console.log(`${evt.dragged.dataset.id},${evt.related}`, 'insertafter', evt.willInsertAfter)
}
function destory() {
sortTable && sortTable.destroy();
sortTable = null;
sortTable && sortTable.destroy()
sortTable = null
}
onUnmounted(() => {
destory();
});
destory()
})
function closeModal() {
show.value = false;
show.value = false
}
defineExpose({
showModal,
query,
pagination,
});
})
const inputHandler = debounce((word) => {
keyword.value = word;
query(1, 5);
}, 300);
keyword.value = word
query(1, 5)
}, 300)
const showSearch = computed(() => {
return selectionIds.value.length > 0;
});
return selectionIds.value.length > 0
})
function handleOk() {
if (selectionIds.value.length > 1) {
$message.error('只能选择一条筛选条件')
return
}
if (selectionIds.value.length == 1) {
const selectedId = selectionIds.value[0]
const item = tableData.value.find(v => v.id == selectedId)
emit('handleOk', item)
}
if (selectionIds.value.length == 0)
emit('handleOk', '')
closeModal()
}
</script>
<template>
@ -331,9 +347,9 @@ const showSearch = computed(() => {
v-model:show="show"
transform-origin="center"
display-directive="if"
@after-leave="afterLeave"
:mask-closable="false"
class="modal_wrapper"
@after-leave="afterLeave"
>
<n-card
:style="cardStyle"
@ -352,11 +368,10 @@ const showSearch = computed(() => {
'font-size': '16px',
'font-weight': '600',
}"
>基本信息</span
>
>基本信息</span>
</div>
</div>
<div class="wrapper-form" v-if="!showSearch">
<div v-if="!showSearch" class="wrapper-form">
<n-input
:style="{ width: '360px', border: '1px solid #cad2dd' }"
placeholder="请输入过滤条件名称搜索"
@ -366,31 +381,29 @@ const showSearch = computed(() => {
<SvgIcon size="14px" name="magnifying-1" />
</template>
</n-input>
<n-button type="info" @click="handleClick">
<NButton type="info" @click="handleClick">
创建
<template #icon>
<SvgIcon size="14px" name="creatFilter" />
</template>
</n-button>
</NButton>
</div>
<div class="wrapper-form" v-else>
<div v-else class="wrapper-form">
<div class="del_btn">
<n-button icon-placement="left" size="medium" @click="deleteSelection">
<NButton icon-placement="left" size="medium" @click="deleteSelection">
<template #icon>
<SvgIcon name="delete-history" size="16" />
</template>
删除</n-button
>
删除
</NButton>
</div>
<div class="msg">
<span
>已选中
<span>已选中
<span style="color: #507afd; font-size: 16px">{{
selectionIds.length
}}</span>
</span
>
</span>
<a @click="selectionIds = []">清空</a>
</div>
</div>
@ -405,19 +418,21 @@ const showSearch = computed(() => {
:loading="loading"
:pagination="pagination"
:row-key="rowKey"
:checked-row-keys="selectionIds"
@update:page="handlePageChange"
@update-page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck"
:checked-row-keys="selectionIds"
/>
</div>
</div>
<template #footer>
<div class="wrapper-footer">
<n-button type="info" @click="closeModal"> </n-button>
<n-button secondary style="margin-left: 15px" @click="closeModal">
<NButton type="info" @click="handleOk">
确认
</NButton>
<NButton secondary style="margin-left: 15px" @click="closeModal">
取消
</n-button>
</NButton>
</div>
</template>
</n-card>

@ -1,108 +1,108 @@
<script lang="ts" setup>
import type { FormInst, FormItemRule, FormRules } from "naive-ui";
import { computed, onBeforeMount, reactive, ref, unref, watch, defineEmits } from "vue";
import { asideMap } from "@/config/final";
import { useDictionary } from "@/store/modules/dictonary";
import { useConfig } from "@/store/modules/asideConfig";
import type { FilterCondition } from "/#/api";
import { addCondition, updateCondition } from "@/api/home/filter";
import { formatToDate2, formatToDate3 } from "@/utils/dateUtil";
type Status = "edit" | "new";
const emit = defineEmits(["onOk"]);
const show = ref(false);
const configStore = useConfig();
const dicStore = useDictionary();
const currentStatus = ref<Status>("new");
let currentEditId: string | null = null;
import type { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { computed, defineEmits, onBeforeMount, reactive, ref, unref, watch } from 'vue'
import { asideMap } from '@/config/final'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import type { FilterCondition } from '/#/api'
import { addCondition, updateCondition } from '@/api/home/filter'
import { formatToDate2, formatToDate3 } from '@/utils/dateUtil'
type Status = 'edit' | 'new'
const emit = defineEmits(['onOk'])
const show = ref(false)
const configStore = useConfig()
const dicStore = useDictionary()
const currentStatus = ref<Status>('new')
let currentEditId: string | null = null
const modalTitle = computed(() => {
return currentStatus.value === "new" ? "新建过滤条件" : "编辑过滤条件";
});
return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件'
})
const cardStyle = {
width: "800px",
"--n-padding-bottom": "10px",
"--n-padding-left": "10px",
};
'width': '800px',
'--n-padding-bottom': '10px',
'--n-padding-left': '10px',
}
const noBorderInput = {
"--n-border": "0px",
"--n-border-hover": "0px",
"--n-border-pressed": "0px",
};
'--n-border': '0px',
'--n-border-hover': '0px',
'--n-border-pressed': '0px',
}
const formItemStyle = {
"--n-label-height": "0px",
"--n-feedback-height": "8px",
};
'--n-label-height': '0px',
'--n-feedback-height': '8px',
}
interface FormType {
name: string | null;
logic: string | null;
conditions: Condition[];
name: string | null
logic: string | null
conditions: Condition[]
}
interface Condition {
type: string | null;
operator: string | null;
result: any;
type: string | null
operator: string | null
result: any
}
interface Option {
label: string;
value: string;
label: string
value: string
}
const rules: FormRules = {
name: {
required: true,
message: "请输入过滤条件名称",
trigger: "blur",
message: '请输入过滤条件名称',
trigger: 'blur',
},
logic: {
required: true,
message: "请选择逻辑关系",
trigger: "blur",
message: '请选择逻辑关系',
trigger: 'blur',
},
conditions: {
required: true,
validator(rule: FormItemRule, value: Condition[]) {
for (const item of value) {
const { type, operator, result } = item;
const { type, operator, result } = item
if (type === null || operator === null || result === null)
return new Error("请选择过滤条件");
return new Error('请选择过滤条件')
}
return true;
return true
},
trigger: ["input", "blur"],
trigger: ['input', 'blur'],
},
};
}
const formRef = ref<FormInst | null>(null);
const formRef = ref<FormInst | null>(null)
const formValue = reactive<FormType>({
name: null,
logic: "and",
logic: 'and',
conditions: [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
],
});
})
function handleSumbit(e: MouseEvent) {
e.preventDefault();
e.preventDefault()
formRef.value?.validate((errors) => {
if (errors) return;
if (errors)
return
const list = formValue.conditions.map((item, index) => {
const { type, operator, result } = item;
const { type, operator, result } = item
return {
searchfield: type!,
@ -110,164 +110,165 @@ function handleSumbit(e: MouseEvent) {
searchvalue: formatValue(type!, result),
searchRelationType: formValue.logic!,
orderNum: index + 1,
};
});
}
})
const param: FilterCondition = {
searchname: formValue.name!,
type: 1,
ocrUsersearchchildList: list,
};
}
if (currentStatus.value === "new") addCondition(param);
else updateCondition({ id: currentEditId!, ...param });
closeModal();
});
if (currentStatus.value === 'new')
addCondition(param)
else updateCondition({ id: currentEditId!, ...param })
closeModal()
})
}
function formatValue(searchfield: string, searchvalue: any) {
if (searchfield === "izyear") {
const start = formatToDate2(searchvalue[0]);
const end = formatToDate2(searchvalue[1]);
return `${start}-${end}`;
if (searchfield === 'izyear') {
const start = formatToDate2(searchvalue[0])
const end = formatToDate2(searchvalue[1])
return `${start}-${end}`
}
return searchvalue;
return searchvalue
}
//
function unformatValue(searchfield: string, searchvalue: any) {
// 2022/01/03-2023/02/04
if (searchfield === "izyear") {
const dataStrs = searchvalue.split("-");
const start = formatToDate3(dataStrs[0]);
const end = formatToDate3(dataStrs[1]);
return [start, end];
if (searchfield === 'izyear') {
const dataStrs = searchvalue.split('-')
const start = formatToDate3(dataStrs[0])
const end = formatToDate3(dataStrs[1])
return [start, end]
}
return searchvalue;
return searchvalue
}
function createCondition() {
formValue.conditions.push({
type: null,
operator: "eq",
operator: 'eq',
result: null,
});
})
}
function removeCondition(index: number) {
formValue.conditions.splice(index, 1);
formValue.conditions.splice(index, 1)
}
function formLabel(index: number) {
return index === 0 ? "筛选条件" : "";
return index === 0 ? '筛选条件' : ''
}
const typeOptions = ref<Option[]>([]);
const typeOptions = ref<Option[]>([])
const operatorOptions = [
{
label: "等于",
value: "eq",
label: '等于',
value: 'eq',
},
{
label: "不等于",
value: "notEq",
label: '不等于',
value: 'notEq',
},
];
]
const logicOptions = ref([]);
const logicOptions = ref([])
onBeforeMount(() => {
dicStore.fetchRelationTypeList();
});
dicStore.fetchRelationTypeList()
})
watch(
() => dicStore.relationTypeList,
(newval) => {
logicOptions.value = newval;
}
);
logicOptions.value = newval
},
)
function showModal() {
show.value = true;
show.value = true
}
function closeModal() {
emit("onOk");
emit('onOk')
setTimeout(() => {
show.value = false;
}, 300);
show.value = false
}, 300)
}
function generateAllData(): Option[] {
const initVal: Option[] = [];
const initVal: Option[] = []
const list = Object.keys(asideMap).reduce((acc, value) => {
if (value.startsWith("iz") && asideMap[value]?.inFilterList !== false) {
const name = asideMap[value]?.label;
if (value.startsWith('iz') && asideMap[value]?.inFilterList !== false) {
const name = asideMap[value]?.label
name &&
acc.push({
name
&& acc.push({
value,
label: name || "未配置",
});
label: name || '未配置',
})
}
return acc;
}, initVal);
return acc
}, initVal)
return list;
return list
}
typeOptions.value = generateAllData();
typeOptions.value = generateAllData()
function getOptions(key: string) {
const getterName = `get${key}`;
const options = unref(dicStore[getterName]);
return options || [];
const getterName = `get${key}`
const options = unref(dicStore[getterName])
return options || []
}
function leaveHandler() {
currentStatus.value = "new";
currentEditId = null;
currentStatus.value = 'new'
currentEditId = null
formValue.name = null;
formValue.name = null
formValue.conditions = [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
];
]
}
function edit(editFilter: any) {
currentStatus.value = "edit";
currentStatus.value = 'edit'
const { searchname, ocrUsersearchchildList, id } = editFilter;
currentEditId = id;
formValue.name = searchname;
const { searchname, ocrUsersearchchildList, id } = editFilter
currentEditId = id
formValue.name = searchname
formValue.conditions = ocrUsersearchchildList.map((item) => {
return {
type: item.searchfield,
operator: item.searchtype,
result: unformatValue(item.searchfield, item.searchvalue),
};
});
}
})
}
defineExpose({
showModal,
edit,
});
})
</script>
<template>
<n-modal
v-model:show="show"
transform-origin="center"
@after-leave="leaveHandler"
:mask-closable="false"
@after-leave="leaveHandler"
>
<n-card
:style="cardStyle"
@ -286,24 +287,28 @@ defineExpose({
'font-size': '16px',
'font-weight': '600',
}"
>基本信息</span
>
>基本信息</span>
</div>
</div>
<div class="wrapper-form">
<n-form ref="formRef" :model="formValue" :rules="rules">
<n-form
ref="formRef"
:model="formValue"
:rules="rules"
require-mark-placement="left"
>
<n-form-item path="name" label="标题">
<n-input
v-model:value="formValue.name"
:style="{ width: '780px' }"
@keydown.enter.prevent
placeholder="请输入过滤名称"
@keydown.enter.prevent
/>
</n-form-item>
<n-form-item path="logic" label="逻辑关系" v-show="false">
<n-form-item v-show="false" path="logic" label="逻辑关系">
<n-select
filterable
v-model:value="formValue.logic"
filterable
placeholder="请选择逻辑关系"
:options="logicOptions"
/>
@ -316,15 +321,15 @@ defineExpose({
:label="formLabel(index)"
>
<n-select
filterable
v-model:value="item.type"
filterable
placeholder="请选择筛选项名称"
:options="typeOptions"
@change="item.result = ''"
/>
<n-select
filterable
v-model:value="item.operator"
filterable
style="margin-left: 8px"
placeholder="请选择"
:options="operatorOptions"
@ -338,9 +343,9 @@ defineExpose({
/>
</n-space>
<n-select
filterable
v-else
v-model:value="item.result"
filterable
style="margin-left: 8px"
placeholder="请选择"
:options="getOptions(item.type!)"
@ -358,13 +363,15 @@ defineExpose({
</n-form>
</div>
<div class="wrapper-new" @click="createCondition">
<span style="font-size:16px;">+</span>
<span style="font-size: 16px">+</span>
<span style="margin-left: 8px">添加筛选条件</span>
</div>
</div>
<template #footer>
<div class="wrapper-footer">
<n-button type="info" @click="handleSumbit"> </n-button>
<n-button type="info" @click="handleSumbit">
确定
</n-button>
<n-button secondary style="margin-left: 15px" @click="closeModal">
取消
</n-button>
@ -405,7 +412,7 @@ defineExpose({
color: #507afd;
line-height: 22px;
cursor: pointer;
span{
span {
font-size: 11px;
}
@ -421,7 +428,7 @@ defineExpose({
&-footer {
display: flex;
justify-content: flex-end;
margin-bottom:6px;
margin-bottom: 6px;
}
&-info {
@ -439,8 +446,8 @@ defineExpose({
}
}
}
::v-deep(.n-form-item .n-form-item-label){
font-size:14px;
::v-deep(.n-form-item .n-form-item-label) {
font-size: 14px;
color: #666666;
font-weight: 500;
}

@ -1,14 +1,14 @@
<script lang="ts" setup>
import { favorite, getConditionList, unfavorite, sort } from "@/api/home/filter";
import { asideMap } from "@/config/aside";
import { useInfiniteScroll } from "@vueuse/core";
import { debounce } from "lodash-es";
import { onMounted, reactive, ref, watch } from "vue";
import type { FilterSearchParam } from "/#/api";
import type { Filter, FilterEntity } from "/#/home";
import { VueDraggable } from "vue-draggable-plus";
import { useInfiniteScroll } from '@vueuse/core'
import { debounce } from 'lodash-es'
import { onMounted, reactive, ref, watch } from 'vue'
import type { FilterSearchParam } from '/#/api'
import type { Filter, FilterEntity } from '/#/home'
import { VueDraggable } from 'vue-draggable-plus'
import { asideMap } from '@/config/aside'
import { favorite, getConditionList, sort, unfavorite } from '@/api/home/filter'
defineOptions({ name: "AdvanceFilter" });
defineOptions({ name: 'AdvanceFilter' })
const props = defineProps({
type: {
@ -16,43 +16,42 @@ const props = defineProps({
default: 0,
required: true,
},
});
const ruleForm = reactive({
keyword: "",
});
const ruleformRef = ref();
})
const emit = defineEmits<{
(e: "show-filter"): void;
(e: "show-custom"): void;
(e: "update:search"): void;
(e: "select", id: string);
}>();
const data = ref<FilterEntity[]>([]);
const unData = ref<FilterEntity[]>([]);
const loading = ref(false);
const canloadMore = true;
const el = ref<HTMLDivElement | null>(null);
const popover = ref<ComponentRef | null>(null);
(e: 'show-filter'): void
(e: 'show-custom'): void
(e: 'update:search'): void
(e: 'select', id: string)
}>()
const ruleForm = reactive({
keyword: '',
})
const ruleformRef = ref()
const data = ref<FilterEntity[]>([])
const unData = ref<FilterEntity[]>([])
const loading = ref(false)
const canloadMore = true
const el = ref<HTMLDivElement | null>(null)
const popover = ref<ComponentRef | null>(null)
const pagination = reactive({
pageNo: 1,
pageSize: 300,
});
const keyword = ref("");
const currentlySelectedAdvanced = ref("高级筛选");
})
const keyword = ref('')
const currentlySelectedAdvanced = ref('高级筛选')
onMounted(() => {
// data.value = generateDefaultConfig()
});
})
//
function generateDefaultConfig(): FilterEntity[] {
return Object.keys(asideMap).reduce((acc, key) => {
const { label, defaultValue, isDefaultFilter } = asideMap[key];
const { label, defaultValue, isDefaultFilter } = asideMap[key]
if (isDefaultFilter === true) {
const config = {
id: "",
id: '',
name: label,
favorite: false,
isDefaultFilter,
@ -62,70 +61,73 @@ function generateDefaultConfig(): FilterEntity[] {
value: defaultValue,
},
],
};
return [...acc, config];
} else {
return acc;
}
}, []);
return [...acc, config]
}
else {
return acc
}
}, [])
}
useInfiniteScroll(
el as any,
() => {
loadMore();
loadMore()
},
{ distance: 10, interval: 300, canLoadMore: () => false }
);
const showClick = async () => {
getSearchedList("");
};
{ distance: 10, interval: 300, canLoadMore: () => false },
)
async function showClick() {
getSearchedList('')
}
async function loadMore() {
if (loading.value || el.value == null) return;
if (loading.value || el.value == null)
return
const more = await featchList();
const more = await featchList()
if (more.length === 0) return;
if (more.length === 0)
return
data.value.push(...more);
data.value.push(...more)
}
async function featchList() {
loading.value = true;
loading.value = true
try {
const searchParam: FilterSearchParam = {
search_searchname: { value: ruleForm.keyword, op: "like", type: "string" },
};
const result = await getConditionList(pagination, searchParam, props.type);
const { data } = result;
search_searchname: { value: ruleForm.keyword, op: 'like', type: 'string' },
}
const result = await getConditionList(pagination, searchParam, props.type)
const { data } = result
// pagination.pageNo += 1
// canloadMore = pageCount >= pagination.pageNo
const entityList = generateFilterEntityList(data);
return entityList;
} catch (error) {
return [];
} finally {
loading.value = false;
const entityList = generateFilterEntityList(data)
return entityList
}
catch (error) {
return []
}
finally {
loading.value = false
}
}
//
function generateFilterEntityList(data) {
const filterEntityList = data.map((item) => {
const { searchname, iztop, ocrUsersearchchildList, id, reorder } = item;
const { searchname, iztop, ocrUsersearchchildList, id, reorder } = item
const list = ocrUsersearchchildList.map((item) => {
const { searchfield, searchvalue } = item;
const { searchfield, searchvalue } = item
return {
key: searchfield,
value: searchvalue,
};
});
}
})
const reg = new RegExp(ruleForm.keyword, "gi");
const hilightText = searchname.replace(reg, `<span>${ruleForm.keyword}</span>`);
const reg = new RegExp(ruleForm.keyword, 'gi')
const hilightText = searchname.replace(reg, `<span>${ruleForm.keyword}</span>`)
return {
id,
@ -135,132 +137,130 @@ function generateFilterEntityList(data) {
filterList: list,
reorder,
searchname,
};
});
}
})
return filterEntityList;
return filterEntityList
}
function selectHandler(item: FilterEntity) {
(popover.value as any).setShow(false);
currentlySelectedAdvanced.value = item.searchname;
emit("select", item.id);
(popover.value as any).setShow(false)
currentlySelectedAdvanced.value = item.searchname
emit('select', item.id)
}
const inputHandler = debounce((word) => {
ruleForm.keyword = word;
ruleformRef.value.validate();
if (word.length < 2 && word) {
return;
}
getSearchedList(word);
}, 300);
ruleForm.keyword = word
ruleformRef.value.validate()
if (word.length < 2 && word)
return
getSearchedList(word)
}, 300)
function getSearchedList(word, isScroll = false) {
if (word) {
pagination.pageSize = 300;
}
if (!word) {
pagination.pageSize = 10;
}
if (isScroll) {
pagination.pageSize = 300;
}
ruleForm.keyword = word;
if (word)
pagination.pageSize = 300
if (!word)
pagination.pageSize = 10
if (isScroll)
pagination.pageSize = 300
ruleForm.keyword = word
featchList().then((list) => {
let dataArr: FilterEntity[] = [];
let unDataArr: FilterEntity[] = [];
list.map((item) => {
if (item.favorite && !item.isDefaultFilter) {
dataArr.push(item);
}
if (!item.favorite && !item.isDefaultFilter) {
unDataArr.push(item);
}
});
const dataArr: FilterEntity[] = []
const unDataArr: FilterEntity[] = []
list.forEach((item) => {
if (item.favorite && !item.isDefaultFilter)
dataArr.push(item)
if (!item.favorite && !item.isDefaultFilter)
unDataArr.push(item)
})
data.value = dataArr.sort(
(a, b) => Number(new Date(a.createtime)) - Number(new Date(b.createtime))
);
(a, b) => Number(new Date(a.createtime)) - Number(new Date(b.createtime)),
)
unData.value = unDataArr.sort(
(a, b) => Number((a as any).reorder) - Number((b as any).reorder)
);
});
(a, b) => Number((a as any).reorder) - Number((b as any).reorder),
)
})
}
function favoriteHandler(event: MouseEvent, item: any) {
event.stopImmediatePropagation();
event.stopPropagation();
event.stopImmediatePropagation()
event.stopPropagation()
const { isDefaultFilter, id } = item;
const { isDefaultFilter, id } = item
if (!isDefaultFilter) {
item.favorite = true;
favorite(id);
data.value.map((v, index) => {
if (v.id == id) {
sort(v.id, 0);
} else {
sort(v.id, index + 1);
}
});
inputHandler(ruleForm.keyword);
item.favorite = true
favorite(id)
data.value.forEach((v, index) => {
if (v.id == id)
sort(v.id, 0)
else
sort(v.id, index + 1)
})
inputHandler(ruleForm.keyword)
}
}
const rules = {
keyword: [
{
trigger: ["blur", "input", "change"],
level: "error",
trigger: ['blur', 'input', 'change'],
level: 'error',
validator(_rule, value) {
if (value.length >= 2) {
return true;
} else {
return new Error("搜索关键字最少为两个");
}
if (value.length >= 2)
return true
else
return new Error('搜索关键字最少为两个')
},
},
],
};
}
function unFavoriteHandler(event: MouseEvent, item) {
event.stopImmediatePropagation();
event.stopPropagation();
event.stopImmediatePropagation()
event.stopPropagation()
const { isDefaultFilter, id } = item;
const { isDefaultFilter, id } = item
if (!isDefaultFilter) {
item.favorite = false;
unfavorite(id);
inputHandler(ruleForm.keyword);
item.favorite = false
unfavorite(id)
inputHandler(ruleForm.keyword)
}
}
const handleScroll = (event) => {
let timer;
function handleScroll(event) {
let timer
if (timer) {
clearTimeout(timer);
} else {
clearTimeout(timer)
}
else {
timer = setTimeout(() => {
getSearchedList("", true);
}, 2000);
getSearchedList('', true)
}, 2000)
}
};
}
const moveEnd = () => {
unData.value.map((v, index) => {
sort(v.id, index);
});
};
function moveEnd() {
unData.value.forEach((v, index) => {
sort(v.id, index)
})
}
const setCurrentlySelectedAdvanced = (value: string) => {
currentlySelectedAdvanced.value = value;
};
function setCurrentlySelectedAdvanced(value: string) {
currentlySelectedAdvanced.value = value
}
defineExpose({
setCurrentlySelectedAdvanced,
});
})
</script>
<template>
@ -284,8 +284,7 @@ defineExpose({
font-size: 17px;
font-weight: 600;
"
>{{ currentlySelectedAdvanced }}</span
>
>{{ currentlySelectedAdvanced }}</span>
<SvgIcon
:style="{ marginLeft: '5px' }"
name="down"
@ -296,7 +295,7 @@ defineExpose({
</template>
<n-spin :show="loading">
<div class="wrapper-left-popover">
<n-form :rules="rules" ref="ruleformRef" :model="ruleForm">
<n-form ref="ruleformRef" :rules="rules" :model="ruleForm">
<n-form-item path="keyword">
<n-input
:style="{
@ -305,9 +304,9 @@ defineExpose({
'--n-height': '40px',
}"
placeholder="请输入关键词"
@input="inputHandler"
:value="ruleForm.keyword"
:minlength="2"
@input="inputHandler"
>
<template #prefix>
<SvgIcon size="14px" name="magnifying-1" />
@ -354,23 +353,23 @@ defineExpose({
style="margin-right: 3px"
@click="favoriteHandler($event, item)"
/>
<div v-html="item.name" style="color: #333333" />
<div style="color: #333333" v-html="item.name" />
</li>
<!-- filter=".draggable-li[draggable='false']" -->
<VueDraggable
@end="moveEnd"
v-model="unData"
class="draggable-ul"
:animation="150"
group="shared"
@end="moveEnd"
>
<li
v-for="(item, index) in unData"
:key="index"
style="display: flex; align-items: center"
@click="selectHandler(item)"
class="cursor-move draggable-li fix"
:draggable="true"
@click="selectHandler(item)"
>
<SvgIcon name="drag" size="10" style="margin-right: 3px" />
<SvgIcon
@ -392,7 +391,7 @@ defineExpose({
style="cursor: pointer !important; margin-right: 3px"
@click="favoriteHandler($event, item)"
/>
<div v-html="item.name" style="color: #333333" />
<div style="color: #333333" v-html="item.name" />
</li>
</VueDraggable>
</ul>
@ -441,6 +440,12 @@ defineExpose({
align-items: center;
margin-left: 12px;
cursor: pointer;
span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 120px;
}
}
&-popvoer {

@ -1,47 +1,49 @@
<script lang="ts" setup>
import { ref } from "vue";
import { useConfig } from "@/store/modules/asideConfig";
import { ref } from 'vue'
import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig();
const props = defineProps<{
value: [number, number]
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string): void
}>()
const range = ref<[number, number]>(props.value || [])
const marks = {
0: '0',
50: '50',
100: '100',
}
const isLoadValue = ref(false)
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false;
return;
isLoadValue.value = false
return
}
let asideValue = configUseStore.getAsideValue;
if (asideValue["izsimilarity"]) {
range.value = asideValue["izsimilarity"];
} else {
range.value = [0, 100];
}
console.log(range.value, "range.value");
const asideValue = configUseStore.getAsideValue
if (asideValue.izsimilarity)
range.value = asideValue.izsimilarity
else
range.value = [0, 100]
console.log(range.value, 'range.value')
// else {
// range.value = [0, 100];
// }
});
const props = defineProps<{
value: [number, number];
label: string;
}>();
})
const emit = defineEmits<{
(e: "update:value", value: string): void;
}>();
const range = ref<[number, number]>(props.value || []);
const marks = {
0: "0",
50: "50",
100: "100",
};
const isLoadValue = ref(false);
function onChange(value: number & number[]) {
range.value = value as any;
isLoadValue.value = true;
let valueStr = value.join("-");
emit("update:value", valueStr);
value = value.sort((a, b) => a - b)
range.value = value as any
isLoadValue.value = true
const valueStr = value.join('-')
emit('update:value', valueStr)
}
</script>

@ -1,106 +1,107 @@
<script lang="ts" setup>
import type { FormInst, FormItemRule, FormRules } from "naive-ui";
import { computed, defineOptions, onBeforeMount, reactive, ref, unref, watch } from "vue";
import { asideMap } from "@/config/aside";
import { useDictionary } from "@/store/modules/dictonary";
import { useConfig } from "@/store/modules/asideConfig";
import type { FilterCondition } from "/#/api";
import { addCondition, updateCondition } from "@/api/home/filter";
import { formatToDate2, formatToDate3 } from "@/utils/dateUtil";
type Status = "edit" | "new";
const emit = defineEmits(["onOk"]);
const show = ref(false);
const configStore = useConfig();
const dicStore = useDictionary();
const currentStatus = ref<Status>("new");
let currentEditId: string | null = null;
import type { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { computed, defineOptions, onBeforeMount, reactive, ref, unref, watch } from 'vue'
import { asideMap } from '@/config/aside'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import type { FilterCondition } from '/#/api'
import { addCondition, updateCondition } from '@/api/home/filter'
import { formatToDate2, formatToDate3 } from '@/utils/dateUtil'
type Status = 'edit' | 'new'
const emit = defineEmits(['onOk'])
const show = ref(false)
const configStore = useConfig()
const dicStore = useDictionary()
const currentStatus = ref<Status>('new')
let currentEditId: string | null = null
const modalTitle = computed(() => {
return currentStatus.value === "new" ? "新建过滤条件" : "编辑过滤条件";
});
return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件'
})
const cardStyle = {
width: "800px",
"--n-padding-bottom": "10px",
"--n-padding-left": "10px",
};
'width': '800px',
'--n-padding-bottom': '10px',
'--n-padding-left': '10px',
}
const noBorderInput = {
"--n-border": "0px",
"--n-border-hover": "0px",
"--n-border-pressed": "0px",
};
'--n-border': '0px',
'--n-border-hover': '0px',
'--n-border-pressed': '0px',
}
const formItemStyle = {
"--n-label-height": "0px",
"--n-feedback-height": "8px",
};
'--n-label-height': '0px',
'--n-feedback-height': '8px',
}
interface FormType {
name: string | null;
logic: string | null;
conditions: Condition[];
name: string | null
logic: string | null
conditions: Condition[]
}
interface Condition {
type: string | null;
operator: string | null;
result: any;
type: string | null
operator: string | null
result: any
}
interface Option {
label: string;
value: string;
label: string
value: string
}
const rules: FormRules = {
name: {
required: true,
message: "请输入过滤条件名称",
trigger: "blur",
message: '请输入过滤条件名称',
trigger: 'blur',
},
logic: {
required: true,
message: "请选择逻辑关系",
trigger: "blur",
message: '请选择逻辑关系',
trigger: 'blur',
},
conditions: {
required: true,
validator(rule: FormItemRule, value: Condition[]) {
for (const item of value) {
const { type, operator, result } = item;
const { type, operator, result } = item
if (type === null || operator === null || result === null)
return new Error("请选择过滤条件");
return new Error('请选择过滤条件')
}
return true;
return true
},
trigger: ["input", "blur"],
trigger: ['input', 'blur'],
},
};
}
const formRef = ref<FormInst | null>(null);
const formRef = ref<FormInst | null>(null)
const formValue = reactive<FormType>({
name: null,
logic: "and",
logic: 'and',
conditions: [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
],
});
})
function handleSumbit(e: MouseEvent) {
e.preventDefault();
e.preventDefault()
formRef.value?.validate((errors) => {
if (errors) return;
if (errors)
return
const list = formValue.conditions.map((item, index) => {
const { type, operator, result } = item;
const { type, operator, result } = item
return {
searchfield: type!,
@ -108,199 +109,202 @@ function handleSumbit(e: MouseEvent) {
searchvalue: formatValue(type!, result),
searchRelationType: formValue.logic!,
orderNum: index + 1,
};
});
}
})
const param: FilterCondition = {
searchname: formValue.name!,
type: 0,
ocrUsersearchchildList: list,
};
}
if (currentStatus.value === "new") addCondition(param);
else updateCondition({ id: currentEditId!, ...param });
closeModal();
});
if (currentStatus.value === 'new')
addCondition(param)
else updateCondition({ id: currentEditId!, ...param })
closeModal()
})
}
//
function formatValue(searchfield: string, searchvalue: any) {
if (searchfield === "izyear") {
const start = formatToDate2(searchvalue[0]);
const end = formatToDate2(searchvalue[1]);
return `${start}-${end}`;
if (searchfield === 'izyear') {
const start = formatToDate2(searchvalue[0])
const end = formatToDate2(searchvalue[1])
return `${start}-${end}`
}
if (searchfield === "izsimilarity" && Array.isArray(searchvalue))
return searchvalue.join(",");
if (searchfield === 'izsimilarity' && Array.isArray(searchvalue))
return searchvalue.join(',')
return searchvalue;
return searchvalue
}
//
function unformatValue(searchfield: string, searchvalue: any) {
// 2022/01/03-2023/02/04
if (searchfield === "izyear") {
const dataStrs = searchvalue.split("-");
const start = formatToDate3(dataStrs[0]);
const end = formatToDate3(dataStrs[1]);
return [start, end];
if (searchfield === 'izyear') {
const dataStrs = searchvalue.split('-')
const start = formatToDate3(dataStrs[0])
const end = formatToDate3(dataStrs[1])
return [start, end]
}
// 80,90
// if (searchfield === "izsimilarity") return searchvalue.split(",");
return searchvalue;
return searchvalue
}
function createCondition() {
formValue.conditions.push({
type: null,
operator: "eq",
operator: 'eq',
result: null,
});
})
}
function removeCondition(index: number) {
formValue.conditions.splice(index, 1);
formValue.conditions.splice(index, 1)
}
function formLabel(index: number) {
return index === 0 ? "筛选条件" : "";
return index === 0 ? '筛选条件' : ''
}
const typeOptions = ref<Option[]>([]);
const typeOptions = ref<Option[]>([])
const operatorOptions = [
{
label: "等于",
value: "eq",
label: '等于',
value: 'eq',
},
{
label: "不等于",
value: "notEq",
label: '不等于',
value: 'notEq',
},
];
]
const logicOptions = ref([]);
const logicOptions = ref([])
const similarityOptions = [
{
label: "80%-90%",
value: "80,90",
label: '80%-90%',
value: '80,90',
},
{
label: "95%-100%",
value: "95,100",
label: '95%-100%',
value: '95,100',
},
{
label: "100%-100%",
value: "100,100",
label: '100%-100%',
value: '100,100',
},
];
]
onBeforeMount(() => {
dicStore.fetchRelationTypeList();
});
dicStore.fetchRelationTypeList()
})
watch(
() => dicStore.relationTypeList,
(newval) => {
logicOptions.value = newval;
}
);
logicOptions.value = newval
},
)
function showModal() {
const list = generateAllData(configStore.systemConfig);
typeOptions.value = list;
show.value = true;
const list = generateAllData(configStore.systemConfig)
typeOptions.value = list
show.value = true
}
function closeModal() {
emit("onOk");
emit('onOk')
setTimeout(() => {
show.value = false;
}, 300);
show.value = false
}, 300)
}
function generateAllData(config): Option[] {
const initVal: Option[] = [];
const initVal: Option[] = []
const list = Object.keys(config).reduce((acc, value) => {
if (value.startsWith("iz") && asideMap[value]?.inFilterList !== false) {
const name = asideMap[value]?.label;
if (value.startsWith('iz') && asideMap[value]?.inFilterList !== false) {
const name = asideMap[value]?.label
name &&
acc.push({
name
&& acc.push({
value,
label: name || "未配置",
});
label: name || '未配置',
})
}
return acc;
}, initVal);
return acc
}, initVal)
return list;
return list
}
watch(
() => configStore.systemConfig,
(newVal) => {
if (!newVal) return;
if (!newVal)
return
const list = generateAllData(newVal);
typeOptions.value = list;
}
);
const list = generateAllData(newVal)
typeOptions.value = list
},
)
function getOptions(key: string) {
if (key === "izsimilarity") return similarityOptions;
const getterName = `get${key}`;
const options = unref(dicStore[getterName]);
return options || [];
if (key === 'izsimilarity')
return similarityOptions
const getterName = `get${key}`
const options = unref(dicStore[getterName])
return options || []
}
function leaveHandler() {
currentStatus.value = "new";
currentEditId = null;
currentStatus.value = 'new'
currentEditId = null
formValue.name = null;
formValue.name = null
formValue.conditions = [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
];
]
}
function edit(editFilter: any) {
currentStatus.value = "edit";
console.log(editFilter, "editFilter");
const { searchname, ocrUsersearchchildList, id } = editFilter;
currentEditId = id;
formValue.name = searchname;
currentStatus.value = 'edit'
console.log(editFilter, 'editFilter')
const { searchname, ocrUsersearchchildList, id } = editFilter
currentEditId = id
formValue.name = searchname
formValue.conditions = ocrUsersearchchildList.map((item) => {
return {
type: item.searchfield,
operator: item.searchtype,
result: unformatValue(item.searchfield, item.searchvalue),
};
});
}
})
}
defineExpose({
showModal,
edit,
});
})
</script>
<template>
<n-modal
v-model:show="show"
transform-origin="center"
@after-leave="leaveHandler"
:mask-closable="false"
class="modal_wrapper"
@after-leave="leaveHandler"
>
<n-card
:style="cardStyle"
@ -319,20 +323,24 @@ defineExpose({
'font-size': '16px',
'font-weight': '600',
}"
>基本信息</span
>
>基本信息</span>
</div>
</div>
<div class="wrapper-form">
<n-form ref="formRef" :model="formValue" :rules="rules" >
<n-form-item path="name" label="标题" mergedRequireMarkPlacement="left">
<n-form
ref="formRef"
:model="formValue"
:rules="rules"
require-mark-placement="left"
>
<n-form-item path="name" label="标题" merged-require-mark-placement="left">
<!-- j -->
<n-input
v-model:value="formValue.name"
:style="{ width: '780px' }"
maxlength="15"
@keydown.enter.prevent
placeholder="请输入过滤名称"
@keydown.enter.prevent
/>
</n-form-item>
<n-form-item v-show="false" path="logic" label="逻辑关系">
@ -418,12 +426,12 @@ defineExpose({
y="0"
width="64"
height="64"
></rect>
/>
<path
d="M32,4 C16.5619675,4 4,16.5600322 4,32 C4,47.4399678 16.5600322,60 32,60 C47.4380325,60 60,47.4399678 60,32 C60,16.5600322 47.4399678,4 32,4 Z M43.4220132,40.6240021 C44.2020159,41.4079827 44.1999731,42.6720064 43.4180353,43.4520091 C43.0280877,43.8400215 42.5180487,44.0360166 42.0060745,44.0360166 C41.4920576,44.0360166 40.9800834,43.8400214 40.5900283,43.4480311 L31.9900014,34.8219862 L23.3620213,43.3580432 C22.9720737,43.7420776 22.4639699,43.9360301 21.9559737,43.9360301 C21.4400215,43.9360301 20.9260046,43.7379922 20.5340143,43.3420239 C19.7579895,42.5560005 19.7640102,41.2919768 20.5500336,40.5140169 L29.1680151,31.9900013 L20.5819648,23.3759978 C19.8019621,22.5939524 19.8040049,21.3279935 20.5859428,20.5479908 C21.3679882,19.7659454 22.6319043,19.7700309 23.4139498,20.5519687 L32.0119339,29.1759709 L40.639914,20.6400214 C41.4238946,19.8620614 42.6918962,19.8700173 43.467921,20.6560407 C44.2458809,21.4420641 44.2379251,22.708023 43.4519016,23.4840477 L34.8340277,32.0079559 L43.4220132,40.6240021 Z"
id="形状"
d="M32,4 C16.5619675,4 4,16.5600322 4,32 C4,47.4399678 16.5600322,60 32,60 C47.4380325,60 60,47.4399678 60,32 C60,16.5600322 47.4399678,4 32,4 Z M43.4220132,40.6240021 C44.2020159,41.4079827 44.1999731,42.6720064 43.4180353,43.4520091 C43.0280877,43.8400215 42.5180487,44.0360166 42.0060745,44.0360166 C41.4920576,44.0360166 40.9800834,43.8400214 40.5900283,43.4480311 L31.9900014,34.8219862 L23.3620213,43.3580432 C22.9720737,43.7420776 22.4639699,43.9360301 21.9559737,43.9360301 C21.4400215,43.9360301 20.9260046,43.7379922 20.5340143,43.3420239 C19.7579895,42.5560005 19.7640102,41.2919768 20.5500336,40.5140169 L29.1680151,31.9900013 L20.5819648,23.3759978 C19.8019621,22.5939524 19.8040049,21.3279935 20.5859428,20.5479908 C21.3679882,19.7659454 22.6319043,19.7700309 23.4139498,20.5519687 L32.0119339,29.1759709 L40.639914,20.6400214 C41.4238946,19.8620614 42.6918962,19.8700173 43.467921,20.6560407 C44.2458809,21.4420641 44.2379251,22.708023 43.4519016,23.4840477 L34.8340277,32.0079559 L43.4220132,40.6240021 Z"
fill="#DDDDDD"
></path>
/>
</g>
</g>
</g>
@ -434,7 +442,7 @@ defineExpose({
</n-form>
</div>
<div class="wrapper-new" @click="createCondition">
<span style="font-size:16px;">+</span>
<span style="font-size: 16px">+</span>
<span style="margin-left: 8px">添加筛选条件</span>
</div>
</div>
@ -492,7 +500,7 @@ defineExpose({
color: #507afd;
line-height: 22px;
cursor: pointer;
span{
span {
font-size: 11px;
}
&:hover {
@ -507,7 +515,7 @@ defineExpose({
&-footer {
display: flex;
justify-content: flex-end;
margin-bottom:6px;
margin-bottom: 6px;
}
&-info {
@ -542,8 +550,8 @@ defineExpose({
.modal_wrapper {
padding: 14px 14px 0 14px !important;
}
::v-deep(.n-form-item .n-form-item-label){
font-size:14px;
::v-deep(.n-form-item .n-form-item-label) {
font-size: 14px;
color: #666666;
font-weight: 500;
}

@ -1,32 +1,32 @@
<script lang="ts" setup>
import { computed, reactive, ref, toRefs } from "vue";
import { format } from "date-fns";
import { useRoute, useRouter } from "vue-router";
import { getMessageList, readAllMsg, readMsg } from "@/api/message/message";
import iconApproveActive from "@/assets/images/message/approve-active.png";
import iconApprove from "@/assets/images/message/approve.png";
import iconSystemActive from "@/assets/images/message/system-active.png";
import iconSystem from "@/assets/images/message/system.png";
import iconArrowActive from "@/assets/images/message/arrow-active.png";
import iconArrow from "@/assets/images/message/arrow.png";
import iconClear from "@/assets/images/message/clear.png";
import iconArrowDown from "@/assets/images/message/arrow-down.png";
const emit = defineEmits(["goDetail"]);
const router = useRouter();
const route = useRoute();
const hasNextPage = ref(false);
import { computed, reactive, ref, toRefs } from 'vue'
import { format } from 'date-fns'
import { useRoute, useRouter } from 'vue-router'
import { getMessageList, readAllMsg, readMsg } from '@/api/message/message'
import iconApproveActive from '@/assets/images/message/approve-active.png'
import iconApprove from '@/assets/images/message/approve.png'
import iconSystemActive from '@/assets/images/message/system-active.png'
import iconSystem from '@/assets/images/message/system.png'
import iconArrowActive from '@/assets/images/message/arrow-active.png'
import iconArrow from '@/assets/images/message/arrow.png'
import iconClear from '@/assets/images/message/clear.png'
import iconArrowDown from '@/assets/images/message/arrow-down.png'
const emit = defineEmits(['goDetail'])
const router = useRouter()
const route = useRoute()
const hasNextPage = ref(false)
const state = reactive({
tabList: [
// {
// name: "",
// icon: iconApprove,
// activeIcon: iconApproveActive,
// value: 1,
// },
{
name: "审批通知",
icon: iconApprove,
activeIcon: iconApproveActive,
value: 1,
},
{
name: "系统消息",
name: '系统消息',
icon: iconSystem,
activeIcon: iconSystemActive,
value: 2,
@ -34,127 +34,148 @@ const state = reactive({
],
list: [] as any,
pageNo: 1,
});
})
const { list, tabList } = toRefs(state);
const { list, tabList } = toRefs(state)
const tab = ref(1);
const tab = ref(2)
const getStateText = computed(() => {
return (value) => (value == 1 ? "待审批" : value == 2 ? "通过" : "不通过");
});
return value => (value == 1 ? '待审批' : value == 2 ? '通过' : '不通过')
})
async function getList(type = "") {
async function getList(type = '') {
let res = await getMessageList({
pageNo: state.pageNo,
pageSize: "20",
pageSize: '20',
msgCategory: tab.value,
});
console.log("getMessageList", res.data);
if (type == "more") {
if (res.code == "OK") {
})
console.log('getMessageList', res.data)
if (type == 'more') {
if (res.code == 'OK') {
if (tab.value === 1) {
res.data.list.forEach((item) => {
item.tag = JSON.parse(item.busJson);
});
item.tag = JSON.parse(item.busJson)
})
}
state.list = state.list.concat(res.data.list);
state.pageNo++;
state.list = state.list.concat(res.data.list)
state.pageNo++
res = await getMessageList({
pageNo: state.pageNo,
pageSize: "20",
pageSize: '20',
msgCategory: tab.value,
});
})
}
hasNextPage.value = res.data.hasNextPage;
} else {
if (res.code === "OK") {
hasNextPage.value = res.data.hasNextPage;
hasNextPage.value = res.data.hasNextPage
}
else {
if (res.code === 'OK') {
hasNextPage.value = res.data.hasNextPage
if (tab.value === 1) {
res.data.list.forEach((item) => {
item.tag = JSON.parse(item.busJson);
});
item.tag = JSON.parse(item.busJson)
})
}
state.list = state.list.concat(res.data.list);
state.list = state.list.concat(res.data.list)
}
}
}
getList();
getList()
async function clearMsg() {
const res = await readAllMsg({ msgCategory: tab.value });
if (res.code === "OK") {
state.list = [];
state.pageNo = 1;
getList();
const res = await readAllMsg({ msgCategory: tab.value })
if (res.code === 'OK') {
state.list = []
state.pageNo = 1
getList()
}
}
function switchTab(type: number) {
tab.value = type;
state.list = [];
state.pageNo = 1;
getList();
tab.value = type
state.list = []
state.pageNo = 1
getList()
}
function goFinalDetail(row) {
console.log(row);
console.log(row)
router.push({
name: "final-detail",
name: 'final-detail',
query: { id: row.tag.fromId, packageid: row.packageid },
});
})
}
function goDetail(item) {
if (tab.value === 1) {
clearMsgOne(item.id);
goFinalDetail(item);
clearMsgOne(item.id)
goFinalDetail(item)
}
// emit('goDetail', item.id)
else {
router.push({ name: "message-detail", query: { id: item.id } });
router.push({ name: 'message-detail', query: { id: item.id } })
}
}
async function clearMsgOne(id) {
const res = await readMsg({ msgid: id });
const res = await readMsg({ msgid: id })
}
function getMore() {
state.pageNo += 1;
getList("more");
state.pageNo += 1
getList('more')
}
console.log(tabList);
console.log(tabList)
</script>
<template>
<div class="wrapper-message">
<div class="flex justify-between header">
<div class="header-title">消息通知</div>
<div class="header-title">
消息通知
</div>
<div class="clear" @click="clearMsg">
<img class="icon-clear" :src="iconClear" alt="" />
<img class="icon-clear" :src="iconClear" alt="">
清除未读
</div>
</div>
<div class="content">
<div class="slider">
<div v-for="item in tabList" :key="item.value" :class="{ 'item-active': tab === item.value }" class="flex item"
@click="switchTab(item.value)">
<div
v-for="item in tabList"
:key="item.value"
:class="{ 'item-active': tab === item.value }"
class="flex item"
@click="switchTab(item.value)"
>
<div class="flex item-left align-center">
<img class="icon" :src="tab === item.value ? item.activeIcon : item.icon" alt="" />
<img
class="icon"
:src="tab === item.value ? item.activeIcon : item.icon"
alt=""
>
<div :class="{ 'text-active': tab === item.value }" class="text">
{{ item.name }}
</div>
</div>
<img class="icon-arrow" :src="tab === item.value ? iconArrowActive : iconArrow" alt="" />
<img
class="icon-arrow"
:src="tab === item.value ? iconArrowActive : iconArrow"
alt=""
>
<div v-if="tab === item.value" class="line" />
</div>
</div>
<div class="list">
<div v-for="(item, index) in list" :key="item.id" :class="{ pt0: index === 0, 'item-disabled': item.readFlag }"
class="item" @click="goDetail(item)">
<div
v-for="(item, index) in list"
:key="item.id"
:class="{ 'pt0': index === 0, 'item-disabled': item.readFlag }"
class="item"
@click="goDetail(item)"
>
<div class="left">
<div class="num">
{{ format(item.sendTime, "dd") }}
@ -172,7 +193,9 @@ console.log(tabList);
{{ item.titile }}
</div>
<div v-if="tab === 1" class="status">
<div class="tag tag-blue">审批节点{{ item.tag.sendUserName }}</div>
<div class="tag tag-blue">
审批节点{{ item.tag.sendUserName }}
</div>
<div :class="item.tag.states === 3 ? 'tag-red' : 'tag-green'" class="tag">
审批状态{{ getStateText(item.tag.states) }}
</div>
@ -186,11 +209,13 @@ console.log(tabList);
<span class="time">{{ format(item.sendTime, "yyyy-MM-dd HH:mm:ss") }}</span>
</div>
</div>
<div class="look">查看</div>
<div class="look">
查看
</div>
</div>
<div v-if="hasNextPage" class="more" @click="getMore">
查看更多<img class="icon-more" :src="iconArrowDown" alt="" />
查看更多<img class="icon-more" :src="iconArrowDown" alt="">
</div>
</div>
</div>
@ -457,4 +482,5 @@ console.log(tabList);
// ::v-deep(.n-divider:not(.n-divider--vertical)) {
// margin-top: 12px;
// margin-bottom: 12px;
// }</style>
// }
</style>

@ -31,7 +31,13 @@ const allCount = computed(() => {
})
const selectCount = computed(() => {
return `显示字段(共${onList.value.length}个)`
let baseNum = 0
offList.value.forEach((item) => {
if (item.fix)
baseNum++
})
return `显示字段(共${baseNum + onList.value.length}个)`
// return `(${onList.value.length})`
})
const show = ref(false)
@ -196,6 +202,11 @@ function clearDragSource() {
return item.fix === true
})
onShowList.value = cloneDeep(onList.value)
offList.value = offList.value.map(item => ({
...item,
checked: item.fix,
}))
offShowList.value = cloneDeep(offList.value)
}
function removeHandler(id: string) {

@ -1,107 +1,107 @@
<script lang="ts" setup>
import type { FormInst, FormItemRule, FormRules } from "naive-ui";
import { computed, onBeforeMount, reactive, ref, unref, watch } from "vue";
import { asideTaskMap } from "@/config/final";
import { useDictionary } from "@/store/modules/dictonary";
import { useConfig } from "@/store/modules/asideConfig";
import type { FilterCondition } from "/#/api";
import { addCondition, updateCondition } from "@/api/home/filter";
import { formatToDate2, formatToDate3 } from "@/utils/dateUtil";
type Status = "edit" | "new";
const show = ref(false);
const configStore = useConfig();
const dicStore = useDictionary();
const currentStatus = ref<Status>("new");
let currentEditId: string | null = null;
const emit = defineEmits(["onOk"]);
import type { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { computed, onBeforeMount, reactive, ref, unref, watch } from 'vue'
import { asideTaskMap } from '@/config/final'
import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig'
import type { FilterCondition } from '/#/api'
import { addCondition, updateCondition } from '@/api/home/filter'
import { formatToDate2, formatToDate3 } from '@/utils/dateUtil'
type Status = 'edit' | 'new'
const emit = defineEmits(['onOk'])
const show = ref(false)
const configStore = useConfig()
const dicStore = useDictionary()
const currentStatus = ref<Status>('new')
let currentEditId: string | null = null
const modalTitle = computed(() => {
return currentStatus.value === "new" ? "新建过滤条件" : "编辑过滤条件";
});
return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件'
})
const cardStyle = {
width: "800px",
"--n-padding-bottom": "10px",
"--n-padding-left": "10px",
};
'width': '800px',
'--n-padding-bottom': '10px',
'--n-padding-left': '10px',
}
const noBorderInput = {
"--n-border": "0px",
"--n-border-hover": "0px",
"--n-border-pressed": "0px",
};
'--n-border': '0px',
'--n-border-hover': '0px',
'--n-border-pressed': '0px',
}
const formItemStyle = {
"--n-label-height": "0px",
"--n-feedback-height": "8px",
};
'--n-label-height': '0px',
'--n-feedback-height': '8px',
}
interface FormType {
name: string | null;
logic: string | null;
conditions: Condition[];
name: string | null
logic: string | null
conditions: Condition[]
}
interface Condition {
type: string | null;
operator: string | null;
result: any;
type: string | null
operator: string | null
result: any
}
interface Option {
label: string;
value: string;
label: string
value: string
}
const rules: FormRules = {
name: {
required: true,
message: "请输入过滤条件名称",
trigger: "blur",
message: '请输入过滤条件名称',
trigger: 'blur',
},
logic: {
required: true,
message: "请选择逻辑关系",
trigger: "blur",
message: '请选择逻辑关系',
trigger: 'blur',
},
conditions: {
required: true,
validator(rule: FormItemRule, value: Condition[]) {
for (const item of value) {
const { type, operator, result } = item;
const { type, operator, result } = item
if (type === null || operator === null || result === null)
return new Error("请选择过滤条件");
return new Error('请选择过滤条件')
}
return true;
return true
},
trigger: ["input", "blur"],
trigger: ['input', 'blur'],
},
};
}
const formRef = ref<FormInst | null>(null);
const formRef = ref<FormInst | null>(null)
const formValue = reactive<FormType>({
name: null,
logic: "and",
logic: 'and',
conditions: [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
],
});
})
function handleSumbit(e: MouseEvent) {
e.preventDefault();
e.preventDefault()
formRef.value?.validate((errors) => {
if (errors) return;
if (errors)
return
const list = formValue.conditions.map((item, index) => {
const { type, operator, result } = item;
const { type, operator, result } = item
return {
searchfield: type!,
@ -109,168 +109,169 @@ function handleSumbit(e: MouseEvent) {
searchvalue: formatValue(type!, result),
searchRelationType: formValue.logic!,
orderNum: index + 1,
};
});
}
})
const param: FilterCondition = {
searchname: formValue.name!,
type: 2,
ocrUsersearchchildList: list,
};
}
if (currentStatus.value === "new") addCondition(param);
else updateCondition({ id: currentEditId!, ...param });
closeModal();
});
if (currentStatus.value === 'new')
addCondition(param)
else updateCondition({ id: currentEditId!, ...param })
closeModal()
})
}
function formatValue(searchfield: string, searchvalue: any) {
if (searchfield === "izuptime") {
const start = formatToDate2(searchvalue[0]);
const end = formatToDate2(searchvalue[1]);
return `${start}-${end}`;
if (searchfield === 'izuptime') {
const start = formatToDate2(searchvalue[0])
const end = formatToDate2(searchvalue[1])
return `${start}-${end}`
}
return searchvalue;
return searchvalue
}
//
function unformatValue(searchfield: string, searchvalue: any) {
// 2022/01/03-2023/02/04
if (searchfield === "izuptime") {
const dataStrs = searchvalue.split("-");
const start = formatToDate3(dataStrs[0]);
const end = formatToDate3(dataStrs[1]);
return [start, end];
if (searchfield === 'izuptime') {
const dataStrs = searchvalue.split('-')
const start = formatToDate3(dataStrs[0])
const end = formatToDate3(dataStrs[1])
return [start, end]
}
return searchvalue;
return searchvalue
}
function createCondition() {
formValue.conditions.push({
type: null,
operator: "eq",
operator: 'eq',
result: null,
});
})
}
function removeCondition(index: number) {
formValue.conditions.splice(index, 1);
formValue.conditions.splice(index, 1)
}
function formLabel(index: number) {
return index === 0 ? "筛选条件" : "";
return index === 0 ? '筛选条件' : ''
}
const typeOptions = ref<Option[]>([]);
const typeOptions = ref<Option[]>([])
const operatorOptions = [
{
label: "等于",
value: "eq",
label: '等于',
value: 'eq',
},
{
label: "不等于",
value: "notEq",
label: '不等于',
value: 'notEq',
},
];
]
const logicOptions = ref([]);
const logicOptions = ref([])
onBeforeMount(() => {
// dicStore.fetchRelationTypeList();
dicStore.initData();
});
dicStore.initData()
})
watch(
() => dicStore.relationTypeList,
(newval) => {
logicOptions.value = newval;
}
);
logicOptions.value = newval
},
)
function showModal() {
show.value = true;
show.value = true
}
function closeModal() {
emit("onOk");
emit('onOk')
setTimeout(() => {
show.value = false;
}, 300);
show.value = false
}, 300)
}
function generateAllData(): Option[] {
const initVal: Option[] = [];
console.log(asideTaskMap,'asideTaskMap')
const initVal: Option[] = []
console.log(asideTaskMap, 'asideTaskMap')
const list = Object.keys(asideTaskMap).reduce((acc, value) => {
if (value.startsWith("iz") && asideTaskMap[value]?.inFilterList !== false) {
const name = asideTaskMap[value]?.label;
if (value.startsWith('iz') && asideTaskMap[value]?.inFilterList !== false) {
const name = asideTaskMap[value]?.label
name &&
acc.push({
name
&& acc.push({
value,
label: name || "未配置",
});
label: name || '未配置',
})
}
return acc;
}, initVal);
return acc
}, initVal)
return list;
return list
}
typeOptions.value = generateAllData();
typeOptions.value = generateAllData()
function getOptions(key: string) {
console.log('key',key,'getOptions');
console.log(formValue.conditions,'formValue.conditions')
const getterName = `get${key}`;
const options = unref(dicStore[getterName]);
return options || [];
console.log('key', key, 'getOptions')
console.log(formValue.conditions, 'formValue.conditions')
const getterName = `get${key}`
const options = unref(dicStore[getterName])
return options || []
}
function leaveHandler() {
currentStatus.value = "new";
currentEditId = null;
currentStatus.value = 'new'
currentEditId = null
formValue.name = null;
formValue.name = null
formValue.conditions = [
{
type: null,
operator: "eq",
operator: 'eq',
result: null,
},
];
]
}
function edit(editFilter: any) {
currentStatus.value = "edit";
currentStatus.value = 'edit'
const { searchname, ocrUsersearchchildList, id } = editFilter;
currentEditId = id;
formValue.name = searchname;
const { searchname, ocrUsersearchchildList, id } = editFilter
currentEditId = id
formValue.name = searchname
formValue.conditions = ocrUsersearchchildList.map((item) => {
return {
type: item.searchfield,
operator: item.searchtype,
result: unformatValue(item.searchfield, item.searchvalue),
};
});
}
})
}
defineExpose({
showModal,
edit,
});
})
</script>
<template>
<n-modal
v-model:show="show"
transform-origin="center"
@after-leave="leaveHandler"
class="modal_wrapper"
@after-leave="leaveHandler"
>
<n-card
:style="cardStyle"
@ -289,24 +290,28 @@ defineExpose({
'font-size': '16px',
'font-weight': '600',
}"
>基本信息</span
>
>基本信息</span>
</div>
</div>
<div class="wrapper-form">
<n-form ref="formRef" :model="formValue" :rules="rules">
<n-form
ref="formRef"
:model="formValue"
:rules="rules"
require-mark-placement="left"
>
<n-form-item path="name" label="标题">
<n-input
v-model:value="formValue.name"
:style="{ width: '780px' }"
@keydown.enter.prevent
placeholder="请输入过滤名称"
@keydown.enter.prevent
/>
</n-form-item>
<n-form-item path="logic" label="逻辑关系" v-show="false">
<n-form-item v-show="false" path="logic" label="逻辑关系">
<n-select
filterable
v-model:value="formValue.logic"
filterable
placeholder="请选择逻辑关系"
:options="logicOptions"
/>
@ -319,15 +324,15 @@ defineExpose({
:label="formLabel(index)"
>
<n-select
filterable
v-model:value="item.type"
filterable
placeholder="请选择筛选项名称"
:options="typeOptions"
@update="item.result = ''"
/>
<n-select
filterable
v-model:value="item.operator"
filterable
style="margin-left: 8px"
placeholder="请选择"
:options="operatorOptions"
@ -341,9 +346,9 @@ defineExpose({
/>
</n-space>
<n-select
filterable
v-else
v-model:value="item.result"
filterable
style="margin-left: 8px"
placeholder="请选择"
:options="getOptions(item.type!)"
@ -361,13 +366,15 @@ defineExpose({
</n-form>
</div>
<div class="wrapper-new" @click="createCondition">
<span style="font-size:16px;">+</span>
<span style="font-size: 16px">+</span>
<span style="margin-left: 8px">添加筛选条件</span>
</div>
</div>
<template #footer>
<div class="wrapper-footer">
<n-button type="info" @click="handleSumbit"> </n-button>
<n-button type="info" @click="handleSumbit">
确定
</n-button>
<n-button secondary style="margin-left: 15px" @click="closeModal">
取消
</n-button>
@ -408,7 +415,7 @@ defineExpose({
color: #507afd;
line-height: 22px;
cursor: pointer;
span{
span {
font-size: 11px;
}
&:hover {
@ -423,7 +430,7 @@ defineExpose({
&-footer {
display: flex;
justify-content: flex-end;
margin-bottom:6px;
margin-bottom: 6px;
}
&-info {
@ -449,8 +456,8 @@ defineExpose({
.modal_wrapper {
padding: 14px 14px 0 14px !important;
}
::v-deep(.n-form-item .n-form-item-label){
font-size:14px;
::v-deep(.n-form-item .n-form-item-label) {
font-size: 14px;
color: #666666;
font-weight: 500;
}

@ -24,7 +24,7 @@ const props = defineProps({
},
mouseOverTask: {
type: Object,
default: () => [],
default: () => {},
},
})
const emit = defineEmits(['dismisClick'])
@ -189,7 +189,7 @@ onMounted(async () => {})
<style lang="less" scoped>
.list-item {
padding: 10px 0px 10px 8px;
padding: 10px 0px 30px 8px;
position: relative;
border-bottom: 1px solid #e8e8e8;
// · transition: height: 0.2s ease-out;

@ -11,7 +11,7 @@ import { isEmpty } from '@/utils'
import type { PackageListItem } from '/#/workorder'
import NotPassed from '@/components/NotPassed.vue'
defineProps({
const props = defineProps({
showFieldList: {
type: Array,
default: () => [],
@ -21,9 +21,13 @@ defineProps({
default: () => [],
},
})
const emit = defineEmits(['ApprovalOver'])
watch(
() => props.showFieldList,
(value) => {
console.log('showFieldList---->', value)
},
)
const workStore = useWorkOrder()
const data = ref<PackageListItem[]>([])
const activeId = ref('')

@ -1,6 +1,14 @@
<script lang="ts" setup>
import { difference } from 'lodash-es'
import { computed, defineEmits, defineProps, onMounted, onUnmounted, ref, watch } from 'vue'
import {
computed,
defineEmits,
defineProps,
onMounted,
onUnmounted,
ref,
watch,
} from 'vue'
import { VueDraggable } from 'vue-draggable-plus'
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import { workPackageMap } from '@/config/workorder'
@ -40,73 +48,18 @@ const showOnList = computed(() => {
return onList.value.filter(i => i.name.includes(searchFixVal.value))
})
const selectCount = computed(() => {
return `显示字段(共${onList.value.length}个)`
})
function generatList() {
const keys = Object.keys(workPackageMap)
let showList: object[] = []
const hideList: object[] = []
const showStr = 'status'
const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
for (const key of keys) {
const name = workPackageMap[key]?.label
const isDefault = workPackageMap[key]?.isDefault
// Y
if (!isDefault) {
hideList.push({
id: key,
name: name || '未配置',
fix: isDefault,
checked: workPackageMap[key].isDefault,
let baseNum = 0
offList.value.forEach((item) => {
if (item.fix)
baseNum++
})
}
}
showList = showKeys.reduce((acc, key) => {
const config = {
id: key,
name: workPackageMap[key].label || '未配置',
fix: workPackageMap[key].isDefault,
}
return [...acc, config]
}, [])
const fixedList = generateDefaultList()
hideList.unshift(...fixedList)
showList.unshift(...fixedList)
onList.value = showList
offList.value = hideList
return { showList, hideList }
}
function generateDefaultList() {
return Object.keys(workPackageMap).reduce((acc, key) => {
const { label, isDefault } = workPackageMap[key]
if (isDefault) {
const config = {
id: key,
name: label || '未配置',
fix: true,
checked: true,
}
return [...acc, config]
}
else {
return acc
}
}, [])
}
return `显示字段(共${baseNum + onList.value.length}个)`
})
const show = ref(false)
const checkAll = computed(() => {
let baseNum = 0
offList.value.map((v) => {
offList.value.forEach((v) => {
if (v.fix)
baseNum += 1
})
@ -124,10 +77,10 @@ async function handleSumbit(e: MouseEvent) {
const userStore = useUser()
const userInfo = userStore.getUserInfo
let userField = ''
fixList.value.map((v) => {
fixList.value.forEach((v) => {
userField += `${v.id},`
})
onList.value.map((v) => {
onList.value.forEach((v) => {
userField += `${v.id},`
})
userField = userField.slice(0, userField.length - 1)
@ -141,20 +94,26 @@ defineExpose({
showModal,
})
// generatList();
const selectIds = ref<string[]>([])
function onCheckAllChange(value) {
const ids: string[] = []
if (value) {
offList.value.forEach((v) => {
console.log()
if (!v.checked)
onList.value.push(v)
})
}
else {
onList.value = []
}
for (const item of offList.value) {
if (!item.fix) {
item.checked = value
ids.push(item.id)
}
}
selectIds.value = value ? ids : []
}
@ -174,15 +133,12 @@ const showIds = computed(() => {
})
})
//
watch(
show,
(val) => {
watch(show, (val) => {
if (!val) {
searchKey.value = ''
searchFixVal.value = ''
}
},
)
})
watch(
() => selectIds.value.length,
(newVal, oldVal) => {
@ -288,7 +244,7 @@ async function getData() {
const userFieldFixed = useList.userFieldFixed?.split(',')
const userFieldUnFixed = useList.userFieldUnFixed?.split(',')
allList.map((v) => {
allList.forEach((v) => {
const item = {
name: v.fieldDesc,
id: v.name,
@ -303,7 +259,7 @@ async function getData() {
else offList.value.push(item)
})
offList.value.unshift(...fixList.value)
useList.userFieldFixed?.split(',').map((v) => {
useList.userFieldFixed?.split(',').forEach((v) => {
let item = allList.find(v2 => v2.name == v)
if (item) {
item = {
@ -338,7 +294,7 @@ onUnmounted(() => {
})
const indeterminate = computed(() => {
let baseNum = 0
offList.value.map((v) => {
offList.value.forEach((v) => {
if (v.fix)
baseNum += 1
})

Loading…
Cancel
Save