@@ -54,7 +54,7 @@ const Advanced = (props) => { | |||||
}else{ | }else{ | ||||
values.defaultMate=""; | values.defaultMate=""; | ||||
} | } | ||||
values.isAttrubute=true; | |||||
await addGoods(JSON.stringify(values)).then((r) => { | await addGoods(JSON.stringify(values)).then((r) => { | ||||
if (r.succeeded) { | if (r.succeeded) { | ||||
message.success('操作成功'); | message.success('操作成功'); | ||||
@@ -197,9 +197,7 @@ const Advanced = (props) => { | |||||
setMatedata(r.data); | setMatedata(r.data); | ||||
}); | }); | ||||
} | } | ||||
function initTypeList(){ | |||||
initGetbomType(); | |||||
} | |||||
const onNameChange = (event) => { | const onNameChange = (event) => { | ||||
setunitname(event.target.value); | setunitname(event.target.value); | ||||
}; | }; | ||||
@@ -235,135 +233,11 @@ const Advanced = (props) => { | |||||
// tab: '商品工艺', | // tab: '商品工艺', | ||||
// }, | // }, | ||||
]; | ]; | ||||
const onUpdateBomCancel=()=>{ | |||||
setUpdateBomVisible(false); | |||||
setBomId('') | |||||
} | |||||
const onBomBatchingCancel=()=>{ | |||||
setBomBatchingVisible(false); | |||||
setBomId('') | |||||
} | |||||
const onUpdateBomSave=(form)=>{ | |||||
form | |||||
.validateFields() | |||||
.then((values) => { | |||||
console.log(values) | |||||
var parm={id:BomId,name:values.bomName,IsMain:values.bomType=='1'?true:false,bomTypeIds:values.bomTypeList} | |||||
UpdateBomInfo(parm).then((r)=>{ | |||||
if(r.succeeded){ | |||||
message.success('修改成功'); | |||||
setUpdateBomVisible(false); | |||||
actionRef.current.reload(); | |||||
setBomId('') | |||||
}else{ | |||||
message.error(r.errors); | |||||
} | |||||
}) | |||||
}) | |||||
} | |||||
const onBomBatchingFinish=(form)=>{ | |||||
console.log("form",form) | |||||
var parm={bomId:BomId,bomEntry:form}; | |||||
UpdateBomBatcing(parm).then((r)=>{ | |||||
if(r.succeeded){ | |||||
message.success('修改成功'); | |||||
setBomBatchingVisible(false); | |||||
actionRef.current.reload(); | |||||
setBomId('') | |||||
}else{ | |||||
message.error(r.errors); | |||||
} | |||||
}) | |||||
} | |||||
const bomcolumns = | |||||
[ | |||||
{ | |||||
title: '主键', | |||||
dataIndex: 'id', | |||||
key: 'id', | |||||
hideInTable: true, | |||||
hideInSearch: true, | |||||
tip: '规则名称是唯一的 key', | |||||
}, | |||||
{ | |||||
title: '配方名称', | |||||
key: 'name', | |||||
dataIndex: 'name', | |||||
valueType: 'textarea', | |||||
}, | |||||
{ | |||||
title: '配方类型', | |||||
dataIndex: 'isMain', | |||||
hideInForm: true, | |||||
valueEnum: { | |||||
false: { | |||||
text: '辅料', | |||||
status: 'Processing', | |||||
}, | |||||
true: { | |||||
text: '主料', | |||||
status: 'Success', | |||||
}, | |||||
}, | |||||
}, | |||||
{ | |||||
title: '操作', | |||||
dataIndex: 'option', | |||||
valueType: 'option', | |||||
render: (_, record) => [ | |||||
<a | |||||
key="primary" | |||||
type="primary" | |||||
onClick={() => { | |||||
setUpdateBomVisible(true); | |||||
setBomId(record.bomId) | |||||
}} | |||||
> | |||||
更新 | |||||
</a>, | |||||
<a | |||||
key="primary" | |||||
type="primary" | |||||
onClick={() => { | |||||
setBomBatchingVisible(true); | |||||
setBomId(record.bomId) | |||||
}} | |||||
> | |||||
配方详情 | |||||
</a>, | |||||
<Popconfirm | |||||
type="primary" | |||||
key="primary" | |||||
title="确认删除吗?" | |||||
okText="是" | |||||
cancelText="否" | |||||
onConfirm={async () => { | |||||
const hide = message.loading('正在删除'); | |||||
try { | |||||
DelGoodsBom(record.id); | |||||
hide(); | |||||
message.success('删除成功,即将刷新'); | |||||
actionRef.current.reload(); | |||||
return true; | |||||
} catch (error) { | |||||
hide(); | |||||
message.error('删除失败,请重试'); | |||||
actionRef.current.reload(); | |||||
return false; | |||||
} | |||||
}} | |||||
onCancel={() => {}} | |||||
> | |||||
<a href="#">删除</a> | |||||
</Popconfirm>, | |||||
], | |||||
} | |||||
] | |||||
const onChange = (newValue) => { | const onChange = (newValue) => { | ||||
setgoodsTypeIdvalue(newValue); | setgoodsTypeIdvalue(newValue); | ||||
}; | }; | ||||
const filterOption = (input, option) => | const filterOption = (input, option) => | ||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()); | |||||
(option?.title ?? '').toLowerCase().includes(input.toLowerCase()); | |||||
const contentList = { | const contentList = { | ||||
basis: ( | basis: ( | ||||
<Card | <Card | ||||
@@ -393,10 +267,11 @@ const Advanced = (props) => { | |||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | ||||
treeData={treeData} | treeData={treeData} | ||||
onChange={onChange} | onChange={onChange} | ||||
filterOption={filterOption} | |||||
filterTreeNode={filterOption} | |||||
value={goodsTypeIdvalue} | value={goodsTypeIdvalue} | ||||
placeholder="请选择商品类型" | placeholder="请选择商品类型" | ||||
treeDefaultExpandAll | treeDefaultExpandAll | ||||
/> | /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="name" label="商品名称" rules={[{ required: true }]}> | <Form.Item name="name" label="商品名称" rules={[{ required: true }]}> | ||||
@@ -404,12 +279,15 @@ const Advanced = (props) => { | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item name="goodsUintId" label="商品单位" rules={[{ required: true }]}> | <Form.Item name="goodsUintId" label="商品单位" rules={[{ required: true }]}> | ||||
<Select | <Select | ||||
style={{width: 400}} | |||||
style={{width: '100%'}} | |||||
placeholder="请选择单位" | placeholder="请选择单位" | ||||
showSearch | showSearch | ||||
allowClear | allowClear | ||||
filterOption={filterOption} | |||||
options={goodsUnit} | options={goodsUnit} | ||||
optionFilterProp="children" filterOption={(input, option) => (option?.label ?? '').includes(input)} | |||||
filterSort={(optionA, optionB) => | |||||
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase()) | |||||
} | |||||
dropdownRender={(menu) => ( | dropdownRender={(menu) => ( | ||||
<> | <> | ||||
{menu} | {menu} | ||||
@@ -437,9 +315,9 @@ const Advanced = (props) => { | |||||
<Form.Item label="是否称重" name="isWeigh" valuePropName="checked" > | <Form.Item label="是否称重" name="isWeigh" valuePropName="checked" > | ||||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | <Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label="是否多属性" name="isAttrubute" valuePropName="checked"> | |||||
{/* <Form.Item label="是否多属性" name="isAttrubute" valuePropName="checked"> | |||||
<Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | <Switch checkedChildren="是" unCheckedChildren="否" defaultChecked={false} /> | ||||
</Form.Item> | |||||
</Form.Item> */} | |||||
<Form.Item name="descritption" label="备注"> | <Form.Item name="descritption" label="备注"> | ||||
<TextArea rows={4} /> | <TextArea rows={4} /> | ||||
</Form.Item> | </Form.Item> | ||||
@@ -276,6 +276,7 @@ const GoodsbomFrom = (props) => { | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item shouldUpdate style={{display:disaenumbled}} name="bomId" label="选择配方" rules={bomcheckRules}> | <Form.Item shouldUpdate style={{display:disaenumbled}} name="bomId" label="选择配方" rules={bomcheckRules}> | ||||
<Select | <Select | ||||
allowClear | |||||
showSearch | showSearch | ||||
optionFilterProp="children" | optionFilterProp="children" | ||||
onChange={handleChange} | onChange={handleChange} | ||||
@@ -126,9 +126,9 @@ const EditFrom = (props) => { | |||||
return ( | return ( | ||||
<ProCard boxShadow title={"工序号"+x.sort} bordered bodyStyle={{ padding: 15,display: 'flex'}} headStyle={{ padding: '0px 24px' }} style={{ marginBlockEnd: 8 }} extra={<DeleteOutlined onClick={() => { onDelClick(x.sort) }} />}> | <ProCard boxShadow title={"工序号"+x.sort} bordered bodyStyle={{ padding: 15,display: 'flex'}} headStyle={{ padding: '0px 24px' }} style={{ marginBlockEnd: 8 }} extra={<DeleteOutlined onClick={() => { onDelClick(x.sort) }} />}> | ||||
<div style={{ float: 'left', width: '20%' }}> | <div style={{ float: 'left', width: '20%' }}> | ||||
<Select name="chnologyId" key={x.sort} style={{ width: '108px' }} value={x.chnologyId} disabled={x.disabled} options={props.goodstechnologydata} onChange={async (value, option) => { onHandleChange(value, option, x.index) }}></Select> | |||||
<Select name="chnologyId" key={x.sort} style={{ width: '100%' }} value={x.chnologyId} disabled={x.disabled} options={props.goodstechnologydata} onChange={async (value, option) => { onHandleChange(value, option, x.index) }}></Select> | |||||
</div> | </div> | ||||
<div style={{ float: 'left',width: '75%'}}> | |||||
<div style={{ float: 'left',width: '78%'}}> | |||||
{ | { | ||||
// x.isBatch ? | // x.isBatch ? | ||||
<From propsdata={x.propsdata} fromdata={fromdata} batchingdata={props.batchingdata} onSaveClick={onSaveClick} optiondata={x.optiondata} index={x.index} /> | <From propsdata={x.propsdata} fromdata={fromdata} batchingdata={props.batchingdata} onSaveClick={onSaveClick} optiondata={x.optiondata} index={x.index} /> | ||||
@@ -84,27 +84,33 @@ const From = (props) => { | |||||
let value=props.optiondata.find(p=>p.id==x.technologyactionId && p.actionName==x.actionName).actionValue; | let value=props.optiondata.find(p=>p.id==x.technologyactionId && p.actionName==x.actionName).actionValue; | ||||
if (x.actionType == "text") { | if (x.actionType == "text") { | ||||
return <> | return <> | ||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</div> | |||||
<div style={{ display: 'block', float: 'left',marginBottom:5,width: '66%' }}><Input key={x.id} defaultValue={value} style={{ width: '100%' }} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></div> | |||||
<div style={{width:'100%',height: '40px'}}> | |||||
<span className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</span> | |||||
<span style={{ display: 'block', float: 'left',marginBottom:5,width: '60%' }}><Input key={x.id} defaultValue={value} style={{ width: '100%' }} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></span> | |||||
</div> | |||||
</> | </> | ||||
} | } | ||||
if (x.actionType == "digit") { | if (x.actionType == "digit") { | ||||
return <> | return <> | ||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</div> | |||||
<div style={{ display: 'block', float: 'left',marginBottom:5,width: '66%' }}><InputNumber key={x.id} defaultValue={value} style={{ width: '100%' }} onChange={(value) => { handlenumChange(value, x.id, x.goddteid) }} /></div> | |||||
</> | |||||
<div style={{width:'100%',height: '40px'}}> | |||||
<span className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</span> | |||||
<span style={{ display: 'block', float: 'left',marginBottom:5,width: '60%' }}><InputNumber key={x.id} defaultValue={value} style={{ width: '100%' }} onChange={(value) => { handlenumChange(value, x.id, x.goddteid) }} /></span> | |||||
</div></> | |||||
} | } | ||||
if (x.actionType == "textarea") { | if (x.actionType == "textarea") { | ||||
return <> | return <> | ||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</div> | |||||
<div style={{ display: 'block', float: 'left',marginBottom:5,width: '66%' }}><TextArea key={x.id} defaultValue={value} style={{ width: '100%'}} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></div> | |||||
<div style={{width:'100%',height: '40px'}}> | |||||
<span className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</span> | |||||
<span style={{ display: 'block', float: 'left',marginBottom:5,width: '60%' }}><TextArea key={x.id} defaultValue={value} style={{ width: '100%'}} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></span> | |||||
</div> | |||||
</> | </> | ||||
} | } | ||||
if (x.actionType == "switch") { | if (x.actionType == "switch") { | ||||
return <> | return <> | ||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</div> | |||||
<div style={{ display: 'block', float: 'left',marginBottom:5,width: '66%' }}><Switch key={x.id} defaultValue={value} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></div> | |||||
</> | |||||
<div style={{width:'100%',height: '40px'}}> | |||||
<span className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</span> | |||||
<span style={{ display: 'block', float: 'left',marginBottom:5,width: '60%' }}><Switch key={x.id} defaultValue={value} onChange={(value) => { handleChange(value, x.id, x.goddteid) }} /></span> | |||||
</div></> | |||||
} | } | ||||
if (x.actionType == "select") { | if (x.actionType == "select") { | ||||
var va = [] | var va = [] | ||||
@@ -122,9 +128,10 @@ const From = (props) => { | |||||
op=sd | op=sd | ||||
} | } | ||||
return <> | return <> | ||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</div> | |||||
<div style={{ display: 'block', float: 'left',marginBottom:5,width: '66%' }}><Select key={x.id} defaultValue={value} labelInValue options={op} style={{ width: '100%' }} onChange={(value) => { handleselectChange(value, x.id, x.goddteid) }} /></div> | |||||
</> | |||||
<div style={{width:'100%',height: '40px'}}> | |||||
<span className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff',marginBottom:5 }}>{x.actionName}</span> | |||||
<span style={{ display: 'block', float: 'left',marginBottom:5,width: '60%' }}><Select key={x.id} defaultValue={value} labelInValue options={op} style={{ width: '100%' }} onChange={(value) => { handleselectChange(value, x.id, x.goddteid) }} /></span> | |||||
</div></> | |||||
} | } | ||||
@@ -584,12 +584,12 @@ const goodstechnologymaken = (props) => { | |||||
// <DeleteOutlined onClick={(e) => { onClickdele(e, item, action) }} /> | // <DeleteOutlined onClick={(e) => { onClickdele(e, item, action) }} /> | ||||
]} style={{boxShadow: '5px 8px 24px 5px rgba(208, 216, 243, 0.6)'}}> | ]} style={{boxShadow: '5px 8px 24px 5px rgba(208, 216, 243, 0.6)'}}> | ||||
<div style={{ lineHeight: '200px', height: '100%', width: '100%' }}> | <div style={{ lineHeight: '200px', height: '100%', width: '100%' }}> | ||||
<div className={style['formlable']} style={{ float: 'left', width: '29%',backgroundColor: '#4eaaf5',color:'white' }}>{item.stepName}</div> | |||||
<div style={{ float: 'left', marginBottom: '5px', width: '67%', }}> | |||||
<div className={style['formlable']} style={{ float: 'left', width: '25%',backgroundColor: '#4eaaf5',color:'white' }}>{item.stepName}</div> | |||||
<div style={{ float: 'left', marginBottom: '5px', width: '70%', }}> | |||||
{ | { | ||||
action.map(x => { | action.map(x => { | ||||
return ( | return ( | ||||
<div style={{ float: 'left', marginBottom: '5px' }}> | |||||
<div style={{ float: 'left', marginBottom: '5px',width: '100%' }}> | |||||
<div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff' }}>{x.actionName}</div> | <div className={style['formlable']} style={{ display: 'block', float: 'left', backgroundColor: '#dcf4ff' }}>{x.actionName}</div> | ||||
<div className={style['formlabletxt']} style={{ display: 'block', float: 'left' }}> {x.actionValue}</div> | <div className={style['formlabletxt']} style={{ display: 'block', float: 'left' }}> {x.actionValue}</div> | ||||
</div> | </div> | ||||
@@ -61,7 +61,7 @@ | |||||
.formlable{ | .formlable{ | ||||
color: #3a3a3a; | color: #3a3a3a; | ||||
border: 1px solid #bfbbbb; | border: 1px solid #bfbbbb; | ||||
width: 91px; | |||||
width: 30%; | |||||
height: 32px; | height: 32px; | ||||
text-align: center; | text-align: center; | ||||
line-height: 30px; | line-height: 30px; | ||||
@@ -70,7 +70,7 @@ | |||||
.formlabletxt{ | .formlabletxt{ | ||||
color: #3a3a3a; | color: #3a3a3a; | ||||
border: 1px solid #ebe1e1; | border: 1px solid #ebe1e1; | ||||
width: 170px; | |||||
width: 60%; | |||||
height: 32px; | height: 32px; | ||||
text-align: center; | text-align: center; | ||||
line-height: 30px; | line-height: 30px; | ||||
@@ -1,5 +1,5 @@ | |||||
import { PlusOutlined, UploadOutlined } from '@ant-design/icons'; | |||||
import { Button, message, Input, Drawer, Popconfirm, Upload, Spin } from 'antd'; | |||||
import { PlusOutlined, UploadOutlined,QuestionCircleOutlined } from '@ant-design/icons'; | |||||
import { Button, message, Input, Drawer, Popconfirm, Upload, Spin,Tooltip } from 'antd'; | |||||
import React, { useState, useRef, useEffect } from 'react'; | import React, { useState, useRef, useEffect } from 'react'; | ||||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | ||||
import ProTable from '@ant-design/pro-table'; | import ProTable from '@ant-design/pro-table'; | ||||
@@ -301,11 +301,12 @@ const GoodsManage = () => { | |||||
// link.href = url; | // link.href = url; | ||||
// link.click(); | // link.click(); | ||||
const link = document.createElement('a'); | const link = document.createElement('a'); | ||||
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/goods/133463060115739076.xlsx"; | |||||
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/goods/133534083799594690.xlsx"; | |||||
link.click(); | link.click(); | ||||
}} | }} | ||||
> | > | ||||
<UploadOutlined /> 下载商品导入模板 | <UploadOutlined /> 下载商品导入模板 | ||||
<Tooltip placement="top" title="下载后请使用wps进行编辑"><QuestionCircleOutlined /></Tooltip> | |||||
</Button>, | </Button>, | ||||
// <Popconfirm | // <Popconfirm | ||||
// type="primary" | // type="primary" | ||||
@@ -9,6 +9,7 @@ const CreateForm = (props) => { | |||||
const [DeviceVesionData, setDeviceVesionData] = useState([]); | const [DeviceVesionData, setDeviceVesionData] = useState([]); | ||||
const [value, setValue] = useState(0); | const [value, setValue] = useState(0); | ||||
const [deviceTypename,setdeviceTypename]=useState(""); | const [deviceTypename,setdeviceTypename]=useState(""); | ||||
const [options,setoptions]=useState([]); | |||||
const inputRef = useRef(null); | const inputRef = useRef(null); | ||||
useEffect(() => { | useEffect(() => { | ||||
console.log(props.values) | console.log(props.values) | ||||
@@ -17,7 +18,11 @@ const CreateForm = (props) => { | |||||
setDeviceVesionData(res.data) | setDeviceVesionData(res.data) | ||||
}) | }) | ||||
} | } | ||||
},[props.values]) | |||||
var optdata=props.dicData.map((item, index) => { | |||||
return {value:item.id,label:item.label} | |||||
}) | |||||
setoptions(optdata); | |||||
},[props]) | |||||
const handleChange=(value)=>{ | const handleChange=(value)=>{ | ||||
GetDeviceVesion(value).then((res)=>{ | GetDeviceVesion(value).then((res)=>{ | ||||
setDeviceVesionData(res.data) | setDeviceVesionData(res.data) | ||||
@@ -72,15 +77,10 @@ const CreateForm = (props) => { | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label={'所属产品'} name="productId" rules={[{ required: true }]}> | <Form.Item label={'所属产品'} name="productId" rules={[{ required: true }]}> | ||||
<Select onChange={handleChange}> | |||||
{props.dicData.map((item, index) => { | |||||
return ( | |||||
<Select.Option index={index} value={item.id} key={item.id}> | |||||
{item.label} | |||||
</Select.Option> | |||||
); | |||||
})} | |||||
</Select> | |||||
<Select onChange={handleChange} allowClear showSearch optionFilterProp="children" filterOption={(input, option) => (option?.label ?? '').includes(input)} | |||||
filterSort={(optionA, optionB) => | |||||
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase()) | |||||
} options={options}/> | |||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label={'产品版本'} name="productVersionId" rules={[{ required: true }]}> | <Form.Item label={'产品版本'} name="productVersionId" rules={[{ required: true }]}> | ||||
<Select> | <Select> | ||||
@@ -101,6 +101,11 @@ const CreateForm = (props) => { | |||||
style={{width: '100%'}} | style={{width: '100%'}} | ||||
placeholder="请选设备标签" | placeholder="请选设备标签" | ||||
options={props.storeType} | options={props.storeType} | ||||
allowClear showSearch | |||||
optionFilterProp="children" filterOption={(input, option) => (option?.label ?? '').includes(input)} | |||||
filterSort={(optionA, optionB) => | |||||
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase()) | |||||
} | |||||
dropdownRender={(menu) => ( | dropdownRender={(menu) => ( | ||||
<> | <> | ||||
{menu} | {menu} | ||||
@@ -42,42 +42,21 @@ const ActionForm = (props) => { | |||||
valueEnum:options, | valueEnum:options, | ||||
}, | }, | ||||
// { | |||||
// title: '类型值', | |||||
// dataIndex: 'actionValue', | |||||
// width: '15%', | |||||
// valueType:'select', | |||||
// valueEnum: { | |||||
// text:{ | |||||
// text: '文本框', | |||||
// status: 'text', | |||||
// }, | |||||
// select:{ | |||||
// text: '下拉框', | |||||
// status: 'select', | |||||
// } | |||||
// } | |||||
// }, | |||||
// { | |||||
// title: '单位', | |||||
// dataIndex: 'unit', | |||||
// width: '8%', | |||||
// }, | |||||
// { | |||||
// title: '是否绑定物料', | |||||
// dataIndex: 'isBatch', | |||||
// width: '15%', | |||||
// valueEnum: { | |||||
// true:{ | |||||
// text: '是', | |||||
// status: 'Success', | |||||
// }, | |||||
// false:{ | |||||
// text: '否', | |||||
// status: 'Processing', | |||||
// } | |||||
// } | |||||
// }, | |||||
{ | |||||
title: '输入值类型', | |||||
dataIndex: 'technologyType', | |||||
valueType: 'select', | |||||
hideInSearch: true, | |||||
valueEnum: { | |||||
"0":{ | |||||
text: ' ', | |||||
}, | |||||
"1":{ | |||||
text: '物料', | |||||
} | |||||
} | |||||
}, | |||||
{ | { | ||||
title: '排序', | title: '排序', | ||||
dataIndex: 'sort', | dataIndex: 'sort', | ||||
@@ -8,6 +8,7 @@ const CreateForm = (props) => { | |||||
const [form] = Form.useForm(); | const [form] = Form.useForm(); | ||||
const [dataSource, setDataSource] = useState([]); | const [dataSource, setDataSource] = useState([]); | ||||
const [editableKeys, setEditableRowKeys] = useState([]); | const [editableKeys, setEditableRowKeys] = useState([]); | ||||
const [options,setoptions]=useState([]); | |||||
useEffect(() => { | useEffect(() => { | ||||
console.log("props.values",props.values) | console.log("props.values",props.values) | ||||
if(props.values.id){ | if(props.values.id){ | ||||
@@ -22,7 +23,10 @@ const CreateForm = (props) => { | |||||
setEditableRowKeys(data.map((item) => item.id)) | setEditableRowKeys(data.map((item) => item.id)) | ||||
setDataSource(data) | setDataSource(data) | ||||
} | } | ||||
var optdata=props.devicedata?.map((item, index) => { | |||||
return {value:item.id,label:item.name} | |||||
}) | |||||
setoptions(optdata); | |||||
},[props]) | },[props]) | ||||
const columns=[ | const columns=[ | ||||
{ | { | ||||
@@ -123,15 +127,14 @@ const CreateForm = (props) => { | |||||
<Input /> | <Input /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item label={"选择设备"} name="deviceId" rules={[{ required: true,max:50}]} > | <Form.Item label={"选择设备"} name="deviceId" rules={[{ required: true,max:50}]} > | ||||
<Select style={{width: '100%'}} onChange={handleChange}> | |||||
{props.devicedata?.map((item, index) => { | |||||
return ( | |||||
<Select.Option index={index} value={item.id} key={item.id}> | |||||
{item.name} | |||||
</Select.Option> | |||||
); | |||||
})} | |||||
</Select> | |||||
<Select style={{width: '100%'}} allowClear showSearch | |||||
optionFilterProp="children" filterOption={(input, option) => (option?.label ?? '').includes(input)} | |||||
filterSort={(optionA, optionB) => | |||||
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase()) | |||||
} | |||||
onChange={handleChange} options={options}/> | |||||
</Form.Item> | </Form.Item> | ||||
{/* <Form.Item> | {/* <Form.Item> | ||||