

function copy(input) {
    return JSON.parse(JSON.stringify(input));
}


export const undo = () => {
    let newData = Service.undo();
    return newData;
};

export const undo_djcs = () => {
    let newData = Service.undo_djcs();
    return newData;
};



export const redo = () => {
    let newData = Service.redo();
    return newData;
};

export const redo_djcs = () => {
    let newData = Service.redo_djcs();
    return newData;
};

export const shanchu = ( selectedRow) => {
   
    
    
    let newData = Service.shanchu(selectedRow);
    
    return newData;
  };

  export const shanchu_djcs = ( selectedRow) => {
   
    
    
    let newData = Service.shanchu_djcs(selectedRow);
    
    return newData;
  };


////////////////////////////////QINGDAN//////////////////////////////




export const danxiangdinge = (selectedRow) => {
    return Service.danxiangdinge(selectedRow);
};


export const updateDercj = (row, data) => {
    return Service.updateDercj(row, data);

};


export const huan = (replaceState, row) => {
   
    return Service.huan(replaceState['old'],replaceState['newBianhao'],replaceState['newName'], replaceState['newJia'], replaceState['zhuanye'],row);

};

export const updateShuliang = (data, row) => {
    return Service.updateShuliang(data, row);

};

export const updateDeMingcheng = (data, row) => {
    return Service.updateDeMingcheng(data, row);

};



export const changguidinge = (dingeclick, selectedRow) => {
    return Service.changguidinge(dingeclick, selectedRow);

};


export const handleYuban = (derow, select ) => {
    return Service.handleYuban(derow, select);

};

export const handleRcjbc = (derow, rcjbc ) => {
    return Service.handleRcjbc(derow, rcjbc);

};

export const handleBeizhu = (beizhuFK/**辅库json */, derow, fuzhuSelect/*被选中的序号*/, fuzhu/*页面展示的附注文本*/  ) => {
    console.log(beizhuFK);
    let bianma = [];
    let xuhao = [];
    let fuzhuSelect_ = Array.from(fuzhuSelect);
    let keys = beizhuFK['BZBH'];
    for(let j = 0; j < fuzhuSelect_.length; j++) {
        let entry = fuzhuSelect_[j];
        for(let i = 0; i < fuzhu.length; i++) {
            if (fuzhu[i]['key'] == entry) {
                bianma.push(fuzhu[i]['编号'].toString().concat('*').concat(fuzhu[i]['数量'].toString()));
                xuhao.push(fuzhu[i]['序号'].toString().concat("*").concat(fuzhu[i]['数量'].toString()));
            }
        }
    }
    let result = [];
    for(let i = 0; i < bianma.length; i++) {
        let bh_ = bianma[i];
        let bh = bh_.split("*")[0];
        for(let j = 0; j < Object.keys(keys).length; j++) {
            let BZBH_ = Object.keys(keys)[j];
            let BZBH = keys[BZBH_];
            if (BZBH == bh) {
                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['XBH'][BZBH_], Number(bh_.split('*')[1])]);
            }
        }
    }
    console.log(result);
    //return Service.updateBeizhu(derow, result, xuhao);
    return result
};

export const handleAI = (result ) => {
    return Service.handleAI(result);

};
export const handleAI_djcs = (result ) => {
    return Service.handleAI_djcs(result);

};
///////////////////////////////////////////DJCS///////////////////////////////////////////
export const handleYuban_djcs = (derow, select ) => {
    return Service.handleYuban_djcs(derow, select);

};
export const handleBeizhu_djcs = (beizhuFK, derow, fuzhuSelect, fuzhu ) => {
    console.log(beizhuFK);
    let bianma = [];
    let xuhao = [];
    let fuzhuSelect_ = Array.from(fuzhuSelect);
    let keys = beizhuFK['BZBH'];
    for(let j = 0; j < fuzhuSelect_.length; j++) {
        let entry = fuzhuSelect_[j];
        for(let i = 0; i < fuzhu.length; i++) {
            if (fuzhu[i]['key'] == entry) {
                bianma.push(fuzhu[i]['编号'].toString().concat('*').concat(fuzhu[i]['数量'].toString()));
                xuhao.push(fuzhu[i]['序号'].toString().concat("*").concat(fuzhu[i]['数量'].toString()));
            }
        }
    }
    let result = [];
    for(let i = 0; i < bianma.length; i++) {
        let bh_ = bianma[i];
        let bh = bh_.split("*")[0];
        for(let j = 0; j < Object.keys(keys).length; j++) {
            let BZBH_ = Object.keys(keys)[j];
            let BZBH = keys[BZBH_];
            if (BZBH == bh) {
                result.push([beizhuFK['BH'][BZBH_], beizhuFK['MC'][BZBH_], beizhuFK['LB'][BZBH_], beizhuFK['SL'][BZBH_], beizhuFK['XBH'][BZBH_], Number(bh_.split('*')[1])]);
            }
        }
    }
    console.log(result);
    return Service.updateBeizhu_djcs(derow, result, xuhao);
};


export const danxiangdinge_djcs = (selectedRow) => {
    return Service.danxiangdinge_djcs(selectedRow);
};

export const updateDercj_djcs = (row, data) => {
    return Service.updateDercj_djcs(row, data);

};

export const updateShuliang_djcs = (data, row) => {
    return Service.updateShuliang_djcs(data, row);

};

export const changguidinge_djcs = (dingeclick, selectedRow) => {
    return Service.changguidinge_djcs(dingeclick, selectedRow);

};

export const azfy_djcs_eligible = (selectedRow) => {
    return Service.azfy_djcs_eligible(selectedRow);

};

export const azfy_djcs = (selectedRow, dinge, selected) => {
    return Service.azfy_djcs(selectedRow, dinge, selected);

};



