chore: merge

refactor/project
LiZhong 1 year ago
commit a0e7b1fe5d

9
components.d.ts vendored

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

@ -72,18 +72,18 @@ function logOut() {
} }
const currentCompanyName = computed(() => { const currentCompanyName = computed(() => {
const tenantList = useInfo.tenantList const deptlist = useInfo.deptlist
const currentId = userStore.getTenantId const currentId = userStore.getTenantId
const current = tenantList.find(item => item.id === currentId) const current = deptlist.find(item => item.id === currentId)
return current.name || 'name' return current.name || 'name'
}) })
const options = computed(() => { const options = computed(() => {
const tenantList = useInfo.tenantList const deptlist = useInfo.deptlist
return tenantList.map((item) => { return deptlist.map((item) => {
return { return {
label: item.name, label: item.departname,
key: item.id, key: item.deptno,
} }
}) })
}) })
@ -101,7 +101,7 @@ const options = computed(() => {
> >
<template #trigger> <template #trigger>
<div class="setting"> <div class="setting">
<span style="color:#333333">{{ useInfo.username }}</span> <span style="color: #333333">{{ useInfo.username }}</span>
<SvgIcon style="margin-left: 6px" :name="iconName" size="16" /> <SvgIcon style="margin-left: 6px" :name="iconName" size="16" />
</div> </div>
</template> </template>

@ -15,7 +15,7 @@ const TOKEN_REFRESH_SECONDS = 20 * 60
export interface UserInfoType { export interface UserInfoType {
token: string token: string
tenantList: any[] deptlist: any[]
userInfo: any userInfo: any
} }
@ -122,8 +122,8 @@ export const useUserStore = defineStore({
if (code === ResultEnum.SUCCESS) { if (code === ResultEnum.SUCCESS) {
const ex = 7 * 24 * 60 * 60 const ex = 7 * 24 * 60 * 60
// 默认设置为第一个租户 // 默认设置为第一个租户
const firstTenant = data.tenantList.length > 0 ? data.tenantList[0] : null const firstTenant = data.deptlist.length > 0 ? data.deptlist[0] : null
const tenantId = firstTenant ? firstTenant.id : '' const tenantId = firstTenant ? firstTenant.deptno : ''
data.frontmenuTList.forEach((ele) => { data.frontmenuTList.forEach((ele) => {
if (ele.description === 'AI工单') if (ele.description === 'AI工单')
ele.description = '图审审批' ele.description = '图审审批'
@ -175,7 +175,7 @@ export const useUserStore = defineStore({
// 登出 // 登出
async logout() { async logout() {
this.setPermissions([]) this.setPermissions([])
this.setUserInfo({ tenantList: [], userInfo: {}, token: '' }) this.setUserInfo({ deptlist: [], userInfo: {}, token: '' })
this.setTenantId('') this.setTenantId('')
storage.remove(USER_ACCESS_TOKEN) storage.remove(USER_ACCESS_TOKEN)
storage.remove(CURRENT_USER) storage.remove(CURRENT_USER)

@ -1,5 +1,4 @@
<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 {
@ -55,6 +54,7 @@ const route = useRoute()
const reviewType = 0 const reviewType = 0
const sortorder = ref('asc') const sortorder = ref('asc')
const sortname = ref('states') const sortname = ref('states')
const searchContent = route.query.searchContent as string
const actionsColumns = { const actionsColumns = {
title: '操作', title: '操作',
key: 'actions', key: 'actions',
@ -199,6 +199,7 @@ async function getColumns() {
width: 120, width: 120,
}) })
} }
return v
}) })
} }
else { else {
@ -210,6 +211,7 @@ async function getColumns() {
fixed: 'left', fixed: 'left',
width: 120, width: 120,
}) })
return v
}) })
userFieldUnFixed.map((v) => { userFieldUnFixed.map((v) => {
const item = allList.find(v2 => v2.name == v) const item = allList.find(v2 => v2.name == v)
@ -218,6 +220,7 @@ async function getColumns() {
key: item.name, key: item.name,
width: 120, width: 120,
}) })
return v
}) })
} }
// TODO: // TODO:
@ -419,6 +422,7 @@ async function formatColumns() {
const deviceHeight = ref(600) const deviceHeight = ref(600)
onMounted(() => { onMounted(() => {
// query(pagination.page, pagination.pageSize);
emitter.on('filter-final', refreshHandler) emitter.on('filter-final', refreshHandler)
getColumns() getColumns()
@ -479,6 +483,7 @@ const message = useMessage()
const finalStore = useFinal() const finalStore = useFinal()
async function query(page: number, pageSize: number, filterId?: any, taskName?: string) { async function query(page: number, pageSize: number, filterId?: any, taskName?: string) {
console.log('query', taskName)
const asideParmas = unref(finalStore.getAsideValue) const asideParmas = unref(finalStore.getAsideValue)
// 使使 // 使使
// let params = filterId ? { userSearchId: filterId } : asideParmas // let params = filterId ? { userSearchId: filterId } : asideParmas
@ -584,10 +589,6 @@ const scrollX = computed(() => {
return width return width
}) })
onMounted(() => {
query(pagination.page, pagination.pageSize)
})
const customTabelRef = ref(null) const customTabelRef = ref(null)
const importExcelRef = ref(null) const importExcelRef = ref(null)
const notPassModalRef = ref(null) // const notPassModalRef = ref(null) //
@ -707,7 +708,7 @@ function resetHandler() {
// TODO // TODO
// const result = await resetApproval() // const result = await resetApproval()
}, },
onNegativeClick: () => { }, onNegativeClick: () => {},
}) })
} }
@ -814,7 +815,7 @@ function doAudit(param: any) {
} }
}) })
}, },
onNegativeClick: () => { }, onNegativeClick: () => {},
}) })
} }
@ -853,15 +854,23 @@ function reset() {
async function refreshHandler(searchId?: any) { async function refreshHandler(searchId?: any) {
reset() reset()
query(pagination.page, pagination.pageSize, searchId) let searchKeyword = ''
if (searchContent) {
const id_param = searchContent.match(/-\d+-/)
if (id_param)
searchKeyword = id_param[0].slice(1, -1)
}
console.log('refreshHandler', searchKeyword)
query(pagination.page, pagination.pageSize, searchId, searchKeyword)
} }
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({
@ -874,10 +883,20 @@ defineExpose({
<div class="wrapper-header"> <div class="wrapper-header">
<div class="wrapper-header-left"> <div class="wrapper-header-left">
<span class="wrapper-header-font">任务管理列表</span> <span class="wrapper-header-font">任务管理列表</span>
<SvgIcon style="cursor: pointer" size="16" name="list-mode" @click="changeContent" /> <SvgIcon
style="cursor: pointer"
size="16"
name="list-mode"
@click="changeContent"
/>
</div> </div>
<div> <div>
<SvgIcon style="margin-right: 6px" size="13" name="summary" @click="showModal(repeatModalRef)" /> <SvgIcon
style="margin-right: 6px"
size="13"
name="summary"
@click="showModal(repeatModalRef)"
/>
<NButton class="xjcc" text @click="showModal(repeatModalRef)"> <NButton class="xjcc" text @click="showModal(repeatModalRef)">
小结查重 小结查重
</NButton> </NButton>
@ -897,16 +916,27 @@ defineExpose({
</NButton> </NButton>
<img <img
class="btn-approval btn-left" src="@/assets/images/task/btn-not-pass.png" alt="" class="btn-approval btn-left"
src="@/assets/images/task/btn-not-pass.png"
alt=""
@click.stop="batchReject" @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 <n-popover
ref="popover" :style="{ padding: '0px' }" style="width: 148px" :show-arrow="false" ref="popover"
placement="bottom-start" trigger="click" :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">
@ -947,22 +977,46 @@ defineExpose({
</div> </div>
</div> --> </div> -->
<div class="wrapper-settings"> <div class="wrapper-settings">
<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 <NDataTable
id="table" ref="tableRef" v-model:checked-row-keys="checkedRowKeys" remote :columns="columnsRef" id="table"
:scroll-x="scrollX" :max-height="maxHeight" :data="tableData" :loading="loading" :pagination="pagination" ref="tableRef"
:row-key="rowKey" @update:page="handlePageChange" @update-page-size="handlePageSizeChange" v-model:checked-row-keys="checkedRowKeys"
@update:checked-row-keys="handleCheck" @update:sorter="handleSorterChange" remote
:columns="columnsRef"
:scroll-x="scrollX"
:max-height="maxHeight"
:data="tableData"
:loading="loading"
:pagination="pagination"
:row-key="rowKey"
@update:page="handlePageChange"
@update-page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck"
@update:sorter="handleSorterChange"
/> />
</div> </div>
<CustomTabelModal ref="customTabelRef" @commit="commitHandler" /> <CustomTabelModal ref="customTabelRef" @commit="commitHandler" />
<ImportExcelModal ref="importExcelRef" :on-success="sucessHandler" :header-config="headRules" /> <ImportExcelModal
ref="importExcelRef"
:on-success="sucessHandler"
:header-config="headRules"
/>
<NotPassed ref="notPassModalRef" @success="reload" /> <NotPassed ref="notPassModalRef" @success="reload" />
<RepeatModal ref="repeatModalRef" @reject="repeatBatchReject" @viewrepeat="showModal(repeatTaskTableModalRef)" /> <RepeatModal
ref="repeatModalRef"
@reject="repeatBatchReject"
@viewrepeat="showModal(repeatTaskTableModalRef)"
/>
<RepeatTaskTableModal ref="repeatTaskTableModalRef" /> <RepeatTaskTableModal ref="repeatTaskTableModalRef" />
</div> </div>
</template> </template>

@ -125,19 +125,23 @@ nextTick(() => {
const sortKeyList: any = [] const sortKeyList: any = []
configStore.getFilterConfig.map((item: any) => { configStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item?.id) sortKeyList.push(item?.id)
return item
}) })
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)) { // TODO hasOwnProperty
// if (asideMap.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(customObjRef.value, 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') {
@ -157,7 +161,11 @@ nextTick(() => {
asideValue[key] = customObjRef.value[str] // asideValue[key] = customObjRef.value[str] //
console.log('时间2222222222', asideValue[key]) console.log('时间2222222222', asideValue[key])
} }
else if (str != 'izsimilarity' && str != 'izyear' && customObjRef.value[str]) { else if (
str != 'izsimilarity'
&& str != 'izyear'
&& customObjRef.value[str]
) {
console.log('customObjRef.value[str]222222', 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);
@ -166,8 +174,9 @@ nextTick(() => {
else { else {
asideValue[key] = null asideValue[key] = null
} }
// asideMap[str].defaultValue = customObjRef.value[str];// // asideMap[str].defaultValue = customObjRef.value[str];//
} }
return key
}) })
customTempObjRef.value = customObjRef.value customTempObjRef.value = customObjRef.value
console.log('asideValue直接处理后的结果', asideValue) console.log('asideValue直接处理后的结果', asideValue)
@ -183,20 +192,20 @@ nextTick(() => {
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 {
else { return acc;
return acc }
} }, []);
}, []) console.log("showItems=================================", items);
console.log('showItems=================================', items) showItems.value = items;
showItems.value = items configFilterRef.value = configStore.getFilterConfig;
configFilterRef.value = configStore.getFilterConfig });
})
}) })
const asideEnter = ref(false) const asideEnter = ref(false)
@ -233,8 +242,12 @@ async function filterHandler(searchId: string) {
customObjRef.value = res.data customObjRef.value = res.data
const showKeys: any[] = [] const showKeys: any[] = []
Object.keys(obj).map((key) => { Object.keys(obj).map((key) => {
if (asideMap.hasOwnProperty(key)) // TODO hasOwnProperty
// if (asideMap.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(asideMap, key))
showKeys.push(key) showKeys.push(key)
return key
}) })
// console.log(showKeys); // console.log(showKeys);
configStore.setCustomConfig(showKeys) configStore.setCustomConfig(showKeys)
@ -312,12 +325,12 @@ function handleOk(item: any) {
</div> </div>
<component <component
:is="item.config.component" :is="item.config?.component"
v-for="(item, index) in showItems" v-for="item in showItems"
:id="item.key" :id="item.key"
:key="item.key" :key="item.key"
v-model:value="asideValue[item.key]" v-model:value="asideValue[item.key]"
:label="item.config.label" :label="item.config?.label"
@update:value="(e) => updateComponent(item.key, e)" @update:value="(e) => updateComponent(item.key, e)"
/> />

@ -1,7 +1,7 @@
<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 { useRoute, useRouter } 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'
@ -18,6 +18,7 @@ const emit = defineEmits<{
const finalStore = useFinal() const finalStore = useFinal()
const router = useRouter()
const route = useRoute() const route = useRoute()
const searchContent = route.query.searchContent as string const searchContent = route.query.searchContent as string
const data = ref<SearchEntity[]>([]) const data = ref<SearchEntity[]>([])
@ -42,7 +43,7 @@ configStore.$subscribe(() => {
return return
const list = keys.map((key) => { const list = keys.map((key) => {
const name = asideMap[key].label const name = asideMap[key]?.label
return { return {
key, key,
@ -69,6 +70,9 @@ function close() {
searchKeyword.value = '' searchKeyword.value = ''
configStore.setSearchValue(searchKeyword.value) configStore.setSearchValue(searchKeyword.value)
finalStore.setSearchValue(searchKeyword.value) finalStore.setSearchValue(searchKeyword.value)
if (searchContent)
router.push(route.path)
emit('close') emit('close')
} }
@ -90,16 +94,27 @@ onMounted(() => {
<template> <template>
<div class="wrapper"> <div class="wrapper">
<n-popover <n-popover
ref="popover" :style="{ padding: '0px' }" style="width: 248px" :show-arrow="false" ref="popover"
placement="bottom-start" trigger="focus" :style="{ padding: '0px' }"
style="width: 248px"
:show-arrow="false"
placement="bottom-start"
trigger="focus"
> >
<template #trigger> <template #trigger>
<n-input <n-input
v-model:value="searchKeyword" style="width: 260px;height: 32px;" placeholder="请输入你需要搜索的内容" v-model:value="searchKeyword"
style="width: 260px; height: 32px"
placeholder="请输入你需要搜索的内容"
@input="inputHandler" @input="inputHandler"
> >
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1" style="cursor: pointer;" @click="searchName" /> <SvgIcon
size="14px"
name="magnifying-1"
style="cursor: pointer"
@click="searchName"
/>
</template> </template>
</n-input> </n-input>
</template> </template>
@ -112,7 +127,12 @@ onMounted(() => {
</div> --> </div> -->
</n-popover> </n-popover>
<SvgIcon size="16px" style="margin-left: 6px;cursor: pointer;" name="clear" @click="close" /> <SvgIcon
size="16px"
style="margin-left: 6px; cursor: pointer"
name="clear"
@click="close"
/>
</div> </div>
</template> </template>

@ -14,6 +14,13 @@ const configStore = useConfig()
const checkAll = ref(false) const checkAll = ref(false)
const selectIds = ref<string[]>([]) const selectIds = ref<string[]>([])
const tempList = ref<string[]>([]) const tempList = ref<string[]>([])
//
const offList = ref<any[]>([])
//
const onList = ref<any[]>([])
const offKeyword = ref('')
const onKeyword = ref('')
function showModal() { function showModal() {
show.value = true show.value = true
@ -27,7 +34,10 @@ function showModal() {
if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig)) if (tempList.value.length > 0 && isEqual(tempList.value, configStore.getFilterConfig))
return return
console.log('开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------', customConfig) console.log(
'开启了啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦筛选条件----------------',
customConfig,
)
const { showList, hideList } = generatList(config, customConfig) const { showList, hideList } = generatList(config, customConfig)
tempList.value = cloneDeep(showList) tempList.value = cloneDeep(showList)
if (tempList.value.length > 0) if (tempList.value.length > 0)
@ -46,11 +56,6 @@ function closeModal() {
show.value = false show.value = false
} }
//
const offList = ref<any[]>([])
//
const onList = ref<any[]>([])
const allCount = computed(() => { const allCount = computed(() => {
return `全部筛选(共${offList.value.length}个)` return `全部筛选(共${offList.value.length}个)`
}) })
@ -138,7 +143,8 @@ function generatList(config, customConfig) {
const sortKeyList: any = [] const sortKeyList: any = []
configStore.getFilterConfig.map((item: any) => { configStore.getFilterConfig.map((item: any) => {
sortKeyList.push(item.id) sortKeyList.push(item?.id)
return item
}) })
console.log('原始筛选条件sortKeyList', sortKeyList) console.log('原始筛选条件sortKeyList', sortKeyList)
const sortList: any = [] const sortList: any = []
@ -146,12 +152,14 @@ function generatList(config, customConfig) {
sortKeyList.map((key) => { sortKeyList.map((key) => {
const tempItem = tempOnList.find(item => item.id == key) const tempItem = tempOnList.find(item => item.id == key)
sortList.push(tempItem) sortList.push(tempItem)
return key
}) })
} }
else { else {
customConfig.map((key) => { customConfig.map((key) => {
const tempItem = tempOnList.find(item => item.id == key) const tempItem = tempOnList.find(item => item.id == key)
sortList.push(tempItem) sortList.push(tempItem)
return key
}) })
} }
console.log('原始筛选条件sortList', sortList) console.log('原始筛选条件sortList', sortList)
@ -185,9 +193,11 @@ configStore.$subscribe(() => {
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
e.preventDefault() e.preventDefault()
const param = onList.value.map((item) => { const param = onList.value
return item.id .map((item) => {
}).join(',') return item.id
})
.join(',')
await setFilter({ searchcount: param, type: 0 }) await setFilter({ searchcount: param, type: 0 })
const obj = await configStore.fetchCustomConfig() const obj = await configStore.fetchCustomConfig()
@ -198,6 +208,7 @@ async function handleSumbit(e: MouseEvent) {
obj.map((key) => { obj.map((key) => {
const tempItem = tempOnList.find(item => item.id == key) const tempItem = tempOnList.find(item => item.id == key)
sortList.push(tempItem) sortList.push(tempItem)
return key
}) })
console.log('configStore.sortList---------------', sortList) console.log('configStore.sortList---------------', sortList)
// setTimeout(() => { // setTimeout(() => {
@ -228,8 +239,7 @@ function onCheckChange(checked: any, item: any) {
if (index === -1 && checked) if (index === -1 && checked)
selectIds.value.push(item.id) selectIds.value.push(item.id)
else else index !== -1 && selectIds.value.splice(index, 1)
index !== -1 && selectIds.value.splice(index, 1)
checkAll.value = offList.value.every(item => item.checked) checkAll.value = offList.value.every(item => item.checked)
} }
@ -247,7 +257,10 @@ watch(
return return
const action = newVal > oldVal ? 'add' : 'remove' const action = newVal > oldVal ? 'add' : 'remove'
const diff = action === 'add' ? difference(selectIds.value, showIds.value) : difference(showIds.value, selectIds.value) const diff
= action === 'add'
? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value)
if (diff.length === 0) if (diff.length === 0)
return return
@ -314,9 +327,6 @@ function removeHandler(id: string) {
onList.value.splice(index, 1) onList.value.splice(index, 1)
} }
const offKeyword = ref('')
const onKeyword = ref('')
const leftInputHandler = debounce((keyword) => { const leftInputHandler = debounce((keyword) => {
offKeyword.value = keyword offKeyword.value = keyword
}, 300) }, 300)
@ -345,7 +355,13 @@ onMounted(() => {
<template> <template>
<n-modal v-model:show="show" transform-origin="center" :mask-closable="false"> <n-modal v-model:show="show" transform-origin="center" :mask-closable="false">
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true"> <n-card
class="cardstyle"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<div class="wrapper"> <div class="wrapper">
<span class="wrapper-title">自定义筛选</span> <span class="wrapper-title">自定义筛选</span>
<div class="wrapper-bar"> <div class="wrapper-bar">
@ -357,7 +373,10 @@ onMounted(() => {
<n-grid cols="24" class="mt-4 proCard" responsive="screen" :x-gap="24"> <n-grid cols="24" class="mt-4 proCard" responsive="screen" :x-gap="24">
<n-grid-item span="11"> <n-grid-item span="11">
<NCard <NCard
:title="allCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small" :title="allCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false" :bordered="false"
> >
<div class="input_wrap"> <div class="input_wrap">
@ -366,17 +385,29 @@ onMounted(() => {
<SvgIcon size="14px" name="magnifying-1-color999" /> <SvgIcon size="14px" name="magnifying-1-color999" />
</template> </template>
</n-input> </n-input>
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;"> <n-scrollbar
style="max-height: 500px; border: 1px solid #cad2dd; border-radius: 2px"
>
<div class="draggable-ul"> <div class="draggable-ul">
<div class="draggable-li"> <div class="draggable-li">
<n-checkbox v-model:checked="checkAll" label="全选" :indeterminate="!checkAll" @update:checked="onCheckAllChange" /> <n-checkbox
v-model:checked="checkAll"
label="全选"
:indeterminate="!checkAll"
@update:checked="onCheckAllChange"
/>
</div> </div>
<div <div
v-for="item in offList" v-show="item.name.includes(offKeyword)" :key="item.id" :class="{ 'disable-check': item.fix }" v-for="item in offList"
v-show="item.name.includes(offKeyword)"
:key="item.id"
:class="{ 'disable-check': item.fix }"
class="draggable-li" class="draggable-li"
> >
<n-checkbox <n-checkbox
v-model:checked="item.checked" :label="item.name" :disabled="item.fix" v-model:checked="item.checked"
:label="item.name"
:disabled="item.fix"
@update:checked="onCheckChange($event, item)" @update:checked="onCheckChange($event, item)"
/> />
</div> </div>
@ -385,12 +416,15 @@ onMounted(() => {
</div> </div>
</NCard> </NCard>
</n-grid-item> </n-grid-item>
<n-grid-item style="display: flex;align-items: center;" span="2"> <n-grid-item style="display: flex; align-items: center" span="2">
<SvgIcon size="20" name="switchsvg" /> <SvgIcon size="20" name="switchsvg" />
</n-grid-item> </n-grid-item>
<n-grid-item span="11"> <n-grid-item span="11">
<NCard <NCard
:title="selectCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small" :title="selectCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false" :bordered="false"
> >
<template #header-extra> <template #header-extra>
@ -402,14 +436,31 @@ onMounted(() => {
<SvgIcon size="14px" name="magnifying-1-color999" /> <SvgIcon size="14px" name="magnifying-1-color999" />
</template> </template>
</n-input> </n-input>
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;" class="scroll"> <n-scrollbar
<VueDraggable v-model="onList" class="draggable-ul" :animation="150" group="shared"> style="max-height: 500px; border: 1px solid #cad2dd; border-radius: 2px"
<div v-for="item in onList" v-show="item.name.includes(onKeyword)" :key="item.id" :draggable="true" class="cursor-move draggable-li"> class="scroll"
>
<VueDraggable
v-model="onList"
class="draggable-ul"
:animation="150"
group="shared"
>
<div
v-for="item in onList"
v-show="item.name.includes(onKeyword)"
:key="item.id"
:draggable="true"
class="cursor-move draggable-li"
>
<SvgIcon name="drag" size="24" /> <SvgIcon name="drag" size="24" />
<span class="ml-2">{{ item.name }}</span> <span class="ml-2">{{ item.name }}</span>
<SvgIcon <SvgIcon
v-if="!item.fix" size="16px" style="display:block;margin-left: auto;cursor: pointer;" v-if="!item.fix"
name="clear" @click="removeHandler(item.id)" size="16px"
style="display: block; margin-left: auto; cursor: pointer"
name="clear"
@click="removeHandler(item.id)"
/> />
</div> </div>
</VueDraggable> </VueDraggable>
@ -424,7 +475,11 @@ onMounted(() => {
<n-button type="info" @click="handleSumbit"> <n-button type="info" @click="handleSumbit">
确定 确定
</n-button> </n-button>
<n-button secondary style="margin-left:15px; border: 1px solid #CAD2DD;" @click="closeModal"> <n-button
secondary
style="margin-left: 15px; border: 1px solid #cad2dd"
@click="closeModal"
>
取消 取消
</n-button> </n-button>
</div> </div>
@ -453,10 +508,10 @@ onMounted(() => {
&-footer { &-footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
.n-button--info-type{ .n-button--info-type {
background: #507AFD !important; background: #507afd !important;
} }
.n-button--default-type{ .n-button--default-type {
background: #fff !important; background: #fff !important;
color: #333333; color: #333333;
} }
@ -468,7 +523,7 @@ onMounted(() => {
font-size: 14px; font-size: 14px;
&:before { &:before {
background-color: #1980FF; background-color: #1980ff;
content: ""; content: "";
width: 5px; width: 5px;
border-radius: 2px; border-radius: 2px;
@ -498,7 +553,7 @@ onMounted(() => {
.textbtnStyle { .textbtnStyle {
cursor: pointer; cursor: pointer;
color: #1980FF; color: #1980ff;
} }
.draggable-ul { .draggable-ul {
@ -531,33 +586,33 @@ onMounted(() => {
--n-padding-top: 0px; --n-padding-top: 0px;
--n-padding-bottom: 12px; --n-padding-bottom: 12px;
} }
::v-deep(.n-card > .n-card-header .n-card-header__main){ ::v-deep(.n-card > .n-card-header .n-card-header__main) {
font-weight: lighter !important; font-weight: lighter !important;
font-size: 14px; font-size: 14px;
color: #666; color: #666;
} }
::v-deep(.n-scrollbar){ ::v-deep(.n-scrollbar) {
border-left: 1px solid #cad2dd !important; border-left: 1px solid #cad2dd !important;
border-right: 1px solid #cad2dd !important; border-right: 1px solid #cad2dd !important;
border-bottom: 1px solid #E8E8E8 !important; border-bottom: 1px solid #e8e8e8 !important;
border-top: 1px solid #E8E8E8 !important; border-top: 1px solid #e8e8e8 !important;
} }
::v-deep(.n-card__content){ ::v-deep(.n-card__content) {
padding: 20px 24px 0 24px !important; padding: 20px 24px 0 24px !important;
} }
::v-deep(.n-card__footer){ ::v-deep(.n-card__footer) {
padding: 0 24px 16px 24px !important; padding: 0 24px 16px 24px !important;
} }
::v-deep(.n-input .n-input-wrapper){ ::v-deep(.n-input .n-input-wrapper) {
height: 44px !important; height: 44px !important;
border: 1px solid #cad2dd !important; border: 1px solid #cad2dd !important;
border-bottom: none !important; border-bottom: none !important;
// margin-bottom: -3px; // margin-bottom: -3px;
.n-input__input input{ .n-input__input input {
height: 44px !important; height: 44px !important;
} }
} }
::v-deep(.n-button--info-type){ ::v-deep(.n-button--info-type) {
background: #507AFD !important; background: #507afd !important;
} }
</style> </style>

Loading…
Cancel
Save