Commit 8fd849e8 by 张珈源

feat(ckgl): 实现出库销售单自动生成码并优化领料单生成功能

- 将单据编号字段从普通输入框改为自动生成码组件
- 为PickListModal组件添加加载状态和防重复提交功能
- 实现领料单生成接口调用和错误处理机制
- 更新工作流程权限配置中的字段类型设置
- 优化表格组件样式配置属性
- 统一组件配置中的键值对应关系
parent 13c8299c
......@@ -4,6 +4,7 @@
@register="registerModal"
title="生成领料单"
width="700px"
:confirmLoading="loading"
@ok="handleOk"
@cancel="handleCancel"
>
......@@ -25,6 +26,7 @@
import { useMessage } from '/@/hooks/web/useMessage';
import { h } from 'vue';
import { InputNumber } from 'ant-design-vue';
import { defHttp } from '/@/utils/http/axios';
const { Message } = useMessage();
const [registerModal, { openModal, closeModal }] = useModal();
const { createMessage } = useMessage();
......@@ -33,6 +35,9 @@
/* 表格数据 */
const tableData = ref<any[]>([]);
/* 加载状态 */
const loading = ref(false);
/* 表格列定义 */
const columns: BasicColumn[] = [
{ title: '物料编码', dataIndex: 'wlbh', width: 120 },
......@@ -61,15 +66,48 @@
}
/* 确认 - 回传所有行(含改后的数量) */
function handleOk() {
async function handleOk() {
// 防止重复提交
if (loading.value) return;
// 简单校验:数量不能全 0
const allZero = tableData.value.every((r) => r.blsl === 0);
if (allZero) {
createMessage.warning('请至少输入一行领料数量'); // ✅ 用 createMessage
return;
}
// 构建请求参数
const requestData = tableData.value.map(item => ({
wlbm: item.wlbh, // 物料编码
wlmc: item.wlmc, // 物料名称
sl: item.blsl || 0 // 领料数量
}));
loading.value = true;
try {
// 调用后端接口
const response = await defHttp.post(
{
url: '/ckgl/scll',
data: requestData,
},
{
errorMessageMode: 'message',
}
);
// 接口调用成功
createMessage.success('领料单生成成功');
emit('success', tableData.value); // 回传完整数组
closeModal();
} catch (error) {
// 接口调用失败
createMessage.error('领料单生成失败,请重试');
console.error('接口调用失败:', error);
} finally {
loading.value = false;
}
}
function handleCancel() {
......
......@@ -132,13 +132,13 @@ export const columns: BasicColumn[] = [
resizable: true,
dataIndex: 'djbh',
title: '单据编号',
componentType: 'input',
componentType: 'auto-code',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
listStyle: undefined,
},
{
......@@ -601,34 +601,24 @@ export const formProps: FormProps = {
span: 6,
list: [
{
key: '7b5da9c087bc41d5ba2efa9034582b0c',
key: '160979df6a214cb590fa0b8f20bcd98c',
field: 'djbh',
label: '单据编号',
type: 'input',
component: 'Input',
type: 'auto-code',
component: 'AutoCodeRule',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 8,
defaultValue: '',
span: 7,
placeholder: '请输入单据编号',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
autoCodeRule: 'XSCK',
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
......
......@@ -136,19 +136,18 @@ export const permissionList = [
{
required: false,
view: true,
edit: true,
disabled: false,
edit: false,
disabled: true,
isSaveTable: false,
tableName: '',
fieldName: '单据编号',
fieldId: 'djbh',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7b5da9c087bc41d5ba2efa9034582b0c',
type: 'auto-code',
key: '160979df6a214cb590fa0b8f20bcd98c',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment