diff --git a/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx b/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx
index 4448e59..9210ea0 100644
--- a/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx
+++ b/src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx
@@ -3,6 +3,7 @@ import React, { useState, useRef, useEffect } from 'react';
import { CloseOutlined, DeleteOutlined, FormOutlined } from '@ant-design/icons';
import { ProCard } from '@ant-design/pro-Card';
import { BetaSchemaForm } from '@ant-design/pro-form';
+import { history } from 'umi';
import {
getbyidgoods,
GetGoodsTechnology,
@@ -50,7 +51,6 @@ const goodstechnologymaken = (props) => {
interdata()
}, [])
const interdata = () => {
- console.log("props.goodsid",props.goodsid)
if(props.goodsid!=undefined){
getbyidgoods(props.goodsid).then((res) => {
if (res.succeeded) {
@@ -125,8 +125,6 @@ const goodstechnologymaken = (props) => {
})
}
const onChangevalue = (e) => {
- console.log(checkvalue)
-
const { name, value } = e.target;
let names = "";
let updatedValues = [...checkvalue];
@@ -169,21 +167,27 @@ const goodstechnologymaken = (props) => {
setdefaultValue(item.deviceId)
setddevideId(item.deviceId)
GetGoodsTechnologyvalue(item.deviceId,"edit",item)
+ var atrid=[]
var gg=goodsinfo.goodsAttributeList.map(x => {
+
x.goodsAttributeValueList.forEach(t=>{
var da=item.goodsAttributeId.split(',')
var df=da.find(g=>g==t.goodsAttributeValuId)
if(df){
t.check=true;
x.defalutvalue=t.goodsAttributeValuId
+ atrid.push(t.goodsAttributeValuId)
+
}
-
})
+
return x
})
const nextItems = {...goodsinfo,goodsAttributeList:gg};
var goodsinfos=nextItems
- console.log("goods",goodsinfos)
+ setCheckvalue(atrid)
+ console.log("checkvalue",atrid)
+ setCheckvalue(atrid)
setGoodsinfo(goodsinfos)
//console.log("attr", attr)
@@ -229,20 +233,11 @@ const goodstechnologymaken = (props) => {
}
const GetGoodsTechnologyvalue=(value,va,item)=>{
let godata=[]
- console.log("va",va)
- console.log("value",value)
- console.log("item",item)
- console.log("goodsinfo.goodsAttributeList",goodsinfo.goodsAttributeList)
-
if(item){
GetwarehousetemplateData(item.deviceId)
setWarehousrTemplateId(item.warehousrTemplateId)
setdefaulttemplateValue(item.warehousrTemplateId)
-
-
}
-
-
GetGoodsTechnology(value).then((r)=>{
if (r.data.length > 0) {
var Technologyacton=[];
@@ -255,7 +250,6 @@ const goodstechnologymaken = (props) => {
}
return { value: x.id, label: x.name }
})
- console.log("godata",godata)
setTechnologyattralldata(Technologyacton)
setgoodstechnologydata(godata)
}else{
@@ -274,8 +268,6 @@ const goodstechnologymaken = (props) => {
DeleteGoodsTechnologyAction(item.id).then((res) => {
if (res.data) {
message.success("删除成功")
- console.log(fromdata)
- //formRef?.current?.resetFields(...props.technologyattrdata)
updadata()
} else {
message.error("删除失败")
@@ -283,12 +275,37 @@ const goodstechnologymaken = (props) => {
})
}
//删除设备工艺
- const onClickDevicedele = (e, devideId, action) => {
- deletebydevidegoodstechnologyaction({ devideId: devideId, goodsId: props.goodsid }).then((res) => {
+ const onClickDevicedele = (e, devideId,goodsAttributeId, action) => {
+ if(goodstechnologydata.length>0){
+ setgoodstechnologydata([])
+ }
+ if(fromdata.length>0){
+ setfromdata([])
+ }
+ if(defaultValue==devideId){
+ setdefaultValue('')
+ setcwdis("none")
+ setdefaulttemplateValue()
+ }
+ if(checkvalue.find(x=>goodsAttributeId.includes(x))){
+ var gg=goodsinfo.goodsAttributeList.map(x => {
+ x.goodsAttributeValueList.forEach(t=>{
+ t.check=false;
+ x.defalutvalue=""
+ setCheckvalue([])
+ })
+ return x
+ })
+ const nextItems = {...goodsinfo,goodsAttributeList:gg};
+ var goodsinfos=nextItems
+ setGoodsinfo(goodsinfos)
+ setCheckvalue([])
+ }
+ //console.log(goodstechnologydata)
+ deletebydevidegoodstechnologyaction({ devideId: devideId, goodsId: props.goodsid,goodsAttributeId:goodsAttributeId }).then((res) => {
if (res.data) {
message.success("删除成功")
setgoodstechnolog([])
- //formRef?.current?.resetFields(...props.technologyattrdata)
updadata()
} else {
message.error("删除失败")
@@ -316,14 +333,10 @@ const goodstechnologymaken = (props) => {
const GetwarehousetemplateData=(deviceId)=>{
setcwdis('block')
GetwarehousetemplateList(deviceId).then((r)=>{
- // var data= r.data.map(x=>{
- // return {id:x.id,label:x.templateName}
- // })
setwarehousetemplatedata(r.data)
})
}
const handleChange = (value) => {
- console.log("进来了", value)
setdefaulttemplateValue("")
if(value){
setdefaultValue(value)
@@ -335,30 +348,14 @@ const goodstechnologymaken = (props) => {
setdefaultValue("")
setddevideId('')
}
-
- // 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)
}
const onUpdataStatus = (val) => {
setUpdataStatus(val)
}
const onSaveClick = (val) => {
- console.log("222",val)
setfromdata(val)
}
const onSubmitSaveClick = () => {
- console.log("保存的数据", fromdata)
let check = true;
var data = []
var msg="没有要保存的数据或数据格式不正确";
@@ -393,22 +390,22 @@ const goodstechnologymaken = (props) => {
}
})
-
-
- // var vacheck=x.optiondata.find(x=>x.actionValue=='')
-
item.goodsId = props.goodsid
item.warehousrTemplateId=WarehousrTemplateId;
item.goodsAttributeId = checkvalue.join(',')
if (x.chnologyId == "") {
check = false;
}
+ if(item.warehousrTemplateId==undefined || item.warehousrTemplateId==""){
+ check = false;
+ msg="请选择仓位模板"
+ }
+ if(item.goodsAttributeId==undefined || item.goodsAttributeId==""){
+ check = false;
+ msg="请选择商品属性"
+ }
data.push(item)
})
- if(WarehousrTemplateId==""){
- check = false;
- msg="请选择仓位模板"
- }
if (data.length > 0 && check) {
if (UpdataStatus == "add") {
AddGoodsTechnologyAction(data).then((res) => {
@@ -433,6 +430,17 @@ const goodstechnologymaken = (props) => {
})
}
+ var gg=goodsinfo.goodsAttributeList.map(x => {
+ x.goodsAttributeValueList.forEach(t=>{
+ t.check=false;
+ x.defalutvalue=""
+ })
+ return x
+ })
+ const nextItems = {...goodsinfo,goodsAttributeList:gg};
+ var goodsinfos=nextItems
+ setGoodsinfo(goodsinfos)
+ setCheckvalue([])
setUpdataStatus("view")
setdisabled(false)
setopreaction("add")
@@ -466,10 +474,23 @@ const goodstechnologymaken = (props) => {
-
+
商品属性
{
- goodsinfo.goodsAttributeList == undefined ? '' : (
+ goodsinfo.goodsAttributeList == undefined || goodsinfo.goodsAttributeList == "" ? ( ) : (
goodsinfo.goodsAttributeList.map((item, index) => {
return (
@@ -557,7 +578,7 @@ const goodstechnologymaken = (props) => {
{ onClickDevicedele(e, x.deviceId) }}
+ onConfirm={(e) => { onClickDevicedele(e, x.deviceId,x.goodsAttributeId) }}
onCancel={cancel}
okText="确定"
cancelText="取消"
diff --git a/src/pages/database/goods/newgoods/index.jsx b/src/pages/database/goods/newgoods/index.jsx
index ff7004e..62a1c48 100644
--- a/src/pages/database/goods/newgoods/index.jsx
+++ b/src/pages/database/goods/newgoods/index.jsx
@@ -164,7 +164,7 @@ const GoodsManage = () => {
// setCurrentRow(record);
}}
>
- 商品配方设置
+ 配方配置
,
{
// setCurrentRow(record);
}}
>
- 商品工艺设置
+ 工艺配置
,
-
+ {
+ history.push({
+ pathname: '/database/goods/goodsattributeprice',
+ query: {
+ isAdd: false,
+ values: record,
+ },
+ });
+ // handleModalVisible(true);
+ // setCurrentRow(record);
+ }}
+ >
+ 价格配置
+ ,
{
const [value, setValue] = useState(0);
const [deviceTypename,setdeviceTypename]=useState("");
const [options,setoptions]=useState([]);
+ const [stopoptions,setstopoptions]=useState([]);
const inputRef = useRef(null);
useEffect(() => {
console.log(props.values)
@@ -22,6 +23,10 @@ const CreateForm = (props) => {
return {value:item.id,label:item.label}
})
setoptions(optdata);
+ var stopData=props.StopData?.map((item, index) => {
+ return {value:item.id,label:item.name}
+ })
+ setstopoptions(stopData)
},[props])
const handleChange=(value)=>{
GetDeviceVesion(value).then((res)=>{
@@ -75,13 +80,20 @@ const CreateForm = (props) => {
-
+
+
+
@@ -303,6 +320,13 @@ const onChangeboolLabel1=(e)=>{
+ 事件类型} rules={[{ required: false }]}>
+
+ 信息
+ 告警
+ 故障
+
+