Commit 1031dfe4 by 孙祥林

[孙祥林]fix:生产备料编辑-生成领料单走自定义页面

parent b74e23fb
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="生成领料单"
width="700px"
@ok="handleOk"
@cancel="handleCancel"
>
<!-- 可编辑表格 -->
<BasicTable
:dataSource="tableData"
:columns="columns"
:pagination="false"
:scroll="{ y: 300 }"
rowKey="id"
/>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, defineExpose } from 'vue';
import { BasicModal, useModal } from '/@/components/Modal';
import { BasicTable, BasicColumn } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { h } from 'vue';
import { InputNumber } from 'ant-design-vue';
const { Message } = useMessage();
const [registerModal, { openModal, closeModal }] = useModal();
const { createMessage } = useMessage();
const emit = defineEmits(['success']); // ✅ 必须写
/* 表格数据 */
const tableData = ref<any[]>([]);
/* 表格列定义 */
const columns: BasicColumn[] = [
{ title: '物料编码', dataIndex: 'wlbh', width: 120 },
{ title: '物料名称', dataIndex: 'wlmc', width: 200 },
{
title: '领料数量',
dataIndex: 'blsl',
width: 130,
// 常驻输入框
customRender: ({ record }) =>
h(InputNumber, {
value: record.blsl,
min: 0,
max: 999999,
size: 'small',
style: { width: '100%' },
onChange: (val) => (record.blsl = val),
}),
},
];
/* 打开弹窗 - 父组件调用 */
function open(rows: any[]) {
tableData.value = rows.map((r) => ({ ...r, blsl: r.blsl || 0 }));
openModal(true);
}
/* 确认 - 回传所有行(含改后的数量) */
function handleOk() {
// 简单校验:数量不能全 0
const allZero = tableData.value.every((r) => r.blsl === 0);
if (allZero) {
createMessage.warning('请至少输入一行领料数量'); // ✅ 用 createMessage
return;
}
emit('success', tableData.value); // 回传完整数组
closeModal();
}
function handleCancel() {
closeModal();
}
defineExpose({ open });
</script>
......@@ -723,10 +723,10 @@ export const formProps: FormProps = {
event: [
{
operateType: 2,
operateConfig: { js: 'formActionType.openModal(curRowData)' },
operateConfig: { js: 'window.scbl_getSelectedRows()' },
},
],
type: 2,
type: 1,
modal: {
bindModal: '2013812486102130689',
innerParams: [
......
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