@@ -175,14 +175,14 @@ const goodstechnologymaken = (props) => { | |||||
item.data.forEach(item => { | item.data.forEach(item => { | ||||
const obj = {}; | const obj = {}; | ||||
let propsdatanew = []; | let propsdatanew = []; | ||||
let propsdata = Technologyacton.filter(x => x.technologyId == item.chnologyId) | |||||
let propsdata = Technologyacton?.filter(x => x.technologyId == item.chnologyId) | |||||
obj.stepName = item.stepName; | obj.stepName = item.stepName; | ||||
obj.id = item.id; | obj.id = item.id; | ||||
obj.chnologyId = item.chnologyId; | obj.chnologyId = item.chnologyId; | ||||
obj.sort = item.sort; | obj.sort = item.sort; | ||||
obj.actionJson = item.actionJson | obj.actionJson = item.actionJson | ||||
obj.optiondata = JSON.parse(item.actionJson) | obj.optiondata = JSON.parse(item.actionJson) | ||||
propsdata.forEach(x => { | |||||
propsdata?.forEach(x => { | |||||
let sd = { | let sd = { | ||||
id: x.id, | id: x.id, | ||||
actionName: x.actionName, | actionName: x.actionName, | ||||
@@ -205,10 +205,11 @@ const goodstechnologymaken = (props) => { | |||||
} | } | ||||
const GetGoodsTechnologyvalue=(value,va,item)=>{ | const GetGoodsTechnologyvalue=(value,va,item)=>{ | ||||
let godata=[] | let godata=[] | ||||
console.log("va",va) | |||||
GetGoodsTechnology(value).then((r)=>{ | GetGoodsTechnology(value).then((r)=>{ | ||||
if (r.data.length > 0) { | if (r.data.length > 0) { | ||||
var Technologyacton=[]; | var Technologyacton=[]; | ||||
godata = r.data.map(x => { | |||||
godata = r.data?.map(x => { | |||||
if(x.technologyActionInfo.length>0){ | if(x.technologyActionInfo.length>0){ | ||||
x.technologyActionInfo.forEach(p=>{ | x.technologyActionInfo.forEach(p=>{ | ||||
@@ -217,8 +218,12 @@ const goodstechnologymaken = (props) => { | |||||
} | } | ||||
return { value: x.id, label: x.name } | return { value: x.id, label: x.name } | ||||
}) | }) | ||||
console.log("godata",godata) | |||||
setTechnologyattralldata(Technologyacton) | setTechnologyattralldata(Technologyacton) | ||||
setgoodstechnologydata(godata) | setgoodstechnologydata(godata) | ||||
}else{ | |||||
setTechnologyattralldata([]) | |||||
setgoodstechnologydata([]) | |||||
} | } | ||||
//setfromdata([]) | //setfromdata([]) | ||||
if(va=="edit"){ | if(va=="edit"){ | ||||
@@ -431,6 +436,7 @@ const goodstechnologymaken = (props) => { | |||||
<div style={{ fontSize: 16, marginBottom: 5, color: '#1890ff', fontWeight: 600 }}>选择设备: | <div style={{ fontSize: 16, marginBottom: 5, color: '#1890ff', fontWeight: 600 }}>选择设备: | ||||
<Select | <Select | ||||
showSearch | showSearch | ||||
allowClear | |||||
style={{ | style={{ | ||||
width: 200, | width: 200, | ||||
marginRight: 10 | marginRight: 10 | ||||
@@ -5,77 +5,13 @@ import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||||
import ProTable from '@ant-design/pro-table'; | import ProTable from '@ant-design/pro-table'; | ||||
import ProDescriptions from '@ant-design/pro-descriptions'; | import ProDescriptions from '@ant-design/pro-descriptions'; | ||||
import { history } from 'umi'; | import { history } from 'umi'; | ||||
import { getDataBaseUrl } from '@/global_data'; | |||||
import { | import { | ||||
goods, | goods, | ||||
addGoods, | |||||
updateGoods, | |||||
removeGoods, | removeGoods, | ||||
gettree, | gettree, | ||||
getBomInfo, | |||||
AddBomApi, | |||||
getbompage, | |||||
upload, | |||||
GoodsTemplateExport | |||||
} from './service'; | } from './service'; | ||||
/** | |||||
* 添加节点 | |||||
* | |||||
* @param fields | |||||
*/ | |||||
const handleAdd = async (fields) => { | |||||
console.log('fields', fields); | |||||
const hide = message.loading('正在添加'); | |||||
fields.createBy = 'admin'; | |||||
try { | |||||
await addGoods(JSON.stringify(fields)).then((r) => { | |||||
if (r.data) { | |||||
message.success('添加成功'); | |||||
} else { | |||||
message.error('添加失败请重试!'); | |||||
} | |||||
}); | |||||
hide(); | |||||
return true; | |||||
} catch (error) { | |||||
hide(); | |||||
message.error('添加失败请重试!'); | |||||
return false; | |||||
} | |||||
}; | |||||
/** | |||||
* 更新节点 | |||||
* | |||||
* @param fields | |||||
*/ | |||||
const handleUpdate = async (fields) => { | |||||
const hide = message.loading('正在配置'); | |||||
try { | |||||
await updateGoods({ | |||||
id: fields.id, | |||||
code: fields.code, | |||||
name: fields.name, | |||||
price: fields.price, | |||||
imgUrl: fields.imgUrl, | |||||
remark: fields.remark, | |||||
status: fields.status, | |||||
goodsTypeId: fields.goodsTypeId, | |||||
}).then((r) => { | |||||
if (r.data) { | |||||
message.success('配置成功'); | |||||
} else { | |||||
message.error('配置失败请重试!'); | |||||
} | |||||
}); | |||||
return true; | |||||
} catch (error) { | |||||
hide(); | |||||
return false; | |||||
} | |||||
}; | |||||
/** | /** | ||||
* 删除节点 | * 删除节点 | ||||
* | * | ||||
@@ -302,7 +238,7 @@ const GoodsManage = () => { | |||||
: Upload.LIST_IGNORE; | : Upload.LIST_IGNORE; | ||||
}, | }, | ||||
name: 'file', | name: 'file', | ||||
action: '/saasbase/api/goodes/ExportGood', | |||||
action: getDataBaseUrl()+'/api/goods/exportgood', | |||||
headers: { | headers: { | ||||
// authorization: 'authorization-text', | // authorization: 'authorization-text', | ||||
Authorization: 'Bearer ' + localStorage.getItem('token') | Authorization: 'Bearer ' + localStorage.getItem('token') | ||||
@@ -21,6 +21,7 @@ const ActionForm = (props) => { | |||||
const [createModalVisible, handleModalVisible] = useState(false); | const [createModalVisible, handleModalVisible] = useState(false); | ||||
const options = { | const options = { | ||||
text:{value:'text',text: `text(字符串)`}, | text:{value:'text',text: `text(字符串)`}, | ||||
textareaary:{value:'textareaary',text: `textarea(字符串数组)`}, | |||||
select:{ value: `select`, text: `enum(枚举)`}, | select:{ value: `select`, text: `enum(枚举)`}, | ||||
// money:{ value: `money`, text: `金额输入`}, | // money:{ value: `money`, text: `金额输入`}, | ||||
textarea:{ value: `textarea`, text: `text(文本域)`}, | textarea:{ value: `textarea`, text: `text(文本域)`}, | ||||
@@ -55,6 +55,7 @@ const handleChange=(value)=>{ | |||||
} | } | ||||
const options = [ | const options = [ | ||||
{value:'text',label: `text(字符串)`}, | {value:'text',label: `text(字符串)`}, | ||||
{value:'textareaary',label: `textarea(字符串数组)`}, | |||||
{ value: `select`, label: `enum(枚举)`}, | { value: `select`, label: `enum(枚举)`}, | ||||
// { value: `money`, label: `金额输入`}, | // { value: `money`, label: `金额输入`}, | ||||
{ value: `textarea`, label: `text(文本域)`}, | { value: `textarea`, label: `text(文本域)`}, | ||||
@@ -12,6 +12,7 @@ const CreateForm = (props) => { | |||||
const [disaenumbled, setdisaenumbled] = useState('none'); | const [disaenumbled, setdisaenumbled] = useState('none'); | ||||
const [displaybool,setdisplaybool]=useState('none'); | const [displaybool,setdisplaybool]=useState('none'); | ||||
const [displaylength,setdisplaylength]=useState('none'); | const [displaylength,setdisplaylength]=useState('none'); | ||||
const [displaytxtjson,setdisplaytxtjson]=useState('none'); | |||||
const [minnumber, setminnumber] = useState(0); | const [minnumber, setminnumber] = useState(0); | ||||
const [maxnumber, setmaxnumber] = useState(1); | const [maxnumber, setmaxnumber] = useState(1); | ||||
const [ReadWrite, setReadWrite] = useState(0); | const [ReadWrite, setReadWrite] = useState(0); | ||||
@@ -22,6 +23,7 @@ const CreateForm = (props) => { | |||||
const options = [ | const options = [ | ||||
{ value: `digit`, label: `int32(整型)`}, | { value: `digit`, label: `int32(整型)`}, | ||||
{value:'text',label: `text(字符串)`}, | {value:'text',label: `text(字符串)`}, | ||||
{value:'textareaary',label: `textarea(字符串数组)`}, | |||||
{ value: `select`, label: `enum(枚举)`}, | { value: `select`, label: `enum(枚举)`}, | ||||
// { value: `money`, label: `金额输入`}, | // { value: `money`, label: `金额输入`}, | ||||
{ value: `textarea`, label: `text(文本域)`}, | { value: `textarea`, label: `text(文本域)`}, | ||||
@@ -61,7 +63,8 @@ const CreateForm = (props) => { | |||||
description:props?.values?.description, | description:props?.values?.description, | ||||
readWrite:props?.values?.readWrite, | readWrite:props?.values?.readWrite, | ||||
dataLength:props?.values?.dataLength, | dataLength:props?.values?.dataLength, | ||||
boolLabel:props?.values?.BoolLabel, | |||||
boolLabel:props?.values?.boolLabel, | |||||
dataJson:props?.values?.dataJson | |||||
}); | }); | ||||
if(props?.values?.boolLabel){ | if(props?.values?.boolLabel){ | ||||
var boolLabel=props?.values?.boolLabel.split(':') | var boolLabel=props?.values?.boolLabel.split(':') | ||||
@@ -141,21 +144,32 @@ const onChangedataType=(value)=>{ | |||||
setdisanumbled('none') | setdisanumbled('none') | ||||
setdisplaybool('none') | setdisplaybool('none') | ||||
setdisplaylength('none') | setdisplaylength('none') | ||||
setdisplaytxtjson('none') | |||||
}else if(value=="switch"){ | }else if(value=="switch"){ | ||||
setdisplaybool('block') | setdisplaybool('block') | ||||
setdisaenumbled('none') | setdisaenumbled('none') | ||||
setdisanumbled('none') | setdisanumbled('none') | ||||
setdisplaylength('none') | setdisplaylength('none') | ||||
setdisplaytxtjson('none') | |||||
}else if(value=="text"){ | }else if(value=="text"){ | ||||
setdisplaybool('none') | setdisplaybool('none') | ||||
setdisaenumbled('none') | setdisaenumbled('none') | ||||
setdisanumbled('none') | setdisanumbled('none') | ||||
setdisplaylength('block') | setdisplaylength('block') | ||||
}else{ | |||||
setdisplaytxtjson('none') | |||||
}else if(value=="textareaary"){ | |||||
setdisplaybool('none') | |||||
setdisaenumbled('none') | |||||
setdisanumbled('none') | |||||
setdisplaylength('none') | |||||
setdisplaytxtjson('block') | |||||
} | |||||
else{ | |||||
setdisplaylength('none') | setdisplaylength('none') | ||||
setdisplaybool('none') | setdisplaybool('none') | ||||
setdisaenumbled('none') | setdisaenumbled('none') | ||||
setdisanumbled('none') | setdisanumbled('none') | ||||
setdisplaytxtjson('none') | |||||
} | } | ||||
} | } | ||||
const onChangewrite=(e)=>{ | const onChangewrite=(e)=>{ | ||||
@@ -283,6 +297,11 @@ const onChangeboolLabel1=(e)=>{ | |||||
<Input placeholder="10240" defaultValue="10240" addonAfter="字节" /> | <Input placeholder="10240" defaultValue="10240" addonAfter="字节" /> | ||||
</Form.Item> | </Form.Item> | ||||
<Form.Item style={{display:displaytxtjson}} name="dataJson" label="数组字符串" rules={[{ required: false }]}> | |||||
<TextArea | |||||
placeholder="数据格式:[data1:{value1:'1'},value2:'2'},data2:{value1:'1'},value2:'2'}]" | |||||
autoSize={{minRows: 10,maxRows: 100}}/> | |||||
</Form.Item> | |||||
<Form.Item style={{display:display}} name="readWrite" label="读写类型" rules={[{ required: false }]}> | <Form.Item style={{display:display}} name="readWrite" label="读写类型" rules={[{ required: false }]}> | ||||
<Radio.Group onChange={onChangewrite} name="radiogroup" defaultValue={0} value={ReadWrite}> | <Radio.Group onChange={onChangewrite} name="radiogroup" defaultValue={0} value={ReadWrite}> | ||||
<Radio value={0}>读写</Radio> | <Radio value={0}>读写</Radio> | ||||
@@ -400,6 +400,10 @@ const handleAdd = async (fields) => { | |||||
fields.dataType=""; | fields.dataType=""; | ||||
} | } | ||||
if(check){ | if(check){ | ||||
if(fields.dataJson!=undefined){ | |||||
fields.dataJson=JSON.parse(fields.dataJson) | |||||
} | |||||
await addgoodstechnology(JSON.stringify(fields)).then((r) => { | await addgoodstechnology(JSON.stringify(fields)).then((r) => { | ||||
if (r.data) { | if (r.data) { | ||||
message.success('添加成功'); | message.success('添加成功'); | ||||
@@ -33,12 +33,12 @@ const GoodsTypeManage = () => { | |||||
message.error(`${file.name} 不是 exelce 文件`); | message.error(`${file.name} 不是 exelce 文件`); | ||||
} | } | ||||
if(ProductVesionId.length==0){ | if(ProductVesionId.length==0){ | ||||
message.error(`请选择产品`); | |||||
message.error(`请选择版本`); | |||||
Upload.LIST_IGNORE | Upload.LIST_IGNORE | ||||
return Upload.LIST_IGNORE; | return Upload.LIST_IGNORE; | ||||
} | } | ||||
if(deviceTypeKey.length==0){ | if(deviceTypeKey.length==0){ | ||||
message.error(`请选择版本`); | |||||
message.error(`请选择产品`); | |||||
return Upload.LIST_IGNORE; | return Upload.LIST_IGNORE; | ||||
} | } | ||||
@@ -209,6 +209,10 @@ const GoodsTypeManage = () => { | |||||
setversion(sd?.label) | setversion(sd?.label) | ||||
} | } | ||||
const onCancel=()=>{ | const onCancel=()=>{ | ||||
console.log("ss") | |||||
setdeviceTypeKey(""); | |||||
setProductVesionId(''); | |||||
setDeviceVesionData([]) | |||||
handleModalVisible(false); | handleModalVisible(false); | ||||
} | } | ||||
return ( | return ( | ||||