LAPTOP-SB56SG4Q\86185
2 years ago
110 changed files with 19152 additions and 1 deletions
@ -1,3 +1,6 @@
|
||||
# open-JSD-9634 |
||||
|
||||
JSD-9634 钉钉用户同步 |
||||
JSD-9634 钉钉用户同步\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.xxxx.dingtalksyn.job</id> |
||||
<name><![CDATA[钉钉数据同步]]></name> |
||||
<active>yes</active> |
||||
<version>1.0</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<description><![CDATA[钉钉数据同步]]></description> |
||||
<change-notes><![CDATA[ |
||||
版本1.0主要功能:<br/> |
||||
1.用户信息全量同步<br/> |
||||
2.用户信息增量同步<br/> |
||||
3.用户单点登陆功能<br/> |
||||
]]></change-notes> |
||||
<main-package>com.fr.plugin.xxxx.dingtalksyn</main-package> |
||||
<prefer-packages> |
||||
<prefer-package>com.fanruan.api</prefer-package> |
||||
<prefer-package>org.apache.commons.codec</prefer-package> |
||||
</prefer-packages> |
||||
<lifecycle-monitor class="com.fr.plugin.xxxx.dingtalksyn.provider.LifeCycleMonitorImpl"/> |
||||
<extra-core> |
||||
<LocaleFinder class="com.fr.plugin.xxxx.dingtalksyn.provider.LocaleFinder"/> |
||||
</extra-core> |
||||
<extra-decision> |
||||
<SystemOptionProvider class="com.fr.plugin.xxxx.dingtalksyn.provider.DingTalkSystemOption"/> |
||||
<HttpHandlerProvider class="com.fr.plugin.xxxx.dingtalksyn.provider.DingTalkHttpHandlerProvider"/> |
||||
<ControllerRegisterProvider class="com.fr.plugin.xxxx.dingtalksyn.request.DingTalkControllerBridge"/> |
||||
<GlobalRequestFilterProvider class="com.fr.plugin.xxxx.dingtalksyn.request.GlobalRequestFilterBridge"/> |
||||
</extra-decision> |
||||
<function-recorder class="com.fr.plugin.xxxx.dingtalksyn.provider.LocaleFinder"/> |
||||
</plugin> |
@ -0,0 +1,158 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DataResponse |
||||
* Author: Louis |
||||
* Date: 2021/3/19 11:46 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.bean; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.webservice.Response; |
||||
import com.fr.third.fasterxml.jackson.annotation.JsonInclude; |
||||
import com.fr.third.fasterxml.jackson.annotation.JsonProperty; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DataResponse> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) |
||||
public class DataResponse extends Response { |
||||
private static final long serialVersionUID = -6470353731188369521L; |
||||
@JsonProperty("msg_signature") |
||||
private String msgSignature; |
||||
private String timeStamp; |
||||
private String nonce; |
||||
private String encrypt; |
||||
|
||||
private String code; |
||||
private String message; |
||||
|
||||
public DataResponse() { |
||||
} |
||||
|
||||
private static DataResponse create() { |
||||
return new DataResponse(); |
||||
} |
||||
|
||||
/** |
||||
* 相应success结果 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static DataResponse success(Map<String, String> successMap) { |
||||
return create().msgSignature(successMap.get("msg_signature")) |
||||
.timeStamp(successMap.get("timeStamp")) |
||||
.nonce(successMap.get("nonce")) |
||||
.encrypt(successMap.get("encrypt")); |
||||
} |
||||
|
||||
/** |
||||
* 操作结果 |
||||
* |
||||
* @param data |
||||
* @return |
||||
*/ |
||||
public static DataResponse operation(String data) { |
||||
return create().code("200").message("success").data(data); |
||||
} |
||||
|
||||
/** |
||||
* 报错结果 |
||||
* |
||||
* @param code |
||||
* @param message |
||||
* @return |
||||
*/ |
||||
public static DataResponse error(String code, String message) { |
||||
return create().code(code).message(message).data(StringKit.EMPTY); |
||||
} |
||||
|
||||
public DataResponse msgSignature(String msgSignature) { |
||||
this.msgSignature = msgSignature; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse timeStamp(String timeStamp) { |
||||
this.timeStamp = timeStamp; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse nonce(String nonce) { |
||||
this.nonce = nonce; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse encrypt(String encrypt) { |
||||
this.encrypt = encrypt; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse code(String code) { |
||||
this.code = code; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse message(String message) { |
||||
this.message = message; |
||||
return this; |
||||
} |
||||
|
||||
public DataResponse data(Object data) { |
||||
this.setData(data); |
||||
return this; |
||||
} |
||||
|
||||
public String getMsgSignature() { |
||||
return msgSignature; |
||||
} |
||||
|
||||
public void setMsgSignature(String msgSignature) { |
||||
this.msgSignature = msgSignature; |
||||
} |
||||
|
||||
public String getTimeStamp() { |
||||
return timeStamp; |
||||
} |
||||
|
||||
public void setTimeStamp(String timeStamp) { |
||||
this.timeStamp = timeStamp; |
||||
} |
||||
|
||||
public String getNonce() { |
||||
return nonce; |
||||
} |
||||
|
||||
public void setNonce(String nonce) { |
||||
this.nonce = nonce; |
||||
} |
||||
|
||||
public String getEncrypt() { |
||||
return encrypt; |
||||
} |
||||
|
||||
public void setEncrypt(String encrypt) { |
||||
this.encrypt = encrypt; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public void setCode(String code) { |
||||
this.code = code; |
||||
} |
||||
|
||||
public String getMessage() { |
||||
return message; |
||||
} |
||||
|
||||
public void setMessage(String message) { |
||||
this.message = message; |
||||
} |
||||
} |
@ -0,0 +1,107 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkJobConstructor |
||||
* Author: Louis |
||||
* Date: 2021/4/21 15:58 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.bean; |
||||
|
||||
import com.fr.scheduler.job.FineScheduleJob; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkJobConstructor> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkJobConstructor { |
||||
private String cron; |
||||
private String jobName; |
||||
private String jobGroup; |
||||
private String triggerName; |
||||
private String triggerGroup; |
||||
private Class<? extends FineScheduleJob> jobClazz; |
||||
|
||||
public DingTalkJobConstructor() { |
||||
} |
||||
|
||||
public DingTalkJobConstructor cron(String var1) { |
||||
this.setCron(var1); |
||||
return this; |
||||
} |
||||
|
||||
public String getCron() { |
||||
return this.cron; |
||||
} |
||||
|
||||
public void setCron(String var1) { |
||||
this.cron = var1; |
||||
} |
||||
|
||||
public DingTalkJobConstructor jobName(String var1) { |
||||
this.setJobName(var1); |
||||
return this; |
||||
} |
||||
|
||||
public String getJobName() { |
||||
return this.jobName; |
||||
} |
||||
|
||||
public void setJobName(String var1) { |
||||
this.jobName = var1; |
||||
} |
||||
|
||||
public DingTalkJobConstructor jobGroup(String var1) { |
||||
this.setJobGroup(var1); |
||||
return this; |
||||
} |
||||
|
||||
public String getJobGroup() { |
||||
return this.jobGroup; |
||||
} |
||||
|
||||
public void setJobGroup(String var1) { |
||||
this.jobGroup = var1; |
||||
} |
||||
|
||||
public DingTalkJobConstructor triggerName(String var1) { |
||||
this.setTriggerName(var1); |
||||
return this; |
||||
} |
||||
|
||||
public String getTriggerName() { |
||||
return this.triggerName; |
||||
} |
||||
|
||||
public void setTriggerName(String var1) { |
||||
this.triggerName = var1; |
||||
} |
||||
|
||||
public DingTalkJobConstructor triggerGroup(String var1) { |
||||
this.setTriggerGroup(var1); |
||||
return this; |
||||
} |
||||
|
||||
public String getTriggerGroup() { |
||||
return this.triggerGroup; |
||||
} |
||||
|
||||
public void setTriggerGroup(String var1) { |
||||
this.triggerGroup = var1; |
||||
} |
||||
|
||||
public DingTalkJobConstructor jobClazz(Class<? extends FineScheduleJob> var1) { |
||||
this.setJobClazz(var1); |
||||
return this; |
||||
} |
||||
|
||||
public Class<? extends FineScheduleJob> getJobClazz() { |
||||
return this.jobClazz; |
||||
} |
||||
|
||||
public void setJobClazz(Class<? extends FineScheduleJob> var1) { |
||||
this.jobClazz = var1; |
||||
} |
||||
} |
@ -0,0 +1,146 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingSynConfig |
||||
* Author: Louis |
||||
* Date: 2021/3/30 9:38 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.config; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.config.*; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingSynConfig> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Visualization(category = "Plugin-dingtalksyn_Group") |
||||
public class DingSynConfig extends DefaultConfiguration { |
||||
|
||||
// 每天中午十二点触发
|
||||
public static final String CRON_CONDITION = "0 0 12 * * ?"; |
||||
public static final long ROOT_DEP_ID = 1; |
||||
private static volatile DingSynConfig config = null; |
||||
|
||||
public static DingSynConfig getInstance() { |
||||
if (config == null) { |
||||
config = ConfigContext.getConfigInstance(DingSynConfig.class); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
@Identifier(value = "cronCondition", name = "Plugin-dingtalksyn_Config_CronCondition", description = "Plugin-dingtalksyn_Config_CronCondition_Description", status = Status.SHOW) |
||||
private Conf<String> cronCondition = Holders.simple(CRON_CONDITION); |
||||
@Identifier(value = "appKey", name = "Plugin-dingtalksyn_Config_appKey", description = "Plugin-dingtalksyn_Config_appKey_Description", status = Status.SHOW) |
||||
private Conf<String> appKey = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "appSecret", name = "Plugin-dingtalksyn_Config_appSecret", description = "Plugin-dingtalksyn_Config_appSecret_Description", status = Status.SHOW) |
||||
private Conf<String> appSecret = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "corpId", name = "Plugin-dingtalksyn_Config_corpId", description = "Plugin-dingtalksyn_Config_corpId_Description", status = Status.SHOW) |
||||
private Conf<String> corpId = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "rootDepId", name = "Plugin-dingtalksyn_Config_rootDepId", description = "Plugin-dingtalksyn_Config_rootDepId_Description", status = Status.SHOW) |
||||
private Conf<Long> rootDepId = Holders.simple(ROOT_DEP_ID); |
||||
@Identifier(value = "token", name = "Plugin-dingtalksyn_Config_Token", description = "Plugin-dingtalksyn_Config_Token_Description", status = Status.SHOW) |
||||
private Conf<String> token = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "aesKey", name = "Plugin-dingtalksyn_Config_AesKey", description = "Plugin-dingtalksyn_Config_AesKey_Description", status = Status.SHOW) |
||||
private Conf<String> aesKey = Holders.simple(StringKit.EMPTY); |
||||
@Identifier(value = "ssoEnable", name = "Plugin-dingtalksyn_Config_SsoEnable", description = "Plugin-dingtalksyn_Config_SsoEnable_Description", status = Status.SHOW) |
||||
private Conf<Boolean> ssoEnable = Holders.simple(true); |
||||
|
||||
private Conf<String> url = Holders.simple(StringKit.EMPTY); |
||||
private Conf<String> proxyServer = Holders.simple(StringKit.EMPTY); |
||||
private Conf<DingTalkMemberManagementConfig> memberManagementConfig = Holders.obj(new DingTalkMemberManagementConfig(), DingTalkMemberManagementConfig.class); |
||||
private Conf<DingTalkTimingTaskConfig> timingTaskConfig = Holders.obj(new DingTalkTimingTaskConfig(), DingTalkTimingTaskConfig.class); |
||||
|
||||
public String getCronCondition() { |
||||
return cronCondition.get(); |
||||
} |
||||
|
||||
public void setCronCondition(String cronCondition) { |
||||
this.cronCondition.set(cronCondition); |
||||
} |
||||
|
||||
public String getAppKey() { |
||||
return appKey.get(); |
||||
} |
||||
|
||||
public void setAppKey(String appKey) { |
||||
this.appKey.set(appKey); |
||||
} |
||||
|
||||
public String getAppSecret() { |
||||
return appSecret.get(); |
||||
} |
||||
|
||||
public void setAppSecret(String appSecret) { |
||||
this.appSecret.set(appSecret); |
||||
} |
||||
|
||||
public String getCorpId() { |
||||
return corpId.get(); |
||||
} |
||||
|
||||
public void setCorpId(String corpId) { |
||||
this.corpId.set(corpId); |
||||
} |
||||
|
||||
public long getRootDepId() { |
||||
return rootDepId.get(); |
||||
} |
||||
|
||||
public void setRootDepId(long rootDepId) { |
||||
this.rootDepId.set(rootDepId); |
||||
} |
||||
|
||||
public String getToken() { |
||||
return token.get(); |
||||
} |
||||
|
||||
public void setToken(String token) { |
||||
this.token.set(token); |
||||
} |
||||
|
||||
public String getAesKey() { |
||||
return aesKey.get(); |
||||
} |
||||
|
||||
public void setAesKey(String aesKey) { |
||||
this.aesKey.set(aesKey); |
||||
} |
||||
|
||||
public boolean getSsoEnable() { |
||||
return ssoEnable.get(); |
||||
} |
||||
|
||||
public void setSsoEnable(boolean ssoEnable) { |
||||
this.ssoEnable.set(ssoEnable); |
||||
} |
||||
|
||||
public String getUrl() { |
||||
return (String) this.url.get(); |
||||
} |
||||
|
||||
public void setUrl(String url) { |
||||
this.url.set(url); |
||||
} |
||||
|
||||
public String getProxyServer() { |
||||
return (String) this.proxyServer.get(); |
||||
} |
||||
|
||||
public void setProxyServer(String proxyServer) { |
||||
this.proxyServer.set(proxyServer); |
||||
} |
||||
|
||||
public DingTalkMemberManagementConfig getMemberManagementConfig() { |
||||
return (DingTalkMemberManagementConfig) this.memberManagementConfig.get(); |
||||
} |
||||
|
||||
public DingTalkTimingTaskConfig getTimingTaskConfig() { |
||||
return (DingTalkTimingTaskConfig) this.timingTaskConfig.get(); |
||||
} |
||||
} |
@ -0,0 +1,74 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkMemberManagementConfig |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:33 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.config; |
||||
|
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
import com.fr.config.utils.UniqueKey; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkMemberManagementConfig> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkMemberManagementConfig extends UniqueKey { |
||||
private static final long serialVersionUID = -7306068222156688449L; |
||||
private Conf<Integer> matchingFSWay; |
||||
private Conf<String> dataSet; |
||||
private Conf<Integer> dataSetFsUserNameColumn; |
||||
private Conf<Integer> dataSetDingTalkUserIdColumn; |
||||
|
||||
public DingTalkMemberManagementConfig() { |
||||
this.matchingFSWay = Holders.simple(MatchingFSWay.MATCHING_USER_BY_DINGTALK_ID.getValue()); |
||||
this.dataSet = Holders.simple(""); |
||||
this.dataSetFsUserNameColumn = Holders.simple(-1); |
||||
this.dataSetDingTalkUserIdColumn = Holders.simple(-1); |
||||
} |
||||
|
||||
public DingTalkMemberManagementConfig(int var1) { |
||||
this.matchingFSWay = Holders.simple(MatchingFSWay.MATCHING_USER_BY_DINGTALK_ID.getValue()); |
||||
this.dataSet = Holders.simple(""); |
||||
this.dataSetFsUserNameColumn = Holders.simple(-1); |
||||
this.dataSetDingTalkUserIdColumn = Holders.simple(-1); |
||||
this.matchingFSWay.set(var1); |
||||
} |
||||
|
||||
public int getMatchingFSWay() { |
||||
return (Integer) this.matchingFSWay.get(); |
||||
} |
||||
|
||||
public void setMatchingFSWay(int var1) { |
||||
this.matchingFSWay.set(var1); |
||||
} |
||||
|
||||
public String getDataSet() { |
||||
return (String) this.dataSet.get(); |
||||
} |
||||
|
||||
public void setDataSet(String var1) { |
||||
this.dataSet.set(var1); |
||||
} |
||||
|
||||
public int getDataSetFsUserNameColumn() { |
||||
return (Integer) this.dataSetFsUserNameColumn.get(); |
||||
} |
||||
|
||||
public void setDataSetFsUserNameColumn(int var1) { |
||||
this.dataSetFsUserNameColumn.set(var1); |
||||
} |
||||
|
||||
public int getDataSetDingTalkUserIdColumn() { |
||||
return (Integer) this.dataSetDingTalkUserIdColumn.get(); |
||||
} |
||||
|
||||
public void setDataSetDingTalkUserIdColumn(int var1) { |
||||
this.dataSetDingTalkUserIdColumn.set(var1); |
||||
} |
||||
} |
@ -0,0 +1,93 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkTimingTaskConfig |
||||
* Author: Louis |
||||
* Date: 2021/6/27 15:24 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.config; |
||||
|
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
import com.fr.config.utils.UniqueKey; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkTimingTaskConfig> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkTimingTaskConfig extends UniqueKey { |
||||
private static final long serialVersionUID = -4918602359444495066L; |
||||
private Conf<Boolean> enableAutoSync; |
||||
private Conf<Integer> period; |
||||
private Conf<Integer> startWeekDay; |
||||
private Conf<String> startHour; |
||||
private Conf<String> startMinute; |
||||
|
||||
public DingTalkTimingTaskConfig() { |
||||
this.enableAutoSync = Holders.simple(false); |
||||
this.period = Holders.simple(0); |
||||
this.startWeekDay = Holders.simple(Week.MONDAY.getDay()); |
||||
this.startHour = Holders.simple("00"); |
||||
this.startMinute = Holders.simple("00"); |
||||
} |
||||
|
||||
public DingTalkTimingTaskConfig(boolean var1, int var2, String var3, String var4) { |
||||
this.enableAutoSync = Holders.simple(false); |
||||
this.period = Holders.simple(0); |
||||
this.startWeekDay = Holders.simple(Week.MONDAY.getDay()); |
||||
this.startHour = Holders.simple("00"); |
||||
this.startMinute = Holders.simple("00"); |
||||
this.enableAutoSync.set(var1); |
||||
this.period.set(var2); |
||||
this.startHour.set(var3); |
||||
this.startMinute.set(var4); |
||||
} |
||||
|
||||
public DingTalkTimingTaskConfig(boolean var1, int var2, int var3, String var4, String var5) { |
||||
this(var1, var2, var4, var5); |
||||
this.startWeekDay.set(var3); |
||||
} |
||||
|
||||
public boolean isEnableAutoSync() { |
||||
return (Boolean) this.enableAutoSync.get(); |
||||
} |
||||
|
||||
public void setEnableAutoSync(boolean var1) { |
||||
this.enableAutoSync.set(var1); |
||||
} |
||||
|
||||
public int getPeriod() { |
||||
return (Integer) this.period.get(); |
||||
} |
||||
|
||||
public void setPeriod(int var1) { |
||||
this.period.set(var1); |
||||
} |
||||
|
||||
public int getStartWeekDay() { |
||||
return (Integer) this.startWeekDay.get(); |
||||
} |
||||
|
||||
public void setStartWeekDay(int var1) { |
||||
this.startWeekDay.set(var1); |
||||
} |
||||
|
||||
public String getStartHour() { |
||||
return (String) this.startHour.get(); |
||||
} |
||||
|
||||
public void setStartHour(String var1) { |
||||
this.startHour.set(var1); |
||||
} |
||||
|
||||
public String getStartMinute() { |
||||
return (String) this.startMinute.get(); |
||||
} |
||||
|
||||
public void setStartMinute(String var1) { |
||||
this.startMinute.set(var1); |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: MatchingFSWay |
||||
* Author: Louis |
||||
* Date: 2021/6/26 14:52 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.config; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <MatchingFSWay> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public enum MatchingFSWay { |
||||
MATCHING_USER_BY_DINGTALK_ID(0), |
||||
MATCHING_USER_BY_DINGTALK_MOBILE(1), |
||||
MATCHING_USER_MANUALLY(2), |
||||
MATCHING_USER_BY_DATASET(3); |
||||
|
||||
private int matchingWay; |
||||
|
||||
private MatchingFSWay(int var3) { |
||||
this.matchingWay = var3; |
||||
} |
||||
|
||||
public int getValue() { |
||||
return this.matchingWay; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: Week |
||||
* Author: Louis |
||||
* Date: 2021/6/27 15:26 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.config; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <Week> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public enum Week { |
||||
SUNDAY("SUN", 0), |
||||
MONDAY("MON", 1), |
||||
TUESDAY("TUE", 2), |
||||
WEDNESDAY("WED", 3), |
||||
THURSDAY("THU", 4), |
||||
FRIDAY("FRI", 5), |
||||
SATURDAY("STA", 6); |
||||
|
||||
private int day; |
||||
private String dayName; |
||||
|
||||
private Week(String var3, int var4) { |
||||
this.dayName = var3; |
||||
this.day = var4; |
||||
} |
||||
|
||||
public int getDay() { |
||||
return this.day; |
||||
} |
||||
|
||||
public String getDayName() { |
||||
return this.dayName; |
||||
} |
||||
|
||||
public static Week getWeek(int var0) { |
||||
switch (var0) { |
||||
case 0: |
||||
return SUNDAY; |
||||
case 1: |
||||
return MONDAY; |
||||
case 2: |
||||
return TUESDAY; |
||||
case 3: |
||||
return WEDNESDAY; |
||||
case 4: |
||||
return THURSDAY; |
||||
case 5: |
||||
return FRIDAY; |
||||
case 6: |
||||
return SATURDAY; |
||||
default: |
||||
return MONDAY; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkRequestException |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:26 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.exceptions; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkRequestException> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkRequestException extends Exception { |
||||
private static final long serialVersionUID = -729781689637350516L; |
||||
|
||||
public DingTalkRequestException() { |
||||
} |
||||
|
||||
public DingTalkRequestException(String msg) { |
||||
super(msg); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkTokenEmptyException |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:27 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.exceptions; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkTokenEmptyException> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkTokenEmptyException extends Exception { |
||||
private static final long serialVersionUID = -7930789693326095840L; |
||||
|
||||
public DingTalkTokenEmptyException() { |
||||
} |
||||
|
||||
public DingTalkTokenEmptyException(String msg) { |
||||
super(msg); |
||||
} |
||||
} |
@ -0,0 +1,87 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkHttpHandlerDecorator |
||||
* Author: Louis |
||||
* Date: 2021/6/24 20:30 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.handler; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.decision.fun.HttpHandler; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.decision.webservice.exception.general.NoPrivilegeException; |
||||
import com.fr.plugin.xxxx.dingtalksyn.exceptions.DingTalkRequestException; |
||||
import com.fr.plugin.xxxx.dingtalksyn.exceptions.DingTalkTokenEmptyException; |
||||
import com.fr.plugin.xxxx.dingtalksyn.helper.DingTalkDecUserHelper; |
||||
import com.fr.plugin.xxxx.dingtalksyn.utils.DingTalkAuthorityUtils; |
||||
import com.fr.plugin.xxxx.dingtalksyn.utils.DingTalkLogUtil; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.provider.DingTalkSystemOption.DING_TALK_SYN_SYSTEM_OPTION; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkHttpHandlerDecorator> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkHttpHandlerDecorator extends BaseHttpHandler { |
||||
private HttpHandler handler; |
||||
private boolean checkModulePrivilege; |
||||
|
||||
public DingTalkHttpHandlerDecorator(HttpHandler handler) { |
||||
this.handler = handler; |
||||
this.checkModulePrivilege = true; |
||||
} |
||||
|
||||
public DingTalkHttpHandlerDecorator(HttpHandler handler, boolean checkModule) { |
||||
this.handler = handler; |
||||
this.checkModulePrivilege = checkModule; |
||||
} |
||||
|
||||
public RequestMethod getMethod() { |
||||
return this.handler.getMethod(); |
||||
} |
||||
|
||||
public String getPath() { |
||||
return this.handler.getPath(); |
||||
} |
||||
|
||||
public boolean isPublic() { |
||||
return this.handler.isPublic(); |
||||
} |
||||
|
||||
public String[] modules() { |
||||
return this.checkModulePrivilege ? new String[]{DING_TALK_SYN_SYSTEM_OPTION} : new String[0]; |
||||
} |
||||
|
||||
public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { |
||||
try { |
||||
if (this.checkModulePrivilege && !this.handler.isPublic()) { |
||||
String var3 = DingTalkDecUserHelper.getCurrentUserId(request); |
||||
if (!DingTalkAuthorityUtils.hasModulePrivilege(var3, DING_TALK_SYN_SYSTEM_OPTION)) { |
||||
throw new NoPrivilegeException(); |
||||
} |
||||
this.handler.handle(request, response); |
||||
} else { |
||||
this.handler.handle(request, response); |
||||
} |
||||
} catch (DingTalkRequestException e) { |
||||
DingTalkLogUtil.error(e.getMessage(), e, 44001); |
||||
WebUtils.flushFailureMessageAutoClose(request, response, 11205037, e.getMessage()); |
||||
} catch (DingTalkTokenEmptyException e) { |
||||
String message = "获取token失败,钉钉返回信息为:" + e.getMessage(); |
||||
DingTalkLogUtil.error(message, 44002); |
||||
WebUtils.flushFailureMessageAutoClose(request, response, 11205031, message); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
throw e; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,128 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkDecUserHelper |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:04 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.helper; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.data.User; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import com.fr.stable.query.restriction.RestrictionFactory; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkDecUserHelper> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkDecUserHelper { |
||||
public DingTalkDecUserHelper() { |
||||
} |
||||
|
||||
public static boolean isUserExist(String userName) { |
||||
if (StringUtils.isEmpty(userName)) { |
||||
return false; |
||||
} |
||||
try { |
||||
List<User> userList = AuthorityContext.getInstance().getUserController().find(QueryFactory.create().addRestriction(RestrictionFactory.eq("userName", userName))); |
||||
return userList != null && !userList.isEmpty(); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public static List<User> getDecUsers() { |
||||
List<User> userList = null; |
||||
try { |
||||
userList = AuthorityContext.getInstance().getUserController().find(QueryFactory.create()); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
return (userList == null ? new ArrayList<>() : userList); |
||||
} |
||||
|
||||
public static String getDecUserNameById(String userId, List<User> userList) { |
||||
String userName = StringKit.EMPTY; |
||||
for (User user : userList) { |
||||
if (ComparatorUtils.equals(user.getId(), userId)) { |
||||
userName = user.getUserName(); |
||||
break; |
||||
} |
||||
} |
||||
return userName; |
||||
} |
||||
|
||||
public static User getDecUserByName(String userName) { |
||||
User User = null; |
||||
if (StringUtils.isNotBlank(userName)) { |
||||
try { |
||||
List<User> userList = AuthorityContext.getInstance().getUserController().find(QueryFactory.create().addRestriction(RestrictionFactory.eq("userName", userName))); |
||||
if (userList != null && !userList.isEmpty()) { |
||||
User = userList.get(0); |
||||
} |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return User; |
||||
} |
||||
|
||||
public static void filterEnableUserNames(List<String> userNames) { |
||||
List<User> userList = getDecUsers(); |
||||
Iterator<String> iterator = userNames.iterator(); |
||||
while (iterator.hasNext()) { |
||||
boolean enable = false; |
||||
String userName = iterator.next(); |
||||
for (User user : userList) { |
||||
if (ComparatorUtils.equals(user.getUserName(), userName) && user.isEnable()) { |
||||
enable = true; |
||||
break; |
||||
} |
||||
} |
||||
if (!enable) { |
||||
iterator.remove(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static String userNameToRealName(String userName, List<User> userList) { |
||||
String realName = StringKit.EMPTY; |
||||
if (StringUtils.isNotEmpty(userName)) { |
||||
for (User user : userList) { |
||||
if (ComparatorUtils.equals(userName, user.getUserName())) { |
||||
realName = user.getRealName(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
return realName; |
||||
} |
||||
|
||||
public static String getCurrentUserId(HttpServletRequest request) { |
||||
String currentUserId = StringKit.EMPTY; |
||||
try { |
||||
currentUserId = UserService.getInstance().getCurrentUserId(request); |
||||
} catch (Exception e) { |
||||
try { |
||||
currentUserId = UserService.getInstance().getCurrentUserIdFromCookie(request); |
||||
} catch (Exception e1) { |
||||
} |
||||
} |
||||
return currentUserId; |
||||
} |
||||
} |
@ -0,0 +1,77 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkScheduleHelper |
||||
* Author: Louis |
||||
* Date: 2021/4/21 15:52 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.helper; |
||||
|
||||
import com.fr.plugin.xxxx.dingtalksyn.bean.DingTalkJobConstructor; |
||||
import com.fr.plugin.xxxx.dingtalksyn.job.DingTalkSyncMemberJob; |
||||
import com.fr.scheduler.ScheduleJobManager; |
||||
import com.fr.third.v2.org.quartz.CronScheduleBuilder; |
||||
import com.fr.third.v2.org.quartz.TriggerBuilder; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.TimeZone; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkScheduleHelper> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkScheduleHelper { |
||||
public static final String DINGTALK_SCHEDULE_SYN_MEMBER_JOB_NAME = "MqhDingTalkSynDepMemberJob"; |
||||
public static final String DINGTALK_SCHEDULE_SYN_MEMBER_TRIGGER_NAME = "MqhDingTalkSynDepMemberTrigger"; |
||||
public static final String DINGTALK_SCHEDULE_SYN_MEMBER_GROUP = "MqhDingTalkSynDepMemberGroup"; |
||||
public static final String DINGTALK_SCHEDULE_SYN_MEMBER_TRIGGER_GROUP = "MqhDingTalkSynDepMemberTriggerGroup"; |
||||
|
||||
private DingTalkScheduleHelper() { |
||||
} |
||||
|
||||
public static DingTalkScheduleHelper getInstance() { |
||||
return HOLDER.INSTANCE; |
||||
} |
||||
|
||||
public void startSynMemberSchedule(String cronCondition) throws Exception { |
||||
DingTalkJobConstructor jobConstructor = (new DingTalkJobConstructor()) |
||||
.cron(cronCondition).jobName(DINGTALK_SCHEDULE_SYN_MEMBER_JOB_NAME) |
||||
.jobGroup(DINGTALK_SCHEDULE_SYN_MEMBER_GROUP).triggerName(DINGTALK_SCHEDULE_SYN_MEMBER_TRIGGER_NAME) |
||||
.triggerGroup(DINGTALK_SCHEDULE_SYN_MEMBER_TRIGGER_GROUP).jobClazz(DingTalkSyncMemberJob.class); |
||||
this.startSchedule(jobConstructor); |
||||
} |
||||
|
||||
public void startSchedule(DingTalkJobConstructor var1) throws Exception { |
||||
if (var1 != null) { |
||||
String var2 = var1.getCron(); |
||||
String var3 = var1.getTriggerName(); |
||||
String var4 = var1.getTriggerGroup(); |
||||
String var5 = var1.getJobName(); |
||||
String var6 = var1.getJobGroup(); |
||||
Class var7 = var1.getJobClazz(); |
||||
TriggerBuilder var8 = TriggerBuilder.newTrigger(); |
||||
var8.withIdentity(var3, var4); |
||||
var8.withSchedule(CronScheduleBuilder.cronSchedule(var2).withMisfireHandlingInstructionFireAndProceed().inTimeZone(TimeZone.getTimeZone(TimeZone.getDefault().getID()))).startNow(); |
||||
var8.forJob(var5, var6); |
||||
ArrayList var9 = new ArrayList(); |
||||
var9.add(var8.build()); |
||||
ScheduleJobManager.getInstance().removeJob(var5, var6); |
||||
ScheduleJobManager.getInstance().addJob(var5, var6, "jobDescription", var7, var9, new HashMap()); |
||||
} |
||||
} |
||||
|
||||
public void stopSchedule(String var1, String var2) { |
||||
ScheduleJobManager.getInstance().removeJob(var1, var2); |
||||
} |
||||
|
||||
public static class HOLDER { |
||||
private static final DingTalkScheduleHelper INSTANCE = new DingTalkScheduleHelper(); |
||||
|
||||
public HOLDER() { |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkSyncMemberJob |
||||
* Author: Louis |
||||
* Date: 2021/4/21 16:02 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.job; |
||||
|
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.cluster.core.ClusterNode; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.plugin.xxxx.dingtalksyn.user.DingTalkUserManager; |
||||
import com.fr.scheduler.job.FineScheduleJob; |
||||
import com.fr.third.v2.org.quartz.JobExecutionContext; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkSyncMemberJob> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkSyncMemberJob extends FineScheduleJob { |
||||
public DingTalkSyncMemberJob() { |
||||
} |
||||
|
||||
public void run(JobExecutionContext jobExecutionContext, ClusterNode clusterNode) { |
||||
try { |
||||
if (PluginContexts.currentContext().isAvailable()) { |
||||
DingTalkUserManager.getInstance().synDingTalkUsers(); |
||||
} else { |
||||
DingSynConfig.getInstance().setSsoEnable(false); |
||||
throw new Exception(I18nKit.getLocText("Plugin-dingtalksyn_Error_501")); |
||||
} |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: CustomRoleServiceKit |
||||
* Author: Louis |
||||
* Date: 2021/5/14 10:31 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.kit; |
||||
|
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.base.constant.SoftRoleType; |
||||
import com.fr.decision.authority.base.constant.type.operation.ManualOperationType; |
||||
import com.fr.decision.authority.data.CustomRole; |
||||
import com.fr.decision.record.OperateMessage; |
||||
import com.fr.decision.webservice.bean.user.RoleBean; |
||||
import com.fr.decision.webservice.exception.general.DuplicatedNameException; |
||||
import com.fr.decision.webservice.utils.ControllerFactory; |
||||
import com.fr.decision.webservice.v10.user.CustomRoleService; |
||||
import com.fr.intelli.record.MetricRegistry; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import com.fr.stable.query.condition.QueryCondition; |
||||
import com.fr.stable.query.restriction.Restriction; |
||||
import com.fr.stable.query.restriction.RestrictionFactory; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <CustomRoleServiceKit> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class CustomRoleServiceKit extends CustomRoleService { |
||||
private static volatile CustomRoleServiceKit customRoleServiceKit = null; |
||||
|
||||
public CustomRoleServiceKit() { |
||||
} |
||||
|
||||
public static CustomRoleServiceKit getInstance() { |
||||
if (customRoleServiceKit == null) { |
||||
customRoleServiceKit = new CustomRoleServiceKit(); |
||||
} |
||||
return customRoleServiceKit; |
||||
} |
||||
|
||||
public void addCustomRole(String username, RoleBean roleBean) throws Exception { |
||||
this.checkDuplicatedCustomRole(roleBean.getText()); |
||||
CustomRole customRole = (new CustomRole()).id(roleBean.getId()).name(roleBean.getText()).description(roleBean.getDescription()).creationType(ManualOperationType.KEY).lastOperationType(ManualOperationType.KEY).enable(true); |
||||
ControllerFactory.getInstance().getCustomRoleController(username).addCustomRole(username, customRole); |
||||
this.deleteSoftData(customRole.getName()); |
||||
MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Role", roleBean.getText(), "Dec-Log_Add")); |
||||
} |
||||
|
||||
private void checkDuplicatedCustomRole(String roleName) throws Exception { |
||||
QueryCondition queryCondition = QueryFactory.create().addRestriction(RestrictionFactory.eq("name", roleName)); |
||||
CustomRole customRole = (CustomRole) AuthorityContext.getInstance().getCustomRoleController().findOne(queryCondition); |
||||
if (customRole != null) { |
||||
throw new DuplicatedNameException(); |
||||
} |
||||
} |
||||
|
||||
private void deleteSoftData(String roleName) throws Exception { |
||||
QueryCondition queryCondition = QueryFactory.create().addRestriction(RestrictionFactory.and(new Restriction[]{RestrictionFactory.eq("deletedName", roleName), RestrictionFactory.eq("type", SoftRoleType.CUSTOM)})); |
||||
AuthorityContext.getInstance().getSoftDataController().remove(queryCondition); |
||||
} |
||||
} |
@ -0,0 +1,109 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DepartmentServiceKit |
||||
* Author: Louis |
||||
* Date: 2021/5/14 9:38 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.kit; |
||||
|
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.base.constant.type.operation.ManualOperationType; |
||||
import com.fr.decision.authority.data.Department; |
||||
import com.fr.decision.record.OperateMessage; |
||||
import com.fr.decision.webservice.exception.general.DuplicatedNameException; |
||||
import com.fr.decision.webservice.v10.user.DepartmentService; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.intelli.record.MetricRegistry; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import com.fr.stable.query.condition.QueryCondition; |
||||
import com.fr.stable.query.restriction.Restriction; |
||||
import com.fr.stable.query.restriction.RestrictionFactory; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DepartmentServiceKit> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DepartmentServiceKit extends DepartmentService { |
||||
public static final String DECISION_DEP_ROOT = "decision-dep-root"; |
||||
private static volatile DepartmentServiceKit departmentServiceKit = null; |
||||
|
||||
public DepartmentServiceKit() { |
||||
} |
||||
|
||||
public static DepartmentServiceKit getInstance() { |
||||
if (departmentServiceKit == null) { |
||||
departmentServiceKit = new DepartmentServiceKit(); |
||||
} |
||||
return departmentServiceKit; |
||||
} |
||||
|
||||
/** |
||||
* 钉钉跟部门与FR跟部门转换 |
||||
* |
||||
* @param parentId |
||||
* @return |
||||
*/ |
||||
public String changeRootId(String parentId) { |
||||
if (StringKit.equals(parentId, String.valueOf(DingSynConfig.getInstance().getRootDepId()))) { |
||||
return DECISION_DEP_ROOT; |
||||
} |
||||
return parentId; |
||||
} |
||||
|
||||
public void addDepartment(String id, String pId, String depName) throws Exception { |
||||
if (StringKit.equals(pId, DECISION_DEP_ROOT)) { |
||||
pId = null; |
||||
} |
||||
this.checkDuplicatedDepartmentName(pId, depName); |
||||
Department department = (new Department()).id(id).name(depName).parentId(pId).creationType(ManualOperationType.KEY).lastOperationType(ManualOperationType.KEY).enable(true); |
||||
AuthorityContext.getInstance().getDepartmentController().add(department); |
||||
MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Department", this.getDepartmentFullPath(pId, depName, "/"), "Dec-Log_Add")); |
||||
} |
||||
|
||||
private void checkDuplicatedDepartmentName(String parentId, String depName) throws Exception { |
||||
QueryCondition condition = QueryFactory.create().addRestriction(RestrictionFactory.and(new Restriction[]{RestrictionFactory.eq("name", depName), RestrictionFactory.eq("parentId", parentId)})); |
||||
Department sameNameDep = AuthorityContext.getInstance().getDepartmentController().findOne(condition); |
||||
if (sameNameDep != null) { |
||||
throw new DuplicatedNameException(); |
||||
} |
||||
} |
||||
|
||||
private String getDepartmentFullPath(String pId, String depName, String splitter) throws Exception { |
||||
List<String> paths = new ArrayList<>(); |
||||
paths.add(depName); |
||||
while (!ComparatorUtils.equals(pId, DECISION_DEP_ROOT) && pId != null) { |
||||
Department parentDepartment = AuthorityContext.getInstance().getDepartmentController().getById(pId); |
||||
paths.add(parentDepartment.getName()); |
||||
pId = parentDepartment.getParentId(); |
||||
} |
||||
Collections.reverse(paths); |
||||
return StableUtils.join(paths.toArray(new String[0]), splitter); |
||||
} |
||||
|
||||
public void editDepartment(String departmentId, String depName, String pId) throws Exception { |
||||
if (StringKit.equals(pId, DECISION_DEP_ROOT)) { |
||||
pId = null; |
||||
} |
||||
Department department = AuthorityContext.getInstance().getDepartmentController().getById(departmentId); |
||||
String departmentFullPath = DepartmentService.getInstance().getDepartmentFullPath(departmentId); |
||||
if (!ComparatorUtils.equals(department.getName(), depName)) { |
||||
this.checkDuplicatedDepartmentName(department.getParentId(), depName); |
||||
department.setName(depName); |
||||
department.setParentId(pId); |
||||
AuthorityContext.getInstance().getDepartmentController().update(department); |
||||
} |
||||
MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Department", DepartmentService.getInstance().getDepartmentFullPath(departmentId), "Dec-Log_Update", I18nKit.getLocText("Fine-Dec_Department") + ":" + departmentFullPath)); |
||||
} |
||||
} |
@ -0,0 +1,231 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: UserServiceKit |
||||
* Author: Louis |
||||
* Date: 2021/5/14 8:28 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.kit; |
||||
|
||||
import com.dingtalk.api.response.OapiV2UserGetResponse; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.data.BaseUserDataRecord; |
||||
import com.fr.decision.authority.data.CustomRole; |
||||
import com.fr.decision.authority.data.Post; |
||||
import com.fr.decision.authority.data.User; |
||||
import com.fr.decision.authority.data.personnel.DepRole; |
||||
import com.fr.decision.privilege.TransmissionTool; |
||||
import com.fr.decision.webservice.bean.user.DepartmentPostBean; |
||||
import com.fr.decision.webservice.bean.user.UserBean; |
||||
import com.fr.decision.webservice.bean.user.UserUpdateBean; |
||||
import com.fr.decision.webservice.utils.UserSourceFactory; |
||||
import com.fr.decision.webservice.utils.WebServiceUtils; |
||||
import com.fr.decision.webservice.v10.user.PositionService; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.collections.CollectionUtils; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import com.fr.stable.query.restriction.RestrictionFactory; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <UserServiceKit> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class UserServiceKit extends UserService { |
||||
private static volatile UserServiceKit userServiceKit = null; |
||||
|
||||
public UserServiceKit() { |
||||
} |
||||
|
||||
public static UserServiceKit getInstance() { |
||||
if (userServiceKit == null) { |
||||
userServiceKit = new UserServiceKit(); |
||||
} |
||||
return userServiceKit; |
||||
} |
||||
|
||||
public UserBean createUserBean(OapiV2UserGetResponse.UserGetResponse userGetResponse) throws Exception { |
||||
UserBean userBean = new UserBean(); |
||||
userBean.setUsername(userGetResponse.getUserid()); |
||||
userBean.setRealName(userGetResponse.getName()); |
||||
userBean.setEmail(userGetResponse.getEmail()); |
||||
userBean.setMobile(userGetResponse.getMobile()); |
||||
userBean.setPassword(TransmissionTool.defaultEncrypt(userGetResponse.getUserid() + "123456")); |
||||
if (!CollectionUtils.isEmpty(userGetResponse.getRoleList())) { |
||||
userBean.setRoleIds(oapiUserRoles2Ids(userGetResponse.getRoleList())); |
||||
} |
||||
if (!CollectionUtils.isEmpty(userGetResponse.getDeptIdList())) { |
||||
List<String> departmentPostIds = createDepartmentPostIds(userGetResponse.getDeptIdList(), userGetResponse.getTitle()); |
||||
userBean.setDepartmentPostIds(departmentPostIds); |
||||
} |
||||
return userBean; |
||||
} |
||||
|
||||
/** |
||||
* 钉钉部门list转为部门职务组合list |
||||
* |
||||
* @param deptIdList |
||||
* @param title |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
private List<String> createDepartmentPostIds(List<Long> deptIdList, String title) throws Exception { |
||||
List<String> departmentPostIds = new ArrayList<>(); |
||||
String departmentPostId; |
||||
for (long currentDepId : deptIdList) { |
||||
departmentPostId = String.valueOf(currentDepId); |
||||
if (StringKit.isBlank(departmentPostId) || StringKit.equals(departmentPostId, "null")) { |
||||
continue; |
||||
} |
||||
// 职务处理
|
||||
String positionId = positionSynOperation(title, departmentPostId); |
||||
if (StringKit.isNotBlank(positionId)) { |
||||
departmentPostId = departmentPostId + "@@@" + positionId; |
||||
} |
||||
departmentPostIds.add(departmentPostId); |
||||
} |
||||
return departmentPostIds; |
||||
} |
||||
|
||||
/** |
||||
* 职务同步操作 |
||||
* |
||||
* @param title |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
private String positionSynOperation(String title, String departmentId) throws Exception { |
||||
String position = StringKit.isNotBlank(title) ? title : "职员"; |
||||
Post post = AuthorityContext.getInstance().getPostController().findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("name", position))); |
||||
String positionId; |
||||
if (post == null) { |
||||
positionId = PositionService.getInstance().addPosition(position, position); |
||||
} else { |
||||
positionId = post.getId(); |
||||
} |
||||
List<DepartmentPostBean> departmentPostBeanList = PositionService.getInstance().getPositionsUnderParentDepartment(getAdminUserId(), departmentId, position); |
||||
if (departmentPostBeanList == null || departmentPostBeanList.isEmpty()) { |
||||
try { |
||||
AuthorityContext.getInstance().getPostController().addPostToDepartment(positionId, departmentId); |
||||
} catch (Exception e) { |
||||
LogKit.info("dingtalksyn-UserServiceKit-positionSynOperation-addPostToDepartmentFailed-position:{}, departmentId:{}", positionId + position, departmentId); |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
return positionId; |
||||
} |
||||
|
||||
/** |
||||
* 获取管理员id |
||||
* |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
public String getAdminUserId() throws Exception { |
||||
List<String> adminUserIdList = this.getAdminUserIdList(); |
||||
if (adminUserIdList.isEmpty()) { |
||||
return "admin"; |
||||
} |
||||
return StringKit.isNotBlank(adminUserIdList.get(0)) ? adminUserIdList.get(0) : "admin"; |
||||
} |
||||
|
||||
public void editUser(UserBean userBean) throws Exception { |
||||
super.editUser(userBean, this.getAdminUserId()); |
||||
} |
||||
|
||||
public UserBean updateUserBean(OapiV2UserGetResponse.UserGetResponse userGetResponse) throws Exception { |
||||
User user = this.getUserByUserName(userGetResponse.getUserid()); |
||||
if (user == null) { |
||||
return null; |
||||
} |
||||
UserBean userBean = new UserBean(); |
||||
userBean.setId(user.getId()); |
||||
userBean.setUsername(user.getUserName()); |
||||
userBean.setRealName(userGetResponse.getName()); |
||||
userBean.setEmail(userGetResponse.getEmail()); |
||||
userBean.setMobile(userGetResponse.getMobile()); |
||||
if (!CollectionUtils.isEmpty(userGetResponse.getRoleList())) { |
||||
userBean.setRoleIds(oapiUserRoles2Ids(userGetResponse.getRoleList())); |
||||
} |
||||
if (!CollectionUtils.isEmpty(userGetResponse.getDeptIdList())) { |
||||
List<String> departmentPostIds = createDepartmentPostIds(userGetResponse.getDeptIdList(), userGetResponse.getTitle()); |
||||
userBean.setDepartmentPostIds(departmentPostIds); |
||||
} |
||||
return userBean; |
||||
} |
||||
|
||||
public int updateRoleUsers(String var1, UserUpdateBean var2) throws Exception { |
||||
String[] var3 = var2.getAddUserIds(); |
||||
String[] var4 = var2.getRemoveUserIds(); |
||||
CustomRole var5 = (CustomRole) AuthorityContext.getInstance().getCustomRoleController().getById(var1); |
||||
int var6 = 0; |
||||
String[] var7; |
||||
int var8; |
||||
int var9; |
||||
String var10; |
||||
if (var3 != null) { |
||||
var7 = var3; |
||||
var8 = var3.length; |
||||
|
||||
for (var9 = 0; var9 < var8; ++var9) { |
||||
var10 = var7[var9]; |
||||
// MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Role_User", this.getRoleUsername(var1, var10), "Dec-Log_Add"));
|
||||
UserSourceFactory.getInstance().checkSource((BaseUserDataRecord) AuthorityContext.getInstance().getUserController().getById(var10), var5); |
||||
AuthorityContext.getInstance().getUserController().addUserToCustomRole(var10, var1); |
||||
++var6; |
||||
} |
||||
} |
||||
|
||||
if (var4 != null) { |
||||
var7 = var4; |
||||
var8 = var4.length; |
||||
|
||||
for (var9 = 0; var9 < var8; ++var9) { |
||||
var10 = var7[var9]; |
||||
// MetricRegistry.getMetric().submit(OperateMessage.build("Dec-Module-User_Manager", "Dec-Role_User", this.getRoleUsername(var1, var10), "Dec-Log_Delete"));
|
||||
UserSourceFactory.getInstance().checkSource((BaseUserDataRecord) AuthorityContext.getInstance().getUserController().getById(var10), var5); |
||||
AuthorityContext.getInstance().getUserController().removeUserFromCustomRole(var10, var1); |
||||
++var6; |
||||
} |
||||
} |
||||
|
||||
return var6; |
||||
} |
||||
|
||||
/** |
||||
* 增加用户部门关联 |
||||
* |
||||
* @param userBean |
||||
* @throws Exception |
||||
*/ |
||||
public void addUserDepartment(UserBean userBean) throws Exception { |
||||
if (CollectionUtils.isEmpty(userBean.getDepartmentPostIds())) { |
||||
return; |
||||
} |
||||
for (String departmentPostId : userBean.getDepartmentPostIds()) { |
||||
if (StringUtils.isEmpty(departmentPostId)) { |
||||
continue; |
||||
} |
||||
User user = this.getUserByUserName(userBean.getUsername()); |
||||
DepRole depRole = WebServiceUtils.parseUniqueDepartmentPostId(departmentPostId); |
||||
UserSourceFactory.getInstance().checkSource(user, AuthorityContext.getInstance().getDepartmentController().getById(depRole.getDepartmentId())); |
||||
AuthorityContext.getInstance().getUserController().addUserToDepartmentAndPost(user.getId(), depRole.getDepartmentId(), depRole.getPostId()); |
||||
} |
||||
} |
||||
|
||||
private String[] oapiUserRoles2Ids(List<OapiV2UserGetResponse.UserRole> oapiUserRoleList) { |
||||
String[] roleIds = new String[oapiUserRoleList.size()]; |
||||
for (int i = 0; i < oapiUserRoleList.size(); i++) { |
||||
roleIds[i] = String.valueOf(oapiUserRoleList.get(i).getId()); |
||||
} |
||||
return roleIds; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkHttpHandlerProvider |
||||
* Author: Louis |
||||
* Date: 2021/6/24 20:18 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.provider; |
||||
|
||||
import com.fr.decision.fun.HttpHandler; |
||||
import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkHttpHandlerProvider> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkHttpHandlerProvider extends AbstractHttpHandlerProvider { |
||||
public DingTalkHttpHandlerProvider() { |
||||
} |
||||
|
||||
public HttpHandler[] registerHandlers() { |
||||
return new HttpHandler[]{ |
||||
// new DingTalkHttpHandlerDecorator(new DingTalkCreateAgentHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkUpdateAgentHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkDeleteAgentHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetAgentListHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetReportServerHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSaveReportServerHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetCorpListHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetMembersHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetMatchMethodHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetTimingTaskHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSaveMatchMethodHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSaveTimingTaskHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSyncMembersHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSaveUserRelationHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkCreateEntryUrlHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetProxyServerHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkProxyTestConnectionHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSaveProxyServerHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkCheckLicenseHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkExpireHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetJsTicketHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkUrlToBase64(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSingleLoginHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkStartDebuggerHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkDebuggerHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkSetLogLevelHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetLogLevelHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkLogDownLoadHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkCreateChatGroupHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetChatGroupHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkDeleteChatGroupHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetAgentMemberHandler()),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkMatchUserHandler(), false),
|
||||
// new DingTalkHttpHandlerDecorator(new DingTalkGetFSUserHandler(), false)
|
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkSystemOption |
||||
* Author: Louis |
||||
* Date: 2021/6/22 16:40 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.provider; |
||||
|
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fr.decision.fun.impl.AbstractSystemOptionProvider; |
||||
import com.fr.decision.web.MainComponent; |
||||
import com.fr.plugin.xxxx.dingtalksyn.provider.components.DingTalkComponent; |
||||
import com.fr.web.struct.Atom; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkSystemOption> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkSystemOption extends AbstractSystemOptionProvider { |
||||
|
||||
public static final String DING_TALK_SYN_SYSTEM_OPTION = "DingTalkSynSystemOption"; |
||||
|
||||
public DingTalkSystemOption() { |
||||
} |
||||
|
||||
public String id() { |
||||
return DING_TALK_SYN_SYSTEM_OPTION; |
||||
} |
||||
|
||||
public String displayName() { |
||||
return I18nKit.getLocText("Plugin-dingtalksyn_DingTalk_Manager"); |
||||
} |
||||
|
||||
public int sortIndex() { |
||||
return 2; |
||||
} |
||||
|
||||
public Atom attach() { |
||||
return MainComponent.KEY; |
||||
} |
||||
|
||||
public Atom client() { |
||||
return DingTalkComponent.KEY; |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: LifeCycleMonitorImpl |
||||
* Author: Louis |
||||
* Date: 2021/3/30 15:10 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.provider; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.xxxx.dingtalksyn.helper.DingTalkScheduleHelper; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.helper.DingTalkScheduleHelper.DINGTALK_SCHEDULE_SYN_MEMBER_GROUP; |
||||
import static com.fr.plugin.xxxx.dingtalksyn.helper.DingTalkScheduleHelper.DINGTALK_SCHEDULE_SYN_MEMBER_JOB_NAME; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LifeCycleMonitorImpl> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class LifeCycleMonitorImpl extends AbstractPluginLifecycleMonitor { |
||||
public LifeCycleMonitorImpl() { |
||||
} |
||||
|
||||
@Override |
||||
public void afterRun(PluginContext pluginContext) { |
||||
DingSynConfig.getInstance(); |
||||
this.reStartSchedule(); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
DingTalkScheduleHelper.getInstance().stopSchedule(DINGTALK_SCHEDULE_SYN_MEMBER_JOB_NAME, DINGTALK_SCHEDULE_SYN_MEMBER_GROUP); |
||||
} |
||||
|
||||
private void reStartSchedule() { |
||||
try { |
||||
String cronCondition = DingSynConfig.getInstance().getCronCondition(); |
||||
DingTalkScheduleHelper.getInstance().startSynMemberSchedule(cronCondition); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* Copyright (C), 2018-2020 |
||||
* Project: starter |
||||
* FileName: LocaleFinder |
||||
* Author: Louis |
||||
* Date: 2020/8/31 22:19 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.provider; |
||||
|
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
import com.fr.stable.fun.Authorize; |
||||
import com.fr.stable.fun.impl.AbstractLocaleFinder; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LocaleFinder> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@EnableMetrics |
||||
@Authorize(callSignKey = LocaleFinder.PLUGIN_ID) |
||||
public class LocaleFinder extends AbstractLocaleFinder { |
||||
public static final String PLUGIN_ID = "com.fr.plugin.xxxx.dingtalksyn.job"; |
||||
|
||||
@Override |
||||
@Focus(id = PLUGIN_ID, text = "Plugin-dingtalksyn", source = Original.PLUGIN) |
||||
public String find() { |
||||
if (PluginContexts.currentContext().isAvailable()) { |
||||
return "com/fr/plugin/xxxx/dingtalksyn/locale/lang"; |
||||
} |
||||
return StringKit.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkComponent |
||||
* Author: Louis |
||||
* Date: 2021/6/22 16:46 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.provider.components; |
||||
|
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkComponent> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkComponent extends Component { |
||||
public static DingTalkComponent KEY = new DingTalkComponent(); |
||||
|
||||
public DingTalkComponent() { |
||||
} |
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient client) { |
||||
return ScriptPath.build("/com/fr/plugin/xxxx/dingtalksyn/web/dingtalk.js"); |
||||
} |
||||
|
||||
@Override |
||||
public StylePath style(RequestClient client) { |
||||
return StylePath.build("/com/fr/plugin/officialaccount/web/dingtalk.css"); |
||||
} |
||||
} |
@ -0,0 +1,404 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: CallBackController |
||||
* Author: Louis |
||||
* Date: 2021/3/29 22:36 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.request; |
||||
|
||||
import com.dingtalk.api.response.OapiRoleGetroleResponse; |
||||
import com.dingtalk.api.response.OapiV2DepartmentGetResponse; |
||||
import com.dingtalk.api.response.OapiV2UserGetResponse; |
||||
import com.dingtalk.oapi.lib.aes.DingTalkEncryptor; |
||||
import com.fanruan.api.decision.user.UserKit; |
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.authority.base.constant.type.operation.ManualOperationType; |
||||
import com.fr.decision.authority.data.User; |
||||
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||
import com.fr.decision.webservice.bean.user.RoleBean; |
||||
import com.fr.decision.webservice.bean.user.UserBean; |
||||
import com.fr.decision.webservice.bean.user.UserUpdateBean; |
||||
import com.fr.decision.webservice.v10.user.CustomRoleService; |
||||
import com.fr.decision.webservice.v10.user.DepartmentService; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.plugin.xxxx.dingtalksyn.bean.DataResponse; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.CustomRoleServiceKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.DepartmentServiceKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.UserServiceKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.utils.DingTokenUtils; |
||||
import com.fr.third.springframework.stereotype.Controller; |
||||
import com.fr.third.springframework.web.bind.annotation.*; |
||||
import com.taobao.api.ApiException; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.utils.DingAPI.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <CallBackController> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("dingCallback") |
||||
public class CallBackController { |
||||
|
||||
/** |
||||
* 测试检查url |
||||
*/ |
||||
public static final String EVENT_CHECK_URL = "check_url"; |
||||
/** |
||||
* 创建应用,验证回调URL创建有效事件(第一次保存回调URL之前) |
||||
*/ |
||||
public static final String EVENT_CHECK_CREATE_SUITE_URL = "check_create_suite_url"; |
||||
/** |
||||
* 创建应用,验证回调URL变更有效事件(第一次保存回调URL之后) |
||||
*/ |
||||
public static final String EVENT_CHECK_UPADTE_SUITE_URL = "check_update_suite_url"; |
||||
/** |
||||
* suite_ticket推送事件 |
||||
*/ |
||||
public static final String EVENT_SUITE_TICKET = "suite_ticket"; |
||||
/** |
||||
* 企业授权开通应用事件 |
||||
*/ |
||||
public static final String EVENT_TMP_AUTH_CODE = "tmp_auth_code"; |
||||
public static final String USER_ADD_ORG = "user_add_org"; |
||||
public static final String USER_MODIFY_ORG = "user_modify_org"; |
||||
public static final String USER_LEAVE_ORG = "user_leave_org"; |
||||
public static final String USER_ACTIVE_ORG = "user_active_org"; |
||||
public static final String ORG_DEPT_CREATE = "org_dept_create"; |
||||
public static final String ORG_DEPT_MODIFY = "org_dept_modify"; |
||||
public static final String ORG_DEPT_REMOVE = "org_dept_remove"; |
||||
public static final String LABEL_USER_CHANGE = "label_user_change"; |
||||
public static final String LABEL_CONF_ADD = "label_conf_add"; |
||||
public static final String LABEL_CONF_DEL = "label_conf_del"; |
||||
public static final String LABEL_CONF_MODIFY = "label_conf_modify"; |
||||
public static final String ACTION_ADD = "add"; |
||||
public static final String ACTION_REMOVE = "remove"; |
||||
|
||||
private DingSynConfig config; |
||||
private String adminName; |
||||
|
||||
public CallBackController() { |
||||
this.config = DingSynConfig.getInstance(); |
||||
} |
||||
|
||||
@RequestMapping(method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@LoginStatusChecker(required = false) |
||||
public DataResponse doAction(@RequestParam(value = "signature") String signature, |
||||
@RequestParam(value = "timestamp") Long timestamp, |
||||
@RequestParam(value = "nonce") String nonce, |
||||
@RequestBody(required = false) String bodyContent, |
||||
HttpServletResponse res) { |
||||
if (!PluginContexts.currentContext().isAvailable()) { |
||||
DingSynConfig.getInstance().setSsoEnable(false); |
||||
return DataResponse.error("501", I18nKit.getLocText("Plugin-dingtalksyn_Error_501")); |
||||
} |
||||
try { |
||||
JSONObject bodyJson = new JSONObject(bodyContent); |
||||
String encryptMsg = bodyJson.getString("encrypt"); |
||||
DingTalkEncryptor dingTalkEncryptor = new DingTalkEncryptor(this.config.getToken(), this.config.getAesKey(), this.config.getAppKey()); |
||||
String decryptMsg = dingTalkEncryptor.getDecryptMsg(signature, timestamp.toString(), nonce, encryptMsg); |
||||
JSONObject event = new JSONObject(decryptMsg); |
||||
this.adminName = UserService.getInstance().getAdminUserNameList().get(0); |
||||
setHeader(res); |
||||
operation(event); |
||||
return DataResponse.success(dingTalkEncryptor.getEncryptedMap("success", timestamp, nonce)); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
return DataResponse.error("500", I18nKit.getLocText("Plugin-dingtalksyn_Error_500")); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 企业应用业务事件处理 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void operation(JSONObject event) throws Exception { |
||||
String eventType = event.getString("EventType"); |
||||
LogKit.info("dingtalksyn-CallBackController-operation-eventType:{}", eventType); |
||||
switch (eventType) { |
||||
case EVENT_CHECK_URL: |
||||
// 测试回调url事件 无操作,只返回success信息
|
||||
break; |
||||
case EVENT_CHECK_CREATE_SUITE_URL: |
||||
// 验证新创建的回调URL,只返回success信息
|
||||
break; |
||||
case EVENT_CHECK_UPADTE_SUITE_URL: |
||||
// 验证更新回调URL,只返回success信息
|
||||
break; |
||||
case EVENT_SUITE_TICKET: |
||||
// 推送suite_ticket事件,保存
|
||||
DingTokenUtils.setSuiteTicket(event.getString("SuiteTicket")); |
||||
break; |
||||
case USER_ADD_ORG: |
||||
createUser(event); |
||||
break; |
||||
case USER_MODIFY_ORG: |
||||
updateUser(event); |
||||
break; |
||||
case USER_LEAVE_ORG: |
||||
deleteUser(event); |
||||
break; |
||||
case USER_ACTIVE_ORG: |
||||
addOrUpdateUser(event); |
||||
break; |
||||
case ORG_DEPT_CREATE: |
||||
createOrganization(event); |
||||
break; |
||||
case ORG_DEPT_MODIFY: |
||||
updateOrganization(event); |
||||
break; |
||||
case ORG_DEPT_REMOVE: |
||||
deleteOrganization(event); |
||||
break; |
||||
case LABEL_USER_CHANGE: |
||||
changeRoleUsers(event); |
||||
break; |
||||
case LABEL_CONF_ADD: |
||||
addRoles(event); |
||||
break; |
||||
case LABEL_CONF_DEL: |
||||
deleteRoles(event); |
||||
break; |
||||
case LABEL_CONF_MODIFY: |
||||
updateRoles(event); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 员工角色信息发生变更 |
||||
* |
||||
* @param event |
||||
*/ |
||||
private void changeRoleUsers(JSONObject event) throws Exception { |
||||
String action = event.getString("action"); |
||||
JSONArray roleIdArray = event.getJSONArray("LabelIdList"); |
||||
JSONArray userIdArray = event.getJSONArray("UserIdList"); |
||||
String[] userIds = new String[userIdArray.size()]; |
||||
for (int i = 0; i < userIdArray.size(); i++) { |
||||
User user = UserService.getInstance().getUserByUserName(userIdArray.getString(i)); |
||||
if (user == null) { |
||||
continue; |
||||
} |
||||
userIds[i] = user.getId(); |
||||
} |
||||
UserUpdateBean userUpdateBean; |
||||
for (int j = 0; j < roleIdArray.size(); j++) { |
||||
userUpdateBean = new UserUpdateBean(); |
||||
if (StringKit.equals(action, ACTION_ADD)) { |
||||
userUpdateBean.setAddUserIds(userIds); |
||||
} |
||||
if (StringKit.equals(action, ACTION_REMOVE)) { |
||||
userUpdateBean.setRemoveUserIds(userIds); |
||||
} |
||||
UserServiceKit.getInstance().updateRoleUsers(roleIdArray.getString(j), userUpdateBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 修改角色或者角色组 |
||||
* |
||||
* @param event |
||||
*/ |
||||
private void updateRoles(JSONObject event) throws Exception { |
||||
JSONArray roleIds = event.getJSONArray("LabelIdList"); |
||||
for (int i = 0; i < roleIds.size(); i++) { |
||||
OapiRoleGetroleResponse.OpenRole openRole = getRoleResponse(roleIds.getLong(i)); |
||||
RoleBean roleBean = CustomRoleService.getInstance().getCustomRole(roleIds.getString(i)); |
||||
roleBean.setText(openRole.getName()); |
||||
roleBean.setDescription(openRole.getName()); |
||||
CustomRoleService.getInstance().editCustomRole(roleBean.getId(), roleBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除角色或者角色组 |
||||
* |
||||
* @param event |
||||
*/ |
||||
private void deleteRoles(JSONObject event) throws Exception { |
||||
JSONArray roleIds = event.getJSONArray("LabelIdList"); |
||||
for (int i = 0; i < roleIds.size(); i++) { |
||||
CustomRoleService.getInstance().deleteCustomRole(roleIds.getString(i)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 增加角色或者角色组 |
||||
* |
||||
* @param event |
||||
* @throws ApiException |
||||
*/ |
||||
private void addRoles(JSONObject event) throws Exception { |
||||
JSONArray roleIds = event.getJSONArray("LabelIdList"); |
||||
long roleId; |
||||
for (int i = 0; i < roleIds.size(); i++) { |
||||
roleId = roleIds.getLong(i); |
||||
OapiRoleGetroleResponse.OpenRole openRole = getRoleResponse(roleId); |
||||
RoleBean roleBean = new RoleBean(openRole.getName(), String.valueOf(roleId), openRole.getName(), ManualOperationType.KEY.toInteger()); |
||||
CustomRoleServiceKit.getInstance().addCustomRole(UserServiceKit.getInstance().getAdminUserId(), roleBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通讯录企业部门创建 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void createOrganization(JSONObject event) throws Exception { |
||||
JSONArray deptIds = event.getJSONArray("DeptId"); |
||||
long deptId; |
||||
for (int i = 0; i < deptIds.size(); i++) { |
||||
deptId = deptIds.getLong(i); |
||||
OapiV2DepartmentGetResponse.DeptGetResponse deptGetResponse = getDeptResponse(deptId); |
||||
String parentId = String.valueOf(deptGetResponse.getParentId()); |
||||
parentId = DepartmentServiceKit.getInstance().changeRootId(parentId); |
||||
String depName = deptGetResponse.getName(); |
||||
DepartmentServiceKit.getInstance().addDepartment(String.valueOf(deptId), parentId, depName); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新组织事件 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void updateOrganization(JSONObject event) throws Exception { |
||||
JSONArray deptIds = event.getJSONArray("DeptId"); |
||||
long deptId; |
||||
for (int i = 0; i < deptIds.size(); i++) { |
||||
deptId = deptIds.getLong(i); |
||||
OapiV2DepartmentGetResponse.DeptGetResponse deptGetResponse = getDeptResponse(deptId); |
||||
String departmentId = String.valueOf(deptGetResponse.getDeptId()); |
||||
String depName = deptGetResponse.getName(); |
||||
String parentId = String.valueOf(deptGetResponse.getParentId()); |
||||
parentId = DepartmentServiceKit.getInstance().changeRootId(parentId); |
||||
DepartmentServiceKit.getInstance().editDepartment(departmentId, depName, parentId); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除组织事件 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void deleteOrganization(JSONObject event) throws Exception { |
||||
JSONArray deptIds = event.getJSONArray("DeptId"); |
||||
for (int i = 0; i < deptIds.size(); i++) { |
||||
DepartmentService.getInstance().deleteDepartment(deptIds.getString(i)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 新增用户事件 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void createUser(JSONObject event) throws Exception { |
||||
JSONArray userIds = event.getJSONArray("UserId"); |
||||
String userId; |
||||
for (int i = 0; i < userIds.size(); i++) { |
||||
userId = userIds.getString(i); |
||||
OapiV2UserGetResponse.UserGetResponse userGetResponse = getUserResponse(userId); |
||||
UserBean userBean = UserServiceKit.getInstance().createUserBean(userGetResponse); |
||||
UserService.getInstance().addUser(userBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新用户事件 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void updateUser(JSONObject event) throws Exception { |
||||
JSONArray userIds = event.getJSONArray("UserId"); |
||||
String userId; |
||||
for (int i = 0; i < userIds.size(); i++) { |
||||
userId = userIds.getString(i); |
||||
OapiV2UserGetResponse.UserGetResponse userGetResponse = getUserResponse(userId); |
||||
UserBean userBean = UserServiceKit.getInstance().updateUserBean(userGetResponse); |
||||
if (userBean == null) { |
||||
continue; |
||||
} |
||||
UserServiceKit.getInstance().editUser(userBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 加入企业后用户激活 |
||||
* 新增或更新用户 |
||||
* |
||||
* @param event |
||||
* @throws Exception |
||||
*/ |
||||
private void addOrUpdateUser(JSONObject event) throws Exception { |
||||
JSONArray userIds = event.getJSONArray("UserId"); |
||||
String userId; |
||||
for (int i = 0; i < userIds.size(); i++) { |
||||
userId = userIds.getString(i); |
||||
OapiV2UserGetResponse.UserGetResponse userGetResponse = getUserResponse(userId); |
||||
UserBean userBean; |
||||
if (UserKit.existUsername(userId)) { |
||||
userBean = UserServiceKit.getInstance().updateUserBean(userGetResponse); |
||||
if (userBean == null) { |
||||
continue; |
||||
} |
||||
UserServiceKit.getInstance().editUser(userBean); |
||||
} else { |
||||
userBean = UserServiceKit.getInstance().createUserBean(userGetResponse); |
||||
UserService.getInstance().addUser(userBean); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 用户离职事件 |
||||
* |
||||
* @param event |
||||
* @return |
||||
*/ |
||||
private void deleteUser(JSONObject event) throws Exception { |
||||
JSONArray userIds = event.getJSONArray("UserId"); |
||||
User user; |
||||
for (int i = 0; i < userIds.size(); i++) { |
||||
user = UserService.getInstance().getUserByUserName(userIds.getString(i)); |
||||
String[] removeUserIds = new String[]{user.getId()}; |
||||
UserUpdateBean userUpdateBean = new UserUpdateBean(); |
||||
userUpdateBean.setRemoveUserIds(removeUserIds); |
||||
UserService.getInstance().deleteUsers(userUpdateBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 解决跨域访问问题 |
||||
* |
||||
* @param res |
||||
*/ |
||||
private void setHeader(HttpServletResponse res) { |
||||
// 跨域设置header
|
||||
res.setHeader("Access-Control-Allow-Origin", "*"); |
||||
res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
||||
res.setHeader("Access-Control-Max-Age", "3600"); |
||||
res.setHeader("Access-Control-Allow-Headers", "x-requested-with"); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkControllerBridge |
||||
* Author: Louis |
||||
* Date: 2021/3/29 22:30 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.request; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractControllerRegisterProvider; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkControllerBridge> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkControllerBridge extends AbstractControllerRegisterProvider { |
||||
@Override |
||||
public Class[] getControllers() { |
||||
return new Class[]{ |
||||
CallBackController.class |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,202 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: GlobalRequestFilterBridge |
||||
* Author: Louis |
||||
* Date: 2021/3/30 22:09 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.request; |
||||
|
||||
import com.fanruan.api.decision.login.LoginKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.net.NetworkKit; |
||||
import com.fanruan.api.net.http.HttpKit; |
||||
import com.fanruan.api.util.IOKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.base.TemplateUtils; |
||||
import com.fr.decision.fun.impl.AbstractGlobalRequestFilterProvider; |
||||
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.FilterChain; |
||||
import javax.servlet.FilterConfig; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.utils.DingAPI.GETTOKEN; |
||||
import static com.fr.plugin.xxxx.dingtalksyn.utils.DingAPI.GET_USER_INFO; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <GlobalRequestFilterBridge> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class GlobalRequestFilterBridge extends AbstractGlobalRequestFilterProvider { |
||||
public static final String TPL_PATH = "/com/fr/plugin/xxxx/dingtalksyn/web/codePage.html"; |
||||
public static final String DINGTALK_OPEN_JS = "/com/fr/plugin/xxxx/dingtalksyn/web/dingtalk.open.js"; |
||||
public static final String CODE = "code"; |
||||
public static final String DING_TALK_LOGIN = "dt"; |
||||
|
||||
private DingSynConfig config; |
||||
|
||||
/** |
||||
* 过滤器名称 |
||||
* |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public String filterName() { |
||||
return "DingTalkSynFilter"; |
||||
} |
||||
|
||||
/** |
||||
* 过滤规则 |
||||
* |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public String[] urlPatterns() { |
||||
return new String[]{"/decision/*"}; |
||||
} |
||||
|
||||
/** |
||||
* 过滤器初始化 |
||||
* |
||||
* @param filterConfig |
||||
*/ |
||||
@Override |
||||
public void init(FilterConfig filterConfig) { |
||||
this.config = DingSynConfig.getInstance(); |
||||
super.init(filterConfig); |
||||
} |
||||
|
||||
/** |
||||
* 过滤器处理 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @param filterChain |
||||
*/ |
||||
@Override |
||||
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { |
||||
try { |
||||
if (operation(request, response)) { |
||||
filterChain.doFilter(request, response); |
||||
} |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 用户验证登陆操作 |
||||
* |
||||
* @param req |
||||
* @param res |
||||
* @throws Exception |
||||
*/ |
||||
private boolean operation(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
// 判断单点功能是否开启
|
||||
if (!this.config.getSsoEnable()) { |
||||
return true; |
||||
} |
||||
String pathInfo = (req.getPathInfo() != null) ? req.getPathInfo() : StringKit.EMPTY; |
||||
if (StringKit.equals(DINGTALK_OPEN_JS, pathInfo)) { |
||||
WebUtils.printAsString(res, IOKit.readResourceAsString(DINGTALK_OPEN_JS)); |
||||
return false; |
||||
} |
||||
//DingTalk登陆参数
|
||||
String dt = NetworkKit.getHTTPRequestParameter(req, DING_TALK_LOGIN); |
||||
if (StringKit.isBlank(dt)) { |
||||
return true; |
||||
} |
||||
String code = NetworkKit.getHTTPRequestParameter(req, CODE); |
||||
LogKit.info("dingtalksyn-GlobalRequestFilterBridge-operation-code:{}", code); |
||||
if (StringKit.isEmpty(code)) { |
||||
loginPage(req, res); |
||||
return false; |
||||
} |
||||
String accessToken = getAccessToken(code); |
||||
String username = getUsername(code, accessToken); |
||||
LogKit.info("dingtalksyn-GlobalRequestFilterBridge-operation-username:{}", username); |
||||
if (StringKit.isEmpty(username)) { |
||||
return true; |
||||
} |
||||
String tokenFR = LoginKit.login(req, res, username); |
||||
req.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME, tokenFR); |
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* 钉钉获取code页面 |
||||
* |
||||
* @param req |
||||
* @param res |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
private void loginPage(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
Map<String, String> parameterMap = new HashMap<>(); |
||||
parameterMap.put("corpId", this.config.getCorpId()); |
||||
parameterMap.put("openJs", WebUtils.createServletURL(req) + DINGTALK_OPEN_JS); |
||||
parameterMap.put("remoteServletURL", getRemoteServletURL(WebUtils.getOriginalURL(req))); |
||||
String codePage = TemplateUtils.renderTemplate(TPL_PATH, parameterMap); |
||||
WebUtils.printAsString(res, codePage); |
||||
} |
||||
|
||||
/** |
||||
* 处理请求url加入code参数 |
||||
* |
||||
* @param url |
||||
* @return |
||||
*/ |
||||
private String getRemoteServletURL(String url) { |
||||
if (url.contains("?")) { |
||||
return url + "&" + CODE + "="; |
||||
} |
||||
return url + "?" + CODE + "="; |
||||
} |
||||
|
||||
/** |
||||
* 获取access_token |
||||
* |
||||
* @param code |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
private String getAccessToken(String code) throws Exception { |
||||
Map<String, String> tokenParams = new HashMap<>(); |
||||
tokenParams.put("appkey", this.config.getAppKey()); |
||||
tokenParams.put("appsecret", this.config.getAppSecret()); |
||||
tokenParams.put("code", code); |
||||
LogKit.info("dingtalksyn-GlobalRequestFilterBridge-getAccessToken-params:{}", tokenParams); |
||||
String res = HttpKit.get(GETTOKEN, tokenParams); |
||||
LogKit.info("dingtalksyn-GlobalRequestFilterBridge-getAccessToken-res:{}", res); |
||||
if (StringKit.isEmpty(res)) { |
||||
return StringKit.EMPTY; |
||||
} |
||||
return new JSONObject(res).getString("access_token"); |
||||
} |
||||
|
||||
/** |
||||
* 通过凭证获得username |
||||
* |
||||
* @param code |
||||
* @param accessToken |
||||
* @return |
||||
*/ |
||||
private String getUsername(String code, String accessToken) throws Exception { |
||||
Map<String, String> userInfoParams = new HashMap<>(); |
||||
userInfoParams.put("access_token", accessToken); |
||||
userInfoParams.put("code", code); |
||||
String userRes = HttpKit.get(GET_USER_INFO, userInfoParams); |
||||
LogKit.info("dingtalksyn-GlobalRequestFilterBridge-getUsername-userRes:{}", userRes); |
||||
return new JSONObject(userRes).getString("userid"); |
||||
} |
||||
} |
@ -0,0 +1,177 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkUserManager |
||||
* Author: Louis |
||||
* Date: 2021/4/21 16:18 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.user; |
||||
|
||||
import com.dingtalk.api.response.OapiRoleListResponse; |
||||
import com.dingtalk.api.response.OapiV2DepartmentListsubResponse; |
||||
import com.dingtalk.api.response.OapiV2UserGetResponse; |
||||
import com.fanruan.api.decision.user.UserKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.base.constant.type.operation.ManualOperationType; |
||||
import com.fr.decision.authority.data.Department; |
||||
import com.fr.decision.webservice.bean.user.RoleBean; |
||||
import com.fr.decision.webservice.bean.user.UserBean; |
||||
import com.fr.decision.webservice.v10.user.CustomRoleService; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.CustomRoleServiceKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.DepartmentServiceKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.kit.UserServiceKit; |
||||
import com.taobao.api.ApiException; |
||||
|
||||
import java.util.List; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.utils.DingAPI.*; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkUserManager> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public final class DingTalkUserManager { |
||||
private DingSynConfig config; |
||||
|
||||
public DingTalkUserManager() { |
||||
this.config = DingSynConfig.getInstance(); |
||||
} |
||||
|
||||
private static class HOLDER { |
||||
private static final DingTalkUserManager INSTANCE = new DingTalkUserManager(); |
||||
} |
||||
public static DingTalkUserManager getInstance() { |
||||
return HOLDER.INSTANCE; |
||||
} |
||||
|
||||
/** |
||||
* 同步更新的字段包括:用户、邮箱、手机、部门、职位、角色。 |
||||
* 用户唯一字段用户名,更新时也是基于用户名。 |
||||
* |
||||
* @throws Exception |
||||
*/ |
||||
public synchronized void synDingTalkUsers() throws Exception { |
||||
LogKit.info("dingtalksyn-DingTalkUserManager-synDingTalkUsers-start"); |
||||
// 同步用户角色
|
||||
List<OapiRoleListResponse.OpenRoleGroup> oapiRoleGroupList = getOapiRoleList(); |
||||
for (OapiRoleListResponse.OpenRoleGroup openRoleGroup : oapiRoleGroupList) { |
||||
List<OapiRoleListResponse.OpenRole> openRoleList = openRoleGroup.getRoles(); |
||||
for (OapiRoleListResponse.OpenRole openRole : openRoleList) { |
||||
roleSynOperation(openRoleGroup.getName(), openRole); |
||||
} |
||||
} |
||||
// 同步部门和用户信息
|
||||
departmentSynLoop(this.config.getRootDepId()); |
||||
LogKit.info("dingtalksyn-DingTalkUserManager-synDingTalkUsers-end"); |
||||
} |
||||
|
||||
/** |
||||
* 按部门遍历子部门并同步人员信息 |
||||
* |
||||
* @param deptId |
||||
* @throws Exception |
||||
*/ |
||||
private void departmentSynLoop(long deptId) throws ApiException { |
||||
List<OapiV2DepartmentListsubResponse.DeptBaseResponse> departmentList = getDepartmentList(deptId); |
||||
if (departmentList == null || departmentList.isEmpty()) { |
||||
return; |
||||
} |
||||
// 同步部门信息
|
||||
for (OapiV2DepartmentListsubResponse.DeptBaseResponse oapiDepartment : departmentList) { |
||||
try { |
||||
departmentSynOperation(oapiDepartment); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
// 同步当前部门的用户信息
|
||||
List<String> deptMemberList = getDeptMember(oapiDepartment.getDeptId()); |
||||
for (String userId : deptMemberList) { |
||||
try { |
||||
OapiV2UserGetResponse.UserGetResponse userGetResponse = getUserResponse(userId); |
||||
if (userGetResponse == null) { |
||||
continue; |
||||
} |
||||
userSynOperation(userGetResponse); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
// 操作子部门遍历
|
||||
departmentSynLoop(oapiDepartment.getDeptId()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 角色的新增更新操作 |
||||
* |
||||
* @param openRole |
||||
* @throws Exception |
||||
*/ |
||||
private void roleSynOperation(String groupName, OapiRoleListResponse.OpenRole openRole) throws Exception { |
||||
if (openRole == null) { |
||||
return; |
||||
} |
||||
RoleBean roleBean = CustomRoleService.getInstance().getCustomRole(String.valueOf(openRole.getId())); |
||||
String roleName = StringKit.isBlank(groupName) ? openRole.getName() : groupName + "-" + openRole.getName(); |
||||
if (roleBean == null) { |
||||
roleBean = new RoleBean(roleName, String.valueOf(openRole.getId()), roleName, ManualOperationType.KEY.toInteger()); |
||||
CustomRoleServiceKit.getInstance().addCustomRole(UserServiceKit.getInstance().getAdminUserId(), roleBean); |
||||
} else if (!StringKit.equals(roleBean.getText(), roleName)) { |
||||
roleBean.setText(roleName); |
||||
roleBean.setDescription(roleName); |
||||
CustomRoleService.getInstance().editCustomRole(roleBean.getId(), roleBean); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 部门组织的新增更新操作 |
||||
* |
||||
* @param oapiDepartment |
||||
* @throws Exception |
||||
*/ |
||||
private void departmentSynOperation(OapiV2DepartmentListsubResponse.DeptBaseResponse oapiDepartment) throws Exception { |
||||
String departmentId = String.valueOf(oapiDepartment.getDeptId()); |
||||
String parentId = String.valueOf(oapiDepartment.getParentId()); |
||||
parentId = DepartmentServiceKit.getInstance().changeRootId(parentId); |
||||
String depName = oapiDepartment.getName(); |
||||
Department department = AuthorityContext.getInstance().getDepartmentController().getById(departmentId); |
||||
if (department == null) { |
||||
DepartmentServiceKit.getInstance().addDepartment(departmentId, parentId, depName); |
||||
} else { |
||||
DepartmentServiceKit.getInstance().editDepartment(department.getId(), depName, parentId); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 用户新增更新操作 |
||||
* |
||||
* @param userGetResponse |
||||
* @throws Exception |
||||
*/ |
||||
private void userSynOperation(OapiV2UserGetResponse.UserGetResponse userGetResponse) throws Exception { |
||||
UserBean userBean; |
||||
if (UserKit.existUsername(userGetResponse.getUserid())) { |
||||
userBean = UserServiceKit.getInstance().updateUserBean(userGetResponse); |
||||
if (userBean == null) { |
||||
return; |
||||
} |
||||
UserServiceKit.getInstance().editUser(userBean); |
||||
} else { |
||||
userBean = UserServiceKit.getInstance().createUserBean(userGetResponse); |
||||
try { |
||||
UserService.getInstance().addUser(userBean); |
||||
} catch (Exception e) { |
||||
LogKit.error("dingtalksyn-DingTalkUserManager-userSynOperation-Username:{}, RealName:{}, Mobile:{}, Email:{}", |
||||
userBean.getUsername(), userBean.getRealName(), userBean.getMobile(), userBean.getEmail()); |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,150 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingAPI |
||||
* Author: Louis |
||||
* Date: 2021/5/13 16:16 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.utils; |
||||
|
||||
import com.dingtalk.api.DefaultDingTalkClient; |
||||
import com.dingtalk.api.DingTalkClient; |
||||
import com.dingtalk.api.request.*; |
||||
import com.dingtalk.api.response.*; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.taobao.api.ApiException; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingAPI> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingAPI { |
||||
public static final int TOKEN_EXPIRE_TIME = 3600000; |
||||
/** |
||||
* 获取企业内部应用的access_token |
||||
*/ |
||||
public static final String GETTOKEN = "https://oapi.dingtalk.com/gettoken"; |
||||
/** |
||||
* 通过免登码获取用户信息 |
||||
*/ |
||||
public static final String GET_USER_INFO = "https://oapi.dingtalk.com/user/getuserinfo"; |
||||
public static final String USER_GET = "https://oapi.dingtalk.com/topapi/v2/user/get"; |
||||
public static final String DEPARTMENT_LIST = "https://oapi.dingtalk.com/topapi/v2/department/listsub"; |
||||
public static final String GET_DEPT_MEMBER = "https://oapi.dingtalk.com/topapi/user/listid"; |
||||
public static final String GET_DEPT = "https://oapi.dingtalk.com/topapi/v2/department/get"; |
||||
public static final String ROLE_LIST = "https://oapi.dingtalk.com/topapi/role/list"; |
||||
public static final String GETROLE = "https://oapi.dingtalk.com/topapi/role/getrole"; |
||||
|
||||
/** |
||||
* 根据deptId获取用户详情 |
||||
* |
||||
* @param deptId |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static OapiV2DepartmentGetResponse.DeptGetResponse getDeptResponse(long deptId) throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(GET_DEPT); |
||||
OapiV2DepartmentGetRequest req = new OapiV2DepartmentGetRequest(); |
||||
req.setDeptId(deptId); |
||||
req.setLanguage("zh_CN"); |
||||
OapiV2DepartmentGetResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getResult(); |
||||
} |
||||
|
||||
/** |
||||
* 获取部门用户userid列表 |
||||
* |
||||
* @param deptId |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static List<String> getDeptMember(long deptId) throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(GET_DEPT_MEMBER); |
||||
OapiUserListidRequest req = new OapiUserListidRequest(); |
||||
req.setDeptId(deptId); |
||||
OapiUserListidResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getResult().getUseridList(); |
||||
} |
||||
|
||||
/** |
||||
* 获取部门列表 |
||||
* |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static List<OapiV2DepartmentListsubResponse.DeptBaseResponse> getDepartmentList(long deptId) throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(DEPARTMENT_LIST); |
||||
OapiV2DepartmentListsubRequest req = new OapiV2DepartmentListsubRequest(); |
||||
req.setDeptId(deptId); |
||||
req.setLanguage("zh_CN"); |
||||
OapiV2DepartmentListsubResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getResult(); |
||||
} |
||||
|
||||
/** |
||||
* 根据roleId获取角色详情 |
||||
* |
||||
* @param roleId |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static OapiRoleGetroleResponse.OpenRole getRoleResponse(long roleId) throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(GETROLE); |
||||
OapiRoleGetroleRequest req = new OapiRoleGetroleRequest(); |
||||
req.setRoleId(roleId); |
||||
OapiRoleGetroleResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getRole(); |
||||
} |
||||
|
||||
/** |
||||
* 获取角色列表 |
||||
* |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static List<OapiRoleListResponse.OpenRoleGroup> getOapiRoleList() throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(ROLE_LIST); |
||||
OapiRoleListRequest req = new OapiRoleListRequest(); |
||||
req.setSize(200L); |
||||
req.setOffset(0L); |
||||
OapiRoleListResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getResult().getList(); |
||||
} |
||||
|
||||
/** |
||||
* 根据userid获取用户详情 |
||||
* |
||||
* @param userId |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static OapiV2UserGetResponse.UserGetResponse getUserResponse(String userId) throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(USER_GET); |
||||
OapiV2UserGetRequest req = new OapiV2UserGetRequest(); |
||||
req.setUserid(userId); |
||||
req.setLanguage("zh_CN"); |
||||
OapiV2UserGetResponse rsp = client.execute(req, DingTokenUtils.getAccessToken()); |
||||
return rsp.getResult(); |
||||
} |
||||
|
||||
/** |
||||
* 获取企业内部应用的access_token |
||||
* |
||||
* @return |
||||
* @throws ApiException |
||||
*/ |
||||
public static String getAccessToken() throws ApiException { |
||||
DingTalkClient client = new DefaultDingTalkClient(GETTOKEN); |
||||
OapiGettokenRequest request = new OapiGettokenRequest(); |
||||
request.setAppkey(DingSynConfig.getInstance().getAppKey()); |
||||
request.setAppsecret(DingSynConfig.getInstance().getAppSecret()); |
||||
request.setHttpMethod("GET"); |
||||
OapiGettokenResponse response = client.execute(request); |
||||
return response.getAccessToken(); |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkAuthorityUtils |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:23 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.utils; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.decision.authority.base.constant.type.authority.ViewAuthorityType; |
||||
import com.fr.decision.config.FSConfig; |
||||
import com.fr.decision.webservice.utils.ControllerFactory; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.license.function.VT4FR; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkAuthorityUtils> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkAuthorityUtils { |
||||
public DingTalkAuthorityUtils() { |
||||
} |
||||
|
||||
public static boolean hasModulePrivilege(String userId, String entityId) throws Exception { |
||||
try { |
||||
if (UserService.getInstance().isAdmin(userId)) { |
||||
return true; |
||||
} else { |
||||
return VT4FR.MultiPrivilege.isSupport() && FSConfig.getInstance().getAuthorizeAttr().isGradeAuthority() && ControllerFactory.getInstance().getEntryController(userId).doesUserHasEntityAuth(userId, entityId, ViewAuthorityType.TYPE); |
||||
} |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
throw e; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTalkLogUtil |
||||
* Author: Louis |
||||
* Date: 2021/6/24 22:29 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.utils; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingTalkMemberManagementConfig; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTalkLogUtil> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTalkLogUtil { |
||||
public DingTalkLogUtil() { |
||||
} |
||||
|
||||
public static String getMatchWay() { |
||||
DingTalkMemberManagementConfig var0 = DingSynConfig.getInstance().getMemberManagementConfig(); |
||||
switch (var0.getMatchingFSWay()) { |
||||
case 0: |
||||
return "工号匹配"; |
||||
case 1: |
||||
return "手机号匹配"; |
||||
case 2: |
||||
return "手动匹配"; |
||||
case 3: |
||||
return "数据集匹配"; |
||||
default: |
||||
return ""; |
||||
} |
||||
} |
||||
|
||||
public static String transformMessageType(int msgType) { |
||||
switch (msgType) { |
||||
case 0: |
||||
default: |
||||
return "未知消息类型"; |
||||
case 1: |
||||
return "链接消息"; |
||||
case 2: |
||||
return "图文消息"; |
||||
case 3: |
||||
return "文件消息"; |
||||
} |
||||
} |
||||
|
||||
public static void warn(String msg, int errorCode) { |
||||
LogKit.warn(msg + ",错误码为:" + errorCode + ",更多信息请参考" + "https://help.fanruan.com/finereport/doc-view-4051.html"); |
||||
} |
||||
|
||||
public static void error(String msg, int errorCode) { |
||||
error(msg, (Exception) null, errorCode); |
||||
} |
||||
|
||||
public static void error(String msg, Exception e, int errorCode) { |
||||
LogKit.error(msg + ",错误码为:" + errorCode + ",更多信息请参考" + "https://help.fanruan.com/finereport/doc-view-4051.html", e); |
||||
} |
||||
} |
@ -0,0 +1,67 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: DingTokenUtils |
||||
* Author: Louis |
||||
* Date: 2021/5/14 14:23 |
||||
*/ |
||||
package com.fr.plugin.xxxx.dingtalksyn.utils; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.plugin.xxxx.dingtalksyn.config.DingSynConfig; |
||||
import com.fr.store.StateHubManager; |
||||
import com.fr.store.StateHubService; |
||||
|
||||
import static com.fr.plugin.xxxx.dingtalksyn.utils.DingAPI.TOKEN_EXPIRE_TIME; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DingTokenUtils> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DingTokenUtils { |
||||
|
||||
public static final String DINGTALKSYN_ACCESS_TOKEN = "dingtalksyn_access_token"; |
||||
public static final String DINGTALKSYN_SUITE_TICKET = "dingtalksyn_suite_ticket"; |
||||
|
||||
private static final StateHubService tokenService = StateHubManager.applyForService(DINGTALKSYN_ACCESS_TOKEN); |
||||
private static final StateHubService ticketService = StateHubManager.applyForService(DINGTALKSYN_SUITE_TICKET); |
||||
|
||||
public DingTokenUtils() { |
||||
} |
||||
|
||||
/** |
||||
* 缓存钉钉端AccessToken |
||||
* |
||||
* @return |
||||
*/ |
||||
public static String getAccessToken() { |
||||
String appKey = DingSynConfig.getInstance().getAppKey(); |
||||
try { |
||||
if (StringKit.isBlank(tokenService.get(appKey))) { |
||||
tokenService.put(appKey, DingAPI.getAccessToken(), TOKEN_EXPIRE_TIME); |
||||
} |
||||
return tokenService.get(appKey); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
return StringKit.EMPTY; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 缓存钉钉端SuiteTicket |
||||
* |
||||
* @return |
||||
*/ |
||||
public static void setSuiteTicket(String suiteTicket) { |
||||
String appKey = DingSynConfig.getInstance().getAppKey(); |
||||
try { |
||||
ticketService.put(appKey, suiteTicket, TOKEN_EXPIRE_TIME); |
||||
} catch (Exception e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,188 @@
|
||||
Plugin-dingtalksyn=DingTalk syn Plugin |
||||
Plugin-dingtalksyn_Group=DingTalk syn Plugin |
||||
Plugin-dingtalksyn_Config_CronCondition=Cron Condition |
||||
Plugin-dingtalksyn_Config_CronCondition_Description=Cron Condition |
||||
Plugin-dingtalksyn_Config_appKey=APPKEY |
||||
Plugin-dingtalksyn_Config_appKey_Description=APPKEY |
||||
Plugin-dingtalksyn_Config_appSecret=appSecret |
||||
Plugin-dingtalksyn_Config_appSecret_Description=appSecret |
||||
Plugin-dingtalksyn_Config_corpId=Corp Id |
||||
Plugin-dingtalksyn_Config_corpId_Description=Corp Id |
||||
Plugin-dingtalksyn_Config_rootDepId=Root Department ID |
||||
Plugin-dingtalksyn_Config_rootDepId_Description=Root Department ID |
||||
Plugin-dingtalksyn_Config_Token=Token |
||||
Plugin-dingtalksyn_Config_Token_Description=Token |
||||
Plugin-dingtalksyn_Config_AesKey=AesKey |
||||
Plugin-dingtalksyn_Config_AesKey_Description=AesKey |
||||
Plugin-dingtalksyn_Config_SsoEnable=Sso Enable |
||||
Plugin-dingtalksyn_Config_SsoEnable_Description=Sso Enable |
||||
Plugin-dingtalksyn_Error_500=error |
||||
Plugin-dingtalksyn_Error_501=DingTalkSyn Plugin License Expired! |
||||
## \u524D\u7AEFjs |
||||
Plugin-dingtalksyn_DingTalk_Manager=DingTalk Sync |
||||
|
||||
Dec-Module-DingTalkSyn_Manager=Dec-Module-DingTalkSyn_Manager |
||||
Dec-DingTalkSyn_Basic=Dec-DingTalkSyn_Basic |
||||
Dec-DingTalkSyn_Recive_Data_URL=Dec-DingTalkSyn_Recive_Data_URL |
||||
Dec-DingTalkSyn_Corp_ID=Dec-DingTalkSyn_Corp_ID |
||||
Dec-DingTalkSyn_Secret=Dec-DingTalkSyn_Secret |
||||
Dec-DingTalkSyn_Member_Management=Dec-DingTalkSyn_Member_Management |
||||
Dec-DingTalkSyn_User-Same-With-FS=Dec-DingTalkSyn_User-Same-With-FS |
||||
Dec-DingTalkSyn_Mobile-Same-With-FS=Dec-DingTalkSyn_Mobile-Same-With-FS |
||||
Dec-DingTalkSyn_Manual-Matching-FS=Dec-DingTalkSyn_Manual-Matching-FS |
||||
Dec-DingTalkSyn_Custom-Matching-FS=Dec-DingTalkSyn_Custom-Matching-FS |
||||
Dec-DingTalkSyn_UserID=Dec-DingTalkSyn_UserID |
||||
Dec-DingTalkSyn_DecUserName=Dec-DingTalkSyn_DecUserName |
||||
Dec-DingTalkSyn_Name=Dec-DingTalkSyn_Name |
||||
Dec-DingTalkSyn_Department=Dec-DingTalkSyn_Department |
||||
Dec-DingTalkSyn_User_Job_Name=Dec-DingTalkSyn_User_Job_Name |
||||
Dec-Schedule-Notification_DingTalkSyn=Dec-Schedule-Notification_DingTalkSyn |
||||
Dec-Schedule-Notification_DingTalkSyn_CorpID=Dec-Schedule-Notification_DingTalkSyn_CorpID |
||||
Dec-Schedule-Notification_DingTalkSyn_Users=Dec-Schedule-Notification_DingTalkSyn_Users |
||||
Dec-Schedule-Notification_DingTalkSyn_DepID=Dec-Schedule-Notification_DingTalkSyn_DepID |
||||
Dec-Schedule-Notification_DingTalkSyn_Content=Dec-Schedule-Notification_DingTalkSyn_Content |
||||
Dec-Schedule-Notification_DingTalkSyn_WithLink=Dec-Schedule-Notification_DingTalkSyn_WithLink |
||||
Dec-Schedule_Mobile-Push-DingTalkSynId-Not-Null=Dec-Schedule_Mobile-Push-DingTalkSynId-Not-Null |
||||
Dec-DingTalkSyn_UrlHint=Dec-DingTalkSyn_UrlHint |
||||
Dec-DingTalkSyn_Token_Path=Dec-DingTalkSyn_Token_Path |
||||
Dec-DingTalkSyn_Refresh_User=Dec-DingTalkSyn_Refresh_User |
||||
Dec-DingTalkSyn_Mobile=Dec-DingTalkSyn_Mobile |
||||
Dec-DingTalkSyn_Matching_Way=Dec-DingTalkSyn_Matching_Way |
||||
Dec-DingTalkSyn_Hint=Dec-DingTalkSyn_Hint |
||||
Dec-DingTalkSyn_Loading=Dec-DingTalkSyn_Loading |
||||
Dec-DingTalkSyn_Mobile_Not_Supported=Dec-DingTalkSyn_Mobile_Not_Supported |
||||
Dec-DingTalkSyn_Mobile-Push-DingTalkSyn-Terminal=DingTalkSyn |
||||
Dec-DingTalkSyn_Addressee_Chat_Group=Dec-DingTalkSyn_Addressee_Chat_Group |
||||
Dec-DingTalkSyn_Addressee_Chat_Group_Disable_Tip=Dec-DingTalkSyn_Addressee_Chat_Group_Disable_Tip |
||||
Dec-DingTalkSyn_Mobile-Push-DingTalkSyn-AgentId=AgentID |
||||
Dec-DingTalkSyn_Expired_Error=Dec-DingTalkSyn_Expired_Error |
||||
Dec-DingTalkSyn_Expired_Solution=Dec-DingTalkSyn_Expired_Solution |
||||
Dec-DingTalkSyn_Agent-Management=Dec-DingTalkSyn_Agent-Management |
||||
Dec-DingTalkSyn_Member-Management=Dec-DingTalkSyn_Member-Management |
||||
Dec-DingTalkSyn_Agent-Config=Dec-DingTalkSyn_Agent-Config |
||||
Dec-DingTalkSyn_Agent-Name=Dec-DingTalkSyn_Agent-Name |
||||
Dec-DingTalkSyn_Agent-Id=Dec-DingTalkSyn_Agent-Id |
||||
Dec-DingTalkSyn_Organizational-Structure=Dec-DingTalkSyn_Organizational-Structure |
||||
Dec-DingTalkSyn_Tag=Dec-DingTalkSyn_Tag |
||||
Dec-DingTalkSyn_Server=Dec-DingTalkSyn_Server |
||||
Dec-DingTalkSyn_Save=Dec-DingTalkSyn_Save |
||||
Dec-DingTalkSyn_Start_With_Http=Dec-DingTalkSyn_Start_With_Http |
||||
Dec-DingTalkSyn_Server_Url=Dec-DingTalkSyn_Server_Url |
||||
Dec-DingTalkSyn_Server_Tip=Dec-DingTalkSyn_Server_Tip |
||||
Dec-DingTalkSyn_Enterprise-DingDing=Dec-DingTalkSyn_Enterprise-DingDing |
||||
Dec-DingTalkSyn_New-Agent=Dec-DingTalkSyn_New-Agent |
||||
Dec-DingTalkSyn_Non-Adapted-Agent=Dec-DingTalkSyn_Non-Adapted-Agent |
||||
Dec-DingTalkSyn_Modify-Agent=Dec-DingTalkSyn_Modify-Agent |
||||
Dec-DingTalkSyn_DeleteAgent-Confirm-Popup=Dec-DingTalkSyn_DeleteAgent-Confirm-Popup |
||||
Dec-DingTalkSyn_Confirm=Dec-DingTalkSyn_Confirm |
||||
Dec-DingTalkSyn_Cancel=Dec-DingTalkSyn_Cancel |
||||
Dec-DingTalkSyn_Save-Agent-Fail=Dec-DingTalkSyn_Save-Agent-Fail |
||||
Dec-DingTalkSyn_Unknown-Agent=Dec-DingTalkSyn_Unknown-Agent |
||||
Dec-DingTalkSyn_Agent-Name-Exist=Dec-DingTalkSyn_Agent-Name-Exist |
||||
Dec-DingTalkSyn_Match-Way=Dec-DingTalkSyn_Match-Way |
||||
Dec-DingTalkSyn_Match-Setting=Dec-DingTalkSyn_Match-Setting |
||||
Dec-DingTalkSyn_DataSet=Dec-DingTalkSyn_DataSet |
||||
Dec-DingTalkSyn_Address-Book=Dec-DingTalkSyn_Address-Book |
||||
Dec-DingTalkSyn_Member-Update=Dec-DingTalkSyn_Member-Update |
||||
Dec-DingTalkSyn_Set-Update=Dec-DingTalkSyn_Set-Update |
||||
Dec-DingTalkSyn_Not-Null=Dec-DingTalkSyn_Not-Null |
||||
Dec-DingTalkSyn_Start-Update=Dec-DingTalkSyn_Start-Update |
||||
Dec-DingTalkSyn_Per=Dec-DingTalkSyn_Per |
||||
Dec-DingTalkSyn_Day=Dec-DingTalkSyn_Day |
||||
Dec-DingTalkSyn_Week=Dec-DingTalkSyn_Week |
||||
Dec-DingTalkSyn_Monday=Dec-DingTalkSyn_Monday |
||||
Dec-DingTalkSyn_Tuesday=Dec-DingTalkSyn_Tuesday |
||||
Dec-DingTalkSyn_Wednesday=Dec-DingTalkSyn_Wednesday |
||||
Dec-DingTalkSyn_Thursday=Dec-DingTalkSyn_Thursday |
||||
Dec-DingTalkSyn_Friday=Dec-DingTalkSyn_Friday |
||||
Dec-DingTalkSyn_Saturday=Dec-DingTalkSyn_Saturday |
||||
Dec-DingTalkSyn_Sunday=Dec-DingTalkSyn_Sunday |
||||
Dec-DingTalkSyn_Hour=Dec-DingTalkSyn_Hour |
||||
Dec-DingTalkSyn_Minute=Dec-DingTalkSyn_Minute |
||||
Dec-DingTalkSyn_Update-Once=Dec-DingTalkSyn_Update-Once |
||||
Dec-DingTalkSyn_Illegal=Dec-DingTalkSyn_Illegal |
||||
Dec-DingTalkSyn_Proxy=Dec-DingTalkSyn_Proxy |
||||
Dec-DingTalkSyn_Proxy_Address=Dec-DingTalkSyn_Proxy_Address |
||||
Dec-DingTalkSyn_Proxy_Address_Tip=Dec-DingTalkSyn_Proxy_Address_Tip |
||||
Dec-DingTalkSyn_Test-Proxy-Address=Dec-DingTalkSyn_Test-Proxy-Address |
||||
Dec-DingTalkSyn_Start-With-Http=Dec-DingTalkSyn_Start-With-Http |
||||
Dec-DingTalkSyn_Test-Connection=Dec-DingTalkSyn_Test-Connection |
||||
Dec-DingTalkSyn_Connection-Success=Dec-DingTalkSyn_Connection-Success |
||||
Dec-DingTalkSyn_Connection-Fail=Dec-DingTalkSyn_Connection-Fail |
||||
Dec-DingTalkSyn_Unknown-Agent-Id=Dec-DingTalkSyn_Unknown-Agent-Id |
||||
Dec-DingTalkSyn_Delete-Agent-Fail=Dec-DingTalkSyn_Delete-Agent-Fail |
||||
Dec-DingTalkSyn_Agent-Id-Exist=Dec-DingTalkSyn_Agent-Id-Exist |
||||
Dec-DingTalkSyn_Save-ReportServer-Url-Fail=Dec-DingTalkSyn_Save-ReportServer-Url-Fail |
||||
Dec-DingTalkSyn_Save-Timing-Task-Fail=Dec-DingTalkSyn_Save-Timing-Task-Fail |
||||
Dec-DingTalkSyn_Error-AppKey-And-AppSecret=Dec-DingTalkSyn_Error-AppKey-And-AppSecret |
||||
Dec-DingTalkSyn_Error-AppKey-And-AgentId=Dec-DingTalkSyn_Error-AppKey-And-AgentId |
||||
Dec-DingTalkSyn_Duplicate-Agent-Name=Dec-DingTalkSyn_Duplicate-Agent-Name |
||||
Dec-DingTalkSyn_Save-Match-Method-Fail=Dec-DingTalkSyn_Save-Match-Method-Fail |
||||
Dec-DingTalkSyn_Duplicate-Agent-Id=Dec-DingTalkSyn_Duplicate-Agent-Id |
||||
Dec-DingTalkSyn_Save-Proxy-Server-Fail=Dec-DingTalkSyn_Save-Proxy-Server-Fail |
||||
Dec-DingTalkSyn_Connect-Proxy-Server-Fail=Dec-DingTalkSyn_Connect-Proxy-Server-Fail |
||||
Dec-DingTalkSyn_NetWork-Anomaly=Dec-DingTalkSyn_NetWork-Anomaly |
||||
Dec-DingTalkSyn_Create-DingTalkSyn-Url=Dec-DingTalkSyn_Create-DingTalkSyn-Url |
||||
Dec-DingTalkSyn_Platform-Page=Dec-DingTalkSyn_Platform_Page |
||||
Dec-DingTalkSyn_Platform-Report=Dec-DingTalkSyn_Platform-Report |
||||
Dec-DingTalkSyn_Platform=Dec-DingTalkSyn_Platform |
||||
Dec-DingTalkSyn_Parameter_Setting=Dec-DingTalkSyn_Parameter_Setting |
||||
Dec-DingTalkSyn_Create-Url=Dec-DingTalkSyn_Create-Url |
||||
Dec-DingTalkSyn_DingTalkSyn_Url=Dec-DingTalkSyn_DingTalkSyn_Url |
||||
Dec-DingTalkSyn_Copy-Url=Dec-DingTalkSyn_Copy-Url |
||||
Dec-DingTalkSyn_Copy-Success=Dec-DingTalkSyn_Copy-Success |
||||
Dec-DingTalkSyn_Input-Hint=Dec-DingTalkSyn_Input-Hint |
||||
Dec-DingTalkSyn_Save-User-Relation-Fail=Dec-DingTalkSyn_Save-User-Relation-Fail |
||||
BI-Basic_Search=BI-Basic_Search |
||||
Dec-DingTalkSyn_Match-Way-Not-Null=Dec-DingTalkSyn_Match-Way-Not-Null |
||||
Dec-DingTalkSyn_Not-Select=Dec-DingTalkSyn_Not-Select |
||||
Dec-DingTalkSyn_Tip-Get-ReportServer-Url-Fail=Dec-DingTalkSyn_Tip-Get-ReportServer-Url-Fail |
||||
Dec-DingTalkSyn_Create-Agent-Tip=Dec-DingTalkSyn_Create-Agent-Tip |
||||
Dec-DingTalkSyn_IP-Config-Not-Available=Dec-DingTalkSyn_IP-Config-Not-Available |
||||
Dec-DingTalkSyn_NetWork-Invalid=Dec-DingTalkSyn_NetWork-Invalid |
||||
Dec-DingTalkSyn_Not_Trusted_Domain_Error=Dec-DingTalkSyn_Not_Trusted_Domain_Error |
||||
Dec-DingTalkSyn_Not_Trusted_Domain_Exception=Dec-DingTalkSyn_Not_Trusted_Domain_Exception |
||||
Dec-DingTalkSyn_Debugger-Set-Level=Dec-DingTalkSyn_Debugger-Set-Level |
||||
Dec-DingTalkSyn_Debugger-Level=Dec-DingTalkSyn_Debugger-Level |
||||
Dec-DingTalkSyn_Debugger-Parameter-List=Dec-DingTalkSyn_Debugger-Parameter-List |
||||
Dec-DingTalkSyn_Debugger-Content=Dec-DingTalkSyn_Debugger-Content |
||||
Dec-DingTalkSyn_Debugger-Type-Get-Access-Token=Dec-DingTalkSyn_Debugger-Type-Get-Access-Token |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Ip=Dec-DingTalkSyn_Debugger-Type-Check-Ip |
||||
Dec-DingTalkSyn_Debugger-Start-Check=Dec-DingTalkSyn_Debugger-Start-Check |
||||
Dec-DingTalkSyn_Debugger-Show-Result=Dec-DingTalkSyn_Debugger-Show-Result |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Request-Time=Dec-DingTalkSyn_Debugger-Type-Check-Request-Time |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Request-Time-Result=Dec-DingTalkSyn_Debugger-Type-Check-Request-Time-Result |
||||
Dec-DingTalkSyn_Debugger-Tip-Curl-Invalid=Dec-DingTalkSyn_Debugger-Tip-Curl-Invalid |
||||
Dec-DingTalkSyn_Debugger-DownLoad_Log=Dec-DingTalkSyn_Debugger-DownLoad_Log |
||||
Dec-DingTalkSyn_Click-To-Download=Dec-DingTalkSyn_Click-To-Download |
||||
Dec-DingTalkSyn_Download-Fail=Dec-DingTalkSyn_Download-Fail |
||||
Dec-DingTalkSyn_Not_Null=Dec-DingTalkSyn_Not_Null |
||||
Dec-DingTalkSyn_ErrorDetail=Dec-DingTalkSyn_ErrorDetail |
||||
Dec-DingTalkSyn_Debugger-Check-Ip-Result=Dec-DingTalkSyn_Debugger-Check-Ip-Result |
||||
Dec-DingTalkSyn_Debugger-Get-Token=Dec-DingTalkSyn_Debugger-Get-Token |
||||
Dec-DingTalkSyn_Agent_Deleted_Tip=Dec-DingTalkSyn_Agent_Deleted_Tip |
||||
Dec-DingTalkSyn_Parse_Parameters=Dec-DingTalkSyn_Parse_Parameters |
||||
Dec-DingTalkSyn_Parse_Parameters_Tip=Dec-DingTalkSyn_Parse_Parameters_Tip |
||||
Dec-DingTalkSyn_Enterprise_Agent=Dec-DingTalkSyn_Enterprise_Agent |
||||
Dec-DingTalkSyn_Chatgroup_Name=Dec-DingTalkSyn_Chatgroup_Name |
||||
Dec-DingTalkSyn_Chat_Group=Dec-DingTalkSyn_Chat_Group |
||||
Dec-DingTalkSyn_New_Chat_Group=Dec-DingTalkSyn_New_Chat_Group |
||||
Dec-DingTalkSyn_Delete_ChatGroup_Confirm=Dec-DingTalkSyn_Delete_ChatGroup_Confirm |
||||
Dec-DingTalkSyn_Chat_Group_Member_Tip=Dec-DingTalkSyn_Chat_Group_Member_Tip |
||||
Dec-DingTalkSyn_Chat_Group_Leader=Dec-DingTalkSyn_Chat_Group_Leader |
||||
Dec-DingTalkSyn_Chat_Group_Member=Dec-DingTalkSyn_Chat_Group_Member |
||||
Dec-DingTalkSyn_New_Chat_Group_Tip1=Dec-DingTalkSyn_New_Chat_Group_Tip1 |
||||
Dec-DingTalkSyn_New_Chat_Group_Tip2=Dec-DingTalkSyn_New_Chat_Group_Tip2 |
||||
Dec-DingTalkSyn_New_Chat_Group_Message=Dec-DingTalkSyn_New_Chat_Group_Message |
||||
Dec-DingTalkSyn_Common_Error_Tip=Dec-DingTalkSyn_Common_Error_Tip |
||||
Dec-DingTalkSyn_Chat_Group_Name_Length_Tip=Dec-DingTalkSyn_Chat_Group_Name_Length_Tip |
||||
Dec-DingTalkSyn_Create-Chat-Group-Fail=Dec-DingTalkSyn_Create-Chat-Group-Fail |
||||
Dec-DingTalkSyn_Output_User_Empty=Dec-DingTalkSyn_Output_User_Empty |
||||
Dec-DingTalkSyn_Message_Agent=Dec-DingTalkSyn_Message_Agent |
||||
Dec-DingTalkSyn_Message_Group=Dec-DingTalkSyn_Message_Group |
||||
Dec-DingTalkSyn_DingTalkSyn=Dec-DingTalkSyn_DingTalkSyn |
||||
Dec-DingTalkSyn_Output_User_Fail_Partly_Header=Dec-DingTalkSyn_Output_User_Fail_Partly_Header |
||||
Dec-DingTalkSyn_Output_User_Fail_Partly_Tip=Dec-DingTalkSyn_Output_User_Fail_Partly_Tip |
||||
Dec-DingTalkSyn_Output_Group_Fail_Partly_Header=Dec-DingTalkSyn_Output_Group_Fail_Partly_Header |
||||
Dec-DingTalkSyn_Output_Group_Fail_Partly_Tip=Dec-DingTalkSyn_Output_Group_Fail_Partly_Tip |
||||
Dec-DingTalkSyn_User_Match_Dec_User_Fail=Dec-DingTalkSyn_User_Match_Dec_User_Fail |
@ -0,0 +1,188 @@
|
||||
Plugin-dingtalksyn=\u9489\u9489\u6570\u636E\u540C\u6B65\u63D2\u4EF6 |
||||
Plugin-dingtalksyn_Group=\u9489\u9489\u6570\u636E\u540C\u6B65\u63D2\u4EF6 |
||||
Plugin-dingtalksyn_Config_CronCondition=Cron\u8868\u8FBE\u5F0F |
||||
Plugin-dingtalksyn_Config_CronCondition_Description=Cron\u8868\u8FBE\u5F0F |
||||
Plugin-dingtalksyn_Config_appKey=\u5E94\u7528\u7CFB\u7EDF\u7684APPKEY |
||||
Plugin-dingtalksyn_Config_appKey_Description=\u5E94\u7528\u7CFB\u7EDF\u7684APPKEY |
||||
Plugin-dingtalksyn_Config_appSecret=\u5E94\u7528\u7CFB\u7EDF\u7684appSecret |
||||
Plugin-dingtalksyn_Config_appSecret_Description=\u5E94\u7528\u7CFB\u7EDF\u7684appSecret |
||||
Plugin-dingtalksyn_Config_corpId=Corp Id |
||||
Plugin-dingtalksyn_Config_corpId_Description=Corp Id |
||||
Plugin-dingtalksyn_Config_rootDepId=\u6839\u90E8\u95E8ID |
||||
Plugin-dingtalksyn_Config_rootDepId_Description=\u6839\u90E8\u95E8ID |
||||
Plugin-dingtalksyn_Config_Token=\u7B7E\u540DToken |
||||
Plugin-dingtalksyn_Config_Token_Description=\u7B7E\u540DToken |
||||
Plugin-dingtalksyn_Config_AesKey=\u52A0\u5BC6aes_key |
||||
Plugin-dingtalksyn_Config_AesKey_Description=\u52A0\u5BC6aes_key |
||||
Plugin-dingtalksyn_Config_SsoEnable=\u5355\u70B9\u529F\u80FD\u5F00\u5173 |
||||
Plugin-dingtalksyn_Config_SsoEnable_Description=\u5355\u70B9\u529F\u80FD\u5F00\u5173 |
||||
Plugin-dingtalksyn_Error_500=error |
||||
Plugin-dingtalksyn_Error_501=DingTalkSyn\u63D2\u4EF6\u8BB8\u53EF\u5931\u6548! |
||||
## \u524D\u7AEFjs |
||||
Plugin-dingtalksyn_DingTalk_Manager=\u9489\u9489\u540C\u6B65 |
||||
|
||||
Dec-Module-DingTalkSyn_Manager=\u9489\u9489\u7BA1\u7406 |
||||
Dec-DingTalkSyn_Basic=\u57FA\u672C\u4FE1\u606F |
||||
Dec-Schedule-Notification_DingTalkSyn=\u63A8\u9001\u9489\u9489\u6D88\u606F |
||||
Dec-Schedule-Notification_DingTalkSyn_CorpID=\u5E94\u7528AgentID\uFF1A |
||||
Dec-Schedule-Notification_DingTalkSyn_Users=\u9489\u9489\u7528\u6237\uFF1A |
||||
Dec-Schedule-Notification_DingTalkSyn_DepID=\u90E8\u95E8ID\uFF1A |
||||
Dec-Schedule-Notification_DingTalkSyn_Content=\u6D88\u606F\u5185\u5BB9\uFF1A |
||||
Dec-Schedule-Notification_DingTalkSyn_WithLink=\u5B9A\u65F6\u7ED3\u679C\u8BBF\u95EE\u94FE\u63A5 |
||||
Dec-Schedule_Mobile-Push-DingTalkSynId-Not-Null=\u8BF7\u8BBE\u7F6E\u63A8\u9001\u7684\u9489\u9489\u5E94\u7528 |
||||
Dec-DingTalkSyn_Recive_Data_URL=\u63A5\u6536\u6570\u636EURL |
||||
Dec-DingTalkSyn_Corp_ID=\u9489\u9489\u4F01\u4E1A\u53F7ID |
||||
Dec-DingTalkSyn_Secret=\u7BA1\u7406\u7EC4\u51ED\u8BC1\u5BC6\u94A5 |
||||
Dec-DingTalkSyn_Member_Management=\u9489\u9489\u6210\u5458\u7BA1\u7406 |
||||
Dec-DingTalkSyn_User-Same-With-FS=\u9489\u9489\u5DE5\u53F7\u5339\u914D |
||||
Dec-DingTalkSyn_Mobile-Same-With-FS=\u624B\u673A\u53F7\u5339\u914D |
||||
Dec-DingTalkSyn_Manual-Matching-FS=\u624B\u52A8\u5339\u914D |
||||
Dec-DingTalkSyn_Custom-Matching-FS=\u81EA\u5B9A\u4E49\u5339\u914D |
||||
Dec-DingTalkSyn_UserID=\u9489\u9489\u6210\u5458ID |
||||
Dec-DingTalkSyn_DecUserName=\u7528\u6237\u540D |
||||
Dec-DingTalkSyn_Name=\u59D3\u540D |
||||
Dec-DingTalkSyn_Department=\u9489\u9489\u90E8\u95E8 |
||||
Dec-DingTalkSyn_UrlHint=\u670D\u52A1\u5668\u4FDD\u5B58\u7684Url\uFF1A |
||||
Dec-DingTalkSyn_User_Job_Name=\u9489\u9489\u5DE5\u53F7 |
||||
Dec-DingTalkSyn_Token_Path=\u8BBE\u7F6EToken\u83B7\u53D6\u8DEF\u5F84 |
||||
Dec-DingTalkSyn_Refresh_User=\u66F4\u65B0\u901A\u8BAF\u5F55 |
||||
Dec-DingTalkSyn_Mobile=\u9489\u9489\u6210\u5458\u624B\u673A\u53F7 |
||||
Dec-DingTalkSyn_Matching_Way=\u7528\u6237\u5339\u914D\u65B9\u5F0F |
||||
Dec-DingTalkSyn_Hint=\u63D0\u793A |
||||
Dec-DingTalkSyn_Loading=\u6B63\u5728\u52A0\u8F7D\u7528\u6237... |
||||
Dec-DingTalkSyn_Mobile_Not_Supported=\u5F53\u524DHTML5\u62A5\u8868\u4E0D\u652F\u6301\u6839\u636E\u624B\u673A\u53F7\u5339\u914D\uFF0C\u8BF7\u5347\u7EA7HTML5\u63D2\u4EF6 |
||||
Dec-DingTalkSyn_Mobile-Push-DingTalkSyn-Terminal=\u9489\u9489\u901A\u77E5 |
||||
Dec-DingTalkSyn_Addressee_Chat_Group=\u9489\u9489\u7FA4 |
||||
Dec-DingTalkSyn_Addressee_Chat_Group_Disable_Tip=\u5982\u679C\u6839\u636E\u9ED8\u8BA4\u7528\u6237\u7EC4\u5185\u7684\u7528\u6237\u5355\u72EC\u751F\u6210\u7ED3\u679C\uFF0C\u5219\u65E0\u6CD5\u901A\u77E5\u5230\u9489\u9489\u7FA4 |
||||
Dec-DingTalkSyn_Mobile-Push-DingTalkSyn-AgentId=\u5E94\u7528ID |
||||
Dec-DingTalkSyn_Expired_Error=\u9519\u8BEF\u4EE3\u7801:11100016 \u60A8\u4F7F\u7528\u4E86\u672A\u6CE8\u518C\u7684\u529F\u80FD\u2014\u2014\u9489\u9489\u96C6\u6210 |
||||
Dec-DingTalkSyn_Expired_Solution=\u9489\u9489\u529F\u80FD\u672A\u6CE8\u518C\uFF0C\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB\u9500\u552E |
||||
Dec-DingTalkSyn_Agent-Management=\u5E94\u7528\u7BA1\u7406 |
||||
Dec-DingTalkSyn_Member-Management=\u6210\u5458\u7BA1\u7406 |
||||
Dec-DingTalkSyn_Agent-Config=\u5E94\u7528\u5FEB\u6377\u914D\u7F6E |
||||
Dec-DingTalkSyn_Agent-Name=\u9489\u9489\u5E94\u7528\u540D\u79F0 |
||||
Dec-DingTalkSyn_Agent-Id=\u9489\u9489\u5E94\u7528ID |
||||
Dec-DingTalkSyn_Organizational-Structure=\u7EC4\u7EC7\u67B6\u6784 |
||||
Dec-DingTalkSyn_Tag=\u6807\u7B7E |
||||
Dec-DingTalkSyn_Server=\u670D\u52A1\u5668 |
||||
Dec-DingTalkSyn_Save=\u4FDD\u5B58 |
||||
Dec-DingTalkSyn_Start_With_Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934 |
||||
Dec-DingTalkSyn_Server_Url=\u670D\u52A1\u5668\u5730\u5740 |
||||
Dec-DingTalkSyn_Server_Tip=1\u3001\u8BE5\u5730\u5740\u5C06\u7528\u4E8E\u5FEB\u6377\u914D\u7F6E\u4E2D\u751F\u6210\u5E73\u53F0\u5355\u70B9\u94FE\u63A5\u3001\u6A21\u677F\u5355\u70B9\u94FE\u63A5\uFF0C\u4EE5\u53CA\u63A8\u9001\u7684\u7ED3\u679C\u94FE\u63A5\uFF1B\n2\u3001\u8BE5\u5730\u5740\u9700\u8981\u5916\u7F51\u53EF\u8BBF\u95EE\uFF0C\u5730\u5740\u683C\u5F0F\u4E3Ahttp://\u57DF\u540D:\u7AEF\u53E3/decision\u6216https://\u57DF\u540D:\u7AEF\u53E3/decision\uFF0C\u914D\u7F6E\u540E\u8BF7\u4FDD\u5B58 |
||||
Dec-DingTalkSyn_Enterprise-DingDing=\u4F01\u4E1A\u9489\u9489 |
||||
Dec-DingTalkSyn_New-Agent=\u65B0\u5EFA\u9489\u9489\u5E94\u7528 |
||||
Dec-DingTalkSyn_Non-Adapted-Agent=\u63D0\u793A\uFF1A\u8BF7\u786E\u8BA4\u5E94\u7528id\u662F\u5426\u6B63\u786E |
||||
Dec-DingTalkSyn_Modify-Agent=\u4FEE\u6539\u9489\u9489\u5E94\u7528 |
||||
Dec-DingTalkSyn_DeleteAgent-Confirm-Popup=\u786E\u5B9A\u5220\u9664\u6B64\u4F01\u4E1A\u9489\u9489\u5E94\u7528 |
||||
Dec-DingTalkSyn_Confirm=\u786E\u5B9A |
||||
Dec-DingTalkSyn_Cancel=\u53D6\u6D88 |
||||
Dec-DingTalkSyn_Save-Agent-Fail=\u5B58\u50A8\u5E94\u7528\u4FE1\u606F\u5931\u8D25 |
||||
Dec-DingTalkSyn_Unknown-Agent=\u7F51\u7EDC\u5F02\u5E38\u6216\u8005\u8BF7\u786E\u8BA4\u5F53\u524D\u4F7F\u7528\u7684CorpId\u548CSecret\u662F\u5426\u6B63\u786E |
||||
Dec-DingTalkSyn_Agent-Name-Exist=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728 |
||||
Dec-DingTalkSyn_Match-Way=\u5339\u914D\u65B9\u5F0F |
||||
Dec-DingTalkSyn_Match-Setting=\u5339\u914D\u8BBE\u7F6E |
||||
Dec-DingTalkSyn_DataSet=\u6570\u636E\u96C6 |
||||
Dec-DingTalkSyn_Address-Book=\u9489\u9489\u901A\u8BAF\u5F55 |
||||
Dec-DingTalkSyn_Member-Update=\u7ACB\u5373\u66F4\u65B0 |
||||
Dec-DingTalkSyn_Set-Update=\u8BBE\u7F6E\u81EA\u52A8\u66F4\u65B0 |
||||
Dec-DingTalkSyn_Not-Null=\u4E0D\u5141\u8BB8\u4E3A\u7A7A |
||||
Dec-DingTalkSyn_Start-Update=\u542F\u7528\u81EA\u52A8\u66F4\u65B0 |
||||
Dec-DingTalkSyn_Per=\u6BCF |
||||
Dec-DingTalkSyn_Day=\u5929 |
||||
Dec-DingTalkSyn_Week=\u5468 |
||||
Dec-DingTalkSyn_Monday=\u5468\u4E00 |
||||
Dec-DingTalkSyn_Tuesday=\u5468\u4E8C |
||||
Dec-DingTalkSyn_Wednesday=\u5468\u4E09 |
||||
Dec-DingTalkSyn_Thursday=\u5468\u56DB |
||||
Dec-DingTalkSyn_Friday=\u5468\u4E94 |
||||
Dec-DingTalkSyn_Saturday=\u5468\u516D |
||||
Dec-DingTalkSyn_Sunday=\u5468\u65E5 |
||||
Dec-DingTalkSyn_Hour=\u65F6 |
||||
Dec-DingTalkSyn_Minute=\u5206 |
||||
Dec-DingTalkSyn_Update-Once=\u5B9A\u65F6\u540C\u6B65\u4E00\u6B21 |
||||
Dec-DingTalkSyn_Illegal=\u4E0D\u5408\u6CD5 |
||||
Dec-DingTalkSyn_Proxy=\u9489\u9489\u4EE3\u7406\u8DF3\u8F6C |
||||
Dec-DingTalkSyn_Proxy_Address=\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740 |
||||
Dec-DingTalkSyn_Proxy_Address_Tip=1\u3001\u8BE5\u5730\u5740\u586B\u5199\u5E06\u8F6F\u6240\u5728\u5E94\u7528\u670D\u52A1\u5668\u8BBF\u95EE\u4EE3\u7406\u670D\u52A1\u5668\u7684\u5730\u5740\uFF0C\u5373\u6B63\u5411\u4EE3\u7406\u5730\u5740\uFF0C\u4ECE\u800C\u4F7F\u5E06\u8F6F\u5E94\u7528\u670D\u52A1\u5668\u80FD\u591F\u901A\u8FC7\u4EE3\u7406\u670D\u52A1\u5668\u8BBF\u95EE\u5230\u5916\u7F51\u9489\u9489\u670D\u52A1\u5668\uFF1B\n2\u3001\u5730\u5740\u683C\u5F0F\u4E3Ahttp://\u57DF\u540D:\u7AEF\u53E3 |
||||
Dec-DingTalkSyn_Test-Proxy-Address=\u6D4B\u8BD5\u8FDE\u63A5 |
||||
Dec-DingTalkSyn_Start-With-Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934 |
||||
Dec-DingTalkSyn_Test-Connection=\u6D4B\u8BD5\u8FDE\u63A5\u4E2D... |
||||
Dec-DingTalkSyn_Connection-Success=\u8FDE\u63A5\u6210\u529F |
||||
Dec-DingTalkSyn_Connection-Fail=\u8FDE\u63A5\u5931\u8D25 |
||||
Dec-DingTalkSyn_Unknown-Agent-Id=\u5E94\u7528ID\u4E0D\u6B63\u786E |
||||
Dec-DingTalkSyn_Delete-Agent-Fail=\u5220\u9664\u5E94\u7528\u5931\u8D25 |
||||
Dec-DingTalkSyn_Agent-Id-Exist=\u5E94\u7528ID\u5DF2\u5B58\u5728 |
||||
Dec-DingTalkSyn_Save-ReportServer-Url-Fail=\u4FDD\u5B58\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 |
||||
Dec-DingTalkSyn_Save-Timing-Task-Fail=\u4FDD\u5B58\u5B9A\u65F6\u4EFB\u52A1\u5931\u8D25 |
||||
Dec-DingTalkSyn_Error-AppKey-And-AppSecret=\u8BF7\u786E\u8BA4\u5F53\u524D\u4F7F\u7528\u7684AppKey\u548CAppSecret\u662F\u5426\u6B63\u786E |
||||
Dec-DingTalkSyn_Error-AppKey-And-AgentId=\u8BF7\u786E\u8BA4\u5F53\u524D\u5E94\u7528ID\u548CAppKey\u662F\u5426\u5BF9\u5E94 |
||||
Dec-DingTalkSyn_Duplicate-Agent-Name=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728 |
||||
Dec-DingTalkSyn_Save-Match-Method-Fail=\u5B58\u50A8\u6210\u5458\u7BA1\u7406\u914D\u7F6E\u4FE1\u606F\u5931\u8D25 |
||||
Dec-DingTalkSyn_Duplicate-Agent-Id=\u5E94\u7528ID\u5DF2\u5B58\u5728 |
||||
Dec-DingTalkSyn_Save-Proxy-Server-Fail=\u4FDD\u5B58\u4EE3\u7406\u670D\u52A1\u5668\u5931\u8D25 |
||||
Dec-DingTalkSyn_Connect-Proxy-Server-Fail=\u9489\u9489\u4EE3\u7406\u670D\u52A1\u5668\u6D4B\u8BD5\u8FDE\u63A5\u5931\u8D25 |
||||
Dec-DingTalkSyn_NetWork-Anomaly=\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u914D\u7F6E |
||||
Dec-DingTalkSyn_Create-DingTalkSyn-Url=\u751F\u6210\u9489\u9489\u94FE\u63A5 |
||||
Dec-DingTalkSyn_Platform-Page=\u94FE\u63A5\u9875\u9762 |
||||
Dec-DingTalkSyn_Platform-Report=\u5355\u4E2A\u6A21\u677F |
||||
Dec-DingTalkSyn_Platform=\u51B3\u7B56\u5E73\u53F0 |
||||
Dec-DingTalkSyn_Parameter_Setting=\u53C2\u6570\u8BBE\u7F6E |
||||
Dec-DingTalkSyn_Create-Url=\u751F\u6210\u94FE\u63A5 |
||||
Dec-DingTalkSyn_DingTalkSyn_Url=\u9489\u9489\u94FE\u63A5 |
||||
Dec-DingTalkSyn_Copy-Url=\u590D\u5236 |
||||
Dec-DingTalkSyn_Copy-Success=\u590D\u5236\u6210\u529F |
||||
Dec-DingTalkSyn_Input-Hint=\u8BF7\u8F93\u5165 |
||||
Dec-DingTalkSyn_Save-User-Relation-Fail=\u624B\u52A8\u5339\u914D\u5931\u8D25 |
||||
BI-Basic_Search=\u641C\u7D22 |
||||
Dec-DingTalkSyn_Match-Way-Not-Null=\u5339\u914D\u8BBE\u7F6E\u4E0D\u80FD\u4E3A\u7A7A |
||||
Dec-DingTalkSyn_Not-Select=\u4E0D\u9009 |
||||
Dec-DingTalkSyn_Tip-Get-ReportServer-Url-Fail=\u8BF7\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740 |
||||
Dec-DingTalkSyn_Create-Agent-Tip=\u82E5\u65E0AppKey\uFF0C\u8BF7\u5728Appkey\u548CAppSecret\u4E2D\u5206\u522B\u586B\u5199CorpId\u548CCorpSecret |
||||
Dec-DingTalkSyn_IP-Config-Not-Available=\u8BBF\u95EEIP\u4E0D\u5728\u767D\u540D\u5355\u4E4B\u4E2D |
||||
Dec-DingTalkSyn_NetWork-Invalid=\u7F51\u7EDC\u5F02\u5E38 |
||||
Dec-DingTalkSyn_Not_Trusted_Domain_Error=\u9519\u8BEF\u4EE3\u7801\uFF1A11205040\uFF0CredirectUrl\u57DF\u540D\u4E0E\u540E\u53F0\u914D\u7F6E\u4E0D\u4E00\u81F4 |
||||
Dec-DingTalkSyn_Not_Trusted_Domain_Exception=\u68C0\u67E5\u57DF\u540D\u4E0E\u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u4E00\u81F4 |
||||
Dec-DingTalkSyn_Debugger-Set-Level=\u8BBE\u7F6E\u65E5\u5FD7\u7EA7\u522B |
||||
Dec-DingTalkSyn_Debugger-Level=\u65E5\u5FD7\u7EA7\u522B |
||||
Dec-DingTalkSyn_Debugger-Parameter-List=\u53C2\u6570\u5217\u8868 |
||||
Dec-DingTalkSyn_Debugger-Content=\u8C03\u8BD5\u5185\u5BB9 |
||||
Dec-DingTalkSyn_Debugger-Type-Get-Access-Token=\u83B7\u53D6access_token |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Ip=\u68C0\u67E5ip\u767D\u540D\u5355 |
||||
Dec-DingTalkSyn_Debugger-Start-Check=\u5F00\u59CB\u68C0\u6D4B |
||||
Dec-DingTalkSyn_Debugger-Show-Result=\u68C0\u6D4B\u7ED3\u679C |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Request-Time=\u68C0\u6D4B\u8BF7\u6C42\u8017\u65F6 |
||||
Dec-DingTalkSyn_Debugger-Type-Check-Request-Time-Result=\u68C0\u6D4B\u7ED3\u679C |
||||
Dec-DingTalkSyn_Debugger-Tip-Curl-Invalid=\u63D0\u793A\uFF1A\u670D\u52A1\u5668\u7CFB\u7EDF\u82E5\u4E3Awindows\u5219\u9700\u8981\u5B89\u88C5curl\u5DE5\u5177\u624D\u80FD\u652F\u6301\u68C0\u6D4B |
||||
Dec-DingTalkSyn_Debugger-DownLoad_Log=\u4E0B\u8F7D\u65E5\u5FD7 |
||||
Dec-DingTalkSyn_Click-To-Download=\u70B9\u51FB\u4E0B\u8F7D |
||||
Dec-DingTalkSyn_Download-Fail=\u4E0B\u8F7D\u5931\u8D25 |
||||
Dec-DingTalkSyn_Not_Null=\u4E0D\u53EF\u4E3A\u7A7A |
||||
Dec-DingTalkSyn_ErrorDetail=\u9519\u8BEF\u4FE1\u606F |
||||
Dec-DingTalkSyn_Debugger-Check-Ip-Result=\u68C0\u67E5\u7ED3\u679C |
||||
Dec-DingTalkSyn_Debugger-Get-Token=access_token |
||||
Dec-DingTalkSyn_Agent_Deleted_Tip=\u65E0\u6CD5\u83B7\u53D6\u8BE5\u9489\u9489\u5E94\u7528\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u9879\u662F\u5426\u6709\u8BEF |
||||
Dec-DingTalkSyn_Parse_Parameters=\u89E3\u6790\u53C2\u6570\u503C |
||||
Dec-DingTalkSyn_Parse_Parameters_Tip=\u5FAE\u4FE1\uFF0F\u9489\u9489\u96C6\u6210\u94FE\u63A5\u5FC5\u987B\u52FE\u9009\u89E3\u6790\u53C2\u6570\u503C\uFF0C\u5426\u5219\u5C06\u5BFC\u81F4\u53C2\u6570\u4E22\u5931\uFF1B\u6A21\u677F\u6D88\u606F\u63A8\u9001\u7684\u6D88\u606F\u94FE\u63A5\u53EF\u9009\u62E9\u4E0D\u89E3\u6790\u53C2\u6570\u503C\uFF0C\u4ECE\u800C\u5B9E\u73B0\u63A8\u9001\u65F6\u7684\u5B9E\u65F6\u516C\u5F0F\u8BA1\u7B97\u3002 |
||||
Dec-DingTalkSyn_Enterprise_Agent=\u9489\u9489\u5E94\u7528 |
||||
Dec-DingTalkSyn_Chatgroup_Name=\u9489\u9489\u7FA4\u540D\u79F0 |
||||
Dec-DingTalkSyn_Chat_Group=\u9489\u9489\u7FA4 |
||||
Dec-DingTalkSyn_New_Chat_Group=\u65B0\u5EFA\u9489\u9489\u7FA4 |
||||
Dec-DingTalkSyn_Delete_ChatGroup_Confirm=\u786E\u8BA4\u5220\u9664\u9489\u9489\u7FA4\uFF1F |
||||
Dec-DingTalkSyn_Chat_Group_Member_Tip=\u9664\u7FA4\u4E3B\u5916\uFF0C\u4E0D\u53EF\u5C11\u4E8E2\u4EBA |
||||
Dec-DingTalkSyn_Chat_Group_Leader=\u7FA4\u4E3B |
||||
Dec-DingTalkSyn_Chat_Group_Member=\u7FA4\u6210\u5458 |
||||
Dec-DingTalkSyn_New_Chat_Group_Tip1=\u7FA4\u6210\u5458\u8D85\u8FC730\u4EBA\u65F6\uFF0C\u5EFA\u8BAE\u5728\u9489\u9489\u5BA2\u6237\u7AEF\u6DFB\u52A0\u66F4\u591A\u7FA4\u6210\u5458\u3002 |
||||
Dec-DingTalkSyn_New_Chat_Group_Tip2=\u5BA2\u6237\u7AEF\u6DFB\u52A0\u7684\u6210\u5458\u82E5\u4E0D\u5728\u5E94\u7528\u53EF\u89C1\u8303\u56F4\u5185\uFF0C\u5C06\u65E0\u6CD5\u5355\u70B9\u767B\u5F55\u67E5\u770B\u6A21\u677F\u3002 |
||||
Dec-DingTalkSyn_New_Chat_Group_Message=\u60A8\u5DF2\u52A0\u5165\u7FA4\u804A |
||||
Dec-DingTalkSyn_Common_Error_Tip=\u53D1\u751F\u9519\u8BEF\uFF0C\u9519\u8BEF\u7801\u4E3A\uFF1A |
||||
Dec-DingTalkSyn_Chat_Group_Name_Length_Tip=\u7FA4\u540D\u79F0\u957F\u5EA6\u965020\u4E2A\u5B57\u7B26 |
||||
Dec-DingTalkSyn_Create-Chat-Group-Fail=\u521B\u5EFA\u9489\u9489\u7FA4\u5931\u8D25 |
||||
Dec-DingTalkSyn_Output_User_Empty=\u63A8\u9001\u4EBA\u4E3A\u7A7A\uFF01 |
||||
Dec-DingTalkSyn_Message_Agent=\u5E94\u7528\u6D88\u606F |
||||
Dec-DingTalkSyn_Message_Group=\u7FA4\u6D88\u606F |
||||
Dec-DingTalkSyn_DingTalkSyn=\u9489\u9489 |
||||
Dec-DingTalkSyn_Output_User_Fail_Partly_Header=\u4E2A\u7528\u6237\u63A8\u9001\u5931\u8D25\uFF1A |
||||
Dec-DingTalkSyn_Output_User_Fail_Partly_Tip=...\uFF0C\u53EF\u5728\u65E5\u5FD7\u4E2D\u67E5\u770B\u5B8C\u6574\u7528\u6237\u540D\u5355 |
||||
Dec-DingTalkSyn_Output_Group_Fail_Partly_Header=\u4E2A\u7FA4\u63A8\u9001\u5931\u8D25\uFF1A |
||||
Dec-DingTalkSyn_Output_Group_Fail_Partly_Tip=...\uFF0C\u53EF\u5728\u65E5\u5FD7\u4E2D\u67E5\u770B\u5B8C\u6574\u7FA4\u540D\u5355 |
||||
Dec-DingTalkSyn_User_Match_Dec_User_Fail=\u9489\u9489\u7528\u6237\u5339\u914D\u5E73\u53F0\u7528\u6237\u5931\u8D25\uFF01 |
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
||||
<title>DingTalk</title> |
||||
<script src="${openJs}"></script> |
||||
</head> |
||||
<body> |
||||
<script> |
||||
dd.ready(function () { |
||||
dd.runtime.permission.requestAuthCode({ |
||||
corpId: "${corpId}", |
||||
onSuccess: function (result) { |
||||
window.open("${remoteServletURL}" + result.code); |
||||
}, |
||||
onFail: function (err) { |
||||
} |
||||
}); |
||||
}); |
||||
</script> |
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,182 @@
|
||||
{ |
||||
"extends": "eslint:recommended", |
||||
"plugins": [ |
||||
"mocha" |
||||
], |
||||
"rules": { |
||||
// 声明 |
||||
"no-use-before-define": "error", |
||||
//禁止定义前使用 |
||||
|
||||
// 对象 |
||||
"no-dupe-keys": "error", |
||||
// 禁止在对象字面量中出现重复的键 |
||||
"quote-props": [ |
||||
"error", |
||||
"as-needed" |
||||
], |
||||
// 对象属性只在需要的时候加引号 |
||||
|
||||
// 字符串 |
||||
"quotes": [ |
||||
"error", |
||||
"double", |
||||
{ |
||||
"allowTemplateLiterals": true |
||||
} |
||||
], |
||||
// 字符串开头和结束使用双引号 |
||||
"no-useless-concat": "error", |
||||
// 禁止没有必要的字符拼接 |
||||
"no-useless-escape": "error", |
||||
// 禁用不必要的转义 |
||||
|
||||
// 函数 |
||||
"no-dupe-args": "error", |
||||
// 禁止在 function 定义中出现重复的参数 |
||||
"space-before-function-paren": "error", |
||||
// 函数括号前必须要有空格 |
||||
|
||||
// 变量 |
||||
"no-undef": "error", |
||||
// 禁止使用未声明的变量 |
||||
|
||||
// 比较运算符 & 相等运算符 |
||||
"eqeqeq": "error", |
||||
// 使用 === 和 !== 代替 == 和 != |
||||
"no-unneeded-ternary": "error", |
||||
//禁止可以在有更简单的可替代的表达式时使用三元操作符 |
||||
|
||||
// 条件 |
||||
"default-case": "error", |
||||
// 要求 Switch 语句中有 Default 分支 |
||||
"no-else-return": "error", |
||||
// 如果 if 块中包含了一个 return 语句,else 块就成了多余的了。可以将其内容移至块外 |
||||
|
||||
// 代码块 |
||||
"brace-style": [ |
||||
"error", |
||||
"1tbs", |
||||
{ |
||||
"allowSingleLine": true |
||||
} |
||||
], |
||||
// 代码块左括号紧跟上一行结束 |
||||
"curly": [ |
||||
"error", |
||||
"multi-line" |
||||
], |
||||
// if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号 |
||||
|
||||
// 注释 |
||||
"spaced-comment": "error", |
||||
// 注释前有空格 |
||||
|
||||
// 空白 |
||||
"indent": [ |
||||
"error", |
||||
4, |
||||
{ |
||||
"SwitchCase": 1 |
||||
} |
||||
], |
||||
// 缩进控制4空格 |
||||
"no-mixed-spaces-and-tabs": "error", |
||||
// 禁止使用 空格 和 tab 混合缩进 |
||||
"space-before-blocks": [ |
||||
"error", |
||||
"always" |
||||
], |
||||
// 语句块之前的需要有空格 |
||||
"space-infix-ops": [ |
||||
"error", |
||||
{ |
||||
"int32Hint": false |
||||
} |
||||
], |
||||
// 要求中缀操作符周围有空格,设置 int32Hint 选项为 true (默认 false) 允许 a|0 不带空格 |
||||
"no-trailing-spaces": [ |
||||
"error", |
||||
{ |
||||
"skipBlankLines": true |
||||
} |
||||
], |
||||
// 禁用行尾空格 |
||||
"key-spacing": [ |
||||
"error", |
||||
{ |
||||
"afterColon": true |
||||
} |
||||
], |
||||
// 要求在对象字面量的冒号和值之间存在至少有一个空格 |
||||
|
||||
|
||||
// 逗号 |
||||
"comma-style": "error", |
||||
// 逗号必须放在行末 |
||||
"comma-dangle": [ |
||||
"error", |
||||
"never" |
||||
], |
||||
// 多行对象字面量中要求不要拖尾逗号 |
||||
"comma-spacing": [ |
||||
"error", |
||||
{ |
||||
"before": false, |
||||
"after": true |
||||
} |
||||
], |
||||
//在变量声明、数组字面量、对象字面量、函数参数 和 序列中禁止在逗号前使用空格,要求在逗号后使用一个或多个空格 |
||||
|
||||
|
||||
// 分号 |
||||
"semi": "error", |
||||
//不得省略语句结束的分号 |
||||
"semi-spacing": [ |
||||
"error", |
||||
{ |
||||
"before": false, |
||||
"after": true |
||||
} |
||||
], |
||||
//禁止分号周围的空格 |
||||
"no-extra-semi": "error", |
||||
// 禁用不必要的分号 |
||||
|
||||
|
||||
// 类型转换 |
||||
"no-extra-boolean-cast": "error", |
||||
// 禁止不必要的布尔类型转换 |
||||
|
||||
|
||||
// 其他最佳实践或规范 |
||||
"no-unexpected-multiline": "error", |
||||
// 禁止使用令人困惑的多行表达式 |
||||
"no-unreachable": "error", |
||||
// 禁止在 return、throw、continue 和 break 语句后出现不可达代码 |
||||
"valid-typeof": "error", |
||||
// 强制 typeof 表达式与有效的字符串进行比较 |
||||
"no-new-wrappers": "error", |
||||
// 禁止通过 new 操作符使用 String、Number 和 Boolean |
||||
|
||||
"mocha/no-exclusive-tests": "error" |
||||
}, |
||||
"globals": { |
||||
"window": true, |
||||
"$": true, |
||||
"WebUI": true, |
||||
"BI": true, |
||||
"BICst": true, |
||||
"Data": true, |
||||
"Fix": true, |
||||
"module": true, |
||||
"Dec": true, |
||||
"DecCst": true, |
||||
"FS": true, |
||||
"NProgress": true, |
||||
"describe": true, |
||||
"before": true, |
||||
"it": true, |
||||
"expect": true |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
/.vscode |
||||
/node_modules |
||||
.idea/workspace.xml |
||||
.idea/vcs.xml |
||||
.idea/modules.xml |
||||
.idea/ |
||||
/css/ |
||||
/src/css/ |
||||
/dist/**/*.js |
||||
/dist/**/*.css |
@ -0,0 +1,45 @@
|
||||
# 平台插件基础工程 |
||||
|
||||
## 下载运行 |
||||
|
||||
```sh |
||||
# 安装 |
||||
git clone https://git.fanruan.com/frank.qiu/plugin-template-simple.git |
||||
|
||||
cd plugin-template-simple |
||||
|
||||
# 如果没有全局安装gulp,需要先npm install -g gulp在全局安装gulp |
||||
npm install |
||||
|
||||
# 安装完成之后直接运行 |
||||
npm run dev |
||||
``` |
||||
|
||||
## 配置 |
||||
|
||||
### 修改代理服务器 |
||||
目前前端工程是通过代理访问到后台资源的,需要根据实际情况修改gulpfile中的代理设置。 |
||||
```js |
||||
// 配置代理 |
||||
proxy("/webroot/decision", { |
||||
// 服务器路径 |
||||
target: "http://localhost:8075", |
||||
changeOrigin: true |
||||
}) |
||||
``` |
||||
|
||||
### 配置插件 |
||||
|
||||
通过修改`start.js`来替换对应的组件,修改`config.js`来配置组件。具体可以查看fineui插件开发文档。 |
||||
|
||||
|
||||
## 如何使用 |
||||
|
||||
前端页面开发完成之后,这个时候需要把js和css文件放到插件当中,需要做的就是把文件合并压缩,复制到插件对应位置。 |
||||
|
||||
```sh |
||||
# 合并、压缩 |
||||
npm run build |
||||
|
||||
# 在dist文件夹中会生成js/plugin.min.js和css/plugin.min.css。复制即可 |
||||
``` |
@ -0,0 +1,106 @@
|
||||
{ |
||||
"dev": { |
||||
"dingTalkJs": { |
||||
"src": [ |
||||
"src/entry.js", |
||||
"src/modules/util/**/*.js", |
||||
"src/modules/module/**/*.js", |
||||
"src/modules/entry/**/*.js", |
||||
"src/modules/schedule/**/*.js" |
||||
], |
||||
"dest": "dingtalk.js" |
||||
}, |
||||
"dingTalkScheduleJs": { |
||||
"src": [ |
||||
"src/modules/util/dingtalk.ajax.util.js", |
||||
"src/modules/module/constants/errorcode.js", |
||||
"src/modules/module/combo/combo.chat.group*.js", |
||||
"src/modules/schedule/**/*.js" |
||||
], |
||||
"dest": "dingtalk.schedule.terminal.js" |
||||
}, |
||||
"dingTalkCustomApi": { |
||||
"src": [ |
||||
"src/modules/lib/sha.util.js", |
||||
"src/modules/jsapi/dingtalk.jsapi.js", |
||||
"src/modules/jsapi/dingtalk.config.jsapi.list.js", |
||||
"src/modules/jsapi/dingtalk.custom.api.js" |
||||
], |
||||
"dest": "dingtalk.custom.api.js" |
||||
}, |
||||
"dingTalkSingleLoginJs": { |
||||
"src": [ |
||||
"src/modules/single/login/dingtalk.single.login.js", |
||||
"src/modules/jsapi/dingtalk.jsapi.js" |
||||
], |
||||
"dest": "dingtalk.single.login.js" |
||||
}, |
||||
"dingTalkUtilJs": { |
||||
"src": [ |
||||
"src/modules/util/**/*.js" |
||||
], |
||||
"dest": "dingtalk.util.js" |
||||
}, |
||||
"dingTalkConstants": { |
||||
"src": [ |
||||
"src/modules/module/constants/*.js" |
||||
], |
||||
"dest": "dingtalk.constants.js" |
||||
}, |
||||
"less": { |
||||
"src": [ |
||||
"src/modules/style/*.less" |
||||
], |
||||
"dest": "src/css" |
||||
}, |
||||
"css": { |
||||
"src": [ |
||||
"src/css/**/*.css" |
||||
], |
||||
"dest": "css/dingtalk.css" |
||||
} |
||||
}, |
||||
"min": { |
||||
"js": { |
||||
"src": [ |
||||
"src/entry.js", |
||||
"src/modules/util/**/*.js", |
||||
"src/modules/module/**/*.js", |
||||
"src/modules/entry/**/*.js", |
||||
"src/modules/schedule/**/*.js" |
||||
] |
||||
}, |
||||
"dingtalkSchedule": { |
||||
"src": [ |
||||
"src/modules/util/dingtalk.ajax.util.js", |
||||
"src/modules/module/constants/errorcode.js", |
||||
"src/modules/module/combo/combo.chat.group*.js", |
||||
"src/modules/schedule/**/*.js" |
||||
] |
||||
}, |
||||
"dingTalkCustomApi": { |
||||
"src": [ |
||||
"src/modules/lib/sha.util.js", |
||||
"src/modules/jsapi/dingtalk.jsapi.js", |
||||
"src/modules/jsapi/dingtalk.config.jsapi.list.js", |
||||
"src/modules/jsapi/dingtalk.custom.api.js" |
||||
] |
||||
}, |
||||
"dingTalkSingleLogin": { |
||||
"src": [ |
||||
"src/modules/single/login/dingtalk.single.login.js", |
||||
"src/modules/jsapi/dingtalk.jsapi.js" |
||||
] |
||||
}, |
||||
"dingTalkUtil": { |
||||
"src": [ |
||||
"src/modules/util/**/*.js" |
||||
] |
||||
}, |
||||
"dingTalkConstants": { |
||||
"src": [ |
||||
"src/modules/module/constants/*.js" |
||||
] |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,249 @@
|
||||
var gulp = require("gulp"), |
||||
minifycss = require("gulp-minify-css"), |
||||
concat = require("gulp-concat"), |
||||
uglify = require("gulp-uglify"), |
||||
rename = require("gulp-rename"), |
||||
proxy = require("http-proxy-middleware"), |
||||
less = require("gulp-less"), |
||||
gutil = require("gulp-util"), |
||||
browserSync = require("browser-sync").create(), |
||||
clean = require("gulp-clean"), |
||||
cached = require("gulp-cached"), |
||||
remember = require("gulp-remember"), |
||||
header = require("gulp-header"); |
||||
|
||||
var config = require("./config"); |
||||
var pkg = require("./package.json"); |
||||
var moment = require("moment"); |
||||
|
||||
var DEST = "dist"; |
||||
|
||||
gulp.task("default", function () { |
||||
gulp.start(["dev", "serve"]); |
||||
gulp.watch("src/**/*.js", ["devjs"]); |
||||
gulp.watch("src/**/*.less", ["devcss"]); |
||||
}); |
||||
|
||||
|
||||
// 开发
|
||||
gulp.task("serve", function () { |
||||
browserSync.init({ |
||||
server: "./", |
||||
notify: false, |
||||
middleware: [ |
||||
// 配置代理
|
||||
proxy("/webroot/decision", { |
||||
target: "http://localhost:8075", |
||||
changeOrigin: true |
||||
}) |
||||
] |
||||
}); |
||||
gulp.watch("./*.html").on("change", browserSync.reload); |
||||
}); |
||||
|
||||
gulp.task("less2css", ["clean-css"], function () { |
||||
return gulp.src(config.dev.less.src) |
||||
.pipe(cached("less-cached")) |
||||
.pipe(less()) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(remember("less-cached")) |
||||
.pipe(gulp.dest(config.dev.less.dest)); |
||||
}); |
||||
|
||||
gulp.task("dev", ["devDingTalkJs", "devcss", "devDingTalkScheduleJs", "devDingTalkCustomApi", "devDingTalkSingleLoginJs", "devDingTalkUtilJs", "devDingTalkConstants"]); |
||||
|
||||
gulp.task("devcss", ["less2css"], function () { |
||||
return gulp.src(config.dev.css.src) |
||||
.pipe(concat(config.dev.css.dest)) |
||||
.pipe(header("/* <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkJs", function () { |
||||
return gulp.src(config.dev.dingTalkJs.src) |
||||
.pipe(concat(config.dev.dingTalkJs.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkScheduleJs", function () { |
||||
return gulp.src(config.dev.dingTalkScheduleJs.src) |
||||
.pipe(concat(config.dev.dingTalkScheduleJs.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkCustomApi", function () { |
||||
return gulp.src(config.dev.dingTalkCustomApi.src) |
||||
.pipe(concat(config.dev.dingTalkCustomApi.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkSingleLoginJs", function () { |
||||
return gulp.src(config.dev.dingTalkSingleLoginJs.src) |
||||
.pipe(concat(config.dev.dingTalkSingleLoginJs.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkUtilJs", function () { |
||||
return gulp.src(config.dev.dingTalkUtilJs.src) |
||||
.pipe(concat(config.dev.dingTalkUtilJs.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("devDingTalkConstants", function () { |
||||
return gulp.src(config.dev.dingTalkConstants.src) |
||||
.pipe(concat(config.dev.dingTalkConstants.dest)) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest(DEST)) |
||||
.pipe(browserSync.stream()); |
||||
}); |
||||
|
||||
gulp.task("clean-css", function () { |
||||
return gulp.src("src/css/**/*.css", {read: false}) |
||||
.pipe(clean()); |
||||
}); |
||||
|
||||
// 打包压缩
|
||||
gulp.task("min", ["proclean"], function () { |
||||
gulp.start(["minifycss", "minifyDingtalk", "minifyDingtalkSchedule", "minifyDingTalkCustomApi", "minifyDingTalkSingleLogin", "minifyDingTalkUtil", "minifyDingTalkConstants"]); |
||||
}); |
||||
|
||||
gulp.task("proclean", function () { |
||||
return gulp.src(["dist/js/*.js", "dist/css/*.css"], {read: false}) |
||||
.pipe(clean()); |
||||
}); |
||||
|
||||
gulp.task("pro-less2css", function () { |
||||
return gulp.src("src/**/*.less") |
||||
.pipe(cached("pro-less-cached")) |
||||
.pipe(less()) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(remember("pro-less-cached")) |
||||
.pipe(gulp.dest("src/css")); |
||||
}); |
||||
|
||||
gulp.task("minifycss", ["pro-less2css"], function () { |
||||
return gulp.src("src/css/**/*.css") |
||||
.pipe(concat("dingtalk.css")) |
||||
.pipe(gulp.dest("dist/css")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(minifycss()) |
||||
.pipe(header("/* <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/css")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingtalk", function () { |
||||
return gulp.src(config.min.js.src) |
||||
.pipe(concat("dingtalk.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingtalkSchedule", function () { |
||||
return gulp.src(config.min.dingtalkSchedule.src) |
||||
.pipe(concat("dingtalk.schedule.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingTalkCustomApi", function () { |
||||
return gulp.src(config.min.dingtalkSchedule.src) |
||||
.pipe(concat("dingtalk.custom.api.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingTalkSingleLogin", function () { |
||||
return gulp.src(config.min.dingtalkSchedule.src) |
||||
.pipe(concat("dingtalk.single.login.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingTalkUtil", function () { |
||||
return gulp.src(config.min.dingtalkSchedule.src) |
||||
.pipe(concat("dingtalk.util.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
||||
|
||||
gulp.task("minifyDingTalkConstants", function () { |
||||
return gulp.src(config.min.dingtalkSchedule.src) |
||||
.pipe(concat("dingtalk.constants.js")) |
||||
.pipe(gulp.dest("dist/js")) |
||||
.pipe(rename({suffix: ".min"})) |
||||
.pipe(uglify({ie8: true})) |
||||
.on("error", function (err) { |
||||
gutil.log(gutil.colors.red("[Error]"), err.toString()); |
||||
}) |
||||
.pipe(header("/** <%= name %> <%= time %> */\n", {name: pkg.name, time: moment().format("YY-MM-DD HH:mm:ss")})) |
||||
.pipe(gulp.dest("dist/js")); |
||||
}); |
@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
|
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
||||
<title>插件DEMO</title> |
||||
<link rel="stylesheet" type="text/css" href="/webroot/decision/file?path=/com/fr/web/ui/fineui.min.css&type=plain&parser=plain"> |
||||
<link rel="stylesheet" type="text/css" href="/webroot/decision/file?path=/com/fr/web/ui/materials.min.css&type=plain&parser=plain"> |
||||
|
||||
<!-- 主页使用这个 --> |
||||
<link rel="stylesheet" type="text/css" href="/webroot/decision/file?path=/com/fr/web/resources/dist/bundle.min.css&type=plain&parser=dynamic"> |
||||
|
||||
<!-- 登录页使用这个 --> |
||||
<!-- <link rel="stylesheet" type="text/css" href="/webroot/decision/file?path=/com/fr/web/resources/dist/login.min.css&type=plain&parser=dynamic"> --> |
||||
|
||||
<link rel="stylesheet" type="text/css" href="dist/dev.css"/> |
||||
|
||||
</head> |
||||
|
||||
<body> |
||||
<div id="wrapper"></div> |
||||
<script type="text/javascript"> |
||||
// 一些初始化会注入页面的信息,后期如果有报错可以更新这边 |
||||
window.Dec = window.Dec || {}; |
||||
Dec.injection = {}; |
||||
Dec.fineServletURL = "/webroot/decision"; |
||||
|
||||
Dec.system = JSON.parse('{\"hyperlink\":{},\"authConfig\":{\"gradeAuth\":false,\"editReportAuth\":false,\"dataConnectAuth\":false},\"frontSeed\":\"eZtTjIenyBUtuaLQ\",\"styleConfig\":{\"platformTitle\":\"decision\",\"headerType\":0,\"logoImgId\":\"\",\"logoImgName\":\"\",\"headBgMode\":0,\"headBgImgId\":\"\",\"headBgImgName\":\"\",\"headBgColor\":\"\",\"colorScheme\":0,\"customColors\":[]},\"timeZone\":28800000,\"weekBegins\":0,\"versionInfo\":[{\"data\":null,\"classInfo\":null,\"id\":\"hYk7n3h5\",\"nameSpace\":null,\"nameLocaleKey\":\"Fine-Core_Module_Name\",\"version\":\"10.0.0\",\"jarTime\":\"Build#feature-2019.07.23.09.41.48.106\",\"level\":\"10\",\"name\":\"unnamed\"},{\"data\":null,\"classInfo\":null,\"id\":\"Ditah0YC\",\"nameSpace\":null,\"nameLocaleKey\":\"Fine-Datasource_Module_Name\",\"version\":\"10.0.0\",\"jarTime\":\"Build#feature-2019.07.23.09.42.15.219\",\"level\":\"\",\"name\":\"unnamed\"},{\"data\":null,\"classInfo\":null,\"id\":\"kh8FBuJb\",\"nameSpace\":null,\"nameLocaleKey\":\"Fine-Dec_Module_Name\",\"version\":\"10.0.0\",\"jarTime\":\"Build#feature-2019.07.23.09.43.47.730\",\"level\":\"10\",\"name\":\"decision\"},{\"data\":null,\"classInfo\":null,\"id\":\"EH-uq2OJ\",\"nameSpace\":null,\"nameLocaleKey\":\"Fine-Engine_Report_Module_Name\",\"version\":\"10.0.0\",\"jarTime\":\"Build#feature-2019.07.23.10.03.04.447\",\"level\":\"10\",\"name\":\"report\"},{\"data\":null,\"classInfo\":null,\"id\":\"Sdj8JRFo\",\"nameSpace\":null,\"nameLocaleKey\":\"BI-Foundation_Module_Name\",\"version\":\"5.1.0\",\"jarTime\":\"Build#feature-2019.07.23.10.24.39.712\",\"level\":\"5\",\"name\":\"unnamed\"}],\"smsAvailable\":false,\"webSocket\":{\"webSocketContextName\":\"\/socket.io\",\"webSocketHostName\":\"0.0.0.0\",\"webSocketProtocol\":\"plain\",\"webSocketNameSpace\":\"\/system\",\"webSocketPort\":[38888,39888,38889]},\"syncDataSet\":false,\"adminUser\":[\"1\"],\"loginInfoRemind\":false,\"loginTimeout\":3600000,\"themeConfig\":[{\"themeId\":\"com.fr.plugin.decision.theme.zxl.lunbo\",\"name\":\"轮播主题\",\"text\":\"轮播主题\",\"cover\":\"com\/fr\/plugin\/decision\/theme\/logo.png\",\"active\":false}],\"emailAvailable\":false,\"cookiePath\":\"\/\",\"authentication\":\"default\"}'); |
||||
Dec.personal = JSON.parse('{\"creationType\":1,\"realName\":\"1\",\"userExtraProps\":[\"user_product_type.platform\",\"user_product_type.platform.bi_design.bi_data_analysis\",\"user_product_type.mobile\",\"user_product_type.platform.bi_datamining\"],\"displayName\":\"1(1)\",\"userId\":\"a54c78b9-34e7-4f6e-ada5-20756e79ec0a\",\"username\":\"1\",\"homepage\":{}}'); |
||||
|
||||
// 如果是登录页,从登录页相同位置复制对应配置过来 |
||||
</script> |
||||
<script type="text/javascript" src="/webroot/decision/file?path=/com/fr/web/ui/fineui.min.js&type=plain&parser=plain"></script> |
||||
<script type="text/javascript" src="/webroot/decision/file?path=com.fr.decision.web.i18n.I18nTextGenerator&type=class&parser=plain"></script> |
||||
<script type="text/javascript" src="/webroot/decision/file?path=com.fr.decision.web.constant.ConstantGenerator&type=class&parser=plain"></script> |
||||
|
||||
<script type="text/javascript" src="/webroot/decision/file?path=/com/fr/web/socketio/dist/socket.io.js&type=plain&parser=plain"></script> |
||||
<script type="text/javascript" src="/webroot/decision/file?path=/com/fr/web/ui/materials.min.js&type=plain&parser=plain"></script> |
||||
|
||||
<!-- 引入对应页面的资源,这是主页 --> |
||||
<script type="text/javascript" src="/webroot/decision/file?path=/com/fr/web/resources/dist/bundle.min.js&type=plain&parser=plain"></script> |
||||
|
||||
<!-- 登录页使用这个 --> |
||||
<!-- <script type="text/javascript" src="/webroot/decision/file?path=/com/fr/web/resources/dist/login.min.js&type=plain&parser=plain"></script> --> |
||||
|
||||
<script src="dist/dev.js"></script> |
||||
|
||||
<script> |
||||
Dec.start(); |
||||
</script> |
||||
</body> |
||||
|
||||
</html> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
{ |
||||
"name": "com.fr.plugin.officialaccount", |
||||
"version": "1.0.0", |
||||
"description": "WeChat officialaccount plugin", |
||||
"main": "index.js", |
||||
"devDependencies": { |
||||
"browser-sync": "^2.26.3", |
||||
"eslint": "^4.19.1", |
||||
"eslint-plugin-mocha": "^5.2.0", |
||||
"gulp": "^3.9.1", |
||||
"gulp-cached": "^1.1.1", |
||||
"gulp-clean": "^0.4.0", |
||||
"gulp-concat": "^2.6.1", |
||||
"gulp-eslint": "^5.0.0", |
||||
"gulp-header": "^2.0.5", |
||||
"gulp-less": "^4.0.1", |
||||
"gulp-minify-css": "^1.2.4", |
||||
"gulp-remember": "^1.0.1", |
||||
"gulp-rename": "^1.4.0", |
||||
"gulp-replace": "^1.0.0", |
||||
"gulp-uglify": "^3.0.1", |
||||
"gulp-util": "^3.0.8", |
||||
"http-proxy-middleware": "^0.19.0", |
||||
"less": "^2.7.2", |
||||
"moment": "^2.22.2" |
||||
}, |
||||
"scripts": { |
||||
"dev": "gulp", |
||||
"build": "gulp min", |
||||
"eslint": "eslint src --fix" |
||||
}, |
||||
"author": "", |
||||
"license": "MIT", |
||||
"dependencies": {} |
||||
} |
@ -0,0 +1,15 @@
|
||||
// !(function () {
|
||||
// Dec.Configs.pushConfig(function () {
|
||||
// 示例,往左侧管理菜单中加上一项
|
||||
// BI.config("dec.constant.management.navigation", function (items) {
|
||||
// items.push({
|
||||
// value: "pluginD",
|
||||
// id: "decision-management-plugin-demo",
|
||||
// text: "这是插件DEMO",
|
||||
// cardType: "dec.plugin.demo",
|
||||
// cls: "management-plugin-font"
|
||||
// });
|
||||
// return items;
|
||||
// });
|
||||
// });
|
||||
// })();
|
@ -0,0 +1,12 @@
|
||||
/* |
||||
* 工程配置文件 |
||||
*/ |
||||
!(function () { |
||||
if (!window.Dec) { |
||||
window.Dec = {}; |
||||
Dec.injection = {}; |
||||
} |
||||
if (!window.DecCst) { |
||||
window.DecCst = {}; |
||||
} |
||||
})(); |
@ -0,0 +1,38 @@
|
||||
// 添加一个新节点
|
||||
!(function () { |
||||
Dec.Plugin.Management.addItem({ |
||||
id: 'DingTalkSynSynSystemOption', |
||||
value: 'DingTalkSynSynSystemOption', |
||||
displayName: BI.i18nText('Plugin-dingtalksyn_DingTalkSyn_Manager'), |
||||
cls: 'dingtalksyn-node-font', |
||||
cardType: 'dec.plugin.dingtalksyn' |
||||
}); |
||||
})(); |
||||
|
||||
!(function () { |
||||
var DingTalkSynManagement = BI.inherit(BI.Widget, { |
||||
_store: function() { |
||||
return BI.Models.getModel('dingtalksyn.model.entry'); |
||||
}, |
||||
|
||||
beforeInit: function (callBack) { |
||||
this.store.checkLisence(callBack); |
||||
}, |
||||
|
||||
render: function () { |
||||
return this.model.authorized ? { |
||||
type: 'dingtalksyn.tab', |
||||
cls: 'dingtalksyn-container' |
||||
} : { |
||||
type: "bi.adaptive", |
||||
items: [{ |
||||
type: 'bi.iframe', |
||||
cls: "bi-card", |
||||
src: resolvePath('/dingtalksyn/expired', false) |
||||
}] |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dec.plugin.dingtalksyn", DingTalkSynManagement); |
||||
}) (); |
@ -0,0 +1,33 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
|
||||
state: function() { |
||||
return { |
||||
authorized: true |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
checkLisence: function (callBack) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/check/license', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.authorized = result.authorized; |
||||
callBack(); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.entry", Model); |
||||
}) (); |
@ -0,0 +1,61 @@
|
||||
function getJsApiList() { |
||||
return jsApiList; |
||||
} |
||||
var jsApiList = [ |
||||
'runtime.info', |
||||
'runtime.permission.requestAuthCode', |
||||
'biz.util.scan', |
||||
'biz.util.uploadImage', |
||||
'biz.navigation.setTitle', |
||||
'device.geolocation.get', |
||||
'device.base.getUUID', |
||||
'device.base.getInterface', |
||||
'device.nfc.nfcWrite', |
||||
'runtime.permission.requestOperateAuthCode', |
||||
'biz.util.scanCard', |
||||
'device.geolocation.start', |
||||
'device.geolocation.stop', |
||||
'biz.map.locate', |
||||
'biz.map.search', |
||||
'biz.map.view', |
||||
'biz.clipboardData.setData', |
||||
'biz.util.open', |
||||
'biz.telephone.call', |
||||
'biz.telephone.showCallMenu', |
||||
'biz.telephone.checkBizCall', |
||||
'biz.telephone.quickCallList', |
||||
'biz.ding.create', |
||||
'biz.ding.post', |
||||
'biz.contact.choose', |
||||
'biz.contact.chooseMobileContacts', |
||||
'biz.contact.complexPicker', |
||||
'biz.contact.departmentsPicker', |
||||
'biz.contact.createGroup', |
||||
'biz.contact.setRule', |
||||
'biz.contact.externalComplexPicker', |
||||
'biz.contact.externalEditForm', |
||||
'biz.customContact.choose', |
||||
'biz.customContact.multipleChoose', |
||||
'biz.chat.pickConversation', |
||||
'biz.chat.chooseConversationByCorpId', |
||||
'biz.chat.openSingleChat', |
||||
'biz.chat.toConversation', |
||||
'biz.cspace.saveFile', |
||||
'biz.cspace.preview', |
||||
'biz.cspace.chooseSpaceDir', |
||||
'biz.util.uploadAttachment', |
||||
'device.audio.startRecord', |
||||
'device.audio.stopRecord', |
||||
'device.audio.onRecordEnd', |
||||
'device.audio.download', |
||||
'device.audio.play', |
||||
'device.audio.pause', |
||||
'device.audio.resume', |
||||
'device.audio.stop', |
||||
'device.audio.onPlayEnd', |
||||
'device.audio.translateVoice', |
||||
'biz.conference.videoConfCall', |
||||
'biz.alipay.pay', |
||||
'biz.util.encrypt', |
||||
'biz.util.decrypt' |
||||
]; |
@ -0,0 +1,211 @@
|
||||
if (!window.Dec) { |
||||
window.Dec = {}; |
||||
} |
||||
|
||||
if (!window.Dec.H5) { |
||||
window.Dec.H5 = {}; |
||||
} |
||||
|
||||
var pluginId = 'com.fr.plugin.dingtalksyn'; |
||||
|
||||
function resolvePath(path, isPublic) { |
||||
if (!path || path[0] !== '/') { |
||||
path = '/' + path; |
||||
} |
||||
return isPublic === true |
||||
? window.FRTemplate.servletURL + '/plugin/public/' + pluginId + path |
||||
: window.FRTemplate.servletURL + '/plugin/private/' + pluginId + path; |
||||
} |
||||
|
||||
window.Dec.H5 = { |
||||
ERROR_CODE_EXPIRE: 11100016, |
||||
ERROR_CODE_NOT_SUPPORTED: 11205020, |
||||
ERROR_CODE_LOGIN_FAIL: 11205027, |
||||
|
||||
Config: function() { |
||||
var self = this; |
||||
var sb = self._getQueryString('sb'); |
||||
if (sb) { |
||||
self._ajax({ |
||||
url: resolvePath('/dingtalksyn/js/ticket?sb=' + sb), |
||||
type: 'GET', |
||||
success: function (req) { |
||||
var result = JSON.parse(req.responseText); |
||||
var timeStamp = new Date().getTime(); |
||||
var nonceStr = 'dingtalksyn'; |
||||
var jsTicket = result.jsTicket; |
||||
var jsApiList = getJsApiList(); |
||||
dd.config({ |
||||
agentId: result.agentId, |
||||
corpId: result.corpId, |
||||
timeStamp: timeStamp, |
||||
nonceStr: nonceStr, |
||||
signature: self._createSignature(timeStamp, nonceStr, jsTicket), |
||||
jsApiList: jsApiList |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
Ready: function(_callBack) { |
||||
dd.ready(_callBack); |
||||
}, |
||||
|
||||
Error: function(_callBack) { |
||||
dd.error(_callBack); |
||||
}, |
||||
|
||||
ScanQRCode: function(needResult, success, error) { |
||||
dd.biz.util.scan({ |
||||
type: 'all', |
||||
onSuccess: success, |
||||
onFail : error |
||||
}) |
||||
}, |
||||
|
||||
GetLocation: function(success, error, type) { |
||||
var coordinate = type == "wgs84" ? 0 : 1; |
||||
dd.device.geolocation.get({ |
||||
targetAccuracy: 200, |
||||
coordinate: coordinate, |
||||
withReGeocode: false, |
||||
useCache: false, //默认是true,如果需要频繁获取地理位置,请设置false
|
||||
onSuccess : function(res) { |
||||
success(res); |
||||
}, |
||||
onFail : function(err) { |
||||
error(err); |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
ChooseImage: function(count, success) { |
||||
var self = this; |
||||
var jo = arguments[0]; |
||||
var compress = false; |
||||
if (jo instanceof Object) { |
||||
count = jo.count || 9; |
||||
success = jo.success || function () { |
||||
|
||||
}; |
||||
compress = jo.compress || false; |
||||
} |
||||
var callBack = function(res) { |
||||
self._getImgStrFromUrl(res, function(datas) { |
||||
success(datas); |
||||
}); |
||||
}; |
||||
dd.biz.util.uploadImage({ |
||||
compression: compress,//(是否压缩)
|
||||
multiple: true, //是否多选,默认false
|
||||
max: count, //最多可选个数
|
||||
quality: 50, // 图片压缩质量,
|
||||
resize: 50, // 图片缩放率
|
||||
onSuccess : callBack, |
||||
onFail : function(err) { |
||||
|
||||
} |
||||
}) |
||||
}, |
||||
|
||||
SetTitle: function(title, success, fail) { |
||||
document.title = title; |
||||
dd.biz.navigation.setTitle({ |
||||
title : title,//控制标题文本,空字符串表示显示默认文本
|
||||
onSuccess : success, |
||||
onFail : fail |
||||
}); |
||||
}, |
||||
|
||||
/** |
||||
* 钉钉旋转到横屏状态,如果showStatusBar被指定为false,则手机导航栏(带时间、信号的那一栏)都会被隐藏 |
||||
* @constructor |
||||
*/ |
||||
RotateViewToLandScape: function (success, fail) { |
||||
dd.device.screen.rotateView({ |
||||
showStatusBar : true, // 否显示statusbar
|
||||
clockwise : true, // 是否顺时针方向
|
||||
onSuccess : success, |
||||
onFail : fail |
||||
}); |
||||
}, |
||||
|
||||
ResetRotation: function (success, fail) { |
||||
dd.device.screen.resetView({ |
||||
onSuccess : success, |
||||
onFail : fail |
||||
}); |
||||
}, |
||||
|
||||
GoBack: function (success, fail) { |
||||
dd.biz.navigation.goBack({ |
||||
onSuccess : success, |
||||
onFail : fail |
||||
}) |
||||
}, |
||||
|
||||
OpenLink: function(url, success, fail) { |
||||
dd.biz.util.openLink({ |
||||
url: url, //要打开链接的地址
|
||||
onSuccess : success, |
||||
onFail : fail |
||||
}); |
||||
}, |
||||
|
||||
_getImgStrFromUrl: function(urls, callBack) { |
||||
var self = this; |
||||
self._ajax({ |
||||
url: resolvePath('/dingtalksyn/get/url/base64data'), |
||||
type: 'POST', |
||||
data: 'imgUrls=' + urls, |
||||
success: function(req) { |
||||
var result = JSON.parse(req.responseText); |
||||
if (result.errorCode === 0) { |
||||
callBack(result.datas); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
_ajax: function(props) { |
||||
if (props instanceof Object) { |
||||
var url = props.url || ''; |
||||
var data = props.data || {}; |
||||
var type = props.type || 'POST'; |
||||
var async = props.async === undefined? true : props.async; |
||||
var complete = props.complete || function(req) {}; |
||||
var success = props.success || function(req) {}; |
||||
var fail = props.fail || function(req) {}; |
||||
|
||||
var xmlHttpRequest = new XMLHttpRequest(); |
||||
xmlHttpRequest.onreadystatechange = function() { |
||||
if (xmlHttpRequest.readyState === 4 && xmlHttpRequest.status === 200) { |
||||
success.call(this, xmlHttpRequest); |
||||
} else { |
||||
fail.call(this, xmlHttpRequest); |
||||
} |
||||
complete.call(this, xmlHttpRequest); |
||||
}; |
||||
xmlHttpRequest.open(type, url, async); |
||||
xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"); |
||||
xmlHttpRequest.send(data); |
||||
} |
||||
}, |
||||
|
||||
_createSignature: function(timeStamp, nonceStr, jsTicket) { |
||||
var url = decodeURIComponent(location.href.split('#')[0]); |
||||
var plainTex = "jsapi_ticket=" + jsTicket + "&noncestr=" + nonceStr + "×tamp=" + timeStamp + "&url=" + url; |
||||
return SHA2(utf16to8(plainTex)); |
||||
}, |
||||
|
||||
_getQueryString: function(key) { |
||||
var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i"); |
||||
var result = window.location.search.substr(1).match(reg); |
||||
if (result !== null) { |
||||
return decodeURIComponent(result[2]) |
||||
} else { |
||||
return ''; |
||||
} |
||||
} |
||||
}; |
File diff suppressed because one or more lines are too long
@ -0,0 +1,99 @@
|
||||
// SHA1
|
||||
function add(x, y) { |
||||
return((x & 0x7FFFFFFF) + (y & 0x7FFFFFFF)) ^ (x & 0x80000000) ^ (y & 0x80000000); |
||||
} |
||||
|
||||
function SHA1hex(num) { |
||||
var sHEXChars = "0123456789abcdef"; |
||||
var str = ""; |
||||
for(var j = 7; j >= 0; j--) |
||||
str += sHEXChars.charAt((num >> (j * 4)) & 0x0F); |
||||
return str; |
||||
} |
||||
|
||||
function AlignSHA1(sIn) { |
||||
var nblk = ((sIn.length + 8) >> 6) + 1, |
||||
blks = new Array(nblk * 16); |
||||
for(var i = 0; i < nblk * 16; i++) blks[i] = 0; |
||||
for(i = 0; i < sIn.length; i++) |
||||
blks[i >> 2] |= sIn.charCodeAt(i) << (24 - (i & 3) * 8); |
||||
blks[i >> 2] |= 0x80 << (24 - (i & 3) * 8); |
||||
blks[nblk * 16 - 1] = sIn.length * 8; |
||||
return blks; |
||||
} |
||||
|
||||
function rol(num, cnt) { |
||||
return(num << cnt) | (num >>> (32 - cnt)); |
||||
} |
||||
|
||||
function ft(t, b, c, d) { |
||||
if(t < 20) return(b & c) | ((~b) & d); |
||||
if(t < 40) return b ^ c ^ d; |
||||
if(t < 60) return(b & c) | (b & d) | (c & d); |
||||
return b ^ c ^ d; |
||||
} |
||||
|
||||
function kt(t) { |
||||
return(t < 20) ? 1518500249 : (t < 40) ? 1859775393 : |
||||
(t < 60) ? -1894007588 : -899497514; |
||||
} |
||||
|
||||
function SHA1(sIn) { |
||||
var x = AlignSHA1(sIn); |
||||
var w = new Array(80); |
||||
var a = 1732584193; |
||||
var b = -271733879; |
||||
var c = -1732584194; |
||||
var d = 271733878; |
||||
var e = -1009589776; |
||||
for(var i = 0; i < x.length; i += 16) { |
||||
var olda = a; |
||||
var oldb = b; |
||||
var oldc = c; |
||||
var oldd = d; |
||||
var olde = e; |
||||
for(var j = 0; j < 80; j++) { |
||||
if(j < 16) w[j] = x[i + j]; |
||||
else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); |
||||
t = add(add(rol(a, 5), ft(j, b, c, d)), add(add(e, w[j]), kt(j))); |
||||
e = d; |
||||
d = c; |
||||
c = rol(b, 30); |
||||
b = a; |
||||
a = t; |
||||
} |
||||
a = add(a, olda); |
||||
b = add(b, oldb); |
||||
c = add(c, oldc); |
||||
d = add(d, oldd); |
||||
e = add(e, olde); |
||||
} |
||||
SHA1Value = SHA1hex(a) + SHA1hex(b) + SHA1hex(c) + SHA1hex(d) + SHA1hex(e); |
||||
return SHA1Value.toUpperCase(); |
||||
} |
||||
|
||||
function SHA2(sIn) { |
||||
return SHA1(sIn).toLowerCase(); |
||||
} |
||||
|
||||
// JavaScript内部对字符串是UTF-16编码,要想加密结果和java保持一致需要先转成UTF-8
|
||||
function utf16to8(str) { |
||||
var out, i, len, c; |
||||
|
||||
out = ""; |
||||
len = str.length; |
||||
for(i = 0; i < len; i++){ |
||||
c = str.charCodeAt(i); |
||||
if ((c >= 0x0001) && (c <= 0x007F)) { |
||||
out += str.charAt(i); |
||||
} else if (c > 0x07FF){ |
||||
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); |
||||
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); |
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); |
||||
} else { |
||||
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); |
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); |
||||
} |
||||
} |
||||
return out; |
||||
} |
@ -0,0 +1,41 @@
|
||||
!(function () { |
||||
var ClipboardButton = BI.inherit(BI.Widget, { |
||||
props: { |
||||
width: 80, |
||||
height: 24, |
||||
text: '', |
||||
copy: function () { |
||||
|
||||
}, |
||||
afterCopy: function () { |
||||
|
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
var clipBoard = BI.createWidget({ |
||||
type: 'bi.clipboard', |
||||
width: o.width, |
||||
height: o.height, |
||||
element: self, |
||||
copy: function () { |
||||
return o.copy(); |
||||
}, |
||||
afterCopy: function () { |
||||
o.afterCopy(); |
||||
} |
||||
}); |
||||
|
||||
var button = BI.createWidget({ |
||||
type: 'bi.button', |
||||
width: o.width, |
||||
height: o.height, |
||||
text: o.text, |
||||
element: clipBoard |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.clipboard.button', ClipboardButton); |
||||
}) (); |
@ -0,0 +1,66 @@
|
||||
!(function () { |
||||
var ChatGroupCombo = BI.inherit(BI.Widget, { |
||||
props: { |
||||
count: 10 |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.chatgroup.combo"); |
||||
}, |
||||
|
||||
beforeInit: function (callback) { |
||||
var self = this; |
||||
BI.Services.getService("dingtalksyn.service.schedule.event").on("AGENT_CHANGE", function (v) { |
||||
self.store.setSelectedAgentId(v); |
||||
}); |
||||
this.store.init(callback); |
||||
}, |
||||
|
||||
watch: { |
||||
selectedValue: function (v) { |
||||
this.combo.setValue(v); |
||||
}, |
||||
|
||||
selectedAgentId: function (v) { |
||||
// 应用变化,那么群肯定需要重新选择
|
||||
this.store.setSelectedValue({}); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.multi_select_combo", |
||||
value: self.model.selectedValue, |
||||
valueFormatter: BI.bind(this.store.valueFormatter, this), |
||||
itemsCreator: BI.bind(this.store.itemsCreator, this), |
||||
width: o.width, |
||||
height: o.height, |
||||
ref: function (_ref) { |
||||
self.combo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function () { |
||||
self.store.setSelectedValue(this.getValue()); |
||||
self.fireEvent("EVENT_CONFIRM", this.getValue()); |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
destroyed: function () { |
||||
BI.Services.getService("dingtalksyn.service.schedule.event").un("AGENT_CHANGE"); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.model.selectedValue; |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.store.setSelectedValue(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.chatgroup.combo", ChatGroupCombo); |
||||
})(); |
@ -0,0 +1,52 @@
|
||||
!(function () { |
||||
var ChatGroupMemberCombo = BI.inherit(BI.Widget, { |
||||
props: { |
||||
count: 50, |
||||
selectLeader: false |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.chatgroup.member.combo", this.options); |
||||
}, |
||||
|
||||
watch: { |
||||
agentId: function (v) { |
||||
this.setValue(null); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: o.selectLeader ? "bi.single_select_combo" : "bi.multi_select_combo", |
||||
allowNoSelect: true, |
||||
value: o.value, |
||||
text: o.text, |
||||
valueFormatter: BI.bind(this.store.valueFormatter, this), |
||||
itemsCreator: BI.bind(this.store.itemsCreator, this), |
||||
width: o.width, |
||||
height: o.height, |
||||
ref: function (_ref) { |
||||
self.combo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function () { |
||||
var selectedMember = this.getValue(); |
||||
self.fireEvent("EVENT_CONFIRM", selectedMember); |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.combo.getValue(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.combo.setValue(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.chatgroup.member.combo", ChatGroupMemberCombo); |
||||
})(); |
@ -0,0 +1,107 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
_init: function () { |
||||
var o = this.options; |
||||
this.resultItems = []; |
||||
this.map = {}; |
||||
if (!BI.isEmpty(o.value)) { |
||||
this.map[o.value] = o.text + " (" + o.value + ")"; |
||||
} |
||||
}, |
||||
|
||||
context: ["agentId"], |
||||
|
||||
actions: { |
||||
getMembers: function (times, count, keyword, callback) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/agentmember', |
||||
type: 'GET', |
||||
data: { |
||||
startIdx: (times - 1) * count, |
||||
count: count, |
||||
agentId: self.model.agentId, |
||||
keyword: BI.isKey(keyword) ? keyword : "" |
||||
}, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
var data = result.data; |
||||
var hasNext = data.total > times * count; |
||||
callback(data.userList, hasNext); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
itemsCreator: function (options, populate) { |
||||
var self = this, o = this.options, keyword = BI.isNotEmptyArray(options.keywords) ? options.keywords.join("") : ""; |
||||
if (o.selectLeader) { |
||||
if (options.type === BI.SingleSelectCombo.REQ_GET_DATA_LENGTH) { |
||||
populate({}); |
||||
return; |
||||
} |
||||
} else { |
||||
if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { |
||||
populate({ |
||||
items: this.resultItems |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { |
||||
populate({ |
||||
count: this.resultItems.length |
||||
}); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
if(options.times) { |
||||
this.getMembers(options.times, o.count, keyword, function (res, hasNext) { |
||||
if (options.selectedValues) { |
||||
var filter = BI.makeObject(options.selectedValues, true); |
||||
res = BI.filter(res, function (i, ob) { |
||||
return !filter[ob.userId]; |
||||
}); |
||||
} |
||||
self.resultItems = self._processUserItems(res); |
||||
populate({ |
||||
items: self.resultItems, |
||||
hasNext: hasNext |
||||
}); |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
_processUserItems: function (items) { |
||||
var self = this, o = this.options; |
||||
return BI.map(items, function (i, v) { |
||||
self.map[v.userId] = v.name; |
||||
return o.selectLeader ? { |
||||
type: "bi.text_item", |
||||
textLgap: 10, |
||||
title: v.name, |
||||
text: v.name, |
||||
value: v.userId, |
||||
cls: "bi-list-item" |
||||
} : { |
||||
text: v.name, |
||||
value: v.userId, |
||||
title: v.name |
||||
}; |
||||
}); |
||||
}, |
||||
|
||||
valueFormatter: function (v) { |
||||
return this.map[v] || v; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.chatgroup.member.combo", Model); |
||||
})(); |
@ -0,0 +1,113 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function () { |
||||
return { |
||||
chatGroups: {}, |
||||
selectedAgentId: BI.Services.getService("dingtalksyn.service.schedule.event").getSelectedAgentId() |
||||
} |
||||
}, |
||||
|
||||
context: ["selectedValue"], |
||||
|
||||
computed: { |
||||
chatGroupItems: function () { |
||||
return this._processChatItems(this.model.chatGroups); |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
init: function (callback) { |
||||
this.map = {}; |
||||
this.getAllChatGroups(callback); |
||||
}, |
||||
|
||||
getAllChatGroups: function (callback) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/chatgroup', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.chatGroups = result.chatGroups; |
||||
self._processChatItems(self.model.chatGroups); // 这里只是为了生成一下map,否则不点开下拉框map无法生成
|
||||
callback(); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
itemsCreator: function (options, populate) { |
||||
var self = this, keywords = (options.keywords || []).slice(); |
||||
|
||||
var items = BI.filter(self.model.chatGroupItems, function (i, ob) { |
||||
return ob.agentId === self.model.selectedAgentId; |
||||
}); |
||||
|
||||
if (options.keyword) { |
||||
keywords.push(options.keyword); |
||||
} |
||||
BI.each(keywords, function (i, keyword) { |
||||
var search = BI.Func.getSearchResult(items, keyword); |
||||
items = search.match.concat(search.find); |
||||
}); |
||||
|
||||
if (options.selectedValues) { |
||||
var filter = BI.makeObject(options.selectedValues, true); |
||||
items = BI.filter(items, function (i, ob) { |
||||
return !filter[ob.value]; |
||||
}); |
||||
} |
||||
|
||||
if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { |
||||
populate({ |
||||
items: items |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { |
||||
populate({ |
||||
count: items.length |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
populate({ |
||||
items: items, |
||||
hasNext: false |
||||
}); |
||||
}, |
||||
|
||||
_processChatItems: function (items) { |
||||
var self = this, o = this.options; |
||||
return BI.map(items, function (i, v) { |
||||
self.map[v.chatGroupId] = v.chatGroupName; |
||||
return { |
||||
text: v.chatGroupName, |
||||
value: v.chatGroupId, |
||||
agentId: v.agentId |
||||
}; |
||||
}); |
||||
}, |
||||
|
||||
valueFormatter: function (v) { |
||||
return this.map[v] || v; |
||||
}, |
||||
|
||||
setSelectedValue: function (v) { |
||||
this.model.selectedValue = v; |
||||
}, |
||||
|
||||
setSelectedAgentId: function (v) { |
||||
this.model.selectedAgentId = v; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.chatgroup.combo", Model); |
||||
})(); |
@ -0,0 +1,78 @@
|
||||
(function() { |
||||
var EditorTextCombo = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(EditorTextCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseClass: "", |
||||
width: 100, |
||||
height: 24, |
||||
allowBlank: true, |
||||
watermark: "", |
||||
editable: false, |
||||
errorText: "" |
||||
}) |
||||
}, |
||||
|
||||
_init: function () { |
||||
EditorTextCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.trigger = BI.createWidget({ |
||||
type: "dingtalksyn.editor_trigger", |
||||
items: o.items, |
||||
height: o.height, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
editable: o.editable, |
||||
errorText: o.errorText, |
||||
value: o.value |
||||
}); |
||||
this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { |
||||
self.popup.setValue(this.getValue()); |
||||
self.fireEvent(EditorTextCombo.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.popup = BI.createWidget({ |
||||
type: "bi.text_value_combo_popup", |
||||
value: o.value, |
||||
items: o.items |
||||
}); |
||||
this.popup.on(EditorTextCombo.EVENT_CHANGE, function () { |
||||
self.setValue(self.popup.getValue()); |
||||
self.editorTextCombo.hideView(); |
||||
self.fireEvent(EditorTextCombo.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.popup.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editorTextCombo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
element: this, |
||||
adjustLength: 2, |
||||
el: this.trigger, |
||||
popup: { |
||||
el: this.popup, |
||||
maxHeight: 300 |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.editorTextCombo.setValue(v); |
||||
}, |
||||
|
||||
setText: function(t) { |
||||
this.trigger.setText(t); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.trigger.getValue(); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.options.items = items; |
||||
this.trigger.populate(items); |
||||
this.editorTextCombo.populate(items); |
||||
} |
||||
}); |
||||
|
||||
EditorTextCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("dingtalksyn.editor_text_value_combo", EditorTextCombo); |
||||
})(); |
@ -0,0 +1,110 @@
|
||||
!(function() { |
||||
var SearchTextValueCombo = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "bi-search-text-value-combo", |
||||
height: 30, |
||||
text: "", |
||||
items: [] |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.absolute", |
||||
cls: 'dingtalksyn-search-combo-container', |
||||
items: [{ |
||||
el: { |
||||
type: "bi.combo", |
||||
adjustLength: 2, |
||||
toggle: false, |
||||
ref: function () { |
||||
self.combo = this; |
||||
}, |
||||
el: { |
||||
type: "dingtalksyn.search_text_value_trigger", |
||||
ref: function () { |
||||
self.trigger = this; |
||||
}, |
||||
items: o.items, |
||||
height: o.height - 2, |
||||
text: o.text, |
||||
value: o.value, |
||||
listeners: [{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self.setValue(this.getValue()); |
||||
self.combo.hideView(); |
||||
self.fireEvent(SearchTextValueCombo.EVENT_CHANGE); |
||||
} |
||||
}] |
||||
}, |
||||
popup: { |
||||
el:{ |
||||
type: "bi.text_value_combo_popup", |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
||||
value: o.value, |
||||
items: o.items, |
||||
ref: function () { |
||||
self.popup = this; |
||||
self.trigger.getSearcher().setAdapter(self.popup); |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextValueComboPopup.EVENT_CHANGE, |
||||
action: function () { |
||||
self.setValue(this.getValue()); |
||||
self.combo.hideView(); |
||||
self.fireEvent(SearchTextValueCombo.EVENT_CHANGE); |
||||
} |
||||
}] |
||||
}, |
||||
maxHeight: 300 |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, |
||||
action: function(){ |
||||
self.trigger.stopEditing(); |
||||
} |
||||
}] |
||||
}, |
||||
left: 0, |
||||
right: 0, |
||||
bottom: 0, |
||||
top: 0 |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
cls: 'dingtalksyn-search-combo-button', |
||||
width: o.height, |
||||
handler: function () { |
||||
if (self.combo.isViewVisible()) { |
||||
self.combo.hideView(); |
||||
} else { |
||||
self.combo.showView(); |
||||
} |
||||
} |
||||
}, |
||||
right: 0, |
||||
bottom: 0, |
||||
top: 0 |
||||
}] |
||||
} |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.options.items = items; |
||||
this.combo.populate(items); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.combo.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var value = this.popup.getValue(); |
||||
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]); |
||||
} |
||||
}); |
||||
SearchTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("dingtalksyn.search_text_value_combo", SearchTextValueCombo); |
||||
})(); |
@ -0,0 +1,41 @@
|
||||
!(function () { |
||||
var UserCombo = BI.inherit(BI.Widget, { |
||||
props: { |
||||
text: "" |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.user.combo", this.options); |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.single_select_combo", |
||||
allowNoSelect: true, |
||||
value: o.value, |
||||
text: o.text, |
||||
valueFormatter: BI.bind(this.store.valueFormatter, this), |
||||
itemsCreator: BI.bind(this.store.itemsCreator, this), |
||||
width: o.width, |
||||
height: o.height, |
||||
ref: function (_ref) { |
||||
self.userCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function () { |
||||
var user = this.getValue(); |
||||
self.fireEvent("EVENT_CONFIRM", user); |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.userCombo.getValue(); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.user.combo", UserCombo); |
||||
})(); |
@ -0,0 +1,69 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
_init: function () { |
||||
var o = this.options; |
||||
this.map = {}; |
||||
if (!BI.isEmpty(o.value)) { |
||||
this.map[o.value] = o.text + " (" + o.value + ")"; |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
getUsers: function (times, count, keyword, callback) { |
||||
Dec.Utils.reqUsersByPage({ |
||||
page: times, |
||||
count: count, |
||||
keyword: keyword |
||||
}, function (res) { |
||||
var data = res.data; |
||||
var hasNext = data.total > times * count; |
||||
callback(data.items, hasNext); |
||||
}); |
||||
}, |
||||
|
||||
itemsCreator: function (options, populate) { |
||||
var self = this, o = this.options, keyword = options.keywords && options.keywords[0]; |
||||
|
||||
if (options.type === BI.SingleSelectCombo.REQ_GET_DATA_LENGTH) { |
||||
populate({}); |
||||
return; |
||||
} |
||||
|
||||
if(options.times) { |
||||
this.getUsers(options.times, o.count, keyword, function (res, hasNext) { |
||||
if (options.selectedValues) { |
||||
var filter = BI.makeObject(options.selectedValues, true); |
||||
res = BI.filter(res, function (i, ob) { |
||||
return !filter[ob.username]; |
||||
}); |
||||
} |
||||
populate({ |
||||
items: self._processUserItems(res), |
||||
hasNext: hasNext |
||||
}); |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
_processUserItems: function (items) { |
||||
var self = this; |
||||
return BI.map(items, function (i, v) { |
||||
self.map[v.username] = v.realName + " (" + v.username + ")"; |
||||
return { |
||||
type: "bi.text_item", |
||||
textLgap: 10, |
||||
text: v.realName + " (" + v.username + ")", |
||||
value: v.username, |
||||
cls: "bi-list-item" |
||||
}; |
||||
}); |
||||
}, |
||||
|
||||
valueFormatter: function (v) { |
||||
return this.map[v] || v; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.user.combo", Model); |
||||
})(); |
@ -0,0 +1,162 @@
|
||||
!(function() { |
||||
BI.constant('dingtalksyn.constants.management.tabs',[{ |
||||
text: BI.i18nText("Dec-DingTalkSyn_Agent-Management"), |
||||
cls: 'dec-font-weight-bold', |
||||
value: "agent", |
||||
selected: true |
||||
}, { |
||||
text: BI.i18nText("Dec-DingTalkSyn_Member-Management"), |
||||
cls: 'dec-font-weight-bold', |
||||
value: "member" |
||||
}, { |
||||
text: BI.i18nText("Dec-DingTalkSyn_Agent-Config"), |
||||
cls: 'dec-font-weight-bold', |
||||
value: "config" |
||||
}]); |
||||
|
||||
BI.constant('dingtalksyn.constants.agentmanagement.table.header', [ |
||||
[{ |
||||
text: BI.i18nText("Dec-DingTalkSyn_Agent-Name"), |
||||
baseCls: '', // fineUI的previewTable才能支持列宽百分比,但是表头文字会被加粗,这里把表头加粗的样式去掉
|
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Agent-Id'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}, { |
||||
text: 'CorpID', |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}, { |
||||
text: 'AppKey', |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}, { |
||||
text: 'AppSecret', |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}] |
||||
]); |
||||
|
||||
BI.constant('dingtalksyn.constants.member.management.tabs', [{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Organizational-Structure'), |
||||
value: 'departments', |
||||
width: 100, |
||||
selected: true |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Tag'), |
||||
value: 'tag', |
||||
width: 100 |
||||
}]); |
||||
|
||||
BI.constant('dingtalksyn.constants.member.management.table.header.fsusername', [ |
||||
[{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Name'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_User_Job_Name'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_DecUserName'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_UserID'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Department'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Mobile'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}] |
||||
]); |
||||
|
||||
BI.constant('dingtalksyn.constants.member.management.table.header.nonfsusername', [ |
||||
[{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Name'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_User_Job_Name'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_UserID'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Department'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Mobile'), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
whiteSpace: 'nowrap', |
||||
height: 33 |
||||
}] |
||||
]); |
||||
|
||||
BI.constant('dingtalksyn.constants.chatgroup.management.table.header', [ |
||||
[{ |
||||
text: BI.i18nText("Dec-DingTalkSyn_Enterprise_Agent"), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}, { |
||||
text: BI.i18nText("Dec-DingTalkSyn_Chatgroup_Name"), |
||||
baseCls: '', |
||||
cls: 'dingtalksyn-table-header', |
||||
height: 33 |
||||
}] |
||||
]); |
||||
|
||||
BI.constant('dingtalksyn.constants', { |
||||
popup_create_agent: 'create_agent', |
||||
popup_create_chat_group: 'create_chat_group', |
||||
popup_not_null: 'popup_not_null', |
||||
popup_auto_update_member: 'popup_auto_update_member', |
||||
popup_alert: 'popup_alert', |
||||
popup_alert_detail: 'popup_alert_detail', |
||||
popup_loading_syn_users: 'popup_loading_syn_users', |
||||
popup_loading_configuration: 'popup_loading_configuration', |
||||
popup_result_tip_popup: 'popup_result_tip_popup', |
||||
agent_type_valid: 1, |
||||
agent_type_token_empty: 2, |
||||
matching_fs_way_user_id: 0, |
||||
matching_fs_way_mobile: 1, |
||||
matching_fs_way_custom: 2, |
||||
matching_fs_way_dataSet: 3 |
||||
}); |
||||
}()); |
@ -0,0 +1,28 @@
|
||||
!(function() { |
||||
if (!Dec.DingTalkSyn) { |
||||
Dec.DingTalkSyn = {}; |
||||
} |
||||
|
||||
Dec.DingTalkSyn.ERROR_CODE_OK = 0; |
||||
Dec.DingTalkSyn.ERROR_CODE_ILLEGAL_PARAMETERS = 11205025; |
||||
|
||||
Dec.DingTalkSyn.ERRORCODE = { |
||||
'11205011': 'Dec-DingTalkSyn_Delete-Agent-Fail', |
||||
'11205012': 'Dec-DingTalkSyn_Save-ReportServer-Url-Fail', |
||||
'11205013': 'Dec-DingTalkSyn_Save-Agent-Fail', |
||||
'11205015': 'Dec-DingTalkSyn_Save-Timing-Task-Fail', |
||||
'11205017': 'Dec-DingTalkSyn_Error-AppKey-And-AgentId', |
||||
'11205018': 'Dec-DingTalkSyn_Duplicate-Agent-Name', |
||||
'11205019': 'Dec-DingTalkSyn_Save-Match-Method-Fail', |
||||
'11205020': 'Dec-DingTalkSyn_Duplicate-Agent-Id', |
||||
'11205023': 'Dec-DingTalkSyn_Save-Proxy-Server-Fail', |
||||
'11205024': 'Dec-DingTalkSyn_Connect-Proxy-Server-Fail', |
||||
'11205026': 'Dec-DingTalkSyn_Save-User-Relation-Fail', |
||||
'11205031': 'Dec-DingTalkSyn_Error-AppKey-And-AppSecret', |
||||
'11205035': 'Dec-DingTalkSyn_Tip-Get-ReportServer-Url-Fail', |
||||
'11205036': 'Dec-DingTalkSyn_IP-Config-Not-Available', |
||||
'11205037': 'Dec-DingTalkSyn_NetWork-Invalid', |
||||
'11205039': 'Dec-DingTalkSyn_Download-Fail', |
||||
'11205041': 'Dec-DingTalkSyn_Create-Chat-Group-Fail' |
||||
} |
||||
}) (); |
@ -0,0 +1,295 @@
|
||||
!(function() { |
||||
var SignEditor = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
var conf = SignEditor.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-sign-editor", |
||||
hgap: 4, |
||||
vgap: 2, |
||||
lgap: 0, |
||||
rgap: 0, |
||||
tgap: 0, |
||||
bgap: 0, |
||||
allowBlank: true, |
||||
watermark: "", |
||||
errorText: "", |
||||
editable: false, |
||||
height: 24, |
||||
items: [] |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
SignEditor.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
var text = ''; |
||||
var value = BI.isArray(o.value) ? o.value[0] : o.value; |
||||
BI.each(o.items, function(index, item) { |
||||
if (item.value === value) { |
||||
text = item.text; |
||||
} |
||||
}); |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.editor", |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
vgap: o.vgap, |
||||
lgap: o.lgap, |
||||
rgap: o.rgap, |
||||
tgap: o.tgap, |
||||
bgap: o.bgap, |
||||
value: text, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
disabled: !o.editable, |
||||
errorText: o.errorText, |
||||
}); |
||||
this.text = BI.createWidget({ |
||||
type: "bi.text_button", |
||||
cls: "sign-editor-text", |
||||
title: o.title, |
||||
warningTitle: o.warningTitle, |
||||
tipType: o.tipType, |
||||
textAlign: "left", |
||||
height: o.height, |
||||
value: text, |
||||
hgap: 4, |
||||
handler: function () { |
||||
if (self.options.editable) { |
||||
self._showInput(); |
||||
self.editor.focus(); |
||||
self.editor.selectAll(); |
||||
} |
||||
} |
||||
}); |
||||
this.text.on(BI.TextButton.EVENT_CHANGE, function () { |
||||
BI.nextTick(function () { |
||||
self.fireEvent(SignEditor.EVENT_CLICK_LABEL); |
||||
}); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.text, |
||||
left: 0, |
||||
right: 0, |
||||
top: 0, |
||||
bottom: 0 |
||||
}] |
||||
}); |
||||
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_FOCUS, function () { |
||||
self.fireEvent(SignEditor.EVENT_FOCUS, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_BLUR, function () { |
||||
self.fireEvent(SignEditor.EVENT_BLUR, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CLICK, function () { |
||||
self.fireEvent(SignEditor.EVENT_CLICK, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CHANGE, function () { |
||||
self.fireEvent(SignEditor.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { |
||||
self.fireEvent(SignEditor.EVENT_KEY_DOWN, arguments); |
||||
}); |
||||
|
||||
this.editor.on(BI.Editor.EVENT_VALID, function () { |
||||
self.fireEvent(SignEditor.EVENT_VALID, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
||||
self._showHint(); |
||||
self._checkText(); |
||||
self.fireEvent(SignEditor.EVENT_CONFIRM, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_START, function () { |
||||
self.fireEvent(SignEditor.EVENT_START, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_PAUSE, function () { |
||||
self.fireEvent(SignEditor.EVENT_PAUSE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_STOP, function () { |
||||
self.fireEvent(SignEditor.EVENT_STOP, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_SPACE, function () { |
||||
self.fireEvent(SignEditor.EVENT_SPACE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
||||
self._checkText(); |
||||
self.fireEvent(SignEditor.EVENT_ERROR, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ENTER, function () { |
||||
self.fireEvent(SignEditor.EVENT_ENTER, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_RESTRICT, function () { |
||||
self.fireEvent(SignEditor.EVENT_RESTRICT, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_EMPTY, function () { |
||||
self.fireEvent(SignEditor.EVENT_EMPTY, arguments); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
scrolly: false, |
||||
element: this, |
||||
items: [this.editor] |
||||
}); |
||||
this._showHint(); |
||||
self._checkText(); |
||||
}, |
||||
|
||||
_checkText: function () { |
||||
var o = this.options; |
||||
BI.nextTick(BI.bind(function () { |
||||
if (this.editor.getValue() === "") { |
||||
this.text.setValue(o.watermark || ""); |
||||
this.text.element.addClass("bi-water-mark"); |
||||
} else { |
||||
this.text.setValue(this.editor.getValue()); |
||||
this.text.element.removeClass("bi-water-mark"); |
||||
} |
||||
}, this)); |
||||
}, |
||||
|
||||
_showInput: function () { |
||||
this.editor.visible(); |
||||
this.text.invisible(); |
||||
}, |
||||
|
||||
_showHint: function () { |
||||
this.editor.invisible(); |
||||
this.text.visible(); |
||||
}, |
||||
|
||||
setTitle: function (title) { |
||||
this.text.setTitle(title); |
||||
}, |
||||
|
||||
setWarningTitle: function (title) { |
||||
this.text.setWarningTitle(title); |
||||
}, |
||||
|
||||
focus: function () { |
||||
this._showInput(); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
blur: function () { |
||||
this.editor.blur(); |
||||
this._showHint(); |
||||
this._checkText(); |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.text.unRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
doHighLight: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unHighLight: function () { |
||||
this.text.unHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
isValid: function () { |
||||
return this.editor.isValid(); |
||||
}, |
||||
|
||||
setErrorText: function (text) { |
||||
this.editor.setErrorText(text); |
||||
}, |
||||
|
||||
getErrorText: function () { |
||||
return this.editor.getErrorText(); |
||||
}, |
||||
|
||||
isEditing: function () { |
||||
return this.editor.isEditing(); |
||||
}, |
||||
|
||||
getLastValidValue: function () { |
||||
return this.editor.getLastValidValue(); |
||||
}, |
||||
|
||||
setValue: function (k) { |
||||
var self = this; |
||||
k = BI.isArray(k) ? k[0] : k; |
||||
if(self.options.items.length === 0) { |
||||
self.editor.setValue(""); |
||||
self._checkText(); |
||||
return ; |
||||
} |
||||
var valueExists = false; |
||||
BI.each(self.options.items, function(index, item) { |
||||
if (item.value === k) { |
||||
valueExists = true; |
||||
self.editor.setValue(item.text); |
||||
self._checkText(); |
||||
} |
||||
}); |
||||
if (!valueExists) { |
||||
self.editor.setValue(''); |
||||
self._checkText(); |
||||
} |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var self = this; |
||||
for (var i = 0; i < self.options.items.length; i++) { |
||||
if (self.options.items[i].text === self.editor.getValue()) { |
||||
return self.options.items[i].value; |
||||
} |
||||
} |
||||
}, |
||||
|
||||
setEditable: function(v) { |
||||
this.options.editable = v; |
||||
this.editor.setEnable(v); |
||||
}, |
||||
|
||||
getEditable: function() { |
||||
return this.editor.isEnabled(); |
||||
}, |
||||
|
||||
getState: function () { |
||||
return this.text.getValue(); |
||||
}, |
||||
|
||||
setState: function (v) { |
||||
this._showHint(); |
||||
this.text.setValue(v); |
||||
} |
||||
}); |
||||
SignEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
SignEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
SignEditor.EVENT_BLUR = "EVENT_BLUR"; |
||||
SignEditor.EVENT_CLICK = "EVENT_CLICK"; |
||||
SignEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
||||
SignEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; |
||||
|
||||
SignEditor.EVENT_START = "EVENT_START"; |
||||
SignEditor.EVENT_PAUSE = "EVENT_PAUSE"; |
||||
SignEditor.EVENT_STOP = "EVENT_STOP"; |
||||
SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
SignEditor.EVENT_VALID = "EVENT_VALID"; |
||||
SignEditor.EVENT_ERROR = "EVENT_ERROR"; |
||||
SignEditor.EVENT_ENTER = "EVENT_ENTER"; |
||||
SignEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; |
||||
SignEditor.EVENT_SPACE = "EVENT_SPACE"; |
||||
SignEditor.EVENT_EMPTY = "EVENT_EMPTY"; |
||||
|
||||
BI.shortcut("dingtalksyn.sign_editor", SignEditor); |
||||
})(); |
@ -0,0 +1,257 @@
|
||||
// 由于bi4.1fineui已经合并到4月初发布的platform中,新建一个editor.state.js修改bug,之后可以删除,继续用bi.state_editor
|
||||
!(function() { |
||||
var StateEditor = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
var conf = StateEditor.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-state-editor", |
||||
hgap: 4, |
||||
vgap: 2, |
||||
lgap: 0, |
||||
rgap: 0, |
||||
tgap: 0, |
||||
bgap: 0, |
||||
validationChecker: BI.emptyFn, |
||||
quitChecker: BI.emptyFn, |
||||
allowBlank: true, |
||||
watermark: "", |
||||
errorText: "", |
||||
height: 24 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
StateEditor.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.editor", |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
vgap: o.vgap, |
||||
lgap: o.lgap, |
||||
rgap: o.rgap, |
||||
tgap: o.tgap, |
||||
bgap: o.bgap, |
||||
value: o.value, |
||||
validationChecker: o.validationChecker, |
||||
quitChecker: o.quitChecker, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
errorText: o.errorText |
||||
}); |
||||
this.text = BI.createWidget({ |
||||
type: "bi.text_button", |
||||
cls: "state-editor-infinite-text", |
||||
textAlign: "left", |
||||
height: o.height, |
||||
text: BI.i18nText("BI-Basic_Unrestricted"), |
||||
hgap: 4, |
||||
handler: function () { |
||||
self._showInput(); |
||||
self.editor.focus(); |
||||
self.editor.setValue(""); |
||||
} |
||||
}); |
||||
this.text.on(BI.TextButton.EVENT_CHANGE, function () { |
||||
BI.nextTick(function () { |
||||
self.fireEvent('EVENT_CLICK_LABEL'); |
||||
}); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.text, |
||||
left: 0, |
||||
right: 0, |
||||
top: 0, |
||||
bottom: 0 |
||||
}] |
||||
}); |
||||
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_FOCUS, function () { |
||||
self.fireEvent('EVENT_FOCUS', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_BLUR, function () { |
||||
self.fireEvent('EVENT_BLUR', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CLICK, function () { |
||||
self.fireEvent('EVENT_CLICK', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CHANGE, function () { |
||||
self.fireEvent('EVENT_CHANGE', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { |
||||
self.fireEvent('EVENT_KEY_DOWN', arguments); |
||||
}); |
||||
|
||||
this.editor.on(BI.Editor.EVENT_VALID, function () { |
||||
self.fireEvent('EVENT_VALID', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
||||
self._showHint(); |
||||
self.fireEvent('EVENT_CONFIRM', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_START, function () { |
||||
self.fireEvent('EVENT_START', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_PAUSE, function () { |
||||
self.fireEvent('EVENT_PAUSE', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_STOP, function () { |
||||
self.fireEvent('EVENT_STOP', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_SPACE, function () { |
||||
self.fireEvent('EVENT_SPACE', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
||||
self.fireEvent('EVENT_ERROR', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ENTER, function () { |
||||
self.fireEvent('EVENT_ENTER', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_RESTRICT, function () { |
||||
self.fireEvent('EVENT_RESTRICT', arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_EMPTY, function () { |
||||
self.fireEvent('EVENT_EMPTY', arguments); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
scrolly: false, |
||||
element: this, |
||||
items: [this.editor] |
||||
}); |
||||
this._showHint(); |
||||
if(BI.isNotNull(o.text)){ |
||||
this.setState(o.text); |
||||
} |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.text.unRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
doHighLight: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unHighLight: function () { |
||||
this.text.unHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
focus: function () { |
||||
if (this.options.disabled === false) { |
||||
this._showInput(); |
||||
this.editor.focus(); |
||||
} |
||||
}, |
||||
|
||||
blur: function () { |
||||
this.editor.blur(); |
||||
this._showHint(); |
||||
}, |
||||
|
||||
_showInput: function () { |
||||
this.editor.visible(); |
||||
this.text.invisible(); |
||||
}, |
||||
|
||||
_showHint: function () { |
||||
this.editor.invisible(); |
||||
this.text.visible(); |
||||
}, |
||||
|
||||
isValid: function () { |
||||
return this.editor.isValid(); |
||||
}, |
||||
|
||||
setErrorText: function (text) { |
||||
this.editor.setErrorText(text); |
||||
}, |
||||
|
||||
getErrorText: function () { |
||||
return this.editor.getErrorText(); |
||||
}, |
||||
|
||||
isEditing: function () { |
||||
return this.editor.isEditing(); |
||||
}, |
||||
|
||||
getLastValidValue: function () { |
||||
return this.editor.getLastValidValue(); |
||||
}, |
||||
|
||||
setValue: function (k) { |
||||
this.editor.setValue(k); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.editor.getValue(); |
||||
}, |
||||
|
||||
getState: function () { |
||||
return this.editor.getValue().match(/[^\s]+/g); |
||||
}, |
||||
|
||||
setState: function (v) { |
||||
StateEditor.superclass.setValue.apply(this, arguments); |
||||
if (BI.isNumber(v)) { |
||||
if (v === BI.Selection.All) { |
||||
this.text.setText(BI.i18nText("BI-Select_All")); |
||||
this.text.setTitle(""); |
||||
this.text.element.removeClass("state-editor-infinite-text"); |
||||
} else if (v === BI.Selection.Multi) { |
||||
this.text.setText(BI.i18nText("BI-Select_Part")); |
||||
this.text.setTitle(""); |
||||
this.text.element.removeClass("state-editor-infinite-text"); |
||||
} else { |
||||
this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); |
||||
this.text.setTitle(""); |
||||
this.text.element.addClass("state-editor-infinite-text"); |
||||
} |
||||
return; |
||||
} |
||||
if (BI.isString(v)) { |
||||
// if (BI.isEmpty(v)) {
|
||||
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
|
||||
// this.text.setTitle("");
|
||||
// this.text.element.addClass("state-editor-infinite-text");
|
||||
// } else {
|
||||
this.text.setText(v); |
||||
this.text.setTitle(v); |
||||
this.text.element.removeClass("state-editor-infinite-text"); |
||||
// }
|
||||
return; |
||||
} |
||||
if (BI.isArray(v)) { |
||||
if (BI.isEmpty(v)) { |
||||
this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); |
||||
this.text.element.addClass("state-editor-infinite-text"); |
||||
} else if (v.length === 1) { |
||||
this.text.setText(v[0]); |
||||
this.text.setTitle(v[0]); |
||||
this.text.element.removeClass("state-editor-infinite-text"); |
||||
} else { |
||||
this.text.setText(BI.i18nText("BI-Select_Part")); |
||||
this.text.setTitle(""); |
||||
this.text.element.removeClass("state-editor-infinite-text"); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.state_editor", StateEditor); |
||||
}) (); |
@ -0,0 +1,60 @@
|
||||
!(function () { |
||||
var LineSegmentButton = BI.inherit(BI.BasicButton, { |
||||
props: { |
||||
baseCls: 'bi-line-segment-button bi-list-item-effect cursor-pointer', |
||||
once: true, |
||||
readonly: true, |
||||
hgap: 10, |
||||
height: 25 |
||||
}, |
||||
|
||||
render: function () { |
||||
var o = this.options, self = this; |
||||
this.text = BI.createWidget({ |
||||
type: "bi.label", |
||||
element: this, |
||||
text: o.text, |
||||
width: o.width, |
||||
height: o.height, |
||||
value: o.value, |
||||
hgap: o.hgap |
||||
}); |
||||
|
||||
this.line = BI.createWidget({ |
||||
type: "bi.layout", |
||||
cls: "line-segment-button-line", |
||||
height: 2 |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.line, |
||||
left: o.hgap - 1, |
||||
right: o.hgap - 1, |
||||
bottom: 0 |
||||
}] |
||||
}) |
||||
}, |
||||
|
||||
setSelected: function (v) { |
||||
LineSegmentButton.superclass.setSelected.apply(this, arguments); |
||||
if (v) { |
||||
this.line.element.addClass("bi-high-light-background"); |
||||
} else { |
||||
this.line.element.removeClass("bi-high-light-background"); |
||||
} |
||||
}, |
||||
|
||||
setText: function (text) { |
||||
LineSegmentButton.superclass.setText.apply(this, arguments); |
||||
this.text.setText(text); |
||||
}, |
||||
|
||||
destroy: function () { |
||||
LineSegmentButton.superclass.destroy.apply(this, arguments); |
||||
} |
||||
}); |
||||
BI.shortcut('dingtalksyn.line_segment_button', LineSegmentButton); |
||||
}()); |
||||
|
@ -0,0 +1,68 @@
|
||||
!(function () { |
||||
var LineSegment = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "decision-line-segment", |
||||
items: [], |
||||
height: 30, |
||||
hgap: 15, |
||||
layouts: [ |
||||
{ |
||||
type: "bi.horizontal" |
||||
} |
||||
], |
||||
defaultValue: null |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
if (BI.isNumber(o.height)) { |
||||
this.element.css({height: o.height, lineHeight: (o.height) + 'px'}); |
||||
} |
||||
this.buttonGroup = BI.createWidget({ |
||||
element: this, |
||||
type: "bi.button_group", |
||||
items: BI.createItems(o.items, { |
||||
type: "dingtalksyn.line_segment_button", |
||||
height: o.height, |
||||
hgap: o.hgap |
||||
}), |
||||
layouts: o.layouts |
||||
}); |
||||
this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.buttonGroup.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) { |
||||
self.fireEvent(LineSegment.EVENT_CHANGE, value, obj); |
||||
}); |
||||
if (!BI.isNull(o.defaultValue)) { |
||||
this.setValue(o.defaultValue); |
||||
} |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.buttonGroup.setValue(v); |
||||
}, |
||||
|
||||
setEnabledValue: function (v) { |
||||
this.buttonGroup.setEnabledValue(v); |
||||
}, |
||||
|
||||
|
||||
getValue: function () { |
||||
return this.buttonGroup.getValue(); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
var o = this.options; |
||||
this.buttonGroup.populate(BI.createItems(items, { |
||||
type: "dingtalksyn.line_segment_button", |
||||
height: o.height |
||||
})) |
||||
} |
||||
|
||||
}); |
||||
LineSegment.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut('dingtalksyn.line_segment', LineSegment); |
||||
}()); |
||||
|
||||
|
@ -0,0 +1,298 @@
|
||||
!(function() { |
||||
var ChatGroupPopover = BI.inherit(BI.Widget, { |
||||
props: { |
||||
noClose: false |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.create.chatgroup.popover", this.options); |
||||
}, |
||||
|
||||
watch: { |
||||
agentId: function (v) { |
||||
this.store.setGroupLeader(''); |
||||
this.store.setGroupMemberValue({}); |
||||
} |
||||
}, |
||||
|
||||
render: function() { |
||||
return { |
||||
type: "bi.vtape", |
||||
items: [ |
||||
{ |
||||
el: this._rebuildCenter() |
||||
}, { |
||||
el: this._rebuildSouth(), |
||||
height: 44 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function() { |
||||
return { |
||||
agentId: this.model.agentId, |
||||
groupName: this.model.groupName, |
||||
groupLeader: this.model.groupLeader, |
||||
groupMember: this.model.groupMemberValue |
||||
}; |
||||
}, |
||||
|
||||
_rebuildCenter: function() { |
||||
return this._createChatGroupPane({}) |
||||
}, |
||||
|
||||
_rebuildSouth: function() { |
||||
var self = this, o = this.options; |
||||
var sure = { |
||||
type: "bi.button", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 0, |
||||
handler: function (v) { |
||||
if (self._checkValid()) { |
||||
self.end(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var cancel = o.noClose? {} : { |
||||
type: "bi.button", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Cancel'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 1, |
||||
level: "ignore", |
||||
handler: function (v) { |
||||
self.close(v); |
||||
}, |
||||
rgap:10 |
||||
}; |
||||
|
||||
return { |
||||
type: "bi.right_vertical_adapt", |
||||
items: [cancel, sure] |
||||
}; |
||||
}, |
||||
|
||||
end: function() { |
||||
this.fireEvent("EVENT_CONFIRM"); |
||||
}, |
||||
|
||||
_checkValid: function() { |
||||
var result = true; |
||||
if (!BI.isKey(this.model.agentId)) { |
||||
result = false; |
||||
this.agentComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
} |
||||
|
||||
if (!BI.isKey(this.model.groupName)) { |
||||
result = false; |
||||
this.chatGroupNameErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
} |
||||
|
||||
if (this.model.groupName.length > 20) { |
||||
result = false; |
||||
this.chatGroupNameErrorPane.showError(BI.i18nText("Dec-DingTalkSyn_Chat_Group_Name_Length_Tip")); |
||||
} |
||||
|
||||
if (!BI.isKey(this.model.groupLeader)) { |
||||
result = false; |
||||
this.groupLeaderComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
} |
||||
|
||||
if (this.model.groupMemberValue.type === BI.Selection.Multi) { |
||||
if (this.model.groupMemberValue.value.length < 1) { |
||||
result = false; |
||||
this.groupMemberComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
} else if (this.model.groupMembers.length < 2) { |
||||
result = false; |
||||
this.groupMemberComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Chat_Group_Member_Tip')) |
||||
} |
||||
} else if (BI.isEmpty(this.model.groupMemberValue) || this.model.groupMemberValue.type === BI.Selection.None) { |
||||
result = false; |
||||
this.groupMemberComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
} |
||||
|
||||
return result; |
||||
}, |
||||
|
||||
close: function () { |
||||
this.fireEvent("EVENT_CLOSE"); |
||||
}, |
||||
|
||||
_createChatGroupPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-overflow-visible', |
||||
items: [{ |
||||
type: "bi.html_label", |
||||
cls: "bi-tips", |
||||
textAlign: 'left', |
||||
text: "<ul><li>" + BI.i18nText("Dec-DingTalkSyn_New_Chat_Group_Tip1") + "</li><li>" + BI.i18nText("Dec-DingTalkSyn_New_Chat_Group_Tip2") + "</li></ul>", |
||||
whiteSpace: "normal", |
||||
lgap: -25, |
||||
tgap: -10, |
||||
}, { |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Enterprise_Agent'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 335, |
||||
el: { |
||||
type: "bi.text_value_combo", |
||||
height: 24, |
||||
items: self.model.agents, |
||||
ref: function(_ref) { |
||||
self.agentCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: function () { |
||||
self.agentComboErrorPane.hideError(); |
||||
self.store.setAgentId(this.getValue()[0]); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.agentComboErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
}, { |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Chatgroup_Name'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 335, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: true, |
||||
ref: function (_ref) { |
||||
self.chatGroupName = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
self.chatGroupNameErrorPane.hideError(); |
||||
} |
||||
}, { |
||||
eventName: BI.Editor.EVENT_CONFIRM, |
||||
action: function () { |
||||
self.store.setGroupName(this.getValue()); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.chatGroupNameErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, { |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Chat_Group_Leader'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 335, |
||||
el: { |
||||
type: "dingtalksyn.chatgroup.member.combo", |
||||
selectLeader: true, |
||||
height: 24, |
||||
ref: function(_ref) { |
||||
self.groupLeaderCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function (v) { |
||||
self.groupLeaderComboErrorPane.hideError(); |
||||
self.groupMemberComboErrorPane.hideError(); |
||||
self.store.setGroupLeader(v); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.groupLeaderComboErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, { |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Chat_Group_Member'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 335, |
||||
el: { |
||||
type: "dingtalksyn.chatgroup.member.combo", |
||||
selectLeader: false, |
||||
height: 24, |
||||
ref: function(_ref) { |
||||
self.groupMemberCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function (v) { |
||||
self.groupMemberComboErrorPane.hideError(); |
||||
self.store.setGroupMemberValue(v); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.groupMemberComboErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}] |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.create.chatgroup.popover', ChatGroupPopover); |
||||
})(); |
@ -0,0 +1,76 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
childContext: ["agentId"], |
||||
|
||||
state: function () { |
||||
return { |
||||
agentId: '', |
||||
groupName: '', |
||||
groupLeader: '', |
||||
groupMemberValue: {} |
||||
} |
||||
}, |
||||
|
||||
computed: { |
||||
agents: function () { |
||||
var agents = BI.filter(this.options.agentList, function(index, agent) { |
||||
return Dec.DingTalkSyn.Util.isValidAgent(agent.validStatus); |
||||
}); |
||||
return BI.map(agents, function(index, agent) { |
||||
return { |
||||
text: agent.agentName + '-' + agent.agentId, |
||||
value: agent.id |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
groupMembers: function () { |
||||
var members = this.model.groupMemberValue ? this.model.groupMemberValue.value : []; |
||||
return this._filterLeaderInGroupMember(members); |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
setAgentId: function (id) { |
||||
this.model.agentId = id; |
||||
}, |
||||
|
||||
getAgentId: function () { |
||||
return this.model.agentId; |
||||
}, |
||||
|
||||
setGroupName: function (name) { |
||||
this.model.groupName = name; |
||||
}, |
||||
|
||||
getGroupName: function () { |
||||
return this.model.groupName; |
||||
}, |
||||
|
||||
setGroupLeader: function (leader) { |
||||
this.model.groupLeader = leader; |
||||
}, |
||||
|
||||
getGroupLeader: function () { |
||||
return this.model.groupLeader; |
||||
}, |
||||
|
||||
setGroupMemberValue: function (v) { |
||||
this.model.groupMemberValue = v; |
||||
}, |
||||
|
||||
getGroupMemberValue: function () { |
||||
return this.model.groupMemberValue; |
||||
}, |
||||
|
||||
_filterLeaderInGroupMember: function (groupMembers) { |
||||
var self = this; |
||||
return BI.filter(groupMembers, function (i, member) { |
||||
return member !== self.model.groupLeader; |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.create.chatgroup.popover", Model); |
||||
})(); |
@ -0,0 +1,134 @@
|
||||
!(function() { |
||||
if (!Dec.DingTalkSyn) { |
||||
Dec.DingTalkSyn = {} |
||||
} |
||||
|
||||
Dec.DingTalkSyn.LoadingPopupController = BI.inherit(BI.Controller, { |
||||
_defaultConfig: function () { |
||||
return BI.extend( Dec.DingTalkSyn.LoadingPopupController.superclass._defaultConfig.apply(this, arguments), { |
||||
render: "body" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
Dec.DingTalkSyn.LoadingPopupController.superclass._init.apply(this, arguments); |
||||
this.floatManager = {}; |
||||
this.floatLayer = {}; |
||||
this.floatContainer = {}; |
||||
this.floatOpened = {}; |
||||
this.zindex = BI.zIndex_popover; |
||||
this.zindexMap = {}; |
||||
}, |
||||
|
||||
_check: function (name) { |
||||
return BI.isNotNull(this.floatManager[name]); |
||||
}, |
||||
|
||||
create: function (name, options) { |
||||
if (this._check(name)) { |
||||
return this; |
||||
} |
||||
var popover = BI.createWidget(options || {}, { |
||||
type: "dingtalksyn.loading.popup" |
||||
}); |
||||
this.add(name, popover, options); |
||||
return this; |
||||
}, |
||||
|
||||
add: function (name, popover, options) { |
||||
var self = this; |
||||
options || (options = {}); |
||||
if (this._check(name)) { |
||||
return this; |
||||
} |
||||
this.floatContainer[name] = BI.createWidget({ |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: (this.floatLayer[name] = BI.createWidget({ |
||||
type: "bi.absolute", |
||||
items: [popover] |
||||
})), |
||||
left: 0, |
||||
right: 0, |
||||
top: 0, |
||||
bottom: 0 |
||||
}] |
||||
}); |
||||
this.floatManager[name] = popover; |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: options.container || this.options.render, |
||||
items: [{ |
||||
el: this.floatContainer[name], |
||||
left: 0, |
||||
right: 0, |
||||
top: 0, |
||||
bottom: 0 |
||||
}] |
||||
}); |
||||
return this; |
||||
}, |
||||
|
||||
open: function (name) { |
||||
if (!this._check(name)) { |
||||
return this; |
||||
} |
||||
if (!this.floatOpened[name]) { |
||||
this.floatOpened[name] = true; |
||||
var container = this.floatContainer[name]; |
||||
container.element.css("zIndex", this.zindex++); |
||||
container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); |
||||
this.zindexMap[name] = this.zindex; |
||||
container.element.__buildZIndexMask__(this.zindex++); |
||||
this.get(name).setZindex(this.zindex++); |
||||
this.floatContainer[name].visible(); |
||||
var popover = this.get(name); |
||||
popover.show && popover.show(); |
||||
var W = $(this.options.render).width(), H = $(this.options.render).height(); |
||||
var w = popover.element.width(), h = popover.element.height(); |
||||
var left = (W - w) / 2, top = (H - h) / 2; |
||||
if (left < 0) { |
||||
left = 0; |
||||
} |
||||
if (top < 0) { |
||||
top = 0; |
||||
} |
||||
popover.element.css({ |
||||
left: left + "px", |
||||
top: top + "px" |
||||
}); |
||||
} |
||||
return this; |
||||
}, |
||||
|
||||
close: function (name) { |
||||
if (!this._check(name)) { |
||||
return this; |
||||
} |
||||
if (this.floatOpened[name]) { |
||||
delete this.floatOpened[name]; |
||||
this.floatContainer[name].invisible(); |
||||
this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); |
||||
} |
||||
return this; |
||||
}, |
||||
|
||||
get: function (name) { |
||||
return this.floatManager[name]; |
||||
}, |
||||
|
||||
remove: function (name) { |
||||
if (!this._check(name)) { |
||||
return this; |
||||
} |
||||
this.floatContainer[name].destroy(); |
||||
this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); |
||||
delete this.floatManager[name]; |
||||
delete this.floatLayer[name]; |
||||
delete this.zindexMap[name]; |
||||
delete this.floatContainer[name]; |
||||
delete this.floatOpened[name]; |
||||
return this; |
||||
} |
||||
}); |
||||
}) (); |
@ -0,0 +1,112 @@
|
||||
!(function () { |
||||
var DetailAlert = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "dingtalksyn-detail-alert", |
||||
iconCls: "upload-fail-icon", |
||||
tipText: "", |
||||
detailText: "" |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.detail.alert"); |
||||
}, |
||||
|
||||
watch: { |
||||
showDetail: function (v) { |
||||
this.detail.setVisible(v); |
||||
var detailBtnText = v ? BI.i18nText("Dec-Basic_Pack_Up_Information") : BI.i18nText("Dec-Basic_Detailed_Information"); |
||||
this.detailBtn.setText(detailBtnText); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.center_adapt", |
||||
cls: "bi-z-index-mask", |
||||
items: [{ |
||||
type: "bi.absolute", |
||||
width: 450, |
||||
height: 250, |
||||
cls: "bi-card", |
||||
items: [{ |
||||
el: { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
type: "dec.tip.icon.vertical", |
||||
iconCls: o.iconCls, |
||||
iconTgap: 40, |
||||
text: o.tipText |
||||
}, { |
||||
type: "bi.horizontal_float", |
||||
items: [{ |
||||
type: "bi.vertical_adapt", |
||||
tgap: 15, |
||||
items: [{ |
||||
type: "bi.button", |
||||
text: BI.i18nText("Dec-Basic_Detailed_Information"), |
||||
level: "ignore", |
||||
width: 80, |
||||
height: 24, |
||||
ref: function (_ref) { |
||||
self.detailBtn = _ref; |
||||
}, |
||||
handler: function () { |
||||
self.store.setShowDetail(!self.model.showDetail); |
||||
} |
||||
}, { |
||||
type: "bi.button", |
||||
hgap: 10, |
||||
height: 24, |
||||
level: "ignore", |
||||
text: BI.i18nText("Dec-Basic_Back"), |
||||
handler: function () { |
||||
self.fireEvent("EVENT_CLOSE"); |
||||
} |
||||
}] |
||||
}] |
||||
}] |
||||
}, |
||||
top: 0, left: 0, bottom: 0, right: 0 |
||||
}, { |
||||
el: { |
||||
type: "bi.vertical", |
||||
cls: "bi-card", |
||||
hgap: 5, |
||||
items: [{ |
||||
el: { |
||||
type: "bi.vertical", |
||||
height: 73, |
||||
cls: "dingtalksyn-error-background", |
||||
hgap: 10, |
||||
scrolly: true, |
||||
invisible: !self.model.showDetail, |
||||
items: [{ |
||||
el: { |
||||
type: "dec.label.line.feed", |
||||
cls: "dingtalksyn-message-board", |
||||
width: 400, |
||||
textHeight: 16, |
||||
text: o.detailText, |
||||
ref: function (_ref) { |
||||
self.detailMessage = _ref; |
||||
} |
||||
}, |
||||
tgap: 5 |
||||
}], |
||||
ref: function (_ref) { |
||||
self.detail = _ref; |
||||
} |
||||
}, |
||||
bgap: 10 |
||||
}] |
||||
}, |
||||
top: 190, left: 0, right: 0 |
||||
}] |
||||
}] |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.detail.alert', DetailAlert); |
||||
}) (); |
@ -0,0 +1,16 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function() { |
||||
return { |
||||
showDetail: false |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
setShowDetail: function (v) { |
||||
this.model.showDetail = v; |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dingtalksyn.model.detail.alert", Model); |
||||
}()); |
@ -0,0 +1,66 @@
|
||||
!(function() { |
||||
var AlertPopover = BI.inherit(BI.Widget, { |
||||
props: { |
||||
label: '', |
||||
end: null |
||||
}, |
||||
|
||||
render: function() { |
||||
return { |
||||
type: "bi.vtape", |
||||
items: [ |
||||
{ |
||||
el: this._rebuildCenter() |
||||
}, { |
||||
el: this._rebuildSouth(), |
||||
height: 44 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_rebuildCenter: function() { |
||||
return { |
||||
type: 'bi.vertical', |
||||
items:[{ |
||||
type: 'bi.label', |
||||
textAlign: 'left', |
||||
whiteSpace: 'normal', |
||||
text: this.options.label |
||||
}] |
||||
} |
||||
}, |
||||
|
||||
_rebuildSouth: function() { |
||||
var self = this, o = this.options; |
||||
var sure = { |
||||
type: "bi.button", |
||||
cls: 'dingtalksyn-popup-confirm-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 0, |
||||
handler: function (v) { |
||||
if (BI.isFunction(o.end)) { |
||||
o.end(); |
||||
} |
||||
self.close(v); |
||||
} |
||||
}; |
||||
|
||||
return { |
||||
type: "bi.right_vertical_adapt", |
||||
cls: 'dingtalksyn-popup-south-container', |
||||
lgap: 10, |
||||
items: [sure] |
||||
}; |
||||
}, |
||||
|
||||
close: function () { |
||||
this.fireEvent("EVENT_CLOSE"); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.alert.popover', AlertPopover); |
||||
}) (); |
||||
|
@ -0,0 +1,300 @@
|
||||
!(function() { |
||||
var ScheduleTaskPopover = BI.inherit(BI.Widget, { |
||||
props: { |
||||
executeTimingTask: false, |
||||
timingTaskFrequencyType: 0, |
||||
timingTaskStartDay: 1, |
||||
timingTaskStartHour: '12', |
||||
timingTaskStartMinute: '00' |
||||
}, |
||||
|
||||
render: function() { |
||||
return { |
||||
type: "bi.vtape", |
||||
items: [ |
||||
{ |
||||
el: this._rebuildCenter() |
||||
}, { |
||||
el: this._rebuildSouth(), |
||||
height: 44 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_rebuildCenter: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
items: [ |
||||
{ |
||||
type: 'bi.vertical_adapt', |
||||
items: [{ |
||||
type: 'bi.checkbox', |
||||
width: 16, |
||||
height: 16, |
||||
selected: self.options.executeTimingTask, |
||||
ref: function (_ref) { |
||||
self.executeTimingTaskCheckBox = _ref; |
||||
} |
||||
}, { |
||||
type: 'bi.label', |
||||
lgap: 2, |
||||
text: BI.i18nText('Dec-DingTalkSyn_Start-Update') |
||||
}] |
||||
}, { |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Per'), |
||||
width: 12 |
||||
}, { |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
lgap: 7, |
||||
width: 60, |
||||
height: 24, |
||||
value: self.options.timingTaskFrequencyType, |
||||
items: [{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Day'), |
||||
value: 0 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Week'), |
||||
value: 1 |
||||
}], |
||||
ref: function(_ref) { |
||||
self.timingTaskFrequencyTypeCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||
action: function () { |
||||
var v = this.getValue(); |
||||
if (v === 0) { |
||||
self.timingTaskStartDayCombo.setVisible(false); |
||||
} else if (v === 1) { |
||||
self.timingTaskStartDayCombo.setVisible(true); |
||||
} |
||||
} |
||||
}] |
||||
}, { |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
lgap: 7, |
||||
width: 60, |
||||
height: 24, |
||||
value: self.options.timingTaskStartDay, |
||||
items: [{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Monday'), |
||||
value: 1 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Tuesday'), |
||||
value: 2 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Wednesday'), |
||||
value: 3 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Thursday'), |
||||
value: 4 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Friday'), |
||||
value: 5 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Saturday'), |
||||
value: 6 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Sunday'), |
||||
value: 0 |
||||
}], |
||||
invisible: !self.options.timingTaskFrequencyType, |
||||
ref: function(_ref) { |
||||
self.timingTaskStartDayCombo = _ref; |
||||
} |
||||
}, { |
||||
type: "dec.error_label", |
||||
width: 60, |
||||
lgap: 7, |
||||
el: { |
||||
type: 'bi.editor', |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
allowBlank: true, |
||||
width: 60, |
||||
height: 24, |
||||
value: self.options.timingTaskStartHour, |
||||
ref: function(_ref) { |
||||
self.timingTaskStartHourEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.hourErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.hourErrorPane = _ref; |
||||
} |
||||
}, { |
||||
el: { |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Hour'), |
||||
width: 12 |
||||
}, |
||||
lgap: 7 |
||||
}, { |
||||
type: "dec.error_label", |
||||
width: 60, |
||||
lgap: 7, |
||||
el: { |
||||
type: 'bi.editor', |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
allowBlank: true, |
||||
height: 24, |
||||
value: self.options.timingTaskStartMinute, |
||||
ref: function(_ref) { |
||||
self.timingTaskStartMinuteEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.minuteErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.minuteErrorPane = _ref; |
||||
} |
||||
}, { |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Minute') + BI.i18nText('Dec-DingTalkSyn_Update-Once'), |
||||
lgap: 4 |
||||
}] |
||||
}, |
||||
tgap: 10 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
_rebuildSouth: function() { |
||||
var self = this, o = this.options; |
||||
var sure = BI.createWidget({ |
||||
type: "bi.button", |
||||
cls: 'dingtalksyn-popup-confirm-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 0, |
||||
handler: function (v) { |
||||
if (self._checkValid()) { |
||||
self.end(); |
||||
self.close(v); |
||||
} |
||||
} |
||||
}); |
||||
var cancel = BI.createWidget({ |
||||
type: "bi.button", |
||||
cls: 'dingtalksyn-popup-cancel-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Cancel'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 1, |
||||
level: "ignore", |
||||
handler: function (v) { |
||||
self.close(v); |
||||
} |
||||
}); |
||||
return { |
||||
type: "bi.right_vertical_adapt", |
||||
cls: 'dingtalksyn-popup-south-container', |
||||
lgap: 10, |
||||
items: [cancel, sure] |
||||
}; |
||||
}, |
||||
|
||||
end: function() { |
||||
this._saveTimingTaskData(); |
||||
}, |
||||
|
||||
_checkValid: function() { |
||||
var self = this; |
||||
var result = true; |
||||
if (!BI.isKey(self.timingTaskStartHourEditor.getValue())) { |
||||
result = false; |
||||
self.hourErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} else if (!self._isHourValid()) { |
||||
result = false; |
||||
self.hourErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Illegal')); |
||||
} |
||||
|
||||
if (!BI.isKey(self.timingTaskStartMinuteEditor.getValue())) { |
||||
result = false; |
||||
self.minuteErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} else if (!self._isMinuteValid()) { |
||||
result = false; |
||||
self.minuteErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Illegal')); |
||||
} |
||||
|
||||
return result; |
||||
}, |
||||
|
||||
_saveTimingTaskData: function() { |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/timing/task', |
||||
type: 'POST', |
||||
data: { |
||||
enableAutoSync: this.executeTimingTaskCheckBox.isSelected(), |
||||
period: this.timingTaskFrequencyTypeCombo.getValue(), |
||||
startWeekDay: this.timingTaskStartDayCombo.getValue(), |
||||
startHour: parseInt(this.timingTaskStartHourEditor.getValue()), // 把01,02这种去0
|
||||
startMinute: parseInt(this.timingTaskStartMinuteEditor.getValue()) |
||||
}, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
close: function () { |
||||
this.fireEvent("EVENT_CLOSE"); |
||||
}, |
||||
|
||||
/** |
||||
* 小时输入是否合法 |
||||
*/ |
||||
_isHourValid: function() { |
||||
var self = this; |
||||
return self._isNumber(self.timingTaskStartHourEditor.getValue()) |
||||
&& parseInt(self.timingTaskStartHourEditor.getValue()) < 24 |
||||
&& parseInt(self.timingTaskStartHourEditor.getValue()) >= 0 |
||||
}, |
||||
|
||||
/** |
||||
* 分钟输入是否合法 |
||||
*/ |
||||
_isMinuteValid: function() { |
||||
var self = this; |
||||
return self._isNumber(self.timingTaskStartMinuteEditor.getValue()) |
||||
&& parseInt(self.timingTaskStartMinuteEditor.getValue()) < 60 |
||||
&& parseInt(self.timingTaskStartMinuteEditor.getValue()) >= 0 |
||||
}, |
||||
|
||||
/** |
||||
* 判断num是否是合法数字 允许0开头的两位数 |
||||
* @param num |
||||
* @returns {boolean} |
||||
*/ |
||||
_isNumber: function(num) { |
||||
var reg = /^\d{1,2}$/; |
||||
return reg.test(num); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.schedule.task.popover', ScheduleTaskPopover); |
||||
}) (); |
||||
|
@ -0,0 +1,413 @@
|
||||
!(function() { |
||||
var AgentPopover = BI.inherit(BI.Widget, { |
||||
props: { |
||||
id: [], |
||||
agentName: [], |
||||
agentId: [], |
||||
corpId: [], |
||||
appKey: [], |
||||
appSecret: [], |
||||
tipLabel: '', |
||||
refreshAgentList: null, |
||||
noClose: false |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this; |
||||
self.secArr = []; |
||||
return { |
||||
type: "bi.vtape", |
||||
items: [ |
||||
{ |
||||
el: this._rebuildCenter() |
||||
}, { |
||||
el: this._rebuildSouth(), |
||||
height: 44 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
getValue: function() { |
||||
var dataArr = []; |
||||
for (var i = 0; i < this.secArr.length; i++) { |
||||
var data = {}; |
||||
if (this.secArr[i].id) { |
||||
data.id = this.secArr[i].id; |
||||
} |
||||
data.agentName = this.secArr[i].agentName.getValue(); |
||||
data.agentId = this.secArr[i].agentId.getValue(); |
||||
data.corpId = this.secArr[i].corpId.getValue(); |
||||
data.appKey = this.secArr[i].appKey.getValue(); |
||||
data.appSecret = this.secArr[i].appSecret.getValue(); |
||||
dataArr.push(data); |
||||
} |
||||
return { |
||||
agents: dataArr, |
||||
compatible: this.options.noClose |
||||
}; |
||||
}, |
||||
|
||||
_rebuildCenter: function() { |
||||
var self = this, o = this.options; |
||||
var tipLabel = {}; |
||||
if (self.options.tipLabel) { |
||||
tipLabel = { |
||||
type: 'bi.label', |
||||
cls: 'dingtalksyn-gray-color', |
||||
text: self.options.tipLabel, |
||||
textAlign: 'left', |
||||
whiteSpace: 'normal' |
||||
} |
||||
} |
||||
|
||||
var items = []; |
||||
items.push(tipLabel); |
||||
if (o.agentName.length > 0) { |
||||
for (var i = 0; i < o.agentName.length; i++) { |
||||
!(function(index) { |
||||
var sec = self._createAgentSection({ |
||||
id: o.id[index], |
||||
agentName: o.agentName[index], |
||||
agentId: o.agentId[index], |
||||
corpId: o.corpId[index], |
||||
appKey: o.appKey[index], |
||||
appSecret: o.appSecret[index] |
||||
}); |
||||
items.push(sec); |
||||
}) (i); |
||||
} |
||||
} else { |
||||
var sec = self._createAgentSection({}); |
||||
items.push(sec); |
||||
} |
||||
|
||||
var appSecretTipLabel = { |
||||
el: { |
||||
type: 'bi.label', |
||||
cls: 'bi-disabled', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Create-Agent-Tip'), |
||||
textAlign: 'left', |
||||
textHeight: 12, |
||||
whiteSpace: 'normal' |
||||
}, |
||||
lgap: 80, |
||||
tgap: 10 |
||||
}; |
||||
|
||||
items.push(appSecretTipLabel); |
||||
|
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-create-agent-popup-content dingtalksyn-overflow-visible', |
||||
items: items |
||||
} |
||||
}, |
||||
|
||||
_rebuildSouth: function() { |
||||
var self = this, o = this.options; |
||||
var sure = { |
||||
type: "bi.button", |
||||
cls: 'dingtalksyn-popup-confirm-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 0, |
||||
handler: function (v) { |
||||
if (self._checkValid()) { |
||||
self.end(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var cancel = o.noClose? {} : { |
||||
type: "bi.button", |
||||
cls: 'dingtalksyn-popup-cancel-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Cancel'), |
||||
width: 80, |
||||
height: 25, |
||||
value: 1, |
||||
level: "ignore", |
||||
handler: function (v) { |
||||
self.close(v); |
||||
} |
||||
}; |
||||
|
||||
return { |
||||
type: "bi.right_vertical_adapt", |
||||
cls: 'dingtalksyn-popup-south-container', |
||||
rgap: 10, |
||||
items: [cancel, sure] |
||||
}; |
||||
}, |
||||
|
||||
end: function() { |
||||
this.fireEvent("EVENT_CONFIRM"); |
||||
}, |
||||
|
||||
_checkValid: function() { |
||||
var self = this; |
||||
var result = true; |
||||
for (var i = 0; i < self.secArr.length; i++) { |
||||
var agentName = self.secArr[i].agentName; |
||||
var agentId = self.secArr[i].agentId; |
||||
var corpId = self.secArr[i].corpId; |
||||
var appKey = self.secArr[i].appKey; |
||||
var appSecret = self.secArr[i].appSecret; |
||||
|
||||
if (!BI.isKey(agentName.getValue())) { |
||||
result = false; |
||||
self.secArr[i].agentNameErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} |
||||
|
||||
if (!BI.isKey(agentId.getValue())) { |
||||
result = false; |
||||
self.secArr[i].agentIdErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} |
||||
|
||||
if (!BI.isKey(corpId.getValue())) { |
||||
result = false; |
||||
self.secArr[i].corpIdErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} |
||||
|
||||
if (!BI.isKey(appKey.getValue())) { |
||||
result = false; |
||||
self.secArr[i].appKeyErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} |
||||
|
||||
if (!BI.isKey(appSecret.getValue())) { |
||||
result = false; |
||||
self.secArr[i].secretErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not-Null')); |
||||
} |
||||
} |
||||
|
||||
return result; |
||||
}, |
||||
|
||||
close: function () { |
||||
this.fireEvent("EVENT_CLOSE"); |
||||
}, |
||||
|
||||
_createAgentSection: function(props) { |
||||
var self = this; |
||||
var secJo = {}; |
||||
if (props instanceof Object) { |
||||
props.agentName = props.agentName || ''; |
||||
props.agentId = props.agentId || ''; |
||||
props.corpId = props.corpId || ''; |
||||
props.appKey = props.appKey || ''; |
||||
props.appSecret = props.appSecret || ''; |
||||
} |
||||
|
||||
var sec = { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-overflow-visible', |
||||
items: [ |
||||
{ |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Agent-Name'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 330, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: true, |
||||
value: props.agentName, |
||||
ref: function(_ref) { |
||||
secJo.agentName = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
secJo.agentNameErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
secJo.agentNameErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Agent-Id'), |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 330, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
value: props.agentId, |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: true, |
||||
ref: function(_ref) { |
||||
secJo.agentId = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
secJo.agentIdErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
secJo.agentIdErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: 'CorpID', |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 330, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
value: props.corpId, |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: true, |
||||
ref: function (_ref) { |
||||
secJo.corpId = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
secJo.corpIdErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
secJo.corpIdErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: 'AppKey', |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 330, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
value: props.appKey, |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: false, |
||||
ref: function(_ref) { |
||||
secJo.appKey = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
secJo.appKeyErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
secJo.appKeyErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: 'AppSecret', |
||||
textAlign: 'left', |
||||
width: 80, |
||||
height: 12 |
||||
}, |
||||
{ |
||||
type: "dec.error_label", |
||||
width: 330, |
||||
el: { |
||||
type: "bi.editor", |
||||
cls: "bi-border dingtalksyn-border-box", |
||||
value: props.appSecret, |
||||
height: 24, |
||||
errorTextHeight: 18, |
||||
allowBlank: false, |
||||
ref: function(_ref) { |
||||
secJo.appSecret = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_FOCUS, |
||||
action: function () { |
||||
secJo.secretErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
secJo.secretErrorPane = _ref; |
||||
} |
||||
} |
||||
|
||||
] |
||||
}, |
||||
tgap: 10 |
||||
} |
||||
] |
||||
}; |
||||
secJo.id = props.id; |
||||
self.secArr.push(secJo); |
||||
|
||||
return sec; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.create.agent.popover', AgentPopover); |
||||
})(); |
@ -0,0 +1,55 @@
|
||||
!(function() { |
||||
var LoadingPopup = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(LoadingPopup.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "dingtalksyn-loading-popup bi-card", |
||||
width: 450, |
||||
height: 250, |
||||
body: null |
||||
}); |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this; |
||||
var items = { |
||||
center: { |
||||
el: { |
||||
type: "bi.absolute", |
||||
width: self.options.width, |
||||
height: self.options.height, |
||||
items: [{ |
||||
el: BI.createWidget(this.options.body), |
||||
left: 0, |
||||
top: 0, |
||||
right: 0, |
||||
bottom: 0 |
||||
}] |
||||
} |
||||
} |
||||
}; |
||||
|
||||
return { |
||||
type: "bi.border", |
||||
items: items, |
||||
width: this.options.width, |
||||
height: this.options.height |
||||
}; |
||||
}, |
||||
|
||||
open: function () { |
||||
this.show(); |
||||
this.fireEvent('EVENT_OPEN', arguments); |
||||
}, |
||||
|
||||
close: function () { |
||||
this.hide(); |
||||
this.fireEvent('EVENT_CLOSE', arguments); |
||||
}, |
||||
|
||||
setZindex: function (zindex) { |
||||
this.element.css({"z-index": zindex}); |
||||
}, |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.loading.popup', LoadingPopup); |
||||
}) (); |
@ -0,0 +1,123 @@
|
||||
!(function() { |
||||
var Tabs = BI.inherit(BI.Widget, { |
||||
_store: function() { |
||||
return BI.Models.getModel('dingtalksyn.model.management'); |
||||
}, |
||||
|
||||
watch: { |
||||
selectedTab: function(v) { |
||||
this.tab.setSelect(v); |
||||
} |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this; |
||||
this.navTabs = BI.Constants.getConstant('dingtalksyn.constants.management.tabs'); |
||||
this.nav = this._createNavTab(); |
||||
|
||||
return { |
||||
type: 'bi.vtape', |
||||
element: this, |
||||
items: [ |
||||
{ |
||||
type: 'bi.absolute', |
||||
cls: 'dingtalksyn-tab-title', |
||||
height: 40, |
||||
items: [ |
||||
{ |
||||
el: this.nav, |
||||
top: 0, left: 0, bottom: 0, right: 0 |
||||
} |
||||
] |
||||
}, { |
||||
type: "bi.absolute", |
||||
cls: 'dingtalksyn-tab-content', |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: 'bi.tab', |
||||
ref: function () { |
||||
self.tab = this; |
||||
}, |
||||
single: false, |
||||
showIndex: this.model.selectedTab, |
||||
defaultShowIndex: this.model.selectedTab, |
||||
cardCreator: BI.bind(this._createTabPane, this) |
||||
}, |
||||
top: 10, |
||||
right: 10, |
||||
bottom: 10, |
||||
left: 10 |
||||
} |
||||
] |
||||
}], |
||||
bgap: 1 |
||||
} |
||||
}, |
||||
|
||||
_createNavTab: function() { |
||||
var self = this; |
||||
return { |
||||
type: "dingtalksyn.line_segment", |
||||
items: self.navTabs, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function (v) { |
||||
self.store.setSelectedTab(v); |
||||
if (v === 'member' && self.memberManagementTab) { |
||||
self.memberManagementTab.store.getDepMemberData({}); |
||||
self.memberManagementTab.depMemberPane.store.getDepTreeData(); |
||||
self.memberManagementTab._clearPageEditor(); |
||||
} |
||||
} |
||||
} |
||||
], |
||||
height: 40 |
||||
}; |
||||
}, |
||||
|
||||
_createTabPane: function (v) { |
||||
var self = this; |
||||
switch (v) { |
||||
case 'agent': |
||||
return { |
||||
type: 'dingtalksyn.agentmanagement', |
||||
ref: function(_ref) { |
||||
self.agentManagementTab = _ref; |
||||
} |
||||
}; |
||||
case 'member': |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-member-management-container', |
||||
items: [{ |
||||
height: '100%', |
||||
type: 'dingtalksyn.membermanagement', |
||||
ref: function(_ref) { |
||||
self.memberManagementTab = _ref; |
||||
} |
||||
}] |
||||
}; |
||||
case 'config': |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-quick-config-container', |
||||
items: [{ |
||||
height: '100%', |
||||
type: 'dingtalksyn.agentquickconfig', |
||||
ref: function(_ref) { |
||||
self.quickConfigTab = _ref; |
||||
} |
||||
}] |
||||
}; |
||||
default: |
||||
return { |
||||
type: 'dingtalksyn.agentmanagement' |
||||
}; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.tab", Tabs); |
||||
})(); |
@ -0,0 +1,21 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
|
||||
state: function() { |
||||
return { |
||||
selectedTab: BI.Constants.getConstant("dingtalksyn.constants.management.tabs")[0].value, |
||||
agentList: [], |
||||
total: 0 |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
setSelectedTab: function(selectedTab) { |
||||
this.model.selectedTab = selectedTab; |
||||
} |
||||
}, |
||||
|
||||
childContext: ["selectedTab", "agentList"] |
||||
}); |
||||
BI.model("dingtalksyn.model.management", Model); |
||||
}) (); |
@ -0,0 +1,417 @@
|
||||
/** |
||||
* 应用快捷配置模块 |
||||
* |
||||
* @author fanglei |
||||
* @since 2017/12/16 |
||||
*/ |
||||
|
||||
!(function() { |
||||
var AgentQuickConfig = BI.inherit(BI.Widget, { |
||||
render: function() { |
||||
this.proxyPane = this._createProxyPane(); |
||||
this.agentUrlPane = this._createAgentUrlPane(); |
||||
this.chatGroupPane = this._createChatGroupPane(); |
||||
|
||||
return ({ |
||||
type: 'bi.flex_vertical', |
||||
rowSize: ['', '', 'fill'], |
||||
horizontalAlign: 'stretch', |
||||
items: [{ |
||||
el: this.proxyPane |
||||
}, { |
||||
el: this.agentUrlPane, |
||||
tgap: 10 |
||||
}, { |
||||
el: this.chatGroupPane, |
||||
tgap: 10 |
||||
}] |
||||
}); |
||||
}, |
||||
|
||||
mounted: function() { |
||||
this._initData(); |
||||
}, |
||||
|
||||
_store: function() { |
||||
return BI.Models.getModel("dingtalksyn.model.quick.config"); |
||||
}, |
||||
|
||||
watch: { |
||||
proxyServer: function() { |
||||
this.proxyUrlPane.setValue(this.model.proxyServer); |
||||
}, |
||||
|
||||
agentList: function() { |
||||
this._populateAgentListCombo(); |
||||
}, |
||||
|
||||
dingTalkUrl: function() { |
||||
this.createUrlPane.setValue(this.model.dingTalkUrl); |
||||
} |
||||
}, |
||||
|
||||
_initData: function() { |
||||
this.store.getProxyServer(); |
||||
this._populateAgentListCombo(); |
||||
}, |
||||
|
||||
_populateAgentListCombo: function() { |
||||
var self = this; |
||||
var items = self.model.agentListComboItems; |
||||
self.agentListCombo.populate(items); |
||||
self.agentListCombo.setValue(items[0] && items[0].value); |
||||
}, |
||||
|
||||
_createProxyPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 15, |
||||
items: [ |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
cls: 'bi-border-bottom', |
||||
height: 40, |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Proxy'), |
||||
cls: 'dec-font-weight-bold' |
||||
}], |
||||
right: [{ |
||||
width: 80, |
||||
height: 24, |
||||
type: 'bi.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Save'), |
||||
handler: function () { |
||||
var proxyUrl = self.proxyUrlPane.getValue().trim(); |
||||
var callBack = function() { |
||||
this.store.saveProxyServer(proxyUrl); |
||||
}; |
||||
self._checkProxyUrlValid(proxyUrl, callBack); |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
height: 40, |
||||
items: [ |
||||
{ |
||||
type: 'bi.vertical_adapt', |
||||
items: [{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Proxy_Address'), |
||||
textAlign: 'left' |
||||
}, { |
||||
el: { |
||||
type: "bi.icon_label", |
||||
cls: "blue-remark-font", |
||||
title: BI.i18nText("Dec-DingTalkSyn_Proxy_Address_Tip") |
||||
}, |
||||
lgap: 5 |
||||
}], |
||||
width: 116 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
width: 300, |
||||
height: 24, |
||||
allowBlank: true, |
||||
ref: function (_ref) { |
||||
self.proxyUrlPane = _ref; |
||||
} |
||||
}, |
||||
rgap: 10 |
||||
}, |
||||
{ |
||||
height: 24, |
||||
type: 'bi.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Test-Proxy-Address'), |
||||
handler: function () { |
||||
var proxyUrl = self.proxyUrlPane.getValue().trim(); |
||||
var callBack = function() { |
||||
this.store.testProxyServer(proxyUrl); |
||||
}; |
||||
self._checkProxyUrlValid(proxyUrl, callBack); |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
vgap: 15 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_createAgentUrlPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 15, |
||||
items: [ |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
cls: 'bi-border-bottom', |
||||
height: 40, |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Create-DingTalkSyn-Url'), |
||||
cls: 'dec-font-weight-bold' |
||||
}] |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
height: 25, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Agent-Name'), |
||||
textAlign: 'left', |
||||
width: 116 |
||||
}, |
||||
{ |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
ref: function (_ref) { |
||||
self.agentListCombo = _ref; |
||||
}, |
||||
items: [] |
||||
} |
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
height: 25, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Platform-Page'), |
||||
textAlign: 'left', |
||||
width: 116 |
||||
}, |
||||
{ |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
value: 1, |
||||
items: [{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Platform'), |
||||
value: 1 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Platform-Report'), |
||||
value: 2 |
||||
}], |
||||
ref: function (_ref) { |
||||
self.platform = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||
action: function () { |
||||
var v = this.getValue(); |
||||
if (v === 1) { |
||||
self.reportFileTree.setVisible(false); |
||||
self._hideParameterPane(); |
||||
} else if (v === 2) { |
||||
self.reportFileTree.setVisible(true); |
||||
var value = self.reportFileTree.getValue(); |
||||
if (self._isFRTemplate(value)) { |
||||
self._populateParameterPane(); |
||||
} |
||||
} |
||||
} |
||||
}] |
||||
}, |
||||
{ |
||||
type: "dingtalksyn.template.search.tree", |
||||
invisible: true, |
||||
lgap: 10, |
||||
ref: function (_ref) { |
||||
self.reportFileTree = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.MultiLayerSingleTreeCombo.EVENT_CHANGE, |
||||
action: function (fileName) { |
||||
if (self._isFRTemplate(fileName)) { |
||||
self._populateParameterPane(); |
||||
} else { |
||||
self._hideParameterPane(); |
||||
} |
||||
} |
||||
}] |
||||
} |
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
invisible: true, |
||||
ref: function(_ref) { |
||||
self.parameterPane = _ref; |
||||
}, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Parameter_Setting'), |
||||
textAlign: 'left', |
||||
width: 116, |
||||
height: 25, |
||||
}, |
||||
{ |
||||
type: 'bi.vertical', |
||||
items:[{ |
||||
type: 'dec.common.parameter_button', |
||||
parameters: [], |
||||
templateId: '', |
||||
ref: function (_ref) { |
||||
self.parameterBtn = _ref; |
||||
}, |
||||
tgap: 10 |
||||
}, { |
||||
type: 'bi.horizontal', |
||||
items: [{ |
||||
type: "bi.multi_select_item", |
||||
logic: { dynamic: true }, |
||||
text: BI.i18nText("Dec-DingTalkSyn_Parse_Parameters"), |
||||
selected: self.model.shouldParseParams, |
||||
listeners: [{ |
||||
eventName: BI.MultiSelectItem.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setShouldParseParams(this.isSelected()); |
||||
}, |
||||
}], |
||||
tgap: 5, |
||||
lgap: -4 |
||||
}, { |
||||
el: { |
||||
type: "bi.icon_label", |
||||
cls: "blue-remark-font", |
||||
title: BI.i18nText("Dec-DingTalkSyn_Parse_Parameters_Tip") |
||||
}, |
||||
tgap: 9, |
||||
lgap: 5 |
||||
}] |
||||
}] |
||||
} |
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
height: 25, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
text: BI.i18nText('Dec-DingTalkSyn_DingTalkSyn_Url'), |
||||
textAlign: 'left', |
||||
width: 116 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
width: 300, |
||||
height: 24, |
||||
allowBlank: true, |
||||
ref: function (_ref) { |
||||
self.createUrlPane = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: function (text) { |
||||
self.store.setDingTalkSynUrl(text); |
||||
} |
||||
}] |
||||
}, |
||||
rgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
height: 24, |
||||
type: 'bi.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Create-Url'), |
||||
handler: function () { |
||||
var data = { |
||||
agentValue: self.agentListCombo.getValue(), |
||||
platform: self.platform.getValue(), |
||||
fileName: self.reportFileTree.getValue(), |
||||
entryParameters: self.store.showParameter ? self.parameterBtn.getValue() : '' |
||||
}; |
||||
self.store.createDingTalkSynUrl(data); |
||||
} |
||||
}, |
||||
rgap: 10 |
||||
}, |
||||
{ |
||||
width: 80, |
||||
height: 24, |
||||
type: 'dingtalksyn.clipboard.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Copy-Url'), |
||||
copy: function () { |
||||
return self.createUrlPane.getValue(); |
||||
}, |
||||
afterCopy: function () { |
||||
BI.Msg.toast(BI.i18nText('Dec-DingTalkSyn_Copy-Success')); |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
vgap: 15 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
_checkProxyUrlValid: function(proxyUrl, callBack) { |
||||
var self = this; |
||||
if (Dec.DingTalkSyn.Util.checkUrlValid(proxyUrl) || proxyUrl === '') { |
||||
if (BI.isFunction(callBack)) { |
||||
callBack.call(self); |
||||
} |
||||
} else { |
||||
Dec.Msg.alert({ |
||||
message: BI.i18nText('Dec-DingTalkSyn_Start-With-Http') |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
_populateParameterPane: function() { |
||||
this.parameterPane.setVisible(true); |
||||
this.parameterBtn.populate([], this.reportFileTree.getValue()); |
||||
this.store.showParameter = true; |
||||
}, |
||||
|
||||
_hideParameterPane: function() { |
||||
this.parameterPane.setVisible(false); |
||||
this.store.showParameter = false; |
||||
}, |
||||
|
||||
_isFRTemplate: function(fileName) { |
||||
return fileName.indexOf('.cpt') > -1 || fileName.indexOf('.frm') > -1; |
||||
}, |
||||
|
||||
_createChatGroupPane: function () { |
||||
return { |
||||
type: "dingtalksyn.chatgroup.management" |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.agentquickconfig', AgentQuickConfig); |
||||
})(); |
@ -0,0 +1,353 @@
|
||||
!(function() { |
||||
var ChatGroupManagement = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: 'dingtalksyn-chatgourp-management' |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.chatgroup.management"); |
||||
}, |
||||
|
||||
watch: { |
||||
addResult: function() { |
||||
var self = this; |
||||
if(!this.model.addResult.success) { |
||||
Dec.DingTalkSyn.Util.alertErrWithDetail(this.model.addResult); |
||||
} else { |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
self.store.initChatGroups(); |
||||
BI.Popovers.remove(BI.Constants.getConstant('dingtalksyn.constants').popup_create_chat_group); |
||||
} |
||||
}, |
||||
|
||||
chatGroups: function(chatGroups) { |
||||
var self = this; |
||||
self._populateChatGroupTable(chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(chatGroups); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this; |
||||
self.currentPage = 1; |
||||
self.totalPage = 1; |
||||
this.chat_group_management_table_header = BI.Constants.getConstant('dingtalksyn.constants.chatgroup.management.table.header'); |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 10, |
||||
items: [{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
height: 40, |
||||
cls: 'bi-border-bottom', |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Chat_Group'), |
||||
cls: 'dec-font-weight-bold', |
||||
height: 40 |
||||
}] |
||||
} |
||||
}, { |
||||
type: 'bi.vertical_adapt', |
||||
height: 46, |
||||
items: [{ |
||||
type: "bi.icon_text_item", |
||||
text: BI.i18nText('Dec-DingTalkSyn_New_Chat_Group'), |
||||
cls: 'plus-font', |
||||
width: 400, |
||||
height: 17, |
||||
handler: function() { |
||||
self._createChatGroupPopupPane({ |
||||
title: BI.i18nText('Dec-DingTalkSyn_New_Chat_Group') |
||||
}, false); |
||||
} |
||||
}] |
||||
}, { |
||||
type: 'bi.table_view', |
||||
cls: 'dingtalksyn-table', |
||||
isNeedMerge: false, |
||||
isNeedFreeze: false, |
||||
columnSize: [370, "fill"], |
||||
items: [], |
||||
header: self.chat_group_management_table_header, |
||||
ref: function(_ref) { |
||||
self.chatGroupTable = _ref; |
||||
} |
||||
}, { |
||||
type: "bi.left_right_vertical_adapt", |
||||
height: 26, |
||||
tgap: 10, |
||||
items: { |
||||
right: [{ |
||||
type: 'bi.horizontal', |
||||
items: [{ |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
cls: 'page-button dec-pager-first-font', |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage = 1; |
||||
self.chatGroupPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateChatGroupTable(self.model.chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.chatGroups); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
lgap: 5, |
||||
width: 24, |
||||
height: 24, |
||||
cls: 'page-button dec-pager-prev-font', |
||||
disabled: true, |
||||
ref: function(_ref) { |
||||
self.previousPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage -= 1; |
||||
self.chatGroupPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateChatGroupTable(self.model.chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.chatGroups); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
allowBlank: true, |
||||
lgap: 5, |
||||
rgap: 5, |
||||
width: 40, |
||||
height: 24, |
||||
value: self.currentPage.toString(), |
||||
ref: function(_ref) { |
||||
self.chatGroupPageEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CONFIRM, |
||||
action: function () { |
||||
if (this.getValue() > self.totalPage) { |
||||
this.setValue(self.totalPage); |
||||
} else if (this.getValue() < 1) { |
||||
this.setValue(1); |
||||
} |
||||
self.currentPage = parseInt(this.getValue()); |
||||
self._populateChatGroupTable(self.model.chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.chatGroups); |
||||
} |
||||
}] |
||||
}, { |
||||
type: 'bi.label', |
||||
width: 5, |
||||
height: 24, |
||||
text: '/ ' |
||||
}, { |
||||
type: 'bi.label', |
||||
height: 24, |
||||
lgap: 5, |
||||
text: '1', |
||||
ref: function(_ref) { |
||||
self.chatGroupPageLabel = _ref; |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-next-font', |
||||
ref: function(_ref) { |
||||
self.nextPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage += 1; |
||||
self.chatGroupPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateChatGroupTable(self.model.chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.chatGroups); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-last-font', |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage = self.totalPage; |
||||
self.chatGroupPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateChatGroupTable(self.model.chatGroups, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.chatGroups); |
||||
} |
||||
} |
||||
}] |
||||
}] |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
mounted: function() { |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
this.store.initChatGroups(); |
||||
}, |
||||
|
||||
_populateChatGroupTable: function(result, page) { |
||||
var self = this; |
||||
page = page || 0; |
||||
var items = []; |
||||
var bubbleCombo = []; |
||||
var chatGroups = result; |
||||
var startIdx = page * 10; |
||||
var endIdx = Math.min(startIdx + 10, chatGroups.length); |
||||
for (var i = startIdx; i < endIdx; i++) { |
||||
items.push( |
||||
(function(index) { |
||||
return [ |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
height: 32, |
||||
lgap: 5, |
||||
title: chatGroups[index].agentName, |
||||
text: chatGroups[index].agentName |
||||
}, |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
height: 32, |
||||
items: { |
||||
left: [{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
lgap: 2.5, |
||||
title: chatGroups[index].chatGroupName, |
||||
text: chatGroups[index].chatGroupName |
||||
}], |
||||
right: [{ |
||||
type: 'bi.bubble_combo', |
||||
rgap: 10, |
||||
ref: function (_ref) { |
||||
bubbleCombo[index] = _ref; |
||||
}, |
||||
el: { |
||||
type: 'bi.icon_button', |
||||
cls: 'delete-node-font', |
||||
height: 32 |
||||
}, |
||||
stopPropagation: true, |
||||
popup: { |
||||
type: 'bi.text_bubble_bar_popup_view', |
||||
cls: "dec-bubble-combo-popup", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Delete_ChatGroup_Confirm'), |
||||
buttons: [ |
||||
{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
value: i, |
||||
width: 80, |
||||
height: 24, |
||||
handler: function (v) { |
||||
self.store.deleteChatGroup(chatGroups[index].id); |
||||
bubbleCombo[index].hideView(); |
||||
} |
||||
}, |
||||
{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Cancel'), |
||||
level: 'ignore', |
||||
value: i, |
||||
width: 80, |
||||
height: 24, |
||||
handler: function (v) { |
||||
bubbleCombo[index].hideView(); |
||||
} |
||||
} |
||||
] |
||||
} |
||||
}] |
||||
} |
||||
} |
||||
] |
||||
})(i) |
||||
); |
||||
} |
||||
self.chatGroupTable.populate(items); |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
}, |
||||
|
||||
_populateDingTalkSynPageNumberButtons: function(result) { |
||||
var chatGroupTotalNumber = result.length; |
||||
this.totalPage = Math.ceil(chatGroupTotalNumber / 10); |
||||
if (this.totalPage === 0) { |
||||
this.totalPage = 1; |
||||
} |
||||
this.chatGroupPageLabel.setValue(this.totalPage); |
||||
if (this.totalPage === 1 && this.currentPage === 1) { |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(false); |
||||
} else if (this.currentPage === 1) { |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(false); |
||||
} else if (this.currentPage === this.totalPage) { |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(true); |
||||
} else { |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(true); |
||||
} |
||||
}, |
||||
|
||||
_createChatGroupPopupPane: function(props, noClose) { |
||||
var self = this; |
||||
var popupCreateChatGroup = BI.Constants.getConstant('dingtalksyn.constants').popup_create_chat_group; |
||||
var chatGroupPopover = BI.extend(props, { |
||||
type: 'dingtalksyn.create.chatgroup.popover', |
||||
noClose: noClose, |
||||
agentList: self.model.agentList, |
||||
listeners: [{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popupCreateChatGroup); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function() { |
||||
var inputInfo = self.createChatGroupPopover.getValue(); |
||||
self.store.createChatGroups(inputInfo); |
||||
} |
||||
}], |
||||
ref: function(_ref) { |
||||
self.createChatGroupPopover = _ref; |
||||
} |
||||
}); |
||||
|
||||
BI.Popovers.create(popupCreateChatGroup, { |
||||
type: 'bi.popover', |
||||
noClose: noClose, |
||||
header: { |
||||
type: 'bi.left_vertical_adapt', |
||||
hgap: 5, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
forceCenter: true, |
||||
text: props.title |
||||
} |
||||
] |
||||
}, |
||||
body: chatGroupPopover, |
||||
width: 455, |
||||
height: 270, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popupCreateChatGroup); |
||||
} |
||||
} |
||||
] |
||||
}).open(popupCreateChatGroup); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.chatgroup.management', ChatGroupManagement); |
||||
})(); |
@ -0,0 +1,74 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
context: ["agentList"], |
||||
|
||||
state: function() { |
||||
return { |
||||
addResult: { |
||||
}, |
||||
chatGroups: [] |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
initChatGroups: function() { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/chatgroup', |
||||
type: 'GET', |
||||
complete: function(res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.chatGroups = result.chatGroups; |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
createChatGroups: function(chatGroup) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/chatgroup', |
||||
type: 'POST', |
||||
data: chatGroup, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.addResult = { |
||||
success: true |
||||
}; |
||||
} else { |
||||
self.model.addResult = result; |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
deleteChatGroup: function(id) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/chatgroup?id=' + id, |
||||
type: 'DELETE', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.initChatGroups(); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.chatgroup.management", Model); |
||||
})(); |
@ -0,0 +1,148 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
context: ["agentList"], |
||||
|
||||
state: function() { |
||||
return { |
||||
dingTalkUrl: '', |
||||
proxyServer: '', |
||||
showParameter: false, |
||||
shouldParseParams: true |
||||
} |
||||
}, |
||||
|
||||
computed: { |
||||
agentListComboItems: function() { |
||||
var items = []; |
||||
var agentList = this.model.agentList; |
||||
var total = this.model.agentList.length; |
||||
for (var i = 0; i < total; i++) { |
||||
var jo = agentList[i]; |
||||
var data = {}; |
||||
data.text = jo.agentName; |
||||
data.value = i; |
||||
items.push(data); |
||||
} |
||||
return items; |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
createDingTalkSynUrl: function(data) { |
||||
var self = this; |
||||
if (BI.isKey(data.agentValue)) { |
||||
var agentInfo = self.model.agentList[data.agentValue]; |
||||
if (agentInfo) { |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/entry/url', |
||||
type: 'POST', |
||||
data: { |
||||
corpId: agentInfo.corpId, |
||||
id: agentInfo.id, |
||||
platform: data.platform, |
||||
fileName: data.fileName, |
||||
entryParameters: data.entryParameters, |
||||
shouldParseParams: self.model.shouldParseParams |
||||
}, |
||||
complete: function(res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.dingTalkUrl = result.oauthUrl; |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}, |
||||
|
||||
getProxyServer: function() { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/proxy/server/url', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.proxyServer = result.proxyServer; |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
saveProxyServer: function(proxyServer) { |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/proxy/server/url', |
||||
type: 'POST', |
||||
data: { |
||||
proxyServer: proxyServer |
||||
}, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
BI.Msg.toast(BI.i18nText('Dec-Basic_Success')); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
testProxyServer: function(proxyServer) { |
||||
var self = this; |
||||
var loadingPane = BI.Constants.getConstant('dingtalksyn.constants').popup_loading_configuration; |
||||
var loadingController = Dec.DingTalkSyn.Util.showLoading('.dingtalksyn-quick-config-container', BI.i18nText('Dec-DingTalkSyn_Test-Connection'), loadingPane); |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/test/proxy/connection', |
||||
type: 'POST', |
||||
data: { |
||||
proxyServer: proxyServer |
||||
}, |
||||
complete: function (res, status) { |
||||
loadingController.remove(loadingPane); |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self._showResultAlert(BI.i18nText('Dec-DingTalkSyn_Connection-Success'), true); |
||||
self._hideResultAlert(); |
||||
} else { |
||||
self._showResultAlert(Dec.DingTalkSyn.Util.getErrorText(result), false); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
setDingTalkSynUrl: function (url) { |
||||
this.model.dingTalkUrl = url; |
||||
}, |
||||
|
||||
setShouldParseParams: function(shouldParseParams) { |
||||
this.model.shouldParseParams = shouldParseParams; |
||||
}, |
||||
|
||||
_showResultAlert: function(label, resultSuccess) { |
||||
var resultTipPopup = BI.Constants.getConstant('dingtalksyn.constants').popup_result_tip_popup; |
||||
Dec.DingTalkSyn.Util.showResultAlert('.dingtalksyn-quick-config-container', label, resultSuccess, resultTipPopup); |
||||
}, |
||||
|
||||
_hideResultAlert: function() { |
||||
var resultTipPopup = BI.Constants.getConstant('dingtalksyn.constants').popup_result_tip_popup; |
||||
setTimeout(function() { |
||||
Dec.DingTalkSyn.Util.hideResultAlert(resultTipPopup); |
||||
}, 1500); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.quick.config", Model); |
||||
}) (); |
@ -0,0 +1,541 @@
|
||||
!(function() { |
||||
var AgentManagement = BI.inherit(BI.Widget, { |
||||
render: function() { |
||||
var self = this; |
||||
self.currentPage = 1; |
||||
self.totalPage = 1; |
||||
this.agent_management_table_header = BI.Constants.getConstant('dingtalksyn.constants.agentmanagement.table.header'); |
||||
|
||||
this._reportServerPane = this._createReportServerPane(); |
||||
this._agentListPane = this._createAgentListPane(); |
||||
|
||||
return { |
||||
type: 'bi.flex_vertical', |
||||
rowSize: ['', 'fill'], |
||||
horizontalAlign: 'stretch', |
||||
items: [ |
||||
{ |
||||
el: self._reportServerPane |
||||
}, |
||||
{ |
||||
el: self._agentListPane, |
||||
tgap: 10 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.agent.management"); |
||||
}, |
||||
|
||||
watch: { |
||||
agentList: function(agentList) { |
||||
var self = this; |
||||
self._populateDingTalkSynAgentTable(agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(agentList); |
||||
}, |
||||
|
||||
addResult: function() { |
||||
var self = this; |
||||
if(!this.model.addResult.success) { |
||||
Dec.DingTalkSyn.Util.alertErrWithDetail(this.model.addResult); |
||||
} else { |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
self.store.initAgentList(); |
||||
BI.Popovers.remove(BI.Constants.getConstant('dingtalksyn.constants').popup_create_agent); |
||||
} |
||||
}, |
||||
|
||||
reportServerUrl: function() { |
||||
var self = this; |
||||
self.reportServerEditor.setValue(self.model.reportServerUrl); |
||||
} |
||||
}, |
||||
|
||||
mounted: function() { |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
this.store.getReportServerUrl(); |
||||
this.store.initAgentList(); |
||||
}, |
||||
|
||||
_createReportServerPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 10, |
||||
items: [ |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
cls: 'bi-border-bottom', |
||||
height: 40, |
||||
items: { |
||||
left: [{ |
||||
type: 'bi.label', |
||||
cls: 'dec-font-weight-bold', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Server'), |
||||
height: 40 |
||||
}], |
||||
right: [{ |
||||
width: 80, |
||||
height: 24, |
||||
type: 'bi.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Save'), |
||||
handler: function () { |
||||
var reportServerUrl = self.reportServerEditor.getValue().trim(); |
||||
if (!Dec.DingTalkSyn.Util.checkUrlValid(reportServerUrl)) { |
||||
Dec.Msg.alert({ |
||||
message: BI.i18nText('Dec-DingTalkSyn_Start_With_Http') |
||||
}); |
||||
} else { |
||||
self.store.saveReportServerUrl(reportServerUrl); |
||||
} |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
{ |
||||
type: 'bi.vertical', |
||||
items: [{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
height: 40, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: 'bi.label', |
||||
textAlign: 'left', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Server_Url'), |
||||
title: BI.i18nText('Dec-DingTalkSyn_Server_Url'), |
||||
width: 111, |
||||
height: 24 |
||||
}, |
||||
rgap: 15 |
||||
}, |
||||
{ |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
width: 390, |
||||
height: 24, |
||||
watermark: 'http://www.fanruan.com:80/webroot/decision', |
||||
allowBlank: false, |
||||
value: self.model.reportServerUrl, |
||||
ref: function (_ref) { |
||||
self.reportServerEditor = _ref; |
||||
} |
||||
}, |
||||
{ |
||||
type: 'dec.text.bubble.combo', |
||||
cls: 'help-area', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Server_Tip'), |
||||
popupWidth: 450, |
||||
popupHeight: 140, |
||||
el: { |
||||
type: 'bi.icon_button', |
||||
$point: 'dec-system-normal-extensible', |
||||
cls: 'detail-font', |
||||
width: 35, |
||||
height: 24 |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
vgap: 10 |
||||
}] |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
_createAgentListPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 10, |
||||
items: [{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
height: 40, |
||||
cls: 'bi-border-bottom', |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Enterprise-DingDing'), |
||||
cls: 'dec-font-weight-bold', |
||||
height: 40 |
||||
}] |
||||
} |
||||
}, { |
||||
type: 'bi.vertical_adapt', |
||||
height: 46, |
||||
items: [{ |
||||
type: "bi.icon_text_item", |
||||
text: BI.i18nText('Dec-DingTalkSyn_New-Agent'), |
||||
cls: 'plus-font', |
||||
width: 200, |
||||
height: 17, |
||||
handler: function() { |
||||
self._saveOrUpdateAgentPopupPane({ |
||||
refreshAgentList: BI.bind(self.store.initAgentList, self.store), |
||||
title: BI.i18nText('Dec-DingTalkSyn_New-Agent') |
||||
}, false, true); |
||||
} |
||||
}] |
||||
}, { |
||||
type: 'bi.table_view', |
||||
cls: 'dingtalksyn-table', |
||||
isNeedMerge: false, |
||||
isNeedFreeze: false, |
||||
columnSize: [140, 100, 250, 250, "fill"], |
||||
items: [], |
||||
header: self.agent_management_table_header, |
||||
ref: function(_ref) { |
||||
self.agentTable = _ref; |
||||
} |
||||
}, { |
||||
type: "bi.left_right_vertical_adapt", |
||||
height: 26, |
||||
vgap: 10, |
||||
items: { |
||||
right: [{ |
||||
type: 'bi.horizontal', |
||||
items: [{ |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
cls: 'page-button dec-pager-first-font', |
||||
ref: function(_ref) { |
||||
self.firstPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage = 1; |
||||
self.agentPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateDingTalkSynAgentTable(self.model.agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.agentList); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
lgap: 5, |
||||
width: 24, |
||||
height: 24, |
||||
cls: 'page-button dec-pager-prev-font', |
||||
disabled: true, |
||||
ref: function(_ref) { |
||||
self.previousPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage -= 1; |
||||
self.agentPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateDingTalkSynAgentTable(self.model.agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.agentList); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
allowBlank: true, |
||||
lgap: 5, |
||||
width: 40, |
||||
height: 24, |
||||
value: self.currentPage.toString(), |
||||
ref: function(_ref) { |
||||
self.agentPageEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CONFIRM, |
||||
action: function () { |
||||
if (this.getValue() > self.totalPage) { |
||||
this.setValue(self.totalPage); |
||||
} else if (this.getValue() < 1) { |
||||
this.setValue(1); |
||||
} |
||||
self.currentPage = parseInt(this.getValue()); |
||||
self._populateDingTalkSynAgentTable(self.model.agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.agentList); |
||||
} |
||||
}] |
||||
}, { |
||||
type: 'bi.label', |
||||
lgap: 5, |
||||
width: 5, |
||||
height: 24, |
||||
text: '/' |
||||
}, { |
||||
type: 'bi.label', |
||||
height: 24, |
||||
lgap: 5, |
||||
text: '1', |
||||
ref: function(_ref) { |
||||
self.agentPageLabel = _ref; |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-next-font', |
||||
ref: function(_ref) { |
||||
self.nextPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage += 1; |
||||
self.agentPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateDingTalkSynAgentTable(self.model.agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.agentList); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-last-font', |
||||
ref: function(_ref) { |
||||
self.lastPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage = self.totalPage; |
||||
self.agentPageEditor.setValue(self.currentPage.toString()); |
||||
self._populateDingTalkSynAgentTable(self.model.agentList, self.currentPage - 1); |
||||
self._populateDingTalkSynPageNumberButtons(self.model.agentList); |
||||
} |
||||
} |
||||
}] |
||||
}] |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
_populateDingTalkSynAgentTable: function(result, page) { |
||||
var self = this; |
||||
page = page || 0; |
||||
var items = []; |
||||
var bubbleCombo = []; |
||||
var agentList = result; |
||||
var startIdx = page * 10; |
||||
var endIdx = Math.min(startIdx + 10, agentList.length); |
||||
for (var i = startIdx; i < endIdx; i++) { |
||||
items.push( |
||||
(function(index) { |
||||
var agentId = agentList[index].agentId === BI.Constants.getConstant('dingtalksyn.constants').dingtalksyn_agent_id_non_adapted? '' : agentList[index].agentId; |
||||
return [ |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
height: 32, |
||||
lgap: 5, |
||||
title: agentList[index].agentName, |
||||
text: agentList[index].agentName |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
height: 32, |
||||
lgap: 5, |
||||
title: agentId, |
||||
text: agentId |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
height: 32, |
||||
lgap: 5, |
||||
title: agentList[index].corpId, |
||||
text: agentList[index].corpId |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
height: 32, |
||||
lgap: 5, |
||||
title: agentList[index].appKey, |
||||
text: agentList[index].appKey |
||||
}, |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
height: 32, |
||||
items: { |
||||
left: [{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
lgap: 2.5, |
||||
title: agentList[index].appSecret, |
||||
text: agentList[index].appSecret, |
||||
width: 280, |
||||
height: 32 |
||||
}], |
||||
right: [self._isShowErrorTip(agentList[index].validStatus) ? { |
||||
type: "bi.icon_label", |
||||
cls: "red-remark-font", |
||||
rgap: 10, |
||||
title: self._getErrorTip(agentList[index].validStatus) |
||||
} : {}, { |
||||
type: 'bi.icon_button', |
||||
cls: 'normal-edit-font', |
||||
rgap: 10, |
||||
height: 32, |
||||
handler: function () { |
||||
self._saveOrUpdateAgentPopupPane({ |
||||
id: [agentList[index].id], |
||||
agentName: [agentList[index].agentName], |
||||
agentId: [agentList[index].agentId], |
||||
corpId: [agentList[index].corpId], |
||||
appKey: [agentList[index].appKey], |
||||
appSecret: [agentList[index].appSecret], |
||||
refreshAgentList: BI.bind(self.store.initAgentList, self.store), |
||||
title: BI.i18nText('Dec-DingTalkSyn_Modify-Agent') |
||||
}, false, false); |
||||
} |
||||
}, { |
||||
type: 'bi.bubble_combo', |
||||
rgap: 10, |
||||
ref: function (_ref) { |
||||
bubbleCombo[index] = _ref; |
||||
}, |
||||
el: { |
||||
type: 'bi.icon_button', |
||||
cls: 'delete-node-font', |
||||
height: 32 |
||||
}, |
||||
stopPropagation: true, |
||||
popup: { |
||||
type: 'bi.text_bubble_bar_popup_view', |
||||
cls: "dec-bubble-combo-popup", |
||||
text: BI.i18nText('Dec-DingTalkSyn_DeleteAgent-Confirm-Popup'), |
||||
buttons: [ |
||||
{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Confirm'), |
||||
value: i, |
||||
width: 80, |
||||
height: 24, |
||||
handler: function (v) { |
||||
self.store.deleteAgent(agentList[index].id); |
||||
bubbleCombo[index].hideView(); |
||||
} |
||||
}, |
||||
{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Cancel'), |
||||
level: 'ignore', |
||||
value: i, |
||||
width: 80, |
||||
height: 24, |
||||
handler: function (v) { |
||||
bubbleCombo[index].hideView(); |
||||
} |
||||
} |
||||
] |
||||
} |
||||
}] |
||||
} |
||||
} |
||||
] |
||||
})(i) |
||||
); |
||||
} |
||||
self.agentTable.populate(items); |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
}, |
||||
|
||||
_isShowErrorTip: function (type) { |
||||
return !Dec.DingTalkSyn.Util.isValidAgent(type); |
||||
}, |
||||
|
||||
_getErrorTip: function (type) { |
||||
if (Dec.DingTalkSyn.Util.isTokenEmptyAgent(type)) { |
||||
return BI.i18nText('Dec-DingTalkSyn_Agent_Deleted_Tip'); |
||||
} else { |
||||
return ''; |
||||
} |
||||
}, |
||||
|
||||
_populateDingTalkSynPageNumberButtons: function(result) { |
||||
var agentTotalNumber = result.length; |
||||
this.totalPage = Math.ceil(agentTotalNumber / 10); |
||||
if (this.totalPage === 0) { |
||||
this.totalPage = 1; // 如果一条记录都没有,这边计算出来的页数是0,但是按照要求,最大页数还是应该显示为1
|
||||
} |
||||
this.agentPageLabel.setValue(this.totalPage); |
||||
if (this.totalPage === 1 && this.currentPage === 1) { |
||||
this.firstPageButton.setEnable(false); |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(false); |
||||
this.lastPageButton.setEnable(false); |
||||
} else if (this.currentPage === 1) { |
||||
this.firstPageButton.setEnable(false); |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(false); |
||||
this.lastPageButton.setEnable(true); |
||||
} else if (this.currentPage === this.totalPage) { |
||||
this.firstPageButton.setEnable(true); |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(true); |
||||
this.lastPageButton.setEnable(false); |
||||
} else { |
||||
this.firstPageButton.setEnable(true); |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(true); |
||||
this.lastPageButton.setEnable(true); |
||||
} |
||||
}, |
||||
|
||||
_saveOrUpdateAgentPopupPane: function(props, noClose, save) { |
||||
var self = this; |
||||
var popup_create_agent = BI.Constants.getConstant('dingtalksyn.constants').popup_create_agent; |
||||
var agentPopover = BI.extend(props, { |
||||
type: 'dingtalksyn.create.agent.popover', |
||||
noClose: noClose, |
||||
listeners: [{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popup_create_agent); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function() { |
||||
var inputInfo = self.createAgentPopover.getValue(); |
||||
self.store.saveOrUpdateAgent(inputInfo.agents, inputInfo.compatible, save); |
||||
} |
||||
}], |
||||
ref: function(_ref) { |
||||
self.createAgentPopover = _ref; |
||||
} |
||||
}); |
||||
|
||||
BI.Popovers.create(popup_create_agent, { |
||||
type: 'bi.popover', |
||||
noClose: noClose, |
||||
header: { |
||||
type: 'bi.left_vertical_adapt', |
||||
hgap: 5, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
forceCenter: true, |
||||
text: props.title |
||||
} |
||||
] |
||||
}, |
||||
body: agentPopover, |
||||
width: 450, |
||||
height: 288, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popup_create_agent); |
||||
} |
||||
} |
||||
] |
||||
}).open(popup_create_agent); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.agentmanagement', AgentManagement); |
||||
})(); |
@ -0,0 +1,115 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
|
||||
context: ["agentList"], |
||||
|
||||
state: function() { |
||||
return { |
||||
addResult: { |
||||
}, |
||||
reportServerUrl: '' |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
saveReportServerUrl: function(reportServerUrl) { |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/report/server/url', |
||||
type: 'POST', |
||||
data: { |
||||
reportServer: reportServerUrl |
||||
}, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
getReportServerUrl: function () { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/report/server/url', |
||||
type: 'GET', |
||||
complete: function(res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.reportServerUrl = result.reportServerUrl; |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
initAgentList: function() { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/agent', |
||||
type: 'GET', |
||||
complete: function(res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.agentList = result.agentList; |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
saveOrUpdateAgent: function(agents, compatible, save) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: save? '/dingtalksyn/save/agent' : '/dingtalksyn/update/agent', |
||||
type: 'POST', |
||||
data: { |
||||
agentArray: agents |
||||
}, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.addResult = { |
||||
success: true, |
||||
compatible: compatible |
||||
}; |
||||
} else { |
||||
self.model.addResult = result; |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
deleteAgent: function(agentID) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/agent?id=' + agentID, |
||||
type: 'DELETE', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.initAgentList(); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dingtalksyn.model.agent.management", Model); |
||||
}) (); |
@ -0,0 +1,58 @@
|
||||
!(function() { |
||||
var MemberDepartment = BI.inherit(BI.Widget, { |
||||
|
||||
_store: function() { |
||||
return BI.Models.getModel("dingtalksyn.model.member.department"); |
||||
}, |
||||
|
||||
watch: { |
||||
depTree: function() { |
||||
var depTree = this.model.depTree; |
||||
var firstNode = null; |
||||
if (depTree && depTree.length > 0) { |
||||
depTree[0].selected = true; |
||||
depTree[0].open = true; |
||||
firstNode = depTree[0]; |
||||
} |
||||
|
||||
this.dingtalksynDepartmentTree.populate(depTree); |
||||
this.dingtalksynDepartmentTree.setValue(firstNode === null ? "" : firstNode.value); |
||||
} |
||||
}, |
||||
|
||||
props: { |
||||
refreshDepartmentData: null, |
||||
clearPageEditor: null |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.multilayer_select_level_tree', |
||||
width: '100%', |
||||
height: '100%', |
||||
ref: function(_ref) { |
||||
self.dingtalksynDepartmentTree = _ref; |
||||
}, |
||||
items: self.model.depMember, |
||||
listeners: [{ |
||||
eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, |
||||
action: function() { |
||||
self.options.refreshDepartmentData(); |
||||
self.options.clearPageEditor(); |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
|
||||
mounted: function() { |
||||
this.store.getDepTreeData(); |
||||
}, |
||||
|
||||
_getDepTree: function() { |
||||
return this.dingtalksynDepartmentTree; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.member.department', MemberDepartment); |
||||
})(); |
@ -0,0 +1,46 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
context: ["agentList"], |
||||
|
||||
state: function() { |
||||
return { |
||||
depTreeData: {} |
||||
} |
||||
}, |
||||
|
||||
computed: { |
||||
depTree: function() { |
||||
var depTree = []; |
||||
var corpList = this.model.depTreeData.corpList; |
||||
if (corpList) { |
||||
corpList.map(function(corp, index) { |
||||
depTree.push(Dec.DingTalkSyn.Util.generateDepTreeRootNode(corp)); |
||||
depTree = depTree.concat(Dec.DingTalkSyn.Util.generateDepTreeChildNode(corp.departmentList, corp.corpId)); |
||||
}); |
||||
} |
||||
return depTree; |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
getDepTreeData: function() { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.reqWithLoading({ |
||||
url: '/dingtalksyn/corp/list', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.depTreeData = BI.jsonDecode(res.responseText); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dingtalksyn.model.member.department", Model); |
||||
})(); |
@ -0,0 +1,740 @@
|
||||
!(function() { |
||||
var MemberManagement = BI.inherit(BI.Widget, { |
||||
_store: function() { |
||||
return BI.Models.getModel("dingtalksyn.model.member.management"); |
||||
}, |
||||
|
||||
watch: { |
||||
agentList: function() { |
||||
this._clearPageEditor(); |
||||
}, |
||||
|
||||
depMember: function() { |
||||
this._populateDingTalkSynMemberTable(this.model.depMember); |
||||
this._populateDingTalkSynPageNumberButtons(this.model.depMemberData); |
||||
}, |
||||
|
||||
matchConfig: function() { |
||||
if (this.model.matchConfig.matchingFsWay) { |
||||
this.matchingFSWayCombo.setValue(this.model.matchConfig.matchingFsWay); |
||||
} else { |
||||
this.matchingFSWayCombo.setValue(0); |
||||
} |
||||
switch(this.model.matchConfig.matchingFsWay) { |
||||
case BI.Constants.getConstant('dingtalksyn.constants').matching_fs_way_user_id: |
||||
case BI.Constants.getConstant('dingtalksyn.constants').matching_fs_way_mobile: |
||||
this.dataSetContainer.setVisible(false); |
||||
this.memberTableNonFsUserName.setVisible(true); |
||||
this.memberTableWithFsUserName.setVisible(false); |
||||
break; |
||||
case BI.Constants.getConstant('dingtalksyn.constants').matching_fs_way_custom: |
||||
this.dataSetContainer.setVisible(false); |
||||
this.memberTableNonFsUserName.setVisible(false); |
||||
this.memberTableWithFsUserName.setVisible(true); |
||||
break; |
||||
case BI.Constants.getConstant('dingtalksyn.constants').matching_fs_way_dataSet: |
||||
this.dataSetContainer.setVisible(true); |
||||
this.memberTableNonFsUserName.setVisible(true); |
||||
this.memberTableWithFsUserName.setVisible(false); |
||||
break; |
||||
} |
||||
}, |
||||
|
||||
serverTableData: function() { |
||||
this.dataSetCombo.populate(this.model.serverTableData); |
||||
this.dataSetCombo.setValue(this.model.matchConfig.dataSet); |
||||
this.store.getDataSetColumn(this.dataSetCombo.getValue()); |
||||
}, |
||||
|
||||
tableDataColName: function() { |
||||
this.userIdCombo.populate(this.model.tableDataColName); |
||||
this.userIdCombo.setValue(this.model.matchConfig.dataSetUserId); |
||||
this.fsUserNameCombo.populate(this.model.tableDataColName); |
||||
this.fsUserNameCombo.setValue(this.model.matchConfig.dataSetFsName); |
||||
} |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this; |
||||
self.currentPage = 1; |
||||
self.totalPage = 1; |
||||
self.matchConfig = {}; |
||||
self.fsUserNameComboGroup = []; |
||||
self.member_management_table_header_non_fsusername = BI.Constants.getConstant('dingtalksyn.constants.member.management.table.header.nonfsusername'); |
||||
self.member_management_table_header_fsusername = BI.Constants.getConstant('dingtalksyn.constants.member.management.table.header.fsusername'); |
||||
|
||||
self.matchingFsWayPane = self._createMatchingFsWayPane(); |
||||
self.synMemberPane = self._createSynMemberPane(); |
||||
|
||||
return { |
||||
type: 'bi.flex_vertical', |
||||
rowSize: ['', 'fill'], |
||||
horizontalAlign: 'stretch', |
||||
items: [ |
||||
{ |
||||
el: self.matchingFsWayPane |
||||
}, |
||||
{ |
||||
el: self.synMemberPane, |
||||
tgap: 10 |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
|
||||
mounted: function() { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
this.store.initData(function() { |
||||
self.store.getDepMemberData({ |
||||
corpId: self._getDepTree().getValue()[0] ? self._getDepTree().getValue()[0].corpId : '' |
||||
}); |
||||
}); |
||||
this._clearPageEditor(); |
||||
}, |
||||
|
||||
_createMatchingFsWayPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vertical', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 10, |
||||
items: [ |
||||
{ |
||||
type: 'bi.left_right_vertical_adapt', |
||||
height: 40, |
||||
cls: 'bi-border-bottom', |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Matching_Way'), |
||||
cls: 'dec-font-weight-bold' |
||||
}], |
||||
right: [{ |
||||
width: 80, |
||||
height: 24, |
||||
type: 'bi.button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Save'), |
||||
handler: function () { |
||||
if (self._checkValid()) { |
||||
self.store.saveMatchingFSWayData({ |
||||
matchingFsWay: self.matchingFSWayCombo.getValue()[0], |
||||
dataSet: self.dataSetCombo.getValue(), |
||||
dataSetFsName: self.fsUserNameCombo.getValue(), |
||||
dataSetUserId: self.userIdCombo.getValue() |
||||
}); |
||||
} else { |
||||
Dec.Msg.alert({ |
||||
message: BI.i18nText('Dec-DingTalkSyn_Match-Way-Not-Null') |
||||
}); |
||||
} |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Match-Way'), |
||||
width: 116, |
||||
textAlign: 'left' |
||||
}, { |
||||
type: "bi.text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
items: [{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_User-Same-With-FS'), |
||||
value: 0 |
||||
}, { |
||||
text: BI.i18nText('Dec-DingTalkSyn_Mobile-Same-With-FS'), |
||||
value: 1 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Manual-Matching-FS'), |
||||
value: 2 |
||||
},{ |
||||
text: BI.i18nText('Dec-DingTalkSyn_Custom-Matching-FS'), |
||||
value: 3 |
||||
}], |
||||
ref: function(_ref) { |
||||
self.matchingFSWayCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CHANGE', |
||||
action: function () { |
||||
var v = this.getValue()[0]; |
||||
switch(v) { |
||||
case 0: |
||||
case 1: |
||||
self.dataSetContainer.setVisible(false); |
||||
self.memberTableNonFsUserName.setVisible(true); |
||||
self.memberTableWithFsUserName.setVisible(false); |
||||
break; |
||||
case 2: |
||||
self.dataSetContainer.setVisible(false); |
||||
self.memberTableNonFsUserName.setVisible(false); |
||||
self.memberTableWithFsUserName.setVisible(true); |
||||
break; |
||||
case 3: |
||||
self.dataSetContainer.setVisible(true); |
||||
self.memberTableNonFsUserName.setVisible(true); |
||||
self.memberTableWithFsUserName.setVisible(false); |
||||
break; |
||||
} |
||||
|
||||
self._refreshDepartmentData(); |
||||
} |
||||
}] |
||||
}] |
||||
}, |
||||
tgap: 10, |
||||
bgap: 10 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.vertical_adapt', |
||||
invisible: true, |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Match-Setting'), |
||||
width: 116, |
||||
textAlign: 'left' |
||||
}, { |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
rgap: 10, |
||||
watermark: BI.i18nText('Dec-DingTalkSyn_DataSet'), |
||||
items: [], |
||||
ref: function(_ref) { |
||||
self.dataSetCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.clearSelectedDataSetColumn(); |
||||
self.store.getDataSetColumn(this.getValue()); |
||||
} |
||||
}] |
||||
}, { |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
rgap: 10, |
||||
watermark: BI.i18nText('Dec-DingTalkSyn_UserID'), |
||||
items: self.model.tableDataColName, |
||||
ref: function(_ref) { |
||||
self.userIdCombo = _ref; |
||||
} |
||||
}, { |
||||
type: "dingtalksyn.editor_text_value_combo", |
||||
width: 150, |
||||
height: 24, |
||||
rgap: 10, |
||||
watermark: BI.i18nText('Dec-DingTalkSyn_DecUserName'), |
||||
items: self.model.tableDataColName, |
||||
ref: function(_ref) { |
||||
self.fsUserNameCombo = _ref; |
||||
} |
||||
}], |
||||
ref: function(_ref) { |
||||
self.dataSetContainer = _ref; |
||||
} |
||||
}, |
||||
bgap: 10 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_createSynMemberPane: function() { |
||||
var self = this; |
||||
return { |
||||
type: 'bi.vtape', |
||||
cls: 'dingtalksyn-section-container', |
||||
hgap: 10, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: 'bi.left_right_vertical_adapt', |
||||
cls: 'bi-border-bottom', |
||||
items: { |
||||
left: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText('Dec-DingTalkSyn_Address-Book'), |
||||
cls: 'dec-font-weight-bold' |
||||
}] |
||||
} |
||||
}, |
||||
height: 40 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.left_right_vertical_adapt', |
||||
items: { |
||||
left: [{ |
||||
type: 'bi.icon_text_item', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Member-Update'), |
||||
cls: 'dingtalksyn-refresh-font', |
||||
width: 75, |
||||
height: 20, |
||||
handler: function() { |
||||
self.synMember(); |
||||
} |
||||
}, { |
||||
type: 'bi.text_button', |
||||
cls: 'dingtalksyn-member-auto-update-button', |
||||
text: BI.i18nText('Dec-DingTalkSyn_Set-Update'), |
||||
height: 20, |
||||
handler: function() { |
||||
var callBack = function(result) { |
||||
self._createAutoUpdateMemberPopupPane({ |
||||
executeTimingTask: result.enableAutoSync, |
||||
timingTaskFrequencyType: result.period, |
||||
timingTaskStartDay: result.startWeekDay, |
||||
timingTaskStartHour: result.startHour, |
||||
timingTaskStartMinute: result.startMinute |
||||
}); |
||||
}; |
||||
self.store.getScheduleTaskConfig(callBack); |
||||
} |
||||
}], |
||||
right: [{ |
||||
type: 'bi.search_editor', |
||||
width: 150, |
||||
height: 24, |
||||
ref: function(_ref) { |
||||
self.dingtalksynMemberSearchEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.SearchEditor.EVENT_CLEAR, |
||||
action: function () { |
||||
// 点叉号清空搜索框触发的事件,把表格还原
|
||||
self._clearPageEditor(); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
}, { |
||||
eventName: BI.Editor.EVENT_CONFIRM, |
||||
action: function () { |
||||
// 点击回车或者失去焦点的时候触发搜索表格数据的操作,如果没有搜到,不动table数据
|
||||
self._clearPageEditor(); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
}] |
||||
}] |
||||
} |
||||
}, |
||||
height: 54 |
||||
}, |
||||
{ |
||||
el: { |
||||
type: 'bi.htape', |
||||
height: 456, |
||||
cls: 'bi-border-top', |
||||
items: [{ |
||||
type: 'bi.vertical', |
||||
cls: 'bi-border-right', |
||||
width: 200, |
||||
items: [{ |
||||
type: 'dingtalksyn.member.department', |
||||
ref: function(_ref) { |
||||
self.depMemberPane = _ref; |
||||
}, |
||||
refreshDepartmentData: BI.bind(self._refreshDepartmentData, self), |
||||
clearPageEditor: BI.bind(self._clearPageEditor, self) |
||||
}] |
||||
}, { |
||||
type: 'bi.vertical', |
||||
items: [{ |
||||
el: { |
||||
type: 'bi.preview_table', |
||||
cls: 'dingtalksyn-table', |
||||
isNeedMerge: false, |
||||
isNeedFreeze: false, |
||||
columnSize: [0.2, 0.2, 0.2, 0.2, 0.2], |
||||
header: self.member_management_table_header_non_fsusername, |
||||
items: [], |
||||
ref: function(_ref) { |
||||
self.memberTableNonFsUserName = _ref; |
||||
} |
||||
}, |
||||
tgap: 10, |
||||
lgap: 10 |
||||
}, { |
||||
el: { |
||||
type: 'bi.preview_table', |
||||
cls: 'dingtalksyn-table', |
||||
isNeedMerge: false, |
||||
isNeedFreeze: false, |
||||
columnSize: [0.16, 0.16, 0.16, 0.16, 0.16, 0.2], |
||||
header: self.member_management_table_header_fsusername, |
||||
invisible: true, |
||||
items: [], |
||||
ref: function(_ref) { |
||||
self.memberTableWithFsUserName = _ref; |
||||
} |
||||
}, |
||||
tgap: 10, |
||||
lgap: 10 |
||||
}, { |
||||
type: "bi.left_right_vertical_adapt", |
||||
tgap: 10, |
||||
height: 26, |
||||
items: { |
||||
right: [{ |
||||
type: 'bi.horizontal', |
||||
items: [{ |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
cls: 'page-button dec-pager-first-font', |
||||
ref: function(_ref) { |
||||
self.firstPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage = 1; |
||||
self.memberPageEditor.setValue(self.currentPage.toString()); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-prev-font', |
||||
disabled: true, |
||||
ref: function(_ref) { |
||||
self.previousPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage > 1) { |
||||
self.currentPage -= 1; |
||||
self.memberPageEditor.setValue(self.currentPage.toString()); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.editor', |
||||
cls: "bi-border", |
||||
allowBlank: true, |
||||
width: 40, |
||||
height: 24, |
||||
lgap: 5, |
||||
value: self.currentPage.toString(), |
||||
ref: function(_ref) { |
||||
self.memberPageEditor = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Editor.EVENT_CONFIRM, |
||||
action: function () { |
||||
if (this.getValue() > self.totalPage) { |
||||
this.setValue(self.totalPage); |
||||
} else if (this.getValue() < 1) { |
||||
this.setValue(1); |
||||
} |
||||
self.currentPage = parseInt(this.getValue()); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
}] |
||||
}, { |
||||
type: 'bi.label', |
||||
width: 5, |
||||
height: 24, |
||||
lgap: 5, |
||||
text: '/' |
||||
}, { |
||||
type: 'bi.label', |
||||
width: 25, |
||||
height: 24, |
||||
lgap: 5, |
||||
text: '1', |
||||
ref: function(_ref) { |
||||
self.memberPageLabel = _ref; |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-next-font', |
||||
ref: function(_ref) { |
||||
self.nextPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage += 1; |
||||
self.memberPageEditor.setValue(self.currentPage.toString()); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
} |
||||
}, { |
||||
type: 'bi.icon_button', |
||||
width: 24, |
||||
height: 24, |
||||
lgap: 5, |
||||
cls: 'page-button dec-pager-last-font', |
||||
ref: function(_ref) { |
||||
self.lastPageButton = _ref; |
||||
}, |
||||
handler: function() { |
||||
if (self.currentPage < self.totalPage) { |
||||
self.currentPage = self.totalPage; |
||||
self.memberPageEditor.setValue(self.currentPage.toString()); |
||||
self._refreshDepartmentData(); |
||||
} |
||||
} |
||||
}] |
||||
}] |
||||
} |
||||
}] |
||||
}] |
||||
}, |
||||
height: 'fill' |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_refreshDepartmentData: function() { |
||||
var self = this; |
||||
|
||||
this.store.getDepMemberData({ |
||||
corpId: this._getDepTree().getValue()[0]? this._getDepTree().getValue()[0].corpId : '', |
||||
depId: this._getDepTree().getValue()[0]? this._getDepTree().getValue()[0].depId : '', |
||||
keyword: self.dingtalksynMemberSearchEditor.getValue(), |
||||
page: self.currentPage - 1 |
||||
}); |
||||
}, |
||||
|
||||
_populateDingTalkSynPageNumberButtons: function(result) { |
||||
var userTotalNumber = result.total; |
||||
this.totalPage = userTotalNumber? Math.ceil(userTotalNumber / 10) : 1; |
||||
this.memberPageLabel.setValue(this.totalPage); |
||||
if (this.totalPage === 1 && this.currentPage === 1) { |
||||
this.firstPageButton.setEnable(false); |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(false); |
||||
this.lastPageButton.setEnable(false); |
||||
} else if (this.currentPage === 1) { |
||||
this.firstPageButton.setEnable(false); |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(false); |
||||
this.lastPageButton.setEnable(true); |
||||
} else if (this.currentPage === this.totalPage) { |
||||
this.firstPageButton.setEnable(true); |
||||
this.nextPageButton.setEnable(false); |
||||
this.previousPageButton.setEnable(true); |
||||
this.lastPageButton.setEnable(false); |
||||
} else { |
||||
this.firstPageButton.setEnable(true); |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(true); |
||||
this.lastPageButton.setEnable(true); |
||||
} |
||||
}, |
||||
|
||||
_populateDingTalkSynMemberTable: function(result) { |
||||
var self = this; |
||||
|
||||
var itemWithFsUserName = []; |
||||
var itemNonFsUserName = []; |
||||
var users = result? result : []; |
||||
|
||||
var v = self.matchingFSWayCombo.getValue()[0]; |
||||
if (v === 2) { |
||||
for (var i = 0; i < users.length; i++) { |
||||
var deps = Dec.DingTalkSyn.Util.replaceDepartmentArrToString(users[i]); |
||||
itemWithFsUserName.push( |
||||
(function (index) { |
||||
return [ |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].name, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].jobNumber, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'dingtalksyn.user.combo', |
||||
value: BI.isEmpty(users[index].decUserName)? null : users[index].decUserName, |
||||
text: users[index].decRealName, |
||||
height: 24, |
||||
count: 10, |
||||
ref: function(_ref) { |
||||
self.fsUserNameComboGroup[index] = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: 'EVENT_CONFIRM', |
||||
action: function () { |
||||
self.store.saveFsUserRelationData(users[index], this.getValue()); |
||||
} |
||||
}] |
||||
|
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].userId, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: deps, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].phone, |
||||
lgap: 5, |
||||
height: 32 |
||||
} |
||||
] |
||||
})(i) |
||||
); |
||||
} |
||||
self.memberTableWithFsUserName.populate(itemWithFsUserName); |
||||
} else { |
||||
for (var i = 0; i < users.length; i++) { |
||||
var deps = Dec.DingTalkSyn.Util.replaceDepartmentArrToString(users[i]); |
||||
itemNonFsUserName.push( |
||||
(function (index) { |
||||
return [ |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].name, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].jobNumber, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].userId, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: deps, |
||||
lgap: 5, |
||||
height: 32 |
||||
}, |
||||
{ |
||||
type: 'bi.label', |
||||
textAlign: "left", |
||||
text: users[index].phone, |
||||
lgap: 5, |
||||
height: 32 |
||||
} |
||||
] |
||||
})(i) |
||||
); |
||||
} |
||||
self.memberTableNonFsUserName.populate(itemNonFsUserName); |
||||
} |
||||
Dec.DingTalkSyn.Util.formatTableStyle(); |
||||
}, |
||||
|
||||
_createAutoUpdateMemberPopupPane: function(props) { |
||||
var popup_auto_update_member = BI.Constants.getConstant('dingtalksyn.constants').popup_auto_update_member; |
||||
var schedulePopover = BI.extend(props, { |
||||
type: 'dingtalksyn.schedule.task.popover', |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popup_auto_update_member); |
||||
} |
||||
} |
||||
] |
||||
}); |
||||
|
||||
BI.Popovers.create(popup_auto_update_member, { |
||||
header: { |
||||
type: 'bi.left_vertical_adapt', |
||||
hgap: 5, |
||||
items: [ |
||||
{ |
||||
type: 'bi.label', |
||||
forceCenter: true, |
||||
text: BI.i18nText('Dec-DingTalkSyn_Set-Update') |
||||
} |
||||
] |
||||
}, |
||||
body: schedulePopover, |
||||
width: 455, |
||||
height: 245, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CLOSE", |
||||
action: function () { |
||||
BI.Popovers.remove(popup_auto_update_member); |
||||
} |
||||
} |
||||
] |
||||
}).open(popup_auto_update_member); |
||||
$('.dingtalksyn-popup-cancel-button').css('border', '1px solid #3685F2').css('border-radius', '2px') |
||||
.css('color', '#3685F2'); |
||||
$('.dingtalksyn-popup-confirm-button').css('border-radius', '2px'); |
||||
}, |
||||
|
||||
_getDingTalkSynMemberTab: function() { |
||||
return this.depMemberPane; |
||||
}, |
||||
|
||||
_getDepTree: function() { |
||||
return this.depMemberPane._getDepTree(); |
||||
}, |
||||
|
||||
_clearPageEditor: function() { |
||||
this.memberPageEditor.setValue(1); |
||||
this.currentPage = 1; |
||||
this.nextPageButton.setEnable(true); |
||||
this.previousPageButton.setEnable(false); |
||||
}, |
||||
|
||||
synMember: function() { |
||||
var self = this; |
||||
self.store.synMemberData(function() { |
||||
self.store.getDepMemberData({}); |
||||
self.depMemberPane.store.getDepTreeData(); |
||||
self._clearPageEditor(); |
||||
}); |
||||
}, |
||||
|
||||
_checkValid: function() { |
||||
var self = this; |
||||
if (self.matchingFSWayCombo.getValue()[0] === BI.Constants.getConstant('dingtalksyn.constants').matching_fs_way_dataSet) { |
||||
if (Dec.DingTalkSyn.Util.isEmpty(self.dataSetCombo.getValue()) || Dec.DingTalkSyn.Util.isEmpty(self.fsUserNameCombo.getValue()) |
||||
|| Dec.DingTalkSyn.Util.isEmpty(self.userIdCombo.getValue())) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.membermanagement', MemberManagement); |
||||
})(); |
@ -0,0 +1,195 @@
|
||||
!(function() { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
context: ["agentList"], |
||||
|
||||
state: function() { |
||||
return { |
||||
depMemberData: {}, |
||||
matchConfig: {}, |
||||
serverTables: [], |
||||
tableColNames: [] |
||||
} |
||||
}, |
||||
|
||||
computed: { |
||||
depMember: function() { |
||||
return this.model.depMemberData.userList; |
||||
}, |
||||
|
||||
serverTableData: function () { |
||||
return BI.map(this.model.serverTables, function (index, item) { |
||||
return { |
||||
text: item.dataSetName, |
||||
value: item.dataSetValue |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
tableDataColName: function () { |
||||
return BI.map(this.model.tableColNames, function (index, item) { |
||||
return { |
||||
text: item.columnName, |
||||
value: item.columnValue |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
initData: function(callBack) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/match/method', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.matchConfig = result; |
||||
Dec.reqGet("/v10/serverdatasets", {}, function (res) { |
||||
self.model.serverTables = res.data; |
||||
}); |
||||
if (BI.isFunction(callBack)) { |
||||
callBack(); |
||||
} |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
getDataSetColumn: function(dataSet) { |
||||
var self = this; |
||||
Dec.reqGet('/v10/' + dataSet + '/datasetcolumns', {}, function (res) { |
||||
var data = res.data; |
||||
if (data) { |
||||
self.model.tableColNames = data; |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
clearSelectedDataSetColumn: function() { |
||||
var self = this; |
||||
self.model.matchConfig.dataSetUserId = -1; |
||||
self.model.matchConfig.dataSetFsName = -1; |
||||
}, |
||||
|
||||
getDepMemberData: function(keyword, corpId, depId, page, count) { |
||||
var self = this; |
||||
var jo = arguments[0]; |
||||
if (jo instanceof Object) { |
||||
keyword = jo.keyword || ''; |
||||
corpId = jo.corpId || ''; |
||||
depId = jo.depId || ''; |
||||
page = jo.page || 0; |
||||
count = jo.count || 10; |
||||
} |
||||
|
||||
var synUserLoadingPane = BI.Constants.getConstant('dingtalksyn.constants').popup_loading_syn_users; |
||||
var loadingController = Dec.DingTalkSyn.Util.showLoading('.digntalk-member-management-container', BI.i18nText('Dec-DingTalkSyn_Loading'), synUserLoadingPane); |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/dep/member', |
||||
type: 'POST', |
||||
data: { |
||||
keyword: keyword, |
||||
corpId: corpId, |
||||
depId: depId, |
||||
page: page, |
||||
count: count |
||||
}, |
||||
complete: function (res, status) { |
||||
loadingController.remove(synUserLoadingPane); |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
self.model.depMemberData = BI.jsonDecode(res.responseText); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
synMemberData: function(callback) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.synMemberData(function() { |
||||
BI.isFunction(callback) && callback(); |
||||
}); |
||||
}, |
||||
|
||||
saveMatchingFSWayData: function(data) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/match/method', |
||||
type: 'POST', |
||||
data: data, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
getScheduleTaskConfig: function(callBack) { |
||||
var self = this; |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/timing/task', |
||||
type: 'GET', |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
if (BI.isFunction(callBack)) { |
||||
callBack.call(self, result); |
||||
} |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
saveFsUserRelationData: function(dingTalkUser, fsUserName) { |
||||
var self = this; |
||||
var userId = dingTalkUser.userId; |
||||
var id = dingTalkUser.userRelationId; |
||||
var corpId = dingTalkUser.corpId; |
||||
var data = { |
||||
dingTalkUser: userId, |
||||
fsUser: BI.isEmpty(fsUserName)? "" : fsUserName, |
||||
corpId: corpId |
||||
}; |
||||
if (!BI.isEmpty(id)) { |
||||
data.id = id; |
||||
} |
||||
Dec.DingTalkSyn.Util.ajax({ |
||||
url: '/dingtalksyn/user/relation', |
||||
type: 'POST', |
||||
data: data, |
||||
complete: function (res, status) { |
||||
if (status === 'success') { |
||||
var result = BI.jsonDecode(res.responseText); |
||||
if (result.errorCode === Dec.DingTalkSyn.ERROR_CODE_OK) { |
||||
dingTalkUser.userRelationId = result.id; |
||||
BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); |
||||
} else { |
||||
Dec.DingTalkSyn.Util.handleCommonErr(result) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
} |
||||
}); |
||||
BI.model("dingtalksyn.model.member.management", Model); |
||||
}) (); |
@ -0,0 +1,34 @@
|
||||
!(function() { |
||||
var TemplateSearchTree = BI.inherit(BI.Widget, { |
||||
props: { |
||||
width: 322, |
||||
height: 24 |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "dec.schedule.template.search", |
||||
width: o.width, |
||||
height: o.height, |
||||
ref: function(_ref) { |
||||
self.templateSearchTree = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.MultiLayerSingleTreeCombo.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent("EVENT_CHANGE", self.getValue()); |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
|
||||
getValue: function() { |
||||
var file = this.templateSearchTree.getValue(); |
||||
// 这里是在兼容10.3 平台改动了搜索树的返回值,从数组变成了值
|
||||
return Array.isArray(file) ? file[0] : file; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut('dingtalksyn.template.search.tree', TemplateSearchTree); |
||||
}) (); |
@ -0,0 +1,77 @@
|
||||
!(function() { |
||||
// fanglei: 自定义editorTrigger,主要解决两个问题:1.提供不可编辑配置选项。2.根据value选出text展示出来。
|
||||
var EditorTrigger = BI.inherit(BI.Trigger, { |
||||
_const: { |
||||
hgap: 4 |
||||
}, |
||||
|
||||
_defaultConfig: function () { |
||||
var conf = EditorTrigger.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-editor-trigger bi-border", |
||||
height: 24, |
||||
allowBlank: false, |
||||
watermark: "", |
||||
errorText: "", |
||||
editable: false, |
||||
items: [] |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
this.options.height -= 2; |
||||
EditorTrigger.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options, c = this._const; |
||||
this.editor = BI.createWidget({ |
||||
type: "dingtalksyn.sign_editor", |
||||
height: o.height, |
||||
value: o.value, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
errorText: o.errorText, |
||||
editable: o.editable, |
||||
items: o.items |
||||
}); |
||||
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
||||
self.fireEvent(EditorTrigger.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
element: this, |
||||
type: "bi.htape", |
||||
items: [ |
||||
{ |
||||
el: this.editor |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
width: o.triggerWidth || o.height |
||||
}, |
||||
width: o.triggerWidth || o.height |
||||
} |
||||
] |
||||
}); |
||||
}, |
||||
|
||||
populate: function(items) { |
||||
this.editor.options.items = items; |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.editor.getValue(); |
||||
}, |
||||
|
||||
setValue: function (value) { |
||||
this.editor.setValue(value); |
||||
}, |
||||
|
||||
setText: function (text) { |
||||
this.editor.setState(text); |
||||
} |
||||
}); |
||||
EditorTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("dingtalksyn.editor_trigger", EditorTrigger); |
||||
})(); |
@ -0,0 +1,106 @@
|
||||
!(function() { |
||||
var SearchTextValueTrigger = BI.inherit(BI.Trigger, { |
||||
|
||||
props: { |
||||
baseCls: "bi-search-text-value-trigger", |
||||
height: 30 |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.htape", |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.searcher", |
||||
ref: function () { |
||||
self.searcher = this; |
||||
}, |
||||
isAutoSearch: false, |
||||
el: { |
||||
type: "dingtalksyn.state_editor", |
||||
ref: function () { |
||||
self.editor = this; |
||||
}, |
||||
text: this._digest(o.value, o.items), |
||||
value: o.value, |
||||
height: o.height |
||||
}, |
||||
popup: { |
||||
type: "bi.search_text_value_combo_popup", |
||||
cls: "bi-card", |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE |
||||
}, |
||||
onSearch: function (obj, callback) { |
||||
var keyword = obj.keyword; |
||||
var finding = BI.Func.getSearchResult(o.items, keyword); |
||||
var matched = finding.matched, finded = finding.finded; |
||||
callback(finded, matched); |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Searcher.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(SearchTextValueTrigger.EVENT_CHANGE); |
||||
} |
||||
}] |
||||
} |
||||
}, { |
||||
el: { |
||||
type: "bi.layout", |
||||
width: 30 |
||||
}, |
||||
width: 30 |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
_setState: function (v) { |
||||
this.editor.setState(v); |
||||
}, |
||||
|
||||
_digest: function(vals, items){ |
||||
var o = this.options; |
||||
vals = BI.isArray(vals) ? vals : [vals]; |
||||
var result = []; |
||||
var formatItems = BI.Tree.transformToArrayFormat(items); |
||||
BI.each(formatItems, function (i, item) { |
||||
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) { |
||||
result.push(item.text || item.value); |
||||
} |
||||
}); |
||||
|
||||
if (result.length > 0) { |
||||
return result.join(","); |
||||
} else { |
||||
return o.text; |
||||
} |
||||
}, |
||||
|
||||
stopEditing: function () { |
||||
this.searcher.stopSearch(); |
||||
}, |
||||
|
||||
getSearcher: function () { |
||||
return this.searcher; |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.options.items = items; |
||||
}, |
||||
|
||||
setValue: function (vals) { |
||||
this._setState(this._digest(vals, this.options.items)); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.searcher.getValue(); |
||||
} |
||||
}); |
||||
SearchTextValueTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
SearchTextValueTrigger.EVENT_STOP = "EVENT_STOP"; |
||||
SearchTextValueTrigger.EVENT_START = "EVENT_START"; |
||||
SearchTextValueTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("dingtalksyn.search_text_value_trigger", SearchTextValueTrigger); |
||||
})(); |
@ -0,0 +1,57 @@
|
||||
!(function () { |
||||
var Addressee = BI.inherit(BI.Widget, { |
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.schedule.addressee", this.options); |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "dec.error_label", |
||||
width: 281, |
||||
el: { |
||||
type: "dingtalksyn.chatgroup.combo", |
||||
value: self.model.selectedValue, |
||||
height: 24, |
||||
ref: function(_ref) { |
||||
self.chatGroupCombo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function () { |
||||
self.chatGroupComboErrorPane.hideError(); |
||||
} |
||||
}] |
||||
}, |
||||
ref: function (_ref) { |
||||
self.chatGroupComboErrorPane = _ref; |
||||
} |
||||
} |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.model.selectedChatGroups; |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.store.setSelectedValue(v); |
||||
}, |
||||
|
||||
checkValid: function () { |
||||
var ob = this.model.selectedValue, valid = true; |
||||
if (BI.isEmpty(ob) || (ob.type === BI.Selection.Multi && ob.value.length < 1) || ob.type === BI.Selection.None) { |
||||
this.chatGroupComboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
valid = false; |
||||
} |
||||
return valid; |
||||
}, |
||||
|
||||
destroyed: function () { |
||||
if (BI.isFunction(this.options.destroyed)) { |
||||
this.options.destroyed() |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.schedule.addressee", Addressee); |
||||
}) (); |
@ -0,0 +1,32 @@
|
||||
!(function () { |
||||
var Model = BI.inherit(Fix.Model, { |
||||
state: function() { |
||||
return { |
||||
selectedValue: {} |
||||
} |
||||
}, |
||||
|
||||
childContext: ["selectedValue"], |
||||
|
||||
computed: { |
||||
selectedChatGroups: function () { |
||||
return { |
||||
type: this.model.selectedValue.type, |
||||
chatGroups: this.model.selectedValue.value |
||||
} |
||||
} |
||||
}, |
||||
|
||||
actions: { |
||||
getSelectedValue: function () { |
||||
return this.model.selectedValue; |
||||
}, |
||||
|
||||
setSelectedValue: function (v) { |
||||
this.model.selectedValue = v; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.model("dingtalksyn.model.schedule.addressee", Model); |
||||
}) (); |
@ -0,0 +1,16 @@
|
||||
BI.service("dingtalksyn.service.schedule.event", BI.inherit(BI.OB, { |
||||
selectedAgentId: "", |
||||
|
||||
getSelectedAgentId: function () { |
||||
return this.selectedAgentId; |
||||
}, |
||||
|
||||
setSelectedAgentId: function (id) { |
||||
this.selectedAgentId = id; |
||||
}, |
||||
|
||||
// Service本是单例对象,当触发事件的组件被销毁的时候,应该把里面的值清空一下。
|
||||
clear: function () { |
||||
this.selectedAgentId = ""; |
||||
} |
||||
})); |
@ -0,0 +1,75 @@
|
||||
!(function () { |
||||
var Schedule = BI.inherit(BI.Widget, { |
||||
_store: function () { |
||||
return BI.Models.getModel("dingtalksyn.model.schedule.terminal"); |
||||
}, |
||||
|
||||
watch: { |
||||
agentIds: function (v) { |
||||
this.combo.populate(v); |
||||
this.combo.setValue(this.model.selectedId); |
||||
}, |
||||
|
||||
selectedId: function (v) { |
||||
var service = BI.Services.getService("dingtalksyn.service.schedule.event"); |
||||
service.setSelectedAgentId(v); |
||||
service.fireEvent("AGENT_CHANGE", v); |
||||
this.combo.setValue(v); |
||||
} |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this; |
||||
return { |
||||
type: "dec.error_label", |
||||
width: 281, |
||||
el: { |
||||
type: "bi.text_value_combo", |
||||
height: 24, |
||||
value: self.model.selectedId, |
||||
ref: function (_ref) { |
||||
self.combo = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||
action: function () { |
||||
self.store.setSelectedId(this.getValue()[0]); |
||||
self.comboErrorPane.hideError(); |
||||
} |
||||
}], |
||||
items: self.model.agentIds |
||||
}, |
||||
ref: function (_ref) { |
||||
self.comboErrorPane = _ref; |
||||
} |
||||
} |
||||
}, |
||||
|
||||
mounted: function () { |
||||
this.store.getAgents(); |
||||
}, |
||||
|
||||
destroyed: function () { |
||||
BI.Services.getService("dingtalksyn.service.schedule.event").clear(); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.store.getSelectedId(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.store.setSelectedId(v); |
||||
}, |
||||
|
||||
checkValid: function () { |
||||
var valid = true; |
||||
if (BI.isEmpty(this.combo.getValue()[0])) { |
||||
this.comboErrorPane.showError(BI.i18nText('Dec-DingTalkSyn_Not_Null')); |
||||
valid = false; |
||||
} |
||||
return valid; |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dingtalksyn.schedule.terminal", Schedule); |
||||
}) (); |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue