Commit 8fd849e8 by 张珈源

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

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