|
|
@@ -1,192 +0,0 @@
|
|
|
-package uzi9.uzi9q.opmcepaq.epaq.plugin.form.zd;
|
|
|
-
|
|
|
-import kd.bos.dataentity.OperateOption;
|
|
|
-import kd.bos.dataentity.entity.DynamicObject;
|
|
|
-import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
-import kd.bos.dataentity.entity.LocaleString;
|
|
|
-import kd.bos.dataentity.entity.OrmLocaleValue;
|
|
|
-import kd.bos.entity.datamodel.ListSelectedRow;
|
|
|
-import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|
|
-import kd.bos.entity.list.QueryResult;
|
|
|
-import kd.bos.entity.operate.Donothing;
|
|
|
-import kd.bos.entity.operate.result.OperationResult;
|
|
|
-import kd.bos.form.control.Button;
|
|
|
-import kd.bos.form.control.Control;
|
|
|
-import kd.bos.form.control.Toolbar;
|
|
|
-import kd.bos.form.control.events.ItemClickEvent;
|
|
|
-import kd.bos.form.events.*;
|
|
|
-import kd.bos.form.operate.formop.Close;
|
|
|
-import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
-import kd.bos.list.BillList;
|
|
|
-import kd.bos.list.IListColumn;
|
|
|
-import kd.bos.list.ListColumn;
|
|
|
-import kd.bos.list.events.CreateListColumnsListener;
|
|
|
-import kd.bos.list.events.CreateListDataProviderListener;
|
|
|
-import kd.bos.list.plugin.AbstractListPlugin;
|
|
|
-import kd.bos.mvc.list.ListDataProvider;
|
|
|
-import kd.bos.orm.query.QFilter;
|
|
|
-import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
-import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
-import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
-import kd.sdk.plugin.Plugin;
|
|
|
-
|
|
|
-import java.util.EventObject;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-/**
|
|
|
- * 从其他表动态表单插件
|
|
|
- */
|
|
|
-public class EvaluationPersonnelFormPlugin extends AbstractFormPlugin implements Plugin, BeforeBindDataListener, CreateListColumnsListener {
|
|
|
-
|
|
|
- @Override
|
|
|
- public void initialize() {
|
|
|
- super.initialize();
|
|
|
- BillList billList = this.getControl("uzi9_billlistap");
|
|
|
- billList.addClickListener(this);
|
|
|
- billList.setClearSelection(false);
|
|
|
- billList.addCreateListColumnsListener(this);
|
|
|
- billList.addBeforeBindDataListener(this);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void createListColumns(BeforeCreateListColumnsArgs args) {
|
|
|
- List<IListColumn> listColumns = args.getListColumns();
|
|
|
- ListColumn listColumn1 = this.createListColumn("name", "姓名", 0);
|
|
|
- ListColumn listColumn2 = this.createListColumn("uzi9_employeeid", "工号", 1);
|
|
|
- ListColumn listColumn3 = this.createListColumn("uzi9_orgfield", "组织", 2);
|
|
|
- ListColumn listColumn4 = this.createListColumn("uzi9_position", "岗位", 3);
|
|
|
- ListColumn listColumn5 = this.createListColumn("uzi9_date_joining", "入职时间", 4);
|
|
|
-
|
|
|
- listColumns.add(listColumn1);
|
|
|
- listColumns.add(listColumn2);
|
|
|
- listColumns.add(listColumn3);
|
|
|
- listColumns.add(listColumn4);
|
|
|
- listColumns.add(listColumn5);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void beforeBindData(BeforeBindDataEvent beforeBindDataEvent) {
|
|
|
- BillList billList = this.getControl("uzi9_billlistap");
|
|
|
- billList.addCreateListDataProviderListener(new CreateListDataProviderListener() {
|
|
|
- @Override
|
|
|
- public void createListDataProvider(BeforeCreateListDataProviderArgs args) {
|
|
|
- args.setListDataProvider(new BillListDataProvider());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- private ListColumn createListColumn(String key, String caption, int colIndex) {
|
|
|
- ListColumn col = new ListColumn();
|
|
|
- col.setCaption(new LocaleString(caption));
|
|
|
- col.setListFieldKey(key);
|
|
|
- col.setKey(key);
|
|
|
- col.setFieldName(key);
|
|
|
- col.setSeq(colIndex);
|
|
|
- col.setWidth(new LocaleString("20%"));
|
|
|
- return col;
|
|
|
- }
|
|
|
-
|
|
|
- //进行数据的封装
|
|
|
- public class BillListDataProvider extends ListDataProvider {
|
|
|
- @Override
|
|
|
- public DynamicObjectCollection getData(int start, int limit) {
|
|
|
- DynamicObjectCollection result = new DynamicObjectCollection();
|
|
|
- DynamicObject[] bosUserS = bosUser();
|
|
|
-
|
|
|
- int endIndex = Math.min(start + limit, bosUserS.length);
|
|
|
- //数据封装
|
|
|
- for (DynamicObject bosUser : bosUserS) {
|
|
|
- DynamicObject post = null;
|
|
|
- DynamicObject dpt = null;
|
|
|
- DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("uzi9_evaluation_object");
|
|
|
- dynamicObject.set("name", bosUser.get("name"));
|
|
|
- dynamicObject.set("id", bosUser.get("id"));
|
|
|
- dynamicObject.set("uzi9_employeeid", bosUser.get("number"));
|
|
|
- DynamicObjectCollection entryentity = bosUser.getDynamicObjectCollection("entryentity");
|
|
|
-
|
|
|
- for (DynamicObject entry : entryentity) {
|
|
|
- boolean bl = (boolean) entry.get("ispartjob");
|
|
|
- if (!bl) {
|
|
|
- post = (DynamicObject) entry.get("post");
|
|
|
- dpt = (DynamicObject) entry.get("dpt");
|
|
|
- if (post != null) {
|
|
|
- dynamicObject.set("uzi9_position",post);
|
|
|
- }
|
|
|
- if (dpt != null) {
|
|
|
- dynamicObject.set("uzi9_orgfield",dpt);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- dynamicObject.set("uzi9_date_joining", bosUser.get("startdate"));
|
|
|
- result.add(dynamicObject);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- getQueryResult().setCollection(result);
|
|
|
- getQueryResult().setDataCount(result.size());
|
|
|
- return result;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //搜索人员(获取数据)
|
|
|
- private DynamicObject[] bosUser() {
|
|
|
- //bos_user人员获取姓名,岗位,工号,组织,
|
|
|
- QFilter qFilter = new QFilter("enable", QFilter.equals, true);
|
|
|
- DynamicObject[] load = BusinessDataServiceHelper.load("bos_user", "id,name,number,entryentity,startdate,entryentity.post,entryentity.dpt,entryentity.ispartjob", new QFilter[]{qFilter});
|
|
|
- return load;
|
|
|
- }
|
|
|
-
|
|
|
- private Object getDefaultValue(Object localeValue) {
|
|
|
- if (localeValue instanceof OrmLocaleValue) {
|
|
|
- OrmLocaleValue ormLocaleValue = (OrmLocaleValue) localeValue;
|
|
|
- // 假设默认语言是 "zh_CN",你可以根据实际情况调整
|
|
|
- return ormLocaleValue.get("zh_CN");
|
|
|
- }
|
|
|
- return localeValue;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void registerListener(EventObject e) {
|
|
|
- super.registerListener(e);
|
|
|
- Button control = this.getView().getControl("btnok");
|
|
|
- control.addClickListener(this);
|
|
|
- }
|
|
|
-
|
|
|
- //数据添加
|
|
|
- @Override
|
|
|
- public void click(EventObject evt) {
|
|
|
- super.click(evt);
|
|
|
- Control source = (Control) evt.getSource();
|
|
|
-
|
|
|
- if (evt.getSource() instanceof Button) {
|
|
|
- Button button = (Button) evt.getSource();
|
|
|
- String key = button.getKey();
|
|
|
- if (key.equals("btnok")) {
|
|
|
- BillList billList = this.getControl("uzi9_billlistap");
|
|
|
- ListSelectedRowCollection selectedRows = billList.getSelectedRows();
|
|
|
- if (selectedRows == null || selectedRows.size() == 0) {
|
|
|
- // 提示用户未选择
|
|
|
- this.getView().showErrorNotification("请至少选择一条记录!");
|
|
|
- return;
|
|
|
- }
|
|
|
- Object[] primaryKeyValues = selectedRows.getPrimaryKeyValues();
|
|
|
- QFilter qFilter = new QFilter("id",QFilter.in,primaryKeyValues);
|
|
|
- DynamicObject[] load = BusinessDataServiceHelper.load("bos_user", "id,name,number,entryentity,startdate,entryentity.post,entryentity.dpt", new QFilter[]{qFilter});
|
|
|
- this.getView().setReturnData(load);
|
|
|
- this.getView().invokeOperation("close");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void afterBindData(EventObject e) {
|
|
|
- super.afterBindData(e);
|
|
|
- Map<String, Object> ismul = new HashMap<>();
|
|
|
- // 开启多选
|
|
|
- ismul.put("ismul", true);
|
|
|
- this.getView().updateControlMetadata("uzi9_billlistap", ismul);
|
|
|
- }
|
|
|
-}
|