@@ -112,9 +112,8 @@ export async function getbyidgoods (data) { | |||
}); | |||
} | |||
export async function GetGoodsTechnology(data) { | |||
return request(getDataBaseUrl()+`/api/goodstechnology/GetGoodsTechnology`, { | |||
method: 'Post', | |||
data: data, | |||
return request(getDataBaseUrl()+`/api/technology/gettechnologylist?deviceId=`+data, { | |||
method: 'Get', | |||
}); | |||
} | |||
export async function GetTechnologyactionList(data) { | |||
@@ -47,11 +47,17 @@ const GoodsbomFrom = (props) => { | |||
} | |||
useEffect(() => { | |||
console.log("props.Bomdata",props.Bomdata) | |||
var ty=form.getFieldValue("type"); | |||
console.log("props.Bomdata",form.getFieldValue("type")) | |||
console.log(props.goodsname) | |||
setdisaenumbled('block') | |||
setdisnewd("none"); | |||
setbomcheckRules([{ required: true, message: '请选择配方' }]) | |||
if(ty!=0){ | |||
setdisaenumbled('block') | |||
setdisnewd("none"); | |||
setbomcheckRules([{ required: true, message: '请选择配方' }]) | |||
setbomNameRules( [{ required: false}]) | |||
setbomTypeListRules([{ required: false}]) | |||
} | |||
// form.setFieldsValue({ | |||
// bomName: props.goodsname, | |||
// // bomType:1 | |||
@@ -71,7 +77,7 @@ const GoodsbomFrom = (props) => { | |||
setEditableRowKeys(soredata.map((item) => item.id)) | |||
setDataSource(soredata); | |||
} | |||
},[]) | |||
},[props]) | |||
const columns=[ | |||
{ | |||
title: '物料名称', | |||
@@ -12,8 +12,8 @@ const EditFrom = (props) => { | |||
useEffect(() => { | |||
//setfromdata(props.fromdata) | |||
//props.fromdata=fromdata | |||
console.log("增加编辑状态值",props.UpdataStatus) | |||
console.log("props.fromdata",props.fromdata) | |||
console.log("增加编辑状态值",props.technologyattralldata) | |||
console.log("props.fromdata",props.goodstechnologydata) | |||
if(props.fromdata.length==0){ | |||
setfromdata([]) | |||
}else{ | |||
@@ -80,7 +80,7 @@ const EditFrom = (props) => { | |||
const onHandleChange = (value, option, index) => { | |||
console.log(fromdata) | |||
console.log(index) | |||
var sd = props.technologyattralldata.filter(x => x.productFunctionId == value); | |||
var sd = props.technologyattralldata.filter(x => x.technologyId == value); | |||
var newdata = fromdata.map(x => { | |||
if (x.index == index) { | |||
@@ -92,9 +92,9 @@ const goodstechnologymaken = (props) => { | |||
// setgoodstechnologydata(sd) | |||
// } | |||
// }); | |||
GetTechnologyActionListAll().then((r) => { | |||
setTechnologyattralldata(r.data) | |||
}) | |||
// GetTechnologyActionListAll().then((r) => { | |||
// setTechnologyattralldata(r.data) | |||
// }) | |||
GetGoodsTechnologyAction(props.goodsid).then((r) => { | |||
if (r.data.length > 0) { | |||
setgoodstechnolog(r.data) | |||
@@ -156,39 +156,13 @@ const goodstechnologymaken = (props) => { | |||
setopreaction("update") | |||
if (UpdataStatus != "add") { | |||
setdefaultValue(item.deviceId) | |||
handleChange(item.deviceId) | |||
let attr = []; | |||
item.data.forEach(item => { | |||
const obj = {}; | |||
let propsdatanew = []; | |||
let propsdata = technologyattralldata.filter(x => x.productFunctionId == item.chnologyId) | |||
obj.stepName = item.stepName; | |||
obj.id = item.id; | |||
obj.chnologyId = item.chnologyId; | |||
obj.sort = item.sort; | |||
obj.actionJson = item.actionJson | |||
obj.optiondata = JSON.parse(item.actionJson) | |||
propsdata.forEach(x => { | |||
let sd = { | |||
id: x.id, | |||
actionName: x.actionName, | |||
actionType: x.actionType, | |||
actionValue: x.actionValue, | |||
goodstechnologyId: x.productFunctionId, | |||
isBatch: x.isBatch, | |||
sort: x.sort, | |||
goddteid: item.id | |||
} | |||
propsdatanew.push(sd) | |||
}) | |||
obj.propsdata = propsdatanew; | |||
obj.isBatch = item.isBatch; | |||
obj.typeName = item.stepName; | |||
attr.push(obj) | |||
}) | |||
console.log("attr", attr) | |||
setfromdata(attr) | |||
//handleChange(item.deviceId) | |||
setdefaultValue(item.deviceId) | |||
setddevideId(item.deviceId) | |||
GetGoodsTechnologyvalue(item.deviceId,"edit",item) | |||
//console.log("attr", attr) | |||
setUpdataStatus("update") | |||
} else { | |||
message.error("请保存当前数据后在编辑"); | |||
@@ -196,6 +170,63 @@ const goodstechnologymaken = (props) => { | |||
//setTechnologyattrdata(attr) | |||
} | |||
const editfrom=(item,Technologyacton)=>{ | |||
let attr = []; | |||
item.data.forEach(item => { | |||
const obj = {}; | |||
let propsdatanew = []; | |||
let propsdata = Technologyacton.filter(x => x.technologyId == item.chnologyId) | |||
obj.stepName = item.stepName; | |||
obj.id = item.id; | |||
obj.chnologyId = item.chnologyId; | |||
obj.sort = item.sort; | |||
obj.actionJson = item.actionJson | |||
obj.optiondata = JSON.parse(item.actionJson) | |||
propsdata.forEach(x => { | |||
let sd = { | |||
id: x.id, | |||
actionName: x.actionName, | |||
actionType: x.actionType, | |||
actionValue: x.actionValue, | |||
goodstechnologyId: x.technologyId, | |||
isBatch: x.isBatch, | |||
sort: x.sort, | |||
goddteid: item.id | |||
} | |||
propsdatanew.push(sd) | |||
}) | |||
obj.propsdata = propsdatanew; | |||
obj.isBatch = item.isBatch; | |||
obj.typeName = item.stepName; | |||
attr.push(obj) | |||
}) | |||
setfromdata(attr) | |||
} | |||
const GetGoodsTechnologyvalue=(value,va,item)=>{ | |||
let godata=[] | |||
GetGoodsTechnology(value).then((r)=>{ | |||
if (r.data.length > 0) { | |||
var Technologyacton=[]; | |||
godata = r.data.map(x => { | |||
if(x.technologyActionInfo.length>0){ | |||
x.technologyActionInfo.forEach(p=>{ | |||
Technologyacton.push(p); | |||
}) | |||
} | |||
return { value: x.id, label: x.name } | |||
}) | |||
setTechnologyattralldata(Technologyacton) | |||
setgoodstechnologydata(godata) | |||
} | |||
//setfromdata([]) | |||
if(va=="edit"){ | |||
editfrom(item,Technologyacton) | |||
} | |||
}) | |||
} | |||
//删除单个工艺 | |||
const onClickdele = (e, item, action) => { | |||
DeleteGoodsTechnologyAction(item.id).then((res) => { | |||
@@ -244,20 +275,20 @@ const goodstechnologymaken = (props) => { | |||
console.log("进来了", value) | |||
setdefaultValue(value) | |||
setddevideId(value) | |||
let godata=[] | |||
let sd = DeviceTechnologydata.find(x => x.id == value); | |||
if (sd) { | |||
if (sd.goodsTechnologyInfo.length > 0) { | |||
godata = sd.goodsTechnologyInfo.map(x => { | |||
return { value: x.deviceTechnologyId, label: x.name } | |||
}) | |||
GetGoodsTechnologyvalue(value,"",null) | |||
// let sd = DeviceTechnologydata.find(x => x.id == value); | |||
// if (sd) { | |||
// if (sd.goodsTechnologyInfo.length > 0) { | |||
// godata = sd.goodsTechnologyInfo.map(x => { | |||
// return { value: x.deviceTechnologyId, label: x.name } | |||
// }) | |||
setgoodstechnologydata(godata) | |||
} | |||
setfromdata([]) | |||
} | |||
console.log("godata", godata) | |||
setgoodstechnologydata(godata) | |||
// setgoodstechnologydata(godata) | |||
// } | |||
// setfromdata([]) | |||
// } | |||
// console.log("godata", godata) | |||
// setgoodstechnologydata(godata) | |||
} | |||
const onUpdataStatus = (val) => { | |||
setUpdataStatus(val) | |||
@@ -160,7 +160,7 @@ const handleAdd = async (fields) => { | |||
}, | |||
{ | |||
title: '排序', | |||
dataIndex: 'goodsType_Sort', | |||
dataIndex: 'sort', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
@@ -54,7 +54,7 @@ export async function GetDeviceType() { | |||
} | |||
/** 添加设备标签 */ | |||
export async function AddDeviceType(data) { | |||
return request(`/saasbase/api/device/adddevicetype`, { | |||
return request(getDataBaseUrl()+`/api/device/adddevicetype`, { | |||
method: 'POST', | |||
data: data, | |||
}); | |||
@@ -0,0 +1,173 @@ | |||
import ProTable from '@ant-design/pro-table'; | |||
import { Modal,Space, Form,Button,Select,message,Popconfirm} from 'antd'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import React, { useState,useRef } from 'react'; | |||
import CreateAction from './CreateAction'; | |||
const { Option, OptGroup } = Select; | |||
const ActionForm = (props) => { | |||
const [currentRow , setcurrentRow ] = useState([]);; | |||
const [dataSource, setDataSource] = useState([]); | |||
const actionRef = useRef(); | |||
const [form] = Form.useForm(); | |||
const [actionValueName,setactionValueName]=useState(); | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const options = { | |||
text:{value:'text',text: `文本框`}, | |||
select:{ value: `select`, text: `下拉框`}, | |||
// money:{ value: `money`, text: `金额输入`}, | |||
textarea:{ value: `textarea`, text: `文本域`}, | |||
// date:{ value: `date`, text: `日期`}, | |||
// dateTime:{ value: `dateTime`, text: `日期时间`}, | |||
// radio:{ value: `radio`, text: `单选框`}, | |||
// radioButton:{ value: `radioButton`, text: `按钮单选框`}, | |||
digit:{ value: `digit`, text: `数字输入框`}, | |||
switch:{ value: `switch`, text: `开关`}, | |||
} | |||
const columns= [ | |||
{ | |||
title: '模型名称', | |||
dataIndex: 'actionName', | |||
width: '15%', | |||
}, | |||
{ | |||
title: '输入类型', | |||
key: 'actionType', | |||
dataIndex: 'actionType', | |||
valueType: 'select', | |||
width: '15%', | |||
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: 'sort', | |||
valueType:'digit', | |||
width: '8%', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
width: 200, | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setcurrentRow(record); | |||
}} | |||
> | |||
查看 | |||
</a>, | |||
// <Popconfirm | |||
// type="primary" | |||
// key="primary" | |||
// title="确认删除吗?" | |||
// okText="是" | |||
// cancelText="否" | |||
// onConfirm={() => { | |||
// handleRemove([record.id]); | |||
// actionRef.current?.reloadAndRest(); | |||
// }} | |||
// onCancel={() => { }} | |||
// > | |||
// <a href="#">删除</a> | |||
// </Popconfirm>,, | |||
], | |||
}, | |||
] | |||
return ( | |||
<> | |||
<Modal | |||
title={'模型配置'} | |||
width={1140} | |||
visible={props?.actionFormModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props?.onCancel(); | |||
}} | |||
destroyOnClose | |||
maskClosable={false} | |||
> | |||
<ProTable rowKey="id" | |||
headerTitle="模型配置列表" | |||
actionRef={actionRef} | |||
pagination={false} | |||
search={false} | |||
toolBarRender={false} | |||
columns={columns} | |||
dataSource={props.dataSource} | |||
> | |||
</ProTable> | |||
<CreateAction | |||
onFinish={async (value) => { | |||
var success = false; | |||
console.log(value) | |||
console.log(value.actionValue) | |||
value.goodstechnologyId=props.values.id; | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
success = await onFinish(value); | |||
} | |||
if (success) { | |||
handleModalVisible(false); | |||
if (actionRef.current) { | |||
actionRef.current.reload(); | |||
} | |||
} | |||
}} | |||
onCancel={() => { | |||
setcurrentRow(undefined); | |||
handleModalVisible(false); | |||
}} | |||
createModalVisible={createModalVisible} | |||
actionValueName={actionValueName} | |||
values={currentRow || {}} | |||
/> | |||
</Modal> | |||
</> | |||
); | |||
}; | |||
export default ActionForm; |
@@ -0,0 +1,246 @@ | |||
import { Modal,Input, Form,Button,Select,message,Switch,Divider,Space,progress,percent} from 'antd'; | |||
import { BetaSchemaForm, ProFormSelect,ProFormDependency } from '@ant-design/pro-form'; | |||
import React, { useState,useEffect } from 'react'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
const CreateAction = (props) => { | |||
const [form] = Form.useForm(); | |||
const formRef = React.useRef(null); | |||
const [valueType, setValueType] = useState('text'); | |||
const [layoutType, setLayoutType] = useState('Form'); | |||
const [optionitem,setoptionitem]=useState([]) | |||
const [modalVisit, setModalVisit] = useState(false); | |||
const [shuUpdate, setshuUpdate] = useState(false); | |||
useEffect(() => { | |||
formRef.current?.setFieldsValue(props.values); | |||
if(props.createModalVisible){ | |||
if(props.values.actionType==null){ | |||
formRef.current?.setFieldsValue({ | |||
actionType: 'text', | |||
}); | |||
props.values.actionType="text"; | |||
setValueType("text"); | |||
setLayoutType('Form'); | |||
setoptionitem([]); | |||
}else{ | |||
formRef.current?.setFieldsValue({ | |||
actionType: props.values.actionType, | |||
}); | |||
setValueType(props.values.actionType) | |||
if(props.values.actionType=="select"){ | |||
setLayoutType('ModalForm'); | |||
let ary=[]; | |||
let op=JSON.parse(props.values.actionValue) | |||
for (let t = 0; t < op.length; t++) { | |||
ary.push({actionValueName:op[t].actionValueName}) | |||
} | |||
setoptionitem(ary); | |||
}else{ | |||
setValueType(props.values.actionType); | |||
setLayoutType('Form'); | |||
setoptionitem([]); | |||
} | |||
} | |||
} | |||
}, [props.createModalVisible]); | |||
const handleChange=(value)=>{ | |||
console.log(JSON.stringify(value)) | |||
if(value){ | |||
formRef.current?.setFieldsValue({ | |||
actionValue:JSON.stringify(value) | |||
}) | |||
} | |||
setModalVisit(false); | |||
message.success("保存成功") | |||
} | |||
const options = [ | |||
{value:'text',label: `文本框`}, | |||
{ value: `select`, label: `下拉框`}, | |||
// { value: `money`, label: `金额输入`}, | |||
{ value: `textarea`, label: `文本域`}, | |||
// { value: `date`, label: `日期`}, | |||
// { value: `dateTime`, label: `日期时间`}, | |||
// { value: `radio`, label: `单选框`}, | |||
// { value: `radioButton`, label: `按钮单选框`}, | |||
{ value: `digit`, label: `数字输入框`}, | |||
{ value: `switch`, label: `开关`}, | |||
] | |||
const columns=[ | |||
{ | |||
dataIndex: 'actionValue', | |||
valueType:'dependency', | |||
name: ['valueType'], | |||
columns: ({ actionType }) => { | |||
console.log(valueType) | |||
switch(valueType) | |||
{ | |||
case 'select': | |||
return [ | |||
{ | |||
dataIndex: 'list', | |||
valueType: 'formList', | |||
initialValue:optionitem, | |||
columns: [ | |||
{ | |||
valueType: 'group', | |||
columns: [ | |||
{ | |||
title: '选项名称', | |||
dataIndex: 'actionValueName', | |||
width: 'md', | |||
disabled:true, | |||
formItemProps: { | |||
rules: [ | |||
{ | |||
required: true, | |||
message: '此项为必填项', | |||
}, | |||
], | |||
}, | |||
} | |||
] | |||
} | |||
], | |||
}, | |||
{ | |||
renderFormItem: (schema,config,form) => { | |||
return [ | |||
<div style={{float:'right'}}> | |||
{/* <Button | |||
type="primary" | |||
style={{'margin-left':'5px'}} | |||
onClick={() => { | |||
handleChange(form?.formRef?.current?.getFieldValue("list")); | |||
return true; | |||
}}> | |||
保存 | |||
</Button> */} | |||
</div> | |||
]; | |||
}, | |||
} | |||
]; | |||
case 'text': | |||
return [ | |||
{ | |||
dataIndex: 'actionValue', | |||
valueType: 'text', | |||
renderFormItem: () => <Input placeholder="输入类型值" disabled /> | |||
}, | |||
]; | |||
default: | |||
return [{ | |||
dataIndex: 'actionValue', | |||
valueType: valueType, | |||
fieldProps:{ | |||
disabled:true | |||
} | |||
}]; | |||
} | |||
} | |||
}, | |||
] | |||
// const handleChange=(value)=>{ | |||
// } | |||
// const onNameChange = (event) => { | |||
// settypename(event.target.value); | |||
// }; | |||
// const addItem = async (e) => { | |||
// e.preventDefault(); | |||
// setItems([...items, {label:typename,value:index++} || `New item ${index++}`]); | |||
// settypename(''); | |||
// setTimeout(() => { | |||
// inputRef.current?.focus(); | |||
// }, 0); | |||
// console.log(items) | |||
// } | |||
return ( | |||
<> | |||
<Modal | |||
title={'动作配置'} | |||
width={640} | |||
ref={formRef} | |||
visible={props?.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 1px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props?.onCancel(); | |||
}} | |||
destroyOnClose | |||
maskClosable={false} | |||
> | |||
<Form | |||
layout="vertical" | |||
preserve={false} | |||
// form={form} | |||
initialValues={props?.values} | |||
onFinish={props?.onFinish} | |||
ref={formRef} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Form.Item name="actionName" label="模型名称" rules={[{ required: true, max: 64, whitespace: true }]}> | |||
<Input placeholder="请输入模型名称" disabled /> | |||
</Form.Item> | |||
<Form.Item name="actionType" label="输入类型" rules={[{ required: true, max: 64, whitespace: true }]}> | |||
<ProFormSelect options={options} disabled fieldProps={{ | |||
value: valueType, | |||
onChange: (e) => { | |||
if(e=='select'){ | |||
setLayoutType('ModalForm'); | |||
}else{ | |||
setLayoutType('Form') | |||
} | |||
setValueType(e); | |||
}, | |||
}}/> | |||
</Form.Item> | |||
<Form.Item name="actionValue" label="输入类型控件"> | |||
<BetaSchemaForm | |||
trigger={<a onClick={()=>setModalVisit(true)}>查看选项</a>} | |||
columns={columns} | |||
layoutType={layoutType} | |||
visible={modalVisit} | |||
modalProps={{ | |||
forceRender: true,//切换显示模式后强制渲染其他模式表单 | |||
onCancel:()=>setModalVisit(false) | |||
}} | |||
onVisibleChange={(vis)=>{ | |||
setshuUpdate(vis) | |||
}} | |||
width={420} | |||
shouldUpdate={shuUpdate} | |||
submitter={false} | |||
style={{padding:'40px 10px 1px 10px;' }} | |||
/> | |||
</Form.Item> | |||
{/* <Form.Item name="unit" label="单位"> | |||
<Input placeholder="请输入单位" /> | |||
</Form.Item> | |||
<Form.Item name="isBatch" label="是否绑定物料" valuePropName="checked"> | |||
<Switch checkedChildren="是" unCheckedChildren="否"/> | |||
</Form.Item> */} | |||
<Form.Item name="sort" label="排序"> | |||
<Input placeholder="请输入排序" disabled /> | |||
</Form.Item> | |||
{/* <Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
</Button> | |||
<Button type="primary" htmlType="submit" style={{float:'right'}} > | |||
保存 | |||
</Button> */} | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
</> | |||
) | |||
} | |||
export default CreateAction; |
@@ -0,0 +1,89 @@ | |||
import React, { useState } from 'react'; | |||
import { Modal, Form, Input, Button, Select } from 'antd'; | |||
// import { | |||
// GetDeviceVesion | |||
// } from '../services'; | |||
const CreateForm = (props) => { | |||
const { Option, OptGroup } = Select; | |||
const [DeviceVesionData, setDeviceVesionData] = useState([]); | |||
const handleChange=(value)=>{ | |||
GetDeviceVesion(value).then((res)=>{ | |||
setDeviceVesionData(res.data) | |||
}) | |||
} | |||
return ( | |||
<Modal | |||
title={props?.values?.id ? '编辑' : '新建'} | |||
width={640} | |||
visible={props?.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props?.onCancel(); | |||
}} | |||
destroyOnClose | |||
maskClosable={false} | |||
> | |||
<Form | |||
layout="vertical" | |||
preserve={false} | |||
initialValues={props?.values} | |||
onFinish={props?.onFinish} | |||
> | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="name" label="工艺名称" rules={[{ required: true, max: 64, whitespace: true }]}> | |||
<Input placeholder="请输入工艺名称" /> | |||
</Form.Item> | |||
<Form.Item label={"设备类型"} name="deviceType" rules={[{ required: true,max:50}]} > | |||
<Select onChange={handleChange}> | |||
{props.dicData.map((item, index) => { | |||
return ( | |||
<Select.Option index={index} value={item.code} key={item.code}> | |||
{item.value} | |||
</Select.Option> | |||
); | |||
})} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item label={'设备版本'} name="deviceVersionKey" rules={[{ required: true }]}> | |||
<Select> | |||
{DeviceVesionData.map((item, index) => { | |||
return ( | |||
<Select.Option index={index} value={item.id} key={item.id}> | |||
{item.vesion} | |||
</Select.Option> | |||
); | |||
})} | |||
</Select> | |||
</Form.Item> | |||
<Form.Item | |||
name="status" | |||
label="状态" | |||
defaultValue={props?.values?.status} | |||
rules={[{ required: true, message: '请选择状态' }]} | |||
> | |||
<Select placeholder="请选择状态"> | |||
<Option value="0">正常</Option> | |||
<Option value="1">停用</Option> | |||
</Select> | |||
</Form.Item> | |||
<Form.Item name="foreignKeyRe" label="关联外键" rules={[{ required: false }]}> | |||
<Input placeholder="请输入关联外键" /> | |||
</Form.Item> | |||
<Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
</Button> | |||
<Button type="primary" htmlType="submit" style={{float:'right'}} > | |||
保存 | |||
</Button> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
); | |||
}; | |||
export default CreateForm; |
@@ -0,0 +1,148 @@ | |||
import { DropboxOutlined, PlusOutlined,UploadOutlined } from '@ant-design/icons'; | |||
import { Button, message, Input, Upload, Modal, Popconfirm } from 'antd'; | |||
import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import ProDescriptions from '@ant-design/pro-descriptions'; | |||
// import CreateForm from './CreateForm'; | |||
import ActionForm from './ActionForm'; | |||
//页面 相当于 class | |||
const bomtechnology = (props) => { | |||
/** 新建/更新窗口的弹窗 */ | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
/** 分布更新窗口的弹窗 */ | |||
const [actionFormModalVisible, setactionFormModalVisible] = useState(false); | |||
const [showDetail, setShowDetail] = useState(false); | |||
//绑定 | |||
const actionRef = useRef(); | |||
const [currentRow, setCurrentRow] = useState(); | |||
//选中的行 | |||
const [selectedRowsState, setSelectedRows] = useState([]); | |||
const [DeviceVesionData, setDeviceVesionData] = useState([]); | |||
/** 国际化配置 */ | |||
const [DictData, setDictData] = useState([]); | |||
const columns = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
tip: '规则名称是唯一的 key', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
render: (dom, entity) => { | |||
return ( | |||
<a | |||
onClick={() => { | |||
setCurrentRow(entity); | |||
setShowDetail(true); | |||
}} | |||
> | |||
{dom} | |||
</a> | |||
); | |||
}, | |||
}, | |||
{ | |||
title: '名称', | |||
dataIndex: 'name', | |||
valueType: 'textarea', | |||
ellipsis: true, | |||
search: true, | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'createAt', | |||
valueType: 'date', | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '操作', | |||
dataIndex: 'option', | |||
valueType: 'option', | |||
render: (_, record) => [ | |||
<a | |||
key="config" | |||
onClick={() => { | |||
setactionFormModalVisible(true); | |||
setCurrentRow(record.technologyActionInfo); | |||
actionRef.current?.reloadAndRest?.(); | |||
}} | |||
> | |||
模型配置 | |||
</a>, | |||
// <Popconfirm | |||
// type="primary" | |||
// key="primary" | |||
// title="确认删除吗?" | |||
// okText="是" | |||
// cancelText="否" | |||
// onConfirm={() => { | |||
// handleRemove([record.id]); | |||
// actionRef.current?.reloadAndRest(); | |||
// }} | |||
// onCancel={() => {}} | |||
// > | |||
// <a href="#">删除</a> | |||
// </Popconfirm>, | |||
], | |||
}, | |||
]; | |||
useEffect(() => { | |||
// GetDicList('DeviceClientType').then((r) => { | |||
// var arr = r.data; | |||
// let data = {}; | |||
// if (r.succeeded) { | |||
// var list = []; | |||
// arr.forEach((item) => { | |||
// data[item.code] = { text: item.code }; | |||
// list.push({ | |||
// code: item.code, | |||
// value: item.code, | |||
// }); | |||
// }); | |||
// //setDicDataAny(data); | |||
// setDictData(list); | |||
// } | |||
// }); | |||
}, []) | |||
return ( | |||
<Modal | |||
title={'工艺详情'} | |||
width={1040} | |||
visible={props.createModalVisible} | |||
bodyStyle={{ padding: '32px 40px 48px' }} | |||
footer={null} | |||
onCancel={() => { | |||
props.onCancel(); | |||
}} | |||
maskClosable={false} | |||
destroyOnClose | |||
> | |||
<ProTable | |||
headerTitle="工艺" | |||
actionRef={actionRef} | |||
rowKey="id" | |||
search={{ | |||
labelWidth: 120, | |||
}} | |||
columns={columns} | |||
toolBarRender={false} | |||
dataSource={props.dataSource} | |||
// 每行选择点击事件 | |||
rowSelection={false} | |||
></ProTable> | |||
<ActionForm actionFormModalVisible={actionFormModalVisible} | |||
dataSource={currentRow || {} } | |||
onCancel={() => { | |||
setCurrentRow(undefined); | |||
setactionFormModalVisible(false); | |||
}} | |||
/> | |||
</Modal> | |||
); | |||
}; | |||
export default bomtechnology; |
@@ -4,13 +4,12 @@ import React, { useState, useRef, useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import {GetTechnologyPage,GetProductList,GetDeviceVesionList } from "./services" | |||
import {GetTechnologyPage,GetProductList,GetDeviceVesionList,DeleteTechnology } from "./services" | |||
import { history } from 'umi'; | |||
import { getDataBaseUrl } from '@/global_data'; | |||
import Technologylist from './components/technologylist' | |||
import useFetchData from '@ant-design/pro-descriptions/lib/useFetchData'; | |||
const key = 'message'; | |||
const GoodsTypeManage = () => { | |||
const [createModalVisible, handleModalVisible] = useState(false); | |||
const actionRef = useRef(); | |||
@@ -21,6 +20,10 @@ const GoodsTypeManage = () => { | |||
const [isModalOpen, setIsModalOpen] = useState(false); | |||
const [isAddGoodsTemplate,setIsAddGoodsTemplate]=useState(false); | |||
const [form] = Form.useForm(); | |||
const [ProductVesionId, setProductVesionId] = useState(''); | |||
const [deviceTypeKey, setdeviceTypeKey] = useState(''); | |||
const [version, setversion] = useState(''); | |||
const props = { | |||
beforeUpload: (file) => { | |||
if ( | |||
@@ -29,18 +32,31 @@ const GoodsTypeManage = () => { | |||
) { | |||
message.error(`${file.name} 不是 exelce 文件`); | |||
} | |||
if(ProductVesionId.length==0){ | |||
message.error(`请选择产品`); | |||
Upload.LIST_IGNORE | |||
return Upload.LIST_IGNORE; | |||
} | |||
if(deviceTypeKey.length==0){ | |||
message.error(`请选择版本`); | |||
return Upload.LIST_IGNORE; | |||
} | |||
return file.type == 'application/vnd.ms-excel' || | |||
file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | |||
? true | |||
: Upload.LIST_IGNORE; | |||
}, | |||
name: 'file', | |||
data: { "id": currentRow?.id, "deviceClientType": currentRow?.deviceTypeKey, "version": currentRow?.vesion,"isAddGoodsTemplate":isAddGoodsTemplate}, | |||
action: '/saasbase/api/goods/goodstemplateexport', | |||
data: { "id": ProductVesionId, "deviceClientType": deviceTypeKey, "version": version,"isAddGoodsTemplate":isAddGoodsTemplate}, | |||
action: getDataBaseUrl()+'/api/goods/goodstemplateexport', | |||
headers: { | |||
Authorization: 'Bearer ' + localStorage.getItem('token') | |||
Authorization: 'Bearer ' + localStorage.getItem('token'), | |||
// 'Content-Type':'application/json' | |||
}, | |||
onChange(info) { | |||
console.log(info) | |||
if (info.file.status !== 'uploading') { | |||
console.log(info.file, info.fileList); | |||
} | |||
@@ -74,8 +90,9 @@ const GoodsTypeManage = () => { | |||
}, | |||
{ | |||
title: '时间', | |||
dataIndex: 'createTime', | |||
dataIndex: 'createAt', | |||
valueType: 'textarea', | |||
search:false | |||
}, | |||
// { | |||
// title: '是否存在模板', | |||
@@ -99,16 +116,12 @@ const GoodsTypeManage = () => { | |||
key="config" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
setCurrentRow(record.technologyInfo); | |||
// form.setFielsValue(record) | |||
}} > 详情</a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
// form.setFielsValue(record) | |||
}} > 下载</a>, | |||
href={record.templatePath}> 下载</a>, | |||
<Popconfirm | |||
type="primary" | |||
key="primary11" | |||
@@ -116,8 +129,7 @@ const GoodsTypeManage = () => { | |||
okText="是" | |||
cancelText="否" | |||
onConfirm={() => { | |||
DelDeviceVesion([record.id]).then((r) => { | |||
DeleteTechnology(record.id).then((r) => { | |||
if (r.data) { | |||
message.success('删除成功'); | |||
actionRef.current.reload(); | |||
@@ -150,18 +162,7 @@ const GoodsTypeManage = () => { | |||
// href={record.templatePath} | |||
// > 下载工艺模板</a>, | |||
<a | |||
key="config" | |||
onClick={() => { | |||
history.push({ | |||
pathname: '/device/productmanage', | |||
query: { | |||
isAdd: false, | |||
values: record, | |||
tabStatus: 'basis' | |||
}, | |||
}); | |||
}} > 管理</a>, | |||
], | |||
}, | |||
]; | |||
@@ -184,6 +185,7 @@ const GoodsTypeManage = () => { | |||
}, []) | |||
const handleChange = (value) => { | |||
console.log(`selected ${value}`); | |||
setdeviceTypeKey(value) | |||
GetDeviceVesionList(value).then((r)=>{ | |||
var arr = r.data; | |||
if (r.succeeded) { | |||
@@ -202,6 +204,12 @@ const GoodsTypeManage = () => { | |||
}; | |||
const handleVisChange=(value)=>{ | |||
console.log(`selected ${value}`); | |||
setProductVesionId(value) | |||
var sd=DeviceVesionData.find(x=>x.id==value); | |||
setversion(sd?.label) | |||
} | |||
const onCancel=()=>{ | |||
handleModalVisible(false); | |||
} | |||
return ( | |||
<PageContainer host header={{ | |||
@@ -304,7 +312,7 @@ const GoodsTypeManage = () => { | |||
<Button style={{marginLeft:'55%'}}>导入工艺模版</Button> | |||
</Upload> | |||
</Modal> | |||
<Technologylist createModalVisible={createModalVisible} dataSource={currentRow} onCancel={onCancel}/> | |||
</PageContainer> | |||
); | |||
}; | |||
@@ -15,4 +15,9 @@ export async function GetTechnologyPage(data) { | |||
return request(getDataBaseUrl()+`/api/devicevesion/getdevicevesion?productId=`+data, { | |||
method: 'Get', | |||
}); | |||
} | |||
export async function DeleteTechnology(data) { | |||
return request(getDataBaseUrl()+`/api/technology/delete?id=`+data, { | |||
method: 'Get', | |||
}); | |||
} |