2025-10-28 18:13:55 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="p-2">
|
|
|
|
|
<!--查询区域-->
|
|
|
|
|
<div class="jeecg-basic-table-form-container">
|
|
|
|
|
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
|
|
|
<a-row :gutter="24">
|
2025-10-31 18:03:10 +08:00
|
|
|
<a-col :lg="6">
|
|
|
|
|
<a-form-item name="areaCode">
|
|
|
|
|
<template #label><span title="库区编码">库区编码</span></template>
|
|
|
|
|
<JInput v-model:value="queryParam.areaCode" :type="JInputTypeEnum.JINPUT_RIGHT_LIKE" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :lg="6">
|
|
|
|
|
<a-form-item name="areaName">
|
|
|
|
|
<template #label><span title="库区名称">库区名称</span></template>
|
|
|
|
|
<JInput v-model:value="queryParam.areaName" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :lg="6">
|
|
|
|
|
<a-form-item name="createTime">
|
|
|
|
|
<template #label><span title="创建日期">创建日期</span></template>
|
|
|
|
|
<JRangeDate v-model:value="queryParam.createTime" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
2025-10-28 18:13:55 +08:00
|
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
|
|
|
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
|
|
|
|
<a-col :lg="6">
|
|
|
|
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
|
|
|
|
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
|
|
|
|
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
|
|
|
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
|
|
|
|
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
|
|
|
|
|
</a>
|
|
|
|
|
</a-col>
|
|
|
|
|
</span>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</a-form>
|
|
|
|
|
</div>
|
|
|
|
|
<!--引用表格-->
|
|
|
|
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
|
|
|
<!--插槽:table标题-->
|
|
|
|
|
<template #tableTitle>
|
2025-10-31 18:03:10 +08:00
|
|
|
<a-button type="primary" v-auth="'base:base_area:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
|
|
|
|
<a-button type="primary" v-auth="'base:base_area:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
|
|
|
|
<j-upload-button type="primary" v-auth="'base:base_area:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
|
|
|
|
|
>导入
|
|
|
|
|
</j-upload-button>
|
2025-10-28 18:13:55 +08:00
|
|
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
|
|
|
|
<template #overlay>
|
|
|
|
|
<a-menu>
|
|
|
|
|
<a-menu-item key="1" @click="batchHandleDelete">
|
|
|
|
|
<Icon icon="ant-design:delete-outlined"></Icon>
|
|
|
|
|
删除
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
</a-menu>
|
|
|
|
|
</template>
|
2025-10-31 18:03:10 +08:00
|
|
|
<a-button v-auth="'base:base_area:deleteBatch'"
|
|
|
|
|
>批量操作
|
2025-10-28 18:13:55 +08:00
|
|
|
<Icon icon="mdi:chevron-down"></Icon>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
</template>
|
|
|
|
|
<!--操作栏-->
|
|
|
|
|
<template #action="{ record }">
|
2025-10-31 18:03:10 +08:00
|
|
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
2025-10-28 18:13:55 +08:00
|
|
|
</template>
|
|
|
|
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
2025-10-31 18:03:10 +08:00
|
|
|
<template v-if="column.dataIndex === 'description'">
|
2025-10-28 18:13:55 +08:00
|
|
|
<!--富文本件字段回显插槽-->
|
|
|
|
|
<div v-html="text"></div>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
<!-- 表单区域 -->
|
|
|
|
|
<AreaModal ref="registerModal" @success="handleSuccess"></AreaModal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" name="base-area" setup>
|
|
|
|
|
import { ref, reactive } from 'vue';
|
2025-10-31 18:03:10 +08:00
|
|
|
import { BasicTable, TableAction } from '/@/components/Table';
|
2025-10-28 18:13:55 +08:00
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
2025-10-31 18:03:10 +08:00
|
|
|
import { columns } from './Area.data';
|
2025-10-28 18:13:55 +08:00
|
|
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Area.api';
|
2025-10-31 18:03:10 +08:00
|
|
|
import AreaModal from './components/AreaModal.vue';
|
2025-10-28 18:13:55 +08:00
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
2025-10-31 18:03:10 +08:00
|
|
|
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
|
|
|
|
|
import JRangeDate from '@/components/Form/src/jeecg/components/JRangeDate.vue';
|
2025-10-28 18:13:55 +08:00
|
|
|
import { getDateByPicker } from '/@/utils';
|
2025-10-31 18:03:10 +08:00
|
|
|
import { JInputTypeEnum } from '@/enums/cpteEnum';
|
2025-10-28 18:13:55 +08:00
|
|
|
|
2025-10-31 18:03:10 +08:00
|
|
|
const fieldPickers = reactive({});
|
2025-10-28 18:13:55 +08:00
|
|
|
const formRef = ref();
|
|
|
|
|
const queryParam = reactive<any>({});
|
|
|
|
|
const toggleSearchStatus = ref<boolean>(false);
|
|
|
|
|
const registerModal = ref();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
|
//注册table数据
|
|
|
|
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
|
|
|
tableProps: {
|
|
|
|
|
title: '库区',
|
|
|
|
|
api: list,
|
|
|
|
|
columns,
|
2025-10-31 18:03:10 +08:00
|
|
|
canResize: true,
|
2025-10-28 18:13:55 +08:00
|
|
|
useSearchForm: false,
|
|
|
|
|
actionColumn: {
|
|
|
|
|
width: 120,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
},
|
|
|
|
|
beforeFetch: async (params) => {
|
2025-10-31 18:03:10 +08:00
|
|
|
// 创建新的查询参数对象,避免修改原始对象
|
|
|
|
|
const newQueryParam = { ...queryParam };
|
|
|
|
|
|
|
|
|
|
// 处理日期范围
|
|
|
|
|
if (newQueryParam.createTime) {
|
|
|
|
|
try {
|
|
|
|
|
const [begin, end] = newQueryParam.createTime.split(',');
|
|
|
|
|
if (begin !== undefined) newQueryParam.createTime_begin = begin;
|
|
|
|
|
if (end !== undefined) newQueryParam.createTime_end = end;
|
|
|
|
|
delete newQueryParam.createTime;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('日期范围处理错误:', error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
for (let key in fieldPickers) {
|
2025-10-31 18:03:10 +08:00
|
|
|
if (newQueryParam[key] && fieldPickers[key]) {
|
|
|
|
|
newQueryParam[key] = getDateByPicker(newQueryParam[key], fieldPickers[key]);
|
2025-10-28 18:13:55 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
|
|
|
|
return Object.assign(params, newQueryParam);
|
2025-10-28 18:13:55 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
exportConfig: {
|
2025-10-31 18:03:10 +08:00
|
|
|
name: '库区',
|
2025-10-28 18:13:55 +08:00
|
|
|
url: getExportUrl,
|
|
|
|
|
params: queryParam,
|
|
|
|
|
},
|
2025-10-31 18:03:10 +08:00
|
|
|
importConfig: {
|
|
|
|
|
url: getImportUrl,
|
|
|
|
|
success: handleSuccess,
|
|
|
|
|
},
|
2025-10-28 18:13:55 +08:00
|
|
|
});
|
2025-10-31 18:03:10 +08:00
|
|
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
|
|
|
|
|
tableContext;
|
2025-10-28 18:13:55 +08:00
|
|
|
const labelCol = reactive({
|
2025-10-31 18:03:10 +08:00
|
|
|
xs: 24,
|
|
|
|
|
sm: 4,
|
|
|
|
|
xl: 6,
|
|
|
|
|
xxl: 4,
|
2025-10-28 18:13:55 +08:00
|
|
|
});
|
|
|
|
|
const wrapperCol = reactive({
|
|
|
|
|
xs: 24,
|
|
|
|
|
sm: 20,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增事件
|
|
|
|
|
*/
|
|
|
|
|
function handleAdd() {
|
|
|
|
|
registerModal.value.disableSubmit = false;
|
|
|
|
|
registerModal.value.add();
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 编辑事件
|
|
|
|
|
*/
|
|
|
|
|
function handleEdit(record: Recordable) {
|
|
|
|
|
registerModal.value.disableSubmit = false;
|
|
|
|
|
registerModal.value.edit(record);
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 详情
|
|
|
|
|
*/
|
|
|
|
|
function handleDetail(record: Recordable) {
|
|
|
|
|
registerModal.value.disableSubmit = true;
|
|
|
|
|
registerModal.value.edit(record);
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 删除事件
|
|
|
|
|
*/
|
|
|
|
|
async function handleDelete(record) {
|
|
|
|
|
await deleteOne({ id: record.id }, handleSuccess);
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 批量删除事件
|
|
|
|
|
*/
|
|
|
|
|
async function batchHandleDelete() {
|
|
|
|
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 成功回调
|
|
|
|
|
*/
|
|
|
|
|
function handleSuccess() {
|
|
|
|
|
(selectedRowKeys.value = []) && reload();
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 操作栏
|
|
|
|
|
*/
|
|
|
|
|
function getTableAction(record) {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
label: '编辑',
|
|
|
|
|
onClick: handleEdit.bind(null, record),
|
2025-10-31 18:03:10 +08:00
|
|
|
auth: 'base:base_area:edit',
|
2025-10-28 18:13:55 +08:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 下拉操作栏
|
|
|
|
|
*/
|
|
|
|
|
function getDropDownAction(record) {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
label: '详情',
|
|
|
|
|
onClick: handleDetail.bind(null, record),
|
2025-10-31 18:03:10 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-10-28 18:13:55 +08:00
|
|
|
label: '删除',
|
|
|
|
|
popConfirm: {
|
|
|
|
|
title: '是否确认删除',
|
|
|
|
|
confirm: handleDelete.bind(null, record),
|
|
|
|
|
placement: 'topLeft',
|
|
|
|
|
},
|
2025-10-31 18:03:10 +08:00
|
|
|
auth: 'base:base_area:delete',
|
|
|
|
|
},
|
|
|
|
|
];
|
2025-10-28 18:13:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询
|
|
|
|
|
*/
|
|
|
|
|
function searchQuery() {
|
|
|
|
|
reload();
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
/**
|
|
|
|
|
* 重置
|
|
|
|
|
*/
|
|
|
|
|
function searchReset() {
|
|
|
|
|
formRef.value.resetFields();
|
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
//刷新数据
|
|
|
|
|
reload();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.jeecg-basic-table-form-container {
|
|
|
|
|
padding: 0;
|
2025-10-31 18:03:10 +08:00
|
|
|
|
2025-10-28 18:13:55 +08:00
|
|
|
.table-page-search-submitButtons {
|
|
|
|
|
display: block;
|
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
|
|
|
|
.query-group-cust {
|
2025-10-28 18:13:55 +08:00
|
|
|
min-width: 100px !important;
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
|
|
|
|
.query-group-split-cust {
|
2025-10-28 18:13:55 +08:00
|
|
|
width: 30px;
|
|
|
|
|
display: inline-block;
|
2025-10-31 18:03:10 +08:00
|
|
|
text-align: center;
|
2025-10-28 18:13:55 +08:00
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
|
|
|
|
.ant-form-item:not(.ant-form-item-with-help) {
|
2025-10-28 18:13:55 +08:00
|
|
|
margin-bottom: 16px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
}
|
2025-10-31 18:03:10 +08:00
|
|
|
|
|
|
|
|
:deep(.ant-picker),
|
|
|
|
|
:deep(.ant-input-number) {
|
2025-10-28 18:13:55 +08:00
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|