From 5100a1cf9d7e0903dbf304419ca5bd0df2990bca Mon Sep 17 00:00:00 2001 From: Yanko <747575620@qq.com> Date: Thu, 21 Nov 2024 10:41:58 +0800 Subject: [PATCH] 1 --- frontend/config/proxy.ts | 2 +- frontend/src/api/sys/dto.d.ts | 2 +- .../src/pages/deviceProductInfo/index.tsx | 550 +++++++++--------- frontend/src/pages/final/index.tsx | 76 +-- frontend/src/pages/stock/index.tsx | 10 +- frontend/src/pages/workInfo/index.tsx | 17 +- 6 files changed, 323 insertions(+), 334 deletions(-) diff --git a/frontend/config/proxy.ts b/frontend/config/proxy.ts index ff1230b..612b70d 100644 --- a/frontend/config/proxy.ts +++ b/frontend/config/proxy.ts @@ -6,7 +6,7 @@ export default { dev: { '/api/': { - target: 'http://localhost:5502', + target: 'http://192.168.1.12:5502', pathRewrite: { '/api': '/api' }, diff --git a/frontend/src/api/sys/dto.d.ts b/frontend/src/api/sys/dto.d.ts index 80631bb..69393c6 100644 --- a/frontend/src/api/sys/dto.d.ts +++ b/frontend/src/api/sys/dto.d.ts @@ -85,7 +85,7 @@ declare namespace RolelTypes { } //人员 declare namespace UserTypes { - // 登录参数类型 + // 登录 type LoginParams = { account: string, pwd: string diff --git a/frontend/src/pages/deviceProductInfo/index.tsx b/frontend/src/pages/deviceProductInfo/index.tsx index ad99711..869d4ef 100644 --- a/frontend/src/pages/deviceProductInfo/index.tsx +++ b/frontend/src/pages/deviceProductInfo/index.tsx @@ -28,15 +28,19 @@ interface ParmForm { } -const ParmsTypeList = [{ - - label: '数据', - value: 0 -}, -{ - label: '数组', - value: 1 -} +const ParmsTypeList = [ + { + label: '数据', + value: 0 + }, + { + label: '多选', + value: 1 + }, + { + label: '单选', + value: 2 + } ] export default () => { @@ -53,7 +57,7 @@ export default () => { // useEffect(()=>{ // console.log("funcParams"); - const [isParamsUnit, setIsParamsUnit] = useState(); + const [isParamsUnit, setIsParamsUnit] = useState(0); // },[funcParams]) const [paramsModelOpen, setParamsModelOpen] = useState(false); @@ -71,23 +75,23 @@ export default () => { { title: '主键', dataIndex: 'id', - formItemProps:{ - hidden:true + formItemProps: { + hidden: true }, search: false, }, { title: '名称', dataIndex: 'name', - formItemProps:{ - rules:[{ required: true, message: '此项为必填项!' }] + formItemProps: { + rules: [{ required: true, message: '此项为必填项!' }] }, }, { title: '编码', dataIndex: 'code', - formItemProps:{ - rules:[{ required: true, message: '此项为必填项!' }] + formItemProps: { + rules: [{ required: true, message: '此项为必填项!' }] }, search: false, }, @@ -99,7 +103,7 @@ export default () => { { title: '操作', valueType: 'option', - fixed:'right', + fixed: 'right', render: (text, row) => [ - - - - ) - )} - - setParamsModelOpen(false)} open={paramsModelOpen}> - { - console.log(values); - const b = paramsForm.getFieldsValue(); - if (b.id) { - funcParams.forEach((res) => { - if (res.id === b.id) { - res.paramCode = b.paramCode; - res.paramName = b.paramName; - res.paramType = b.paramType; - res.paramUnit = b.paramUnit; - } - }) - setFuncParams(funcParams); - } else { - b.id = uuid() - funcParams.push(b); - } - setFuncParams(funcParams); - console.log(b); - setParamsModelOpen(false) + readonly: true, + }, + { + title: '功能名称', + dataIndex: 'name', + ellipsis: true, + search: false, + }, + { + title: '功能编码', + hideInDescriptions: true, + dataIndex: 'code', + search: false, + }, { + title: '输入参数', + hideInDescriptions: true, + hideInTable: true, + dataIndex: "params", + search: false, + renderFormItem(schema, config, form, action?) { + // let b = JSON.parse(config?.record!.params); + return ( +
+ {funcParams.map((res: ParmForm, index: number) => ( + + }> +
参数名称:{res.paramName}
+
参数代码:{res.paramCode}
+
- ) - }, + }}> + + + + + + + + + + + {isParamsUnit ===1 ? + + + :"" + } + {isParamsUnit === 2 ? + + + + + :"" } +
+
+ + ) + }, - }, 200); + }, + { + title: '描述', + dataIndex: 'description', + search: false, + }, + { + title: '操作', + valueType: 'option', + dataIndex: 'id', + fixed: 'right', + render: (text, row) => [ + + { + setFuncFromType('form') + console.log('row', row); + setTimeout(() => { + funcRef.current?.setFieldsValue(row) + if (row.params) { + const ppp = JSON.parse(row.params) + setFuncParams(ppp) + } else { + setFuncParams([]) + } - }} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> - 编辑 - - { + }, 200); - deviceProducFunctiontApi.Del(row).then((res: MyResponse.Content) => { - if (res.statusCode === 200) { - message.info("删除成功!"); - Reolod() - } else { - message.error(res.errors); - } - }) - }} - onCancel={() => { - message.info('已取消删除'); - }} - okText="确认" - cancelText="关闭" - > - - 删除 - - - - ], - }, - ]} - onSubmit={(params: any) => { - console.log(params, funcParams); - params.params = JSON.stringify(funcParams); - params.deviceProductId = selectRow?.id - if (funcfromType === 'form') { - if (params.id) { - deviceProducFunctiontApi.Update(params).then((res: MyResponse.Content) => { - if (res.statusCode === 200) { - message.info("更新成功!"); - setFuncFromType('table') - FuncReolod() - } else { - message.error(res.errors); - } - }) - } else { - deviceProducFunctiontApi.Add(params).then((res: MyResponse.Content) => { - if (res.statusCode === 200) { - message.info("新增成功!"); - setFuncFromType('table') - FuncReolod() - } else { - message.error(res.errors); - } - }) - } - } - }} - request={async (params = {}) => { - const jsonData: deviceProductFunction.queryPage = { - pageIndex: params.current || 1, - pageSize: params.pageSize || 10, - deviceProductId: selectRow?.id - }; - const response = await deviceProducFunctiontApi.PagedList(jsonData); - if (response.statusCode === 200) { - return { - data: response.data.items, - success: true, - total: response.data.total, - }; + }} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> + 编辑 + + { + + deviceProducFunctiontApi.Del(row).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("删除成功!"); + Reolod() + } else { + message.error(res.errors); + } + }) + }} + onCancel={() => { + message.info('已取消删除'); + }} + okText="确认" + cancelText="关闭" + > + + 删除 + + + + ], + }, + ]} + onSubmit={(params: any) => { + console.log(params, funcParams); + params.params = JSON.stringify(funcParams); + params.deviceProductId = selectRow?.id + if (funcfromType === 'form') { + if (params.id) { + deviceProducFunctiontApi.Update(params).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("更新成功!"); + setFuncFromType('table') + FuncReolod() + } else { + message.error(res.errors); + } + }) } else { - return { - data: [], - success: false, - total: 0, - }; - } - }} - form={{ - ignoreRules: true,// 自定义提交按钮的属性 - submitter: { - onReset: () => { - funcRef.current?.resetFields(); - setFuncFromType("table") - }, - searchConfig: { resetText: funcfromType === 'form' ? '返回' : '重置', submitText: funcfromType === 'form' ? '提交' : '查询' }, + deviceProducFunctiontApi.Add(params).then((res: MyResponse.Content) => { + if (res.statusCode === 200) { + message.info("新增成功!"); + setFuncFromType('table') + FuncReolod() + } else { + message.error(res.errors); + } + }) } - }} - pagination={{ - pageSize: 5, - showSizeChanger: false - }} - rowKey="id" - dateFormatter="string" + } + }} + request={async (params = {}) => { + const jsonData: deviceProductFunction.queryPage = { + pageIndex: params.current || 1, + pageSize: params.pageSize || 10, + deviceProductId: selectRow?.id + }; + const response = await deviceProducFunctiontApi.PagedList(jsonData); + if (response.statusCode === 200) { + return { + data: response.data.items, + success: true, + total: response.data.total, + }; + } else { + return { + data: [], + success: false, + total: 0, + }; + } + }} + form={{ + ignoreRules: true,// 自定义提交按钮的属性 + submitter: { + onReset: () => { + funcRef.current?.resetFields(); + setFuncFromType("table") + }, + searchConfig: { resetText: funcfromType === 'form' ? '返回' : '重置', submitText: funcfromType === 'form' ? '提交' : '查询' }, + } + }} + pagination={{ + pageSize: 10, + showSizeChanger: false + }} + rowKey="id" + dateFormatter="string" + + toolBarRender={() => [ + , + ]} + /> - toolBarRender={() => [ - , - ]} - /> - } diff --git a/frontend/src/pages/final/index.tsx b/frontend/src/pages/final/index.tsx index 5899626..9098673 100644 --- a/frontend/src/pages/final/index.tsx +++ b/frontend/src/pages/final/index.tsx @@ -236,10 +236,10 @@ const final = () => { .then((res: MyResponse.Content) => { if (res.statusCode === 200) { res.data.map((item: any) => ( - item.value = item.id, - item.label = item.materialName + item.value = item.materialCode, + item.label = item.materialName+`(${item.mode==1?"人工":"设备"})` )) - console.log(res.data); + console.log('物料信息',res.data); setMaterialParmList(res.data) } @@ -469,7 +469,7 @@ const final = () => { { setcurrentproductionProcess(item) - setcurrentproductionDev(devicesItem.code) + setcurrentproductionDev(devicesItem) setStepTitle(item.processName + '-' + devicesItem.name + '[' + devicesItem.code + ']') console.log('currentproductionline', currentproductionline); @@ -506,9 +506,7 @@ const final = () => { } {stepTitle}} onCancel={() => { setIsEditModalOpen(false) @@ -517,19 +515,6 @@ const final = () => { } onOk={() => setIsEditModalOpen(false)} footer={false} - // footer={[ - // , - // , - // ]} > tableStyle={{ overflowY: 'auto', overflowX: 'hidden', maxHeight: '500px' }} @@ -542,11 +527,11 @@ const final = () => { setIsSchemaModalOpen(true) setDeviceParm([]); setSpinStatus(true) - - const jsonData: deviceProductFunction.queryParms = { - deviceProductId: selectRowItem?.deviceProductId + deviceProductId: currentproductionDev?.deviceType }; + console.log('jsonData',jsonData); + DeviceProductFunctionAPI.List(jsonData).then((res: MyResponse.Content) => { if (res.succeeded) { setDeviceFun(res.data); @@ -600,7 +585,7 @@ const final = () => { console.log('sss', currentproductionProcess?.devicesInfo); const b = JSON.stringify(currentproductionProcess?.devicesInfo); const c: any[] = JSON.parse(b); - const d = c.filter(x => x.code != currentproductionDev); + const d = c.filter(x => x.code != currentproductionDev.code); setM_device(d); setisConfigDevOpen(true) }} @@ -629,34 +614,17 @@ const final = () => { hideInSearch: true }, - // { - // title: '产线工序', - // dataIndex: 'productLineStepsName', - // align: 'center', - // hideInSearch: true - // } - // , - // { - // title: '设备类型', - // dataIndex: 'deviceTypeName', - // align: 'center', - // hideInSearch: true - // }, - // { - // title: '设备名称', - // dataIndex: 'deviceName', - // align: 'center', - // hideInSearch: true - // }, { title: '功能', dataIndex: 'deviceProductFunctionName', hideInSearch: true, + width:200 + }, { title: '设备参数预览', - width: 100, hideInSearch: true, + render(dom, entity, index, action, schema) { const deviceFunParams = JSON.parse(entity?.deviceFunParams); if (entity?.deviceStepParms) { @@ -671,9 +639,9 @@ const final = () => { deviceStepParms[citem]?.map( (s: any) => { if (wl == '') { - wl = materialParmList.find((x: any) => x.value == s).label + wl = materialParmList.find((x: any) => x.value == s)?.label } else { - wl = wl + ',' + materialParmList.find((x: any) => x.value == s).label + wl = wl + ',' + materialParmList.find((x: any) => x.value == s)?.label } } ) @@ -689,7 +657,7 @@ const final = () => { { newParms.map((sss) => ( - {sss.name} +
{sss.name}
)) }
@@ -946,7 +914,7 @@ const final = () => { columns={[ { title: '物料名称', - dataIndex: 'materialId', + dataIndex: 'materialCode', valueType: 'select', ellipsis: true, request: async () => { @@ -957,7 +925,7 @@ const final = () => { res.data.map((item: MaterialsTypes.Info) => ( myData.push({ label: `${item.name}[${item.unit}]`, - value: item.id, + value: item.code, }) )) } @@ -979,7 +947,7 @@ const final = () => { text: '设备', }, '1': { - text: '其他', + text: '人工', }, } }, @@ -1226,7 +1194,7 @@ const final = () => { const jsonData: finalCraftStepsTypes.addInput = { productLineStepsId: currentproductionProcess.id, description: froms.description, - deviceId: currentproductionDev, + deviceId: currentproductionDev.code, finalId: selectRowItem.id, deviceProductFunctionId: froms.deviceProductFunctionId!, params: JSON.stringify(values) @@ -1265,7 +1233,7 @@ const final = () => { const jsonData: finalCraftStepsTypes.addInput = { productLineStepsId: currentproductionProcess.id, description: value.description, - deviceId: currentproductionDev, + deviceId: currentproductionDev.code, finalId: selectRowItem.id, deviceProductFunctionId: '', params: '' @@ -1337,7 +1305,7 @@ const final = () => { lineId: currentproductionline.key, copyDeviceId: value.deviceId, productLineStepsId: currentproductionProcess.id, - toDeviceId: currentproductionDev + toDeviceId: currentproductionDev.code }).then((res: MyResponse.Content) => { if (res.statusCode === 200) { message.success('同步成功!'); @@ -1345,7 +1313,7 @@ const final = () => { setTimeout(() => { const jsondata = { lineId: currentproductionline.key, - deviceId: currentproductionDev, + deviceId: currentproductionDev.code, finalId: selectRowItem?.id, productLineStepsId: currentproductionProcess.id } diff --git a/frontend/src/pages/stock/index.tsx b/frontend/src/pages/stock/index.tsx index e4c0300..a9fabce 100644 --- a/frontend/src/pages/stock/index.tsx +++ b/frontend/src/pages/stock/index.tsx @@ -126,7 +126,7 @@ export default () => { // 下拉列表信息 const RegionDataList = async () => { - const data = await materialAPI.selectlist(); + const data = await materialAPI.List(); // console.log(data); setRegionData(data.data); @@ -266,13 +266,13 @@ export default () => { > - + diff --git a/frontend/src/pages/workInfo/index.tsx b/frontend/src/pages/workInfo/index.tsx index 9cf7777..a78b314 100644 --- a/frontend/src/pages/workInfo/index.tsx +++ b/frontend/src/pages/workInfo/index.tsx @@ -623,6 +623,8 @@ export default () => { const UpdateGY = (lineId: string, finalId: string) => { productlineInfoStepsAPI.List({ lineId: lineId, finalId: finalId }).then((res: MyResponse.Content) => { if (res.statusCode === 200) { + console.log('res.data',res.data); + setLineProcessList(res.data); } }) @@ -992,16 +994,23 @@ export default () => { - 0, message: `产线工序路线[${index + 1}-${item.processName}]未选择设备!`,validator:(rule, value)=>{ - message.error(rule.message) - } }]} > + 0, + message: `产线工序路线[${index + 1}-${item.processName}]未选择设备!`,validator(rule, value, callback) { + if (value || item.devicesInfo.length == 0) { + return Promise.resolve(); + }else{ + message.error(`产线工序路线[${index + 1}-${item.processName}]未选择设备!`) + } + + },}]}> { item.devicesInfo.length > 0 ? {item.devicesInfo.map((devicesItem: any, devicesIndex: number) => ( { - }} size='small' title={devicesItem.name} value={devicesItem.id} /> + }} size='small' title={devicesItem.name} value={devicesItem.code} /> ))} :