package com.yem.wm.im.tracktaskconsole.dynamic;

import com.alibaba.fastjson.JSONArray;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.form.IFormView;
import kd.bos.form.plugin.AbstractFormPlugin;

import java.util.ArrayList;
import java.util.EventObject;
import java.util.Map;

public class QueryStoreEdit extends AbstractFormPlugin {
    @Override
    public void afterCreateNewData(EventObject e) {
        super.afterCreateNewData(e);
        IFormView view = this.getView();
        Map<String, Object> customParams = view.getFormShowParameter().getCustomParams();
        JSONArray materialIds = (JSONArray) customParams.get("ids");
        IDataModel model = this.getModel();
        model.deleteEntryData("yem_entryentity");
        for (Object materialId : materialIds) {
            int row = model.createNewEntryRow("yem_entryentity");
            model.setValue("yem_materielfield",materialId,row);
        }
    }
}
