zhaoy 8 月之前
父節點
當前提交
c5eec0a946
共有 6 個檔案被更改,包括 121 行新增94 行删除
  1. +56
    -49
      src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx
  2. +7
    -5
      src/pages/device/deviceVesion/index.jsx
  3. +29
    -5
      src/pages/device/productmanage/components/CreateForm.jsx
  4. +19
    -25
      src/pages/device/productmanage/index.jsx
  5. +9
    -9
      src/pages/device/warehousepostion/components/CreateForm.jsx
  6. +1
    -1
      src/pages/device/warehousepostion/index.jsx

+ 56
- 49
src/pages/database/goods/goodstechnology/components/goodstechnologymaken.jsx 查看文件

@@ -50,7 +50,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 +124,6 @@ const goodstechnologymaken = (props) => {
})
}
const onChangevalue = (e) => {
console.log(checkvalue)
const { name, value } = e.target;
let names = "";
let updatedValues = [...checkvalue];
@@ -169,21 +166,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 +232,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 +249,6 @@ const goodstechnologymaken = (props) => {
}
return { value: x.id, label: x.name }
})
console.log("godata",godata)
setTechnologyattralldata(Technologyacton)
setgoodstechnologydata(godata)
}else{
@@ -274,8 +267,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 +274,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 +332,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 +347,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 +389,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 +429,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")
@@ -557,7 +564,7 @@ const goodstechnologymaken = (props) => {
<Popconfirm
title="确认删除吗?"
description="确认删除吗"
onConfirm={(e) => { onClickDevicedele(e, x.deviceId) }}
onConfirm={(e) => { onClickDevicedele(e, x.deviceId,x.goodsAttributeId) }}
onCancel={cancel}
okText="确定"
cancelText="取消"


+ 7
- 5
src/pages/device/deviceVesion/index.jsx 查看文件

@@ -203,14 +203,16 @@ const handleRemove = async (selectedRows) => {
setCurrentRow(record);
const tempUploadImage = JSON.parse(JSON.stringify([
{
uid: '-1',
name: 'image.png',
status: 'done',
url: '',
},
]));
tempUploadImage[0].url=record.productUrl;
setFileList(tempUploadImage);
if(record.productUrl){
tempUploadImage[0].url=record.productUrl;
setFileList(tempUploadImage);
}else{
setFileList([])
}
// form.setFielsValue(record)
}} > 更新</a>,
<Popconfirm


+ 29
- 5
src/pages/device/productmanage/components/CreateForm.jsx 查看文件

@@ -1,7 +1,8 @@
import React, { useState,useEffect } from 'react';
import { CloseOutlined} from '@ant-design/icons';
import { Modal, Form, Input, Button, Select,Radio,InputNumber, message,Space } from 'antd';
import { CloseOutlined,QuestionCircleOutlined} from '@ant-design/icons';
import { Modal, Form, Input, Button, Select,Radio,InputNumber, message,Space,Tooltip } from 'antd';
import unitoption from '../unit'
import useFetchData from '@ant-design/pro-descriptions/lib/useFetchData';

const CreateForm = (props) => {
const { Option, OptGroup } = Select;
@@ -14,6 +15,7 @@ const CreateForm = (props) => {
const [displaylength,setdisplaylength]=useState('none');
const [displaytxtjson,setdisplaytxtjson]=useState('none');
const [disabledname,setdisabledname]=useState('false');
const [displayleventType,setdisplayleventType]=useState('none');
const [minnumber, setminnumber] = useState(0);
const [maxnumber, setmaxnumber] = useState(1);
const [ReadWrite, setReadWrite] = useState(0);
@@ -106,7 +108,6 @@ const CreateForm = (props) => {
}
},[props?.values])
const onchagetype=(e)=>{
console.log(e)
setarttue(e.target.value)
form.setFieldsValue({
type: e.target.value
@@ -117,12 +118,23 @@ const onchagetype=(e)=>{
setdisplaybool('none')
setdisaenumbled('none')
setdisanumbled('none')
setdisplayleventType("none")
}else if(e.target.value==0){
setdisplay("block")
setdisplayleventType("none")
form.setFieldsValue({
dataType: "digit"
});
setdisanumbled("block")
}else if(e.target.value==2){
setdisplayleventType("block")
setdisplay("none")
setdisanumbled('none')
setdisplaylength('none')
setdisplaybool('none')
form.setFieldsValue({
eventType: 0
});
}
}
const onChangemix=(value)=>{
@@ -187,6 +199,11 @@ const onChangeboolLabel0=(e)=>{
const onChangeboolLabel1=(e)=>{
setboolLabel1(e.target.value)
}
const onChangeeventType=(e)=>{
form.setFieldsValue({
eventType: e.target.value
});
}
return (
<Modal
@@ -212,8 +229,7 @@ const onChangeboolLabel1=(e)=>{
boolLabel: boolLabel0+":"+boolLabel1
});
}
console.log(form.getFieldsValue())
console.log("form.getFieldsValue()",form.getFieldsValue())
props?.onFinish(form.getFieldsValue())
}}
>
@@ -235,6 +251,7 @@ const onChangeboolLabel1=(e)=>{
<Radio.Group name="type" defaultValue={0} value={arttue} onChange={onchagetype} disabled={disabled}>
<Radio.Button value={0}>属性</Radio.Button>
<Radio.Button value={1}>服务</Radio.Button>
<Radio.Button value={2}>事件</Radio.Button>
</Radio.Group>
</Form.Item>
@@ -303,6 +320,13 @@ const onChangeboolLabel1=(e)=>{
<Input placeholder="10240" defaultValue="10240" addonAfter="字节" />
</Form.Item>
<Form.Item style={{display:displayleventType}} name="eventType" label={<span>事件类型<Tooltip placement="top" title="“信息”是设备上报的一般性通知,如完成某项任务等。“告警”和“故障”是设备运行过程中主动上报的突发或异常情况,优先级高。不同的事件类型将用于统计分析。"><QuestionCircleOutlined /></Tooltip></span>} rules={[{ required: false }]}>
<Radio.Group defaultValue={0} onChange={onChangeeventType} value={0}>
<Radio value={0}>信息</Radio>
<Radio value={1}>告警</Radio>
<Radio value={2}>故障</Radio>
</Radio.Group>
</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'}]"


+ 19
- 25
src/pages/device/productmanage/index.jsx 查看文件

@@ -118,7 +118,7 @@ const bomtechnology = (props) => {
}, [tabStatus])
const Btn = (record) => {
var arr = [];
if (record.type == 1) {
if (record.type == 1 || record.type == 2) {
arr.push(<a
key="config"
onClick={() => {
@@ -136,7 +136,6 @@ const bomtechnology = (props) => {
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
更新
@@ -152,7 +151,7 @@ const bomtechnology = (props) => {
cancelText="否"
onConfirm={() => {
handleRemove([record.id]);
actionRef.current?.reloadAndRest();
}}
onCancel={() => {}}
>
@@ -201,8 +200,12 @@ const bomtechnology = (props) => {
1: {
text: '服务',
},
2: {
text: '事件',
},
},
},
// {
// title: '版本',
// dataIndex: 'vesion',
@@ -415,7 +418,7 @@ const handleAdd = async (fields) => {
await addgoodstechnology(JSON.stringify(fields)).then((r) => {
if (r.data) {
message.success('添加成功');
var params={productId:props.location.query.values.productId,deviceTypeKey:props.location.query.values.productId,current:1,pageSize:10}
var params={productId:props.location.query.values.productId,productVesionId:props.location.query.values.productId,current:1,pageSize:10}
LoadfunData(params)
handleModalVisible(false);
if (actionRef.current) {
@@ -440,8 +443,10 @@ const handleRemove = async (ids) => {
deletegoodstechnology(ids).then((r) => {
if (r.data) {
message.success('删除成功');
var params={productId:props.location.query.values.productId,deviceTypeKey:props.location.query.values.productId,current:1,pageSize:10}
LoadfunData(params)
// var params={productId:props.location.query.values.productId,productVesionId:props.location.query.values.productId,current:1,pageSize:10}
// LoadfunData(params)
actionRef.current.reload();
} else {
message.error(r.errors);
}
@@ -463,15 +468,18 @@ const handleRemove = async (ids) => {
}
}
if(check){
console.log("actionRef.current",actionRef.current.current)
updategoodstechnology(fields).then((r) => {
if (r.data) {
message.success('修改成功');
var params={productId:props.location.query.values.productId,deviceTypeKey:props.location.query.values.productId,current:1,pageSize:10}
LoadfunData(params)
handleModalVisible(false);
if (actionRef.current) {
actionRef.current.reload();
}
actionRef.current.reload();
// var params={productId:props.location.query.values.productId,productVesionId:props.location.query.values.productId,current:actionRef.current.current,pageSize:10}
// LoadfunData(params)
// handleModalVisible(false);
// if (actionRef.current) {
// actionRef.current.reloadAndRest();
// }
} else {
message.error(r.errors);
}
@@ -639,20 +647,6 @@ const handleRemove = async (ids) => {
>
<PlusOutlined /> 新建
</Button>,
// <Button
// key="primary"
// onClick={async () => {
// const link = document.createElement('a');
// link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/gzaxn@163.com/goods/133458884696092845.xlsx";
// link.click();
// }}
// >
// <UploadOutlined /> 下载设备版本工艺模板
// </Button>,
// <Upload {...props}>
// <Button icon={<UploadOutlined />}>导入工艺模版</Button>
// </Upload>
]}
dataSource={datafunctionSource}
//数据绑定


+ 9
- 9
src/pages/device/warehousepostion/components/CreateForm.jsx 查看文件

@@ -62,14 +62,14 @@ const CreateForm = (props) => {
// valueType:'digit',
// width: '15%',
// },
{
title: '操作',
valueType: 'option',
width: '15%',
render: () => {
return null;
},
},
// {
// title: '操作',
// valueType: 'option',
// width: '15%',
// render: () => {
// return null;
// },
// },
]
const handleChange=(value)=>{
var device=props.devicedata.find(x=>x.id==value);
@@ -162,7 +162,7 @@ const CreateForm = (props) => {
type: 'multiple',
editableKeys,
actionRender: (row, config, defaultDoms) => {
return [defaultDoms.delete,defaultDoms.Button];
return [];
},
onValuesChange: (record, recordList) => {
setDataSource(recordList);


+ 1
- 1
src/pages/device/warehousepostion/index.jsx 查看文件

@@ -79,7 +79,7 @@ const GoodsTypeManage = () => {
WarehousetemplateDel([record.id]).then((r) => {
message.success('删除成功,即将刷新');
actionRef.current.reload();
actionRef.current.reloadAndRest();
});
}}
onCancel={() => { }}


Loading…
取消
儲存