fix: fix eslint error

refactor/project
LiZhong 2 years ago
parent 5e52a9a191
commit ef3ce4d5bc

@ -1,4 +1,3 @@
// @ts-check
const antfu = require('@antfu/eslint-config').default const antfu = require('@antfu/eslint-config').default
module.exports = antfu( module.exports = antfu(
@ -10,21 +9,20 @@ module.exports = antfu(
'dist', 'dist',
'/public', '/public',
'.husky', '.husky',
'eslint.config.js',
], ],
}, },
{ {
rules: { rules: {
// 允许使用 debugger
'no-debugger': 'off', 'no-debugger': 'off',
'unused-imports/no-unused-vars': 'off', 'unused-imports/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'off', 'unused-imports/no-unused-imports': 'off',
'jsdoc/require-returns-description': 'off', 'jsdoc/require-returns-description': 'off',
'eqeqeq': 'off', 'eqeqeq': 'off',
'no-console': 'off',
'vue/custom-event-name-casing': 'off', 'vue/custom-event-name-casing': 'off',
'vue/eqeqeq': 'off', 'vue/eqeqeq': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-restricted-syntax': [ 'no-restricted-syntax': [
// eslint-disable-next-line node/prefer-global/process
process.env.MODE === 'production' ? 2 : 0, process.env.MODE === 'production' ? 2 : 0,
], ],
'array-callback-return': ['error', { allowImplicit: true }], 'array-callback-return': ['error', { allowImplicit: true }],

@ -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>

@ -1,5 +1,5 @@
import { http } from '@/utils/http/axios' import { http } from '@/utils/http/axios'
import type { BusinessParam, PageParam } from '/#/api' import type { PageParam } from '/#/api'
/** /**
* *

@ -21,7 +21,7 @@ export async function getConditionList(page: PageParam, searchParam: FilterSearc
return { return {
pageCount: pages, pageCount: pages,
data: records, data: records,
total total,
} }
} }
@ -172,7 +172,3 @@ export async function sort(searchid: string, reorder: number): Promise<void> {
params: { reviewType, userId, userFieldFixed, userFieldUnFixed }, params: { reviewType, userId, userFieldFixed, userFieldUnFixed },
}) })
} }

@ -79,7 +79,6 @@ export async function getToolsCount() {
}) })
} }
/** /**
* *
* @param note * @param note
@ -132,7 +131,6 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @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',
@ -145,7 +143,6 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @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',
@ -159,7 +156,6 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @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',
@ -173,11 +169,10 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @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,
}) })
} }
/** /**
@ -186,11 +181,10 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
* @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,
}) })
} }
/** /**
@ -270,10 +264,9 @@ export async function getPictureList(params: any): Promise<any> {
* @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,
}) })
} }

@ -15,7 +15,7 @@ export async function getApprovalList(page: any) {
pageSize: page.pageSize, pageSize: page.pageSize,
currPage: page.pageNo, currPage: page.pageNo,
keyword: page.keyword, keyword: page.keyword,
userSearchId:page.userSearchId userSearchId: page.userSearchId,
}, },
}) })

@ -1,21 +1,21 @@
<template>
<div class="ip_box" :style="canClick?'cursor: pointer;':''">
<img :src="IPImg" />
</div>
</template>
<script setup> <script setup>
import IPImg from "@/assets/images/IP.png"; import { defineProps } from 'vue'
import { defineProps } from "vue"; import IPImg from '@/assets/images/IP.png'
defineProps({ defineProps({
canClick: { canClick: {
type: Boolean, type: Boolean,
default: () => false, default: () => false,
}, },
}); })
</script> </script>
<template>
<div class="ip_box" :style="canClick ? 'cursor: pointer;' : ''">
<img :src="IPImg">
</div>
</template>
<style scoped lang="less"> <style scoped lang="less">
.ip_box { .ip_box {
position: fixed; position: fixed;

@ -72,9 +72,9 @@ async function getHistory() {
getHistory() getHistory()
function goPath(item, id) { function goPath(item, id) {
const desiredObject = item.data.find(function (item) { const desiredObject = item.data.find((item) => {
return item.id === id; return item.id === id
}); })
router.push({ name: item.path, query: { id, searchContent: desiredObject.name } }) router.push({ name: item.path, query: { id, searchContent: desiredObject.name } })
emit('close') emit('close')
} }
@ -97,8 +97,10 @@ function highlightText(text, query) {
<img src="../../assets/images/IP.png" alt=""> <img src="../../assets/images/IP.png" alt="">
</div> </div>
<div class="input_box"> <div class="input_box">
<n-input v-model:value="value" placeholder="搜索任务ID、任务名称、提报人、拜访终端" type="text" @input="inputHandler" <n-input
@mousedown="handlerShowList"> v-model:value="value" placeholder="搜索任务ID、任务名称、提报人、拜访终端" type="text" @input="inputHandler"
@mousedown="handlerShowList"
>
<template #prefix> <template #prefix>
<SvgIcon name="magnifying-1" size="18" /> <SvgIcon name="magnifying-1" size="18" />
</template> </template>
@ -111,16 +113,20 @@ function highlightText(text, query) {
</div> </div>
<div class="flex history-list"> <div class="flex history-list">
<div class="tag-wrap"> <div class="tag-wrap">
<div v-for="(item, index) of historyList" :key="index" class="tag" <div
@click="handlerHistory(item.historyname)"> v-for="(item, index) of historyList" :key="index" class="tag"
@click="handlerHistory(item.historyname)"
>
{{ item.historyname }} {{ item.historyname }}
</div> </div>
</div> </div>
<SvgIcon class="icon-delete" name="delete-history" size="16" @click="deleteHistory" /> <SvgIcon class="icon-delete" name="delete-history" size="16" @click="deleteHistory" />
</div> </div>
</div> </div>
<div v-for="(item, index) in resultList" :key="index" class="list_classfiy_item" <div
:style="(index === resultList.length - 1) ? '' : 'border-bottom:1px solid #e4e4e4'"> v-for="(item, index) in resultList" :key="index" class="list_classfiy_item"
:style="(index === resultList.length - 1) ? '' : 'border-bottom:1px solid #e4e4e4'"
>
<div class="list_title"> <div class="list_title">
{{ item.title }} {{ item.title }}
</div> </div>

@ -1,5 +1,5 @@
import { IzCustomlevel, IzCustomname, IzCustomtype, IzfirmVue, IzProductVue, IzProjecttype, IzProjectVue, IztaskrromVue, IztaskstatusVue, IzVisitcity, IzvisitproVue, PictureDownloadVue, PictureTypeVue, PictureUploadVue, PlanVue, ReportUserVue, SimilarityVue, TimeVue } from '@/views/home/aside/comp/items'
import type { Component } from 'vue' import type { Component } from 'vue'
import { IzCustomlevel, IzCustomname, IzCustomtype, IzProductVue, IzProjectVue, IzProjecttype, IzVisitcity, IzfirmVue, IztaskrromVue, IztaskstatusVue, IzvisitproVue, PictureDownloadVue, PictureTypeVue, PictureUploadVue, PlanVue, ReportUserVue, SimilarityVue, TimeVue } from '@/views/home/aside/comp/items'
export interface AsideEntity { export interface AsideEntity {
label: string label: string

@ -1,6 +1,6 @@
import { defineAsyncComponent } from 'vue'
import type { AsideEntity } from './aside' import type { AsideEntity } from './aside'
import { IzApprovalStatus, IzCustomlevel, IzCustomname, IzCustomtype, IzProductVue, IzProjectVue, IzProjecttype, IzShowAll, IzStatus, IzVisitcity, IzfirmVue, IztaskrromVue, IzvisitproVue, PictureDownloadVue, PlanVue, ReportUserVue, TimeVue } from '@/views/home/aside/comp/items' import { IzApprovalStatus, IzCustomlevel, IzCustomname, IzCustomtype, IzProductVue, IzProjectVue, IzProjecttype, IzShowAll, IzStatus, IzVisitcity, IzfirmVue, IztaskrromVue, IzvisitproVue, PictureDownloadVue, PlanVue, ReportUserVue, TimeVue } from '@/views/home/aside/comp/items'
import { defineAsyncComponent } from "vue"
export interface RowData { export interface RowData {
id: string id: string
@ -85,7 +85,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izupuser', key: 'izupuser',
// component: ReportUserVue, // component: ReportUserVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/ReportUser.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/ReportUser.vue')),
}, },
izproject: { izproject: {
label: '所属项目', label: '所属项目',
@ -93,7 +93,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izproject', key: 'izproject',
// component: IzProjectVue, // component: IzProjectVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProject.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzProject.vue')),
}, },
izplan: { izplan: {
label: '所属计划', label: '所属计划',
@ -101,7 +101,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izplan', key: 'izplan',
// component: PlanVue, // component: PlanVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Plan.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Plan.vue')),
}, },
izstatus: { izstatus: {
label: '审批状态', label: '审批状态',
@ -109,7 +109,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: false, isDefaultFilter: false,
key: 'izstatus', key: 'izstatus',
// component: IzStatus, // todo // component: IzStatus, // todo
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzStatus.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzStatus.vue')),
}, },
izyear: { izyear: {
label: '提报时间', label: '提报时间',
@ -117,7 +117,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: false, isDefaultFilter: false,
key: 'izyear', key: 'izyear',
// component: TimeVue, // component: TimeVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Time.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Time.vue')),
}, },
iztaskrrom: { iztaskrrom: {
label: '任务来源', label: '任务来源',
@ -125,7 +125,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: false, isDefaultFilter: false,
key: 'iztaskrrom', key: 'iztaskrrom',
// component: IztaskrromVue, // component: IztaskrromVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Iztaskrrom.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Iztaskrrom.vue')),
}, },
izshowall: { izshowall: {
label: '显示全部任务数据', label: '显示全部任务数据',
@ -133,7 +133,7 @@ export const asideMap: Recordable<AsideEntity> = {
isDefaultFilter: false, isDefaultFilter: false,
key: 'izshowall', key: 'izshowall',
// component: IzShowAll, // component: IzShowAll,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzShowAll.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzShowAll.vue')),
inFilterList: false, inFilterList: false,
}, },
} }
@ -146,7 +146,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izApprovalStatus', key: 'izApprovalStatus',
// component: IzApprovalStatus, // todo // component: IzApprovalStatus, // todo
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzApprovalStatus.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzApprovalStatus.vue')),
}, },
izuptime: { izuptime: {
label: '提报时间', label: '提报时间',
@ -154,7 +154,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izuptime', key: 'izuptime',
// component: TimeVue, // component: TimeVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Time.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Time.vue')),
}, },
izupuser: { izupuser: {
label: '提报人', label: '提报人',
@ -162,7 +162,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izupuser', key: 'izupuser',
// component: ReportUserVue, // component: ReportUserVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/ReportUser.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/ReportUser.vue')),
}, },
iztaskrrom: { iztaskrrom: {
label: '任务来源', label: '任务来源',
@ -170,7 +170,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'iztaskrrom', key: 'iztaskrrom',
// component: IztaskrromVue, // component: IztaskrromVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Iztaskrrom.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Iztaskrrom.vue')),
}, },
izcustomname: { izcustomname: {
label: '拜访客户', label: '拜访客户',
@ -178,7 +178,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izcustomname', key: 'izcustomname',
// component: IzCustomname, // component: IzCustomname,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomname.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzCustomname.vue')),
}, },
izcustomtype: { izcustomtype: {
label: '客户类型', label: '客户类型',
@ -186,7 +186,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izcustomtype', key: 'izcustomtype',
// component: IzCustomtype, // component: IzCustomtype,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomtype.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzCustomtype.vue')),
}, },
izproject: { izproject: {
label: '所属项目', label: '所属项目',
@ -194,7 +194,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izproject', key: 'izproject',
// component: IzProjectVue, // component: IzProjectVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProject.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzProject.vue')),
}, },
izvisitpro: { izvisitpro: {
label: '拜访省份/直辖市', label: '拜访省份/直辖市',
@ -202,7 +202,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izvisitpro', key: 'izvisitpro',
// component: IzVisitcity, // component: IzVisitcity,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzVisitcity.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzVisitcity.vue')),
}, },
izcustomlevel: { izcustomlevel: {
label: '客户级别', label: '客户级别',
@ -210,7 +210,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izcustomlevel', key: 'izcustomlevel',
// component: IzCustomlevel, // component: IzCustomlevel,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzCustomlevel.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzCustomlevel.vue')),
}, },
izprojecttype: { izprojecttype: {
label: '项目类别', label: '项目类别',
@ -218,7 +218,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izprojecttype', key: 'izprojecttype',
// component: IzProjecttype, // component: IzProjecttype,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProjecttype.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzProjecttype.vue')),
}, },
izproductname: { izproductname: {
label: '产品名称', label: '产品名称',
@ -226,7 +226,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izproductname', key: 'izproductname',
// component: IzProductVue, // component: IzProductVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/IzProduct.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/IzProduct.vue')),
}, },
izvisitcity: { izvisitcity: {
label: '拜访城市', label: '拜访城市',
@ -234,7 +234,7 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izvisitcity', key: 'izvisitcity',
// component: IzvisitproVue, // component: IzvisitproVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Izvisitpro.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Izvisitpro.vue')),
}, },
izfirm: { izfirm: {
label: '厂商', label: '厂商',
@ -242,6 +242,6 @@ export const asideTaskMap: Recordable<AsideEntity> = {
isDefaultFilter: true, isDefaultFilter: true,
key: 'izfirm', key: 'izfirm',
// component: IzfirmVue, // component: IzfirmVue,
component: defineAsyncComponent(() => import("@/views/home/aside/comp/items/Izfirm.vue")), component: defineAsyncComponent(() => import('@/views/home/aside/comp/items/Izfirm.vue')),
}, },
} }

@ -1,11 +1,11 @@
const commonKeyDown = (keyCode: number) => { function commonKeyDown(keyCode: number) {
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode })); document.dispatchEvent(new KeyboardEvent('keydown', { keyCode }))
} }
const c = () => { function c() {
commonKeyDown(27) commonKeyDown(27)
} }
const initBind = (mousetrap) => { function initBind(mousetrap) {
mousetrap.bind('c', c) mousetrap.bind('c', c)
} }
export default initBind; export default initBind

@ -1,16 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeMount, ref } from 'vue'; import { onBeforeMount, ref } from 'vue'
const emit = defineEmits<{
(e: 'commit')
}>()
const props = defineProps({ const props = defineProps({
selectedTotal: { selectedTotal: {
type: Number, type: Number,
default: () => 0, default: () => 0,
} },
}) })
const emit = defineEmits<{
(e: 'commit')
}>()
const show = ref(false) const show = ref(false)
const cardStyle = { const cardStyle = {
'width': '450px', 'width': '450px',

@ -3,36 +3,35 @@ import Masonry from 'masonry-layout'
import { useDialog, useMessage } from 'naive-ui' import { useDialog, useMessage } from 'naive-ui'
import { computed, nextTick, onBeforeMount, onMounted, onUpdated, reactive, ref, unref, watch } from 'vue' import { computed, nextTick, onBeforeMount, onMounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import { dubiousfilelist, removeFiles } from '@/api/task/task'
import { viewOptions } from '@/config/home'
import { useInfiniteScroll } from '@vueuse/core' import { useInfiniteScroll } from '@vueuse/core'
import imagesloaded from 'imagesloaded' import imagesloaded from 'imagesloaded'
import { debounce, cloneDeep } from 'lodash-es' import { cloneDeep, debounce } from 'lodash-es'
import ConfrimModal from './ConfrimModal.vue'
import { audit, dubiousfilelist, removeFiles } from '@/api/task/task'
import { viewOptions } from '@/config/home'
import { audit } from '@/api/task/task'
import NotPassed from '@/components/Approval/NotPassed.vue' import NotPassed from '@/components/Approval/NotPassed.vue'
import { formatToDateHMS } from '@/utils/dateUtil' import { formatToDateHMS } from '@/utils/dateUtil'
import { off, on } from '@/utils/domUtils' import { off, on } from '@/utils/domUtils'
import ConfrimModal from "./ConfrimModal.vue"
const cardStyle = { const cardStyle = {
'--n-padding-bottom': '40px', '--n-padding-bottom': '40px',
'--n-padding-left': '120px', '--n-padding-left': '120px',
} }
let startTime = 0; let startTime = 0
let endTime = 0; let endTime = 0
let startCalTime = false; let startCalTime = false
const message = useMessage() const message = useMessage()
const timeRange = ref('desc') const timeRange = ref('desc')
const similarRange = ref('desc') const similarRange = ref('desc')
const batch = ref(false) const batch = ref(false)
const imageRef = ref<ComponentElRef | null>(); const imageRef = ref<ComponentElRef | null>()
let filterId = null; const filterId = null
const isTop = ref(false) const isTop = ref(false)
let sortObj: any = { let sortObj: any = {
orderByUptime: 'desc' orderByUptime: 'desc',
}; }
const timeOptions = [{ const timeOptions = [{
label: '升序', label: '升序',
@ -68,12 +67,12 @@ const viewLabel = computed(() => {
}) })
const maxHeight = computed(() => { const maxHeight = computed(() => {
let height = "800"; let height = '800'
const screenWidth = window.screen.width; const screenWidth = window.screen.width
if(screenWidth <= 1920) { if (screenWidth <= 1920)
height = "600"; height = '600'
}
return height + 'px'; return `${height}px`
}) })
const masonryRef = ref<ComponentRef>(null) const masonryRef = ref<ComponentRef>(null)
@ -87,10 +86,10 @@ const pagination = reactive({
let loading = false let loading = false
let _masonry: null | Masonry = null let _masonry: null | Masonry = null
const show = ref(false) const show = ref(false)
const selectedApproveItems = ref<any[]>([]); // const selectedApproveItems = ref<any[]>([]) //
const dialog = useDialog(); const dialog = useDialog()
let processItems: any[] = []; let processItems: any[] = []
const confrimModalRef = ref<any>(); const confrimModalRef = ref<any>()
const layout = debounce(() => { const layout = debounce(() => {
if (!show.value) if (!show.value)
@ -111,11 +110,11 @@ const layout = debounce(() => {
const scrollHeight = el.value!.scrollHeight const scrollHeight = el.value!.scrollHeight
const clientHeight = el.value!.clientHeight const clientHeight = el.value!.clientHeight
const top = scrollHeight - clientHeight - 20 const top = scrollHeight - clientHeight - 20
if(isTop.value) { if (isTop.value)
el.value!.scrollTo({ top: 0, behavior: 'instant' }) el.value!.scrollTo({ top: 0, behavior: 'instant' })
}else { else
el.value!.scrollTo({ top, behavior: 'instant' }) el.value!.scrollTo({ top, behavior: 'instant' })
}
// let height = 800 - 15; // let height = 800 - 15;
// const screenWidth = window.screen.width; // const screenWidth = window.screen.width;
// if(screenWidth <= 1920) { // if(screenWidth <= 1920) {
@ -123,23 +122,23 @@ const layout = debounce(() => {
// } // }
// el.value!.scrollTo({ top: height, behavior: 'instant' }) // el.value!.scrollTo({ top: height, behavior: 'instant' })
loading = false loading = false
console.log("loading---------------", loading); console.log('loading---------------', loading)
console.log("pagination.pageNo---------------", pagination.pageNo); console.log('pagination.pageNo---------------', pagination.pageNo)
if (pagination.pageNo == 3) { if (pagination.pageNo == 3) {
let timer; let timer
if(timer) { if (timer)
clearTimeout(timer); clearTimeout(timer)
}
timer = setTimeout(() => { timer = setTimeout(() => {
isTop.value = false isTop.value = false
console.log("isTop.value---------------", isTop.value); console.log('isTop.value---------------', isTop.value)
}, 1000) }, 1000)
} }
}) })
}, 300) }, 300)
watch(viewMode, () => { watch(viewMode, () => {
isTop.value = true; isTop.value = true
layout() layout()
}) })
@ -153,7 +152,7 @@ useInfiniteScroll(
el as any, el as any,
() => { () => {
loading = false loading = false
console.log("加载了000000000000000---------------------------"); console.log('加载了000000000000000---------------------------')
loadMore() loadMore()
}, },
{ distance: 10, canLoadMore: () => canloadMore }, { distance: 10, canLoadMore: () => canloadMore },
@ -163,14 +162,14 @@ async function featchList() {
loading = true loading = true
try { try {
// const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value }) // const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value })
console.log("pagination.pageNo------------", pagination.pageNo); console.log('pagination.pageNo------------', pagination.pageNo)
const result = await dubiousfilelist({ ...pagination, ...sortObj }) const result = await dubiousfilelist({ ...pagination, ...sortObj })
// TODO // TODO
// result.data = Array.from({ length: 30 }) // result.data = Array.from({ length: 30 })
const { data, pageCount } = result const { data, pageCount } = result
// canloadMore = pageCount >= pagination.pageNo && pageCount > 0; // canloadMore = pageCount >= pagination.pageNo && pageCount > 0;
canloadMore = data.pages >= pagination.pageNo && data.pages > 0; canloadMore = data.pages >= pagination.pageNo && data.pages > 0
console.log("canloadMore------------", canloadMore); console.log('canloadMore------------', canloadMore)
return result.data.records return result.data.records
// const list = data.map((item) => { // const list = data.map((item) => {
@ -181,32 +180,31 @@ async function featchList() {
// return list // return list
} }
catch (error) { catch (error) {
canloadMore = false; canloadMore = false
return [] return []
} }
} }
async function loadMore() { async function loadMore() {
console.log('执行l------------------------', loading, el.value, pagination.pageNo)
console.log("执行l------------------------", loading, el.value, pagination.pageNo);
if (loading || el.value == null) if (loading || el.value == null)
return return
// loading = true // loading = true
pagination.pageNo = pagination.pageNo + 1; pagination.pageNo = pagination.pageNo + 1
const more = await featchList() const more = await featchList()
console.log("more------------------------", more); console.log('more------------------------', more)
listData.value.push(...more) listData.value.push(...more)
layout() layout()
} }
onUpdated(() => { onUpdated(() => {
if (startCalTime) { if (startCalTime) {
endTime = new Date().getTime(); endTime = new Date().getTime()
if(endTime - startTime > 500) { if (endTime - startTime > 500)
createDom() createDom()
} }
}else { else {
removeDom() removeDom()
} }
// if(elwc.value) { // if(elwc.value) {
@ -220,8 +218,8 @@ let selectionBox: HTMLDivElement | null
const selectIds = ref<string[]>([]) const selectIds = ref<string[]>([])
function downHandler(event: MouseEvent) { function downHandler(event: MouseEvent) {
startTime = new Date().getTime(); startTime = new Date().getTime()
startCalTime = true; startCalTime = true
if (!selectionBox) if (!selectionBox)
return return
@ -264,17 +262,14 @@ function imUpdateSelectIds(x: number, y: number, w: number, h: number) {
// selectedApproveItems.value.splice(tempApproveIndex, 1); // selectedApproveItems.value.splice(tempApproveIndex, 1);
// } // }
}) })
selectedApproveItems.value = []; selectedApproveItems.value = []
// //
listData.value.map(item => { listData.value.map((item) => {
if (selectIds.value.includes(String(item.pictureId))) { if (selectIds.value.includes(String(item.pictureId))) {
item.checked = true; item.checked = true
selectedApproveItems.value.push(item); selectedApproveItems.value.push(item)
} }
}); })
} }
function isSelected(pictureId: number) { function isSelected(pictureId: number) {
@ -283,11 +278,11 @@ function isSelected(pictureId: number) {
function moveHandler(e: MouseEvent) { function moveHandler(e: MouseEvent) {
if (startCalTime) { if (startCalTime) {
endTime = new Date().getTime(); endTime = new Date().getTime()
if(endTime - startTime > 500) { if (endTime - startTime > 500)
createDom() createDom()
} }
}else { else {
removeDom() removeDom()
} }
if (!selectionBox || !start) if (!selectionBox || !start)
@ -307,68 +302,66 @@ function moveHandler(e: MouseEvent) {
} }
function createDom() { function createDom() {
let dom = document.createElement('div'); const dom = document.createElement('div')
dom.className = "selection-box"; dom.className = 'selection-box'
dom.style.width = "1px"; dom.style.width = '1px'
dom.style.border = "1px dotted black"; dom.style.border = '1px dotted black'
dom.style.position = "absolute"; dom.style.position = 'absolute'
dom.style.display = "block"; dom.style.display = 'block'
dom.style.zIndex = '9999'; dom.style.zIndex = '9999'
document.body.appendChild(dom); document.body.appendChild(dom)
selectionBox = document.querySelector('.selection-box') as HTMLDivElement selectionBox = document.querySelector('.selection-box') as HTMLDivElement
} }
function removeDom() { function removeDom() {
let dom = document.getElementsByClassName("selection-box")[0]; const dom = document.getElementsByClassName('selection-box')[0]
if(dom) { if (dom)
document.body.removeChild(dom); document.body.removeChild(dom)
}
} }
function upHandler(event: MouseEvent) { function upHandler(event: MouseEvent) {
endTime = new Date().getTime(); endTime = new Date().getTime()
startCalTime = false; startCalTime = false
if(endTime - startTime > 500) { if (endTime - startTime > 500)
createDom() createDom()
}else { else
removeDom() removeDom()
}
if (!selectionBox) if (!selectionBox)
return return
selectionBox.style.display = 'none' selectionBox.style.display = 'none'
start = null start = null
if(selectionBox.style.width == "0px") { if (selectionBox.style.width == '0px') {
removeDom() removeDom()
if(event.target?.className.indexOf("n-checkbox-box__border") != -1 ) { if (event.target?.className.indexOf('n-checkbox-box__border') != -1)
return return
}
selectIds.value = [] selectIds.value = []
selectedApproveItems.value.forEach((item) => (item.checked = false)); selectedApproveItems.value.forEach(item => (item.checked = false))
selectedApproveItems.value.length = 0; selectedApproveItems.value.length = 0
listData.value.map(item => { listData.value.map((item) => {
item.checked = false; item.checked = false
}); })
// batch.value = false; // batch.value = false;
} }
} }
const gridHeight = computed(() => { const gridHeight = computed(() => {
// return viewMode.value !== 'masonry' ? '157px' : '' // return viewMode.value !== 'masonry' ? '157px' : ''
let height = ""; let height = ''
if (viewMode.value === "masonry") { if (viewMode.value === 'masonry')
height = ""; height = ''
} else if (viewMode.value === "horizontalVersion") { else if (viewMode.value === 'horizontalVersion')
height = "145px"; height = '145px'
} else if (viewMode.value === "verticalVersion") { else if (viewMode.value === 'verticalVersion')
height = "300px"; height = '300px'
} else if (viewMode.value === "3:4") { else if (viewMode.value === '3:4')
height = "240px"; height = '240px'
}
return height; return height
}) })
function addListeners() { function addListeners() {
// selectionBox.style['z-index'] = '-1' // selectionBox.style['z-index'] = '-1'
on(el.value!, 'mousedown', downHandler) on(el.value!, 'mousedown', downHandler)
on(el.value!, 'mousemove', moveHandler) on(el.value!, 'mousemove', moveHandler)
@ -406,38 +399,38 @@ async function showModal() {
} }
async function onChange() { async function onChange() {
if(timeRange.value == "desc") { if (timeRange.value == 'desc')
timeRange.value = "asc"; timeRange.value = 'asc'
}else { else
timeRange.value = "desc"; timeRange.value = 'desc'
}
sortObj = { sortObj = {
// orderbyname: val, // orderbyname: val,
orderByUptime: timeRange.value orderByUptime: timeRange.value,
} }
pagination.pageNo = 1; pagination.pageNo = 1
canloadMore = true; canloadMore = true
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
isTop.value = true; isTop.value = true
layout() layout()
} }
async function onChangeView() { async function onChangeView() {
if(similarRange.value == "desc") { if (similarRange.value == 'desc')
similarRange.value = "asc"; similarRange.value = 'asc'
}else { else
similarRange.value = "desc"; similarRange.value = 'desc'
}
sortObj = { sortObj = {
// orderbyname: val, // orderbyname: val,
orderBySimilarity: similarRange.value orderBySimilarity: similarRange.value,
} }
pagination.pageNo = 1; pagination.pageNo = 1
canloadMore = true; canloadMore = true
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
isTop.value = true; isTop.value = true
layout() layout()
} }
@ -465,17 +458,16 @@ function remove() {
confrimModalRef?.value?.showModal() confrimModalRef?.value?.showModal()
} }
function setBatch(value) { function setBatch(value) {
if (value && batch.value) { if (value && batch.value)
batch.value = !value; batch.value = !value
} else { else
batch.value = value; batch.value = value
}
if (value === false) { if (value === false) {
selectIds.value = [] selectIds.value = []
selectedApproveItems.value.forEach((item) => (item.checked = false)); selectedApproveItems.value.forEach(item => (item.checked = false))
selectedApproveItems.value.length = 0; selectedApproveItems.value.length = 0
} }
} }
@ -485,26 +477,24 @@ defineExpose({
const notPassModalRef = ref(null) const notPassModalRef = ref(null)
const showActions = computed(() => { const showActions = computed(() => {
return selectedApproveItems.value.length > 0 && batch; return selectedApproveItems.value.length > 0 && batch
}); })
function onCheckChange(checked: any, item: any) { function onCheckChange(checked: any, item: any) {
item.checked = checked item.checked = checked
const index = selectedApproveItems.value.indexOf(item); const index = selectedApproveItems.value.indexOf(item)
const picIndex = selectIds.value.indexOf(item.pictureId); const picIndex = selectIds.value.indexOf(item.pictureId)
if (index === -1 && checked) { if (index === -1 && checked)
selectedApproveItems.value.push(item) selectedApproveItems.value.push(item)
} else { else
selectedApproveItems.value.splice(index, 1); selectedApproveItems.value.splice(index, 1)
}
if (picIndex === -1 && checked) { if (picIndex === -1 && checked)
selectIds.value.push(item.pictureId); selectIds.value.push(item.pictureId)
} else { else
selectIds.value.splice(picIndex, 1); selectIds.value.splice(picIndex, 1)
}
setTimeout(() => { setTimeout(() => {
nextTick(() => { nextTick(() => {
batch.value = true batch.value = true
@ -518,19 +508,20 @@ function rejectHandler() {
} }
function reset() { function reset() {
batch.value = false; batch.value = false
// pagination.pageNo = 1; // pagination.pageNo = 1;
pagination.pageNo = 1; pagination.pageNo = 1
pagination.pageSize = 20; pagination.pageSize = 20
selectIds.value = []; selectIds.value = []
selectedApproveItems.value.length = 0; selectedApproveItems.value.length = 0
loading = false; loading = false
canloadMore = true; canloadMore = true
layout(); layout()
} }
function validate(items: any[]) { function validate(items: any[]) {
if (items.length === 0) return "至少选中一个任务"; if (items.length === 0)
return null; return '至少选中一个任务'
return null
} }
function approvalHandler(items?: any) { function approvalHandler(items?: any) {
// if (batch.value) { // if (batch.value) {
@ -539,7 +530,7 @@ function approvalHandler(items?: any) {
// => => / // => => /
if (items !== undefined && !(items instanceof PointerEvent)) if (items !== undefined && !(items instanceof PointerEvent))
processItems = [items] processItems = [items]
console.log("batch-------------",batch.value,selectedApproveItems.value,processItems); console.log('batch-------------', batch.value, selectedApproveItems.value, processItems)
const msg = validate(processItems) const msg = validate(processItems)
if (msg !== null) { if (msg !== null) {
@ -586,9 +577,8 @@ function doAudit(param: any) {
message.info(res.message) message.info(res.message)
// emitter.emit('refresh') // emitter.emit('refresh')
refreshHandler() refreshHandler()
} }
else message.error(res.message) else { message.error(res.message) }
}) })
} }
function reloadList() { function reloadList() {
@ -597,7 +587,7 @@ function reloadList() {
async function refreshHandler(filtersearchId?: any) { async function refreshHandler(filtersearchId?: any) {
// rao start // rao start
reset() reset()
pagination.pageNo = 1; pagination.pageNo = 1
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
layout() layout()
@ -613,53 +603,51 @@ async function refreshHandler(filtersearchId?: any) {
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
console.log("加载了333333333333333333333333---------------------------"); console.log('加载了333333333333333333333333---------------------------')
loadMore(); loadMore()
}, },
{ distance: 10, canLoadMore: () => canloadMore } { distance: 10, canLoadMore: () => canloadMore },
); )
}, 300); }, 300)
}); })
} }
watch(() => show.value, watch(() => show.value, async (newVal) => {
async(newVal) => {
if (show.value) { if (show.value) {
pagination.pageNo = 1; pagination.pageNo = 1
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
console.log("加载了1111111111111---------------------------", listData.value); console.log('加载了1111111111111---------------------------', listData.value)
layout() layout()
} }
}, })
)
watch(() => pagination.pageNo, watch(() => pagination.pageNo, (newVal, oldVal) => {
(newVal, oldVal) => { console.log('加载了22222222222222222---------------------------', newVal, oldVal, canloadMore)
console.log("加载了22222222222222222---------------------------", newVal, oldVal, canloadMore); if (newVal == oldVal)
if(newVal == oldVal) {
return return
}
if ((newVal == 1 || newVal == 2) && canloadMore) { if ((newVal == 1 || newVal == 2) && canloadMore) {
setTimeout(() => { setTimeout(() => {
nextTick(() => { nextTick(() => {
loading = false loading = false
loadMore(); loadMore()
}) })
}, 500) }, 500)
} }
}, })
);
</script> </script>
<template> <template>
<div> <div>
<n-modal v-model:show="show" :mask-closable="false" style="position: relative;" transform-origin="center" <n-modal
@after-enter="afterEnter" @after-leave="afterLeave"> v-model:show="show" :mask-closable="false" style="position: relative;" transform-origin="center"
<n-card ref="elwc" :style="cardStyle" class="card card-1" style="position: fixed;top:64px" :bordered="false" size="huge" @after-enter="afterEnter" @after-leave="afterLeave"
role="dialog" aria-modal="true"> >
<n-card
ref="elwc" :style="cardStyle" class="card card-1" style="position: fixed;top:64px" :bordered="false" size="huge"
role="dialog" aria-modal="true"
>
<div class="wrapper"> <div class="wrapper">
<div class="wrapper-m32"> <div class="wrapper-m32">
<SvgIcon name="recycle" size="16" /> <SvgIcon name="recycle" size="16" />
@ -709,7 +697,7 @@ watch(() => pagination.pageNo,
<div class="remove" @click="remove"> <div class="remove" @click="remove">
移除可疑文件夹 移除可疑文件夹
</div> </div>
<div class="wrapper-content-form-button" @click="setBatch(true)" v-show="!showActions"> <div v-show="!showActions" class="wrapper-content-form-button" @click="setBatch(true)">
<SvgIcon style="margin-right: 6px;" size="14" name="tf" /> <SvgIcon style="margin-right: 6px;" size="14" name="tf" />
批量审批 批量审批
</div> </div>
@ -734,9 +722,11 @@ watch(() => pagination.pageNo,
<div ref="el" class="scroll" :style="{ height: maxHeight }"> <div ref="el" class="scroll" :style="{ height: maxHeight }">
<!-- <n-scrollbar :on-scroll="scrollHandler"> --> <!-- <n-scrollbar :on-scroll="scrollHandler"> -->
<div ref="masonryRef" class="grid"> <div ref="masonryRef" class="grid">
<div v-for="(item, index) in listData" :key="item.pictureId" :data-id="item.pictureId" <div
v-for="(item, index) in listData" :key="item.pictureId" :data-id="item.pictureId"
:class="{ 'grid-item-selected': isSelected(item.pictureId) }" :style="{ height: gridHeight }" :class="{ 'grid-item-selected': isSelected(item.pictureId) }" :style="{ height: gridHeight }"
class="grid-item"> class="grid-item"
>
<n-image <n-image
ref="imageRef" ref="imageRef"
:src="item.imgUrl" :src="item.imgUrl"
@ -746,12 +736,16 @@ watch(() => pagination.pageNo,
'img-fit': viewMode === 'horizontalVersion', 'img-fit': viewMode === 'horizontalVersion',
'img-full': viewMode === '3:4' || viewMode === 'verticalVersion' }" 'img-full': viewMode === '3:4' || viewMode === 'verticalVersion' }"
/> />
<n-checkbox v-if="batch && item.historyStates === 1" v-model:checked="item.checked" <n-checkbox
v-if="batch && item.historyStates === 1" v-model:checked="item.checked"
style="position:absolute;left:20px;top:20px" @click.prevent.stop style="position:absolute;left:20px;top:20px" @click.prevent.stop
@update:checked="onCheckChange($event, item)" /> @update:checked="onCheckChange($event, item)"
/>
<img v-if="item.historyStates === 2" class="tag-status" src="@/assets/images/task/tag-pass.png" alt=""> <img v-if="item.historyStates === 2" class="tag-status" src="@/assets/images/task/tag-pass.png" alt="">
<img v-if="item.historyStates === 3" class="tag-status" src="@/assets/images/task/tag-not-pass.png" <img
alt=""> v-if="item.historyStates === 3" class="tag-status" src="@/assets/images/task/tag-not-pass.png"
alt=""
>
<div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent"> <div :class="{ 'percent-red': item.similarityScore === 100 }" class="percent">
{{ item.similarityScore }}<span class="percent-unit">%</span> {{ item.similarityScore }}<span class="percent-unit">%</span>
@ -769,13 +763,13 @@ watch(() => pagination.pageNo,
</div> --> </div> -->
<div class="time-item" style="margin-bottom: 4px;"> <div class="time-item" style="margin-bottom: 4px;">
<SvgIcon color="#FFF" size="16" name="camera" style="margin-right: 4px;" /> <SvgIcon color="#FFF" size="16" name="camera" style="margin-right: 4px;" />
<span class="time-value">{{ item?.photoDateTimestamp ? <span class="time-value">{{ item?.photoDateTimestamp
formatToDateHMS(Number(item.photoDateTimestamp)) : '-' }} </span> ? formatToDateHMS(Number(item.photoDateTimestamp)) : '-' }} </span>
</div> </div>
<div class="time-item"> <div class="time-item">
<SvgIcon class="svg-time" color="#FFF" size="16" name="time" /> <SvgIcon class="svg-time" color="#FFF" size="16" name="time" />
<span>{{ item.submitDateTimestamp ? <span>{{ item.submitDateTimestamp
formatToDateHMS(Number(item.submitDateTimestamp)) : '-' }}</span> ? formatToDateHMS(Number(item.submitDateTimestamp)) : '-' }}</span>
</div> </div>
</div> </div>
</div> </div>
@ -791,8 +785,7 @@ watch(() => pagination.pageNo,
</n-card> </n-card>
</n-modal> </n-modal>
<NotPassed ref="notPassModalRef" @success="reloadList" /> <NotPassed ref="notPassModalRef" @success="reloadList" />
<ConfrimModal ref="confrimModalRef" @commit="commit" :selectedTotal="selectIds.length" /> <ConfrimModal ref="confrimModalRef" :selected-total="selectIds.length" @commit="commit" />
</div> </div>
</template> </template>
@ -977,7 +970,6 @@ watch(() => pagination.pageNo,
} }
} }
.scroll { .scroll {
overflow-y: auto; overflow-y: auto;
// height: calc(100vh - 282px); // height: calc(100vh - 282px);
@ -1005,4 +997,5 @@ watch(() => pagination.pageNo,
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
}</style> }
</style>

@ -14,7 +14,7 @@ defineExpose({
<template> <template>
<div> <div>
<n-modal v-model:show="show" :mask="false" :showMask="false" transform-origin="center"> <n-modal v-model:show="show" :mask="false" :show-mask="false" transform-origin="center">
<Search @close="show = false" /> <Search @close="show = false" />
</n-modal> </n-modal>
</div> </div>

@ -9,7 +9,7 @@ const cardStyle = {
'width': '800px', 'width': '800px',
'--n-padding-bottom': '10px', '--n-padding-bottom': '10px',
'--n-padding-left': '10px', '--n-padding-left': '10px',
'padding-bottom':'100px' 'padding-bottom': '100px',
} }
function showModal() { function showModal() {
@ -102,7 +102,6 @@ defineExpose({
</div> </div>
<div class="wrapper-request"> <div class="wrapper-request">
<table style="margin-left: 100px;"> <table style="margin-left: 100px;">
<tr> <tr>
<td><div class="key" data-key="p p" /></td> <td><div class="key" data-key="p p" /></td>
<td>通过</td> <td>通过</td>

@ -1,92 +1,92 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, ref } from "vue"; import { computed, inject, onMounted, ref } from 'vue'
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from 'vue-router'
import { useUser } from "@/store/modules/user"; import { useUser } from '@/store/modules/user'
import { getImgUrl } from "@/utils/urlUtils"; import { getImgUrl } from '@/utils/urlUtils'
import defaultAvatar from '@/assets/icons/avatar.svg'; import defaultAvatar from '@/assets/icons/avatar.svg'
const emit = defineEmits<{ const emit = defineEmits<{
(e: "logout"): void; (e: 'logout'): void
}>(); }>()
const router = useRouter(); const router = useRouter()
const userStore = useUser(); const userStore = useUser()
const useInfo = userStore.getUserInfo; const useInfo = userStore.getUserInfo
const aiDisabled = ref(false); const aiDisabled = ref(false)
function handleSelect(row) { function handleSelect(row) {
userStore.updateTenantId(row.key); userStore.updateTenantId(row.key)
location.reload(); location.reload()
} }
function logIt(e) { function logIt(e) {
return false; return false
} }
// //
function goHome(e) { function goHome(e) {
router.push({ name: "home" }); router.push({ name: 'home' })
} }
// //
function goTask(e) { function goTask(e) {
router.push({ name: "task-main" }); router.push({ name: 'task-main' })
} }
// AI // AI
function goWorksheet(e) { function goWorksheet(e) {
router.push({ name: "worksheet-main" }); router.push({ name: 'worksheet-main' })
} }
// //
function goFinal(e) { function goFinal(e) {
router.push({ name: "final-main" }); router.push({ name: 'final-main' })
} }
const mousetrap = inject("mousetrap") as any; const mousetrap = inject('mousetrap') as any
onMounted(() => { onMounted(() => {
mousetrap.bind("g h", goHome); mousetrap.bind('g h', goHome)
mousetrap.bind("g t", goTask); mousetrap.bind('g t', goTask)
mousetrap.bind("g a", goWorksheet); mousetrap.bind('g a', goWorksheet)
mousetrap.bind("g e", goFinal); mousetrap.bind('g e', goFinal)
}); })
const showPopover = ref(false); const showPopover = ref(false)
const popRef = ref(null); const popRef = ref(null)
const changeFlag = ref(false); const changeFlag = ref(false)
const iconName = computed(() => { const iconName = computed(() => {
return showPopover.value ? "expand" : "collapse"; return showPopover.value ? 'expand' : 'collapse'
}); })
function handleUpdateShow(show: boolean) { function handleUpdateShow(show: boolean) {
showPopover.value = show; showPopover.value = show
} }
function logOut() { function logOut() {
(popRef.value as any).setShow(false); (popRef.value as any).setShow(false)
emit("logout"); emit('logout')
} }
const currentCompanyName = computed(() => { const currentCompanyName = computed(() => {
const tenantList = useInfo.tenantList; const tenantList = useInfo.tenantList
const currentId = userStore.getTenantId; const currentId = userStore.getTenantId
const current = tenantList.find((item) => item.id === currentId); const current = tenantList.find(item => item.id === currentId)
return current.name || "name"; return current.name || 'name'
}); })
const options = computed(() => { const options = computed(() => {
const tenantList = useInfo.tenantList; const tenantList = useInfo.tenantList
return tenantList.map((item) => { return tenantList.map((item) => {
return { return {
label: item.name, label: item.name,
key: item.id, key: item.id,
}; }
}); })
}); })
</script> </script>
<template> <template>
@ -119,24 +119,28 @@ const options = computed(() => {
</div> </div>
<div class="trigger"> <div class="trigger">
<span>{{ currentCompanyName }}</span> <span>{{ currentCompanyName }}</span>
<span @click="changeFlag = !changeFlag" style="cursor: pointer"><SvgIcon name="switchCompany" size="24" /></span> <span style="cursor: pointer" @click="changeFlag = !changeFlag"><SvgIcon name="switchCompany" size="24" /></span>
</div> </div>
<div class="item"> <div class="item">
<span>AI设置开关</span> <span>AI设置开关</span>
<n-switch v-model:value="aiDisabled" /> <n-switch v-model:value="aiDisabled" />
</div> </div>
<div class="trigger">联系我们</div> <div class="trigger">
联系我们
</div>
<n-divider style="margin-top: 0px; margin-bottom: 10px; padding: 0 22px" /> <n-divider style="margin-top: 0px; margin-bottom: 10px; padding: 0 22px" />
<div class="trigger" @click="logOut">退</div> <div class="trigger" @click="logOut">
退出登录
</div>
<div <div
class="container sub-container"
v-show="changeFlag" v-show="changeFlag"
class="container sub-container"
style="position: absolute; right: 17vw; width: 11.5vw; padding: 24px 0" style="position: absolute; right: 17vw; width: 11.5vw; padding: 24px 0"
> >
<div <div
class="trigger"
v-for="option in options" v-for="option in options"
:key="option.key" :key="option.key"
class="trigger"
@click="handleSelect(option)" @click="handleSelect(option)"
> >
{{ option.label }} {{ option.label }}

@ -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,39 @@ 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;
});
} }
console.log(userInfo.frontmenuTList,'frontmenuTList'); return v
})
}
console.log(userInfo.frontmenuTList, 'frontmenuTList')
console.log(menus.value, 'menus') console.log(menus.value, 'menus')
updateSelectedKeys(); updateSelectedKeys()
} }
// //
function clickMenuItem(key: string) { function clickMenuItem(key: string) {
console.log('clickMenuItem', key) console.log('clickMenuItem', key)
if (/http(s)?:/.test(key)) window.open(key); if (/http(s)?:/.test(key))
else router.push({ name: key }); window.open(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,17 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, unref } from "vue"; import { computed, unref } from 'vue'
import { Logo } from "./components/Logo"; import { Logo } from './components/Logo'
import { MainView } from "./components/Main"; import { MainView } from './components/Main'
import { AsideMenu } from "./components/Menu"; import { AsideMenu } from './components/Menu'
import { PageHeader } from "./components/Header"; import { PageHeader } from './components/Header'
import { useProjectSetting } from "@/hooks/setting/useProjectSetting"; import { useProjectSetting } from '@/hooks/setting/useProjectSetting'
const { menuSetting } = useProjectSetting(); 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>

@ -1,5 +1,5 @@
import { Layout } from '@/router/constant'
import type { RouteRecordRaw } from 'vue-router' import type { RouteRecordRaw } from 'vue-router'
import { Layout } from '@/router/constant'
/** /**
* @param name , , * @param name , ,

@ -21,7 +21,7 @@ export const useAsideConfigStore = defineStore({
systemConfig: null, systemConfig: null,
customConfig: null, customConfig: null,
asideValue: null, asideValue: null,
searchValue: "", searchValue: '',
isAllowDownload: true, isAllowDownload: true,
timeNum: 0, timeNum: 0,
filterConfig: [], filterConfig: [],

@ -1,6 +1,6 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { store } from '@/store' import { store } from '@/store'
import { getBackList, getBusinessList, getIzShowList, getIztaskstatusList, getPictureTypeList, getRegionList, getRejectList, getRelationTypeList, getTFList, getizstatusList, getizApprovalStatusList } from '@/api/dictionary' import { getBackList, getBusinessList, getIzShowList, getIztaskstatusList, getPictureTypeList, getRegionList, getRejectList, getRelationTypeList, getTFList, getizApprovalStatusList, getizstatusList } from '@/api/dictionary'
export interface DictionaryState { export interface DictionaryState {
regionList: any regionList: any
@ -104,32 +104,32 @@ export const useDictionaryStore = defineStore({
}, },
getizApprovalStatus: (state) => { getizApprovalStatus: (state) => {
return state.izApprovalStatusList return state.izApprovalStatusList
} },
}, },
actions: { actions: {
initData() { initData() {
// this.fetchRegionList(); //废弃 // this.fetchRegionList(); //废弃
this.fetchPictureTypeList(); this.fetchPictureTypeList()
this.fetchPersionList(); this.fetchPersionList()
this.fetchPlanList(); this.fetchPlanList()
this.fetchTFList(); this.fetchTFList()
// this.fetchIzShowList(); //废弃 // this.fetchIzShowList(); //废弃
this.fetchIzProjectList(); this.fetchIzProjectList()
this.fetchIztaskrromList(); this.fetchIztaskrromList()
this.fetchIztaskstatusList(); this.fetchIztaskstatusList()
this.fetchIzvisitproList(); this.fetchIzvisitproList()
this.fetchIzfirmList(); this.fetchIzfirmList()
this.fetchIzproductnameList(); this.fetchIzproductnameList()
this.fetchizcustomnameList(); this.fetchizcustomnameList()
this.fetchIzCustomtypeList(); this.fetchIzCustomtypeList()
this.fetchIzcustomlevelList(); this.fetchIzcustomlevelList()
this.fetchizizprojecttypeList(); this.fetchizizprojecttypeList()
this.fetchizvisitcityList(); this.fetchizvisitcityList()
this.fetchRejectList(); this.fetchRejectList()
this.fetchBackList(); this.fetchBackList()
this.fetchRelationTypeList(); this.fetchRelationTypeList()
this.fetchizstatusListt(); this.fetchizstatusListt()
this.fetchizApprovalStatusList(); this.fetchizApprovalStatusList()
}, },
settfList(config) { settfList(config) {
this.tfList = config this.tfList = config

@ -2,8 +2,8 @@ import { defineStore } from 'pinia'
import { store } from '@/store' import { store } from '@/store'
import { getFilter } from '@/api/home/filter' import { getFilter } from '@/api/home/filter'
import { getConfig } from '@/api/system/user' import { getConfig } from '@/api/system/user'
import { asideMap } from "@/config/final"; import { asideMap } from '@/config/final'
import { cloneDeep, isEqual } from "lodash-es"; import { cloneDeep, isEqual } from 'lodash-es'
import type { AsideConfig } from '/#/api' import type { AsideConfig } from '/#/api'
@ -25,7 +25,7 @@ export const useFinalStore = defineStore({
customConfig: null, customConfig: null,
asideValue: null, asideValue: null,
listKey: 0, listKey: 0,
searchValue: "", searchValue: '',
isAllowDownload: true, isAllowDownload: true,
timeNum: 0, timeNum: 0,
filterConfig: [], filterConfig: [],
@ -56,7 +56,7 @@ export const useFinalStore = defineStore({
actions: { actions: {
setSystemConfig(config: AsideConfig) { setSystemConfig(config: AsideConfig) {
this.systemConfig = config this.systemConfig = config
console.log("systemConfig----------", config); console.log('systemConfig----------', config)
}, },
setAsideValue(value) { setAsideValue(value) {
this.asideValue = value this.asideValue = value
@ -86,21 +86,21 @@ export const useFinalStore = defineStore({
// console.log("response.data----------", response.data); // console.log("response.data----------", response.data);
// this.setSystemConfig(response.data) // this.setSystemConfig(response.data)
// return response.data // return response.data
let list: any = {}; const list: any = {}
let tempAsideMap = cloneDeep(asideMap); const tempAsideMap = cloneDeep(asideMap)
Object.keys(tempAsideMap).map(key => { Object.keys(tempAsideMap).map((key) => {
list[key] = "Y"; list[key] = 'Y'
}); })
console.log("setSystemConfig---------------", list); console.log('setSystemConfig---------------', list)
this.setSystemConfig(list); this.setSystemConfig(list)
return list return list
}, },
// // 获取终审个性化配置 // // 获取终审个性化配置
async fetchCustomConfig() { async fetchCustomConfig() {
const res = await getFilter(1) const res = await getFilter(1)
const { data } = res const { data } = res
const list = data && data.searchcount ? data.searchcount.split(',') : []; const list = data && data.searchcount ? data.searchcount.split(',') : []
console.log("listkey---------------", list); console.log('listkey---------------', list)
this.customConfig = list this.customConfig = list
return list return list
}, },

@ -12,7 +12,7 @@ export const useTaskStore = defineStore({
packageid: '', packageid: '',
immersion: false, immersion: false,
inFile: false, // 是否进入文件夹 inFile: false, // 是否进入文件夹
inFileId:"", inFileId: '',
}), }),
getters: { getters: {
getActiveId: (state: TaskState) => state.activeId, getActiveId: (state: TaskState) => state.activeId,

@ -28,7 +28,7 @@ export const useWorkOrderStore = defineStore({
this.currentIndex = index this.currentIndex = index
const order = this.packageList[index] const order = this.packageList[index]
this.activeId = orderId || order?.checkDuplicateId this.activeId = orderId || order?.checkDuplicateId
this.dataId = dataId || order.id; this.dataId = dataId || order.id
}, },
forward() { forward() {
const len = this.packageList.length const len = this.packageList.length

@ -10,107 +10,108 @@ import {
shallowRef, shallowRef,
unref, unref,
watch, watch,
} from "vue"; } from 'vue'
import { CustomFilterModalVue, FilterModal, NewFilterModal } from "@/views/final/comp"; import { cloneDeep, isEqual } from 'lodash-es'
import Search from "@/views/home/aside/comp/Search.vue"; import { CustomFilterModalVue, FilterModal, NewFilterModal } from '@/views/final/comp'
import AdvanceFilter from "@/views/home/aside/comp/AdvanceFilter.vue"; import Search from '@/views/home/aside/comp/Search.vue'
import { getViewportOffset } from "@/utils/domUtils"; import AdvanceFilter from '@/views/home/aside/comp/AdvanceFilter.vue'
import { useWindowSizeFn } from "@/hooks/event/useWindowSizeFn"; import { getViewportOffset } from '@/utils/domUtils'
import { useFinal } from "@/store/modules/final"; import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
import type { Filter } from "/#/home"; import { useFinal } from '@/store/modules/final'
import type { AsideEntity } from "@/config/aside"; import type { Filter } from '/#/home'
import { asideMap } from "@/config/final"; import type { AsideEntity } from '@/config/aside'
import type { AsideConfig } from "/#/api"; import { asideMap } from '@/config/final'
import emitter from "@/utils/mitt"; import type { AsideConfig } from '/#/api'
import { getFilterList } from "@/api/home/main"; import emitter from '@/utils/mitt'
import { cloneDeep, isEqual } from "lodash-es"; import { getFilterList } from '@/api/home/main'
const emit = defineEmits(["inputChange"]); const emit = defineEmits(['inputChange'])
const finalStore = useFinal(); const finalStore = useFinal()
// //
const asideValue: Record<keyof typeof asideMap, any> = reactive({}); const asideValue: Record<keyof typeof asideMap, any> = reactive({})
// : // :
const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({}); const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({})
// //
const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]); const showItems = shallowRef<{ key: string, config: AsideEntity }[]>([])
const initAsideValueRef = ref<any>(null); // () const initAsideValueRef = ref<any>(null) // ()
const customObjRef = ref<any>(null); // const customObjRef = ref<any>(null) //
const customTempObjRef = ref<any>(null); // () const customTempObjRef = ref<any>(null) // ()
const configFilterRef = ref<any>([]); // const configFilterRef = ref<any>([]) //
initAsideValueRef.value = cloneDeep(asideMap); initAsideValueRef.value = cloneDeep(asideMap)
onBeforeMount(async () => { onBeforeMount(async () => {
finalStore.fetchConfig(); finalStore.fetchConfig()
finalStore.fetchCustomConfig(); finalStore.fetchCustomConfig()
}); })
Object.keys(asideMap).forEach((key) => { Object.keys(asideMap).forEach((key) => {
const { defaultValue, inFilterList } = asideMap[key]; const { defaultValue, inFilterList } = asideMap[key]
if (inFilterList !== false) asideValue[key] = defaultValue; if (inFilterList !== false)
}); asideValue[key] = defaultValue
})
const filterModalRef:any = ref(null); const filterModalRef: any = ref(null)
const newFilterModalRef = ref(null); const newFilterModalRef = ref(null)
const customModalRef = ref(null); const customModalRef = ref(null)
const AdvanceFilterRef: any = ref(null); const AdvanceFilterRef: any = ref(null)
function showModal(modalRef: any) { function showModal(modalRef: any) {
const modal = unref(modalRef)! as any; const modal = unref(modalRef)! as any
modal.showModal(); modal.showModal()
} }
const newFilterOk = () => { 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()
}; }
const mousetrap = inject("mousetrap") as any; const mousetrap = inject('mousetrap') as any
mousetrap.bind("[", collapseHandler); mousetrap.bind('[', collapseHandler)
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
computeSlideHeight(); computeSlideHeight()
}); })
}); })
const collapse = ref(false); const collapse = ref(false)
function collapseHandler() { function collapseHandler() {
collapse.value = !collapse.value; collapse.value = !collapse.value
} }
const asideWidth = computed(() => { const asideWidth = computed(() => {
return collapse.value ? 0 : 308; return collapse.value ? 0 : 308
}); })
const asideHeight = ref(500); const asideHeight = ref(500)
const asideStyle = computed(() => { const asideStyle = computed(() => {
return { return {
width: `${asideWidth.value}px`, width: `${asideWidth.value}px`,
height: `${asideHeight.value}px`, height: `${asideHeight.value}px`,
}; }
}); })
const collapseIcon = computed(() => { const collapseIcon = computed(() => {
return collapse.value ? "expand-cir" : "collapse-cir"; return collapse.value ? 'expand-cir' : 'collapse-cir'
}); })
function computeSlideHeight() { function computeSlideHeight() {
const headEl = document.querySelector(".aside-header")!; const headEl = document.querySelector('.aside-header')!
const { bottomIncludeBody } = getViewportOffset(headEl); const { bottomIncludeBody } = getViewportOffset(headEl)
const height = bottomIncludeBody; const height = bottomIncludeBody
asideHeight.value = height - 24; asideHeight.value = height - 24
} }
useWindowSizeFn(computeSlideHeight, 280); useWindowSizeFn(computeSlideHeight, 280)
onBeforeMount(async () => { onBeforeMount(async () => {
finalStore.fetchCustomConfig(); finalStore.fetchCustomConfig()
}); })
nextTick(() => { nextTick(() => {
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
@ -144,17 +145,18 @@ nextTick(()=>{
// }, []); // }, []);
// console.log("showItems111111111---------------", items); // console.log("showItems111111111---------------", items);
// showItems.value = items; // showItems.value = items;
const config = finalStore.getSystemConfig; const config = finalStore.getSystemConfig
const customConfig = finalStore.getCustomConfig; const customConfig = finalStore.getCustomConfig
if ( if (
configFilterRef.value.length > 0 && configFilterRef.value.length > 0
isEqual(configFilterRef.value, finalStore.getFilterConfig) && && isEqual(configFilterRef.value, finalStore.getFilterConfig)
customObjRef.value && && customObjRef.value
isEqual(customObjRef.value, customTempObjRef.value) && isEqual(customObjRef.value, customTempObjRef.value)
) { )
return; return
}
if (config == null || customConfig == null) return; if (config == null || customConfig == null)
return
// console.log("config", config, "customConfig", customConfig); // console.log("config", config, "customConfig", customConfig);
/* rao /* rao
const showKeys = [...customConfig].filter(key => !asideMap[key].isDefaultFilter)// customConfig isDefaultFilter const showKeys = [...customConfig].filter(key => !asideMap[key].isDefaultFilter)// customConfig isDefaultFilter
@ -162,166 +164,171 @@ nextTick(()=>{
showKeys.unshift(...defaultKeys) showKeys.unshift(...defaultKeys)
*/ */
let sortKeyList: any = []; const sortKeyList: any = []
finalStore.getFilterConfig.map((item: any) => { finalStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item?.id); sortKeyList.push(item?.id)
}); })
const showKeys = [...sortKeyList]; const showKeys = [...sortKeyList]
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) {
// //
Object.keys(customObjRef.value).map((key) => { Object.keys(customObjRef.value).map((key) => {
if (asideMap.hasOwnProperty(key)) { if (asideMap.hasOwnProperty(key)) {
const str = key.toLowerCase(); const str = key.toLowerCase()
// console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]); // console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]);
if (str == "izsimilarity") { if (str == 'izsimilarity') {
if (typeof customObjRef.value[str] == "string") { if (typeof customObjRef.value[str] == 'string')
customObjRef.value[str] = customObjRef.value[str].split(","); customObjRef.value[str] = customObjRef.value[str].split(',')
}
asideValue[key] = customObjRef.value[str]; // asideValue[key] = customObjRef.value[str] //
console.log("相似度2222222222", asideValue[key]); console.log('相似度2222222222', asideValue[key])
} else if (str == "izyear") { }
if (typeof customObjRef.value[str] == "string") { else if (str == 'izyear') {
let time = customObjRef.value[str].split("-"); if (typeof customObjRef.value[str] == 'string') {
time[0] = new Date(time[0]).getTime(); const time = customObjRef.value[str].split('-')
time[1] = new Date(time[1]).getTime(); time[0] = new Date(time[0]).getTime()
customObjRef.value[str] = time; time[1] = new Date(time[1]).getTime()
} customObjRef.value[str] = time
asideValue[key] = customObjRef.value[str]; // }
console.log("时间2222222222", asideValue[key]); asideValue[key] = customObjRef.value[str] //
} else if (customObjRef.value[str]) { console.log('时间2222222222', asideValue[key])
console.log("customObjRef.value[str]222222", customObjRef.value[str]); }
else if (customObjRef.value[str]) {
console.log('customObjRef.value[str]222222', customObjRef.value[str])
// let list = customObjRef.value[str].split(','); // let list = customObjRef.value[str].split(',');
// console.log("list222222", list); // console.log("list222222", list);
if (typeof customObjRef.value[str] == "string") { if (typeof customObjRef.value[str] == 'string') {
customObjRef.value[str] = customObjRef.value[str].split(","); customObjRef.value[str] = customObjRef.value[str].split(',')
asideValue[key] = customObjRef.value[str]; // asideValue[key] = customObjRef.value[str] //
}else { }
asideValue[key] = customObjRef.value[str]; // else {
asideValue[key] = customObjRef.value[str] //
}
} }
} else { else {
asideValue[key] = null; asideValue[key] = null
} }
// asideMap[str].defaultValue = customObjRef.value[str];// // asideMap[str].defaultValue = customObjRef.value[str];//
} }
}); })
customTempObjRef.value = customObjRef.value; customTempObjRef.value = customObjRef.value
console.log("asideValue直接处理后的结果", asideValue); console.log('asideValue直接处理后的结果', asideValue)
console.log("customTempObjRef.value", customTempObjRef.value); console.log('customTempObjRef.value', customTempObjRef.value)
let tempobj = cloneDeep(asideValue); const tempobj = cloneDeep(asideValue)
console.log("tempObj", tempobj); console.log('tempObj', tempobj)
finalStore.setAsideValue(tempobj); finalStore.setAsideValue(tempobj)
} }
// console.log("showKeys", showKeys); // console.log("showKeys", showKeys);
const items = showKeys.reduce((acc, key) => { const items = showKeys.reduce((acc, key) => {
const currentData = asideMap[key]; const currentData = asideMap[key]
const render = currentData?.render; const render = currentData?.render
if (render !== false) { if (render !== false) {
const str = key?.toLowerCase(); const str = key?.toLowerCase()
const o = { const o = {
key: str, key: str,
config: asideMap[str], config: asideMap[str],
}; }
return [...acc, o]; return [...acc, o]
} else { }
return acc; else {
} return acc
}, []); }
console.log("showItems=================================", items); }, [])
showItems.value = items; console.log('showItems=================================', items)
configFilterRef.value = finalStore.getFilterConfig; showItems.value = items
}); configFilterRef.value = finalStore.getFilterConfig
})
}) })
watch(asideVisible, (newVal) => { watch(asideVisible, (newVal) => {
Object.keys(asideValue).forEach((key) => { Object.keys(asideValue).forEach((key) => {
if (newVal[key] === false) asideValue[key] = asideMap[key].defaultValue; if (newVal[key] === false)
}); asideValue[key] = asideMap[key].defaultValue
}); })
})
const asideEnter = ref(false); const asideEnter = ref(false)
const showCollapse = computed(() => { const showCollapse = computed(() => {
return collapse.value ? true : asideEnter.value; return collapse.value ? true : asideEnter.value
}); })
const showSearch = ref(false); const showSearch = ref(false)
function setShowSearch(value: boolean) { function setShowSearch(value: boolean) {
showSearch.value = value; showSearch.value = value
if(!value){ if (!value)
inputChange('') inputChange('')
} }
}
// key // key
function scrollHandler(key: string) { function scrollHandler(key: string) {
const element = document.querySelector(`#${key}`); const element = document.querySelector(`#${key}`)
element?.scrollIntoView(true); element?.scrollIntoView(true)
} }
async function filterHandler(searchId: string) { async function filterHandler(searchId: string) {
emitter.emit("filter-final", searchId); emitter.emit('filter-final', searchId)
const res = await getFilterList({ userSearchId: searchId }); const res = await getFilterList({ userSearchId: searchId })
// console.log("", res); // console.log("", res);
if (res.code == "OK") { if (res.code == 'OK') {
let obj = res.data; const obj = res.data
customObjRef.value = res.data; customObjRef.value = res.data
let showKeys: any[] = []; const showKeys: any[] = []
Object.keys(obj).map((key) => { Object.keys(obj).map((key) => {
if (asideMap.hasOwnProperty(key)) { if (asideMap.hasOwnProperty(key))
showKeys.push(key); showKeys.push(key)
} })
}); console.log('showKeys1111111111111111', showKeys)
console.log("showKeys1111111111111111", showKeys); finalStore.setCustomConfig(showKeys)
finalStore.setCustomConfig(showKeys);
} }
} }
function editFilter(filter: any) { function editFilter(filter: any) {
const modal = unref(newFilterModalRef)! as any; const modal = unref(newFilterModalRef)! as any
modal.showModal(); modal.showModal()
modal.edit(filter); modal.edit(filter)
} }
// watch(asideValue, (newVal) => { // watch(asideValue, (newVal) => {
// finalStore.setAsideValue(newVal); // finalStore.setAsideValue(newVal);
// }); // });
const inputChange = (keyword) => { function inputChange(keyword) {
emit("inputChange", keyword); emit('inputChange', keyword)
}; }
const handleOk = (item: any) => { function handleOk(item: any) {
console.log("handleOk", item); console.log('handleOk', item)
if (item) { if (item) {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname); AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname)
filterHandler(item.id); filterHandler(item.id)
} else { }
AdvanceFilterRef.value.setCurrentlySelectedAdvanced("高级筛选"); else {
filterHandler(""); AdvanceFilterRef.value.setCurrentlySelectedAdvanced('高级筛选')
filterHandler('')
}
} }
};
function updateComponent(key, e) { function updateComponent(key, e) {
console.log("跟新值", key, e); console.log('跟新值', key, e)
console.log("tempAsideValue跟新值", finalStore.getAsideValue, asideValue); console.log('tempAsideValue跟新值', finalStore.getAsideValue, asideValue)
// let tempAsideValue = finalStore.getAsideValue || asideValue; // let tempAsideValue = finalStore.getAsideValue || asideValue;
let tempobj = cloneDeep(asideValue); const tempobj = cloneDeep(asideValue)
console.log(tempobj, "tempobj"); console.log(tempobj, 'tempobj')
tempobj[key] = e; tempobj[key] = e
console.log(tempobj, "tempobj After"); console.log(tempobj, 'tempobj After')
customObjRef.value = tempobj; customObjRef.value = tempobj
// asideValue = Object.assign({}, asideValue, tempobj); // asideValue = Object.assign({}, asideValue, tempobj);
console.log("asideValue跟新值", tempobj); console.log('asideValue跟新值', tempobj)
finalStore.setAsideValue(tempobj); finalStore.setAsideValue(tempobj)
} }
</script> </script>
<template> <template>
@ -343,18 +350,18 @@ function updateComponent(key, e) {
v-show="showSearch" v-show="showSearch"
@select="scrollHandler" @select="scrollHandler"
@close="setShowSearch(false)" @close="setShowSearch(false)"
@inputChange="inputChange" @input-change="inputChange"
@showSearch="setShowSearch(true)" @show-search="setShowSearch(true)"
/> />
<!-- 高级筛选 --> <!-- 高级筛选 -->
<AdvanceFilter <AdvanceFilter
v-show="!showSearch" v-show="!showSearch"
ref="AdvanceFilterRef"
:type="1" :type="1"
@select="filterHandler" @select="filterHandler"
@update:search="setShowSearch(true)" @update:search="setShowSearch(true)"
@show-custom="showModal(customModalRef)" @show-custom="showModal(customModalRef)"
@show-filter="showModal(filterModalRef)" @show-filter="showModal(filterModalRef)"
ref="AdvanceFilterRef"
/> />
</div> </div>
@ -375,10 +382,10 @@ function updateComponent(key, e) {
ref="filterModalRef" ref="filterModalRef"
@edit-filter="editFilter" @edit-filter="editFilter"
@show-new-filter="showModal(newFilterModalRef)" @show-new-filter="showModal(newFilterModalRef)"
@handleOk="handleOk" @handle-ok="handleOk"
/> />
<!-- 新增过滤 --> <!-- 新增过滤 -->
<NewFilterModal ref="newFilterModalRef" @onOk="newFilterOk" /> <NewFilterModal ref="newFilterModalRef" @on-ok="newFilterOk" />
</n-scrollbar> </n-scrollbar>
</div> </div>
</template> </template>

@ -1,25 +1,23 @@
<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 = []
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
@ -37,7 +35,7 @@ function showModal() {
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); 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)
@ -94,14 +92,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.map((item) => {
if(!showKeys.includes(item)) { if (!showKeys.includes(item))
showKeys.push(item); showKeys.push(item)
} })
});
console.log('原始筛选条件showKeys', showKeys) console.log('原始筛选条件showKeys', showKeys)
console.log('原始筛选条件config customConfig', config, customConfig) console.log('原始筛选条件config customConfig', config, customConfig)
// for (const key of keys) { // for (const key of keys) {
@ -125,7 +122,7 @@ function generatList(config, customConfig) {
// isChecked && selectIds.value.push(key) // isChecked && selectIds.value.push(key)
// } // }
// } // }
Object.keys(asideMap).map(key => { Object.keys(asideMap).map((key) => {
const name = asideMap[key]?.label const name = asideMap[key]?.label
const isDefaultFilter = asideMap[key]?.isDefaultFilter const isDefaultFilter = asideMap[key]?.isDefaultFilter
@ -173,7 +170,7 @@ function generatList(config, customConfig) {
const sortKeyList: any = [] const sortKeyList: any = []
finalStore.getFilterConfig.map((item: any) => { finalStore.getFilterConfig.map((item: any) => {
console.log("tFilterConfig item000000000000000", item); console.log('tFilterConfig item000000000000000', item)
sortKeyList.push(item.id) sortKeyList.push(item.id)
}) })
console.log('原始筛选条件sortKeyList', sortKeyList) console.log('原始筛选条件sortKeyList', sortKeyList)
@ -182,17 +179,15 @@ function generatList(config, customConfig) {
if (sortKeyList.length > 0) { if (sortKeyList.length > 0) {
sortKeyList.map((key) => { sortKeyList.map((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.map((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('原始筛选条件showList', sortList)
@ -240,9 +235,8 @@ async function handleSumbit(e: MouseEvent) {
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)
if(tempItem) { if (tempItem)
sortList.push(tempItem) sortList.push(tempItem)
}
}) })
console.log('finalStore.sortList提交---------------', sortList) console.log('finalStore.sortList提交---------------', sortList)
// setTimeout(() => { // setTimeout(() => {

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { import {
computed,
defineOptions, defineOptions,
h, h,
nextTick, nextTick,
@ -8,97 +9,98 @@ 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 SvgIcon from '@/components/Icon/SvgIcon.vue'
import { useModal, NButton } from "naive-ui"; defineOptions({ name: 'FilterModal' })
const modal = useModal();
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
}>(); }>()
const modal = useModal()
const show = ref(false); const show = ref(false)
const checkedRowKeys = ref([]); const checkedRowKeys = ref([])
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 +108,222 @@ 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) { switch (key) {
case 1: case 1:
editSelection(id); editSelection(id)
break; break
case 2: 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; break
default: default:
break; 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 el: HTMLDivElement = tableRef.value?.$el
const tbody: HTMLElement | null = el.querySelector("tbody.n-data-table-tbody")!; const tbody: HTMLElement | null = el.querySelector('tbody.n-data-table-tbody')!
if (tbody) sortTable = Sortable.create(tbody, { onEnd, onMove }); 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
}); })
</script> </script>
<template> <template>
@ -331,9 +335,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 +356,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 +369,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 +406,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="closeModal">
<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,188 +1,192 @@
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, unref } from "vue"; import { reactive, ref, unref } from 'vue'
import * as XLSX from "xlsx"; import * as XLSX from 'xlsx'
import { arrayEquals } from "@/utils/index"; import { arrayEquals } from '@/utils/index'
import { generateUuid } from "@/utils/uuid"; import { generateUuid } from '@/utils/uuid'
const props = defineProps<{ const props = defineProps<{
onSuccess: Function; onSuccess: Function
headerConfig: string[]; headerConfig: string[]
}>(); }>()
interface ExcelData { interface ExcelData {
header: string[] | null; header: string[] | null
content: any[] | null; content: any[] | null
} }
interface ParseResults { interface ParseResults {
fileName: string; fileName: string
results: any[]; results: any[]
uuid: string; uuid: string
} }
const cardStyle = { const cardStyle = {
width: "620px", 'width': '620px',
"--n-padding-bottom": "10px", '--n-padding-bottom': '10px',
"--n-padding-left": "0px", '--n-padding-left': '0px',
}; }
const inputRef = ref(null); const inputRef = ref(null)
let loading = false; let loading = false
const excelData: ExcelData = { header: null, content: null }; const excelData: ExcelData = { header: null, content: null }
const excelDatas: ParseResults[] = reactive([]); const excelDatas: ParseResults[] = reactive([])
function generateData(content) { function generateData(content) {
excelData.header = props.headerConfig; excelData.header = props.headerConfig
excelData.content = content; excelData.content = content
props.onSuccess && props.onSuccess(excelData); props.onSuccess && props.onSuccess(excelData)
} }
function handleDrop(e) { function handleDrop(e) {
e.stopPropagation(); e.stopPropagation()
e.preventDefault(); e.preventDefault()
if (loading) return; if (loading)
const files = e.dataTransfer.files; return
const rawFiles = Array.from(files); const files = e.dataTransfer.files
const rawFiles = Array.from(files)
// eslint-disable-next-line dot-notation // eslint-disable-next-line dot-notation
const $message = window["$message"]; const $message = window['$message']
if (!isExcel(rawFiles)) { if (!isExcel(rawFiles)) {
$message.error("Only supports upload .xlsx, .xls, .csv suffix files"); $message.error('Only supports upload .xlsx, .xls, .csv suffix files')
return false; return false
} }
uploadFiles(rawFiles); uploadFiles(rawFiles)
e.stopPropagation(); e.stopPropagation()
e.preventDefault(); e.preventDefault()
} }
async function uploadFiles(files) { async function uploadFiles(files) {
const inputEl: HTMLInputElement | null = unref(inputRef); const inputEl: HTMLInputElement | null = unref(inputRef)
inputEl!.value = ""; inputEl!.value = ''
loading = true; loading = true
for (const file of files) { for (const file of files) {
const fileData = await readFileData(file); const fileData = await readFileData(file)
const message = validate(fileData); const message = validate(fileData)
// TODO // TODO
if (message === undefined || true) { if (message === undefined || true) {
const uuid = generateUuid(); const uuid = generateUuid()
excelDatas.push({ excelDatas.push({
fileName: file.name, fileName: file.name,
results: (fileData as any).results, results: (fileData as any).results,
uuid, uuid,
}); })
} }
} }
loading = false; loading = false
} }
function commitData() { function commitData() {
const mergeResults: any[] = []; const mergeResults: any[] = []
if (excelDatas.length === 0) return; if (excelDatas.length === 0)
return
excelDatas.forEach((item) => { excelDatas.forEach((item) => {
mergeResults.push(...item.results); mergeResults.push(...item.results)
}); })
generateData(mergeResults); generateData(mergeResults)
} }
function validate(fileData) { function validate(fileData) {
const { header } = fileData; const { header } = fileData
// //
const equal = arrayEquals(header, props.headerConfig); const equal = arrayEquals(header, props.headerConfig)
if (!equal) return "表头不匹配"; if (!equal)
return '表头不匹配'
// TODO // TODO
} }
function readFileData(file) { function readFileData(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader()
reader.onload = (e) => { reader.onload = (e) => {
const data = e.target!.result; const data = e.target!.result
const workbook = XLSX.read(data, { type: "array" }); const workbook = XLSX.read(data, { type: 'array' })
const firstSheetName = workbook.SheetNames[0]; const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]; const worksheet = workbook.Sheets[firstSheetName]
const header = getHeaderRow(worksheet); const header = getHeaderRow(worksheet)
const results = XLSX.utils.sheet_to_json(worksheet); const results = XLSX.utils.sheet_to_json(worksheet)
resolve({ header, results }); resolve({ header, results })
}; }
reader.readAsArrayBuffer(file); reader.readAsArrayBuffer(file)
}); })
} }
function handleDragover(e) { function handleDragover(e) {
e.stopPropagation(); e.stopPropagation()
e.preventDefault(); e.preventDefault()
e.dataTransfer.dropEffect = "copy"; e.dataTransfer.dropEffect = 'copy'
} }
function handleUpload() { function handleUpload() {
(inputRef.value as any).click(); (inputRef.value as any).click()
} }
function handleClick(e) { function handleClick(e) {
const files = e.target.files; const files = e.target.files
const rawFiles = Array.from(files); const rawFiles = Array.from(files)
uploadFiles(rawFiles); uploadFiles(rawFiles)
} }
function getHeaderRow(sheet) { function getHeaderRow(sheet) {
const headers: string[] = []; const headers: string[] = []
const range = XLSX.utils.decode_range(sheet["!ref"]); const range = XLSX.utils.decode_range(sheet['!ref'])
let C; let C
const R = range.s.r; const R = range.s.r
/* start in the first row */ /* start in the first row */
for (C = range.s.c; C <= range.e.c; ++C) { for (C = range.s.c; C <= range.e.c; ++C) {
/* walk every column in the range */ /* walk every column in the range */
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]; const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
/* find the cell in the first row */ /* find the cell in the first row */
let hdr = `UNKNOWN ${C}`; // <-- replace with your desired default let hdr = `UNKNOWN ${C}` // <-- replace with your desired default
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell); if (cell && cell.t)
headers.push(hdr); hdr = XLSX.utils.format_cell(cell)
headers.push(hdr)
} }
return headers; return headers
} }
function isExcel(files) { function isExcel(files) {
return files.every((file) => { return files.every((file) => {
return /\.(xlsx|xls|csv)$/.test(file.name); return /\.(xlsx|xls|csv)$/.test(file.name)
}); })
} }
const show = ref(false); const show = ref(false)
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
e.preventDefault(); e.preventDefault()
commitData(); commitData()
closeModal(); closeModal()
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
function removeHandler(id: string) { function removeHandler(id: string) {
const index = excelDatas.findIndex((item) => item.uuid === id); const index = excelDatas.findIndex(item => item.uuid === id)
excelDatas.splice(index, 1); excelDatas.splice(index, 1)
} }
function afterLeave() { function afterLeave() {
excelDatas.length = 0; excelDatas.length = 0
} }
</script> </script>
@ -218,7 +222,7 @@ function afterLeave() {
type="file" type="file"
accept=".xlsx, .xls,.csv" accept=".xlsx, .xls,.csv"
@change="handleClick" @change="handleClick"
/> >
<SvgIcon <SvgIcon
style="margin-top: 32px; margin-bottom: 13px" style="margin-top: 32px; margin-bottom: 13px"
size="45" size="45"
@ -226,9 +230,7 @@ function afterLeave() {
@click="handleUpload" @click="handleUpload"
/> />
<span class="wrapper-tip1">点击或拖拽审批文件到这里上传</span> <span class="wrapper-tip1">点击或拖拽审批文件到这里上传</span>
<span style="margin-top: 3px; margin-bottom: 19px" class="wrapper-tip2" <span style="margin-top: 3px; margin-bottom: 19px" class="wrapper-tip2">支持上传格式.xls .xlsx .csv的文件</span>
>支持上传格式.xls .xlsx .csv的文件</span
>
</div> </div>
<div <div
v-for="(item, index) in excelDatas" v-for="(item, index) in excelDatas"
@ -249,7 +251,9 @@ function afterLeave() {
</div> </div>
<template #footer> <template #footer>
<div class="footer"> <div class="footer">
<n-button type="info" @click="handleSumbit"> </n-button> <n-button type="info" @click="handleSumbit">
确认
</n-button>
</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,8 +287,7 @@ 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">
@ -296,14 +296,14 @@ defineExpose({
<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 +316,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 +338,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!)"
@ -364,7 +364,9 @@ defineExpose({
</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>

@ -78,11 +78,11 @@ onBeforeMount(async () => {
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>处理方式</span> <span>处理方式</span>
<n-select filterable v-model:value="selectBackId" style="margin-top: 10px;" :options="backOptions" /> <n-select v-model:value="selectBackId" filterable style="margin-top: 10px;" :options="backOptions" />
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>不通过原因</span> <span>不通过原因</span>
<n-select filterable v-model:value="selectRejectId" style="margin-top: 10px;" :options="reasonOptions" /> <n-select v-model:value="selectRejectId" filterable style="margin-top: 10px;" :options="reasonOptions" />
<n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" /> <n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" />
</div> </div>
</div> </div>

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import console from 'node:console'
import type { DataTableColumns, DataTableRowKey, PaginationProps } from 'naive-ui' import type { DataTableColumns, DataTableRowKey, PaginationProps } from 'naive-ui'
import { NButton, NDataTable, useDialog, useMessage } from 'naive-ui' import { NButton, NDataTable, useDialog, useMessage } from 'naive-ui'
import { import {
@ -41,9 +42,6 @@ import emitter from '@/utils/mitt'
import { formatToDateHMS } from '@/utils/dateUtil' import { formatToDateHMS } from '@/utils/dateUtil'
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter' import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import DataHeader from '@/components/DataHeader/index.vue' import DataHeader from '@/components/DataHeader/index.vue'
import console from 'console'
const emit = defineEmits(['changeShow']) const emit = defineEmits(['changeShow'])
function changeContent() { function changeContent() {
@ -861,9 +859,9 @@ async function refreshHandler(searchId?: any) {
function filterTableData(keyword) { function filterTableData(keyword) {
pagination.page = 1 pagination.page = 1
pagination.pageSize = 10 pagination.pageSize = 10
if (keyword) { if (keyword)
query(pagination.page, pagination.pageSize, '', keyword) query(pagination.page, pagination.pageSize, '', keyword)
} else { query(pagination.page, pagination.pageSize) } else query(pagination.page, pagination.pageSize)
} }
defineExpose({ defineExpose({
@ -898,14 +896,18 @@ defineExpose({
取消 取消
</NButton> </NButton>
<img class="btn-approval btn-left" src="@/assets/images/task/btn-not-pass.png" alt="" <img
@click.stop="batchReject"> class="btn-approval btn-left" src="@/assets/images/task/btn-not-pass.png" alt=""
@click.stop="batchReject"
>
<SvgIcon size="24" name="vs" /> <SvgIcon size="24" name="vs" />
<img class="btn-approval" src="@/assets/images/task/btn-pass.png" alt="" @click.stop="batchApproval"> <img class="btn-approval" src="@/assets/images/task/btn-pass.png" alt="" @click.stop="batchApproval">
</div> </div>
<n-popover ref="popover" :style="{ padding: '0px' }" style="width: 148px" :show-arrow="false" <n-popover
placement="bottom-start" trigger="click"> ref="popover" :style="{ padding: '0px' }" style="width: 148px" :show-arrow="false"
placement="bottom-start" trigger="click"
>
<template #trigger> <template #trigger>
<div class="icon-wrap"> <div class="icon-wrap">
<SvgIcon size="20" name="more-blue" /> <SvgIcon size="20" name="more-blue" />
@ -948,10 +950,12 @@ defineExpose({
<SvgIcon style="cursor: pointer" size="18" name="column" @click="showModal(customTabelRef)" /> <SvgIcon style="cursor: pointer" size="18" name="column" @click="showModal(customTabelRef)" />
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<NDataTable id="table" ref="tableRef" v-model:checked-row-keys="checkedRowKeys" remote :columns="columnsRef" <NDataTable
id="table" ref="tableRef" v-model:checked-row-keys="checkedRowKeys" remote :columns="columnsRef"
:scroll-x="scrollX" :max-height="maxHeight" :data="tableData" :loading="loading" :pagination="pagination" :scroll-x="scrollX" :max-height="maxHeight" :data="tableData" :loading="loading" :pagination="pagination"
:row-key="rowKey" @update:page="handlePageChange" @update-page-size="handlePageSizeChange" :row-key="rowKey" @update:page="handlePageChange" @update-page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck" @update:sorter="handleSorterChange" /> @update:checked-row-keys="handleCheck" @update:sorter="handleSorterChange"
/>
</div> </div>
<CustomTabelModal ref="customTabelRef" @commit="commitHandler" /> <CustomTabelModal ref="customTabelRef" @commit="commitHandler" />

@ -1,36 +1,36 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from "vue"; import { onMounted, ref } from 'vue'
import testImg from "@/assets/images/test.png";
import { chunk } from 'lodash-es' import { chunk } from 'lodash-es'
import testImg from '@/assets/images/test.png'
const emit = defineEmits(["changeShow"]); const emit = defineEmits(['changeShow'])
function changeContent() { function changeContent() {
emit("changeShow"); emit('changeShow')
}
function initRem() {
const designWidth = 1440
const rempPx = 16
const scale = window.innerWidth / designWidth
document.documentElement.style.fontSize = `${scale * rempPx}px`
} }
const initRem = () => {
const designWidth = 1440;
const rempPx = 16;
const scale = window.innerWidth / designWidth;
document.documentElement.style.fontSize = scale * rempPx + "px";
};
onMounted(() => { onMounted(() => {
initRem(); initRem()
}); })
const item = { const item = {
img: testImg, img: testImg,
checked: false, checked: false,
title: "YP4567890545", title: 'YP4567890545',
date: "2023-12-19 12:09:18", date: '2023-12-19 12:09:18',
}; }
const data = ref<any[]>([]); const data = ref<any[]>([])
onMounted(() => { onMounted(() => {
for (let i = 0; i < 8; i++) { for (let i = 0; i < 8; i++)
data.value.push(item as any); data.value.push(item as any)
}
data.value = chunk(data.value, 4) data.value = chunk(data.value, 4)
}); })
</script> </script>
<template> <template>
@ -48,11 +48,11 @@ onMounted(() => {
</div> </div>
<div class="header_data"> <div class="header_data">
<DataHeader :hasColor="true" /> <DataHeader :has-color="true" />
</div> </div>
<div class="data_wrapper" v-for="(sitem,sindex) in data" :key="sindex"> <div v-for="(sitem, sindex) in data" :key="sindex" class="data_wrapper">
<div class="item" v-for="(item, index) in sitem" :key="index"> <div v-for="(item, index) in sitem" :key="index" class="item">
<div class="top"> <div class="top">
<div <div
class="img" class="img"
@ -61,13 +61,17 @@ onMounted(() => {
<!-- <div class="check_box"><n-checkbox size="medium" label=" " /></div> --> <!-- <div class="check_box"><n-checkbox size="medium" label=" " /></div> -->
</div> </div>
<div class="content"> <div class="content">
<div class="title">任务ID{{ item.title }}</div> <div class="title">
<div class="date">{{ item.date }}</div> 任务ID{{ item.title }}
</div>
<div class="date">
{{ item.date }}
</div>
<div class="tag_box"> <div class="tag_box">
<div <div
class="tag_item"
v-for="index in 2" v-for="index in 2"
:key="index" :key="index"
class="tag_item"
:style="index == 2 ? 'color:#02C984' : 'color:#507AFD'" :style="index == 2 ? 'color:#02C984' : 'color:#507AFD'"
> >
{{ index == 1 ? "待确认" : "张思" }} {{ index == 1 ? "待确认" : "张思" }}
@ -76,8 +80,12 @@ onMounted(() => {
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="resovle_action">通过</div> <div class="resovle_action">
<div class="reject_action">不通过</div> 通过
</div>
<div class="reject_action">
不通过
</div>
</div> </div>
</div> </div>
</div> </div>

@ -5,7 +5,6 @@ import Content from './content/Content.vue'
import ListContent from './content/ListContent.vue' import ListContent from './content/ListContent.vue'
import Robot from '@/components/Robot/index.vue' import Robot from '@/components/Robot/index.vue'
defineOptions({ defineOptions({
name: 'FinalMain', name: 'FinalMain',
}) })

@ -10,110 +10,111 @@ import {
shallowRef, shallowRef,
unref, unref,
watch, watch,
} from "vue"; } from 'vue'
import { CustomFilterModalVue, FilterModalVue, NewFilterModalVue } from "./comp/modals"; import dayjs from 'dayjs'
import Search from "./comp/Search.vue"; import { cloneDeep, isEqual } from 'lodash-es'
import AdvanceFilter from "./comp/AdvanceFilter.vue"; import { CustomFilterModalVue, FilterModalVue, NewFilterModalVue } from './comp/modals'
import { getViewportOffset } from "@/utils/domUtils"; import Search from './comp/Search.vue'
import { useWindowSizeFn } from "@/hooks/event/useWindowSizeFn"; import AdvanceFilter from './comp/AdvanceFilter.vue'
import { useConfig } from "@/store/modules/asideConfig"; import { getViewportOffset } from '@/utils/domUtils'
import type { Filter } from "/#/home"; import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
import type { AsideEntity } from "@/config/aside"; import { useConfig } from '@/store/modules/asideConfig'
import { asideMap } from "@/config/aside"; import type { Filter } from '/#/home'
import type { AsideConfig } from "/#/api"; import type { AsideEntity } from '@/config/aside'
import emitter from "@/utils/mitt"; import { asideMap } from '@/config/aside'
import { getFilterList } from "@/api/home/main"; import type { AsideConfig } from '/#/api'
import dayjs from "dayjs"; import emitter from '@/utils/mitt'
import { cloneDeep, isEqual } from "lodash-es"; import { getFilterList } from '@/api/home/main'
const configStore = useConfig(); const configStore = useConfig()
// //
let asideValue: Record<keyof typeof asideMap, any> = reactive({}); const asideValue: Record<keyof typeof asideMap, any> = reactive({})
// : // :
const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({}); const asideVisible: Partial<Record<keyof AsideConfig, boolean>> = reactive({})
// //
const showItems = shallowRef<{ key: string; config: AsideEntity }[]>([]); const showItems = shallowRef<{ key: string, config: AsideEntity }[]>([])
Object.keys(asideMap).forEach((key) => { Object.keys(asideMap).forEach((key) => {
const entity = asideMap[key]; const entity = asideMap[key]
const { defaultValue } = entity; const { defaultValue } = entity
asideValue[key] = defaultValue; asideValue[key] = defaultValue
}); })
const filterModalRef: any = ref(null); const filterModalRef: any = ref(null)
const newFilterModalRef = ref(null); const newFilterModalRef = ref(null)
const customModalRef = ref(null); const customModalRef = ref(null)
const customObjRef = ref<any>(null); // const customObjRef = ref<any>(null) //
const customTempObjRef = ref<any>(null); // () const customTempObjRef = ref<any>(null) // ()
const configFilterRef = ref<any>([]); // const configFilterRef = ref<any>([]) //
const AdvanceFilterRef: any = ref(null); const AdvanceFilterRef: any = ref(null)
function showModal(modalRef: any) { function showModal(modalRef: any) {
const modal = unref(modalRef)! as any; const modal = unref(modalRef)! as any
modal.showModal(); modal.showModal()
} }
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
computeSlideHeight(); computeSlideHeight()
let tempAsideValue = cloneDeep(asideValue); const tempAsideValue = cloneDeep(asideValue)
// configStore.setAsideValue(tempAsideValue); // configStore.setAsideValue(tempAsideValue);
console.log("asideMap和asideValue", tempAsideValue); console.log('asideMap和asideValue', tempAsideValue)
}); })
}); })
const collapse = ref(false); const collapse = ref(false)
const mousetrap = inject("mousetrap") as any; const mousetrap = inject('mousetrap') as any
mousetrap.bind("[", collapseHandler); mousetrap.bind('[', collapseHandler)
function collapseHandler() { function collapseHandler() {
collapse.value = !collapse.value; collapse.value = !collapse.value
} }
const asideWidth = computed(() => { const asideWidth = computed(() => {
return collapse.value ? 0 : 308; return collapse.value ? 0 : 308
}); })
const asideHeight = ref(500); const asideHeight = ref(500)
const asideStyle = computed(() => { const asideStyle = computed(() => {
return { return {
width: `${asideWidth.value}px`, width: `${asideWidth.value}px`,
height: `${asideHeight.value}px`, height: `${asideHeight.value}px`,
}; }
}); })
const collapseIcon = computed(() => { const collapseIcon = computed(() => {
return collapse.value ? "expand-cir" : "collapse-cir"; return collapse.value ? 'expand-cir' : 'collapse-cir'
}); })
function computeSlideHeight() { function computeSlideHeight() {
const headEl = document.querySelector(".aside-header")!; const headEl = document.querySelector('.aside-header')!
const { bottomIncludeBody } = getViewportOffset(headEl); const { bottomIncludeBody } = getViewportOffset(headEl)
const height = bottomIncludeBody; const height = bottomIncludeBody
asideHeight.value = height - 24; asideHeight.value = height - 24
} }
useWindowSizeFn(computeSlideHeight, 280); useWindowSizeFn(computeSlideHeight, 280)
onBeforeMount(async () => { onBeforeMount(async () => {
configStore.fetchConfig(); configStore.fetchConfig()
configStore.fetchCustomConfig(); configStore.fetchCustomConfig()
}); })
nextTick(() => { nextTick(() => {
configStore.$subscribe(() => { configStore.$subscribe(() => {
const config = configStore.getConfig; const config = configStore.getConfig
const customConfig = configStore.getCustomConfig; const customConfig = configStore.getCustomConfig
if ( if (
configFilterRef.value.length > 0 && configFilterRef.value.length > 0
isEqual(configFilterRef.value, configStore.getFilterConfig) && && isEqual(configFilterRef.value, configStore.getFilterConfig)
customObjRef.value && && customObjRef.value
isEqual(customObjRef.value, customTempObjRef.value) && isEqual(customObjRef.value, customTempObjRef.value)
) { )
return; return
}
if (config == null || customConfig == null) return; if (config == null || customConfig == null)
return
// console.log("config", config, "customConfig", customConfig); // console.log("config", config, "customConfig", customConfig);
/* rao /* rao
const showKeys = [...customConfig].filter(key => !asideMap[key].isDefaultFilter)// customConfig isDefaultFilter const showKeys = [...customConfig].filter(key => !asideMap[key].isDefaultFilter)// customConfig isDefaultFilter
@ -121,152 +122,156 @@ nextTick(()=>{
showKeys.unshift(...defaultKeys) showKeys.unshift(...defaultKeys)
*/ */
let sortKeyList: any = []; const sortKeyList: any = []
configStore.getFilterConfig.map((item: any) => { configStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item?.id); sortKeyList.push(item?.id)
}); })
const showKeys = [...sortKeyList]; const showKeys = [...sortKeyList]
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) {
// //
Object.keys(customObjRef.value).map((key) => { Object.keys(customObjRef.value).map((key) => {
if (asideMap.hasOwnProperty(key)) { if (asideMap.hasOwnProperty(key)) {
const str = key.toLowerCase(); const str = key.toLowerCase()
// console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]); // console.log("customObjRef.value[str]1111111111111", customObjRef.value[str]);
if (str == "izsimilarity") { if (str == 'izsimilarity') {
if (typeof customObjRef.value[str] == "string") { if (typeof customObjRef.value[str] == 'string')
customObjRef.value[str] = customObjRef.value[str].split(","); customObjRef.value[str] = customObjRef.value[str].split(',')
}
asideValue[key] = customObjRef.value[str]; // asideValue[key] = customObjRef.value[str] //
console.log("相似度2222222222", asideValue[key]); console.log('相似度2222222222', asideValue[key])
} else if (str == "izyear") { }
if (typeof customObjRef.value[str] == "string") { else if (str == 'izyear') {
let time = customObjRef.value[str].split("-"); if (typeof customObjRef.value[str] == 'string') {
time[0] = new Date(time[0]).getTime(); const time = customObjRef.value[str].split('-')
time[1] = new Date(time[1]).getTime(); time[0] = new Date(time[0]).getTime()
customObjRef.value[str] = time; time[1] = new Date(time[1]).getTime()
} customObjRef.value[str] = time
asideValue[key] = customObjRef.value[str]; // }
console.log("时间2222222222", asideValue[key]); asideValue[key] = customObjRef.value[str] //
} else if (str != "izsimilarity" && str != "izyear" && customObjRef.value[str]) { console.log('时间2222222222', asideValue[key])
console.log("customObjRef.value[str]222222", customObjRef.value[str]); }
else if (str != 'izsimilarity' && str != 'izyear' && customObjRef.value[str]) {
console.log('customObjRef.value[str]222222', customObjRef.value[str])
// let list = customObjRef.value[str].split(','); // let list = customObjRef.value[str].split(',');
// console.log("list222222", list); // console.log("list222222", list);
asideValue[key] = customObjRef.value[str]; // asideValue[key] = customObjRef.value[str] //
} else { }
asideValue[key] = null; else {
asideValue[key] = null
} }
// asideMap[str].defaultValue = customObjRef.value[str];// // asideMap[str].defaultValue = customObjRef.value[str];//
} }
}); })
customTempObjRef.value = customObjRef.value; customTempObjRef.value = customObjRef.value
console.log("asideValue直接处理后的结果", asideValue); console.log('asideValue直接处理后的结果', asideValue)
console.log("customTempObjRef.value", customTempObjRef.value); console.log('customTempObjRef.value', customTempObjRef.value)
let tempobj = cloneDeep(asideValue); const tempobj = cloneDeep(asideValue)
console.log("tempObj", tempobj); console.log('tempObj', tempobj)
configStore.setAsideValue(tempobj); configStore.setAsideValue(tempobj)
} }
// console.log("showKeys", showKeys); // console.log("showKeys", showKeys);
const items = showKeys.reduce((acc, key) => { const items = showKeys.reduce((acc, key) => {
const currentData = asideMap[key]; const currentData = asideMap[key]
const render = currentData?.render; const render = currentData?.render
if (render !== false) { if (render !== false) {
const str = key?.toLowerCase(); const str = key?.toLowerCase()
const o = { const o = {
key: str, key: str,
config: asideMap[str], config: asideMap[str],
};
return [...acc, o];
} else {
return acc;
} }
}, []); return [...acc, o]
console.log("showItems=================================", items); }
showItems.value = items; else {
configFilterRef.value = configStore.getFilterConfig; return acc
}); }
}, [])
console.log('showItems=================================', items)
showItems.value = items
configFilterRef.value = configStore.getFilterConfig
})
}) })
const asideEnter = ref(false); const asideEnter = ref(false)
const showCollapse = computed(() => { const showCollapse = computed(() => {
return collapse.value ? true : asideEnter.value; return collapse.value ? true : asideEnter.value
}); })
const showSearch = ref(false); const showSearch = ref(false)
function setShowSearch(value: boolean) { function setShowSearch(value: boolean) {
showSearch.value = value; showSearch.value = value
} }
const newFilterOk = () => { 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()
}; }
// key // key
function scrollHandler(key: string) { function scrollHandler(key: string) {
const element = document.querySelector(`#${key}`); const element = document.querySelector(`#${key}`)
element?.scrollIntoView(true); element?.scrollIntoView(true)
} }
// -> // ->
async function filterHandler(searchId: string) { async function filterHandler(searchId: string) {
// emitter.emit('filter', searchId) // emitter.emit('filter', searchId)
const res = await getFilterList({ userSearchId: searchId }); const res = await getFilterList({ userSearchId: searchId })
// console.log("", res); // console.log("", res);
if (res.code == "OK") { if (res.code == 'OK') {
let obj = res.data; const obj = res.data
customObjRef.value = res.data; customObjRef.value = res.data
let showKeys: any[] = []; const showKeys: any[] = []
Object.keys(obj).map((key) => { Object.keys(obj).map((key) => {
if (asideMap.hasOwnProperty(key)) { if (asideMap.hasOwnProperty(key))
showKeys.push(key); showKeys.push(key)
} })
});
// console.log(showKeys); // console.log(showKeys);
configStore.setCustomConfig(showKeys); configStore.setCustomConfig(showKeys)
} }
} }
function editFilter(filter: any) { function editFilter(filter: any) {
const modal = unref(newFilterModalRef)! as any; const modal = unref(newFilterModalRef)! as any
modal.showModal(); modal.showModal()
modal.edit(filter); modal.edit(filter)
} }
function updateComponent(key, e) { function updateComponent(key, e) {
console.log("跟新值", key, e); console.log('跟新值', key, e)
console.log("tempAsideValue跟新值", configStore.getAsideValue, asideValue); console.log('tempAsideValue跟新值', configStore.getAsideValue, asideValue)
// let tempAsideValue = configStore.getAsideValue || asideValue; // let tempAsideValue = configStore.getAsideValue || asideValue;
let tempobj = cloneDeep(asideValue); const tempobj = cloneDeep(asideValue)
console.log(tempobj, "tempobj"); console.log(tempobj, 'tempobj')
tempobj[key] = e; tempobj[key] = e
console.log(tempobj, "tempobj After"); console.log(tempobj, 'tempobj After')
customObjRef.value = tempobj; customObjRef.value = tempobj
// asideValue = Object.assign({}, asideValue, tempobj); // asideValue = Object.assign({}, asideValue, tempobj);
console.log("asideValue跟新值", tempobj); console.log('asideValue跟新值', tempobj)
configStore.setAsideValue(tempobj); configStore.setAsideValue(tempobj)
} }
const handleOk = (item: any) => { function handleOk(item: any) {
console.log("handleOk", item); console.log('handleOk', item)
if (item) { if (item) {
AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname); AdvanceFilterRef.value.setCurrentlySelectedAdvanced(item.searchname)
filterHandler(item.id); filterHandler(item.id)
} else { }
AdvanceFilterRef.value.setCurrentlySelectedAdvanced("高级筛选"); else {
filterHandler(""); AdvanceFilterRef.value.setCurrentlySelectedAdvanced('高级筛选')
filterHandler('')
}
} }
};
// watch(asideValue, (newVal) => { // watch(asideValue, (newVal) => {
// console.log("asideValue", newVal); // console.log("asideValue", newVal);
@ -297,12 +302,12 @@ const handleOk = (item: any) => {
<!-- 高级筛选 --> <!-- 高级筛选 -->
<AdvanceFilter <AdvanceFilter
v-show="!showSearch" v-show="!showSearch"
ref="AdvanceFilterRef"
:type="0" :type="0"
@select="filterHandler" @select="filterHandler"
@update:search="setShowSearch(true)" @update:search="setShowSearch(true)"
@show-custom="showModal(customModalRef)" @show-custom="showModal(customModalRef)"
@show-filter="showModal(filterModalRef)" @show-filter="showModal(filterModalRef)"
ref="AdvanceFilterRef"
/> />
</div> </div>
@ -321,10 +326,10 @@ const handleOk = (item: any) => {
ref="filterModalRef" ref="filterModalRef"
@edit-filter="editFilter" @edit-filter="editFilter"
@show-new-filter="showModal(newFilterModalRef)" @show-new-filter="showModal(newFilterModalRef)"
@handleOk="handleOk" @handle-ok="handleOk"
/> />
<!-- 新增过滤 --> <!-- 新增过滤 -->
<NewFilterModalVue ref="newFilterModalRef" @onOk="newFilterOk" /> <NewFilterModalVue ref="newFilterModalRef" @on-ok="newFilterOk" />
<!-- 筛选 --> <!-- 筛选 -->
<CustomFilterModalVue ref="customModalRef" /> <CustomFilterModalVue ref="customModalRef" />
</n-scrollbar> </n-scrollbar>

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DropdownMixedOption } from "naive-ui/es/dropdown/src/interface"; import type { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface'
import type { PropType } from "vue"; import type { PropType } from 'vue'
defineOptions({ name: "Action" }); defineOptions({ name: 'Action' })
const props = defineProps({ const props = defineProps({
options: { options: {
@ -16,12 +16,12 @@ const props = defineProps({
}, },
id: { id: {
type: String, type: String,
default: "", default: '',
}, },
}); })
const fun = (key) => { function fun(key) {
props.select(key, props.id); props.select(key, props.id)
}; }
</script> </script>
<template> <template>

@ -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,75 @@ function generateDefaultConfig(): FilterEntity[] {
value: defaultValue, value: defaultValue,
}, },
], ],
};
return [...acc, config];
} else {
return acc;
} }
}, []); return [...acc, config]
}
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 +139,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.map((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.map((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.map((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 +286,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 +297,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 +306,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 +355,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 +393,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>

@ -1,16 +1,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, ref, watch } from 'vue' import { nextTick, onMounted, ref, watch } from 'vue'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { useRoute } from 'vue-router'
import { asideMap } from '@/config/aside' import { asideMap } from '@/config/aside'
import type { SearchEntity } from '/#/home' import type { SearchEntity } from '/#/home'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useRoute } from 'vue-router' import { useFinal } from '@/store/modules/final'
import { useFinal } from "@/store/modules/final";
const finalStore = useFinal();
const route = useRoute()
const searchContent = route.query.searchContent as string;
defineOptions({ name: 'Search' }) defineOptions({ name: 'Search' })
const emit = defineEmits<{ const emit = defineEmits<{
@ -20,13 +16,17 @@ const emit = defineEmits<{
(e: 'showSearch'): void (e: 'showSearch'): void
}>() }>()
const finalStore = useFinal()
const route = useRoute()
const searchContent = route.query.searchContent as string
const data = ref<SearchEntity[]>([]) const data = ref<SearchEntity[]>([])
const popover = ref<ComponentRef | null>(null) const popover = ref<ComponentRef | null>(null)
const configStore = useConfig() const configStore = useConfig()
const searchKeyword = ref('') const searchKeyword = ref('')
const inputHandler = debounce((keyword) => { const inputHandler = debounce((keyword) => {
searchKeyword.value = keyword; searchKeyword.value = keyword
emit('inputChange', keyword) emit('inputChange', keyword)
}, 300) }, 300)
@ -59,30 +59,25 @@ function selectHandler(item: SearchEntity) {
} }
// //
const searchName = () => { function searchName() {
configStore.setSearchValue(searchKeyword.value); configStore.setSearchValue(searchKeyword.value)
finalStore.setSearchValue(searchKeyword.value); finalStore.setSearchValue(searchKeyword.value)
emit('inputChange', searchKeyword.value); emit('inputChange', searchKeyword.value)
} }
function close() {
searchKeyword.value = ''
configStore.setSearchValue(searchKeyword.value)
const close = () => { finalStore.setSearchValue(searchKeyword.value)
searchKeyword.value = ""; emit('close')
configStore.setSearchValue(searchKeyword.value);
finalStore.setSearchValue(searchKeyword.value);
emit('close');
} }
function initSerach() {
const initSerach = () => {
if (searchContent) { if (searchContent) {
emit('showSearch') emit('showSearch')
const id_param = searchContent.match(/-\d+-/); const id_param = searchContent.match(/-\d+-/)
if (id_param) { if (id_param) {
searchKeyword.value = id_param[0].slice(1, -1); searchKeyword.value = id_param[0].slice(1, -1)
emit('inputChange', searchKeyword.value) emit('inputChange', searchKeyword.value)
} }
} }
@ -94,13 +89,17 @@ onMounted(() => {
<template> <template>
<div class="wrapper"> <div class="wrapper">
<n-popover ref="popover" :style="{ padding: '0px' }" style="width: 248px" :show-arrow="false" <n-popover
placement="bottom-start" trigger="focus"> ref="popover" :style="{ padding: '0px' }" style="width: 248px" :show-arrow="false"
placement="bottom-start" trigger="focus"
>
<template #trigger> <template #trigger>
<n-input v-model:value="searchKeyword" style="width: 260px;height: 32px;" placeholder="请输入你需要搜索的内容" <n-input
@input="inputHandler"> v-model:value="searchKeyword" style="width: 260px;height: 32px;" placeholder="请输入你需要搜索的内容"
@input="inputHandler"
>
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1" @click="searchName" style="cursor: pointer;" /> <SvgIcon size="14px" name="magnifying-1" style="cursor: pointer;" @click="searchName" />
</template> </template>
</n-input> </n-input>
</template> </template>

@ -1,11 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { upload } from '@/api/home/main'
import { hideDownload } from '@/utils/image'
import { getImgUrl } from '@/utils/urlUtils'
import { useElementHover } from '@vueuse/core' import { useElementHover } from '@vueuse/core'
import type { GlobalThemeOverrides, UploadCustomRequestOptions } from 'naive-ui' import type { GlobalThemeOverrides, UploadCustomRequestOptions } from 'naive-ui'
import { useThemeVars } from 'naive-ui' import { useThemeVars } from 'naive-ui'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { getImgUrl } from '@/utils/urlUtils'
import { hideDownload } from '@/utils/image'
import { upload } from '@/api/home/main'
const props = defineProps<{ const props = defineProps<{
value: string value: string
@ -15,13 +15,11 @@ const emit = defineEmits<{
(e: 'update:value', value: string): void (e: 'update:value', value: string): void
}>() }>()
const figureUrl = ref(props.value)
if (figureUrl.value && !figureUrl.value.includes('http'))
figureUrl.value = getImgUrl(figureUrl.value)
let figureUrl = ref(props.value) const uploadRef = ref(null)
if(figureUrl.value && figureUrl.value.indexOf('http') == -1) {
figureUrl.value = getImgUrl(figureUrl.value);
}
const uploadRef = ref(null);
async function customRequest(data: UploadCustomRequestOptions) { async function customRequest(data: UploadCustomRequestOptions) {
const result = await upload({ file: data.file.file as any }) const result = await upload({ file: data.file.file as any })
@ -66,34 +64,35 @@ const imageGroupThemeOverrides = computed(() => {
}) })
// //
const handleDragOver = (e) => { function handleDragOver(e) {
e.preventDefault(); // e.preventDefault() //
e.dataTransfer.dropEffect = 'copy'; // e.dataTransfer.dropEffect = 'copy' //
}; }
// //
const handleDragLeave = (e) => { function handleDragLeave(e) {
e.preventDefault(); // e.preventDefault() //
}; }
// //
const handleDrop = async (e) => { async function handleDrop(e) {
e.preventDefault(); // e.preventDefault() //
const files = e.dataTransfer.files; const files = e.dataTransfer.files
if (files[0]) { if (files[0]) {
const result = await upload({ file: files[0] as any }) const result = await upload({ file: files[0] as any })
const imgUrl = getImgUrl(result.data) const imgUrl = getImgUrl(result.data)
figureUrl.value = imgUrl figureUrl.value = imgUrl
emit('update:value', result.data) emit('update:value', result.data)
} }
}; }
</script> </script>
<template> <template>
<n-space> <n-space>
<n-upload ref="uploadRef" directory-dnd :show-file-list="false" accept=".png,.jpg,.bmp" <n-upload
:custom-request="customRequest" @dragover="handleDragOver" @dragleave="handleDragLeave" @drop="handleDrop"> ref="uploadRef" directory-dnd :show-file-list="false" accept=".png,.jpg,.bmp"
:custom-request="customRequest" @dragover="handleDragOver" @dragleave="handleDragLeave" @drop="handleDrop"
>
<n-upload-dragger class="wrapper"> <n-upload-dragger class="wrapper">
<div v-show="!showFigure" class="wrapper-dragger"> <div v-show="!showFigure" class="wrapper-dragger">
<SvgIcon size="30" name="upload" /> <SvgIcon size="30" name="upload" />
@ -101,8 +100,10 @@ const handleDrop = async (e) => {
<span class="wrapper-tip2">上传格式为.png .jpg .bmp 20M以内</span> <span class="wrapper-tip2">上传格式为.png .jpg .bmp 20M以内</span>
</div> </div>
<div v-show="showFigure" ref="figureRef" class="wrapper-figure"> <div v-show="showFigure" ref="figureRef" class="wrapper-figure">
<n-image ref="imageRef" :img-props="{ onClick: hideDownload }" :theme-overrides="imageGroupThemeOverrides" <n-image
width="288" height="116" :src="figureUrl" /> ref="imageRef" :img-props="{ onClick: hideDownload }" :theme-overrides="imageGroupThemeOverrides"
width="288" height="116" :src="figureUrl"
/>
<div v-show="figureHovered" class="wrapper-figure-tools"> <div v-show="figureHovered" class="wrapper-figure-tools">
<SvgIcon size="28" name="view" @click="previewHandler" /> <SvgIcon size="28" name="view" @click="previewHandler" />
<div class="wrapper-figure-line" /> <div class="wrapper-figure-line" />

@ -4,22 +4,6 @@ import type { FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izApprovalStatus'] && typeof asideValue['izApprovalStatus'] == "string") {
let list = asideValue['izApprovalStatus'].split(',');
formValue.value.plans = list;
console.log("formValue.value.izApprovalStatus", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -29,12 +13,29 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izApprovalStatus && typeof asideValue.izApprovalStatus == 'string') {
const list = asideValue.izApprovalStatus.split(',')
formValue.value.plans = list
console.log('formValue.value.izApprovalStatus', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -58,7 +59,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -66,8 +67,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择审核状态" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择审核状态" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,27 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izcustomlevel']) {
if(typeof asideValue['izcustomlevel'] == "string") {
let list = asideValue['izcustomlevel'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izcustomlevel'];
}
console.log("formValue.value.izcustomlevel", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -34,15 +13,38 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izcustomlevel) {
if (typeof asideValue.izcustomlevel == 'string') {
const list = asideValue.izcustomlevel.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izcustomlevel
}
console.log('formValue.value.izcustomlevel', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
console.log("formValue.value.izcustomlevel22222", formValue.value.plans); console.log('formValue.value.izcustomlevel22222', formValue.value.plans)
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -66,7 +68,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -74,8 +76,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户级别" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户级别" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izcustomname']) {
if(typeof asideValue['izcustomname'] == "string") {
let list = asideValue['izcustomname'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izcustomname'];
}
console.log("formValue.value.izcustomname", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izcustomname) {
if (typeof asideValue.izcustomname == 'string') {
const list = asideValue.izcustomname.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izcustomname
}
console.log('formValue.value.izcustomname', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -63,7 +65,7 @@ onBeforeMount(async () => {
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -71,8 +73,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户名称" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户名称" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izcustomtype']) {
if(typeof asideValue['izcustomtype'] == "string") {
let list = asideValue['izcustomtype'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izcustomtype'];
}
console.log("formValue.value.izcustomtype", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izcustomtype) {
if (typeof asideValue.izcustomtype == 'string') {
const list = asideValue.izcustomtype.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izcustomtype
}
console.log('formValue.value.izcustomtype', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户类型" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户类型" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izcustomtypes']) {
if(typeof asideValue['izcustomtypes'] == "string") {
let list = asideValue['izcustomtypes'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izcustomtypes'];
}
console.log("formValue.value.izcustomtypes", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izcustomtypes) {
if (typeof asideValue.izcustomtypes == 'string') {
const list = asideValue.izcustomtypes.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izcustomtypes
}
console.log('formValue.value.izcustomtypes', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择izcustomtype" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择izcustomtype" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izproductname']) {
if(typeof asideValue['izproductname'] == "string") {
let list = asideValue['izproductname'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izproductname'];
}
console.log("formValue.value.izproductname", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izproductname) {
if (typeof asideValue.izproductname == 'string') {
const list = asideValue.izproductname.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izproductname
}
console.log('formValue.value.izproductname', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择产品名称" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择产品名称" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -5,62 +5,66 @@ import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const configUseStore = useConfig() 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['izproject']) { if (asideValue.izproject) {
if(typeof asideValue['izproject'] == "string") { if (typeof asideValue.izproject == 'string') {
let list = asideValue['izproject'].split(','); const list = asideValue.izproject.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izproject'];
} }
console.log("formValue.value.izproject", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izproject
formValue.value.plans = [];
} }
}); console.log('formValue.value.izproject', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
let asideValue = finalStore.getAsideValue; const asideValue = finalStore.getAsideValue
if(asideValue && asideValue['izproject']) { if (asideValue && asideValue.izproject) {
if(typeof asideValue['izproject'] == "string") { if (typeof asideValue.izproject == 'string') {
let list = asideValue['izproject'].split(','); const list = asideValue.izproject.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izproject'];
} }
console.log("formValue.value.izproject", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izproject
formValue.value.plans = [];
} }
}); console.log('formValue.value.izproject', formValue.value.plans)
}
const props = defineProps<{ else {
value: string[] | null formValue.value.plans = []
label: string }
}>() })
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -76,7 +80,7 @@ const options = ref([])
const configStore = useDictionary() const configStore = useDictionary()
const labStyle = { const labStyle = {
fontWeight: 'bold', fontWeight: 'bold',
color: '#333333' color: '#333333',
} }
onBeforeMount(async () => { onBeforeMount(async () => {
@ -85,7 +89,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -93,8 +97,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择所属项目" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择所属项目" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -1,30 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeMount, onMounted, ref } from 'vue' import { onBeforeMount, onMounted, onUpdated, ref } from 'vue'
import type { FormItemRule, FormRules } from 'naive-ui' import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { onUpdated } from 'vue';
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izprojecttype']) {
if(typeof asideValue['izprojecttype'] == "string") {
let list = asideValue['izprojecttype'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izprojecttype'];
}
console.log("formValue.value.izprojecttype", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -34,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izprojecttype) {
if (typeof asideValue.izprojecttype == 'string') {
const list = asideValue.izprojecttype.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izprojecttype
}
console.log('formValue.value.izprojecttype', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -63,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -71,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访项目类别" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访项目类别" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izsearch']) {
if(typeof asideValue['izsearch'] == "string") {
let list = asideValue['izsearch'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izsearch'];
}
console.log("formValue.value.izsearch", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izsearch) {
if (typeof asideValue.izsearch == 'string') {
const list = asideValue.izsearch.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izsearch
}
console.log('formValue.value.izsearch', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择IzSearch" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择IzSearch" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izsearchmanager']) {
if(typeof asideValue['izsearchmanager'] == "string") {
let list = asideValue['izsearchmanager'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izsearchmanager'];
}
console.log("formValue.value.izsearchmanager", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izsearchmanager) {
if (typeof asideValue.izsearchmanager == 'string') {
const list = asideValue.izsearchmanager.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izsearchmanager
}
console.log('formValue.value.izsearchmanager', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择IzSearchManager" multiple :options="options" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择IzSearchManager" multiple :options="options"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izshow']) {
if(typeof asideValue['izshow'] == "string") {
let list = asideValue['izshow'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izshow'];
}
console.log("formValue.value.izshow", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izshow) {
if (typeof asideValue.izshow == 'string') {
const list = asideValue.izshow.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izshow
}
console.log('formValue.value.izshow', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择分类" multiple :options="options" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择分类" multiple :options="options"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -5,62 +5,66 @@ import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const configUseStore = useConfig() 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['izstatus']) { if (asideValue.izstatus) {
if(typeof asideValue['izstatus'] == "string") { if (typeof asideValue.izstatus == 'string') {
let list = asideValue['izstatus'].split(','); const list = asideValue.izstatus.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izstatus'];
} }
console.log("formValue.value.izstatus", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izstatus
formValue.value.plans = [];
} }
}); console.log('formValue.value.izstatus', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
let asideValue = finalStore.getAsideValue; const asideValue = finalStore.getAsideValue
if(asideValue && asideValue['izstatus']) { if (asideValue && asideValue.izstatus) {
if(typeof asideValue['izstatus'] == "string") { if (typeof asideValue.izstatus == 'string') {
let list = asideValue['izstatus'].split(','); const list = asideValue.izstatus.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izstatus'];
} }
console.log("formValue.value.izstatus", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izstatus
formValue.value.plans = [];
} }
}); console.log('formValue.value.izstatus', formValue.value.plans)
}
const props = defineProps<{ else {
value: string[] | null formValue.value.plans = []
label: string }
}>() })
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -84,7 +88,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -92,8 +96,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择审核状态" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择审核状态" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izvisitcity']) {
if(typeof asideValue['izvisitcity'] == "string") {
let list = asideValue['izvisitcity'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izvisitcity'];
}
console.log("formValue.value.izvisitcity", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izvisitcity) {
if (typeof asideValue.izvisitcity == 'string') {
const list = asideValue.izvisitcity.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izvisitcity
}
console.log('formValue.value.izvisitcity', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择发布地区" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择发布地区" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izfiled17']) {
if(typeof asideValue['izfiled17'] == "string") {
let list = asideValue['izfiled17'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izfiled17'];
}
console.log("formValue.value.izfiled17", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izfiled17) {
if (typeof asideValue.izfiled17 == 'string') {
const list = asideValue.izfiled17.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izfiled17
}
console.log('formValue.value.izfiled17', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访项目类别" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访项目类别" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izfiled2']) {
if(typeof asideValue['izfiled2'] == "string") {
let list = asideValue['izfiled2'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izfiled2'];
}
console.log("formValue.value.izfiled2", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izfiled2) {
if (typeof asideValue.izfiled2 == 'string') {
const list = asideValue.izfiled2.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izfiled2
}
console.log('formValue.value.izfiled2', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户类型" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户类型" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izfiled3']) {
if(typeof asideValue['izfiled3'] == "string") {
let list = asideValue['izfiled3'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izfiled3'];
}
console.log("formValue.value.izfiled3", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izfiled3) {
if (typeof asideValue.izfiled3 == 'string') {
const list = asideValue.izfiled3.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izfiled3
}
console.log('formValue.value.izfiled3', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户名称" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户名称" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izfiled6']) {
if(typeof asideValue['izfiled6'] == "string") {
let list = asideValue['izfiled6'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izfiled6'];
}
console.log("formValue.value.izfiled6", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izfiled6) {
if (typeof asideValue.izfiled6 == 'string') {
const list = asideValue.izfiled6.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izfiled6
}
console.log('formValue.value.izfiled6', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -68,7 +70,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -76,8 +78,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择拜访客户级别" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择拜访客户级别" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izfirm']) {
if(typeof asideValue['izfirm'] == "string") {
let list = asideValue['izfirm'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izfirm'];
}
console.log("formValue.value.izfirm", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izfirm) {
if (typeof asideValue.izfirm == 'string') {
const list = asideValue.izfirm.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izfirm
}
console.log('formValue.value.izfirm', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择厂商" multiple v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择厂商" multiple
:options="options" @update:value="onChange" :options="options" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -5,64 +5,67 @@ import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const configUseStore = useConfig() const configUseStore = useConfig()
configUseStore.$subscribe(() => { configUseStore.$subscribe(() => {
console.log("isLoadValue.value", isLoadValue.value, console.log('isLoadValue.value', isLoadValue.value, 'configUseStore.getAsideValue', configUseStore.getAsideValue)
"configUseStore.getAsideValue", configUseStore.getAsideValue);
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
let asideValue = configUseStore.getAsideValue; const asideValue = configUseStore.getAsideValue
if(asideValue['iztaskrrom']) { if (asideValue.iztaskrrom) {
if(typeof asideValue['iztaskrrom'] == "string") { if (typeof asideValue.iztaskrrom == 'string') {
let list = asideValue['iztaskrrom'].split(','); const list = asideValue.iztaskrrom.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['iztaskrrom'];
} }
console.log("formValue.value.iztaskrrom", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.iztaskrrom
formValue.value.plans = [];
} }
}); console.log('formValue.value.iztaskrrom', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
let asideValue = finalStore.getAsideValue; const asideValue = finalStore.getAsideValue
if(asideValue && asideValue['iztaskrrom']) { if (asideValue && asideValue.iztaskrrom) {
if(typeof asideValue['iztaskrrom'] == "string") { if (typeof asideValue.iztaskrrom == 'string') {
let list = asideValue['iztaskrrom'].split(','); const list = asideValue.iztaskrrom.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['iztaskrrom'];
} }
console.log("formValue.value.iztaskrrom", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.iztaskrrom
formValue.value.plans = [];
} }
}); console.log('formValue.value.iztaskrrom', formValue.value.plans)
}
const props = defineProps<{ else {
value: string[] | null formValue.value.plans = []
label: string }
}>() })
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -86,7 +89,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -94,8 +97,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择任务来源" multiple :options="options" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择任务来源" multiple :options="options"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['iztaskstatus']) {
if(typeof asideValue['iztaskstatus'] == "string") {
let list = asideValue['iztaskstatus'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['iztaskstatus'];
}
console.log("formValue.value.iztaskstatus", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.iztaskstatus) {
if (typeof asideValue.iztaskstatus == 'string') {
const list = asideValue.iztaskstatus.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.iztaskstatus
}
console.log('formValue.value.iztaskstatus', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择任务状态" multiple :options="options" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择任务状态" multiple :options="options"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -4,26 +4,6 @@ import type { FormItemRule, FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary' import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if(isLoadValue.value) {
isLoadValue.value = false;
return
}
let asideValue = configUseStore.getAsideValue;
if(asideValue['izvisitpro']) {
if(typeof asideValue['izvisitpro'] == "string") {
let list = asideValue['izvisitpro'].split(',');
formValue.value.plans = list;
}else {
formValue.value.plans = asideValue['izvisitpro'];
}
console.log("formValue.value.izvisitpro", formValue.value.plans);
}else {
formValue.value.plans = [];
}
});
const props = defineProps<{ const props = defineProps<{
value: string[] | null value: string[] | null
label: string label: string
@ -33,12 +13,34 @@ const emit = defineEmits<{
(e: 'update:value', value: string[]): void (e: 'update:value', value: string[]): void
}>() }>()
const configUseStore = useConfig()
configUseStore.$subscribe(() => {
if (isLoadValue.value) {
isLoadValue.value = false
return
}
const asideValue = configUseStore.getAsideValue
if (asideValue.izvisitpro) {
if (typeof asideValue.izvisitpro == 'string') {
const list = asideValue.izvisitpro.split(',')
formValue.value.plans = list
}
else {
formValue.value.plans = asideValue.izvisitpro
}
console.log('formValue.value.izvisitpro', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const formValue = ref({ const formValue = ref({
plans: props.value, plans: props.value,
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -62,7 +64,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -70,8 +72,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择省份" multiple :options="options" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择省份" multiple :options="options"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -2,8 +2,6 @@
import { ref } from 'vue' import { ref } from 'vue'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
const configStore = useConfig()
const props = defineProps({ const props = defineProps({
value: { value: {
type: Boolean, type: Boolean,
@ -19,11 +17,13 @@ const emit = defineEmits<{
(e: 'update:value', value: boolean): void (e: 'update:value', value: boolean): void
}>() }>()
const configStore = useConfig()
const download = ref(props.value) const download = ref(props.value)
function onChange(value: boolean) { function onChange(value: boolean) {
emit('update:value', value) emit('update:value', value)
configStore.setIsAllowDownload(value); configStore.setIsAllowDownload(value)
} }
</script> </script>

@ -5,62 +5,66 @@ import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const configUseStore = useConfig() 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['izplan']) { if (asideValue.izplan) {
if(typeof asideValue['izplan'] == "string") { if (typeof asideValue.izplan == 'string') {
let list = asideValue['izplan'].split(','); const list = asideValue.izplan.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izplan'];
} }
console.log("formValue.value.izplan", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izplan
formValue.value.plans = [];
} }
}); console.log('formValue.value.izplan', formValue.value.plans)
}
else {
formValue.value.plans = []
}
})
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
let asideValue = finalStore.getAsideValue; const asideValue = finalStore.getAsideValue
if(asideValue && asideValue['izplan']) { if (asideValue && asideValue.izplan) {
if(typeof asideValue['izplan'] == "string") { if (typeof asideValue.izplan == 'string') {
let list = asideValue['izplan'].split(','); const list = asideValue.izplan.split(',')
formValue.value.plans = list; formValue.value.plans = list
}else {
formValue.value.plans = asideValue['izplan'];
} }
console.log("formValue.value.izplan", formValue.value.plans); else {
}else { formValue.value.plans = asideValue.izplan
formValue.value.plans = [];
} }
}); console.log('formValue.value.izplan', formValue.value.plans)
}
const props = defineProps<{ else {
value: string[] | null formValue.value.plans = []
label: string }
}>() })
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({ const formValue = ref({
plans: props.value || [], plans: props.value || [],
}) })
if(typeof formValue.value.plans == "string") { if (typeof formValue.value.plans == 'string') {
let list = formValue.value.plans.split(','); const list = formValue.value.plans.split(',')
formValue.value.plans = list; formValue.value.plans = list
} }
const rules: FormRules = { const rules: FormRules = {
plans: [ plans: [
@ -84,7 +88,7 @@ onBeforeMount(async () => {
}) })
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -92,8 +96,9 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle"> <n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择计划" multiple :options="planOptons" v-model:value="formValue.plans"
filterable :max-tag-count="2" placeholder="请选择计划" multiple :options="planOptons"
@update:value="onChange" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -5,66 +5,70 @@ import { useDictionary } from '@/store/modules/dictonary'
import { useConfig } from '@/store/modules/asideConfig' import { useConfig } from '@/store/modules/asideConfig'
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const configUseStore = useConfig() const configUseStore = useConfig()
configUseStore.$subscribe(() => { configUseStore.$subscribe(() => {
let asideValue = configUseStore.getAsideValue; const asideValue = configUseStore.getAsideValue
console.log("asideValue接受到的", asideValue); console.log('asideValue接受到的', asideValue)
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
if(asideValue['izupuser']) { if (asideValue.izupuser) {
if(typeof asideValue['izupuser'] == "string") { if (typeof asideValue.izupuser == 'string') {
let list = asideValue['izupuser'].split(','); const list = asideValue.izupuser.split(',')
formValue.value.users = list; formValue.value.users = list
}else {
formValue.value.users = asideValue['izupuser'];
} }
console.log("formValue.value.users1111111111", formValue.value.users); else {
}else { formValue.value.users = asideValue.izupuser
formValue.value.users = [];
} }
}); console.log('formValue.value.users1111111111', formValue.value.users)
}
else {
formValue.value.users = []
}
})
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
let asideValue = finalStore.getAsideValue; const asideValue = finalStore.getAsideValue
console.log("asideValue接受到的", asideValue); console.log('asideValue接受到的', asideValue)
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return return
} }
if(asideValue && asideValue['izupuser']) { if (asideValue && asideValue.izupuser) {
if(typeof asideValue['izupuser'] == "string") { if (typeof asideValue.izupuser == 'string') {
let list = asideValue['izupuser'].split(','); const list = asideValue.izupuser.split(',')
formValue.value.users = list; formValue.value.users = list
}else {
formValue.value.users = asideValue['izupuser'];
} }
console.log("formValue.value.users222222222222222", formValue.value.users); else {
}else { formValue.value.users = asideValue.izupuser
formValue.value.users = [];
} }
}); console.log('formValue.value.users222222222222222', formValue.value.users)
}
const props = defineProps<{ else {
value: string[] | null formValue.value.users = []
label: string }
}>() })
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({ const formValue = ref({
users: props.value || [], users: props.value || [],
}) })
if(typeof formValue.value.users == "string") { if (typeof formValue.value.users == 'string') {
let list = formValue.value.users.split(','); const list = formValue.value.users.split(',')
formValue.value.users = list; formValue.value.users = list
} }
console.log("formValue.value.users2222222222222", formValue.value.users); console.log('formValue.value.users2222222222222', formValue.value.users)
const rules: FormRules = { const rules: FormRules = {
users: [ users: [
{ {
@ -88,8 +92,8 @@ onBeforeMount(async () => {
const isLoadValue = ref(false) const isLoadValue = ref(false)
function onChange(value: Array<string>) { function onChange(value: Array<string>) {
console.log("user选中 ", value); console.log('user选中 ', value)
isLoadValue.value = true; isLoadValue.value = true
emit('update:value', value) emit('update:value', value)
} }
</script> </script>
@ -97,9 +101,10 @@ function onChange(value: Array<string>) {
<template> <template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules"> <n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="users" :label-style="labStyle"> <n-form-item :label="label" path="users" :label-style="labStyle">
<n-select filterable <n-select
v-model:value="formValue.users"
v-model:value="formValue.users" :max-tag-count="2" multiple placeholder="请选择提报人(可多选)" filterable :max-tag-count="2" multiple placeholder="请选择提报人(可多选)"
:options="personOptions" @update:value="onChange" :options="personOptions" @update:value="onChange"
/> />
</n-form-item> </n-form-item>

@ -1,47 +1,47 @@
<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 configUseStore = useConfig()
configUseStore.$subscribe(() => { configUseStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return; return
}
let asideValue = configUseStore.getAsideValue;
if (asideValue["izsimilarity"]) {
range.value = asideValue["izsimilarity"];
} else {
range.value = [0, 100];
} }
console.log(range.value, "range.value"); const asideValue = configUseStore.getAsideValue
if (asideValue.izsimilarity)
range.value = asideValue.izsimilarity
else
range.value = [0, 100]
console.log(range.value, 'range.value')
// else { // else {
// range.value = [0, 100]; // range.value = [0, 100];
// } // }
}); })
const props = defineProps<{ const range = ref<[number, number]>(props.value || [])
value: [number, number];
label: string;
}>();
const emit = defineEmits<{
(e: "update:value", value: string): void;
}>();
const range = ref<[number, number]>(props.value || []);
const marks = { const marks = {
0: "0", 0: '0',
50: "50", 50: '50',
100: "100", 100: '100',
}; }
const isLoadValue = ref(false); const isLoadValue = ref(false)
function onChange(value: number & number[]) { function onChange(value: number & number[]) {
range.value = value as any; range.value = value as any
isLoadValue.value = true; isLoadValue.value = true
let valueStr = value.join("-"); const valueStr = value.join('-')
emit("update:value", valueStr); emit('update:value', valueStr)
} }
</script> </script>

@ -1,71 +1,67 @@
<script lang="ts" setup> <script lang="ts" setup>
import dayjs from "dayjs"; import dayjs from 'dayjs'
import { onUpdated, watch } from "vue"; import { onMounted, onUpdated, ref, watch } from 'vue'
import { onMounted, ref } from "vue"; import { useConfig } from '@/store/modules/asideConfig'
import { useConfig } from "@/store/modules/asideConfig";
import { useFinal } from '@/store/modules/final' import { useFinal } from '@/store/modules/final'
const configUseStore = useConfig(); const props = defineProps<{
value: [number, number] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: number[]): void
}>()
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["izyear"]) { if (asideValue.izyear)
time.value = asideValue["izyear"]; time.value = asideValue.izyear
} else { else
time.value = null; time.value = null
} })
});
const finalStore = useFinal() const finalStore = useFinal()
finalStore.$subscribe(() => { finalStore.$subscribe(() => {
if (isLoadValue.value) { if (isLoadValue.value) {
isLoadValue.value = false; isLoadValue.value = false
return; return
}
let asideValue = finalStore.getAsideValue;
console.log("asideValue izyear", asideValue);
if (asideValue && asideValue["izyear"]) {
time.value = asideValue["izyear"];
} else {
time.value = null;
} }
}); const asideValue = finalStore.getAsideValue
console.log('asideValue izyear', asideValue)
if (asideValue && asideValue.izyear)
time.value = asideValue.izyear
else
time.value = null
})
const props = defineProps<{ const time = ref<[number, number] | null>(props.value)
value: [number, number] | null; const isLoadValue = ref(false)
label: string;
}>();
const emit = defineEmits<{
(e: "update:value", value: number[]): void;
}>();
const time = ref<[number, number] | null>(props.value);
const isLoadValue = ref(false);
function onChange(value: [number, number]) { function onChange(value: [number, number]) {
isLoadValue.value = true; isLoadValue.value = true
emit("update:value", value); emit('update:value', value)
} }
onMounted(() => { onMounted(() => {
if (!props.value) { if (!props.value) {
// //
const currentDate = dayjs(); const currentDate = dayjs()
// //
const endDate = currentDate.toDate(); const endDate = currentDate.toDate()
const startDate = currentDate.subtract(3, "month").toDate(); const startDate = currentDate.subtract(3, 'month').toDate()
// //
time.value = [startDate.getTime(), endDate.getTime()]; time.value = [startDate.getTime(), endDate.getTime()]
console.log("time init", startDate.getTime(), endDate.getTime()); console.log('time init', startDate.getTime(), endDate.getTime())
setTimeout(() => { setTimeout(() => {
emit("update:value", [startDate.getTime(), endDate.getTime()]); emit('update:value', [startDate.getTime(), endDate.getTime()])
}, 300); }, 300)
} }
}); })
</script> </script>
<template> <template>
@ -77,10 +73,12 @@ onMounted(() => {
v-model:value="time" v-model:value="time"
type="daterange" type="daterange"
:clearable="false" :clearable="false"
@update:value="onChange"
placeholder="请选择" placeholder="请选择"
@update:value="onChange"
> >
<template #separator> </template> <template #separator>
</template>
</n-date-picker> </n-date-picker>
</n-space> </n-space>
</n-collapse-item> </n-collapse-item>

@ -8,132 +8,137 @@ import {
reactive, reactive,
ref, ref,
unref, unref,
} from "vue"; } from 'vue'
import { NDataTable } from "naive-ui"; import { NDataTable, useModal } 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 "../Action.vue"; import selection from 'naive-ui/es/_internal/selection'
import { deleteCondition, getConditionList, sort } from "@/api/home/filter"; import Action from '../Action.vue'
import type { FilterSearchParam } from "/#/api"; import { deleteCondition, getConditionList, sort } from '@/api/home/filter'
import selection from "naive-ui/es/_internal/selection"; import type { FilterSearchParam } from '/#/api'
import SvgIcon from "@/components/Icon/SvgIcon.vue"; import SvgIcon from '@/components/Icon/SvgIcon.vue'
import { useModal } from "naive-ui"; defineOptions({ name: 'FilterModal' })
const modal = useModal();
defineOptions({ name: "FilterModal" });
const $message = window["$message"];
const props = defineProps({ const props = defineProps({
type: { type: {
type: Number, type: Number,
default: () => 0, default: () => 0,
}, },
}); })
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; (e: 'handleOk', item: any): void
}>(); }>()
const show = ref(false); const modal = useModal()
const $message = window.$message
const show = ref(false)
const cardStyle = { const cardStyle = {
width: "808px", 'width': '808px',
height: "840px", 'height': '840px',
"--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
} }
function sortData(row) { function sortData(row) {
console.log("sortData", row); console.log('sortData', row)
if (row.order == "descend") { if (row.order == 'descend') {
tableData.value.sort( tableData.value.sort(
(a, b) => (a, b) =>
new Date(a[row.columnKey]).getTime() - new Date(b[row.columnKey]).getTime() new Date(a[row.columnKey]).getTime() - new Date(b[row.columnKey]).getTime(),
); )
} else if (row.order == "ascend") { }
else if (row.order == 'ascend') {
tableData.value.sort( tableData.value.sort(
(a, b) => (a, b) =>
new Date(b[row.columnKey]).getTime() - new Date(a[row.columnKey]).getTime() new Date(b[row.columnKey]).getTime() - new Date(a[row.columnKey]).getTime(),
); )
} else { }
else {
tableData.value.sort( tableData.value.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),
); )
} }
} }
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,
}); })
}, },
}, },
// j // j
{ {
title: "名称", title: '名称',
key: "searchname", key: 'searchname',
ellipsis: { ellipsis: {
tooltip: true, tooltip: true,
}, },
}, },
{ {
title: "创建者", title: '创建者',
key: "createby", key: 'createby',
}, },
{ {
title: "创建时间", title: '创建时间',
key: "createtime", key: 'createtime',
width: 180, width: 180,
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) => {
// tableData.value.sort( // tableData.value.sort(
// (a, b) => new Date(a?.createtime).getTime() - new Date(b?.createtime).getTime() // (a, b) => new Date(a?.createtime).getTime() - new Date(b?.createtime).getTime()
// ); // );
return new Date(row1?.createtime).getTime() - new Date(row2?.createtime).getTime(); return new Date(row1?.createtime).getTime() - new Date(row2?.createtime).getTime()
}, },
}, },
{ {
title: "更新者", title: '更新者',
key: "updateby", key: 'updateby',
}, },
{ {
title: "更新时间", title: '更新时间',
key: "updatetime", key: 'updatetime',
width: 180, width: 180,
}, },
]; ]
const total = ref(0); const total = ref(0)
const loading = ref(true); const loading = ref(true)
const pagination = reactive({ const pagination = reactive({
page: 1, page: 1,
pageCount: 1, pageCount: 1,
@ -141,83 +146,83 @@ 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( const result = await getConditionList(
{ pageNo: page, pageSize }, { pageNo: page, pageSize },
searchParam, searchParam,
props.type props.type,
); )
const { data, pageCount, total: totalCount } = result; const { data, pageCount, total: totalCount } = result
tableData.value = data; tableData.value = data
pagination.page = page; pagination.page = page
total.value = totalCount; total.value = totalCount
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) { switch (key) {
case 1: case 1:
editSelection(id); editSelection(id)
break; break
case 2: 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; break
default: default:
break; break
} }
} }
@ -227,145 +232,149 @@ function editSelection(id) {
// $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 = '') {
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')
closeModal(); closeModal()
} }
let sortTable: Sortable | null = null; let sortTable: Sortable | null = null
const tableRef = ref<InstanceType<typeof NDataTable>>(); const tableRef = ref<InstanceType<typeof NDataTable>>()
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 el: HTMLDivElement = tableRef.value?.$el
const tbody: HTMLElement | null = el.querySelector("tbody.n-data-table-tbody")!; const tbody: HTMLElement | null = el.querySelector('tbody.n-data-table-tbody')!
if (tbody) sortTable = Sortable.create(tbody, { onEnd, onMove }); 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() {
selectionIds.value = []; selectionIds.value = []
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
}); })
const handleOk = () => { function handleOk() {
if (selectionIds.value.length > 1) { if (selectionIds.value.length > 1) {
$message.error("只能选择一条筛选条件"); $message.error('只能选择一条筛选条件')
return; return
} }
if (selectionIds.value.length == 1) { if (selectionIds.value.length == 1) {
const selectedId = selectionIds.value[0]; const selectedId = selectionIds.value[0]
let item = tableData.value.find((v) => v.id == selectedId); const item = tableData.value.find(v => v.id == selectedId)
emit("handleOk", item); emit('handleOk', item)
} }
if (selectionIds.value.length == 0) { if (selectionIds.value.length == 0)
emit("handleOk", ""); emit('handleOk', '')
closeModal()
} }
closeModal();
};
</script> </script>
<template> <template>
@ -374,9 +383,9 @@ const handleOk = () => {
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"
@ -396,8 +405,7 @@ const handleOk = () => {
'font-weight': '600', 'font-weight': '600',
}" }"
class="wrapper-info-title" class="wrapper-info-title"
>基本信息</span >基本信息</span>
>
</div> </div>
</div> </div>
@ -429,13 +437,11 @@ const handleOk = () => {
</n-button> </n-button>
</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>

@ -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,19 @@ 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">
<n-form-item path="name" label="标题" mergedRequireMarkPlacement="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 +421,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>

File diff suppressed because it is too large Load Diff

@ -1,54 +1,54 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineOptions, onMounted, ref, onBeforeUnmount } from "vue"; import { defineOptions, onBeforeUnmount, onMounted, ref } from 'vue'
import { useRouter } from "vue-router"; import { useRouter } from 'vue-router'
defineOptions({ name: "ShortcutModal" }); defineOptions({ name: 'ShortcutModal' })
const emit = defineEmits<{ const emit = defineEmits<{
(e: "refresh", value: any); (e: 'refresh', value: any)
(e: "cancel", value: any); (e: 'cancel', value: any)
}>(); }>()
const show = ref(false); const show = ref(false)
const isFold = ref(false); const isFold = ref(false)
const router = useRouter(); const router = useRouter()
const cardStyle = { const cardStyle = {
width: "29vw", 'width': '29vw',
"--n-padding-bottom": "10px", '--n-padding-bottom': '10px',
"--n-padding-left": "10px", '--n-padding-left': '10px',
}; }
function toggle() { function toggle() {
isFold.value = !isFold.value; isFold.value = !isFold.value
} }
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
function refresh() { function refresh() {
emit("refresh", true); emit('refresh', true)
} }
function cancel() { function cancel() {
closeModal(); closeModal()
emit("cancel", true); emit('cancel', true)
} }
const time = ref(); const time = ref()
onMounted(() => { onMounted(() => {
time.value = setInterval(() => { time.value = setInterval(() => {
// console.log("00000000-----------"); // console.log("00000000-----------");
show.value && refresh(); show.value && refresh()
}, 5000); }, 5000)
}); })
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearInterval(time.value); clearInterval(time.value)
time.value = null; time.value = null
}); })
defineExpose({ defineExpose({
showModal, showModal,
closeModal, closeModal,
}); })
</script> </script>
<template> <template>
@ -75,13 +75,15 @@ defineExpose({
style="padding: 8px 8px 0 8px" style="padding: 8px 8px 0 8px"
> >
<div class="wrapper"> <div class="wrapper">
<div class="title">查重进度</div> <div class="title">
查重进度
</div>
<div class="icon-list"> <div class="icon-list">
<svg-icon <svg-icon
size="16" size="16"
name="refresh" name="refresh"
@click="refresh"
style="margin-right: 16px; cursor: pointer" style="margin-right: 16px; cursor: pointer"
@click="refresh"
/> />
<svg-icon <svg-icon
v-show="!isFold" v-show="!isFold"
@ -100,8 +102,8 @@ defineExpose({
<svg-icon <svg-icon
size="16" size="16"
name="close-none-border" name="close-none-border"
@click="cancel"
style="margin-right: 25.7px; cursor: pointer" style="margin-right: 25.7px; cursor: pointer"
@click="cancel"
/> />
</div> </div>
</div> </div>

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineOptions, ref } from 'vue'; import { defineOptions, ref } from 'vue'
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router'
defineOptions({ name: 'ShortcutModal' }) defineOptions({ name: 'ShortcutModal' })
@ -9,7 +9,7 @@ const props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
}); })
const show = ref(false) const show = ref(false)
const router = useRouter() const router = useRouter()
@ -26,12 +26,11 @@ function showModal() {
function closeModal(path) { function closeModal(path) {
show.value = false show.value = false
if(props.id) { if (props.id)
router.push(path + '?id=' + props.id) router.push(`${path}?id=${props.id}`)
}else { else
router.push(path) router.push(path)
} }
}
function closeIconModal() { function closeIconModal() {
show.value = false show.value = false
@ -43,7 +42,7 @@ defineExpose({
</script> </script>
<template> <template>
<div class="finish-package-modal" v-if="show"> <div v-if="show" class="finish-package-modal">
<!-- <n-modal v-model:show="show" :mask-closable="false" transform-origin="center" style="padding: 8px;"> <!-- <n-modal v-model:show="show" :mask-closable="false" transform-origin="center" style="padding: 8px;">
<n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true"> <n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
<div style="display: flex;"> <div style="display: flex;">
@ -67,10 +66,16 @@ defineExpose({
</n-card> </n-card>
</n-modal> --> </n-modal> -->
<div class="header-box"> <div class="header-box">
<div class="robot-box"><svg-icon size="80" name="robot-two" /></div> <div class="robot-box">
<svg-icon size="80" name="robot-two" />
</div>
<div class="text-box"> <div class="text-box">
<div class="msg-title">生成成功提示</div> <div class="msg-title">
<div class="msg-text">AI助手已根据您的配置要求生成任务包</div> 生成成功提示
</div>
<div class="msg-text">
AI助手已根据您的配置要求生成任务包
</div>
</div> </div>
<div class="close-box" @click="closeIconModal"> <div class="close-box" @click="closeIconModal">
<svg-icon size="30" name="close-none-border" /> <svg-icon size="30" name="close-none-border" />

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineOptions, ref } from 'vue'; import { defineOptions, ref } from 'vue'
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router'
defineOptions({ name: 'ShortcutModal' }) defineOptions({ name: 'ShortcutModal' })
@ -34,8 +34,12 @@ defineExpose({
<div style="display: flex;"> <div style="display: flex;">
<div><svg-icon size="80" name="robot2" /></div> <div><svg-icon size="80" name="robot2" /></div>
<div style="height: 130px;text-align: center;margin-left: 20px;"> <div style="height: 130px;text-align: center;margin-left: 20px;">
<div class="msg-title">生成任务提示</div> <div class="msg-title">
<div class="msg-text">AI已根据您的配置要求生成任务包</div> 生成任务提示
</div>
<div class="msg-text">
AI已根据您的配置要求生成任务包
</div>
</div> </div>
</div> </div>
@ -78,5 +82,4 @@ defineExpose({
color: #666666; color: #666666;
line-height: 22px; line-height: 22px;
} }
</style> </style>

@ -1,81 +1,102 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from "vue"; import { onMounted, ref } from 'vue'
import { getToolsCount } from "@/api/home/main"; import { getToolsCount } from '@/api/home/main'
const emit = defineEmits<{ const emit = defineEmits<{
(e: "reject", params: any); (e: 'reject', params: any)
(e: "viewrepeat"); (e: 'viewrepeat')
}>(); }>()
const show = ref(false); const show = ref(false)
const toolsData = ref({} as any); const toolsData = ref({} as any)
async function getData() { async function getData() {
const res = await getToolsCount(); const res = await getToolsCount()
toolsData.value = res.data || {}; toolsData.value = res.data || {}
if (res.code == "OK") { if (res.code == 'OK')
showModal(); showModal()
}
} }
onMounted(() => { onMounted(() => {
getData(); getData()
}); })
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function reject() { async function reject() {
emit("reject", { a: "todo" }); emit('reject', { a: 'todo' })
closeModal(); closeModal()
} }
async function viewRepeat(e: MouseEvent) { async function viewRepeat(e: MouseEvent) {
emit("viewrepeat"); emit('viewrepeat')
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
</script> </script>
<template> <template>
<n-modal v-model:show="show" transform-origin="center" class="modal_wrap"> <n-modal v-model:show="show" transform-origin="center" class="modal_wrap">
<div class="wrapper"> <div class="wrapper">
<div class="wrapper-hearder"> <div class="wrapper-hearder">
<div class="wrapper-title">欢迎登录智能AI审批工具</div> <div class="wrapper-title">
<div class="wrapper-mark">某某有限公司-某某事业部-张小凡</div> 欢迎登录智能AI审批工具
</div>
<div class="wrapper-mark">
某某有限公司-某某事业部-张小凡
</div>
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<div class="flex_box"> <div class="flex_box">
<div class="item"> <div class="item">
<SvgIcon name="task_count" width="49" height="58" /> <SvgIcon name="task_count" width="49" height="58" />
<div class="num_box">{{ toolsData?.total || 0 }}</div> <div class="num_box">
<div class="title_box">任务总数</div> {{ toolsData?.total || 0 }}
</div>
<div class="title_box">
任务总数
</div>
</div> </div>
<div class="item"> <div class="item">
<SvgIcon name="task_wait" width="49" height="58" /> <SvgIcon name="task_wait" width="49" height="58" />
<div class="num_box">{{ toolsData?.treat || 0 }}</div> <div class="num_box">
<div class="title_box">待审批</div> {{ toolsData?.treat || 0 }}
</div>
<div class="title_box">
待审批
</div>
</div> </div>
<div class="item"> <div class="item">
<SvgIcon name="task_over" width="49" height="58" /> <SvgIcon name="task_over" width="49" height="58" />
<div class="num_box">{{ toolsData?.approvedCount || 0 }}</div> <div class="num_box">
<div class="title_box">已审批</div> {{ toolsData?.approvedCount || 0 }}
</div>
<div class="title_box">
已审批
</div>
</div> </div>
<div class="item"> <div class="item">
<SvgIcon name="modal_reImg" width="49" height="58" /> <SvgIcon name="modal_reImg" width="49" height="58" />
<div class="num_box">{{ toolsData?.repeat }}</div> <div class="num_box">
<div class="title_box">重复图片</div> {{ toolsData?.repeat }}
</div>
<div class="title_box">
重复图片
</div>
</div>
</div> </div>
<div class="footer" @click="viewRepeat">
我知道了
</div> </div>
<div class="footer" @click="viewRepeat"></div>
<!-- <div class="footer"> <!-- <div class="footer">
<SvgIcon <SvgIcon
@click="viewRepeat" @click="viewRepeat"

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { FormInst, FormRules } from 'naive-ui'; import type { FormInst, FormRules } from 'naive-ui'
import { useMessage } from 'naive-ui'; import { useMessage } from 'naive-ui'
import { ref } from 'vue'; import { ref } from 'vue'
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'commit', value: any) (e: 'commit', value: any)

@ -1,50 +1,50 @@
<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 emit = defineEmits<{ const emit = defineEmits<{
(e: "closeCallback", value: any); (e: 'closeCallback', value: any)
}>(); }>()
const show = ref(false); const show = ref(false)
const stys = { const stys = {
width: "424px", 'width': '424px',
height: "232px", 'height': '232px',
"--n-padding-bottom": "20px", '--n-padding-bottom': '20px',
"--n-padding-left": "0px", '--n-padding-left': '0px',
background: 'background':
"linear-gradient(132deg, rgba(255, 255, 255, 0.32) 21%, rgba(152, 172, 255, 0.14) 100%)", 'linear-gradient(132deg, rgba(255, 255, 255, 0.32) 21%, rgba(152, 172, 255, 0.14) 100%)',
"border-radius": "4px", 'border-radius': '4px',
"box-shadow": "0px 12px 48px 16px rgba(0, 0, 0, 0.03)", 'box-shadow': '0px 12px 48px 16px rgba(0, 0, 0, 0.03)',
"backdrop-filter": " blur(10px)", 'backdrop-filter': ' blur(10px)',
}; }
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
emit("closeCallback", true); emit('closeCallback', true)
} }
function closeOnlyModal() { function closeOnlyModal() {
show.value = false; show.value = false
} }
defineExpose({ defineExpose({
showModal, showModal,
closeModal, closeModal,
closeOnlyModal, closeOnlyModal,
}); })
const configStore = useConfig(); const configStore = useConfig()
const percent = ref(0); const percent = ref(0)
configStore.$subscribe(() => { configStore.$subscribe(() => {
percent.value = configStore.getTimeNum; percent.value = configStore.getTimeNum
}); })
</script> </script>
<template> <template>
@ -58,8 +58,8 @@ configStore.$subscribe(() => {
<svg-icon <svg-icon
size="15" size="15"
name="close" name="close"
@click="closeModal"
style="position: absolute; right: 15.7px; top: 6px; cursor: pointer" style="position: absolute; right: 15.7px; top: 6px; cursor: pointer"
@click="closeModal"
/> />
<div class="wrapper"> <div class="wrapper">
<svg-icon size="90" name="robot2" /> <svg-icon size="90" name="robot2" />

@ -1,14 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'
import Aside from './aside/Aside.vue' import Aside from './aside/Aside.vue'
import Content from './content/Content.vue' import Content from './content/Content.vue'
import Robot from '@/components/Robot/index.vue' import Robot from '@/components/Robot/index.vue'
import {ref} from 'vue';
const contentRef: any = ref(null) const contentRef: any = ref(null)
const showLoginModal = ()=>{ function showLoginModal() {
contentRef.value.showLoginSuccessModal(); contentRef.value.showLoginSuccessModal()
} }
</script> </script>
<template> <template>

@ -1,281 +1,285 @@
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from "vue"; import { reactive, ref } from 'vue'
import { useMessage } from "naive-ui"; import { useMessage } from 'naive-ui'
import { forgetPassword, getCode, updateSUser } from "@/api/login/login"; import { forgetPassword, getCode, updateSUser } from '@/api/login/login'
const emit = defineEmits(["close", "forget"]); const emit = defineEmits(['close', 'forget'])
interface FormState { interface FormState {
enterprisecode?: string; enterprisecode?: string
username: string; username: string
password: string; password: string
captcha: string; captcha: string
} }
interface FormForget { interface FormForget {
agentcode: string; agentcode: string
loginname: string; loginname: string
phone: string; phone: string
phonecode: string; phonecode: string
} }
interface FormSure { interface FormSure {
newPassword: string; newPassword: string
rePasswrod: string; rePasswrod: string
loginname: string; loginname: string
} }
const formRef = ref(); const formRef = ref()
const formRefSure = ref(); const formRefSure = ref()
const message = useMessage(); const message = useMessage()
const loading = ref(false); const loading = ref(false)
const flag = ref(true); const flag = ref(true)
const formForget: FormForget = reactive({ const formForget: FormForget = reactive({
agentcode: "", agentcode: '',
loginname: "", loginname: '',
phone: "", phone: '',
phonecode: "", phonecode: '',
}); })
const formInline: FormState = reactive({ const formInline: FormState = reactive({
enterprisecode: "", enterprisecode: '',
username: "", username: '',
password: "", password: '',
captcha: "", captcha: '',
}); })
const formSure: FormSure = reactive({ const formSure: FormSure = reactive({
newPassword: "", newPassword: '',
rePasswrod: "", rePasswrod: '',
loginname: "13311111111", loginname: '13311111111',
}); })
const tab = ref(0); const tab = ref(0)
const loginSuccess = ref(true); const loginSuccess = ref(true)
const loginRejectMessge = ref(""); const loginRejectMessge = ref('')
const countTime = ref("获取验证码"); const countTime = ref('获取验证码')
const rules = { const rules = {
enterprisecode: [ enterprisecode: [
{ required: true, message: "请输入企业编码", trigger: "blur" }, { required: true, message: '请输入企业编码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("企业") > -1) { if (loginRejectMessge.value.includes('企业'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
agentcode: [ agentcode: [
{ required: true, message: "请输入企业编码", trigger: "blur" }, { required: true, message: '请输入企业编码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("企业") > -1) { if (loginRejectMessge.value.includes('企业'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
loginname: [ loginname: [
{ required: true, message: "请输入用户名", trigger: "blur" }, { required: true, message: '请输入用户名', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("用户名") > -1||loginRejectMessge.value.indexOf("账号") > -1) { if (loginRejectMessge.value.includes('用户名') || loginRejectMessge.value.includes('账号'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: '请输入手机号', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("手机号") > -1) { if (loginRejectMessge.value.includes('手机号'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
password: { required: true, message: "请输入密码", trigger: "blur" }, password: { required: true, message: '请输入密码', trigger: 'blur' },
phonecode: [ phonecode: [
{ required: true, message: "请输入验证码", trigger: "blur" }, { required: true, message: '请输入验证码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("验证码") > -1) { if (loginRejectMessge.value.includes('验证码'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
newPassword: { required: true, message: "请输入新密码", trigger: "blur" }, newPassword: { required: true, message: '请输入新密码', trigger: 'blur' },
rePasswrod: [ rePasswrod: [
{ {
required: true, required: true,
message: "请再次输入密码", message: '请再次输入密码',
trigger: ["input", "blur"], trigger: ['input', 'blur'],
}, },
{ {
validator: validatePasswordSame, validator: validatePasswordSame,
message: "两次密码输入不一致", message: '两次密码输入不一致',
trigger: ["blur", "password-input"], trigger: ['blur', 'password-input'],
}, },
], ],
}; }
function validatePasswordSame(rule: any, value: string): boolean { function validatePasswordSame(rule: any, value: string): boolean {
if (Boolean(formSure.rePasswrod)) { if (formSure.rePasswrod) {
if (value == formSure.newPassword) { if (value == formSure.newPassword)
return true; return true
} else { else
return false; return false
} }
} else { else {
return true; return true
} }
} }
function handleSubmit(e) { function handleSubmit(e) {
e.preventDefault(); e.preventDefault()
loginSuccess.value = true; loginSuccess.value = true
formRef.value.validate(async (errors) => { formRef.value.validate(async (errors) => {
if (!errors) { if (!errors) {
const { loginname, phone, phonecode, agentcode } = formForget; const { loginname, phone, phonecode, agentcode } = formForget
loading.value = true; loading.value = true
const params = { const params = {
loginname, loginname,
phone, phone,
phonecode, phonecode,
agentcode, agentcode,
}; }
try { try {
const res = await forgetPassword(params); const res = await forgetPassword(params)
if (res.code === "OK") { if (res.code === 'OK') {
loginSuccess.value = true; loginSuccess.value = true
formSure.loginname = res.data?.loginname; formSure.loginname = res.data?.loginname
tab.value = 1; tab.value = 1
} else { }
loginSuccess.value = false; else {
message.error(res.message); loginSuccess.value = false
loginRejectMessge.value = res.message; message.error(res.message)
formRef.value.validate(); loginRejectMessge.value = res.message
formRef.value.validate()
}
} }
} finally { finally {
loading.value = false; loading.value = false
} }
} }
}); })
} }
function handleSure(e) { function handleSure(e) {
e.preventDefault(); e.preventDefault()
formRefSure.value.validate(async (errors) => { formRefSure.value.validate(async (errors) => {
if (!errors) { if (!errors) {
const { newPassword, rePasswrod, loginname } = formSure; const { newPassword, rePasswrod, loginname } = formSure
loading.value = true; loading.value = true
const params = { const params = {
newPassword, newPassword,
rePasswrod, rePasswrod,
loginname, loginname,
}; }
try { try {
const res = await updateSUser(params); const res = await updateSUser(params)
if (res.code === "OK") { if (res.code === 'OK') {
message.success("修改成功"); message.success('修改成功')
tab.value = 0; tab.value = 0
forget(); forget()
} else { }
message.error(res.message); else {
message.error(res.message)
} }
} finally {
loading.value = false;
} }
finally {
loading.value = false
} }
}); }
})
} }
function close() { function close() {
loading.value = false; loading.value = false
emit("close"); emit('close')
} }
function switchTab(type: number) { function switchTab(type: number) {
tab.value = type; tab.value = type
} }
function computedForm() { function computedForm() {
return !formForget.phonecode || !formForget.phone || !formForget.loginname || !formForget.agentcode; return !formForget.phonecode || !formForget.phone || !formForget.loginname || !formForget.agentcode
} }
function computedFormSure() { function computedFormSure() {
return !formSure.newPassword || !formSure.rePasswrod; return !formSure.newPassword || !formSure.rePasswrod
} }
async function sendCode(value) { async function sendCode(value) {
if (!flag.value) return; if (!flag.value)
flag.value = false;
if(!(formForget.phone.length == 11)){
return return
} flag.value = false
if (!(formForget.phone.length == 11))
return
const res = await getCode({ const res = await getCode({
phone: formForget.phone, phone: formForget.phone,
agentcode: formForget.agentcode, agentcode: formForget.agentcode,
}); })
if (!res.data) { if (!res.data) {
message.error(res.message); message.error(res.message)
return; return
} }
startCount(); startCount()
} }
function startCount() { function startCount() {
let time = 60; let time = 60
countTime.value = "60s"; countTime.value = '60s'
const timer = setInterval(() => { const timer = setInterval(() => {
countTime.value = `${--time}s`; countTime.value = `${--time}s`
if (time === 0) { if (time === 0) {
clearInterval(timer); clearInterval(timer)
countTime.value = "获取验证码"; countTime.value = '获取验证码'
flag.value = true; flag.value = true
} }
}, 1000); }, 1000)
} }
function forget() { function forget() {
loading.value = false; loading.value = false
emit("forget"); emit('forget')
} }
</script> </script>
<template> <template>
<div class="form-login"> <div class="form-login">
<img class="img-close" src="@/assets/images/login/close.png" alt="" @click="close" /> <img class="img-close" src="@/assets/images/login/close.png" alt="" @click="close">
<div class="flex justify-between header"> <div class="flex justify-between header">
<div class="tab">忘记密码</div> <div class="tab">
<div class="back" @click="forget">&lt; </div> 忘记密码
</div>
<div class="back" @click="forget">
&lt; 返回登录
</div>
</div> </div>
<div v-if="tab === 0" class="form-1"> <div v-if="tab === 0" class="form-1">
<n-form <n-form
@ -322,7 +326,7 @@ function forget() {
src="@/assets/images/login/phone.png" src="@/assets/images/login/phone.png"
alt="" alt=""
@click="close" @click="close"
/> >
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -340,7 +344,7 @@ function forget() {
src="@/assets/images/login/auth.png" src="@/assets/images/login/auth.png"
alt="" alt=""
@click="close" @click="close"
/> >
</template> </template>
<template #suffix> <template #suffix>
<div <div

@ -1,344 +1,349 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, reactive, ref } from "vue"; import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from 'vue-router'
import { useMessage } from "naive-ui"; import { useMessage } from 'naive-ui'
// import captcha from './captcha.vue' // import captcha from './captcha.vue'
import { PageEnum } from "@/enums/pageEnum"; import { PageEnum } from '@/enums/pageEnum'
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from '@/store/modules/user'
import { ResultEnum } from "@/enums/httpEnum"; import { ResultEnum } from '@/enums/httpEnum'
import { getCode, smsLogin } from "@/api/login/login"; import { getCode, smsLogin } from '@/api/login/login'
import SvgIcon from "@/components/Icon/SvgIcon.vue"; import SvgIcon from '@/components/Icon/SvgIcon.vue'
const emit = defineEmits(["close", "forget"]); const emit = defineEmits(['close', 'forget'])
interface FormState { interface FormState {
enterprisecode?: string; enterprisecode?: string
username: string; username: string
password: string; password: string
} }
interface FormSms { interface FormSms {
agentcode: string; agentcode: string
phone: string; phone: string
phonecode: string; phonecode: string
} }
const formRef = ref(); const formRef = ref()
const formRefSms = ref(); const formRefSms = ref()
const message = useMessage(); const message = useMessage()
const loading = ref(false); const loading = ref(false)
const autoLogin = ref(false); const autoLogin = ref(false)
const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME; const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME
const userStore = useUserStore(); const userStore = useUserStore()
const router = useRouter(); const router = useRouter()
const route = useRoute(); const route = useRoute()
const show = ref(false); const show = ref(false)
const flag = ref(true); const flag = ref(true)
const loginSuccess = ref(true); const loginSuccess = ref(true)
const loginRejectMessge = ref(""); const loginRejectMessge = ref('')
let formInline: FormState = reactive({ const formInline: FormState = reactive({
// enterprisecode: "", // enterprisecode: "",
// username: "yanshi01", // username: "yanshi01",
// password: "123456", // password: "123456",
enterprisecode: "", enterprisecode: '',
username: "", username: '',
password: "", password: '',
}); })
let formSms: FormSms = reactive({ const formSms: FormSms = reactive({
agentcode: "", agentcode: '',
phone: "", phone: '',
phonecode: "", phonecode: '',
}); })
const tab = ref(0); const tab = ref(0)
const countTime = ref("获取验证码"); const countTime = ref('获取验证码')
const rules = { const rules = {
enterprisecode: [ enterprisecode: [
{ required: true, message: "请输入企业编码", trigger: "blur" }, { required: true, message: '请输入企业编码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("企业") > -1) { if (loginRejectMessge.value.includes('企业'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
agentcode: [ agentcode: [
{ required: true, message: "请输入验证码", trigger: "blur" }, { required: true, message: '请输入验证码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("验证码") > -1) { if (loginRejectMessge.value.includes('验证码'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: '请输入手机号', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("手机号") > -1) { if (loginRejectMessge.value.includes('手机号'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
phonecode: [ phonecode: [
{ required: true, message: "请输入验证码", trigger: "blur" }, { required: true, message: '请输入验证码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (value.length < 4 && value.length > 0) { if (value.length < 4 && value.length > 0)
return new Error("请正确填写4位手机短信验证码"); return new Error('请正确填写4位手机短信验证码')
}
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("验证码") > -1) { if (loginRejectMessge.value.includes('验证码'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
username: [ username: [
{ required: true, message: "请输入账号", trigger: "blur" }, { required: true, message: '请输入账号', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("账号") > -1) { if (loginRejectMessge.value.includes('账号'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
password: [ password: [
{ required: true, message: "请输入密码", trigger: "blur" }, { required: true, message: '请输入密码', trigger: 'blur' },
{ {
trigger: ["blur", "input", "change"], trigger: ['blur', 'input', 'change'],
level: "error", level: 'error',
validator(_rule, value) { validator(_rule, value) {
if (loginSuccess.value || !value) { if (loginSuccess.value || !value)
return true; return true
}
if (loginRejectMessge.value.indexOf("密码") > -1) { if (loginRejectMessge.value.includes('密码'))
return new Error(loginRejectMessge.value); return new Error(loginRejectMessge.value)
}
}, },
}, },
], ],
captcha: [{ required: true, message: "请输入验证码", trigger: "blur" }], captcha: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
}; }
function handleSubmit(e) { function handleSubmit(e) {
e.preventDefault(); e.preventDefault()
loginSuccess.value = true; loginSuccess.value = true
formRef.value.validate(async (errors) => { formRef.value.validate(async (errors) => {
if (!errors) { if (!errors) {
const { username, password, enterprisecode } = formInline; const { username, password, enterprisecode } = formInline
message.loading("登录中..."); message.loading('登录中...')
loading.value = true; loading.value = true
const params = { const params = {
username, username,
password, password,
codetoken: userStore.getCapToken, codetoken: userStore.getCapToken,
agentcode: enterprisecode, agentcode: enterprisecode,
}; }
try { try {
const { code, message: msg } = await userStore.login(params); const { code, message: msg } = await userStore.login(params)
loginRejectMessge.value = msg; loginRejectMessge.value = msg
if (code === ResultEnum.SUCCESS) { if (code === ResultEnum.SUCCESS) {
// //
if (autoLogin.value) { if (autoLogin.value)
localStorage.setItem("LOGIN_FORM_PASS", JSON.stringify(formInline)); localStorage.setItem('LOGIN_FORM_PASS', JSON.stringify(formInline))
} else { else
localStorage.removeItem("LOGIN_FORM_PASS"); localStorage.removeItem('LOGIN_FORM_PASS')
}
loginSuccess.value = true; loginSuccess.value = true
const { data: userInfo } = await userStore.getInformation(); const { data: userInfo } = await userStore.getInformation()
message.destroyAll(); message.destroyAll()
const toPath = decodeURIComponent((route.query?.redirect || "/") as string); const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
if (route.name === LOGIN_NAME) if (route.name === LOGIN_NAME) {
if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) { if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) {
message.success("登录成功,即将进入系统"); message.success('登录成功,即将进入系统')
router.replace( router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" userInfo.frontmenuTList ? userInfo.frontmenuTList[0].resUrl : '/',
); )
} else {
message.error("用户无菜单权限,请联系管理员");
} }
else router.replace(toPath); else {
} else { message.error('用户无菜单权限,请联系管理员')
loginSuccess.value = false;
message.destroyAll();
message.info(msg || "登录失败");
formRef.value.validate();
} }
} finally {
loading.value = false;
} }
} else { else { router.replace(toPath) }
message.error("请填写完整信息,并且进行验证码校验");
} }
}); else {
loginSuccess.value = false
message.destroyAll()
message.info(msg || '登录失败')
formRef.value.validate()
}
}
finally {
loading.value = false
}
}
else {
message.error('请填写完整信息,并且进行验证码校验')
}
})
} }
onMounted(() => { onMounted(() => {
let data: any = localStorage.getItem("LOGIN_FORM_SMS"); let data: any = localStorage.getItem('LOGIN_FORM_SMS')
if (data) { if (data) {
data = JSON.parse(data) as any; data = JSON.parse(data) as any
formSms.agentcode = data.agentcode; formSms.agentcode = data.agentcode
formSms.phone = data.phone; formSms.phone = data.phone
formSms.phonecode = ""; formSms.phonecode = ''
autoLogin.value = true; autoLogin.value = true
} }
data = localStorage.getItem("LOGIN_FORM_PASS"); data = localStorage.getItem('LOGIN_FORM_PASS')
if (data) { if (data) {
data = JSON.parse(data) as any; data = JSON.parse(data) as any
formInline.username = data.username; formInline.username = data.username
formInline.password = ""; formInline.password = ''
// formInline.password = data.password; // formInline.password = data.password;
formInline.enterprisecode = data.enterprisecode; formInline.enterprisecode = data.enterprisecode
autoLogin.value = true; autoLogin.value = true
} }
}); })
function handleSmsSubmit(e) { function handleSmsSubmit(e) {
e.preventDefault(); e.preventDefault()
loginSuccess.value = true; loginSuccess.value = true
formRefSms.value.validate(async (errors) => { formRefSms.value.validate(async (errors) => {
if (!errors) { if (!errors) {
const { phone, agentcode, phonecode } = formSms; const { phone, agentcode, phonecode } = formSms
message.loading("登录中..."); message.loading('登录中...')
loading.value = true; loading.value = true
try { try {
const res = await smsLogin({ const res = await smsLogin({
phone, phone,
agentcode, agentcode,
phonecode, phonecode,
}); })
const { code, message: msg } = res; const { code, message: msg } = res
loginRejectMessge.value = msg; loginRejectMessge.value = msg
if (code === ResultEnum.SUCCESS) { if (code === ResultEnum.SUCCESS) {
// //
if (autoLogin.value) { if (autoLogin.value)
localStorage.setItem("LOGIN_FORM_SMS", JSON.stringify(formSms)); localStorage.setItem('LOGIN_FORM_SMS', JSON.stringify(formSms))
} else { else
localStorage.removeItem("LOGIN_FORM_SMS"); localStorage.removeItem('LOGIN_FORM_SMS')
}
loginSuccess.value = true; loginSuccess.value = true
// const { code, message: msg } = await userStore.login(params) // const { code, message: msg } = await userStore.login(params)
await userStore.setStorageToken(res.data); await userStore.setStorageToken(res.data)
const { data: userInfo } = await userStore.getInformation(); const { data: userInfo } = await userStore.getInformation()
message.destroyAll(); message.destroyAll()
const toPath = decodeURIComponent((route.query?.redirect || "/") as string); const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
if (route.name === LOGIN_NAME) { if (route.name === LOGIN_NAME) {
if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) { if (userInfo.frontmenuTList && userInfo.frontmenuTList.length) {
message.success("登录成功,即将进入系统"); message.success('登录成功,即将进入系统')
router.replace( router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/" userInfo.frontmenuTList ? userInfo.frontmenuTList[0].resUrl : '/',
); )
} else { }
message.error("用户无菜单权限,请联系管理员"); else {
message.error('用户无菜单权限,请联系管理员')
}
}
else {
router.replace(toPath)
}
} }
} else { else {
router.replace(toPath); message.destroyAll()
message.info(msg || '登录失败')
loginSuccess.value = false
formRefSms.value.validate()
} }
} else {
message.destroyAll();
message.info(msg || "登录失败");
loginSuccess.value = false;
formRefSms.value.validate();
} }
} catch (e) { catch (e) {
} finally {
loading.value = false;
} }
} else { finally {
message.error("请填写完整信息,并且进行验证码校验"); loading.value = false
} }
}); }
else {
message.error('请填写完整信息,并且进行验证码校验')
}
})
} }
function close() { function close() {
loading.value = false; loading.value = false
emit("close"); emit('close')
} }
function switchTab(type: number) { function switchTab(type: number) {
loading.value = false; loading.value = false
tab.value = type; tab.value = type
} }
function computedForm() { function computedForm() {
if (tab.value == 0) { if (tab.value == 0)
return !formInline.enterprisecode || !formInline.username || !formInline.password; return !formInline.enterprisecode || !formInline.username || !formInline.password
}
if (tab.value == 1) { if (tab.value == 1)
return !formSms.agentcode || !formSms.phone || !formSms.phonecode; return !formSms.agentcode || !formSms.phone || !formSms.phonecode
}
} }
async function sendCode(value) { async function sendCode(value) {
if (!formSms.phone) return; if (!formSms.phone)
return
if (!flag.value) return; if (!flag.value)
flag.value = false; return
flag.value = false
const res = await getCode({ const res = await getCode({
phone: formSms.phone, phone: formSms.phone,
agentcode: formSms.agentcode, agentcode: formSms.agentcode,
}); })
if (res.code == "OK") { if (res.code == 'OK')
startCount(); startCount()
} else { else
message.error(res.message); message.error(res.message)
}
} }
function startCount() { function startCount() {
let time = 60; let time = 60
countTime.value = "60s"; countTime.value = '60s'
const timer = setInterval(() => { const timer = setInterval(() => {
countTime.value = `${--time}s`; countTime.value = `${--time}s`
if (time === 0) { if (time === 0) {
clearInterval(timer); clearInterval(timer)
countTime.value = "重新获取"; countTime.value = '重新获取'
flag.value = true; flag.value = true
} }
}, 1000); }, 1000)
} }
function forget() { function forget() {
loading.value = false; loading.value = false
emit("forget"); emit('forget')
} }
</script> </script>
<template> <template>
<div class="form-login"> <div class="form-login">
<img class="img-close" src="@/assets/images/login/close.png" alt="" @click="close" /> <img class="img-close" src="@/assets/images/login/close.png" alt="" @click="close">
<div class="tab"> <div class="tab">
<div <div
:class="{ 'tab-item-active': tab === 0 }" :class="{ 'tab-item-active': tab === 0 }"
@ -373,7 +378,7 @@ function forget() {
maxlength="20" maxlength="20"
> >
<template #prefix> <template #prefix>
<svg-icon size="20" name="enterprise" /> <SvgIcon size="20" name="enterprise" />
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -385,7 +390,7 @@ function forget() {
maxlength="16" maxlength="16"
> >
<template #prefix> <template #prefix>
<svg-icon size="20" name="account" /> <SvgIcon size="20" name="account" />
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -399,7 +404,7 @@ function forget() {
maxlength="16" maxlength="16"
> >
<template #prefix> <template #prefix>
<svg-icon size="20" name="password" /> <SvgIcon size="20" name="password" />
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -411,8 +416,8 @@ function forget() {
size="large" size="large"
:loading="loading" :loading="loading"
block block
@click="handleSubmit"
:disabled="computedForm()" :disabled="computedForm()"
@click="handleSubmit"
> >
登录 登录
</n-button> </n-button>
@ -446,7 +451,7 @@ function forget() {
placeholder="请输入企业编码" placeholder="请输入企业编码"
> >
<template #prefix> <template #prefix>
<svg-icon size="20" name="enterprise" /> <SvgIcon size="20" name="enterprise" />
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -463,7 +468,7 @@ function forget() {
src="@/assets/images/login/phone.png" src="@/assets/images/login/phone.png"
alt="" alt=""
@click="close" @click="close"
/> >
</template> </template>
</n-input> </n-input>
</n-form-item> </n-form-item>
@ -481,7 +486,7 @@ function forget() {
src="@/assets/images/login/auth.png" src="@/assets/images/login/auth.png"
alt="" alt=""
@click="close" @click="close"
/> >
</template> </template>
<template #suffix> <template #suffix>
<div <div
@ -505,8 +510,8 @@ function forget() {
size="large" size="large"
:loading="loading" :loading="loading"
block block
@click="handleSmsSubmit"
:disabled="computedForm()" :disabled="computedForm()"
@click="handleSmsSubmit"
> >
登录 登录
</n-button> </n-button>

@ -1,36 +1,37 @@
<script lang="ts" setup> <script lang="ts" setup>
import Login from "./components/Login.vue"; import { nextTick, onDeactivated, onMounted, ref } from 'vue'
import Forget from "./components/Forget.vue"; import Login from './components/Login.vue'
import { onMounted, nextTick, ref, onDeactivated } from "vue"; import Forget from './components/Forget.vue'
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
initRem(); initRem()
}); })
window.addEventListener("resize", () => { window.addEventListener('resize', () => {
initRem(); initRem()
}); })
}); })
onDeactivated(() => { onDeactivated(() => {
window.removeEventListener('resize', () => { window.removeEventListener('resize', () => {
}) })
}) })
const show = ref(false); const show = ref(false)
const ifLogin = ref(true); const ifLogin = ref(true)
const initRem = () => { function initRem() {
const designWidth = 1440; const designWidth = 1440
const rempPx = 16; const rempPx = 16
const scale = window.innerWidth / designWidth; const scale = window.innerWidth / designWidth
document.documentElement.style.fontSize = scale * rempPx + "px"; document.documentElement.style.fontSize = `${scale * rempPx}px`
}; }
function showLogin() { function showLogin() {
show.value = true; show.value = true
} }
function close() { function close() {
show.value = false; show.value = false
ifLogin.value = true; ifLogin.value = true
} }
</script> </script>
@ -38,56 +39,84 @@ function close() {
<div class="wrap-login"> <div class="wrap-login">
<div class="content"> <div class="content">
<div class="header f-c-b"> <div class="header f-c-b">
<img class="img-logo" src="@/assets/images/login/logo.png" alt="" /> <img class="img-logo" src="@/assets/images/login/logo.png" alt="">
<div class="btn-login f-c-c" @click="showLogin"></div> <div class="btn-login f-c-c" @click="showLogin">
登录
</div>
</div> </div>
<div class="img-wrap f-s"> <div class="img-wrap f-s">
<img class="img-ai" src="../../assets/images/login/ai.png" alt="" /> <img class="img-ai" src="../../assets/images/login/ai.png" alt="">
<div class="right"> <div class="right">
<div class="f-c"> <div class="f-c">
<img class="img-item" src="../../assets/images/login/img-item-1.png" alt="" /> <img class="img-item" src="../../assets/images/login/img-item-1.png" alt="">
<img class="img-item" src="../../assets/images/login/img-item-2.png" alt="" /> <img class="img-item" src="../../assets/images/login/img-item-2.png" alt="">
<img class="img-item" src="../../assets/images/login/img-item-3.png" alt="" /> <img class="img-item" src="../../assets/images/login/img-item-3.png" alt="">
<img class="img-item" src="../../assets/images/login/img-item-4.png" alt="" /> <img class="img-item" src="../../assets/images/login/img-item-4.png" alt="">
<img class="img-item" src="../../assets/images/login/img-item-5.png" alt="" /> <img class="img-item" src="../../assets/images/login/img-item-5.png" alt="">
</div>
<div class="img-task">
Task approval
</div> </div>
<div class="img-task">Task approval</div>
</div> </div>
</div> </div>
<div class="center-text f-c-b"> <div class="center-text f-c-b">
<img class="img-ip" src="../../assets/images/login/img-ip.png" alt="" /> <img class="img-ip" src="../../assets/images/login/img-ip.png" alt="">
<img class="img-text" src="../../assets/images/login/img-text.png" alt="" /> <img class="img-text" src="../../assets/images/login/img-text.png" alt="">
<img class="img-icon-1" src="../../assets/images/login/img-icon-1.png" alt="" /> <img class="img-icon-1" src="../../assets/images/login/img-icon-1.png" alt="">
</div>
<div class="text">
企业级 SaaS 智能审批解决方案
</div>
<img class="img-icon-2" src="../../assets/images/login/img-icon-2.png" alt="">
<div class="flex btn-login-2 f-c-c" @click="showLogin">
立即登录 <SvgIcon name="right_arrow" class="right_arrow" />
</div> </div>
<div class="text">企业级 SaaS 智能审批解决方案</div>
<img class="img-icon-2" src="../../assets/images/login/img-icon-2.png" alt="" />
<div class="flex btn-login-2 f-c-c" @click="showLogin"> <SvgIcon name="right_arrow" class="right_arrow"/></div>
<div class="item-wrap f-c"> <div class="item-wrap f-c">
<div class="item"> <div class="item">
<img class="item-img" src="../../assets/images/login/item-1.png" alt="" /> <img class="item-img" src="../../assets/images/login/item-1.png" alt="">
<div class="title">AI一键查重</div> <div class="title">
<div class="subtitle">一键查重生成任务包</div> AI一键查重
</div>
<div class="subtitle">
一键查重生成任务包
</div>
</div> </div>
<div class="item"> <div class="item">
<img class="item-img" src="../../assets/images/login/item-2.png" alt="" /> <img class="item-img" src="../../assets/images/login/item-2.png" alt="">
<div class="title">AI工单管理</div> <div class="title">
<div class="subtitle">智能批量辨识真假假图快速审批</div> AI工单管理
</div>
<div class="subtitle">
智能批量辨识真假假图快速审批
</div>
</div> </div>
<div class="item"> <div class="item">
<img class="item-img" src="../../assets/images/login/item-3.png" alt="" /> <img class="item-img" src="../../assets/images/login/item-3.png" alt="">
<div class="title">AI快速审批</div> <div class="title">
<div class="subtitle">智能图片比对批量审批一键确认</div> AI快速审批
</div>
<div class="subtitle">
智能图片比对批量审批一键确认
</div>
</div> </div>
<div class="item"> <div class="item">
<img class="item-img" src="../../assets/images/login/item-4.png" alt="" /> <img class="item-img" src="../../assets/images/login/item-4.png" alt="">
<div class="title">OCR</div> <div class="title">
<div class="subtitle">图片自动识别文档图片版面解析</div> OCR
</div>
<div class="subtitle">
图片自动识别文档图片版面解析
</div>
</div> </div>
<div class="item"> <div class="item">
<img class="item-img" src="../../assets/images/login/item-5.png" alt="" /> <img class="item-img" src="../../assets/images/login/item-5.png" alt="">
<div class="title">更多功能</div> <div class="title">
<div class="subtitle">探索更多功能</div> 更多功能
</div>
<div class="subtitle">
探索更多功能
</div>
</div> </div>
</div> </div>
</div> </div>
@ -95,7 +124,7 @@ function close() {
<Login v-if="ifLogin" @close="close" @forget="ifLogin = !ifLogin" /> <Login v-if="ifLogin" @close="close" @forget="ifLogin = !ifLogin" />
<Forget v-else @close="close" @forget="ifLogin = !ifLogin" /> <Forget v-else @close="close" @forget="ifLogin = !ifLogin" />
</n-modal> </n-modal>
<img class="item-footer" src="../../assets/images/login/footer.png" alt="" /> <img class="item-footer" src="../../assets/images/login/footer.png" alt="">
</div> </div>
</template> </template>

@ -1,77 +1,78 @@
<script> <script>
import { reactive, toRefs, onMounted } from "vue"; import { onMounted, reactive, toRefs } from 'vue'
export default { export default {
components: {},
setup() { setup() {
let state = reactive({}); const state = reactive({})
let methods = { const methods = {
init() { init() {
function getQueryParamsNew() { function getQueryParamsNew() {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search)
let paramsObj = {}; const paramsObj = {}
for (const [key, value] of params.entries()) { for (const [key, value] of params.entries()) {
if (paramsObj.hasOwnProperty(key)) { if (paramsObj.hasOwnProperty(key)) {
if (Array.isArray(paramsObj[key])) { if (Array.isArray(paramsObj[key]))
paramsObj[key].push(value); paramsObj[key].push(value)
} else { else
paramsObj[key] = [paramsObj[key], value]; paramsObj[key] = [paramsObj[key], value]
} }
} else { else {
paramsObj[key] = value; paramsObj[key] = value
} }
} }
return paramsObj; return paramsObj
} }
var queryParamsNew = getQueryParamsNew(); const queryParamsNew = getQueryParamsNew()
state.queryParamsNew = queryParamsNew; state.queryParamsNew = queryParamsNew
const lng = queryParamsNew.lng; // const lng = queryParamsNew.lng //
const lat = queryParamsNew.lat; // const lat = queryParamsNew.lat //
// //
const center = new qq.maps.LatLng(lat, lng); const center = new qq.maps.LatLng(lat, lng)
const map = new qq.maps.Map(document.getElementById("map-container"), { const map = new qq.maps.Map(document.getElementById('map-container'), {
center, center,
zoom: 15, zoom: 15,
}); })
// //
const marker = new qq.maps.Marker({ const marker = new qq.maps.Marker({
position: center, position: center,
map: map, map,
}); })
// //
const infoWin = new qq.maps.InfoWindow({ const infoWin = new qq.maps.InfoWindow({
map: map, map,
position: center, position: center,
}); })
infoWin.setContent( infoWin.setContent(
`<div class="detailshow" >${queryParamsNew.name}</div>` `<div class="detailshow" >${queryParamsNew.name}</div>`,
); )
infoWin.open(); infoWin.open()
qq.maps.event.addListener(marker, "click", function () { qq.maps.event.addListener(marker, 'click', () => {
infoWin.open(); infoWin.open()
infoWin.setContent( infoWin.setContent(
`<div class="detailshow" >${queryParamsNew.name}</div>` `<div class="detailshow" >${queryParamsNew.name}</div>`,
); )
infoWin.setPosition(centerLatLng); infoWin.setPosition(centerLatLng)
}); })
}, },
}; }
onMounted(() => { onMounted(() => {
methods.init(); methods.init()
}); })
return { return {
...toRefs(state), ...toRefs(state),
...methods, ...methods,
}; }
}, },
components: {}, }
};
</script> </script>
<template> <template>
<div class="mapmain"> <div class="mapmain">
<div id="map-container" style="width: 100%; height: 100%"></div> <div id="map-container" style="width: 100%; height: 100%" />
</div> </div>
</template> </template>

@ -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: "审批通知", name: '审批通知',
icon: iconApprove, icon: iconApprove,
activeIcon: iconApproveActive, activeIcon: iconApproveActive,
value: 1, value: 1,
}, },
{ {
name: "系统消息", name: '系统消息',
icon: iconSystem, icon: iconSystem,
activeIcon: iconSystemActive, activeIcon: iconSystemActive,
value: 2, value: 2,
@ -34,127 +34,134 @@ 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(1)
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 +179,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 +195,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 +468,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 } 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,19 @@ 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 type { FilterSearchParam } from "/#/api";
import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
const searchContent = route.query.searchContent as string; 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('')
@ -135,33 +133,35 @@ async function getshowFieldList() {
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) { catch (error) {
return []; return []
} finally { }
finally {
} }
// currentlySelectedAdvanced.value="" // 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 +191,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,27 +206,28 @@ 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("高级筛选"); else {
filterHandler(""); AdvanceFilterRef.value.setCurrentlySelectedAdvanced('高级筛选')
filterHandler('')
}
} }
};
</script> </script>
<template> <template>
@ -259,8 +260,10 @@ 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">
@ -275,8 +278,10 @@ const handleOk = (item: any) => {
<!-- 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>

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { format } from 'date-fns' import { format } from 'date-fns'
import { computed,watch ,ref} from 'vue' import { computed, ref, watch } from 'vue'
defineOptions({ name: 'ListItem' }) defineOptions({ name: 'ListItem' })

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from "vue"; import { ref, watch } from 'vue'
import * as XLSX from "xlsx"; import * as XLSX from 'xlsx'
defineProps({ defineProps({
data: { data: {
@ -11,21 +11,23 @@ defineProps({
type: Array as any, type: Array as any,
default: () => [[]], default: () => [[]],
}, },
}); })
const emit = defineEmits(["showModal", "getrowValue"]); const emit = defineEmits(['showModal', 'getrowValue'])
function showActionsModal() { function showActionsModal() {
emit("showModal"); emit('showModal')
} }
function getrowvalue(row) { function getrowvalue(row) {
emit("getrowValue", row); emit('getrowValue', row)
} }
</script> </script>
<template> <template>
<div class="info-header"> <div class="info-header">
<div class="left_box"> <div class="left_box">
<div class="title">填报信息</div> <div class="title">
填报信息
</div>
</div> </div>
<div class="right_box" @click="showActionsModal"> <div class="right_box" @click="showActionsModal">
自定义设置 自定义设置
@ -42,9 +44,8 @@ function getrowvalue(row) {
:class="item[0].blue ? 'blue' : ''" :class="item[0].blue ? 'blue' : ''"
@click="getrowvalue(item[0])" @click="getrowvalue(item[0])"
> >
<span :style="item[0].label == '定位信息'?{cursor:'pointer'}:{}" v-show="item[0].label == '定位信息'"> <span v-show="item[0].label == '定位信息'" :style="item[0].label == '定位信息' ? { cursor: 'pointer' } : {}">
<SvgIcon class="icon" size="16" name="lctname" <SvgIcon class="icon" size="16" name="lctname" /></span>
/></span>
<span :style="item[0].label == '定位信息' ? { cursor: 'pointer' } : {}"> {{ item[0].value }}</span> <span :style="item[0].label == '定位信息' ? { cursor: 'pointer' } : {}"> {{ item[0].value }}</span>
</td> </td>
<th v-if="item && item.length > 1"> <th v-if="item && item.length > 1">
@ -55,7 +56,7 @@ function getrowvalue(row) {
:class="item[1].blue ? 'blue' : ''" :class="item[1].blue ? 'blue' : ''"
@click="getrowvalue(item[1])" @click="getrowvalue(item[1])"
> >
<span :style="item[0].label == '定位信息'?{cursor:'pointer'}:{}" v-show="item[1].label == '定位信息'"> <span v-show="item[1].label == '定位信息'" :style="item[0].label == '定位信息' ? { cursor: 'pointer' } : {}">
<SvgIcon class="icon" size="16" name="lctname" /> <SvgIcon class="icon" size="16" name="lctname" />
</span> </span>
<span :style="item[1].label == '定位信息' ? { cursor: 'pointer' } : {}"> {{ item[1].value }}</span> <span :style="item[1].label == '定位信息' ? { cursor: 'pointer' } : {}"> {{ item[1].value }}</span>

@ -1,14 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from 'vue'
import Aside from "./aside/Aside.vue"; import Aside from './aside/Aside.vue'
import Content from "./content/Content.vue"; import Content from './content/Content.vue'
import DataHeader from "@/components/DataHeader/index.vue"; import DataHeader from '@/components/DataHeader/index.vue'
import Robot from '@/components/Robot/index.vue' import Robot from '@/components/Robot/index.vue'
const asideRef: any = ref(null); const asideRef: any = ref(null)
function setAsideItemName(text) { function setAsideItemName(text) {
asideRef.value.setAsideItemName(text); asideRef.value.setAsideItemName(text)
} }
</script> </script>

@ -254,19 +254,16 @@ function afterLeave() {
onMounted(() => { onMounted(() => {
show.value && addListeners() show.value && addListeners()
window.addEventListener("keydown", handleKeydown); window.addEventListener('keydown', handleKeydown)
}) })
// //
function handleKeydown(event) { function handleKeydown(event) {
// //
if (event.keyCode === 67) { if (event.keyCode === 67)
show.value = false show.value = false
// batchModalRef.value.closeModal() // batchModalRef.value.closeModal()
} }
}
function showModal(value) { function showModal(value) {
taskId.value = value taskId.value = value
refreshHandler() refreshHandler()
@ -408,7 +405,8 @@ const gridHeight = computed(() => {
defineExpose({ defineExpose({
showModal, showModal,
reload,closeModal reload,
closeModal,
}) })
</script> </script>

@ -65,11 +65,8 @@ onBeforeMount(async () => {
async function selectChange(id) { async function selectChange(id) {
console.log(id, 'selectChange') console.log(id, 'selectChange')
selectItem.value = reasonOptions.value.find(v=>v.id == id); selectItem.value = reasonOptions.value.find(v => v.id == id)
} }
</script> </script>
<template> <template>
@ -86,22 +83,19 @@ async function selectChange(id){
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>处理方式</span> <span>处理方式</span>
<n-select filterable v-model:value="selectBackId" style="margin-top: 10px;" :options="backOptions" /> <n-select v-model:value="selectBackId" filterable style="margin-top: 10px;" :options="backOptions" />
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>不通过原因</span> <span>不通过原因</span>
<n-select filterable v-model:value="selectRejectId" @change="selectChange" style="margin-top: 10px;" :options="reasonOptions" /> <n-select v-model:value="selectRejectId" filterable style="margin-top: 10px;" :options="reasonOptions" @change="selectChange" />
<n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" /> <n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" />
</div> </div>
<!-- <div class="wrapper-content"> <!-- <div class="wrapper-content">
<n-input <n-input
type="textarea" type="textarea"
placeholder="备注内容" v-model="showOther"></n-input> placeholder="备注内容" v-model="showOther"></n-input>
</div> --> </div> -->
</div> </div>
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">

@ -1,12 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { cloneDeep, difference } from "lodash-es"; import { cloneDeep, difference } from 'lodash-es'
import { computed, defineEmits, defineProps, onMounted, ref, watch } from "vue"; import { computed, defineEmits, defineProps, onMounted, 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 { useMessage } from 'naive-ui'
import { workPackageMap } from "@/config/workorder"; import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import { useUser } from "@/store/modules/user"; import { workPackageMap } from '@/config/workorder'
import { useMessage } from "naive-ui"; import { useUser } from '@/store/modules/user'
const message = useMessage();
const props = defineProps({ const props = defineProps({
reviewType: { reviewType: {
@ -14,352 +13,370 @@ const props = defineProps({
default: () => 1, default: () => 1,
require: true, require: true,
}, },
}); })
const emit = defineEmits(["onOk"]); const emit = defineEmits(['onOk'])
const message = useMessage()
// //
const offList = ref<any[]>([]); const offList = ref<any[]>([])
// //
const onList = ref<any[]>([]); const onList = ref<any[]>([])
// //
const fixList = ref<any[]>([]); const fixList = ref<any[]>([])
const offShowList = ref<any[]>([]); const offShowList = ref<any[]>([])
const onShowList = ref<any[]>([]); const onShowList = ref<any[]>([])
const fixShowList = ref<any[]>([]); const fixShowList = ref<any[]>([])
const allCount = computed(() => { const allCount = computed(() => {
return `全部字段(共${offList.value.length - 1}个)`; return `全部字段(共${offList.value.length - 1}个)`
}); })
const selectCount = computed(() => { const selectCount = computed(() => {
return `显示字段(共${onList.value.length}个)`; return `显示字段(共${onList.value.length}个)`
}); })
function generatList() { function generatList() {
const keys = Object.keys(workPackageMap); const keys = Object.keys(workPackageMap)
let showList: object[] = []; let showList: object[] = []
const hideList: object[] = []; const hideList: object[] = []
const showStr = "status"; const showStr = 'status'
const showKeys = showStr.split(",").map((key: string) => key.toLowerCase()); const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
for (const key of keys) { for (const key of keys) {
const name = workPackageMap[key]?.label; const name = workPackageMap[key]?.label
const isDefault = workPackageMap[key]?.isDefault; const isDefault = workPackageMap[key]?.isDefault
// Y // Y
if (!isDefault) { if (!isDefault) {
hideList.push({ hideList.push({
id: key, id: key,
name: name || "未配置", name: name || '未配置',
fix: isDefault, fix: isDefault,
checked: workPackageMap[key].isDefault, checked: workPackageMap[key].isDefault,
}); })
} }
} }
showList = showKeys.reduce((acc, key) => { showList = showKeys.reduce((acc, key) => {
const config = { const config = {
id: key, id: key,
name: workPackageMap[key].label || "未配置", name: workPackageMap[key].label || '未配置',
fix: workPackageMap[key].isDefault, fix: workPackageMap[key].isDefault,
}; }
return [...acc, config]; return [...acc, config]
}, []); }, [])
const fixedList = generateDefaultList(); const fixedList = generateDefaultList()
hideList.unshift(...fixedList); hideList.unshift(...fixedList)
showList.unshift(...fixedList); showList.unshift(...fixedList)
onList.value = showList; onList.value = showList
offList.value = hideList; offList.value = hideList
return { showList, hideList }; return { showList, hideList }
} }
function generateDefaultList() { function generateDefaultList() {
return Object.keys(workPackageMap).reduce((acc, key) => { return Object.keys(workPackageMap).reduce((acc, key) => {
const { label, isDefault } = workPackageMap[key]; const { label, isDefault } = workPackageMap[key]
if (isDefault) { if (isDefault) {
const config = { const config = {
id: key, id: key,
name: label || "未配置", name: label || '未配置',
fix: true, fix: true,
checked: true, checked: true,
};
return [...acc, config];
} else {
return acc;
} }
}, []); 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.map((v) => {
if (v.fix) baseNum += 1; if (v.fix)
}); baseNum += 1
return onList.value.length == offList.value.length - baseNum; })
}); return onList.value.length == offList.value.length - baseNum
})
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let userFieldFixed = ""; let userFieldFixed = ''
fixList.value.map((v) => { fixList.value.map((v) => {
userFieldFixed += `${v.id},`; userFieldFixed += `${v.id},`
}); })
onList.value.map((v) => { onList.value.map((v) => {
userFieldFixed += `${v.id},`; userFieldFixed += `${v.id},`
}); })
userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1); userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1)
savefield(props.reviewType, userInfo.id, userFieldFixed); savefield(props.reviewType, userInfo.id, userFieldFixed)
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
emit("onOk"); emit('onOk')
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
// generatList(); // generatList();
const selectIds = ref<string[]>([]); const selectIds = ref<string[]>([])
function onCheckAllChange(value) { function onCheckAllChange(value) {
const ids: string[] = []; const ids: string[] = []
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)
} }
} }
for (const item of offShowList.value) { for (const item of offShowList.value) {
if (!item.fix) item.checked = value; if (!item.fix)
item.checked = value
} }
selectIds.value = value ? ids : [];
selectIds.value = value ? ids : []
if (value) { if (value) {
offList.value.map((v) => { offList.value.map((v) => {
if (!v.checked) onList.value.push(v); if (!v.checked)
}); onList.value.push(v)
onShowList.value = cloneDeep(onList.value); })
} else { onShowList.value = cloneDeep(onList.value)
onList.value = []; }
onShowList.value = []; else {
onList.value = []
onShowList.value = []
} }
} }
function onCheckChange(checked: any, item: any) { function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id); const index = selectIds.value.indexOf(item.id)
// TODO // TODO
// if (index == -1 && selectIds.value.length >= 6) { // if (index == -1 && selectIds.value.length >= 6) {
// item.checked = false; // item.checked = false;
// message.error("6"); // message.error("6");
// return; // return;
// } // }
item.checked = checked; item.checked = checked
const currentIndex = offList.value.findIndex((v) => v.id == item.id); const currentIndex = offList.value.findIndex(v => v.id == item.id)
offList.value[currentIndex].checked = checked; offList.value[currentIndex].checked = checked
if (index === -1 && checked) { if (index === -1 && checked)
selectIds.value.push(item.id); selectIds.value.push(item.id)
} else { else
selectIds.value.splice(index, 1); selectIds.value.splice(index, 1)
}
} }
const showIds = computed(() => { const showIds = computed(() => {
return onList.value.map((item) => { return onList.value.map((item) => {
return item.id; return item.id
}); })
}); })
watch( watch(
() => selectIds.value.length, () => selectIds.value.length,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal === oldVal) return; if (newVal === oldVal)
return
const action = newVal > oldVal ? "add" : "remove"; const action = newVal > oldVal ? 'add' : 'remove'
const diff = const diff
action === "add" = action === 'add'
? difference(selectIds.value, showIds.value) ? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value); : difference(showIds.value, selectIds.value)
if (diff.length === 0) return; if (diff.length === 0)
return
if (action === "add") { if (action === 'add') {
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
onList.value.push({ onList.value.push({
id: item.id, id: item.id,
name: item.name || "未配置", name: item.name || '未配置',
fix: item.fix || false, fix: item.fix || false,
}); })
} }
} }
onShowList.value = cloneDeep(onList.value); onShowList.value = cloneDeep(onList.value)
} else { }
const list = onList.value; else {
const list = onList.value
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
const item = list[index]; const item = list[index]
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
list.splice(index, 1); list.splice(index, 1)
onShowList.value.splice(index, 1); onShowList.value.splice(index, 1)
index--; index--
}
} }
console.log(onShowList.value, list, "onShowList");
} }
console.log(onShowList.value, list, 'onShowList')
} }
); },
)
watch( watch(
() => showIds.value.length, () => showIds.value.length,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal === oldVal) return; if (newVal === oldVal)
return
const diff = difference(selectIds.value, showIds.value); const diff = difference(selectIds.value, showIds.value)
if (diff.length === 0) return; if (diff.length === 0)
return
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
const index = selectIds.value.indexOf(item.id); const index = selectIds.value.indexOf(item.id)
item.checked = false; item.checked = false
selectIds.value.splice(index, 1); selectIds.value.splice(index, 1)
}
} }
} }
); },
)
function clearDragSource() { function clearDragSource() {
onList.value = onList.value.filter((item) => { onList.value = onList.value.filter((item) => {
return item.fix === true; return item.fix === true
}); })
onShowList.value = cloneDeep(onList.value); onShowList.value = cloneDeep(onList.value)
} }
function removeHandler(id: string) { function removeHandler(id: string) {
let index = onList.value.findIndex((item) => { let index = onList.value.findIndex((item) => {
return item.id === id; return item.id === id
}); })
if (index !== -1) { if (index !== -1) {
onList.value.splice(index, 1); onList.value.splice(index, 1)
onShowList.value.splice(index, 1); onShowList.value.splice(index, 1)
} }
index = offList.value.findIndex((v) => v.id == id); index = offList.value.findIndex(v => v.id == id)
offList.value[index].checked = false; offList.value[index].checked = false
offShowList.value = cloneDeep(offList.value); offShowList.value = cloneDeep(offList.value)
} }
function initData() { function initData() {
offList.value = []; offList.value = []
onList.value = []; onList.value = []
fixList.value = []; fixList.value = []
offShowList.value = []; offShowList.value = []
onShowList.value = []; onShowList.value = []
fixShowList.value = []; fixShowList.value = []
selectIds.value = []; selectIds.value = []
} }
async function getData(type = "") { async function getData(type = '') {
initData(); initData()
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let res; let res
res = await getAllfieldList(props.reviewType); // res = await getAllfieldList(props.reviewType) //
const allList = res.data; const allList = res.data
res = await getfieldList(props.reviewType, userInfo.id); // res = await getfieldList(props.reviewType, userInfo.id) //
const useList = res.data; const useList = res.data
/** /**
* name 标题 * name 标题
* id 键值 * id 键值
* fix 是否默认 * fix 是否默认
* checked 是否选中 * checked 是否选中
*/ */
const userFieldFixed = useList?.userFieldFixed?.split(","); const userFieldFixed = useList?.userFieldFixed?.split(',')
const userFieldUnFixed = useList?.userFieldUnFixed?.split(","); const userFieldUnFixed = useList?.userFieldUnFixed?.split(',')
if (!type || type == "off") { if (!type || type == 'off') {
offList.value = []; offList.value = []
allList?.map((v) => { allList?.map((v) => {
const item = { const item = {
name: v.fieldDesc, name: v.fieldDesc,
id: v.name, id: v.name,
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2
Boolean(userFieldFixed?.find((v2) => v2 == v.name)) || || Boolean(userFieldFixed?.find(v2 => v2 == v.name))
Boolean(userFieldUnFixed?.find((v2) => v2 == v.name)), || Boolean(userFieldUnFixed?.find(v2 => v2 == v.name)),
}; }
if (item.fix) fixList.value.push(item); if (item.fix)
else offList.value.push(item); fixList.value.push(item)
}); else offList.value.push(item)
offList.value.unshift(...fixList.value); })
} offList.value.unshift(...fixList.value)
if (!type || type == "on") { }
useList?.userFieldFixed?.split(",").map((v) => { if (!type || type == 'on') {
let item = allList.find((v2) => v2.name == v); useList?.userFieldFixed?.split(',').map((v) => {
let item = allList.find(v2 => v2.name == v)
if (item) { if (item) {
item = { item = {
name: item.fieldDesc, name: item.fieldDesc,
id: item.name, id: item.name,
fix: item.isrequired == 2, fix: item.isrequired == 2,
checked: true, checked: true,
};
selectIds.value.push(item.id);
if (!item.fix) onList.value.push(item);
} }
}); selectIds.value.push(item.id)
if (!item.fix)
onList.value.push(item)
} }
offShowList.value = cloneDeep(offList.value); })
fixShowList.value = cloneDeep(fixList.value); }
onShowList.value = cloneDeep(onList.value); offShowList.value = cloneDeep(offList.value)
fixShowList.value = cloneDeep(fixList.value)
onShowList.value = cloneDeep(onList.value)
} }
onMounted(() => getData()); onMounted(() => getData())
const indeterminate = computed(() => { const indeterminate = computed(() => {
let baseNum = 0; let baseNum = 0
offList.value.map((v) => { offList.value.map((v) => {
if (v.fix) baseNum += 1; if (v.fix)
}); baseNum += 1
})
return ( return (
onShowList.value.length > 0 && onShowList.value.length > 0
offShowList.value.length - baseNum > onShowList.value.length && offShowList.value.length - baseNum > onShowList.value.length
); )
}); })
function queryData(value, type) { function queryData(value, type) {
if (value) { if (value) {
if (type == "off") { if (type == 'off') {
offShowList.value = offList.value.filter((item) => item.name.includes(value)); offShowList.value = offList.value.filter(item => item.name.includes(value))
} else { }
onShowList.value = onList.value.filter((item) => item.name.includes(value)); else {
fixShowList.value = fixList.value.filter((item) => item.name.includes(value)); onShowList.value = onList.value.filter(item => item.name.includes(value))
fixShowList.value = fixList.value.filter(item => item.name.includes(value))
} }
} else { }
else {
// getData(type); // getData(type);
if (type == "off") { if (type == 'off') {
offShowList.value = cloneDeep(offList.value); offShowList.value = cloneDeep(offList.value)
} else { }
onShowList.value = cloneDeep(onList.value); else {
fixShowList.value = cloneDeep(fixList.value); onShowList.value = cloneDeep(onList.value)
fixShowList.value = cloneDeep(fixList.value)
} }
} }
} }
const moreThanSix = computed(() => { const moreThanSix = computed(() => {
return selectIds.value.length >= 6; return selectIds.value.length >= 6
}); })
</script> </script>
<template> <template>
@ -445,7 +462,9 @@ const moreThanSix = computed(() => {
<SvgIcon size="14px" name="magnifying-1" /> <SvgIcon size="14px" name="magnifying-1" />
</template> </template>
</n-input> </n-input>
<div class="draggable-title">系统默认</div> <div class="draggable-title">
系统默认
</div>
<div class="draggable-ul" style="border-bottom: none"> <div class="draggable-ul" style="border-bottom: none">
<div <div
v-for="item in fixShowList" v-for="item in fixShowList"
@ -456,7 +475,9 @@ const moreThanSix = computed(() => {
<span class="ml-2">{{ item.name }}</span> <span class="ml-2">{{ item.name }}</span>
</div> </div>
</div> </div>
<div class="draggable-title" style="border-top: none">自定义配置</div> <div class="draggable-title" style="border-top: none">
自定义配置
</div>
<VueDraggable <VueDraggable
v-model="onList" v-model="onList"
class="draggable-ul" class="draggable-ul"
@ -487,7 +508,9 @@ const moreThanSix = computed(() => {
</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 <n-button
secondary secondary
style="margin-left: 15px" style="margin-left: 15px"

@ -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,8 +290,7 @@ 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">
@ -299,14 +299,14 @@ defineExpose({
<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 +319,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 +341,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!)"
@ -367,7 +367,9 @@ defineExpose({
</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>

@ -11,6 +11,7 @@ import {
unref, unref,
watch, watch,
} from 'vue' } from 'vue'
import { useRoute } 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'
@ -18,14 +19,12 @@ import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
import { useUser } from '@/store/modules/user' import { useUser } from '@/store/modules/user'
import { useWorkOrder } from '@/store/modules/workOrder' import { useWorkOrder } from '@/store/modules/workOrder'
import { getViewportOffset } from '@/utils/domUtils' import { getViewportOffset } from '@/utils/domUtils'
import { useRoute } from 'vue-router'
const route = useRoute()
const searchContent = route.query.searchContent;
console.log(searchContent);
defineOptions({ name: 'AsideContent' }) defineOptions({ name: 'AsideContent' })
const emit = defineEmits(['ApprovalOver']) const emit = defineEmits(['ApprovalOver'])
const route = useRoute()
const searchContent = route.query.searchContent
console.log(searchContent)
const collapse = ref(false) const collapse = ref(false)
const workStore = useWorkOrder() const workStore = useWorkOrder()
const filterModalRef = ref(null) const filterModalRef = ref(null)
@ -40,7 +39,7 @@ function collapseHandler() {
const mousetrap = inject('mousetrap') as any const mousetrap = inject('mousetrap') as any
mousetrap.bind('[', collapseHandler) mousetrap.bind('[', collapseHandler)
const searchKeyword = ref(searchContent ? searchContent : '') const searchKeyword = ref(searchContent || '')
const asideWidth = computed(() => { const asideWidth = computed(() => {
return collapse.value ? 0 : 308 return collapse.value ? 0 : 308
@ -183,14 +182,18 @@ if (searchContent) {
<span style="margin-left: 8px; color: #333333">所有任务包</span> <span style="margin-left: 8px; color: #333333">所有任务包</span>
</div> </div>
<div class="right"> <div class="right">
<SvgIcon style="cursor: pointer; margin-left: 10px" size="18" name="magnifying-1" <SvgIcon
@click="setShowSearch(true)" /> style="cursor: pointer; margin-left: 10px" size="18" name="magnifying-1"
@click="setShowSearch(true)"
/>
<SvgIcon style="cursor: pointer; margin-left: 10px" size="18" name="filter" @click="showFilter" /> <SvgIcon style="cursor: pointer; margin-left: 10px" size="18" name="filter" @click="showFilter" />
</div> </div>
</div> </div>
<div v-show="showSearch" class="warpper"> <div v-show="showSearch" class="warpper">
<n-input v-model:value="searchKeyword" style="flex: 1; height: 32px" placeholder="请输入你需要搜索的内容" <n-input
@input="inputHandler"> v-model:value="searchKeyword" 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>
@ -198,8 +201,10 @@ if (searchContent) {
<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>
<WorkSheetList ref="packageListRef" class="work-sheet-list" :show-field-list="showFieldList" :dicts="dicts" <WorkSheetList
@approval-over="ApprovalOver" /> ref="packageListRef" class="work-sheet-list" :show-field-list="showFieldList" :dicts="dicts"
@approval-over="ApprovalOver"
/>
<CustomFieldModalVue ref="filterModalRef" :review-type="1" @on-ok="getshowFieldList" /> <CustomFieldModalVue ref="filterModalRef" :review-type="1" @on-ok="getshowFieldList" />
</div> </div>
</template> </template>

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { format } from 'date-fns' import { format } from 'date-fns'
import { computed, onMounted, ref, watch } from 'vue' import { computed, onMounted, ref } from 'vue'
import type { PackageListItem } from '/#/workorder' import type { PackageListItem } from '/#/workorder'
import { useDialog } from 'naive-ui' import { useDialog } from 'naive-ui'
@ -24,7 +24,7 @@ const props = defineProps({
}, },
mouseOverTask: { mouseOverTask: {
type: Object, type: Object,
default: () => [], default: () => {},
}, },
}) })
const emit = defineEmits(['dismisClick']) const emit = defineEmits(['dismisClick'])
@ -57,9 +57,6 @@ function handleDismissTask() {
}) })
popconfirmRef.value[0]?.setShow(false) // popconfirm popconfirmRef.value[0]?.setShow(false) // popconfirm
} }
watch(() => props.mouseOverTask, (value) => {
console.log(props)
})
onMounted(async () => { onMounted(async () => {
}) })
@ -111,7 +108,7 @@ onMounted(async () => {
</li> </li>
<li v-else-if="item.id === 'createTime'"> <li v-else-if="item.id === 'createTime'">
生成时间<n-ellipsis style="max-width: 170px"> 生成时间<n-ellipsis style="max-width: 170px">
{{ listItem.createTime && format(listItem.createTime, "yyyy-MM-dd HH:mm:ss") || '全部' }} {{ listItem.createTime && format(listItem.createTime as unknown as (number | Date), "yyyy-MM-dd HH:mm:ss") || '全部' }}
</n-ellipsis> </n-ellipsis>
</li> </li>
<li v-else-if="item.id === 'submit_date_timestamp'"> <li v-else-if="item.id === 'submit_date_timestamp'">

@ -6,22 +6,22 @@
</n-spin> </n-spin>
--> -->
<script lang="ts" setup> <script lang="ts" setup>
import { audit } from '@/api/task/task'; import { audit } from '@/api/task/task'
import { import {
getPictureSimilarityList getPictureSimilarityList,
} from "@/api/work/work"; } from '@/api/work/work'
import NotPassed from '@/components/Approval/NotPassed.vue'; import NotPassed from '@/components/Approval/NotPassed.vue'
import { useWorkOrder } from "@/store/modules/workOrder"; import { useWorkOrder } from '@/store/modules/workOrder'
import { isEmpty } from "@/utils"; import { isEmpty } from '@/utils'
import { formatToDateHMS } from "@/utils/dateUtil"; import { formatToDateHMS } from '@/utils/dateUtil'
import emitter from '@/utils/mitt'; import emitter from '@/utils/mitt'
import { useInfiniteScroll } from "@vueuse/core"; import { useInfiniteScroll } from '@vueuse/core'
import imagesloaded from "imagesloaded"; import imagesloaded from 'imagesloaded'
import { clone, debounce } from "lodash-es"; import { clone, debounce } from 'lodash-es'
import { useDialog, useMessage } from "naive-ui"; import { useDialog, useMessage } from 'naive-ui'
import { onMounted, onUnmounted, onUpdated, reactive, ref, toRefs, unref, watch } from "vue"; import { onMounted, onUnmounted, onUpdated, reactive, ref, toRefs, unref, watch } from 'vue'
import ConfrimModal from "../modal/ConfrimModal.vue"; import ConfrimModal from '../modal/ConfrimModal.vue'
import type { ApprovalParam, SimilarityPictureSortParam } from "/#/api"; import type { ApprovalParam, SimilarityPictureSortParam } from '/#/api'
const props = defineProps({ const props = defineProps({
taskDetailInfo: { taskDetailInfo: {
@ -36,7 +36,7 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: () => (false), default: () => (false),
}, },
}); })
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'toggle', loading: boolean) (e: 'toggle', loading: boolean)
@ -44,169 +44,167 @@ const emit = defineEmits<{
const { taskDetailInfo, el, loading } = toRefs(props) const { taskDetailInfo, el, loading } = toRefs(props)
const batch = ref(false); // const batch = ref(false) //
const selectItems = ref<any[]>([]); const selectItems = ref<any[]>([])
const message = useMessage(); const message = useMessage()
const dialog = useDialog(); const dialog = useDialog()
const totalCount = ref(0); const totalCount = ref(0)
let _imagesload: any; let _imagesload: any
function setBatch(value: boolean) { function setBatch(value: boolean) {
if (value && batch.value) { if (value && batch.value)
batch.value = !value; batch.value = !value
} else { else
batch.value = value; batch.value = value
}
if (value === false) { if (value === false) {
selectItems.value.forEach((item) => (item.checked = false)); selectItems.value.forEach(item => (item.checked = false))
selectItems.value.length = 0; selectItems.value.length = 0
} }
} }
function onCheckChange(checked: any, item: any) { function onCheckChange(checked: any, item: any) {
const index = selectItems.value.indexOf(item); const index = selectItems.value.indexOf(item)
item.checked = checked; item.checked = checked
if (index === -1 && checked) selectItems.value.push(item); if (index === -1 && checked)
else selectItems.value.splice(index, 1); selectItems.value.push(item)
else selectItems.value.splice(index, 1)
} }
const taskpagination = reactive({ const taskpagination = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
}); })
const sortBy: SimilarityPictureSortParam = { const sortBy: SimilarityPictureSortParam = {
orderType: "desc", orderType: 'desc',
orderName: "similarityScore", orderName: 'similarityScore',
}; }
const workStore = useWorkOrder(); const workStore = useWorkOrder()
const selectTask = ref<any>(null); const selectTask = ref<any>(null)
const overTask = ref<any>(null); const overTask = ref<any>(null)
const confrimModalRef = ref(null); const confrimModalRef = ref(null)
const listData = ref<any[]>([]); const listData = ref<any[]>([])
const selectedSortName = ref(''); const selectedSortName = ref('')
const notPassModalRef = ref(null) const notPassModalRef = ref(null)
const canLoadMore = ref(true); const canLoadMore = ref(true)
let processItems: any[] = []; let processItems: any[] = []
function validate(items: any[]) { function validate(items: any[]) {
if (items.length === 0) return "至少选中一个任务"; if (items.length === 0)
return '至少选中一个任务'
return null; return null
} }
function reset() { function reset() {
taskpagination.pageNo = 0; taskpagination.pageNo = 0
taskpagination.pageSize = 20; taskpagination.pageSize = 20
listData.value.length = 0; listData.value.length = 0
emit('toggle', false) emit('toggle', false)
canLoadMore.value = true; canLoadMore.value = true
} }
async function refreshHandler() { async function refreshHandler() {
reset(); reset()
console.log('refreshHandler')
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
console.log(el) loadMore()
console.log(11111111)
loadMore();
}, },
{ distance: 10, interval: 1500, canLoadMore: () => canLoadMore.value } { distance: 10, interval: 1500, canLoadMore: () => canLoadMore.value },
); )
} }
async function loadMore() { async function loadMore() {
if (loading.value || el.value == null) return; if (loading.value || el.value == null)
const more = await fetchList(); return
listData.value.push(...more); const more = await fetchList()
listData.value.push(...more)
} }
async function fetchList() { async function fetchList() {
console.log(3333)
emit('toggle', true) emit('toggle', true)
try { try {
taskpagination.pageNo += 1; taskpagination.pageNo += 1
const { data, total, pageCount } = await getPictureSimilarityList( const { data, total, pageCount } = await getPictureSimilarityList(
{ ...taskpagination, ...sortBy, checkDuplicateId: workStore.activeId, pictureId: taskDetailInfo.value.id } { ...taskpagination, ...sortBy, checkDuplicateId: workStore.activeId, pictureId: taskDetailInfo.value.id },
); )
totalCount.value = total; totalCount.value = total
canLoadMore.value = pageCount >= taskpagination.pageNo && pageCount > 0; canLoadMore.value = pageCount >= taskpagination.pageNo && pageCount > 0
return data; return data
} catch (error) { }
canLoadMore.value = false; catch (error) {
return []; canLoadMore.value = false
return []
} }
} }
const layout = debounce(() => { const layout = debounce(() => {
if (el.value == null) return; if (el.value == null)
return
_imagesload = imagesloaded(".grid-item"); _imagesload = imagesloaded('.grid-item')
_imagesload.on("done", (instance) => { _imagesload.on('done', (instance) => {
if (!el.value) return; if (!el.value)
return
emit('toggle', false) emit('toggle', false)
}); })
_imagesload.on("fail", (instance) => { _imagesload.on('fail', (instance) => {
message.error("图片错误"); message.error('图片错误')
emit('toggle', false) emit('toggle', false)
}); })
}, 300); }, 300)
watch( watch(
() => taskDetailInfo.value.id, () => taskDetailInfo.value.id,
async (newValue, oldValue) => { async (newValue, oldValue) => {
if (newValue !== oldValue) { if (newValue !== oldValue) {
if (isEmpty(taskDetailInfo.value.id)) { if (isEmpty(taskDetailInfo.value.id)) {
listData.value.length = 0; listData.value.length = 0
totalCount.value = 0; totalCount.value = 0
return; return
} }
refreshHandler() refreshHandler()
} }
}, { deep: true, immediate: true } },
); { deep: true, immediate: true },
)
// //
async function handleSelect(item: any) { async function handleSelect(item: any) {
const packageid = workStore.getActiveId; const packageid = workStore.getActiveId
if (isEmpty(packageid)) { if (isEmpty(packageid)) {
listData.value.length = 0; listData.value.length = 0
totalCount.value = 0; totalCount.value = 0
return;
} }
} }
async function sortHandler(orderby: "similarityScore" | "createdate") { async function sortHandler(orderby: 'similarityScore' | 'createdate') {
selectedSortName.value = orderby; selectedSortName.value = orderby
sortBy.orderName = orderby; sortBy.orderName = orderby
sortBy.orderType = sortBy.orderType === "asc" ? "desc" : "asc"; sortBy.orderType = sortBy.orderType === 'asc' ? 'desc' : 'asc'
refreshHandler(); refreshHandler()
} }
function overTaskHandelr(item: any) { function overTaskHandelr(item: any) {
if (item?.historyStates === 2 || item?.historyStates == 3) { if (item?.historyStates === 2 || item?.historyStates == 3) {
overTask.value = null; overTask.value = null
return; return
} }
if (validate([item]) == null && batch.value === false) overTask.value = item; if (validate([item]) == null && batch.value === false)
overTask.value = item
} }
function leaveTaskHandler() { function leaveTaskHandler() {
overTask.value = null; overTask.value = null
} }
function singleRejectHandler(item) { function singleRejectHandler(item) {
const modal = unref(notPassModalRef)! as any const modal = unref(notPassModalRef)! as any
modal.showModal([item]) modal.showModal([item])
@ -272,7 +270,7 @@ function doAudit(param: any) {
emitter.emit('refresh') emitter.emit('refresh')
refreshHandler() refreshHandler()
} }
else message.error(res.message) else { message.error(res.message) }
}) })
} }
@ -301,12 +299,12 @@ onMounted(async () => {
}) })
onUpdated(() => { onUpdated(() => {
layout(); layout()
}); })
onUnmounted(() => { onUnmounted(() => {
workStore.reset(); workStore.reset()
}); })
</script> </script>
<template> <template>
@ -314,31 +312,36 @@ onUnmounted(() => {
<div style="display: flex; justify-content: space-between; padding: 12px 0px 3px 0"> <div style="display: flex; justify-content: space-between; padding: 12px 0px 3px 0">
<div> <div>
<span <span
style="font-size: 18px; font-weight: Medium;color: #333333;font-family: PingFang SC, PingFang SC-Medium;">任务包图片</span> style="font-size: 18px; font-weight: Medium;color: #333333;font-family: PingFang SC, PingFang SC-Medium;"
>任务包图片</span>
</div> </div>
<div style="display: flex; align-items: center;font-size: 14px;margin-right: 25px;color:#323233"> <div style="display: flex; align-items: center;font-size: 14px;margin-right: 25px;color:#323233">
<div style="cursor: pointer" @click="sortHandler('createdate')"> <div style="cursor: pointer" @click="sortHandler('createdate')">
<span>时间排序</span> <span>时间排序</span>
<SvgIcon style="margin-left: 5px" name="sort" size="12" v-show="selectedSortName !== 'createdate'" /> <SvgIcon v-show="selectedSortName !== 'createdate'" style="margin-left: 5px" name="sort" size="12" />
<SvgIcon style="margin-left: 5px" name="active-sort" size="12" v-show="selectedSortName === 'createdate'" /> <SvgIcon v-show="selectedSortName === 'createdate'" style="margin-left: 5px" name="active-sort" size="12" />
</div> </div>
<div style="margin-left: 15px; cursor: pointer" @click="sortHandler('similarityScore')"> <div style="margin-left: 15px; cursor: pointer" @click="sortHandler('similarityScore')">
<span>相似度排序</span> <span>相似度排序</span>
<SvgIcon style="margin-left: 5px" name="sort" size="12" v-show="selectedSortName !== 'similarityScore'" /> <SvgIcon v-show="selectedSortName !== 'similarityScore'" style="margin-left: 5px" name="sort" size="12" />
<SvgIcon style="margin-left: 5px" name="active-sort" size="12" <SvgIcon
v-show="selectedSortName === 'similarityScore'" /> v-show="selectedSortName === 'similarityScore'" style="margin-left: 5px" name="active-sort"
size="12"
/>
</div> </div>
</div> </div>
</div> </div>
<div class="wrapper-list"> <div class="wrapper-list">
<div v-for="(item, index) in listData" :key="index" :class="{ 'item-selected': item === selectTask }" <div
class="grid-item" @click="handleSelect(item)" @mouseover="overTaskHandelr(item)" @mouseleave="leaveTaskHandler"> v-for="(item, index) in listData" :key="index" :class="{ 'item-selected': item === selectTask }"
class="grid-item" @click="handleSelect(item)" @mouseover="overTaskHandelr(item)" @mouseleave="leaveTaskHandler"
>
<div class="img-wrapper" :style="{ 'background-image': `url(${item.imgurl})` }" /> <div class="img-wrapper" :style="{ 'background-image': `url(${item.imgurl})` }" />
<div class="time-wrapper"> <div class="time-wrapper">
<div class="time"> <div class="time">
<SvgIcon color="#FFF" size="16" name="camera" /> <SvgIcon color="#FFF" size="16" name="camera" />
<span class="current-time">{{ item.photoDateTimestamp ? formatToDateHMS(Number(item.photoDateTimestamp) || <span class="current-time">{{ item.photoDateTimestamp ? formatToDateHMS(Number(item.photoDateTimestamp)
0) : '-' || 0) : '-'
}}</span> }}</span>
</div> </div>
<div class="time"> <div class="time">
@ -349,8 +352,10 @@ onUnmounted(() => {
</div> </div>
</div> </div>
<div class="check"> <div class="check">
<n-checkbox v-show="batch && item.historyStates !== 2 && item.historyStates !== 3" <n-checkbox
v-model:checked="item.checked" @click.stop @update:checked="onCheckChange($event, item)" /> v-show="batch && item.historyStates !== 2 && item.historyStates !== 3"
v-model:checked="item.checked" @click.stop @update:checked="onCheckChange($event, item)"
/>
</div> </div>
<div class="percent" :class="{ 'percent-red': item?.maxSimilarity >= 100 }"> <div class="percent" :class="{ 'percent-red': item?.maxSimilarity >= 100 }">
<div class="val"> <div class="val">
@ -358,10 +363,10 @@ onUnmounted(() => {
</div> </div>
</div> </div>
<div class="pass-status" v-if="item.historyStates === 2"> <div v-if="item.historyStates === 2" class="pass-status">
<SvgIcon name="pass-icon" style="width:52;height:24px" /> <SvgIcon name="pass-icon" style="width:52;height:24px" />
</div> </div>
<div class="pass-status" v-else-if="item.historyStates === 3"> <div v-else-if="item.historyStates === 3" class="pass-status">
<SvgIcon name="no-pass-icon" style="width:52;height:24px" /> <SvgIcon name="no-pass-icon" style="width:52;height:24px" />
</div> </div>
<div v-show="overTask && overTask.id === item.id" class="action"> <div v-show="overTask && overTask.id === item.id" class="action">
@ -372,7 +377,6 @@ onUnmounted(() => {
</div> </div>
<NotPassed ref="notPassModalRef" @success="reloadList" /> <NotPassed ref="notPassModalRef" @success="reloadList" />
<ConfrimModal ref="confrimModalRef" @commit="reject" /> <ConfrimModal ref="confrimModalRef" @commit="reject" />
</div> </div>
</template> </template>
@ -480,7 +484,6 @@ onUnmounted(() => {
} }
} }
.action { .action {
position: absolute; position: absolute;
z-index: 5; z-index: 5;
@ -495,11 +498,9 @@ onUnmounted(() => {
background-color: rgba(0, 0, 0, 0.48); background-color: rgba(0, 0, 0, 0.48);
} }
} }
} }
::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;

@ -105,7 +105,7 @@ function previewHandler(event: MouseEvent) {
<div class="check"> <div class="check">
<n-checkbox <n-checkbox
v-show="batch && taskDetailInfo?.userapprove?.statshis === 1" v-show="batch && taskDetailInfo?.userapprove?.statshis === 1"
v-model:checked="taskDetailInfo?.checked" v-model:checked="taskDetailInfo.checked"
@click.stop @click.stop
@update:checked="onCheckChange($event, taskDetailInfo)" @update:checked="onCheckChange($event, taskDetailInfo)"
/> />

@ -1,18 +1,17 @@
<script lang="ts" setup> <script lang="ts" setup>
import DataHeader from "@/components/DataHeader/index.vue"; import { ref } from 'vue'
import { ref } from "vue"; import Aside from './aside/Aside.vue'
import Aside from "./aside/Aside.vue"; import Content from './content/Content.vue'
import Content from "./content/Content.vue"; import DataHeader from '@/components/DataHeader/index.vue'
import { useWorkOrder } from "@/store/modules/workOrder"; import { useWorkOrder } from '@/store/modules/workOrder'
import Robot from '@/components/Robot/index.vue' import Robot from '@/components/Robot/index.vue'
const workStore = useWorkOrder()
const workStore = useWorkOrder(); const contentRef: any = ref(null)
const contentRef: any = ref(null); function ApprovalOver(packageId) {
const ApprovalOver = (packageId) => { const id: string = workStore.getActiveId
const id: string = workStore.getActiveId; contentRef.value.queryDetail(id)
contentRef.value.queryDetail(id); }
};
</script> </script>
<template> <template>
@ -22,7 +21,7 @@ const ApprovalOver = (packageId) => {
</div> </div>
<div class="main"> <div class="main">
<!-- 侧边 --> <!-- 侧边 -->
<Aside @ApprovalOver="ApprovalOver" /> <Aside @approval-over="ApprovalOver" />
<!-- 内容 --> <!-- 内容 -->
<Content ref="contentRef" /> <Content ref="contentRef" />

@ -1,52 +1,52 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onDeactivated, onMounted, reactive, ref, toRefs } from "vue"; import { nextTick, onDeactivated, onMounted, reactive, ref, toRefs } from 'vue'
import { format } from "date-fns"; import { format } from 'date-fns'
import { NButton, NDataTable, useDialog, useMessage } from "naive-ui"; import { NButton, NDataTable, useDialog, useMessage } from 'naive-ui'
import { aiApprovaltools, aiApprovaltoolsClearmark, setTF } from "@/api/work/work"; import { aiApprovaltools, aiApprovaltoolsClearmark, setTF } from '@/api/work/work'
import { audit } from "@/api/task/task"; import { audit } from '@/api/task/task'
import { getToolsCount } from "@/api/home/main"; import { getToolsCount } from '@/api/home/main'
import { storage } from "@/utils/Storage"; import { storage } from '@/utils/Storage'
import { CURRENT_USER } from "@/store/mutation-types"; import { CURRENT_USER } from '@/store/mutation-types'
const emit = defineEmits<{ const emit = defineEmits<{
(e: "reject", params?: any); (e: 'reject', params?: any)
(e: "notPass", params: any); (e: 'notPass', params: any)
}>(); }>()
const message = useMessage() const message = useMessage()
const dialog = useDialog(); const dialog = useDialog()
const state: any = reactive({ const state: any = reactive({
detail: {}, detail: {},
packageid: "", packageid: '',
}); })
const { detail } = toRefs(state); const { detail } = toRefs(state)
const cardStyle = { const cardStyle = {
width: "450px", 'width': '450px',
"--n-padding-bottom": "10px", '--n-padding-bottom': '10px',
"--n-padding-left": "0px", '--n-padding-left': '0px',
}; }
const show = ref(false); const show = ref(false)
function showModal(id) { function showModal(id) {
state.packageid = id; state.packageid = id
getDetail(id); getDetail(id)
} }
async function getDetail(id) { async function getDetail(id) {
// const userInfo = storage.get(CURRENT_USER); // const userInfo = storage.get(CURRENT_USER);
// const nodeType = userInfo.nodeType; // const nodeType = userInfo.nodeType;
// id = "264627119490116380"; // id = "264627119490116380";
const res = await aiApprovaltools({ taskid: id }); const res = await aiApprovaltools({ taskid: id })
if (res.code === "OK") { if (res.code === 'OK') {
state.detail = res.data; state.detail = res.data
if(Number(res.data.pendingApprovaCount) > 0){ if (Number(res.data.pendingApprovaCount) > 0)
show.value = true; show.value = true
}
} }
} }
const handleReject = async () => { async function handleReject() {
const param = { const param = {
result: false, result: false,
comment: '', comment: '',
@ -57,71 +57,73 @@ const handleReject = async () => {
flowTaskInfoList: state.detail.flowTaskInfoList, flowTaskInfoList: state.detail.flowTaskInfoList,
} }
const res = await audit(param) const res = await audit(param)
if(res.code == 'OK'){ if (res.code == 'OK')
message.success(res.message) message.success(res.message)
}else{
else
message.error(res.message) message.error(res.message)
}
emit('reject', state.packageid) emit('reject', state.packageid)
closeModal(); closeModal()
}; }
async function clearMark() { async function clearMark() {
const res = await aiApprovaltoolsClearmark({ taskid: state.packageid }); const res = await aiApprovaltoolsClearmark({ taskid: state.packageid })
if (res.code === "OK") closeModal(); if (res.code === 'OK')
closeModal()
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function reject() { async function reject() {
// emit('reject', { a: 'todo' }) // emit('reject', { a: 'todo' })
// closeModal() // closeModal()
dialog.info({ dialog.info({
title: "确认提示", title: '确认提示',
content: "确认设置成假吗?", content: '确认设置成假吗?',
positiveText: "确定", positiveText: '确定',
negativeText: "取消", negativeText: '取消',
onPositiveClick: async () => { onPositiveClick: async () => {
// TODO // TODO
// const result = await resetApproval() // const result = await resetApproval()
clearMark(); clearMark()
}, },
onNegativeClick: () => {}, onNegativeClick: () => {},
}); })
} }
async function viewRepeat(e: MouseEvent) { async function viewRepeat(e: MouseEvent) {
emit("notPass", { emit('notPass', {
id: state.packageid, id: state.packageid,
detail: state.detail, detail: state.detail,
}); })
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
} }
const initRem = () => { function initRem() {
const designWidth = 1440; const designWidth = 1440
const rempPx = 16; const rempPx = 16
const scale = window.innerWidth / designWidth; const scale = window.innerWidth / designWidth
document.documentElement.style.fontSize = scale * rempPx + "px"; document.documentElement.style.fontSize = `${scale * rempPx}px`
}; }
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
initRem(); initRem()
}); })
window.addEventListener("resize", () => { window.addEventListener('resize', () => {
initRem(); initRem()
}); })
}); })
onDeactivated(() => { onDeactivated(() => {
window.removeEventListener("resize", () => {}); window.removeEventListener('resize', () => {})
}); })
defineExpose({ defineExpose({
showModal, showModal,
}); })
</script> </script>
<template> <template>
@ -131,7 +133,9 @@ defineExpose({
<SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" /> <SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" />
</div> </div>
<div class="wrapper-hearder"> <div class="wrapper-hearder">
<div class="wrapper-title">智能AI审批工具</div> <div class="wrapper-title">
智能AI审批工具
</div>
<div class="wrapper-mark"> <div class="wrapper-mark">
{{ detail.tenantUserName || "部门信息" }} {{ detail.tenantUserName || "部门信息" }}
</div> </div>
@ -140,7 +144,9 @@ defineExpose({
<div class="item"> <div class="item">
<div class="imgwrapper" /> <div class="imgwrapper" />
<div class="content"> <div class="content">
<div class="task_id">{{ detail.packageName }}</div> <div class="task_id">
{{ detail.packageName }}
</div>
<div class="tag_box"> <div class="tag_box">
<div class="tag_item error"> <div class="tag_item error">
<span style="color: red"><SvgIcon name="error_icon" size="14" /></span> 重复图片({{ <span style="color: red"><SvgIcon name="error_icon" size="14" /></span> 重复图片({{

@ -1,41 +1,41 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from 'vue'
const emit = defineEmits<{ const emit = defineEmits<{
(e: "reject", params: any); (e: 'reject', params: any)
(e: "viewrepeat"); (e: 'viewrepeat')
}>(); }>()
const cardStyle = { const cardStyle = {
width: "450px", 'width': '450px',
"--n-padding-bottom": "10px", '--n-padding-bottom': '10px',
"--n-padding-left": "0px", '--n-padding-left': '0px',
}; }
const show = ref(false); const show = ref(false)
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function reject() { async function reject() {
emit("reject", { a: "todo" }); emit('reject', { a: 'todo' })
closeModal(); closeModal()
} }
async function viewRepeat(e: MouseEvent) { async function viewRepeat(e: MouseEvent) {
emit("viewrepeat"); emit('viewrepeat')
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
</script> </script>
<template> <template>
@ -45,20 +45,32 @@ defineExpose({
<SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" /> <SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" />
</div> </div>
<div class="wrapper-hearder"> <div class="wrapper-hearder">
<div class="wrapper-title">智能AI审批工具</div> <div class="wrapper-title">
<div class="wrapper-mark">某某有限公司-某某事业部-张小凡</div> 智能AI审批工具
</div>
<div class="wrapper-mark">
某某有限公司-某某事业部-张小凡
</div>
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<n-scrollbar style="height: 200px"> <n-scrollbar style="height: 200px">
<div v-for="i in 1" :key="i" class="item"> <div v-for="i in 1" :key="i" class="item">
<div class="imgwrapper" /> <div class="imgwrapper" />
<div class="content"> <div class="content">
<div class="task_id">任务IDYPW34567890-2995</div> <div class="task_id">
任务IDYPW34567890-2995
</div>
<div class="tag_box"> <div class="tag_box">
<div class="tag_item">基线任务</div> <div class="tag_item">
<div class="tag_item error">中日友好医院</div> 基线任务
</div>
<div class="tag_item error">
中日友好医院
</div>
</div>
<div class="time_box">
2023-09-17 13:09:10
</div> </div>
<div class="time_box">2023-09-17 13:09:10</div>
</div> </div>
</div> </div>
</n-scrollbar> </n-scrollbar>

@ -1,94 +1,86 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, reactive, ref, toRefs } from "vue"; import { onMounted, reactive, ref, toRefs } from 'vue'
import { format } from "date-fns"; import { format } from 'date-fns'
import { NButton, NDataTable, useDialog, useMessage } from "naive-ui"; import { useDialog } from 'naive-ui'
import { aiApprovaltools, aiApprovaltoolsClearmark } from "@/api/work/work"; import { aiApprovaltools, aiApprovaltoolsClearmark } from '@/api/work/work'
import { getToolsCount } from "@/api/home/main"; import { getToolsCount } from '@/api/home/main'
const emit = defineEmits<{ const emit = defineEmits<{
(e: "reject", params: any); (e: 'reject', params: any)
(e: "notPass", params: any); (e: 'notPass', params: any)
}>(); }>()
const dialog = useDialog(); const dialog = useDialog()
const state: any = reactive({ const state: any = reactive({
detail: {}, detail: {},
taskId: "", taskId: '',
}); })
const { detail } = toRefs(state); const { detail } = toRefs(state)
const cardStyle = {
width: "450px",
"--n-padding-bottom": "10px",
"--n-padding-left": "0px",
};
const show = ref(false); const show = ref(false)
function showModal(id) { function showModal(id) {
console.log(id); state.taskId = id
state.taskId = id; getDetail(id)
getDetail(id);
} }
async function getDetail(id) { async function getDetail(id: string | number) {
const res = await aiApprovaltools({ taskid: id }); const res = await aiApprovaltools({ taskid: id })
if (res.code === "OK") { if (res.code === 'OK') {
state.detail = res.data; state.detail = res.data
show.value = true; show.value = true
} }
console.log(res,'getDetail');
} }
async function clearMark() { async function clearMark() {
const res = await aiApprovaltoolsClearmark({ taskid: state.taskId }); const res = await aiApprovaltoolsClearmark({ taskid: state.taskId })
if (res.code === "OK") closeModal(); if (res.code === 'OK')
closeModal()
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function reject() { async function reject() {
// emit('reject', { a: 'todo' }) // emit('reject', { a: 'todo' })
// closeModal() // closeModal()
dialog.info({ dialog.info({
title: "确认提示", title: '确认提示',
content: "确认设置成假吗?", content: '确认设置成假吗?',
positiveText: "确定", positiveText: '确定',
negativeText: "取消", negativeText: '取消',
onPositiveClick: async () => { onPositiveClick: async () => {
// TODO // TODO
// const result = await resetApproval() // const result = await resetApproval()
clearMark(); clearMark()
}, },
onNegativeClick: () => {}, onNegativeClick: () => {},
}); })
} }
async function viewRepeat(e: MouseEvent) { async function viewRepeat(e: MouseEvent) {
emit("notPass", { emit('notPass', {
id: state.taskId, id: state.taskId,
detail: state.detail, detail: state.detail,
}); })
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
} }
async function getShowStatus() { async function getShowStatus() {
const res = await getToolsCount(); const res = await getToolsCount()
if (res.code == 'OK') { if (res.code == 'OK')
show.value = true; show.value = true
}
} }
onMounted(() => { onMounted(() => {
getShowStatus(); getShowStatus()
}); })
defineExpose({ defineExpose({
showModal, showModal,
}); })
</script> </script>
<template> <template>
@ -98,7 +90,9 @@ defineExpose({
<SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" /> <SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal" />
</div> </div>
<div class="wrapper-hearder"> <div class="wrapper-hearder">
<div class="wrapper-title">智能AI审批工具</div> <div class="wrapper-title">
智能AI审批工具
</div>
<div class="wrapper-mark"> <div class="wrapper-mark">
{{ detail.tenantusername }} {{ detail.tenantusername }}
</div> </div>
@ -108,10 +102,16 @@ defineExpose({
<div v-for="i in 1" :key="i" class="item"> <div v-for="i in 1" :key="i" class="item">
<div class="imgwrapper" /> <div class="imgwrapper" />
<div class="content"> <div class="content">
<div class="task_id">任务ID{{ detail.taskid }}</div> <div class="task_id">
任务ID{{ detail.taskid }}
</div>
<div class="tag_box"> <div class="tag_box">
<div class="tag_item">基线任务</div> <div class="tag_item">
<div class="tag_item error">相似图片({{ detail.similarcount }})</div> 基线任务
</div>
<div class="tag_item error">
相似图片({{ detail.similarcount }})
</div>
</div> </div>
<div class="time_box"> <div class="time_box">
{{ format(detail?.createtime || 0, "yyyy-MM-dd HH:mm:ss") }} {{ format(detail?.createtime || 0, "yyyy-MM-dd HH:mm:ss") }}

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useDictionary } from '@/store/modules/dictonary'; import { computed, onBeforeMount, ref, unref } from 'vue'
import { computed, onBeforeMount, ref, unref } from 'vue'; import { useDictionary } from '@/store/modules/dictonary'
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'commit', rejectId: any, backId: any, isOther: boolean) (e: 'commit', rejectId: any, backId: any, isOther: boolean)
@ -64,12 +64,8 @@ onBeforeMount(async () => {
}) })
async function selectChange(id) { async function selectChange(id) {
console.log(id,'selectChange') selectItem.value = reasonOptions.value.find(v => v.id == id)
selectItem.value = reasonOptions.value.find(v=>v.id == id);
} }
</script> </script>
<template> <template>
@ -86,22 +82,19 @@ async function selectChange(id){
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>处理方式</span> <span>处理方式</span>
<n-select filterable v-model:value="selectBackId" style="margin-top: 10px;" :options="backOptions" /> <n-select v-model:value="selectBackId" filterable style="margin-top: 10px;" :options="backOptions" />
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
<span>不通过原因</span> <span>不通过原因</span>
<n-select filterable v-model:value="selectRejectId" @change="selectChange" style="margin-top: 10px;" :options="reasonOptions" /> <n-select v-model:value="selectRejectId" filterable style="margin-top: 10px;" :options="reasonOptions" @change="selectChange" />
<n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" /> <n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" />
</div> </div>
<!-- <div class="wrapper-content"> <!-- <div class="wrapper-content">
<n-input <n-input
type="textarea" type="textarea"
placeholder="备注内容" v-model="showOther"></n-input> placeholder="备注内容" v-model="showOther"></n-input>
</div> --> </div> -->
</div> </div>
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">

@ -1,13 +1,11 @@
// <!-- // -->
<script lang="ts" setup> <script lang="ts" setup>
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter"; import { difference } from 'lodash-es'
import { workPackageMap } from "@/config/workorder"; import { computed, defineEmits, defineProps, onMounted, ref, watch } from 'vue'
import { useUser } from "@/store/modules/user"; import { VueDraggable } from 'vue-draggable-plus'
import { difference } from "lodash-es"; import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import { computed, defineEmits, defineProps, onMounted, ref, watch } from "vue"; import { useUser } from '@/store/modules/user'
import { VueDraggable } from "vue-draggable-plus";
const props = defineProps({ const props = defineProps({
reviewType: { reviewType: {
@ -15,222 +13,170 @@ const props = defineProps({
default: () => 1, default: () => 1,
require: true, require: true,
}, },
}); })
const emit = defineEmits(["onOk"]); const emit = defineEmits(['onOk'])
// //
const offList = ref<any[]>([]); const offList = ref<any[]>([])
// //
const onList = ref<any[]>([]); const onList = ref<any[]>([])
const fixList = ref<any[]>([]); const fixList = ref<any[]>([])
const allCount = computed(() => { const allCount = computed(() => {
return `全部筛选(共${offList.value.length - 1}个)`; return `全部筛选(共${offList.value.length - 1}个)`
}); })
const selectCount = computed(() => { const selectCount = computed(() => {
return `全部筛选(共${onList.value.length}个)`; return `全部筛选(共${onList.value.length}个)`
}); })
function generatList() {
const keys = Object.keys(workPackageMap);
let showList: object[] = [];
const hideList: object[] = [];
const showStr = "status";
const showKeys = showStr.split(",").map((key: string) => key.toLowerCase());
for (const key of keys) {
const name = workPackageMap[key]?.label;
const isDefault = workPackageMap[key]?.isDefault;
// Y
if (!isDefault) {
hideList.push({
id: key,
name: name || "未配置",
fix: isDefault,
checked: workPackageMap[key].isDefault,
});
}
}
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 = ref(false); const checkAll = ref(false)
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let userField = ""; let userField = ''
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)
savefield(props.reviewType, userInfo.id, userField); savefield(props.reviewType, userInfo.id, userField)
e.preventDefault(); e.preventDefault()
closeModal(); closeModal()
emit("onOk"); emit('onOk')
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
// generatList(); // generatList();
const selectIds = ref<string[]>([]); const selectIds = ref<string[]>([])
function onCheckAllChange(value) { function onCheckAllChange(value) {
const ids: string[] = []; const ids: string[] = []
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 : []
} }
function onCheckChange(checked: any, item: any) { function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id); const index = selectIds.value.indexOf(item.id)
item.checked = checked; item.checked = checked
if (index === -1 && checked) selectIds.value.push(item.id); if (index === -1 && checked)
else selectIds.value.splice(index, 1); selectIds.value.push(item.id)
else selectIds.value.splice(index, 1)
} }
const showIds = computed(() => { const showIds = computed(() => {
return onList.value.map((item) => { return onList.value.map((item) => {
return item.id; return item.id
}); })
}); })
watch( watch(
() => selectIds.value.length, () => selectIds.value.length,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal === oldVal) return; if (newVal === oldVal)
return
const action = newVal > oldVal ? "add" : "remove"; const action = newVal > oldVal ? 'add' : 'remove'
const diff = const diff
action === "add" = action === 'add'
? difference(selectIds.value, showIds.value) ? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value); : difference(showIds.value, selectIds.value)
if (diff.length === 0) return; if (diff.length === 0)
return
if (action === "add") { if (action === 'add') {
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
onList.value.push({ onList.value.push({
id: item.id, id: item.id,
name: item.name || "未配置", name: item.name || '未配置',
fix: item.fix || false, fix: item.fix || false,
}); })
}
} }
} }
} else { else {
const list = onList.value; const list = onList.value
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
const item = list[index]; const item = list[index]
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
list.splice(index, 1); list.splice(index, 1)
index--; index--
} }
} }
} }
} },
); )
watch( watch(
() => showIds.value.length, () => showIds.value.length,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal === oldVal) return; if (newVal === oldVal)
return
const diff = difference(selectIds.value, showIds.value); const diff = difference(selectIds.value, showIds.value)
if (diff.length === 0) return; if (diff.length === 0)
return
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix && diff.includes(item.id)) { if (!item.fix && diff.includes(item.id)) {
const index = selectIds.value.indexOf(item.id); const index = selectIds.value.indexOf(item.id)
item.checked = false; item.checked = false
selectIds.value.splice(index, 1); selectIds.value.splice(index, 1)
}
} }
} }
); },
)
function clearDragSource() { function clearDragSource() {
onList.value = onList.value.filter((item) => { onList.value = onList.value.filter((item) => {
return item.fix === true; return item.fix === true
}); })
} }
function removeHandler(id: string) { function removeHandler(id: string) {
const index = onList.value.findIndex((item) => { const index = onList.value.findIndex((item) => {
return item.id === id; return item.id === id
}); })
if (index !== -1) onList.value.splice(index, 1); if (index !== -1)
onList.value.splice(index, 1)
} }
onMounted(async () => { onMounted(async () => {
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let res; let res
res = await getAllfieldList(props.reviewType); // res = await getAllfieldList(props.reviewType) //
const allList = res.data; const allList = res.data
res = await getfieldList(props.reviewType, userInfo.id); // res = await getfieldList(props.reviewType, userInfo.id) //
const useList = res.data; const useList = res.data
/** /**
* name 标题 * name 标题
@ -238,41 +184,39 @@ onMounted(async () => {
* fix 是否默认 * fix 是否默认
* checked 是否选中 * checked 是否选中
*/ */
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) => {
let item = { const item = {
name: v.fieldDesc, name: v.fieldDesc,
id: v.name, id: v.name,
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2
Boolean(userFieldFixed?.find((v2) => v2 == v.name)) || || Boolean(userFieldFixed?.find(v2 => v2 == v.name))
Boolean(userFieldUnFixed?.find((v2) => v2 == v.name)), || Boolean(userFieldUnFixed?.find(v2 => v2 == v.name)),
}; }
if (item.fix) { if (item.fix)
fixList.value.push(item); fixList.value.push(item)
} else { else
offList.value.push(item); offList.value.push(item)
} })
}); offList.value.unshift(...fixList.value)
offList.value.unshift(...fixList.value); useList.userFieldFixed?.split(',').forEach((v) => {
useList.userFieldFixed?.split(",").map((v) => { let item = allList.find(v2 => v2.name == v)
let item = allList.find((v2) => v2.name == v);
if (item) { if (item) {
item = { item = {
name: item.fieldDesc, name: item.fieldDesc,
id: item.name, id: item.name,
fix: item.isrequired == 2, fix: item.isrequired == 2,
checked: true, checked: true,
};
onList.value.push(item);
} }
}); onList.value.push(item)
if (!onList.value.length) {
onList.value.push(...fixList.value);
} }
}); })
if (!onList.value.length)
onList.value.push(...fixList.value)
})
</script> </script>
<template> <template>
@ -381,7 +325,9 @@ onMounted(async () => {
</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>

@ -30,7 +30,6 @@ const allCount = computed(() => {
}) })
const showOffList = computed(() => { const showOffList = computed(() => {
return offList.value.filter((i) => { return offList.value.filter((i) => {
console.log(i.name, searchKey.value, 'i.name.includes(searchKey.value)')
return i.name.includes(searchKey.value) return i.name.includes(searchKey.value)
}) })
}) })
@ -41,71 +40,10 @@ const selectCount = computed(() => {
return `显示字段(共${onList.value.length}个)` return `显示字段(共${onList.value.length}个)`
}) })
function generatList() {
const keys = Object.keys(workPackageMap)
let showList: object[] = []
const hideList: object[] = []
const showStr = 'status'
const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
for (const key of keys) {
const name = workPackageMap[key]?.label
const isDefault = workPackageMap[key]?.isDefault
// Y
if (!isDefault) {
hideList.push({
id: key,
name: name || '未配置',
fix: isDefault,
checked: workPackageMap[key].isDefault,
})
}
}
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
console.log(offList.value, 'console.log(offList.value)')
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
}) })
@ -123,10 +61,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)
@ -278,7 +216,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,
@ -294,7 +232,7 @@ async function getData() {
offList.value.push(item) 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 = {
@ -316,7 +254,7 @@ onMounted(async () => {
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
}) })

2
types/task.d.ts vendored

@ -11,7 +11,7 @@ export interface TaskState {
currentIndex: number currentIndex: number
approvalList: any[] approvalList: any[]
immersion: boolean immersion: boolean
inFile: boolean, inFile: boolean
inFileId: string inFileId: string
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save