zhaoy пре 1 година
родитељ
комит
2f3033e24d
2 измењених фајлова са 31 додато и 14 уклоњено
  1. +1
    -1
      config/proxy.js
  2. +30
    -13
      src/pages/bom/manage/components/BomTechnology.jsx

+ 1
- 1
config/proxy.js Прегледај датотеку

@@ -9,7 +9,7 @@
export default {
dev: {
'/kitchen/': {
target: 'http://localhost:5001/',
target: 'http://localhost:5000/',
changeOrigin: true,
secure: false, //关闭证书验证
pathRewrite: {


+ 30
- 13
src/pages/bom/manage/components/BomTechnology.jsx Прегледај датотеку

@@ -10,12 +10,7 @@ const key = 'message';

const BomTechnology = (props) => {
/** 新建/更新窗口的弹窗 */
const [createModalVisible, handleModalVisible] = useState(false);
const actionRef = useRef();
const [currentRow, setCurrentRow] = useState();
const [datalist, setdatalist] = useState([]);
const [total, setTotal] = useState(0);
// const [check, setcheck] = useState(false);
const [check, setcheck] = useState(false);
const [stockGoods, setstockGoods] = useState([]);
const [technologydata, settechnologydata] = useState([]);
const [gyname, setgyname] = useState();
@@ -27,6 +22,7 @@ const BomTechnology = (props) => {
const [technologyId,settechnologyId]=useState();
const [columns,setcolumns]=useState([]);
const formRef = React.useRef(null);
//let check=false;
useEffect(() => {
/** 获取原料名称*/
async function initStockGoods() {
@@ -170,18 +166,20 @@ const BomTechnology = (props) => {
}else{
datacheckbatcloum.splice(datacheckbatcloum.indexOf(value),1)
}
//check=e.target.checked
setcheck(e.target.checked)
console.log(datacheckbatcloum)
}
//处理动态表单函数(物料动态表单)
const BomForminitialValue =async (value,datalist) => {
var clo=[];
setcolumns([])
setcolumns([]);

//console.log(datalist)
// console.log(value)
var data = value;
let defaltvaluewl='';
for (let index = 0; index < data.length; index++) {
setcheck(false);
defaltvaluewl=datalist?.find(it=>it.TechnologyactionId==data[index].id)?.ActionValue;
//console.log(defaltvaluewl)
// let check=false;
@@ -213,17 +211,31 @@ const BomTechnology = (props) => {
// }
// };
// clo.push(checkboc)
const titles=()=> <Checkbox key={data[index].id} onChange={onChange.bind(this,data[index].id+':'+data[index].batchingName)}>{data[index].batchingName}</Checkbox>
//let check=false;
if(defaltvaluewl){
setcheck(true);
//datacheckbatcloum.push(this,data[index].id+':'+data[index].batchingName)
}
console.log(check)
//const titles=checkbox(data[index].id,data[index].batchingName);//{render(){<Checkbox checked={check} key={data[index].id} onChange={onChange.bind(this,data[index].id+':'+data[index].batchingName)}>{data[index].batchingName}</Checkbox>}}
const element =
{
title: titles,
//key:data[index].batchingId,
title: checkbox(data[index].id,data[index].batchingName),
dataIndex:data[index].id+':'+data[index].batchingName,
valueType:"text",
width: 'md',
initialValue:defaltvaluewl??0
};
clo.push(element)
// const batching = {
// dataIndex: 'hidden',
// valueType: 'text',
// fieldProps:{
// hideInForm:true
// }
// }
// clo.push(batching)
}
// const elementss = [
// {
@@ -239,14 +251,18 @@ const BomTechnology = (props) => {
//console.log(clo)
setcolumns(clo)
};
function checkbox(id,name) {
return <Checkbox checked={check} key={id} onChange={onChange.bind(this,id+':'+name)}>{name}</Checkbox>;
}
//保存数据
const onFinish=async (value)=>{
console.log(technologyId)
console.log(value)
//console.log(datacheckbatcloum)
var data=[];
var parmdata={BomId:props.values.id,ChnologyId:technologyId,ActionJson:'',StepName:value.stepName,isBatch:!isBatch}
var parmwldata=[]
var datas=Object.keys(value);
console.log(datas)
var keys=[];
if(!isBatch){
for (let index = 0; index < datas.length; index++) {
@@ -263,7 +279,7 @@ const BomTechnology = (props) => {
}
for (var i in keys) {
if(keys[i]!="stepName"){
var parm={TechnologyactionId:'',ActionName:'',ActionValue:''}
var parm={TechnologyactionId:'',ActionName:'',ActionValue:'',BatchingId:''}
parm.TechnologyactionId=keys[i].split(':')[0];
parm.ActionValue=value[keys[i]];
parm.ActionName=keys[i].split(':')[1]
@@ -279,6 +295,7 @@ const BomTechnology = (props) => {
}
}
parmdata.ActionJson=JSON.stringify(data)
console.log(parmdata.ActionJson)
if(parmdata.ActionJson.length<=2){
message.error("请选择工艺并配置相关动作步骤");
return false;


Loading…
Откажи
Сачувај