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