入库新增,修改、删除、;AGV任务新增、修改、删除
parent
9f3b8f4af0
commit
fcd12d7be5
|
|
@ -16,7 +16,7 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
|||
VITE_GLOB_API_URL=/cpte-wms
|
||||
|
||||
#后台接口全路径地址(必填)
|
||||
VITE_GLOB_DOMAIN_URL=http://127.0.0.1:8080/cpte-wms
|
||||
VITE_GLOB_DOMAIN_URL=http://10.180.9.60:8000/cpte-wms
|
||||
|
||||
# 接口父路径前缀
|
||||
VITE_GLOB_API_URL_PREFIX=
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@
|
|||
<div class="app-loading-wrap">
|
||||
<div style="position: relative;">
|
||||
<img style="width: 350px; position: relative; z-index: 2;" src="<%= basePublicPath %>/resource/img/logo.png" class="app-loading-logo" alt="Logo" />
|
||||
<div class="app-loading-dots" style="position: absolute; bottom: 35px; left: 360px; z-index: 2;">
|
||||
<div class="app-loading-dots" style="position: absolute; bottom: 45px; left: 350px; z-index: 2;">
|
||||
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 107 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 107 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 107 KiB |
|
|
@ -1,4 +1,4 @@
|
|||
import { defineComponent, h, nextTick, ref, useSlots } from 'vue';
|
||||
import { defineComponent, h, ref, useSlots } from 'vue';
|
||||
import { vxeEmits, vxeProps } from './vxe.data';
|
||||
import { useData, useRefs, useResolveComponent as rc } from './hooks/useData';
|
||||
import { useColumns } from './hooks/useColumns';
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export const vxeProps = () => ({
|
|||
// 新增按钮配置
|
||||
addBtnCfg: propTypes.object,
|
||||
// 删除按钮配置
|
||||
removeBtnCfg: propTypes.object,
|
||||
removeBtnCfg: propTypes.object
|
||||
});
|
||||
|
||||
export const vxeEmits = ['save', 'added', 'removed', 'inserted', 'dragged', 'selectRowChange', 'pageChange', 'valueChange', 'blur'];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/agvTask/list',
|
||||
save='/agvTask/add',
|
||||
edit='/agvTask/edit',
|
||||
deleteOne = '/agvTask/delete',
|
||||
deleteBatch = '/agvTask/deleteBatch',
|
||||
importExcel = '/agvTask/importExcel',
|
||||
exportXls = '/agvTask/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import { render } from '@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '任务ID',
|
||||
align: "center",
|
||||
width: '170px',
|
||||
dataIndex: 'id'
|
||||
},
|
||||
{
|
||||
title: '容器',
|
||||
align: "center",
|
||||
width: '120px',
|
||||
dataIndex: 'carrierCode'
|
||||
},
|
||||
{
|
||||
title: '业务类型',
|
||||
align: "center",
|
||||
width: '120px',
|
||||
dataIndex: 'type_dictText'
|
||||
},
|
||||
{
|
||||
title: '任务状态',
|
||||
align: "center",
|
||||
width: '120px',
|
||||
dataIndex: 'status_dictText',
|
||||
customRender: ({ text }) => {
|
||||
//入库状态:已创建、已审核、收货中、收货完成、已关闭、已取消。
|
||||
const statusColorMap = {
|
||||
'已创建': 'orange',
|
||||
'执行中': 'cyan',
|
||||
'已到达': 'blue',
|
||||
'已完成': 'green',
|
||||
'已取消': 'red'
|
||||
};
|
||||
const color = statusColorMap[text] || 'red';
|
||||
return render.renderTag(text, color);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '起点',
|
||||
align: "center",
|
||||
width: '120px',
|
||||
dataIndex: 'startCode'
|
||||
},
|
||||
{
|
||||
title: '终点',
|
||||
align: "center",
|
||||
width: '120px',
|
||||
dataIndex: 'endCode'
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
align: "center",
|
||||
width: '60px',
|
||||
dataIndex: 'priority'
|
||||
},
|
||||
{
|
||||
title: '返回报文',
|
||||
align: "center",
|
||||
dataIndex: 'resMessage'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
<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">
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'agvTask:data_agv_task:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'agvTask:data_agv_task:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'agvTask:data_agv_task:importExcel'" v-show="false" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<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>
|
||||
<a-button v-auth="'agvTask:data_agv_task:deleteBatch'">批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AgvTaskModal ref="registerModal" @success="handleSuccess"></AgvTaskModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="agvTask-agvTask" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './AgvTask.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AgvTask.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import AgvTaskModal from './components/AgvTaskModal.vue'
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
|
||||
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: 'AGV任务表',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:true,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
for (let key in fieldPickers) {
|
||||
if (queryParam[key] && fieldPickers[key]) {
|
||||
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "AGV任务表",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'agvTask:data_agv_task:edit'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'agvTask:data_agv_task:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
-- 注意:该页面对应的前台目录为views/agvTask文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
|
||||
-- 主菜单
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('176240183424201', NULL, 'AGV任务表', '/agvTask/agvTaskList', 'agvTask/AgvTaskList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0);
|
||||
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424202', '176240183424201', '添加AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424203', '176240183424201', '编辑AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424204', '176240183424201', '删除AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424205', '176240183424201', '批量删除AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424206', '176240183424201', '导出excel_AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176240183424207', '176240183424201', '导入excel_AGV任务表', NULL, NULL, 0, NULL, NULL, 2, 'agvTask:data_agv_task:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-06 12:03:54', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 角色授权(以 admin 角色为例,role_id 可替换)
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424208', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424201', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424209', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424202', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424210', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424203', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424211', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424204', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424212', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424205', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424213', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424206', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176240183424214', 'f6817f48af4fb3af11b9e8bf182f618b', '176240183424207', NULL, '2025-11-06 12:03:54', '127.0.0.1');
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="AgvTaskForm">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="任务ID" v-bind="validateInfos.id" v-if="formData.id" id="AgvTaskForm-id" name="id">
|
||||
<a-input v-model:value="formData.id" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="容器" v-bind="validateInfos.carrierCode" id="AgvTaskForm-carrierCode" name="carrierCode">
|
||||
<JDictSelectTag v-model:value="formData.carrierCode" placeholder="请选择容器" dictCode="base_stock where iz_active=1 and del_flag=0,stock_code,stock_code" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="任务类型" v-bind="validateInfos.taskType" id="AgvTaskForm-taskType" name="taskType">
|
||||
<a-input v-model:value="formData.taskType" placeholder="请输入任务类型" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="业务类型" v-bind="validateInfos.type" id="AgvTaskForm-type" name="type">
|
||||
<JDictSelectTag
|
||||
type="select"
|
||||
v-model:value="formData.type"
|
||||
dictCode="business_type"
|
||||
placeholder="请选择业务类型"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="任务状态" v-bind="validateInfos.status" id="AgvTaskForm-status" name="status">
|
||||
<JDictSelectTag
|
||||
type="select"
|
||||
v-model:value="formData.status"
|
||||
dictCode="agv_task_status"
|
||||
placeholder="请选择任务状态"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="优先级" v-bind="validateInfos.priority" id="AgvTaskForm-priority" name="priority">
|
||||
<a-input-number v-model:value="formData.priority" placeholder="请输入优先级" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="起点" v-bind="validateInfos.startCode" id="AgvTaskForm-startCode" name="startCode">
|
||||
<JDictSelectTag v-model:value="formData.startCode" placeholder="请选择库位" dictCode="base_point where iz_active=1 and del_flag=0 ,point_code,point_code" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="终点" v-bind="validateInfos.endCode" id="AgvTaskForm-endCode" name="endCode">
|
||||
<JDictSelectTag v-model:value="formData.endCode" placeholder="请选择库位" dictCode="base_point where iz_active=1 and del_flag=0 ,point_code,point_code" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="返回报文" v-bind="validateInfos.resMessage" v-if="formData.id" id="AgvTaskForm-resMessage" name="resMessage">
|
||||
<a-textarea v-model:value="formData.resMessage" :rows="4" placeholder="请输入返回报文" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker, getValueType } from '/@/utils';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
import { saveOrUpdate } from '../AgvTask.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({})},
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
//仓库 ID
|
||||
let tenantId = getTenantId();
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
carrierCode: '',
|
||||
carrierType: 'TRAY',
|
||||
taskType: 'PF-LMR-COMMON',
|
||||
type: '',
|
||||
status: 'CREATED',
|
||||
priority: 99,
|
||||
startCode: '',
|
||||
endCode: '',
|
||||
resMessage: '',
|
||||
tenantId: tenantId,
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
carrierCode: [{ required: true, message: '请选择容器!'},],
|
||||
taskType: [{ required: true, message: '请输入任务类型!'},],
|
||||
type: [{ required: true, message: '请选择业务类型!'},],
|
||||
priority: [{ required: true, message: '请输入优先级!'},],
|
||||
startCode: [{ required: true, message: '请选择起点!'},],
|
||||
endCode: [{ required: true, message: '请选择终点!'},],
|
||||
status: [{ required: true, message: '请选择任务状态!'},]
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if(record.hasOwnProperty(key)){
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
try {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
}
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
if (model.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
// 更新个性化日期选择器的值
|
||||
model[data] = getDateByPicker(model[data], fieldPickers[data]);
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (model[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
model[data] = model[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdate(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
padding: 14px 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<j-modal :title="title" :maxHeight="400" :width="600" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<AgvTaskForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></AgvTaskForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import AgvTaskForm from './AgvTaskForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<a-col :lg="6">
|
||||
<a-form-item name="izActive">
|
||||
<template #label><span title="是否启用">是否启用</span></template>
|
||||
<JSearchSelect dict="dict_item_status" v-model:value="queryParam.izActive" placeholder="请选择" allow-clear />
|
||||
<JDictSelectTag v-model:value="queryParam.izActive" placeholder="请选择" dictCode="dict_item_status" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template v-if="toggleSearchStatus">
|
||||
|
|
@ -92,8 +92,8 @@
|
|||
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
|
||||
import JRangeDate from '@/components/Form/src/jeecg/components/JRangeDate.vue';
|
||||
import AreaModal from './components/AreaModal.vue';
|
||||
import JSearchSelect from '../../../components/Form/src/jeecg/components/JSearchSelect.vue';
|
||||
import SwitchStatus from '/@/views/base/SwitchStatus.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
|
||||
const fieldPickers = reactive({});
|
||||
const formRef = ref();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@
|
|||
const validatorRules = reactive({
|
||||
areaCode: [{ required: true, message: '请输入库区编码!' }],
|
||||
areaName: [{ required: true, message: '请输入库区名称!' }],
|
||||
delFlag: [{ required: true, message: '请输入删除状态!' }],
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
import { BasicColumn } from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '物料编码',
|
||||
align: "center",
|
||||
dataIndex: 'itemCode'
|
||||
align: 'center',
|
||||
dataIndex: 'itemCode',
|
||||
},
|
||||
{
|
||||
title: '物料名称',
|
||||
align: "center",
|
||||
dataIndex: 'itemName'
|
||||
align: 'center',
|
||||
dataIndex: 'itemName',
|
||||
},
|
||||
{
|
||||
title: '仓库ID',
|
||||
align: "center",
|
||||
dataIndex: 'tenantId'
|
||||
title: '是否启用',
|
||||
align: 'center',
|
||||
dataIndex: 'izActive',
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
align: 'center',
|
||||
dataIndex: 'description',
|
||||
},
|
||||
{
|
||||
title: '创建日期',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
sorter: true,
|
||||
}
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
itemCode: {title: '物料编码',order: 0,view: 'text', type: 'string',},
|
||||
itemName: {title: '物料名称',order: 1,view: 'text', type: 'string',},
|
||||
tenantId: {title: '仓库ID',order: 2,view: 'number', type: 'number',},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,36 @@
|
|||
<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">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="itemCode">
|
||||
<template #label><span title="物料编码">物料编码</span></template>
|
||||
<JInput v-model:value="queryParam.itemCode" :placeholder="'请输入物料编码'" :type="JInputTypeEnum.JINPUT_RIGHT_LIKE" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="itemName">
|
||||
<template #label><span title="物料名称">物料名称</span></template>
|
||||
<JInput v-model:value="queryParam.itemName" :placeholder="'请输入物料名称'" :type="JInputTypeEnum.JINPUT_RIGHT_LIKE" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="izActive">
|
||||
<template #label><span title="是否启用">是否启用</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.izActive" placeholder="请选择" dictCode="dict_item_status" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<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>
|
||||
|
|
@ -13,7 +43,9 @@
|
|||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'base:base_item:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button type="primary" v-auth="'base:base_item:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
||||
<j-upload-button type="primary" v-auth="'base:base_item:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<j-upload-button type="primary" v-auth="'base:base_item:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
|
||||
>导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
|
|
@ -23,19 +55,17 @@
|
|||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'base:base_item:deleteBatch'">批量操作
|
||||
<a-button v-auth="'base:base_item:deleteBatch'"
|
||||
>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<!-- 高级查询 -->
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }"></template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<ItemModal ref="registerModal" @success="handleSuccess"></ItemModal>
|
||||
|
|
@ -43,20 +73,21 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" name="base-item" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { ref, reactive, h } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './Item.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Item.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import ItemModal from './components/ItemModal.vue'
|
||||
import { columns } from './Item.data';
|
||||
import { list, deleteOne, batchDelete, saveOrUpdate, getImportUrl, getExportUrl } from './Item.api';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import { JInputTypeEnum } from '@/enums/cpteEnum';
|
||||
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
|
||||
import ItemModal from './components/ItemModal.vue';
|
||||
import SwitchStatus from '/@/views/base/SwitchStatus.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
|
|
@ -64,12 +95,38 @@
|
|||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
//将是否启用转换成开关
|
||||
const enhancedColumns = columns.map((col) => {
|
||||
if (col.dataIndex === 'izActive') {
|
||||
return {
|
||||
...col,
|
||||
customRender: ({ record }) => {
|
||||
return h(SwitchStatus, {
|
||||
modelValue: record.izActive,
|
||||
recordId: record.id,
|
||||
recordName: record.itemCode,
|
||||
updateApi: saveOrUpdate,
|
||||
switchOptions: ['1', '0'],
|
||||
checkedChildren: '启用',
|
||||
unCheckedChildren: '禁用',
|
||||
buildParams: (value) => ({
|
||||
izActive: value,
|
||||
itemCode: record.itemCode,
|
||||
}),
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
return col;
|
||||
});
|
||||
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '物料',
|
||||
api: list,
|
||||
columns,
|
||||
columns: enhancedColumns,
|
||||
canResize: true,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
|
|
@ -77,7 +134,7 @@
|
|||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
console.log("params",params)
|
||||
console.log('params', params);
|
||||
for (let key in fieldPickers) {
|
||||
if (queryParam[key] && fieldPickers[key]) {
|
||||
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
|
||||
|
|
@ -87,40 +144,28 @@
|
|||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "物料",
|
||||
name: '物料',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
|
||||
tableContext;
|
||||
const labelCol = reactive({
|
||||
xs: 24,
|
||||
sm: 4,
|
||||
xl: 6,
|
||||
xxl:4
|
||||
xxl: 4,
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
|
|
@ -174,7 +219,7 @@
|
|||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'base:base_item:edit'
|
||||
auth: 'base:base_item:edit',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -187,16 +232,17 @@
|
|||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'base:base_item:delete'
|
||||
}
|
||||
]
|
||||
auth: 'base:base_item:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -215,35 +261,35 @@
|
|||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.query-group-cust {
|
||||
min-width: 100px !important;
|
||||
}
|
||||
|
||||
.query-group-split-cust {
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ant-form-item:not(.ant-form-item-with-help) {
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,13 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="仓库ID" v-bind="validateInfos.tenantId" id="ItemForm-tenantId" name="tenantId">
|
||||
<a-input-number v-model:value="formData.tenantId" placeholder="请输入仓库ID" style="width: 100%" />
|
||||
<a-form-item label="描述" v-bind="validateInfos.description" id="AreaForm-description" name="description">
|
||||
<a-textarea v-model:value="formData.description" :rows="4" placeholder="请输入描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="是否启用" v-bind="validateInfos.izActive" id="AreaForm-izActive" name="izActive">
|
||||
<JSwitch v-model:value="formData.izActive" :options="['1', '0']"></JSwitch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
@ -27,26 +32,32 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker, getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../Item.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import JSwitch from '@/components/Form/src/jeecg/components/JSwitch.vue';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({}) },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
formBpm: { type: Boolean, default: true },
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
//仓库 ID
|
||||
let tenantId = getTenantId();
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
itemCode: '',
|
||||
itemName: '',
|
||||
tenantId: undefined,
|
||||
delFlag: 0,
|
||||
izActive: 1,
|
||||
tenantId: tenantId,
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
|
|
@ -54,11 +65,12 @@
|
|||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
itemCode: [{ required: true, message: '请输入库区编码!' }],
|
||||
itemName: [{ required: true, message: '请输入库区名称!' }],
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(() => {
|
||||
|
|
@ -72,7 +84,6 @@
|
|||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
|
|
@ -89,9 +100,9 @@
|
|||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (record.hasOwnProperty(key)) {
|
||||
tmpData[key] = record[key]
|
||||
tmpData[key] = record[key];
|
||||
}
|
||||
})
|
||||
});
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
|
|
@ -147,7 +158,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<j-modal :title="title" maxHeight="500px" :width="800" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<j-modal :title="title" :maxHeight="500" :width="600" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<ItemForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ItemForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '排',
|
||||
align: 'center',
|
||||
dataIndex: 'row',
|
||||
dataIndex: 'rows',
|
||||
},
|
||||
{
|
||||
title: '列',
|
||||
align: 'center',
|
||||
dataIndex: 'col',
|
||||
dataIndex: 'cols',
|
||||
},
|
||||
{
|
||||
title: '层',
|
||||
align: 'center',
|
||||
dataIndex: 'layer',
|
||||
dataIndex: 'layers',
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<a-col :lg="6">
|
||||
<a-form-item name="areaId">
|
||||
<template #label><span title="库区">库区</span></template>
|
||||
<AreaSelect v-model:value="queryParam.areaId" :area="queryParam" />
|
||||
<JDictSelectTag v-model:value="queryParam.areaId" placeholder="请选择库区" dictCode="base_area where iz_active=1 and del_flag=0 ,area_name,id" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
|
|
@ -16,12 +16,20 @@
|
|||
<JInput v-model:value="queryParam.pointCode" :placeholder="'请输入库位编码'" :type="JInputTypeEnum.JINPUT_RIGHT_LIKE" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="status">
|
||||
<template #label><span title="状态">状态</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.status" placeholder="请选择" dictCode="common_status" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template v-if="toggleSearchStatus">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="izActive">
|
||||
<template #label><span title="是否启用">是否启用</span></template>
|
||||
<JSearchSelect dict="dict_item_status" v-model:value="queryParam.izActive" placeholder="请选择" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
<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">
|
||||
|
|
@ -77,17 +85,16 @@
|
|||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './Point.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Point.api';
|
||||
import { list, deleteOne, batchDelete, saveOrUpdate, getImportUrl, getExportUrl } from './Point.api';
|
||||
import PointModal from './components/PointModal.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import AreaSelect from '@/views/base/area/components/AreaSelect.vue';
|
||||
import { JInputTypeEnum } from '@/enums/cpteEnum';
|
||||
import JInput from '../../../components/Form/src/jeecg/components/JInput.vue';
|
||||
import SwitchStatus from '/@/views/base/SwitchStatus.vue';
|
||||
import { saveOrUpdate } from '@/views/base/area/Area.api';
|
||||
import JSearchSelect from "../../../components/Form/src/jeecg/components/JSearchSelect.vue";
|
||||
import JSearchSelect from '../../../components/Form/src/jeecg/components/JSearchSelect.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="库区" v-bind="validateInfos.areaId" id="PointForm-areaId" name="areaId">
|
||||
<AreaSelect v-model:value="formData.areaId" />
|
||||
<JDictSelectTag v-model:value="formData.areaId" placeholder="请选择库区" dictCode="base_area where iz_active=1 and del_flag=0,area_name,id" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
|
|
@ -17,7 +17,13 @@
|
|||
|
||||
<a-col :span="24">
|
||||
<a-form-item label="状态" v-bind="validateInfos.status" id="PointForm-status" name="status">
|
||||
<JDictSelectTag type="select" v-model:value="formData.status" dictCode="common_status" placeholder="请选择状态" string-to-number="true" />
|
||||
<JDictSelectTag
|
||||
v-model:value="formData.status"
|
||||
dictCode="common_status"
|
||||
placeholder="请选择状态"
|
||||
allow-clear
|
||||
:string-to-number="true"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
|
|
@ -60,8 +66,7 @@
|
|||
import { saveOrUpdate } from '../Point.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import AreaSelect from '@/views/base/area/components/AreaSelect.vue';
|
||||
import JDictSelectTag from '../../../../components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
import JSwitch from '@/components/Form/src/jeecg/components/JSwitch.vue';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,361 @@
|
|||
<!-- 库位下拉选择-->
|
||||
<template>
|
||||
<a-select
|
||||
v-model:value="selectedValue"
|
||||
showSearch
|
||||
:placeholder="placeholder"
|
||||
:loading="loading"
|
||||
:allowClear="true"
|
||||
:filterOption="filterOption"
|
||||
:notFoundContent="notFoundContent"
|
||||
:mode="multiple ? 'multiple' : 'default'"
|
||||
@change="handleChange"
|
||||
@search="handleSearch"
|
||||
@focus="handleFocus"
|
||||
@popupScroll="handlePopupScroll"
|
||||
:getPopupContainer="getParentContainer"
|
||||
v-bind="attrs"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<a-spin v-if="loading" size="small" />
|
||||
<span v-else>暂无库位数据</span>
|
||||
</template>
|
||||
<a-select-option v-for="option in PointOptions" :key="option.id" :value="getOptionValue(option)">
|
||||
{{ getOptionLabel(option) }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, watch, computed, onMounted } from 'vue';
|
||||
import { useAttrs } from '/@/hooks/core/useAttrs';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { setPopContainer } from '/@/utils';
|
||||
import { debounce } from 'lodash-es';
|
||||
|
||||
// 库位数据接口
|
||||
interface Point {
|
||||
id: string;
|
||||
pointCode: string;
|
||||
areaId_dictText: string;
|
||||
}
|
||||
|
||||
//响应数据接口
|
||||
interface ResponseData {
|
||||
records: Point[];
|
||||
total: number;
|
||||
size: number;
|
||||
current: number;
|
||||
page: number;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PointSelect',
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
// 选中值,支持v-model
|
||||
value: propTypes.oneOfType([propTypes.string, propTypes.array, propTypes.object]),
|
||||
// 占位符
|
||||
placeholder: propTypes.string.def('请选择库位'),
|
||||
// 是否多选
|
||||
multiple: propTypes.bool.def(false),
|
||||
// 是否异步加载数据
|
||||
async: propTypes.bool.def(true),
|
||||
// 分页大小
|
||||
pageSize: propTypes.number.def(20),
|
||||
// 弹出层容器
|
||||
popContainer: propTypes.string,
|
||||
// 自定义弹出层容器函数
|
||||
getPopupContainer: {
|
||||
type: Function,
|
||||
default: (node: HTMLElement) => node?.parentNode,
|
||||
},
|
||||
// 是否立即触发change事件
|
||||
immediateChange: propTypes.bool.def(false),
|
||||
// 返回值类型: 'id'(默认) | 'object' | 其他字段名
|
||||
returnValue: propTypes.string.def('id'),
|
||||
//默认启用
|
||||
izActive: propTypes.number.def(1),
|
||||
},
|
||||
emits: ['change', 'update:value', 'optionsLoaded'],
|
||||
setup(props, { emit }) {
|
||||
const PointOptions = ref<Point[]>([]);
|
||||
const loading = ref<boolean>(false);
|
||||
const allPoints = ref<Point[]>([]);
|
||||
const attrs = useAttrs({ excludeDefaultKeys: false });
|
||||
|
||||
// 分页相关
|
||||
const pageNo = ref(1);
|
||||
const isHasData = ref(true);
|
||||
const scrollLoading = ref(false);
|
||||
const searchKeyword = ref('');
|
||||
|
||||
// 选中值
|
||||
const selectedValue = ref<string | string[] | undefined>(undefined);
|
||||
|
||||
// 未找到内容
|
||||
const notFoundContent = computed(() => {
|
||||
return loading.value ? undefined : null;
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取选项显示文本 - 始终显示完整格式
|
||||
*/
|
||||
function getOptionLabel(option: Point) {
|
||||
return `${option.pointCode} - ${option.areaId_dictText }`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选项值 - 根据returnValue确定实际存储的值
|
||||
*/
|
||||
function getOptionValue(option: Point) {
|
||||
if (props.returnValue === 'object') {
|
||||
return option.id; // 对于object类型,仍然使用id作为选项值,但在change事件中返回完整对象
|
||||
} else if (props.returnValue === 'id') {
|
||||
return option.id;
|
||||
} else {
|
||||
return option[props.returnValue as keyof Point] as string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取弹出层容器
|
||||
*/
|
||||
function getParentContainer(node: HTMLElement) {
|
||||
if (props.popContainer) {
|
||||
return setPopContainer(node, props.popContainer);
|
||||
} else {
|
||||
if (typeof props.getPopupContainer === 'function') {
|
||||
return props.getPopupContainer(node);
|
||||
} else {
|
||||
return node?.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤选项 - 禁用前端过滤,使用后端搜索
|
||||
*/
|
||||
function filterOption(_input: string, _option: any) {
|
||||
return true; // 禁用前端过滤,完全依赖后端搜索
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库位数据
|
||||
*/
|
||||
const fetchPoints = async (page = 1, keyword = '', isSearch = false) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
const res = await defHttp.get<ResponseData>({
|
||||
url: '/base/point/list',
|
||||
params: {
|
||||
pageSize: props.pageSize,
|
||||
pageNo: page,
|
||||
keyword: keyword,
|
||||
izActive: props.izActive,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('获取库位数据成功:', res);
|
||||
const records = res.records || [];
|
||||
|
||||
if (page === 1 || isSearch) {
|
||||
// 第一页或搜索时,重置数据
|
||||
allPoints.value = records;
|
||||
PointOptions.value = records;
|
||||
} else {
|
||||
// 滚动加载时,追加数据
|
||||
allPoints.value = [...allPoints.value, ...records];
|
||||
PointOptions.value = [...PointOptions.value, ...records];
|
||||
}
|
||||
|
||||
// 修正分页判断逻辑
|
||||
isHasData.value = records.length >= props.pageSize;
|
||||
console.log('是否还有更多数据:', records.length);
|
||||
|
||||
emit('optionsLoaded', allPoints.value);
|
||||
} catch (error) {
|
||||
console.error('获取库位数据失败:', error);
|
||||
if (page === 1) {
|
||||
allPoints.value = [];
|
||||
PointOptions.value = [];
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
scrollLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据选项值找到对应的选项对象
|
||||
*/
|
||||
function findOptionByValue(value: string): Point | undefined {
|
||||
if (props.returnValue === 'object' || props.returnValue === 'id') {
|
||||
return allPoints.value.find((item) => item.id === value);
|
||||
} else {
|
||||
return allPoints.value.find((item) => item[props.returnValue as keyof Point] === value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需要返回的值
|
||||
*/
|
||||
function getReturnValue(value: string | string[]) {
|
||||
if (!value) {
|
||||
return props.multiple ? [] : undefined;
|
||||
}
|
||||
|
||||
// 如果返回整个对象
|
||||
if (props.returnValue === 'object') {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((v) => findOptionByValue(v)).filter(Boolean);
|
||||
} else {
|
||||
return findOptionByValue(value);
|
||||
}
|
||||
}
|
||||
// 如果返回ID(默认情况)
|
||||
else if (props.returnValue === 'id') {
|
||||
return value;
|
||||
}
|
||||
// 如果返回对象中的某个字段
|
||||
else {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((v) => {
|
||||
const option = findOptionByValue(v);
|
||||
return option ? option[props.returnValue as keyof Point] : v;
|
||||
});
|
||||
} else {
|
||||
const option = findOptionByValue(value);
|
||||
return option ? option[props.returnValue as keyof Point] : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索处理(防抖)
|
||||
*/
|
||||
const handleSearch = debounce(function (value: string) {
|
||||
searchKeyword.value = value;
|
||||
pageNo.value = 1;
|
||||
isHasData.value = true;
|
||||
|
||||
// 直接调用API进行搜索
|
||||
fetchPoints(1, value, true);
|
||||
}, 300);
|
||||
|
||||
/**
|
||||
* 处理焦点事件
|
||||
*/
|
||||
function handleFocus() {
|
||||
// 如果还没有数据,加载数据
|
||||
if (allPoints.value.length === 0 && props.async) {
|
||||
pageNo.value = 1;
|
||||
isHasData.value = true;
|
||||
fetchPoints(1, '');
|
||||
}
|
||||
attrs.onFocus?.();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理值变化
|
||||
*/
|
||||
function handleChange(value: string | string[]) {
|
||||
selectedValue.value = value;
|
||||
|
||||
// 根据配置返回相应的值
|
||||
const returnValue = getReturnValue(value);
|
||||
console.log('值变化:', returnValue);
|
||||
emit('update:value', returnValue);
|
||||
emit('change', returnValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 滚动加载处理
|
||||
*/
|
||||
function handlePopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
|
||||
if (!scrollLoading.value && isHasData.value && scrollTop + clientHeight >= scrollHeight - 10) {
|
||||
console.log('滚动加载更多');
|
||||
scrollLoading.value = true;
|
||||
pageNo.value++;
|
||||
|
||||
fetchPoints(pageNo.value, searchKeyword.value)
|
||||
.finally(() => {
|
||||
scrollLoading.value = false;
|
||||
})
|
||||
.catch(() => {
|
||||
pageNo.value--;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据选中值初始化显示文本
|
||||
*/
|
||||
const initSelectValue = async () => {
|
||||
if (!props.value) {
|
||||
selectedValue.value = props.multiple ? [] : undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果是异步模式且还没有加载数据,则先加载数据
|
||||
if (props.async && allPoints.value.length === 0) {
|
||||
await fetchPoints();
|
||||
}
|
||||
|
||||
// 根据不同的returnValue设置选中的值
|
||||
if (props.returnValue === 'object') {
|
||||
// 如果返回的是对象,value可能是对象或对象数组
|
||||
if (Array.isArray(props.value)) {
|
||||
selectedValue.value = props.value.map((item: any) => item.id);
|
||||
} else {
|
||||
selectedValue.value = (props.value as any).id;
|
||||
}
|
||||
} else if (props.returnValue === 'id') {
|
||||
selectedValue.value = props.value as string | string[];
|
||||
} else {
|
||||
// 对于其他字段类型,直接使用传入的值
|
||||
selectedValue.value = props.value as string | string[];
|
||||
}
|
||||
};
|
||||
|
||||
// 监听value变化
|
||||
watch(
|
||||
() => props.value,
|
||||
() => {
|
||||
initSelectValue();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 组件挂载时初始化
|
||||
onMounted(() => {
|
||||
if (!props.async) {
|
||||
fetchPoints();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
attrs,
|
||||
PointOptions,
|
||||
loading,
|
||||
selectedValue,
|
||||
notFoundContent,
|
||||
getParentContainer,
|
||||
filterOption,
|
||||
handleChange,
|
||||
handleSearch,
|
||||
handleFocus,
|
||||
getOptionLabel,
|
||||
getOptionValue,
|
||||
handlePopupScroll,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
|
|
@ -10,6 +7,30 @@ export const columns: BasicColumn[] = [
|
|||
align: "center",
|
||||
dataIndex: 'stockCode'
|
||||
},
|
||||
{
|
||||
title: '容器类型',
|
||||
align: "center",
|
||||
dataIndex: 'stockType_dictText'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
dataIndex: 'status_dictText',
|
||||
customRender: ({ text }) => {
|
||||
const color = text == '占用' ? 'red' : text == '空闲' ? 'green' : 'gray';
|
||||
return render.renderTag(text, color);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '库位',
|
||||
align: "center",
|
||||
dataIndex: 'pointId_dictText'
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
align: 'center',
|
||||
dataIndex: 'izActive',
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
align: "center",
|
||||
|
|
@ -22,9 +43,3 @@ export const columns: BasicColumn[] = [
|
|||
},
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
stockCode: {title: '容器编码',order: 0,view: 'text', type: 'string',},
|
||||
description: {title: '描述',order: 1,view: 'text', type: 'string',},
|
||||
createTime: {title: '创建日期',order: 3,view: 'datetime', type: 'string',},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,11 +11,25 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="createTime">
|
||||
<template #label><span title="创建日期">创建日期</span></template>
|
||||
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="请选择创建日期" v-model:value="queryParam.createTime" allow-clear />
|
||||
<a-form-item name="pointId">
|
||||
<template #label><span title="库位">库位</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.pointId" placeholder="请选择库区" dictCode="base_point where iz_active=1 and del_flag=0 ,point_code,id" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="status">
|
||||
<template #label><span title="状态">状态</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.status" placeholder="请选择状态" dictCode="common_status" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template v-if="toggleSearchStatus">
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="izActive">
|
||||
<template #label><span title="是否启用">是否启用</span></template>
|
||||
<JSearchSelect dict="dict_item_status" v-model:value="queryParam.izActive" placeholder="请选择" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</template>
|
||||
<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">
|
||||
|
|
@ -37,7 +51,9 @@
|
|||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'base:base_stock:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button type="primary" v-auth="'base:base_stock:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
||||
<j-upload-button type="primary" v-auth="'base:base_stock:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
<j-upload-button type="primary" v-auth="'base:base_stock:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
|
||||
>导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
|
|
@ -47,19 +63,17 @@
|
|||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'base:base_stock:deleteBatch'">批量操作
|
||||
<a-button v-auth="'base:base_stock:deleteBatch'"
|
||||
>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<!-- 高级查询 -->
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }"></template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<StockModal ref="registerModal" @success="handleSuccess"></StockModal>
|
||||
|
|
@ -67,20 +81,20 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" name="base-stock" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { ref, reactive, h } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './Stock.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Stock.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import StockModal from './components/StockModal.vue'
|
||||
import { columns } from './Stock.data';
|
||||
import { list, deleteOne, batchDelete, saveOrUpdate, getImportUrl, getExportUrl } from './Stock.api';
|
||||
import StockModal from './components/StockModal.vue';
|
||||
import SwitchStatus from '/@/views/base/SwitchStatus.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import JSearchSelect from '../../../components/Form/src/jeecg/components/JSearchSelect.vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
|
|
@ -88,12 +102,38 @@
|
|||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
//将是否启用转换成开关
|
||||
const enhancedColumns = columns.map((col) => {
|
||||
if (col.dataIndex === 'izActive') {
|
||||
return {
|
||||
...col,
|
||||
customRender: ({ record }) => {
|
||||
return h(SwitchStatus, {
|
||||
modelValue: record.izActive,
|
||||
recordId: record.id,
|
||||
recordName: record.stockCode,
|
||||
updateApi: saveOrUpdate,
|
||||
switchOptions: ['1', '0'],
|
||||
checkedChildren: '启用',
|
||||
unCheckedChildren: '禁用',
|
||||
buildParams: (value) => ({
|
||||
izActive: value,
|
||||
stockCode: record.stockCode,
|
||||
}),
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
return col;
|
||||
});
|
||||
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '容器',
|
||||
api: list,
|
||||
columns,
|
||||
columns: enhancedColumns,
|
||||
canResize: true,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
|
|
@ -110,40 +150,28 @@
|
|||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "容器",
|
||||
name: '容器',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
|
||||
tableContext;
|
||||
const labelCol = reactive({
|
||||
xs: 24,
|
||||
sm: 4,
|
||||
xl: 6,
|
||||
xxl:4
|
||||
xxl: 4,
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
|
|
@ -197,7 +225,7 @@
|
|||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'base:base_stock:edit'
|
||||
auth: 'base:base_stock:edit',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -210,16 +238,17 @@
|
|||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'base:base_stock:delete'
|
||||
}
|
||||
]
|
||||
auth: 'base:base_stock:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -238,35 +267,35 @@
|
|||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.query-group-cust {
|
||||
min-width: 100px !important;
|
||||
}
|
||||
|
||||
.query-group-split-cust {
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ant-form-item:not(.ant-form-item-with-help) {
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,40 @@
|
|||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="StockForm">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="容器编码" v-bind="validateInfos.stockCode" id="StockForm-stockCode" name="stockCode">
|
||||
<a-input v-model:value="formData.stockCode" placeholder="请输入容器编码" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="描述" v-bind="validateInfos.description" id="StockForm-description" name="description">
|
||||
<a-input v-model:value="formData.description" placeholder="请输入描述" allow-clear ></a-input>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="容器类型" v-bind="validateInfos.stockType" id="StockForm-stockType" name="stockType">
|
||||
<JDictSelectTag v-model:value="formData.stockType" dictCode="stock_type" placeholder="请选择容器类型" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="创建日期" v-bind="validateInfos.createTime" id="StockForm-createTime" name="createTime">
|
||||
<a-date-picker placeholder="请选择创建日期" v-model:value="formData.createTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
|
||||
<a-col :span="24">
|
||||
<a-form-item label="状态" v-bind="validateInfos.status" id="StockForm-status" name="status">
|
||||
<JDictSelectTag
|
||||
v-model:value="formData.status"
|
||||
dictCode="common_status"
|
||||
placeholder="请选择状态"
|
||||
allowClear
|
||||
:string-to-number="true"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="库位" v-bind="validateInfos.pointId" id="StockForm-pointId" name="pointId">
|
||||
<JDictSelectTag v-model:value="formData.pointId" placeholder="请选择库位" dictCode="base_point where iz_active=1 and del_flag=0 ,point_code,id" allowClear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="描述" v-bind="validateInfos.description" id="StockForm-description" name="description">
|
||||
<a-textarea v-model:value="formData.description" :rows="4" placeholder="请输入描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="是否启用" v-bind="validateInfos.izActive" id="StockForm-izActive" name="izActive">
|
||||
<JSwitch v-model:value="formData.izActive" :options="['1', '0']"></JSwitch>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
@ -27,27 +48,36 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed } from 'vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker, getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../Stock.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import JSwitch from '@/components/Form/src/jeecg/components/JSwitch.vue';
|
||||
import JDictSelectTag from '../../../../components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({}) },
|
||||
formBpm: { type: Boolean, default: true }
|
||||
formBpm: { type: Boolean, default: true },
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
//仓库 ID
|
||||
let tenantId = getTenantId();
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
pointId: '',
|
||||
stockCode: '',
|
||||
stockType: 'TRAY',
|
||||
status: 0,
|
||||
description: '',
|
||||
delFlag: '',
|
||||
createTime: '',
|
||||
delFlag: 0,
|
||||
izActive: 1,
|
||||
tenantId: tenantId,
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
|
|
@ -55,13 +85,13 @@
|
|||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
stockCode: [{ required: true, message: '请输入容器编码!'},],
|
||||
delFlag: [{ required: true, message: '请输入删除状态!'},],
|
||||
stockCode: [{ required: true, message: '请输入容器编码!' }],
|
||||
stockType: [{ required: true, message: '请选择容器类型!' }],
|
||||
status: [{ required: true, message: '请选择状态!' }],
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const fieldPickers = reactive({});
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(() => {
|
||||
|
|
@ -75,7 +105,6 @@
|
|||
return props.formDisabled;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
|
|
@ -92,9 +121,9 @@
|
|||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (record.hasOwnProperty(key)) {
|
||||
tmpData[key] = record[key]
|
||||
tmpData[key] = record[key];
|
||||
}
|
||||
})
|
||||
});
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
|
|
@ -125,6 +154,7 @@
|
|||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
console.log('data:' + data);
|
||||
// 更新个性化日期选择器的值
|
||||
model[data] = getDateByPicker(model[data], fieldPickers[data]);
|
||||
//如果该数据是数组并且是字符串类型
|
||||
|
|
@ -150,7 +180,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<j-modal :title="title" maxHeight="500px" :width="896" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<j-modal :title="title" :maxHeight="500" :width="600" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<StockForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></StockForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
title.value = '新增容器';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
title.value = disableSubmit.value ? '容器详情' : '编辑容器';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/receive/asn/list',
|
||||
save='/receive/asn/add',
|
||||
edit='/receive/asn/edit',
|
||||
deleteOne = '/receive/asn/delete',
|
||||
deleteBatch = '/receive/asn/deleteBatch',
|
||||
importExcel = '/receive/asn/importExcel',
|
||||
exportXls = '/receive/asn/exportXls',
|
||||
queryDataById = '/receive/asn/queryById',
|
||||
asnDetailList = '/receive/asn/queryAsnDetailByMainId',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 查询子表数据
|
||||
* @param params
|
||||
*/
|
||||
export const queryAsnDetailListByMainId = (id) => defHttp.get({url: Api.asnDetailList, params:{ id }});
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询数据
|
||||
* @param params
|
||||
*/
|
||||
export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
|
||||
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
import { BasicColumn } from '/@/components/Table';
|
||||
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { render } from '@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '系统单号',
|
||||
align: 'center',
|
||||
dataIndex: 'orderNo',
|
||||
},
|
||||
{
|
||||
title: '外部单号',
|
||||
align: 'center',
|
||||
dataIndex: 'thirdPartyOrderNo',
|
||||
},
|
||||
{
|
||||
title: '任务号',
|
||||
align: 'center',
|
||||
dataIndex: 'no',
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
align: 'center',
|
||||
dataIndex: 'status_dictText',
|
||||
customRender: ({ text }) => {
|
||||
//入库状态:已创建、已审核、收货中、收货完成、已关闭、已取消。
|
||||
const statusColorMap = {
|
||||
'已创建': 'orange',
|
||||
'已审核': 'pink',
|
||||
'收货中': 'cyan',
|
||||
'收货完成': 'blue',
|
||||
'已关闭': 'green',
|
||||
'已取消': 'red'
|
||||
};
|
||||
const color = statusColorMap[text] || 'red';
|
||||
return render.renderTag(text, color);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '单据类型',
|
||||
align: 'center',
|
||||
dataIndex: 'orderType_dictText',
|
||||
},
|
||||
{
|
||||
title: '需求数量',
|
||||
align: 'center',
|
||||
dataIndex: 'orderQty',
|
||||
},
|
||||
{
|
||||
title: '收货数量',
|
||||
align: 'center',
|
||||
dataIndex: 'receivedQty',
|
||||
},
|
||||
{
|
||||
title: '供应商',
|
||||
align: 'center',
|
||||
dataIndex: 'supplierCode',
|
||||
},
|
||||
{
|
||||
title: '外部仓库',
|
||||
align: 'center',
|
||||
dataIndex: 'whCode',
|
||||
},
|
||||
{
|
||||
title: '订单日期',
|
||||
align: 'center',
|
||||
dataIndex: 'orderDate',
|
||||
},
|
||||
];
|
||||
|
||||
//子表表格配置
|
||||
export const asnDetailColumns: JVxeColumn[] = [
|
||||
{
|
||||
title: '入库单ID',
|
||||
key: 'asnId',
|
||||
type: JVxeTypes.hidden,
|
||||
width: '130px',
|
||||
},
|
||||
{
|
||||
title: '物料',
|
||||
key: 'itemId',
|
||||
type: JVxeTypes.selectDictSearch,
|
||||
width: 150,
|
||||
async: true, // 异步搜索,默认为 true
|
||||
//查询状态启用、未删除的物料
|
||||
dict: 'base_item where iz_active=1 and del_flag=0,item_code,id',
|
||||
tipsContent: '请搜索物料',
|
||||
validateRules: [
|
||||
{
|
||||
required: true, // 必填
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '单位',
|
||||
key: 'unit',
|
||||
type: JVxeTypes.select,
|
||||
dictCode: 'package_unit',
|
||||
width: '130px',
|
||||
placeholder: '请选择${title}',
|
||||
defaultValue: '托',
|
||||
},
|
||||
{
|
||||
title: '容器',
|
||||
key: 'stockId',
|
||||
type: JVxeTypes.selectDictSearch,
|
||||
width: 150,
|
||||
async: true, // 异步搜索,默认为 true
|
||||
//查询状态为可用、启用、未删除的容器
|
||||
dict: 'base_stock where status=0 and iz_active=1 and del_flag=0,stock_code,id',
|
||||
tipsContent: '请搜索容器',
|
||||
validateRules: [
|
||||
{
|
||||
required: true, // 必填
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '库位',
|
||||
key: 'pointId',
|
||||
type: JVxeTypes.selectDictSearch,
|
||||
width: 150,
|
||||
async: true, // 异步搜索,默认为 true
|
||||
//查询状态为可用、启用、未删除的库位
|
||||
dict: 'base_point where status=0 and iz_active=1 and del_flag=0,point_code,id',
|
||||
tipsContent: '请搜索库位',
|
||||
validateRules: [
|
||||
{
|
||||
required: true, // 必填
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '需求数量',
|
||||
key: 'orderQty',
|
||||
type: JVxeTypes.inputNumber,
|
||||
width: '130px',
|
||||
validateRules: [
|
||||
{
|
||||
required: true, // 必填
|
||||
message: '请输入${title}', // 显示的文本
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '收货数量',
|
||||
key: 'receivedQty',
|
||||
type: JVxeTypes.normal,
|
||||
width: '130px',
|
||||
defaultValue: '0',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: '项目号',
|
||||
key: 'project',
|
||||
type: JVxeTypes.input,
|
||||
width: '130px',
|
||||
placeholder: '请输入${title}',
|
||||
},
|
||||
{
|
||||
title: '任务号',
|
||||
key: 'taskNo',
|
||||
type: JVxeTypes.input,
|
||||
width: '130px',
|
||||
placeholder: '请输入${title}',
|
||||
},
|
||||
{
|
||||
title: '批次号',
|
||||
key: 'propC1',
|
||||
type: JVxeTypes.input,
|
||||
width: '130px',
|
||||
placeholder: '请输入${title}',
|
||||
},
|
||||
{
|
||||
title: '库存状态',
|
||||
key: 'propC3',
|
||||
type: JVxeTypes.input,
|
||||
width: '130px',
|
||||
placeholder: '请输入${title}',
|
||||
},
|
||||
];
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24"> </a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'receive:data_asn:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
|
||||
<a-button type="primary" v-auth="'receive:data_asn:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
|
||||
<j-upload-button type="primary" v-auth="'receive:data_asn:importExcel'" v-show="false" preIcon="ant-design:import-outlined" @click="onImportXls"
|
||||
>导入
|
||||
</j-upload-button>
|
||||
<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>
|
||||
<a-button v-auth="'receive:data_asn:deleteBatch'"
|
||||
>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template v-slot:bodyCell="{ column, record, index, text }"> </template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<AsnModal @register="registerModal" @success="handleSuccess"></AsnModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="receive-asn" setup>
|
||||
import { ref, reactive, computed, unref } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import AsnModal from './components/AsnModal.vue';
|
||||
import { columns } from './Asn.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Asn.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const fieldPickers = reactive({});
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '入库单',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
for (let key in fieldPickers) {
|
||||
if (queryParam[key] && fieldPickers[key]) {
|
||||
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '入库单',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'receive:data_asn:edit',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'receive:data_asn:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/* ----------------------以下为原生查询需要添加的-------------------------- */
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const labelCol = reactive({
|
||||
xs: 24,
|
||||
sm: 4,
|
||||
xl: 6,
|
||||
xxl: 4,
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.query-group-cust {
|
||||
min-width: 100px !important;
|
||||
}
|
||||
|
||||
.query-group-split-cust {
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ant-form-item:not(.ant-form-item-with-help) {
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
:deep(.ant-picker),
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
-- 注意:该页面对应的前台目录为views/receive文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
|
||||
-- 主菜单
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('176216432288201', NULL, '入库单', '/receive/asnList', 'receive/AsnList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0);
|
||||
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288202', '176216432288201', '添加入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288203', '176216432288201', '编辑入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288204', '176216432288201', '删除入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288205', '176216432288201', '批量删除入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288206', '176216432288201', '导出excel_入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('176216432288207', '176216432288201', '导入excel_入库单', NULL, NULL, 0, NULL, NULL, 2, 'receive:data_asn:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-11-03 18:05:22', NULL, NULL, 0, 0, '1', 0);
|
||||
|
||||
-- 角色授权(以 admin 角色为例,role_id 可替换)
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288308', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288201', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288309', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288202', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288310', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288203', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288311', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288204', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288312', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288205', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288313', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288206', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
INSERT INTO sys_role_permission (id, role_id, permission_id, data_rule_ids, operate_date, operate_ip) VALUES ('176216432288314', 'f6817f48af4fb3af11b9e8bf182f618b', '176216432288207', NULL, '2025-11-03 18:05:22', '127.0.0.1');
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form v-bind="formItemLayout" name="AsnForm" ref="formRef" class="jeecg-native-form">
|
||||
<a-row class="form-row" :gutter="24">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="外部单号" v-bind="validateInfos.thirdPartyOrderNo" id="AsnForm-thirdPartyOrderNo" name="thirdPartyOrderNo">
|
||||
<a-input v-model:value="formData.thirdPartyOrderNo" placeholder="请输入外部单号" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="任务号" v-bind="validateInfos.no" id="AsnForm-no" name="no">
|
||||
<a-input v-model:value="formData.no" placeholder="请输入任务号" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="form-row" :span="8">
|
||||
<a-form-item label="单据类型" v-bind="validateInfos.orderType" id="AsnForm-orderType" name="orderType">
|
||||
<JDictSelectTag
|
||||
type="select"
|
||||
v-model:value="formData.orderType"
|
||||
dictCode="asn_order_type"
|
||||
placeholder="请选择单据类型"
|
||||
:string-to-number="true"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row class="form-row" :gutter="24">
|
||||
<a-col class="form-row" :span="8">
|
||||
<a-form-item label="供应商" v-bind="validateInfos.supplierCode" id="AsnForm-supplierCode" name="supplierCode">
|
||||
<a-input v-model:value="formData.supplierCode" placeholder="请输入供应商" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="form-row" :span="8">
|
||||
<a-form-item label="外部仓库" v-bind="validateInfos.whCode" id="AsnForm-whCode" name="whCode">
|
||||
<a-input v-model:value="formData.whCode" placeholder="请输入外部仓库代码" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="订单日期" v-bind="validateInfos.orderDate" id="AsnForm-orderDate" name="orderDate">
|
||||
<a-date-picker
|
||||
placeholder="请选择订单日期"
|
||||
v-model:value="formData.orderDate"
|
||||
showTime
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row class="form-row" :gutter="24">
|
||||
<a-col :span="24">
|
||||
<a-form-item
|
||||
label="描述"
|
||||
v-bind="validateInfos.description"
|
||||
id="AsnForm-description"
|
||||
name="description"
|
||||
:labelCol="{ span: 2 }"
|
||||
:wrapperCol="{ span: 24 }"
|
||||
>
|
||||
<a-textarea v-model:value="formData.description" :rows="4" placeholder="请输入描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model:activeKey="activeKey" animated style="overflow: hidden" class="jeecg-native-tab">
|
||||
<a-tab-pane tab="入库明细" key="asnDetail" :forceRender="true">
|
||||
<j-vxe-table
|
||||
:row-number="true"
|
||||
:keep-source="true"
|
||||
resizable
|
||||
ref="asnDetailTableRef"
|
||||
:loading="asnDetailTable.loading"
|
||||
:columns="asnDetailTable.columns"
|
||||
:dataSource="asnDetailTable.dataSource"
|
||||
:height="340"
|
||||
:disabled="disabled"
|
||||
:rowSelection="true"
|
||||
:toolbar="true"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, reactive, computed, toRaw } from 'vue';
|
||||
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
|
||||
import { queryAsnDetailListByMainId, queryDataById, saveOrUpdate } from '../Asn.api';
|
||||
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
||||
import { asnDetailColumns } from '../Asn.data';
|
||||
import { getTenantId } from '@/utils/auth';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
import dayjs from 'dayjs';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { JDictSelectTag } from '@/components/Form';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
|
||||
export default defineComponent({
|
||||
name: 'AsnForm',
|
||||
components: {
|
||||
JDictSelectTag,
|
||||
JVxeTable,
|
||||
JFormContainer,
|
||||
},
|
||||
props: {
|
||||
formDisabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
formData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
formBpm: { type: Boolean, default: true },
|
||||
},
|
||||
emits: ['success'],
|
||||
setup(props, { emit }) {
|
||||
const loading = ref(false);
|
||||
const formRef = ref();
|
||||
const asnDetailTableRef = ref();
|
||||
const asnDetailTable = reactive<Record<string, any>>({
|
||||
loading: false,
|
||||
columns: asnDetailColumns,
|
||||
dataSource: [],
|
||||
});
|
||||
const activeKey = ref('asnDetail');
|
||||
|
||||
//仓库 ID
|
||||
let tenantId = getTenantId();
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
thirdPartyOrderNo: '',
|
||||
no: '',
|
||||
status: 'CREATED',
|
||||
orderType: '',
|
||||
supplierCode: '',
|
||||
whCode: '',
|
||||
orderDate: dayjs(),
|
||||
description: '',
|
||||
tenantId: tenantId,
|
||||
});
|
||||
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
thirdPartyOrderNo: [{ required: true, message: '请输入外部单号!' }],
|
||||
no: [{ required: true, message: '请输入任务号!' }],
|
||||
orderType: [{ required: true, message: '请选择单据类型!' }],
|
||||
});
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({});
|
||||
const dbData = {};
|
||||
const formItemLayout = {
|
||||
labelCol: { xs: { span: 24 }, sm: { span: 6 } },
|
||||
wrapperCol: { xs: { span: 24 }, sm: { span: 24 } },
|
||||
};
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(() => {
|
||||
if (props.formBpm === true) {
|
||||
if (props.formData.disabled === false) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
function add() {
|
||||
resetFields();
|
||||
asnDetailTable.dataSource = [];
|
||||
}
|
||||
|
||||
async function edit(row) {
|
||||
//主表数据
|
||||
await queryMainData(row.id);
|
||||
//子表数据
|
||||
const asnDetailDataList = await queryAsnDetailListByMainId(row['id']);
|
||||
asnDetailTable.dataSource = [...asnDetailDataList];
|
||||
}
|
||||
|
||||
async function queryMainData(id) {
|
||||
const row = await queryDataById(id);
|
||||
resetFields();
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (row.hasOwnProperty(key)) {
|
||||
tmpData[key] = row[key];
|
||||
}
|
||||
});
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
}
|
||||
|
||||
const { getSubFormAndTableData, transformData } = useValidateAntFormAndTable(activeKey, {
|
||||
asnDetail: asnDetailTableRef,
|
||||
});
|
||||
|
||||
async function getFormData() {
|
||||
try {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
}
|
||||
return transformData(toRaw(formData));
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
// 防止重复提交
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置加载状态,防止重复提交
|
||||
loading.value = true;
|
||||
try {
|
||||
const mainData = await getFormData();
|
||||
const subData = await getSubFormAndTableData();
|
||||
// 预处理日期数据
|
||||
changeDateValue(mainData, subData);
|
||||
const values = Object.assign({}, dbData, mainData, subData);
|
||||
console.log('表单提交数据', values);
|
||||
const isUpdate = values.id ? true : false;
|
||||
await saveOrUpdate(values, isUpdate);
|
||||
//关闭弹窗
|
||||
emit('success');
|
||||
}catch (error){
|
||||
console.error('提交失败:', error);
|
||||
}finally {
|
||||
// 重置加载状态
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function setFieldsValue(values) {
|
||||
if (values) {
|
||||
Object.keys(values).map((k) => {
|
||||
formData[k] = values[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理日期值
|
||||
* @param formData 表单数据
|
||||
*/
|
||||
const changeDateValue = (mainData, subData) => {
|
||||
for (let key in mainData) {
|
||||
// 更新个性化日期选择器的值
|
||||
mainData[key] = getDateByPicker(mainData[key], fieldPickers[key]);
|
||||
}
|
||||
if (subData.asnDetailList && subData.asnDetailList.length > 0) {
|
||||
asnDetailColumns.forEach((subFormField) => {
|
||||
if (subFormField && subFormField.picker && subFormField.key) {
|
||||
let subPicker = subFormField.picker;
|
||||
const subFieldName = subFormField.key;
|
||||
subData.asnDetailList.forEach((subFormData) => {
|
||||
if (subPicker === 'year') {
|
||||
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).set('month', 0).set('date', 1).format('YYYY-MM-DD');
|
||||
} else if (subPicker === 'month') {
|
||||
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).set('date', 1).format('YYYY-MM-DD');
|
||||
} else if (subPicker === 'week') {
|
||||
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).startOf('week').format('YYYY-MM-DD');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 值改变事件触发-树控件回调
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
formData[key] = value;
|
||||
}
|
||||
|
||||
return {
|
||||
asnDetailTableRef,
|
||||
asnDetailTable,
|
||||
validatorRules,
|
||||
validateInfos,
|
||||
activeKey,
|
||||
loading,
|
||||
formData,
|
||||
setFieldsValue,
|
||||
handleFormChange,
|
||||
formItemLayout,
|
||||
disabled,
|
||||
getFormData,
|
||||
submitForm,
|
||||
add,
|
||||
edit,
|
||||
formRef,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.ant-tabs-tabpane.sub-one-form {
|
||||
max-height: 340px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.jeecg-native-form,
|
||||
.jeecg-native-tab {
|
||||
padding: 0 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<template>
|
||||
' <BasicModal v-bind="$attrs" @register="registerModal" :title="title" :okText="'保存'" :defaultFullscreen="true" @ok="handleSubmit">
|
||||
' <asn-form ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></asn-form>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import AsnForm from './AsnForm.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
export default {
|
||||
name: "TestCgMainVxeModal",
|
||||
components:{
|
||||
BasicModal,
|
||||
AsnForm
|
||||
},
|
||||
emits:['register','success'],
|
||||
setup(_p, {emit}){
|
||||
const formComponent = ref()
|
||||
const isUpdate = ref(true);
|
||||
const formDisabled = ref(false);
|
||||
const title = ref('')
|
||||
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
formDisabled.value = !data?.showFooter;
|
||||
title.value = data?.isUpdate ? (unref(formDisabled) ? '入库单详情' : '编辑入库单') : '新增入库单';
|
||||
if (unref(isUpdate)) {
|
||||
formComponent.value.edit(data.record)
|
||||
}else{
|
||||
formComponent.value.add()
|
||||
}
|
||||
});
|
||||
|
||||
function handleSubmit() {
|
||||
formComponent.value.submitForm();
|
||||
}
|
||||
|
||||
function submitSuccess(){
|
||||
emit('success');
|
||||
closeModal();
|
||||
}
|
||||
return {
|
||||
registerModal,
|
||||
title,
|
||||
formComponent,
|
||||
formDisabled,
|
||||
handleSubmit,
|
||||
submitSuccess,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
import { columns, searchFormSchema } from '/@/views/system/fillRule/fill.rule.data';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { ActionItem } from '/@/components/Table';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
import FillRuleModal from '/@/views/system/fillRule/FillRuleModal.vue';
|
||||
|
||||
|
|
@ -132,7 +133,6 @@
|
|||
*/
|
||||
function getDropDownAction(record): ActionItem[] {
|
||||
return [
|
||||
{ label: '功能测试', onClick: testRule.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
color: 'error',
|
||||
|
|
|
|||
Loading…
Reference in New Issue