入库新增,修改、删除、;AGV任务新增、修改、删除

main
HUOJIN\92525 2025-11-06 17:55:06 +08:00
parent 9f3b8f4af0
commit fcd12d7be5
34 changed files with 2414 additions and 260 deletions

View File

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

View File

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

View File

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

View File

@ -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'];

View File

@ -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 });
}

View File

@ -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,
},
];

View File

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

View File

@ -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');

View File

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

View File

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

View File

@ -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();

View File

@ -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 });

View File

@ -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';
import { BasicColumn } from '/@/components/Table';
//列表数据
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',},
};

View File

@ -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>
@ -11,9 +41,11 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<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>
<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>
<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 }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</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,20 +95,46 @@
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,
canResize:true,
columns: enhancedColumns,
canResize: true,
useSearchForm: false,
actionColumn: {
width: 120,
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
},
importConfig: {
url: getImportUrl,
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
xs: 24,
sm: 4,
xl: 6,
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{
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust{
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
text-align: center;
}
.ant-form-item:not(.ant-form-item-with-help){
.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%;
}
}

View File

@ -4,21 +4,26 @@
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ItemForm">
<a-row>
<a-col :span="24">
<a-form-item label="物料编码" v-bind="validateInfos.itemCode" id="ItemForm-itemCode" name="itemCode">
<a-input v-model:value="formData.itemCode" placeholder="请输入物料编码" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="物料名称" v-bind="validateInfos.itemName" id="ItemForm-itemName" name="itemName">
<a-input v-model:value="formData.itemName" placeholder="请输入物料名称" allow-clear ></a-input>
</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>
</a-col>
<a-col :span="24">
<a-form-item label="物料编码" v-bind="validateInfos.itemCode" id="ItemForm-itemCode" name="itemCode">
<a-input v-model:value="formData.itemCode" placeholder="请输入物料编码" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="物料名称" v-bind="validateInfos.itemName" id="ItemForm-itemName" name="itemName">
<a-input v-model:value="formData.itemName" placeholder="请输入物料名称" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<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>
</a-form>
</template>
@ -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 }
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: '',
itemCode: '',
itemName: '',
tenantId: undefined,
delFlag: 0,
izActive: 1,
tenantId: tenantId,
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -54,25 +65,25 @@
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(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
}else{
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
@ -88,10 +99,10 @@
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key];
}
})
});
//
Object.assign(formData, tmpData);
});
@ -147,7 +158,6 @@
});
}
defineExpose({
add,
edit,

View File

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

View File

@ -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: '是否启用',

View File

@ -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">
@ -17,11 +17,19 @@
</a-form-item>
</a-col>
<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 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({});

View File

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

View File

@ -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使idchange
} 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>

View File

@ -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',},
};

View File

@ -7,15 +7,29 @@
<a-col :lg="6">
<a-form-item name="stockCode">
<template #label><span title="容器编码">容器编码</span></template>
<a-input placeholder="请输入容器编码" v-model:value="queryParam.stockCode" allow-clear ></a-input>
<a-input placeholder="请输入容器编码" v-model:value="queryParam.stockCode" allow-clear></a-input>
</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">
@ -35,9 +49,11 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<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>
<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>
<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 }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</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,13 +102,39 @@
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,
canResize:true,
columns: enhancedColumns,
canResize: true,
useSearchForm: false,
actionColumn: {
width: 120,
@ -110,40 +150,28 @@
},
},
exportConfig: {
name: "容器",
name: '容器',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
importConfig: {
url: getImportUrl,
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
xs: 24,
sm: 4,
xl: 6,
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{
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust{
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
text-align: center;
}
.ant-form-item:not(.ant-form-item-with-help){
.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%;
}
}

View File

@ -4,21 +4,42 @@
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="StockForm">
<a-row>
<a-col :span="12">
<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-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-form-item>
</a-col>
<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="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="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>
</a-form>
</template>
@ -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 }
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: '',
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,27 +85,26 @@
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(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
}else{
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
@ -91,10 +120,10 @@
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
if (record.hasOwnProperty(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,

View File

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

View File

@ -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 }});

View File

@ -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}',
},
];

View File

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

View File

@ -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');

View File

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

View File

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

View File

@ -3,9 +3,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd"></a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> </a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls"></j-upload-button>
<a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd"> </a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> </a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls"> </j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -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',