feat: 修改图片相关bug

pull/208/head
raofuzi 1 year ago
commit 9a5700ae00

8
components.d.ts vendored

@ -11,6 +11,7 @@ declare module 'vue' {
BasicModal: typeof import('./src/components/Modal/BasicModal.vue')['default'] BasicModal: typeof import('./src/components/Modal/BasicModal.vue')['default']
DataHeader: typeof import('./src/components/DataHeader/index.vue')['default'] DataHeader: typeof import('./src/components/DataHeader/index.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar'] NAvatar: typeof import('naive-ui')['NAvatar']
NBackTop: typeof import('naive-ui')['NBackTop']
NButton: typeof import('naive-ui')['NButton'] NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard'] NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox'] NCheckbox: typeof import('naive-ui')['NCheckbox']
@ -21,6 +22,8 @@ declare module 'vue' {
NDialogProvider: typeof import('naive-ui')['NDialogProvider'] NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDivider: typeof import('naive-ui')['NDivider'] NDivider: typeof import('naive-ui')['NDivider']
NDropdown: typeof import('naive-ui')['NDropdown'] NDropdown: typeof import('naive-ui')['NDropdown']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NEmpty: typeof import('naive-ui')['NEmpty']
NForm: typeof import('naive-ui')['NForm'] NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem'] NFormItem: typeof import('naive-ui')['NFormItem']
NGrid: typeof import('naive-ui')['NGrid'] NGrid: typeof import('naive-ui')['NGrid']
@ -31,6 +34,7 @@ declare module 'vue' {
NModal: typeof import('naive-ui')['NModal'] NModal: typeof import('naive-ui')['NModal']
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NotPassed: typeof import('./src/components/NotPassed.vue')['default'] NotPassed: typeof import('./src/components/NotPassed.vue')['default']
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NPopover: typeof import('naive-ui')['NPopover'] NPopover: typeof import('naive-ui')['NPopover']
NPopselect: typeof import('naive-ui')['NPopselect'] NPopselect: typeof import('naive-ui')['NPopselect']
NProgress: typeof import('naive-ui')['NProgress'] NProgress: typeof import('naive-ui')['NProgress']
@ -40,7 +44,11 @@ declare module 'vue' {
NSpace: typeof import('naive-ui')['NSpace'] NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin'] NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch'] NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag'] NTag: typeof import('naive-ui')['NTag']
NTimeline: typeof import('naive-ui')['NTimeline']
NTimelineItem: typeof import('naive-ui')['NTimelineItem']
NTooltip: typeof import('naive-ui')['NTooltip'] NTooltip: typeof import('naive-ui')['NTooltip']
NUpload: typeof import('naive-ui')['NUpload'] NUpload: typeof import('naive-ui')['NUpload']
NUploadDragger: typeof import('naive-ui')['NUploadDragger'] NUploadDragger: typeof import('naive-ui')['NUploadDragger']

@ -22,7 +22,7 @@ index 3aacec9..a63ab54 100644
+ class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--error flex` + class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--error flex`
+ }, [h('img', { + }, [h('img', {
+ style: { width: '1rem', height: '1rem' }, + style: { width: '1rem', height: '1rem' },
+ src: 'http://47.93.59.251/api/upload/ocr/1711419313955_c.png' + src: 'http://47.93.59.251/api/upload/ocr/1713246379185_c.png'
+ }), feedbackNodes]) : mergedValidationStatus === 'success' ? h("div", { + }), feedbackNodes]) : mergedValidationStatus === 'success' ? h("div", {
key: "controlled-success", key: "controlled-success",
class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--success` class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--success`

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

@ -5,6 +5,17 @@ import { http } from '@/utils/http/axios'
import { pickBy } from 'lodash-es' import { pickBy } from 'lodash-es'
import type { CheckParam, PageParam, QueryPictureParam, UploadParam } from '/#/api' import type { CheckParam, PageParam, QueryPictureParam, UploadParam } from '/#/api'
/**
*
* @returns
*/
export async function gettaskToolsCount(): Promise<any> {
return await http.request({
url: `/ocr/aitools/toolsTaskApprovalCount`,
method: 'get',
})
}
/** /**
* *
* @param params * @param params
@ -79,7 +90,6 @@ export async function getToolsCount() {
}) })
} }
/** /**
* *
* @param note * @param note
@ -108,7 +118,7 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @param note * @param note
* @returns * @returns
*/ */
export async function oneClickCheckTaskPackage(params: Partial<CheckParam> = { search_history: '0' }) { export async function oneClickCheckTaskPackage(params: Partial<CheckParam> = { search_history: '0' }) {
const notEmptyParams = pickBy(params, notEmpty) const notEmptyParams = pickBy(params, notEmpty)
Object.keys(notEmptyParams).forEach((key) => { Object.keys(notEmptyParams).forEach((key) => {
@ -131,8 +141,7 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @param note * @param note
* @returns * @returns
*/ */
export async function getLastCheckNo() { export async function getLastCheckNo() {
return http.request({ return http.request({
url: `/ocr/checkDuplicate/getLastCheckNo`, url: `/ocr/checkDuplicate/getLastCheckNo`,
method: 'get', method: 'get',
@ -144,8 +153,7 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @param note * @param note
* @returns * @returns
*/ */
export async function getCheckDuplicateStatus(checkDuplicateNo) { export async function getCheckDuplicateStatus(checkDuplicateNo) {
return http.request({ return http.request({
url: `/ocr/checkDuplicate/getCheckDuplicateStatus`, url: `/ocr/checkDuplicate/getCheckDuplicateStatus`,
method: 'get', method: 'get',
@ -158,8 +166,7 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @param note * @param note
* @returns * @returns
*/ */
export async function removeCheckDuplicate(checkDuplicateNo) { export async function removeCheckDuplicate(checkDuplicateNo) {
return http.request({ return http.request({
url: `/ocr/checkDuplicate/removeCheckDuplicate`, url: `/ocr/checkDuplicate/removeCheckDuplicate`,
method: 'get', method: 'get',
@ -169,33 +176,31 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
} }
/** /**
* *
* @param * @param
* @returns * @returns
*/ */
export async function createPackage(params) { export async function createPackage(params) {
return http.request({ return http.request({
url: `/ocr/ocrTaskPackage/createPackage`, url: `/ocr/ocrTaskPackage/createPackage`,
method: 'post', method: 'post',
params params,
}) })
} }
/** /**
* *
* @param * @param
* @returns * @returns
*/ */
export async function deletePackage(params) { export async function deletePackage(params) {
return http.request({ return http.request({
url: `/ocr/ocrTaskPackage/deletePackage`, url: `/ocr/ocrTaskPackage/deletePackage`,
method: 'get', method: 'get',
params params,
}) })
} }
/** /**
* *
* @param * @param
* @returns * @returns
*/ */
export async function queryPageListByCheckNo(params: any): Promise<any> { export async function queryPageListByCheckNo(params: any): Promise<any> {
@ -266,14 +271,13 @@ export async function getPictureList(params: any): Promise<any> {
/** /**
* *
* @param * @param
* @returns * @returns
*/ */
export async function getFilterList(params) { export async function getFilterList(params) {
return http.request({ return http.request({
url: `/ocr/ocrUsersearch/querySearchCondition`, url: `/ocr/ocrUsersearch/querySearchCondition`,
method: 'get', method: 'get',
params params,
}) })
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineProps, onMounted } from 'vue' import { defineProps, onMounted, ref } from 'vue'
import { gettaskToolsCount } from '@/api/home/main'
defineProps({ defineProps({
hasColor: { hasColor: {
@ -7,6 +8,9 @@ defineProps({
default: () => false, default: () => false,
}, },
}) })
const data = ref()
function initRem() { function initRem() {
const designWidth = 1440 const designWidth = 1440
const rempPx = 16 const rempPx = 16
@ -15,47 +19,60 @@ function initRem() {
} }
onMounted(() => { onMounted(() => {
initRem() initRem()
getData()
}) })
async function getData() {
const data = [ const {
{ data: {
link: 'count', total,
title: '任务总数', treat,
count: 6399, alreadyApprove,
}, repeatedNodules,
{ repeat,
link: 'wait', approvedCount,
title: '待审批', notGoCount,
count: 6290, },
}, } = await gettaskToolsCount()
{ data.value = [
link: 'done', {
title: '已审批', link: 'count',
count: 109, title: '任务总数',
}, count: total,
{ },
link: 'resolve', {
title: '通过', link: 'wait',
count: 3290, title: '待审批',
color: '#03c984', count: treat,
}, },
{ {
link: 'reject', link: 'done',
title: '不通过', title: '已审批',
count: 3000, count: alreadyApprove,
color: '#ff8b8b', },
}, {
{ link: 'resolve',
link: 'reimg', title: '通过',
title: '图片重复数', count: approvedCount,
count: 230, color: '#03c984',
}, },
{ {
link: 'breakcount', link: 'reject',
title: '小结重复数', title: '不通过',
count: 365, count: notGoCount,
}, color: '#ff8b8b',
] },
{
link: 'reimg',
title: '图片重复数',
count: repeat,
},
{
link: 'breakcount',
title: '小结重复数',
count: repeatedNodules,
},
]
}
</script> </script>
<template> <template>
@ -96,7 +113,7 @@ const data = [
height: 2.75rem !important; height: 2.75rem !important;
} }
.data_wrap { .data_wrap {
margin-left: .8125rem; margin-left: 0.8125rem;
.data_title { .data_title {
font-size: 1.125rem; font-size: 1.125rem;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC-Bold; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC-Bold;
@ -109,7 +126,7 @@ const data = [
} }
.data_content { .data_content {
opacity: 0.6; opacity: 0.6;
font-size: .75rem; font-size: 0.75rem;
font-family: PingFang SC, PingFang SC-Regular; font-family: PingFang SC, PingFang SC-Regular;
font-weight: 500; font-weight: 500;
text-align: center; text-align: center;
@ -121,7 +138,7 @@ const data = [
} }
} }
} }
.settingSvg{ .settingSvg {
width: 1rem !important; width: 1rem !important;
height: 1rem !important; height: 1rem !important;
} }

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

@ -3,6 +3,7 @@ import { nextTick, onMounted, onUnmounted, reactive, ref, toRefs } from 'vue'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { deleteSearch, getSearchList, historySearch } from '@/api/search/search' import { deleteSearch, getSearchList, historySearch } from '@/api/search/search'
import { storage } from '@/utils/Storage'
const emit = defineEmits(['close']) const emit = defineEmits(['close'])
@ -73,6 +74,7 @@ function goPath(item, id) {
const desiredObject = item.data.find((item) => { const desiredObject = item.data.find((item) => {
return item.id === id return item.id === id
}) })
storage.set('isSearch', true)
router.push({ name: item.path, query: { id, searchContent: desiredObject.name } }) router.push({ name: item.path, query: { id, searchContent: desiredObject.name } })
emit('close') emit('close')
} }
@ -89,6 +91,8 @@ function highlightText(text, query) {
} }
onMounted(() => { onMounted(() => {
setTimeout(() => (value.value = '')) setTimeout(() => (value.value = ''))
handlerShowList()
handlerSearch('')
}) })
</script> </script>
@ -112,7 +116,7 @@ onMounted(() => {
</div> </div>
<div v-show="showList && (historyList.length || resultList.length)" class="list_box"> <div v-show="showList && (historyList.length || resultList.length)" class="list_box">
<div <div
v-if="historyList.length" v-if="historyList.length && !value"
class="list_classfiy_item" class="list_classfiy_item"
style="border-bottom: 1px solid #e4e4e4" style="border-bottom: 1px solid #e4e4e4"
> >

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

@ -74,7 +74,7 @@ function logOut() {
const currentCompanyName = computed(() => { const currentCompanyName = computed(() => {
const deptlist = useInfo.deptlist const deptlist = useInfo.deptlist
const currentId = userStore.getTenantId const currentId = userStore.getTenantId
const current = deptlist.find(item => item.id === currentId) const current = deptlist.find(item => item.deptno === currentId)
return current?.departname || 'name' return current?.departname || 'name'
}) })

@ -1,13 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { websiteConfig } from '@/config/website.config' import { websiteConfig } from '@/config/website.config'
import { storage } from '@/utils/Storage'
import { CURRENT_USER } from '@/store/mutation-types'
defineOptions({ name: 'Index' }) defineOptions({ name: 'Index' })
const router = useRouter() const router = useRouter()
function clickHandler() { function clickHandler() {
router.push({ path: '/home' }) const userInfo = storage.get(CURRENT_USER)
if (userInfo && userInfo.frontmenuTList) {
if (userInfo.frontmenuTList.find(item => item.resUrl == '/home'))
router.push({ path: '/home' })
}
} }
</script> </script>
@ -18,23 +24,23 @@ function clickHandler() {
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.logo { .logo {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
img { img {
width: auto; width: auto;
height: 32px; height: 32px;
cursor: pointer; cursor: pointer;
} }
.title { .title {
margin: 0; margin: 0;
}
} }
}
</style> </style>

@ -1,57 +1,57 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, onMounted, ref, unref, watch } from "vue"; import { computed, defineComponent, onMounted, ref, unref, watch } from 'vue'
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from 'vue-router'
import { IconGroup } from "../IconGroup"; import { IconGroup } from '../IconGroup'
import { useAsyncRouteStore } from "@/store/modules/asyncRoute"; import { useAsyncRouteStore } from '@/store/modules/asyncRoute'
import { generatorMenu } from "@/utils"; import { generatorMenu } from '@/utils'
import { storage } from "@/utils/Storage"; import { storage } from '@/utils/Storage'
import { CURRENT_USER } from "@/store/mutation-types"; import { CURRENT_USER } from '@/store/mutation-types'
export default defineComponent({ export default defineComponent({
name: "AppMenu", name: 'AppMenu',
components: { IconGroup }, components: { IconGroup },
emits: ["clickMenuItem"], emits: ['clickMenuItem'],
setup(props, { emit }) { setup(props, { emit }) {
// //
const currentRoute = useRoute(); const currentRoute = useRoute()
const router = useRouter(); const router = useRouter()
const asyncRouteStore = useAsyncRouteStore(); const asyncRouteStore = useAsyncRouteStore()
const menus = ref<any[]>([]); const menus = ref<any[]>([])
const selectedSvg = ref<string>(currentRoute.meta.svgname as string); const selectedSvg = ref<string>(currentRoute.meta.svgname as string)
const getSelectedSvg = computed(() => { const getSelectedSvg = computed(() => {
return unref(selectedSvg); return unref(selectedSvg)
}); })
// //
watch( watch(
() => currentRoute.fullPath, () => currentRoute.fullPath,
() => { () => {
updateMenu(); updateMenu()
} },
); )
function updateSelectedKeys() { function updateSelectedKeys() {
const svgname: string = (currentRoute.meta?.svgname as string) || ""; const svgname: string = (currentRoute.meta?.svgname as string) || ''
selectedSvg.value = svgname; selectedSvg.value = svgname
} }
function updateMenu() { function updateMenu() {
menus.value = generatorMenu(asyncRouteStore.getMenus); menus.value = generatorMenu(asyncRouteStore.getMenus)
const userInfo = storage.get(CURRENT_USER); const userInfo = storage.get(CURRENT_USER)
if (userInfo && userInfo.frontmenuTList) { if (userInfo && userInfo.frontmenuTList) {
menus.value = userInfo.frontmenuTList.map((item) => { menus.value = userInfo.frontmenuTList.map((item) => {
let v = { const v = {
component: () => component: () =>
item.resUrl == "/task" item.resUrl == '/task'
? import("@/views/task/index.vue") ? import('@/views/task/index.vue')
: item.resUrl == "/home" : item.resUrl == '/home'
? import("@/views/home/index.vue") ? import('@/views/home/index.vue')
: item.resUrl == "/worksheet" : item.resUrl == '/worksheet'
? import("@/views/worksheet/index.vue") ? import('@/views/worksheet/index.vue')
: item.resUrl == "/final" : item.resUrl == '/final'
? import("@/views/final/index.vue") ? import('@/views/final/index.vue')
: "", : '',
icon: undefined, icon: undefined,
key: item.resKey, key: item.resKey,
label: item.description, label: item.description,
@ -62,38 +62,36 @@ export default defineComponent({
path: item.resUrl, path: item.resUrl,
name: item.resKey, name: item.resKey,
svgname: item.icon, svgname: item.icon,
svgsize: item.resUrl == "/home" ? 60 : 22, svgsize: item.resUrl == '/home' ? 60 : 22,
title: item.description, title: item.description,
}; }
return v; return v
}); })
} }
console.log(userInfo.frontmenuTList,'frontmenuTList'); updateSelectedKeys()
console.log(menus.value,'menus')
updateSelectedKeys();
} }
// //
function clickMenuItem(key: string) { function clickMenuItem(key: string) {
console.log('clickMenuItem',key) if (/http(s)?:/.test(key))
if (/http(s)?:/.test(key)) window.open(key); window.open(key)
else router.push({ name: key }); else router.push({ name: key })
emit("clickMenuItem" as any, key); emit('clickMenuItem' as any, key)
} }
onMounted(() => { onMounted(() => {
updateMenu(); updateMenu()
}); })
return { return {
menus, menus,
selectedSvg, selectedSvg,
getSelectedSvg, getSelectedSvg,
clickMenuItem, clickMenuItem,
}; }
}, },
}); })
</script> </script>
<template> <template>

@ -1,17 +1,40 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, unref } from "vue"; import { computed, onBeforeMount, unref } from 'vue'
import { Logo } from "./components/Logo"; import { useRoute, useRouter } from 'vue-router'
import { MainView } from "./components/Main"; import { Logo } from './components/Logo'
import { AsideMenu } from "./components/Menu"; import { MainView } from './components/Main'
import { PageHeader } from "./components/Header"; import { AsideMenu } from './components/Menu'
import { useProjectSetting } from "@/hooks/setting/useProjectSetting"; import { PageHeader } from './components/Header'
import { useProjectSetting } from '@/hooks/setting/useProjectSetting'
import { storage } from '@/utils/Storage'
const { menuSetting } = useProjectSetting(); const router = useRouter()
const route = useRoute()
onBeforeMount(() => {
/**
* 如果刷新则去掉筛选条件
* 1. 如果当前页面路由与上一个页面路由相同时则为刷新
* 2. 防止一直刷新 另外一个判断条件为当前当前路由query不为{}
* 3. 当前页面下执行当前页面的搜索 1条件一定成立
*
* 4. 搜索点击->存storage->跳转页面->onMounted
* ->如果storage为true则不replace 并将storage置false
*/
if (
history.state.back == route.path
&& JSON.stringify(route.query).trim() != '{}'
&& storage.get('isSearch')
) {
storage.set('isSearch', false)
router.replace(route.path)
}
})
const { menuSetting } = useProjectSetting()
const leftMenuWidth = computed(() => { const leftMenuWidth = computed(() => {
const { minMenuWidth } = unref(menuSetting); const { minMenuWidth } = unref(menuSetting)
return minMenuWidth; return minMenuWidth
}); })
</script> </script>
<template> <template>

@ -9,7 +9,9 @@ export function hideDownload(e: MouseEvent) {
const downloadEle: any = document.querySelector('.n-image-preview-toolbar')?.children[5] const downloadEle: any = document.querySelector('.n-image-preview-toolbar')?.children[5]
const asideValue = unref(configStore.getAsideValue) const asideValue = unref(configStore.getAsideValue)
const download = asideValue?.izimgdownload 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' downloadEle.style.display = 'none'
else else
downloadEle.style.display = 'block' downloadEle.style.display = 'block'

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

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

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

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

@ -520,7 +520,7 @@ async function query(page: number, pageSize: number, filterId?: any, taskName?:
async function handleSorterChange(value) { async function handleSorterChange(value) {
let name = value.columnKey let name = value.columnKey
if (name === 'fromuptime') if (name === 'fromuptime')
name = 'field11' name = 'submit_date_timestamp'
else if (name === 'similarityscore') else if (name === 'similarityscore')
name = 'similarity_score' name = 'similarity_score'
else if (name === 'fromusername') else if (name === 'fromusername')

File diff suppressed because it is too large Load Diff

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

@ -71,8 +71,7 @@ function close() {
configStore.setSearchValue(searchKeyword.value) configStore.setSearchValue(searchKeyword.value)
finalStore.setSearchValue(searchKeyword.value) finalStore.setSearchValue(searchKeyword.value)
if (searchContent) if (searchContent)
router.push(route.path) router.replace(route.path)
emit('close') emit('close')
} }

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

@ -33,11 +33,6 @@ function showModal() {
return return
if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig)) if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig))
return return
console.log(
'开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',
customConfig,
)
const { showList, hideList } = generatList(config, customConfig) const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList) tempList.value = cloneDeep(showList)
if (tempList.value.length > 0) if (tempList.value.length > 0)
@ -136,17 +131,13 @@ function generatList(config, customConfig) {
const fixedList = generateDefaultList(config) const fixedList = generateDefaultList(config)
offList.unshift(...fixedList) offList.unshift(...fixedList)
onList.unshift(...fixedList) onList.unshift(...fixedList)
console.log('原始筛选条件customConfig', customConfig)
// onListcustomConfig // onListcustomConfig
const tempOnList = cloneDeep(onList) const tempOnList = cloneDeep(onList)
console.log('原始筛选条件tempOnList', tempOnList)
const sortKeyList: any = [] const sortKeyList: any = []
configStore.getFilterConfig.map((item: any) => { configStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item?.id) sortKeyList.push(item?.id)
return item return item
}) })
console.log('原始筛选条件sortKeyList', sortKeyList)
const sortList: any = [] const sortList: any = []
if (sortKeyList.length > 0) { if (sortKeyList.length > 0) {
sortKeyList.map((key) => { sortKeyList.map((key) => {
@ -162,8 +153,6 @@ function generatList(config, customConfig) {
return key return key
}) })
} }
console.log('原始筛选条件sortList', sortList)
console.log('原始筛选条件configStore.getFilterConfig', configStore.getFilterConfig)
// return { showList: onList, hideList: offList } // return { showList: onList, hideList: offList }
return { showList: sortList, hideList: offList } return { showList: sortList, hideList: offList }
} }
@ -174,25 +163,21 @@ configStore.$subscribe(() => {
if (config == null || customConfig == null) if (config == null || customConfig == null)
return return
console.log('tempList.value-----------', tempList.value)
console.log('configStore.getFilterConfig-----------', configStore.getFilterConfig)
if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig)) if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig))
return return
const { showList, hideList } = generatList(config, customConfig) const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList) tempList.value = cloneDeep(showList)
console.log('克隆条件', tempList.value)
if (tempList.value.length > 0) if (tempList.value.length > 0)
configStore.setFilterConfig(tempList.value) configStore.setFilterConfig(tempList.value)
onList.value = hideList.filter(item => (item as any).checked)
// setTimeout(() => {
// }, 500);
onList.value = showList
offList.value = hideList offList.value = hideList
if (!showList.length)
handleSumbit()
}) })
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e?: MouseEvent) {
e.preventDefault() e?.preventDefault()
const param = onList.value const param = onList.value
.map((item) => { .map((item) => {
return item.id return item.id
@ -201,21 +186,15 @@ async function handleSumbit(e: MouseEvent) {
await setFilter({ searchcount: param, type: 0 }) await setFilter({ searchcount: param, type: 0 })
const obj = await configStore.fetchCustomConfig() const obj = await configStore.fetchCustomConfig()
console.log('obj-------------------------------', obj)
const tempOnList = cloneDeep(onList.value) const tempOnList = cloneDeep(onList.value)
console.log('原始筛选条件tempOnList', tempOnList)
const sortList: any = [] const sortList: any = []
obj.map((key) => { obj.map((key) => {
const tempItem = tempOnList.find(item => item.id == key) const tempItem = tempOnList.find(item => item.id == key)
sortList.push(tempItem) sortList.push(tempItem)
return key return key
}) })
console.log('configStore.sortList---------------', sortList)
// setTimeout(() => {
if (sortList.length > 0) if (sortList.length > 0)
configStore.setFilterConfig(sortList) configStore.setFilterConfig(sortList)
// }, 500);
closeModal() closeModal()
} }

@ -1,106 +1,107 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { FormInst, FormItemRule, FormRules } from "naive-ui"; import type { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { computed, defineOptions, onBeforeMount, reactive, ref, unref, watch } from "vue"; import { computed, defineOptions, onBeforeMount, reactive, ref, unref, watch } from 'vue'
import { asideMap } from "@/config/aside"; import { asideMap } from '@/config/aside'
import { useDictionary } from "@/store/modules/dictonary"; import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from "@/store/modules/asideConfig"; import { useConfig } from '@/store/modules/asideConfig'
import type { FilterCondition } from "/#/api"; import type { FilterCondition } from '/#/api'
import { addCondition, updateCondition } from "@/api/home/filter"; import { addCondition, updateCondition } from '@/api/home/filter'
import { formatToDate2, formatToDate3 } from "@/utils/dateUtil"; import { formatToDate2, formatToDate3 } from '@/utils/dateUtil'
type Status = "edit" | "new"; type Status = 'edit' | 'new'
const emit = defineEmits(["onOk"]); const emit = defineEmits(['onOk'])
const show = ref(false); const show = ref(false)
const configStore = useConfig(); const configStore = useConfig()
const dicStore = useDictionary(); const dicStore = useDictionary()
const currentStatus = ref<Status>("new"); const currentStatus = ref<Status>('new')
let currentEditId: string | null = null; let currentEditId: string | null = null
const modalTitle = computed(() => { const modalTitle = computed(() => {
return currentStatus.value === "new" ? "新建过滤条件" : "编辑过滤条件"; return currentStatus.value === 'new' ? '新建过滤条件' : '编辑过滤条件'
}); })
const cardStyle = { const cardStyle = {
width: "800px", 'width': '800px',
"--n-padding-bottom": "10px", '--n-padding-bottom': '10px',
"--n-padding-left": "10px", '--n-padding-left': '10px',
}; }
const noBorderInput = { const noBorderInput = {
"--n-border": "0px", '--n-border': '0px',
"--n-border-hover": "0px", '--n-border-hover': '0px',
"--n-border-pressed": "0px", '--n-border-pressed': '0px',
}; }
const formItemStyle = { const formItemStyle = {
"--n-label-height": "0px", '--n-label-height': '0px',
"--n-feedback-height": "8px", '--n-feedback-height': '8px',
}; }
interface FormType { interface FormType {
name: string | null; name: string | null
logic: string | null; logic: string | null
conditions: Condition[]; conditions: Condition[]
} }
interface Condition { interface Condition {
type: string | null; type: string | null
operator: string | null; operator: string | null
result: any; result: any
} }
interface Option { interface Option {
label: string; label: string
value: string; value: string
} }
const rules: FormRules = { const rules: FormRules = {
name: { name: {
required: true, required: true,
message: "请输入过滤条件名称", message: '请输入过滤条件名称',
trigger: "blur", trigger: 'blur',
}, },
logic: { logic: {
required: true, required: true,
message: "请选择逻辑关系", message: '请选择逻辑关系',
trigger: "blur", trigger: 'blur',
}, },
conditions: { conditions: {
required: true, required: true,
validator(rule: FormItemRule, value: Condition[]) { validator(rule: FormItemRule, value: Condition[]) {
for (const item of value) { for (const item of value) {
const { type, operator, result } = item; const { type, operator, result } = item
if (type === null || operator === null || result === null) 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>({ const formValue = reactive<FormType>({
name: null, name: null,
logic: "and", logic: 'and',
conditions: [ conditions: [
{ {
type: null, type: null,
operator: "eq", operator: 'eq',
result: null, result: null,
}, },
], ],
}); })
function handleSumbit(e: MouseEvent) { function handleSumbit(e: MouseEvent) {
e.preventDefault(); e.preventDefault()
formRef.value?.validate((errors) => { formRef.value?.validate((errors) => {
if (errors) return; if (errors)
return
const list = formValue.conditions.map((item, index) => { const list = formValue.conditions.map((item, index) => {
const { type, operator, result } = item; const { type, operator, result } = item
return { return {
searchfield: type!, searchfield: type!,
@ -108,199 +109,202 @@ function handleSumbit(e: MouseEvent) {
searchvalue: formatValue(type!, result), searchvalue: formatValue(type!, result),
searchRelationType: formValue.logic!, searchRelationType: formValue.logic!,
orderNum: index + 1, orderNum: index + 1,
}; }
}); })
const param: FilterCondition = { const param: FilterCondition = {
searchname: formValue.name!, searchname: formValue.name!,
type: 0, type: 0,
ocrUsersearchchildList: list, ocrUsersearchchildList: list,
}; }
if (currentStatus.value === "new") addCondition(param); if (currentStatus.value === 'new')
else updateCondition({ id: currentEditId!, ...param }); addCondition(param)
closeModal(); else updateCondition({ id: currentEditId!, ...param })
}); closeModal()
})
} }
// //
function formatValue(searchfield: string, searchvalue: any) { function formatValue(searchfield: string, searchvalue: any) {
if (searchfield === "izyear") { if (searchfield === 'izyear') {
const start = formatToDate2(searchvalue[0]); const start = formatToDate2(searchvalue[0])
const end = formatToDate2(searchvalue[1]); const end = formatToDate2(searchvalue[1])
return `${start}-${end}`; return `${start}-${end}`
} }
if (searchfield === "izsimilarity" && Array.isArray(searchvalue)) if (searchfield === 'izsimilarity' && Array.isArray(searchvalue))
return searchvalue.join(","); return searchvalue.join(',')
return searchvalue; return searchvalue
} }
// //
function unformatValue(searchfield: string, searchvalue: any) { function unformatValue(searchfield: string, searchvalue: any) {
// 2022/01/03-2023/02/04 // 2022/01/03-2023/02/04
if (searchfield === "izyear") { if (searchfield === 'izyear') {
const dataStrs = searchvalue.split("-"); const dataStrs = searchvalue.split('-')
const start = formatToDate3(dataStrs[0]); const start = formatToDate3(dataStrs[0])
const end = formatToDate3(dataStrs[1]); const end = formatToDate3(dataStrs[1])
return [start, end]; return [start, end]
} }
// 80,90 // 80,90
// if (searchfield === "izsimilarity") return searchvalue.split(","); // if (searchfield === "izsimilarity") return searchvalue.split(",");
return searchvalue; return searchvalue
} }
function createCondition() { function createCondition() {
formValue.conditions.push({ formValue.conditions.push({
type: null, type: null,
operator: "eq", operator: 'eq',
result: null, result: null,
}); })
} }
function removeCondition(index: number) { function removeCondition(index: number) {
formValue.conditions.splice(index, 1); formValue.conditions.splice(index, 1)
} }
function formLabel(index: number) { function formLabel(index: number) {
return index === 0 ? "筛选条件" : ""; return index === 0 ? '筛选条件' : ''
} }
const typeOptions = ref<Option[]>([]); const typeOptions = ref<Option[]>([])
const operatorOptions = [ const operatorOptions = [
{ {
label: "等于", label: '等于',
value: "eq", value: 'eq',
}, },
{ {
label: "不等于", label: '不等于',
value: "notEq", value: 'notEq',
}, },
]; ]
const logicOptions = ref([]); const logicOptions = ref([])
const similarityOptions = [ const similarityOptions = [
{ {
label: "80%-90%", label: '80%-90%',
value: "80,90", value: '80,90',
}, },
{ {
label: "95%-100%", label: '95%-100%',
value: "95,100", value: '95,100',
}, },
{ {
label: "100%-100%", label: '100%-100%',
value: "100,100", value: '100,100',
}, },
]; ]
onBeforeMount(() => { onBeforeMount(() => {
dicStore.fetchRelationTypeList(); dicStore.fetchRelationTypeList()
}); })
watch( watch(
() => dicStore.relationTypeList, () => dicStore.relationTypeList,
(newval) => { (newval) => {
logicOptions.value = newval; logicOptions.value = newval
} },
); )
function showModal() { function showModal() {
const list = generateAllData(configStore.systemConfig); const list = generateAllData(configStore.systemConfig)
typeOptions.value = list; typeOptions.value = list
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
emit("onOk"); emit('onOk')
setTimeout(() => { setTimeout(() => {
show.value = false; show.value = false
}, 300); }, 300)
} }
function generateAllData(config): Option[] { function generateAllData(config): Option[] {
const initVal: Option[] = []; const initVal: Option[] = []
const list = Object.keys(config).reduce((acc, value) => { const list = Object.keys(config).reduce((acc, value) => {
if (value.startsWith("iz") && asideMap[value]?.inFilterList !== false) { if (value.startsWith('iz') && asideMap[value]?.inFilterList !== false) {
const name = asideMap[value]?.label; const name = asideMap[value]?.label
name && name
acc.push({ && acc.push({
value, value,
label: name || "未配置", label: name || '未配置',
}); })
} }
return acc; return acc
}, initVal); }, initVal)
return list; return list
} }
watch( watch(
() => configStore.systemConfig, () => configStore.systemConfig,
(newVal) => { (newVal) => {
if (!newVal) return; if (!newVal)
return
const list = generateAllData(newVal); const list = generateAllData(newVal)
typeOptions.value = list; typeOptions.value = list
} },
); )
function getOptions(key: string) { function getOptions(key: string) {
if (key === "izsimilarity") return similarityOptions; if (key === 'izsimilarity')
const getterName = `get${key}`; return similarityOptions
const options = unref(dicStore[getterName]); const getterName = `get${key}`
return options || []; const options = unref(dicStore[getterName])
return options || []
} }
function leaveHandler() { function leaveHandler() {
currentStatus.value = "new"; currentStatus.value = 'new'
currentEditId = null; currentEditId = null
formValue.name = null; formValue.name = null
formValue.conditions = [ formValue.conditions = [
{ {
type: null, type: null,
operator: "eq", operator: 'eq',
result: null, result: null,
}, },
]; ]
} }
function edit(editFilter: any) { function edit(editFilter: any) {
currentStatus.value = "edit"; currentStatus.value = 'edit'
console.log(editFilter, "editFilter"); console.log(editFilter, 'editFilter')
const { searchname, ocrUsersearchchildList, id } = editFilter; const { searchname, ocrUsersearchchildList, id } = editFilter
currentEditId = id; currentEditId = id
formValue.name = searchname; formValue.name = searchname
formValue.conditions = ocrUsersearchchildList.map((item) => { formValue.conditions = ocrUsersearchchildList.map((item) => {
return { return {
type: item.searchfield, type: item.searchfield,
operator: item.searchtype, operator: item.searchtype,
result: unformatValue(item.searchfield, item.searchvalue), result: unformatValue(item.searchfield, item.searchvalue),
}; }
}); })
} }
defineExpose({ defineExpose({
showModal, showModal,
edit, edit,
}); })
</script> </script>
<template> <template>
<n-modal <n-modal
v-model:show="show" v-model:show="show"
transform-origin="center" transform-origin="center"
@after-leave="leaveHandler"
:mask-closable="false" :mask-closable="false"
class="modal_wrapper" class="modal_wrapper"
@after-leave="leaveHandler"
> >
<n-card <n-card
:style="cardStyle" :style="cardStyle"
@ -319,20 +323,24 @@ defineExpose({
'font-size': '16px', 'font-size': '16px',
'font-weight': '600', 'font-weight': '600',
}" }"
>基本信息</span >基本信息</span>
>
</div> </div>
</div> </div>
<div class="wrapper-form"> <div class="wrapper-form">
<n-form ref="formRef" :model="formValue" :rules="rules" > <n-form
<n-form-item path="name" label="标题" mergedRequireMarkPlacement="left"> ref="formRef"
:model="formValue"
:rules="rules"
require-mark-placement="left"
>
<n-form-item path="name" label="标题" merged-require-mark-placement="left">
<!-- j --> <!-- j -->
<n-input <n-input
v-model:value="formValue.name" v-model:value="formValue.name"
:style="{ width: '780px' }" :style="{ width: '780px' }"
maxlength="15" maxlength="15"
@keydown.enter.prevent
placeholder="请输入过滤名称" placeholder="请输入过滤名称"
@keydown.enter.prevent
/> />
</n-form-item> </n-form-item>
<n-form-item v-show="false" path="logic" label="逻辑关系"> <n-form-item v-show="false" path="logic" label="逻辑关系">
@ -418,12 +426,12 @@ defineExpose({
y="0" y="0"
width="64" width="64"
height="64" height="64"
></rect> />
<path <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="形状" 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" fill="#DDDDDD"
></path> />
</g> </g>
</g> </g>
</g> </g>
@ -434,7 +442,7 @@ defineExpose({
</n-form> </n-form>
</div> </div>
<div class="wrapper-new" @click="createCondition"> <div class="wrapper-new" @click="createCondition">
<span style="font-size:16px;">+</span> <span style="font-size: 16px">+</span>
<span style="margin-left: 8px">添加筛选条件</span> <span style="margin-left: 8px">添加筛选条件</span>
</div> </div>
</div> </div>
@ -492,7 +500,7 @@ defineExpose({
color: #507afd; color: #507afd;
line-height: 22px; line-height: 22px;
cursor: pointer; cursor: pointer;
span{ span {
font-size: 11px; font-size: 11px;
} }
&:hover { &:hover {
@ -507,7 +515,7 @@ defineExpose({
&-footer { &-footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-bottom:6px; margin-bottom: 6px;
} }
&-info { &-info {
@ -542,8 +550,8 @@ defineExpose({
.modal_wrapper { .modal_wrapper {
padding: 14px 14px 0 14px !important; padding: 14px 14px 0 14px !important;
} }
::v-deep(.n-form-item .n-form-item-label){ ::v-deep(.n-form-item .n-form-item-label) {
font-size:14px; font-size: 14px;
color: #666666; color: #666666;
font-weight: 500; font-weight: 500;
} }

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

@ -10,6 +10,7 @@ import {
unref, unref,
watch, watch,
} from 'vue' } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import CustomFieldModal from '../modal/CustomFieldModal.vue' import CustomFieldModal from '../modal/CustomFieldModal.vue'
import AdvanceFilter from '../../home/aside/comp/AdvanceFilter.vue' import AdvanceFilter from '../../home/aside/comp/AdvanceFilter.vue'
import { FilterModalVue } from '../../home/aside/comp/modals' import { FilterModalVue } from '../../home/aside/comp/modals'
@ -17,22 +18,21 @@ import NewFilterModalVue from '../modal/NewFilterModal.vue'
import TaskList from './TaskList.vue' import TaskList from './TaskList.vue'
import type { AsideEntity } from '@/config/aside' import type { AsideEntity } from '@/config/aside'
import { useUser } from '@/store/modules/user' import { useUser } from '@/store/modules/user'
import { getAllfieldList, getfieldList } from '@/api/home/filter' import { getAllfieldList, getConditionList, getfieldList } from '@/api/home/filter'
import { useTaskStore } from '@/store/modules/task' import { useTaskStore } from '@/store/modules/task'
import emitter from '@/utils/mitt' import emitter from '@/utils/mitt'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { getConditionList } from "@/api/home/filter";
import type { FilterSearchParam } from "/#/api";
import { useRoute } from 'vue-router'
import type { FilterSearchParam } from '/#/api'
const route = useRoute() const route = useRoute()
const searchContent = route.query.searchContent as string; const router = useRouter()
const searchContent = route.query.searchContent as string
const CustomFieldModalRef = ref(null) const CustomFieldModalRef = ref(null)
const collapse = ref(false) const collapse = ref(false)
const taskStore = useTaskStore() const taskStore = useTaskStore()
const taskListRef: any = ref(null) const taskListRef: any = ref(null)
const AdvanceFilterRef: any = ref(null); const AdvanceFilterRef: any = ref(null)
// //
const showFieldList = ref<any[]>([]) const showFieldList = ref<any[]>([])
const search = ref('') const search = ref('')
@ -79,6 +79,8 @@ function setShowSearch(value: boolean) {
if (!value) { if (!value) {
search.value = '' search.value = ''
taskListRef.value.search('') taskListRef.value.search('')
if (searchContent)
router.replace(route.path)
} }
showSearch.value = value showSearch.value = value
} }
@ -115,6 +117,7 @@ async function getshowFieldList() {
} }
showFieldList.value.push(item) showFieldList.value.push(item)
} }
return v
}) })
} }
else { else {
@ -129,39 +132,40 @@ async function getshowFieldList() {
} }
showFieldList.value.push(item) showFieldList.value.push(item)
} }
return v
}) })
} }
} }
onMounted(() => { onMounted(() => {
getshowFieldList() getshowFieldList()
window.addEventListener("keydown", handleKeydown); window.addEventListener('keydown', handleKeydown)
init() init()
}) })
async function init() { async function init() {
try { try {
const searchParam: FilterSearchParam = { const searchParam: FilterSearchParam = {
search_searchname: { value: "", op: "like", type: "string" }, search_searchname: { value: '', op: 'like', type: 'string' },
}; }
const result = await getConditionList(1, searchParam, 2); const result = await getConditionList(1, searchParam, 2)
const { data } = result; const { data } = result
if (data[0]) { if (data[0]) {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced(data[0].searchname); AdvanceFilterRef.value.setCurrentlySelectedAdvanced(data[0].searchname)
setTimeout(() => { setTimeout(() => {
filterHandler(data[0].id) filterHandler(data[0].id)
}, 1000); }, 1000)
//filterHandler(data[0].id); // filterHandler(data[0].id);
} }
// pagination.pageNo += 1 // pagination.pageNo += 1
} catch (error) {
return [];
} finally {
} }
//currentlySelectedAdvanced.value="" catch (error) {
return []
}
// currentlySelectedAdvanced.value=""
} }
function handleKeydown(event) { function handleKeydown(event) {
if (event.key === "s") setShowSearch(true) if (event.key === 's')
setShowSearch(true)
} }
// key // key
function scrollHandler(key: string) { function scrollHandler(key: string) {
@ -191,8 +195,8 @@ function newFilterOk() {
filterModalRef.value.query( filterModalRef.value.query(
filterModalRef.value.pagination.page, filterModalRef.value.pagination.page,
filterModalRef.value.pagination.pageSize, filterModalRef.value.pagination.pageSize,
); )
filterModalRef.value.showModal(); filterModalRef.value.showModal()
} }
onBeforeMount(async () => { onBeforeMount(async () => {
configStore.fetchConfig() configStore.fetchConfig()
@ -206,31 +210,37 @@ defineExpose({
setAsideItemName, setAsideItemName,
}) })
const initSerach = () => { function initSerach() {
if (searchContent) { if (searchContent) {
setShowSearch(true); setShowSearch(true)
const id_param = searchContent.match(/-\d+-/); const id_param = searchContent.match(/-\d+-/)
if (id_param) { if (id_param) {
search.value = id_param[0].slice(1, -1); search.value = id_param[0].slice(1, -1)
inputHandler(id_param[0].slice(1, -1)); inputHandler(id_param[0].slice(1, -1))
} }
} }
} }
initSerach(); initSerach()
const handleOk = (item: any) => { function handleOk(item: any) {
if (item) { if (item) {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname); AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname)
filterHandler(item.id); filterHandler(item.id)
} else {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced("高级筛选");
filterHandler("");
} }
}; else {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced('高级筛选')
filterHandler('')
}
}
</script> </script>
<template> <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 v-show="showCollapse" class="aside-collapse">
<div class="aside-collapse-btn" @click="collapseHandler"> <div class="aside-collapse-btn" @click="collapseHandler">
<SvgIcon :name="collapseIcon" size="40" /> <SvgIcon :name="collapseIcon" size="40" />
@ -259,24 +269,55 @@ const handleOk = (item: any) => {
</div> </div>
</div> --> </div> -->
<!-- 高级筛选 --> <!-- 高级筛选 -->
<AdvanceFilter v-show="!showSearch" :type="2" @select="filterHandler" @update:search="setShowSearch(true)" <AdvanceFilter
@show-custom="showModal(CustomFieldModalRef)" @show-filter="showModal(filterModalRef)" ref="AdvanceFilterRef" /> v-show="!showSearch"
ref="AdvanceFilterRef"
:type="2"
@select="filterHandler"
@update:search="setShowSearch(true)"
@show-custom="showModal(CustomFieldModalRef)"
@show-filter="showModal(filterModalRef)"
/>
<div v-show="showSearch" class="warpper"> <div v-show="showSearch" class="warpper">
<n-input v-model:value="search" style="flex: 1; height: 32px" placeholder="请输入你需要搜索的内容" @input="inputHandler"> <n-input
v-model:value="search"
style="flex: 1; height: 32px"
placeholder="请输入你需要搜索的内容"
@input="inputHandler"
>
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1" /> <SvgIcon size="14px" name="magnifying-1" />
</template> </template>
</n-input> </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>
</div> </div>
<TaskList ref="taskListRef" :show-field-list="showFieldList" style="height: 811px" class="work-sheet-list" /> <TaskList
ref="taskListRef"
:show-field-list="showFieldList"
style="height: 811px"
class="work-sheet-list"
/>
<!-- calc(100vh - 146px) --> <!-- calc(100vh - 146px) -->
<CustomFieldModal ref="CustomFieldModalRef" :review-type="reviewType" @on-ok="getshowFieldList" /> <CustomFieldModal
ref="CustomFieldModalRef"
:review-type="reviewType"
@on-ok="getshowFieldList"
/>
<!-- 过滤列表 --> <!-- 过滤列表 -->
<FilterModalVue ref="filterModalRef" :type="2" @edit-filter="editFilter" <FilterModalVue
@show-new-filter="showModal(newFilterModalRef)" @handleOk="handleOk" /> ref="filterModalRef"
:type="2"
@edit-filter="editFilter"
@show-new-filter="showModal(newFilterModalRef)"
@handle-ok="handleOk"
/>
<!-- 新增过滤 --> <!-- 新增过滤 -->
<NewFilterModalVue ref="newFilterModalRef" @on-ok="newFilterOk" /> <NewFilterModalVue ref="newFilterModalRef" @on-ok="newFilterOk" />
</div> </div>

@ -154,10 +154,7 @@ function handleKeydown(event) {
// //
clearTimeout(keyPressTimer) clearTimeout(keyPressTimer)
const item = taskDetailInfo.value const item = taskDetailInfo.value
if ( if (item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3) {
item?.userapprove?.statshis === 2
|| item?.userapprove?.statshis == 3
) {
overTask.value = null overTask.value = null
return return
} }
@ -191,10 +188,7 @@ function handleKeydown(event) {
// //
clearTimeout(keyPressTimer) clearTimeout(keyPressTimer)
const item = taskDetailInfo.value const item = taskDetailInfo.value
if ( if (item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3) {
item?.userapprove?.statshis === 2
|| item?.userapprove?.statshis == 3
) {
overTask.value = null overTask.value = null
return return
} }
@ -321,9 +315,10 @@ function approvalHandler(items?: any) {
}, },
}) })
} }
function approvalHandlerx(item?: any) { // function approvalHandlerx(item?: any) {
console.log(item) // console.log(item);
} // alert(1);
// }
function singleRejectHandlex(item?: any) { function singleRejectHandlex(item?: any) {
console.log(item) console.log(item)
const modal = unref(notPassModalRef)! as any const modal = unref(notPassModalRef)! as any
@ -422,26 +417,31 @@ async function getTableData() {
fieldList.forEach((v) => { fieldList.forEach((v) => {
if (userFieldList.includes(v.name)) { if (userFieldList.includes(v.name)) {
let locationobj = { address: '' } let locationobj = { address: '' }
if (v.name == 'location') if (v.name == 'location') {
locationobj = JSON.parse(taskDetailInfo.value.ocrPicture[v.name]) locationobj = JSON.parse(
taskDetailInfo.value.ocrPicture ? taskDetailInfo.value.ocrPicture[v.name] : '{}',
)
}
const item = { const item = {
label: v.fieldDesc, label: v.fieldDesc,
value: value:
v.name == 'location' v.name == 'location'
? locationobj.address ? locationobj.address
: taskDetailInfo.value.ocrPicture[v.name], : taskDetailInfo.value.ocrPicture
? taskDetailInfo.value.ocrPicture[v.name]
: '',
key: v.name, key: v.name,
blue: blueList.includes(v.fieldDesc), blue: blueList.includes(v.fieldDesc),
} }
listData.push(item) listData.push(item)
} }
return v
}) })
taskTableData.value = chunk(listData, 2) taskTableData.value = chunk(listData, 2)
} }
async function getImgList() { async function getImgList() {
if (!isEmpty(taskDetailInfo.value.ocrPicture.id)) { if (!isEmpty(taskDetailInfo.value.ocrPicture?.id)) {
const { data, total } = await getSimilarityList({ const { data, total } = await getSimilarityList({
...taskpagination, ...taskpagination,
...sortBy, ...sortBy,
@ -534,9 +534,7 @@ function notPassSuccess(param) {
function reloadList(param, text) { function reloadList(param, text) {
// //
const id = currentTaskId() const id = currentTaskId()
const hasCurrentId = param.flowTaskInfoList.find( const hasCurrentId = param.flowTaskInfoList.find(item => item.formId === id)
item => item.formId === id,
)
finalStore.setListKey() finalStore.setListKey()
if (hasCurrentId) if (hasCurrentId)
emit('setAsideItemName', text) emit('setAsideItemName', text)
@ -609,8 +607,7 @@ function checkBottom() {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop const scrollTop = window.pageYOffset || document.documentElement.scrollTop
// //
const clientHeight const clientHeight = window.innerHeight || document.documentElement.clientHeight
= window.innerHeight || document.documentElement.clientHeight
// //
const scrollHeight = document.documentElement.scrollHeight const scrollHeight = document.documentElement.scrollHeight
@ -680,18 +677,8 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
<div class="left"> <div class="left">
<span class="font">任务ID{{ taskDetailInfo.fromtaskname }}</span> <span class="font">任务ID{{ taskDetailInfo.fromtaskname }}</span>
<template v-if="!isDetail"> <template v-if="!isDetail">
<SvgIcon <SvgIcon size="22" class="forward" name="arrow-left" @click="backHandler" />
size="22" <SvgIcon size="22" class="back" name="arrow-right" @click="forwardHandler" />
class="forward"
name="arrow-left"
@click="backHandler"
/>
<SvgIcon
size="22"
class="back"
name="arrow-right"
@click="forwardHandler"
/>
</template> </template>
</div> </div>
<div v-if="!isDetail" class="right"> <div v-if="!isDetail" class="right">
@ -887,25 +874,13 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
> >
</div> </div>
<div class="mark"> <div class="mark">
<SvgIcon <SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 0" size="128" name="jia" />
v-show="taskDetailInfo?.iztrueorfalse === 0"
size="128"
name="jia"
/>
</div> </div>
<div class="mark"> <div class="mark">
<SvgIcon <SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 0" size="128" name="jia" />
v-show="taskDetailInfo?.iztrueorfalse === 0"
size="128"
name="jia"
/>
</div> </div>
<div class="mark"> <div class="mark">
<SvgIcon <SvgIcon v-show="taskDetailInfo?.iztrueorfalse === 1" size="128" name="zhen" />
v-show="taskDetailInfo?.iztrueorfalse === 1"
size="128"
name="zhen"
/>
</div> </div>
<div class="big-mark" /> <div class="big-mark" />
<div class="preview" @click="previewHandler"> <div class="preview" @click="previewHandler">
@ -915,11 +890,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
<n-grid x-gap="12" y-gap="10" :cols="12"> <n-grid x-gap="12" y-gap="10" :cols="12">
<n-gi span="4" class="gi1"> <n-gi span="4" class="gi1">
<span> <span>
<img <img class="icon-status" src="@/assets/images/task/status.png" alt="">
class="icon-status"
src="@/assets/images/task/status.png"
alt=""
>
</span> </span>
</n-gi> </n-gi>
<n-gi span="8" class="gi2"> <n-gi span="8" class="gi2">
@ -938,38 +909,23 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
</span> </span>
</n-gi> </n-gi>
<n-gi span="8" class="gi2"> <n-gi span="8" class="gi2">
<span class="value num">{{ totalCount }}<span class="unit"></span> <span class="value num">{{ totalCount }}<span class="unit"></span> </span>
</span>
<span class="label">相似匹配</span> <span class="label">相似匹配</span>
</n-gi> </n-gi>
</n-grid> </n-grid>
</div> </div>
<div class="time"> <div class="time">
<div class="time-item"> <div class="time-item">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="16" name="camera-time" />
class="svg-time"
color="#FFF"
size="16"
name="camera-time"
/>
<span>{{ <span>{{ taskDetailInfo?.ocrPicture?.photoDateTimestamp ?? "-" }}</span>
taskDetailInfo?.ocrPicture?.photoDateTimestamp ?? "-"
}}</span>
</div> </div>
<div class="time-item time-item2"> <div class="time-item time-item2">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="16" name="submit-time" />
class="svg-time"
color="#FFF"
size="16"
name="submit-time"
/>
<span>{{ <span>{{
taskDetailInfo?.ocrPicture?.submitDateTimestamp taskDetailInfo?.ocrPicture?.submitDateTimestamp
? formatToDateHMS( ? formatToDateHMS(Number(taskDetailInfo.ocrPicture.submitDateTimestamp))
Number(taskDetailInfo.ocrPicture.submitDateTimestamp),
)
: "-" : "-"
}}</span> }}</span>
</div> </div>
@ -1071,12 +1027,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
> >
<div class="time"> <div class="time">
<div class="time-item"> <div class="time-item">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="8" name="camera-time" />
class="svg-time"
color="#FFF"
size="8"
name="camera-time"
/>
<span>{{ <span>{{
item.photoDateTimestamp item.photoDateTimestamp
? formatToDateHMS(Number(item.photoDateTimestamp)) ? formatToDateHMS(Number(item.photoDateTimestamp))
@ -1084,12 +1035,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
}}</span> }}</span>
</div> </div>
<div class="time-item time-item2"> <div class="time-item time-item2">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="8" name="submit-time" />
class="svg-time"
color="#FFF"
size="8"
name="submit-time"
/>
<span>{{ <span>{{
item.submitDateTimestamp item.submitDateTimestamp
? formatToDateHMS(Number(item.submitDateTimestamp)) ? formatToDateHMS(Number(item.submitDateTimestamp))
@ -1117,7 +1063,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
width: 20vw; width: 20vw;
" "
> >
<n-ellipsis style="max-width: 20VW"> <n-ellipsis style="max-width: 20vw">
{{ taskDetailInfo.fromtaskname }} {{ taskDetailInfo.fromtaskname }}
</n-ellipsis> </n-ellipsis>
</div> </div>
@ -1181,16 +1127,10 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
{{ item[0].value }} {{ item[0].value }}
</div> </div>
</div> </div>
<div <div v-if="!(item[0].label == '拜访终端名称')" class="viewlabel">
v-if="!(item[0].label == '拜访终端名称')"
class="viewlabel"
>
{{ item[0].label }} {{ item[0].label }}
</div> </div>
<div <div v-if="!(item[0].label == '拜访终端名称')" class="viewvalue">
v-if="!(item[0].label == '拜访终端名称')"
class="viewvalue"
>
{{ item[0].value }} {{ item[0].value }}
</div> </div>
<div <div
@ -1233,11 +1173,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
<div v-else class="imgbottom"> <div v-else class="imgbottom">
<div <div
v-show="imgbigshow" v-show="imgbigshow"
style=" style="display: flex; justify-content: space-between; padding: 12px 0px 3px 0"
display: flex;
justify-content: space-between;
padding: 12px 0px 3px 0;
"
> >
<div> <div>
<span <span
@ -1260,36 +1196,16 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
> >
<div style="cursor: pointer" @click="sortHandler('createdate')"> <div style="cursor: pointer" @click="sortHandler('createdate')">
<span>时间排序</span> <span>时间排序</span>
<SvgIcon <SvgIcon v-if="true" style="margin-left: 5px" name="sort" size="12" />
v-if="true" <SvgIcon v-else style="margin-left: 5px" name="active-sort" size="12" />
style="margin-left: 5px"
name="sort"
size="12"
/>
<SvgIcon
v-else
style="margin-left: 5px"
name="active-sort"
size="12"
/>
</div> </div>
<div <div
style="margin-left: 15px; cursor: pointer" style="margin-left: 15px; cursor: pointer"
@click="sortHandler('similarityScore')" @click="sortHandler('similarityScore')"
> >
<span>相似度排序</span> <span>相似度排序</span>
<SvgIcon <SvgIcon v-if="true" style="margin-left: 5px" name="sort" size="12" />
v-if="true" <SvgIcon v-else style="margin-left: 5px" name="active-sort" size="12" />
style="margin-left: 5px"
name="sort"
size="12"
/>
<SvgIcon
v-else
style="margin-left: 5px"
name="active-sort"
size="12"
/>
</div> </div>
</div> </div>
</div> </div>
@ -1355,12 +1271,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
> >
<div class="time"> <div class="time">
<div class="time-item"> <div class="time-item">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="16" name="camera-time" />
class="svg-time"
color="#FFF"
size="16"
name="camera-time"
/>
<span>{{ <span>{{
item.photoDateTimestamp item.photoDateTimestamp
? formatToDateHMS(Number(item.photoDateTimestamp)) ? formatToDateHMS(Number(item.photoDateTimestamp))
@ -1368,12 +1279,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
}}</span> }}</span>
</div> </div>
<div class="time-item time-item2"> <div class="time-item time-item2">
<SvgIcon <SvgIcon class="svg-time" color="#FFF" size="16" name="submit-time" />
class="svg-time"
color="#FFF"
size="16"
name="submit-time"
/>
<span>{{ <span>{{
item.submitDateTimestamp item.submitDateTimestamp
? formatToDateHMS(Number(item.submitDateTimestamp)) ? formatToDateHMS(Number(item.submitDateTimestamp))
@ -1381,10 +1287,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
}}</span> }}</span>
</div> </div>
</div> </div>
<div <div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">
:class="{ 'percent-red': item.similarityScore === 100 }"
class="percent"
>
{{ item.similarityScore }}<span class="percent-unit">%</span> {{ item.similarityScore }}<span class="percent-unit">%</span>
</div> </div>
</div> </div>
@ -1471,16 +1374,8 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
</div> </div>
</div> --> </div> -->
</div> </div>
<NotPassed <NotPassed ref="notPassModalRef" @success="notPassSuccess" @close="closePassno" />
ref="notPassModalRef" <BatchModal ref="batchModalRef" @reject="rejectHandler" @approval="approvalHandler" />
@success="notPassSuccess"
@close="closePassno"
/>
<BatchModal
ref="batchModalRef"
@reject="rejectHandler"
@approval="approvalHandler"
/>
<CustomSettingModal ref="CustomSettingModalRef" @on-ok="getDetail" /> <CustomSettingModal ref="CustomSettingModalRef" @on-ok="getDetail" />
</div> </div>
</template> </template>
@ -2189,11 +2084,7 @@ function sortHandler(orderby: 'similarityScore' | 'createdate') {
.small-mark { .small-mark {
width: 100%; width: 100%;
height: 53px; height: 53px;
background: linear-gradient( background: linear-gradient(180deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.44) 88%);
180deg,
rgba(0, 0, 0, 0.01),
rgba(0, 0, 0, 0.44) 88%
);
border-radius: 0px 8px 8px 8px; border-radius: 0px 8px 8px 8px;
position: absolute; position: absolute;
left: 0; left: 0;

@ -31,7 +31,13 @@ const allCount = computed(() => {
}) })
const selectCount = 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) const show = ref(false)
@ -196,6 +202,11 @@ function clearDragSource() {
return item.fix === true return item.fix === true
}) })
onShowList.value = cloneDeep(onList.value) onShowList.value = cloneDeep(onList.value)
offList.value = offList.value.map(item => ({
...item,
checked: item.fix,
}))
offShowList.value = cloneDeep(offList.value)
} }
function removeHandler(id: string) { function removeHandler(id: string) {

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

@ -12,7 +12,7 @@ import {
unref, unref,
watch, watch,
} from 'vue' } from 'vue'
import { useRoute } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import CustomFieldModalVue from '../modal/CustomFieldModal.vue' import CustomFieldModalVue from '../modal/CustomFieldModal.vue'
import WorkSheetList from './WorkSheetList.vue' import WorkSheetList from './WorkSheetList.vue'
import { getAllfieldList, getfieldList } from '@/api/home/filter' import { getAllfieldList, getfieldList } from '@/api/home/filter'
@ -24,6 +24,7 @@ import { getViewportOffset } from '@/utils/domUtils'
defineOptions({ name: 'AsideContent' }) defineOptions({ name: 'AsideContent' })
const emit = defineEmits(['ApprovalOver']) const emit = defineEmits(['ApprovalOver'])
const route = useRoute() const route = useRoute()
const router = useRouter()
const searchContent = route.query.searchContent const searchContent = route.query.searchContent
console.log(searchContent) console.log(searchContent)
const collapse = ref(false) const collapse = ref(false)
@ -106,6 +107,7 @@ async function getshowFieldList() {
} }
showFieldList.value.push(item) showFieldList.value.push(item)
} }
return v
}) })
} }
else { else {
@ -120,6 +122,7 @@ async function getshowFieldList() {
} }
showFieldList.value.push(item) showFieldList.value.push(item)
} }
return v
}) })
} }
} }
@ -160,6 +163,9 @@ function setShowSearch(value: boolean) {
if (value === false) { if (value === false) {
(packageListRef.value as any).search('') (packageListRef.value as any).search('')
searchKeyword.value = '' searchKeyword.value = ''
if (!searchContent)
return router.replace(route.path)
nextTick(() => { nextTick(() => {
searchInputRef.value?.focus() searchInputRef.value?.focus()
}) })

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

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

@ -227,7 +227,6 @@ const packageName = computed(() => {
const index = workStore.getCurrentIndex const index = workStore.getCurrentIndex
return workStore.getOrderList[index]?.name || '' return workStore.getOrderList[index]?.name || ''
}) })
async function queryDetail(checkDuplicateId: any) { async function queryDetail(checkDuplicateId: any) {
taskDetailInfo.value = await getTaskDetailInfo(checkDuplicateId) taskDetailInfo.value = await getTaskDetailInfo(checkDuplicateId)
const packageid = workStore.getActiveId const packageid = workStore.getActiveId
@ -290,7 +289,6 @@ function onEsc(event: KeyboardEvent) {
return return
if (!keys.includes(event.code)) if (!keys.includes(event.code))
return return
if (event.code === 'KeyC') { if (event.code === 'KeyC') {
// //
const modalClasss = [ const modalClasss = [
@ -315,6 +313,10 @@ function onEsc(event: KeyboardEvent) {
// //
if (rejectDialog.value || passDialog.value) if (rejectDialog.value || passDialog.value)
return return
// 1 2 3
if (taskDetailInfo.value.historyStates !== 1)
return
// p // p
if (code === 'KeyP') { if (code === 'KeyP') {
const currentTime = Date.now() const currentTime = Date.now()
@ -544,8 +546,6 @@ function handleRejectdubiousfileyd(pictureid) {
dubiousfileyd({ pictureid }).then(({ code }) => { dubiousfileyd({ pictureid }).then(({ code }) => {
if (code === 'OK') if (code === 'OK')
message.success('加入成功') message.success('加入成功')
refreshHandler()
const packageid = workStore.getActiveId const packageid = workStore.getActiveId
if (isEmpty(packageid)) { if (isEmpty(packageid)) {
listData.value.length = 0 listData.value.length = 0

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

Loading…
Cancel
Save