|
|
|
@ -8,132 +8,138 @@ import {
|
|
|
|
|
reactive,
|
|
|
|
|
ref,
|
|
|
|
|
unref,
|
|
|
|
|
} from "vue";
|
|
|
|
|
import { NDataTable } from "naive-ui";
|
|
|
|
|
import type { DataTableColumns, DataTableRowKey } from "naive-ui";
|
|
|
|
|
import type { SortableEvent } from "sortablejs";
|
|
|
|
|
import Sortable from "sortablejs";
|
|
|
|
|
import { debounce } from "lodash-es";
|
|
|
|
|
import Action from "../Action.vue";
|
|
|
|
|
import { deleteCondition, getConditionList, sort } from "@/api/home/filter";
|
|
|
|
|
import type { FilterSearchParam } from "/#/api";
|
|
|
|
|
import selection from "naive-ui/es/_internal/selection";
|
|
|
|
|
import SvgIcon from "@/components/Icon/SvgIcon.vue";
|
|
|
|
|
|
|
|
|
|
import { useModal } from "naive-ui";
|
|
|
|
|
const modal = useModal();
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: "FilterModal" });
|
|
|
|
|
const $message = window["$message"];
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import { NDataTable, useModal } from 'naive-ui'
|
|
|
|
|
import type { DataTableColumns, DataTableRowKey } from 'naive-ui'
|
|
|
|
|
import type { SortableEvent } from 'sortablejs'
|
|
|
|
|
import Sortable from 'sortablejs'
|
|
|
|
|
import { debounce } from 'lodash-es'
|
|
|
|
|
import selection from 'naive-ui/es/_internal/selection'
|
|
|
|
|
import Action from '../Action.vue'
|
|
|
|
|
import { deleteCondition, getConditionList, sort } from '@/api/home/filter'
|
|
|
|
|
import type { FilterSearchParam } from '/#/api'
|
|
|
|
|
import SvgIcon from '@/components/Icon/SvgIcon.vue'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'FilterModal' })
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
type: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: () => 0,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: "showNewFilter"): void;
|
|
|
|
|
(e: "editFilter", filter: any): void;
|
|
|
|
|
(e: "handleOk", item: any): void;
|
|
|
|
|
}>();
|
|
|
|
|
(e: 'showNewFilter'): void
|
|
|
|
|
(e: 'editFilter', filter: any): void
|
|
|
|
|
(e: 'handleOk', item: any): void
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const show = ref(false);
|
|
|
|
|
const modal = useModal()
|
|
|
|
|
|
|
|
|
|
const $message = window.$message
|
|
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
|
const tableData = ref<Array<RowData>>([])
|
|
|
|
|
const keyword = ref('')
|
|
|
|
|
const cardStyle = {
|
|
|
|
|
width: "808px",
|
|
|
|
|
height: "840px",
|
|
|
|
|
"--n-padding-bottom": "10px",
|
|
|
|
|
"--n-padding-left": "10px",
|
|
|
|
|
};
|
|
|
|
|
'width': '808px',
|
|
|
|
|
'height': '840px',
|
|
|
|
|
'--n-padding-bottom': '10px',
|
|
|
|
|
'--n-padding-left': '10px',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface RowData {
|
|
|
|
|
id: string;
|
|
|
|
|
searchname: string;
|
|
|
|
|
createby: string;
|
|
|
|
|
createtime: string;
|
|
|
|
|
updateby: string;
|
|
|
|
|
updatetime: string;
|
|
|
|
|
id: string
|
|
|
|
|
searchname: string
|
|
|
|
|
createby: string
|
|
|
|
|
createtime: string
|
|
|
|
|
updateby: string
|
|
|
|
|
updatetime: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortData(row) {
|
|
|
|
|
console.log("sortData", row);
|
|
|
|
|
if (row.order == "descend") {
|
|
|
|
|
console.log('sortData', row)
|
|
|
|
|
if (row.order == 'descend') {
|
|
|
|
|
tableData.value.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
new Date(a[row.columnKey]).getTime() - new Date(b[row.columnKey]).getTime()
|
|
|
|
|
);
|
|
|
|
|
} else if (row.order == "ascend") {
|
|
|
|
|
new Date(a[row.columnKey]).getTime() - new Date(b[row.columnKey]).getTime(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
else if (row.order == 'ascend') {
|
|
|
|
|
tableData.value.sort(
|
|
|
|
|
(a, b) =>
|
|
|
|
|
new Date(b[row.columnKey]).getTime() - new Date(a[row.columnKey]).getTime()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
new Date(b[row.columnKey]).getTime() - new Date(a[row.columnKey]).getTime(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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> = [
|
|
|
|
|
{
|
|
|
|
|
type: "selection",
|
|
|
|
|
type: 'selection',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "操作",
|
|
|
|
|
key: "action",
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
|
render(row) {
|
|
|
|
|
return h(Action, {
|
|
|
|
|
options: [
|
|
|
|
|
{ label: "编辑", key: 1 },
|
|
|
|
|
{ label: "删除", key: 2 },
|
|
|
|
|
{ label: '编辑', key: 1 },
|
|
|
|
|
{ label: '删除', key: 2 },
|
|
|
|
|
],
|
|
|
|
|
id: row.id,
|
|
|
|
|
select,
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// j
|
|
|
|
|
{
|
|
|
|
|
title: "名称",
|
|
|
|
|
key: "searchname",
|
|
|
|
|
title: '名称',
|
|
|
|
|
key: 'searchname',
|
|
|
|
|
ellipsis: {
|
|
|
|
|
tooltip: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "创建者",
|
|
|
|
|
key: "createby",
|
|
|
|
|
title: '创建者',
|
|
|
|
|
key: 'createby',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "创建时间",
|
|
|
|
|
key: "createtime",
|
|
|
|
|
title: '创建时间',
|
|
|
|
|
key: 'createtime',
|
|
|
|
|
width: 180,
|
|
|
|
|
renderSorterIcon: ({ order }) => {
|
|
|
|
|
if (order === false) return h(SvgIcon, { name: "sort-2" });
|
|
|
|
|
if (order === "ascend") return h(SvgIcon, { name: "sort-1" });
|
|
|
|
|
if (order === "descend") return h(SvgIcon, { name: "sort-3" });
|
|
|
|
|
if (order === false)
|
|
|
|
|
return h(SvgIcon, { name: 'sort-2' })
|
|
|
|
|
if (order === 'ascend')
|
|
|
|
|
return h(SvgIcon, { name: 'sort-1' })
|
|
|
|
|
if (order === 'descend')
|
|
|
|
|
return h(SvgIcon, { name: 'sort-3' })
|
|
|
|
|
},
|
|
|
|
|
sorter: (row1, row2) => {
|
|
|
|
|
// tableData.value.sort(
|
|
|
|
|
// (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: "更新者",
|
|
|
|
|
key: "updateby",
|
|
|
|
|
title: '更新者',
|
|
|
|
|
key: 'updateby',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "更新时间",
|
|
|
|
|
key: "updatetime",
|
|
|
|
|
title: '更新时间',
|
|
|
|
|
key: 'updatetime',
|
|
|
|
|
width: 180,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
const total = ref(0);
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
]
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
const loading = ref(true)
|
|
|
|
|
const pagination = reactive({
|
|
|
|
|
page: 1,
|
|
|
|
|
pageCount: 1,
|
|
|
|
@ -141,83 +147,82 @@ const pagination = reactive({
|
|
|
|
|
showSizePicker: true,
|
|
|
|
|
pageSizes: [
|
|
|
|
|
{
|
|
|
|
|
label: "10 每页",
|
|
|
|
|
label: '10 每页',
|
|
|
|
|
value: 10,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "15 每页",
|
|
|
|
|
label: '15 每页',
|
|
|
|
|
value: 15,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "30 每页",
|
|
|
|
|
label: '30 每页',
|
|
|
|
|
value: 30,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "50 每页",
|
|
|
|
|
label: '50 每页',
|
|
|
|
|
value: 50,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
prefix: () => `共 ${total.value} 条数据`,
|
|
|
|
|
});
|
|
|
|
|
const tableData = ref<Array<RowData>>([]);
|
|
|
|
|
const keyword = ref("");
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
async function query(page: number, pageSize: number) {
|
|
|
|
|
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,
|
|
|
|
|
props.type
|
|
|
|
|
);
|
|
|
|
|
const { data, pageCount, total: totalCount } = result;
|
|
|
|
|
tableData.value = data;
|
|
|
|
|
pagination.page = page;
|
|
|
|
|
total.value = totalCount;
|
|
|
|
|
pagination.pageCount = pageCount;
|
|
|
|
|
loading.value = false;
|
|
|
|
|
props.type,
|
|
|
|
|
)
|
|
|
|
|
const { data, pageCount, total: totalCount } = result
|
|
|
|
|
tableData.value = data
|
|
|
|
|
pagination.page = page
|
|
|
|
|
total.value = totalCount
|
|
|
|
|
pagination.pageCount = pageCount
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function afterLeave() {
|
|
|
|
|
pagination.page = 1;
|
|
|
|
|
pagination.pageCount = 1;
|
|
|
|
|
pagination.pageSize = 10;
|
|
|
|
|
pagination.page = 1
|
|
|
|
|
pagination.pageCount = 1
|
|
|
|
|
pagination.pageSize = 10
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const selectionIds = ref<DataTableRowKey[]>([]);
|
|
|
|
|
const selectionIds = ref<DataTableRowKey[]>([])
|
|
|
|
|
|
|
|
|
|
const rowKey = (row: RowData) => row.id;
|
|
|
|
|
const rowKey = (row: RowData) => row.id
|
|
|
|
|
|
|
|
|
|
function rowProps(row: RowData) {
|
|
|
|
|
return {
|
|
|
|
|
"data-id": row.id,
|
|
|
|
|
};
|
|
|
|
|
'data-id': row.id,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleCheck(rowKeys: DataTableRowKey[]) {
|
|
|
|
|
selectionIds.value = rowKeys;
|
|
|
|
|
selectionIds.value = rowKeys
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function select(key: number, id: string) {
|
|
|
|
|
switch (key) {
|
|
|
|
|
case 1:
|
|
|
|
|
editSelection(id);
|
|
|
|
|
break;
|
|
|
|
|
editSelection(id)
|
|
|
|
|
break
|
|
|
|
|
case 2:
|
|
|
|
|
const modalInst = modal.create({
|
|
|
|
|
title: "确认提示",
|
|
|
|
|
content: "确认删除该条过滤条件吗?",
|
|
|
|
|
positiveText: "确定",
|
|
|
|
|
negativeText: "取消",
|
|
|
|
|
preset: "dialog",
|
|
|
|
|
onPositiveClick: () => deleteSelection(id),
|
|
|
|
|
onNegativeClick: () => modalInst.destroy(),
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
deleteSelection(id)
|
|
|
|
|
// const modalInst = modal.create({
|
|
|
|
|
// title: "确认提示",
|
|
|
|
|
// content: "确认删除该条过滤条件吗?",
|
|
|
|
|
// positiveText: "确定",
|
|
|
|
|
// negativeText: "取消",
|
|
|
|
|
// preset: "dialog",
|
|
|
|
|
// onPositiveClick: () => deleteSelection(id),
|
|
|
|
|
// onNegativeClick: () => modalInst.destroy(),
|
|
|
|
|
// });
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -227,145 +232,149 @@ function editSelection(id) {
|
|
|
|
|
// $message.error("请选中一条过滤");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
const selectedId = id;
|
|
|
|
|
const selectedId = id
|
|
|
|
|
const selectedFilter = tableData.value.find((item: any) => {
|
|
|
|
|
return item.id === selectedId;
|
|
|
|
|
});
|
|
|
|
|
return item.id === selectedId
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
emit("editFilter", selectedFilter);
|
|
|
|
|
closeModal();
|
|
|
|
|
emit('editFilter', selectedFilter)
|
|
|
|
|
closeModal()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteSelection(id = "") {
|
|
|
|
|
function deleteSelection(id = '') {
|
|
|
|
|
if (selectionIds.value.length === 0) {
|
|
|
|
|
deleteCondition({ ids: id }).then(() => {
|
|
|
|
|
query(pagination.page, pagination.pageSize);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
query(pagination.page, pagination.pageSize)
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const modalInst = modal.create({
|
|
|
|
|
title: "确认提示",
|
|
|
|
|
content: "确认删除所选过滤条件吗?",
|
|
|
|
|
positiveText: "确定",
|
|
|
|
|
negativeText: "取消",
|
|
|
|
|
preset: "dialog",
|
|
|
|
|
title: '确认提示',
|
|
|
|
|
content: '确认删除所选过滤条件吗?',
|
|
|
|
|
positiveText: '确定',
|
|
|
|
|
negativeText: '取消',
|
|
|
|
|
preset: 'dialog',
|
|
|
|
|
onPositiveClick: () =>
|
|
|
|
|
deleteCondition({ ids: selectionIds.value.join(",") }).then(() => {
|
|
|
|
|
selectionIds.value = [];
|
|
|
|
|
query(pagination.page, pagination.pageSize);
|
|
|
|
|
deleteCondition({ ids: selectionIds.value.join(',') }).then(() => {
|
|
|
|
|
selectionIds.value = []
|
|
|
|
|
query(pagination.page, pagination.pageSize)
|
|
|
|
|
}),
|
|
|
|
|
onNegativeClick: () => modalInst.destroy(),
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handlePageChange(currentPage) {
|
|
|
|
|
if (loading.value) return;
|
|
|
|
|
pagination.page = currentPage;
|
|
|
|
|
const { pageSize } = pagination;
|
|
|
|
|
await query(currentPage, pageSize);
|
|
|
|
|
if (loading.value)
|
|
|
|
|
return
|
|
|
|
|
pagination.page = currentPage
|
|
|
|
|
const { pageSize } = pagination
|
|
|
|
|
await query(currentPage, pageSize)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handlePageSizeChange(currentPageSize) {
|
|
|
|
|
if (loading.value) return;
|
|
|
|
|
if (loading.value)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
const { page } = pagination;
|
|
|
|
|
pagination.pageSize = currentPageSize;
|
|
|
|
|
await query(page, currentPageSize);
|
|
|
|
|
const { page } = pagination
|
|
|
|
|
pagination.pageSize = currentPageSize
|
|
|
|
|
await query(page, currentPageSize)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleClick() {
|
|
|
|
|
emit("showNewFilter");
|
|
|
|
|
closeModal();
|
|
|
|
|
emit('showNewFilter')
|
|
|
|
|
closeModal()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let sortTable: Sortable | null = null;
|
|
|
|
|
const tableRef = ref<InstanceType<typeof NDataTable>>();
|
|
|
|
|
let sortTable: Sortable | null = null
|
|
|
|
|
const tableRef = ref<InstanceType<typeof NDataTable>>()
|
|
|
|
|
|
|
|
|
|
async function showModal() {
|
|
|
|
|
show.value = true;
|
|
|
|
|
show.value = true
|
|
|
|
|
|
|
|
|
|
const { page, pageSize } = pagination;
|
|
|
|
|
await query(page, pageSize);
|
|
|
|
|
const { page, pageSize } = pagination
|
|
|
|
|
await query(page, pageSize)
|
|
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
if (sortTable !== null) destory();
|
|
|
|
|
|
|
|
|
|
const el: HTMLDivElement = tableRef.value?.$el;
|
|
|
|
|
const tbody: HTMLElement | null = el.querySelector("tbody.n-data-table-tbody")!;
|
|
|
|
|
if (tbody) sortTable = Sortable.create(tbody, { onEnd, onMove });
|
|
|
|
|
});
|
|
|
|
|
if (sortTable !== null)
|
|
|
|
|
destory()
|
|
|
|
|
|
|
|
|
|
const el: HTMLDivElement = tableRef.value?.$el
|
|
|
|
|
const tbody: HTMLElement | null = el.querySelector('tbody.n-data-table-tbody')!
|
|
|
|
|
if (tbody)
|
|
|
|
|
sortTable = Sortable.create(tbody, { onEnd, onMove })
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let relatedId = "";
|
|
|
|
|
let insertafter = false;
|
|
|
|
|
let relatedId = ''
|
|
|
|
|
let insertafter = false
|
|
|
|
|
|
|
|
|
|
// TODO: 有bug,需跟后端联调
|
|
|
|
|
function onEnd(event: SortableEvent) {
|
|
|
|
|
const data = unref(tableData);
|
|
|
|
|
const oldElem = data[event.oldIndex!];
|
|
|
|
|
data.splice(event.oldIndex!, 1);
|
|
|
|
|
data.splice(event.newIndex!, 0, oldElem);
|
|
|
|
|
const data = unref(tableData)
|
|
|
|
|
const oldElem = data[event.oldIndex!]
|
|
|
|
|
data.splice(event.oldIndex!, 1)
|
|
|
|
|
data.splice(event.newIndex!, 0, oldElem)
|
|
|
|
|
|
|
|
|
|
const dragId = oldElem.id;
|
|
|
|
|
const dragId = oldElem.id
|
|
|
|
|
const index = data.findIndex((item) => {
|
|
|
|
|
return item.id === relatedId;
|
|
|
|
|
});
|
|
|
|
|
return item.id === relatedId
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 插入到元素后,索引-1;插入到元素前,索引+1
|
|
|
|
|
const order = insertafter ? index - 1 : index + 1;
|
|
|
|
|
const order = insertafter ? index - 1 : index + 1
|
|
|
|
|
// console.log('dragid:', dragId, 'order:', order)
|
|
|
|
|
sort(dragId, order);
|
|
|
|
|
sort(dragId, order)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onMove(evt: any) {
|
|
|
|
|
relatedId = evt.related?.dataset?.id;
|
|
|
|
|
insertafter = evt.willInsertAfter;
|
|
|
|
|
relatedId = evt.related?.dataset?.id
|
|
|
|
|
insertafter = evt.willInsertAfter
|
|
|
|
|
// console.log(`你正在拖动:${evt.dragged.dataset.id},替换了:${evt.related}`, 'insertafter', evt.willInsertAfter)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function destory() {
|
|
|
|
|
sortTable && sortTable.destroy();
|
|
|
|
|
sortTable = null;
|
|
|
|
|
sortTable && sortTable.destroy()
|
|
|
|
|
sortTable = null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
destory();
|
|
|
|
|
});
|
|
|
|
|
destory()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function closeModal() {
|
|
|
|
|
selectionIds.value = [];
|
|
|
|
|
show.value = false;
|
|
|
|
|
selectionIds.value = []
|
|
|
|
|
show.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
showModal,
|
|
|
|
|
query,
|
|
|
|
|
pagination,
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const inputHandler = debounce((word) => {
|
|
|
|
|
keyword.value = word;
|
|
|
|
|
query(1, 5);
|
|
|
|
|
}, 300);
|
|
|
|
|
keyword.value = word
|
|
|
|
|
query(1, 5)
|
|
|
|
|
}, 300)
|
|
|
|
|
|
|
|
|
|
const showSearch = computed(() => {
|
|
|
|
|
return selectionIds.value.length > 0;
|
|
|
|
|
});
|
|
|
|
|
return selectionIds.value.length > 0
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const handleOk = () => {
|
|
|
|
|
function handleOk() {
|
|
|
|
|
if (selectionIds.value.length > 1) {
|
|
|
|
|
$message.error("只能选择一条筛选条件");
|
|
|
|
|
return;
|
|
|
|
|
$message.error('只能选择一条筛选条件')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (selectionIds.value.length == 1) {
|
|
|
|
|
const selectedId = selectionIds.value[0];
|
|
|
|
|
let item = tableData.value.find((v) => v.id == selectedId);
|
|
|
|
|
emit("handleOk", item);
|
|
|
|
|
const selectedId = selectionIds.value[0]
|
|
|
|
|
const item = tableData.value.find(v => v.id == selectedId)
|
|
|
|
|
emit('handleOk', item)
|
|
|
|
|
}
|
|
|
|
|
if (selectionIds.value.length == 0) {
|
|
|
|
|
emit("handleOk", "");
|
|
|
|
|
}
|
|
|
|
|
closeModal();
|
|
|
|
|
};
|
|
|
|
|
if (selectionIds.value.length == 0)
|
|
|
|
|
emit('handleOk', '')
|
|
|
|
|
|
|
|
|
|
closeModal()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@ -374,9 +383,9 @@ const handleOk = () => {
|
|
|
|
|
v-model:show="show"
|
|
|
|
|
transform-origin="center"
|
|
|
|
|
display-directive="if"
|
|
|
|
|
@after-leave="afterLeave"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
class="modal_wrapper"
|
|
|
|
|
@after-leave="afterLeave"
|
|
|
|
|
>
|
|
|
|
|
<n-card
|
|
|
|
|
:style="cardStyle"
|
|
|
|
@ -396,8 +405,7 @@ const handleOk = () => {
|
|
|
|
|
'font-weight': '600',
|
|
|
|
|
}"
|
|
|
|
|
class="wrapper-info-title"
|
|
|
|
|
>基本信息</span
|
|
|
|
|
>
|
|
|
|
|
>基本信息</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -429,13 +437,11 @@ const handleOk = () => {
|
|
|
|
|
</n-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="msg">
|
|
|
|
|
<span
|
|
|
|
|
>已选中
|
|
|
|
|
<span>已选中
|
|
|
|
|
<span style="color: #507afd; font-size: 16px">{{
|
|
|
|
|
selectionIds.length
|
|
|
|
|
}}</span>
|
|
|
|
|
项</span
|
|
|
|
|
>
|
|
|
|
|
项</span>
|
|
|
|
|
<a @click="selectionIds = []">清空</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|