Commit 6af1848b by 胡鑫

生产模块修改

parent 5d28fcfc
......@@ -118,7 +118,7 @@ export interface MesProductionTaskModel {
mesProductionGongdanList?: MesProductionGongdanModel;
mesWarehouseMaterialList?: MesWarehouseMaterialModel;
mesWarehouseMaterialList?: MesWarehouseMaterialModel[];
}
/**
......
......@@ -585,7 +585,7 @@
} else {
if (schema.componentProps?.['events']) {
for (const eventKey in schema.componentProps['events']) {
if (eventKey !== 'change') return;
if (eventKey !== 'change') continue;
try {
const event = new Function(
'schema',
......@@ -596,65 +596,30 @@
`${schema.componentProps['events'][eventKey]}`,
);
schema.componentProps['on' + upperFirst(eventKey)] = function (e, opt) {
try {
event(schema, formModel, formApi, e, opt);
};
} catch (error) {
console.log('error', error);
// Handle curRowData is not defined error gracefully
if (error.message && error.message.includes('curRowData is not defined')) {
console.warn('Event handler references curRowData which is not available in this context');
} else {
console.error('Error executing event:', error);
notification.error({
message: 'Tip',
description: '触发事件填写有误!',
});
}
}
};
} catch (error) {
console.error('Error creating event function:', error);
}
}
}
}
}
// if (componentProps['events']) {
// for (const eventKey in componentProps['events']) {
// try {
// const event = new Function(
// 'schema',
// 'formModel',
// 'formActionType',
// `${componentProps['events'][eventKey]}`,
// );
// componentProps['on' + upperFirst(eventKey)] = function () {
// event(props.schema, formModel, props.formApi);
// };
// } catch (error) {
// console.log('error', error);
// notification.error({
// message: 'Tip',
// description: '触发事件填写有误!',
// });
// }
// }
// }
};
// if (componentProps['events']) {
// for (const eventKey in componentProps['events']) {
// try {
// const event = new Function(
// 'schema',
// 'formModel',
// 'formActionType',
// `${componentProps['events'][eventKey]}`,
// );
// componentProps['on' + upperFirst(eventKey)] = function () {
// event(props.schema, formModel, props.formApi);
// };
// } catch (error) {
// console.log('error', error);
// notification.error({
// message: 'Tip',
// description: '触发事件填写有误!',
// });
// }
// }
// }
//获取表单值 慎用 建议直接页面直接操作formModel数据
const getFieldsValue = (): Recordable => {
return toRaw(unref(formModel));
......
<template>
<div class="pt-4">
<SimpleForm
......@@ -16,6 +15,7 @@
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesProductionTask, getMesProductionTask, updateMesProductionTask } from '/@/api/scgl/scrw';
import { getRokeRouting } from '/@/api/jcsj/gylx';
import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
......@@ -25,6 +25,10 @@
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router';
import { notification } from 'ant-design-vue';
import axios from 'axios';
import { getEnvConfig } from '/@/build/utils';
import { log } from 'node:console';
const { filterFormSchemaAuth } = usePermission();
......@@ -42,7 +46,8 @@
});
const state = reactive({
formModel: {},
formInfo:{formId:'',formName:''}
formInfo:{formId:'',formName:''},
isInitializing: false
});
const { currentRoute } = useRouter();
watch(
......@@ -55,6 +60,58 @@
},
);
// Watch for changes to BOM field and call API
watch(
() => state.formModel.bom,
async (newBomId) => {
if (newBomId && !state.isInitializing) {
try {
const apiUrl = import.meta.env.VITE_GLOB_API_URL || '';
const response = await axios.get(apiUrl + '/magic-api/jcxx/wlxList', { params: { bomId: newBomId } });
state.formModel.mesWarehouseMaterialList = []
// Process API response data and assign to material list
state.formModel.mesWarehouseMaterialList = response.data.data.map(item => ({
wlbh: item.wlbh,
wlmc: item.wlmc,
blsl: item.wlsl,
kcl: item.kcl,
khbz: item.khbz,
nkbz: item.nkbz,
sftl: item.sftl,
wlId: item.id
}
)
);
// state.formModel.mesWarehouseMaterialList = materialList;
} catch (error) {
notification.error({ message: '获取物料清单失败' });
}
}
}
);
// Watch for changes to process route field and call API
watch(
() => state.formModel.gylx,
async (newGylxId) => {
if (newGylxId && !state.isInitializing) {
try {
const response = await getRokeRouting(newGylxId);
// Assign the process list from API response to production order list with field mapping
state.formModel.mesProductionGongdanList = response.rokeRoutingProcessList.map(item => ({
gxbh: item.code, // 工序编号 → 工序编号
gxmc: item.name, // 工序名称 → 工序名称
gxId: item.processId // 工序ID → 工序ID
}));
} catch (error) {
notification.error({ message: '获取工艺路线详情失败' });
}
}
}
);
onMounted(async () => {
try {
if (props.fromPage == FromPageType.MENU) {
......@@ -110,14 +167,17 @@
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) {
try {
state.isInitializing = true;
const record = await getMesProductionTask(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
formProps.schemas, true, state.formInfo.formName, state.formInfo.formId); //表单事件:获取表单数据
} catch (error) {
} finally {
state.isInitializing = false;
}
}
// 辅助返回表单数据
......@@ -189,14 +249,9 @@
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
}
function handleChange(val) {
state.formModel = val;
emits('update:value', val);
}
async function sendMessageForAllIframe() {
......@@ -221,5 +276,3 @@
sendMessageForAllIframe
});
</script>
\ No newline at end of file
\ No newline at end of file
......@@ -131,6 +131,7 @@
function handleClose() {
formRef.value.resetFields();
closeModal();
}
</script>
......
......@@ -1150,282 +1150,282 @@ export const formProps: FormProps = {
componentProps: {
mainKey: 'mesProductionGongdanList',
columns: [
{
key: '2745856f030c4f4b8488732136060d78',
title: '任务编号',
dataIndex: 'rwbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入任务编号任务编号任务编号',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'e2a2a9437363423b93f280617e27d8d2',
title: '计划编号',
dataIndex: 'jhbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入计划编号',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '589c359e5a7e498695fcf5c224a5e557',
title: '熔次号',
dataIndex: 'rch',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入熔次号',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '2957c762b0a3437f872fdab6f46544c2',
title: '铸次号',
dataIndex: 'zch',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入铸次号单行文本',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'c1ed5718a38d45d298352ea8b22eb2b8',
title: '合金标准',
dataIndex: 'hjzt',
componentType: 'XjrSelect',
componentProps: {
width: '100%',
span: '',
placeholder: '请选择下拉选择',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: '',
datasourceType: 'api',
labelField: 'label',
valueField: 'value',
apiConfig: {
path: '/zlgl//zjjcsj/getHjbz',
method: 'GET',
apiId: '36768924878d48e5ac3b3b24fc25765e',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select id as value,name as label from mes_alloy_standard where delete_mark = 0";\r\nreturn db.select(sql);',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'border: 0'",
},
},
{
key: '69da890610284539b4ad26bed8e9c566',
title: '产品ID',
dataIndex: 'cpid',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入产品ID',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'dc242ae845f1489a8cc2f47c98b565b8',
title: '产品类型',
dataIndex: 'cplx',
componentType: 'XjrSelect',
componentProps: {
width: '100%',
span: '',
placeholder: '请选择下拉选择',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
datasourceType: 'dic',
params: { itemId: '2003761375221407745' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
itemId: '2003761375221407745',
defaultSelect: '',
listStyle: "return 'border: 0'",
},
},
{
key: '7e31a788100b4eefba52c3a36443ba87',
title: '客户',
dataIndex: 'kh',
componentType: 'XjrSelect',
componentProps: {
width: '100%',
placeholder: '请选择客户',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: '',
datasourceType: 'api',
labelField: 'label',
valueField: 'value',
apiConfig: {
path: '/jcxx/getKhList',
method: 'GET',
apiId: '7bc8db3faba24b19a997856f6ef0b27e',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
'var sql="select id as value,name as label from roke_partner where delete_mark = 0 and customer = \'1\'";\r\nreturn db.select(sql);',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'border: 0'",
},
},
// {
// key: '2745856f030c4f4b8488732136060d78',
// title: '任务编号',
// dataIndex: 'rwbh',
// componentType: 'Input',
// defaultValue: '',
// componentProps: {
// width: '100%',
// span: '',
// defaultValue: '',
// placeholder: '请输入任务编号任务编号任务编号',
// prefix: '',
// suffix: '',
// addonBefore: '',
// addonAfter: '',
// disabled: false,
// allowClear: false,
// showLabel: true,
// required: false,
// rules: [],
// events: {},
// listStyle: '',
// isSave: false,
// isShow: true,
// scan: false,
// bordered: true,
// isShowAi: false,
// tooltipConfig: { visible: false, title: '提示文本' },
// },
// },
// {
// key: 'e2a2a9437363423b93f280617e27d8d2',
// title: '计划编号',
// dataIndex: 'jhbh',
// componentType: 'Input',
// defaultValue: '',
// componentProps: {
// width: '100%',
// span: '',
// defaultValue: '',
// placeholder: '请输入计划编号',
// prefix: '',
// suffix: '',
// addonBefore: '',
// addonAfter: '',
// disabled: false,
// allowClear: false,
// showLabel: true,
// required: false,
// rules: [],
// events: {},
// listStyle: '',
// isSave: false,
// isShow: true,
// scan: false,
// bordered: true,
// isShowAi: false,
// tooltipConfig: { visible: false, title: '提示文本' },
// },
// },
// {
// key: '589c359e5a7e498695fcf5c224a5e557',
// title: '熔次号',
// dataIndex: 'rch',
// componentType: 'Input',
// defaultValue: '',
// componentProps: {
// width: '100%',
// span: '',
// defaultValue: '',
// placeholder: '请输入熔次号',
// prefix: '',
// suffix: '',
// addonBefore: '',
// addonAfter: '',
// disabled: false,
// allowClear: false,
// showLabel: true,
// required: false,
// rules: [],
// events: {},
// listStyle: '',
// isSave: false,
// isShow: true,
// scan: false,
// bordered: true,
// isShowAi: false,
// tooltipConfig: { visible: false, title: '提示文本' },
// },
// },
// {
// key: '2957c762b0a3437f872fdab6f46544c2',
// title: '铸次号',
// dataIndex: 'zch',
// componentType: 'Input',
// defaultValue: '',
// componentProps: {
// width: '100%',
// span: '',
// defaultValue: '',
// placeholder: '请输入铸次号单行文本',
// prefix: '',
// suffix: '',
// addonBefore: '',
// addonAfter: '',
// disabled: false,
// allowClear: false,
// showLabel: true,
// required: false,
// rules: [],
// events: {},
// listStyle: '',
// isSave: false,
// isShow: true,
// scan: false,
// bordered: true,
// isShowAi: false,
// tooltipConfig: { visible: false, title: '提示文本' },
// },
// },
// {
// key: 'c1ed5718a38d45d298352ea8b22eb2b8',
// title: '合金标准',
// dataIndex: 'hjzt',
// componentType: 'XjrSelect',
// componentProps: {
// width: '100%',
// span: '',
// placeholder: '请选择下拉选择',
// showLabel: true,
// showSearch: false,
// isMultiple: false,
// clearable: false,
// disabled: false,
// staticOptions: [
// { key: 1, label: 'Option 1', value: 'Option 1' },
// { key: 2, label: 'Option 2', value: 'Option 2' },
// { key: 3, label: 'Option 3', value: 'Option 3' },
// ],
// defaultSelect: '',
// datasourceType: 'api',
// labelField: 'label',
// valueField: 'value',
// apiConfig: {
// path: '/zlgl//zjjcsj/getHjbz',
// method: 'GET',
// apiId: '36768924878d48e5ac3b3b24fc25765e',
// apiParams: [
// { key: '1', title: 'Query Params', tableInfo: [] },
// { key: '2', title: 'Header', tableInfo: [] },
// { key: '3', title: 'Body' },
// ],
// script:
// 'var sql="select id as value,name as label from mes_alloy_standard where delete_mark = 0";\r\nreturn db.select(sql);',
// },
// dicOptions: [],
// required: false,
// rules: [],
// events: {},
// isShow: true,
// tooltipConfig: { visible: false, title: '提示文本' },
// listStyle: "return 'border: 0'",
// },
// },
// {
// key: '69da890610284539b4ad26bed8e9c566',
// title: '产品ID',
// dataIndex: 'cpid',
// componentType: 'Input',
// defaultValue: '',
// componentProps: {
// width: '100%',
// span: '',
// defaultValue: '',
// placeholder: '请输入产品ID',
// prefix: '',
// suffix: '',
// addonBefore: '',
// addonAfter: '',
// disabled: false,
// allowClear: false,
// showLabel: true,
// required: false,
// rules: [],
// events: {},
// listStyle: '',
// isSave: false,
// isShow: false,
// scan: false,
// bordered: true,
// isShowAi: false,
// tooltipConfig: { visible: false, title: '提示文本' },
// },
// },
// {
// key: 'dc242ae845f1489a8cc2f47c98b565b8',
// title: '产品类型',
// dataIndex: 'cplx',
// componentType: 'XjrSelect',
// componentProps: {
// width: '100%',
// span: '',
// placeholder: '请选择下拉选择',
// showLabel: true,
// showSearch: false,
// isMultiple: false,
// clearable: false,
// disabled: false,
// staticOptions: [
// { key: 1, label: 'Option 1', value: 'Option 1' },
// { key: 2, label: 'Option 2', value: 'Option 2' },
// { key: 3, label: 'Option 3', value: 'Option 3' },
// ],
// datasourceType: 'dic',
// params: { itemId: '2003761375221407745' },
// labelField: 'name',
// valueField: 'value',
// apiConfig: {
// path: 'CodeGeneration/selection',
// method: 'GET',
// apiId: '93d735dcb7364a0f8102188ec4d77ac7',
// },
// dicOptions: [],
// required: false,
// rules: [],
// events: {},
// isShow: true,
// tooltipConfig: { visible: false, title: '提示文本' },
// itemId: '2003761375221407745',
// defaultSelect: '',
// listStyle: "return 'border: 0'",
// },
// },
// {
// key: '7e31a788100b4eefba52c3a36443ba87',
// title: '客户',
// dataIndex: 'kh',
// componentType: 'XjrSelect',
// componentProps: {
// width: '100%',
// placeholder: '请选择客户',
// showLabel: true,
// showSearch: false,
// isMultiple: false,
// clearable: false,
// disabled: false,
// staticOptions: [
// { key: 1, label: 'Option 1', value: 'Option 1' },
// { key: 2, label: 'Option 2', value: 'Option 2' },
// { key: 3, label: 'Option 3', value: 'Option 3' },
// ],
// defaultSelect: '',
// datasourceType: 'api',
// labelField: 'label',
// valueField: 'value',
// apiConfig: {
// path: '/jcxx/getKhList',
// method: 'GET',
// apiId: '7bc8db3faba24b19a997856f6ef0b27e',
// apiParams: [
// { key: '1', title: 'Query Params', tableInfo: [] },
// { key: '2', title: 'Header', tableInfo: [] },
// { key: '3', title: 'Body' },
// ],
// script:
// 'var sql="select id as value,name as label from roke_partner where delete_mark = 0 and customer = \'1\'";\r\nreturn db.select(sql);',
// },
// dicOptions: [],
// required: false,
// rules: [],
// events: {},
// isShow: true,
// tooltipConfig: { visible: false, title: '提示文本' },
// listStyle: "return 'border: 0'",
// },
// },
{
key: '16fd1699db7744379edd01b6eb5653f9',
title: '工序编号',
......@@ -1800,7 +1800,7 @@ export const formProps: FormProps = {
},
],
span: '24',
preloadType: 'api',
preloadType: 'static',
apiConfig: {},
itemId: '',
dicOptions: [],
......@@ -1826,7 +1826,7 @@ export const formProps: FormProps = {
isShowDelete: false,
hasCheckedCol: false,
events: {},
showPagenation: true,
showPagenation: 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