Browse Source

DEC-13003 批量设置角色权限插件

pull/1/head
zed 5 years ago
commit
23eb863bcf
  1. 130
      build.xml
  2. 23
      plugin.xml
  3. 41
      pom.xml
  4. 11
      readme.md
  5. BIN
      screenshots/result1.png
  6. BIN
      screenshots/result2.png
  7. 22
      src/main/java/com/fr/plugin/decision/role/auth/BatchRoleComponent.java
  8. 53
      src/main/java/com/fr/plugin/decision/role/auth/BatchRoleController.java
  9. 16
      src/main/java/com/fr/plugin/decision/role/auth/BatchRoleI18n.java
  10. 23
      src/main/java/com/fr/plugin/decision/role/auth/BatchRoleResource.java
  11. 17
      src/main/java/com/fr/plugin/decision/role/auth/ControllerRegisterImpl.java
  12. 62
      src/main/java/com/fr/plugin/decision/role/auth/RequestBean.java
  13. 0
      src/main/resources/.gitkeep
  14. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n.properties
  15. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n_en_US.properties
  16. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n_ja_JP.properties
  17. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n_ko_KR.properties
  18. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n_zh_CN.properties
  19. 7
      src/main/resources/com/fr/plugin/decision/batch/role/i18n_zh_TW.properties
  20. 2
      src/main/resources/com/fr/plugin/decision/batch/role/plugin.min.js

130
build.xml

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home"/>
<property name="libs" value="${basedir}/lib/report"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/../env/webroot/WEB-INF/lib"/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<property name="current-version" value="${plugin.version}"/>
<!-- 插件版本-->
<property name="plugin-version" value="${current-version}"/>
<!-- 插件名字-->
<property name="plugin-name" value="decision-batch-role"/>
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/>
<target name="prepare">
<delete dir="${classes}"/>
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<delete dir="${destLoc}/${plugin.name}"/>
</target>
<path id="compile.classpath">
<fileset dir="${libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${publicLibs}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${reportLibs}">
<include name="**/*.jar"/>
</fileset>
</path>
<patternset id="resources4Jar">
<exclude name="**/.settings/**"/>
<exclude name=".classpath"/>
<exclude name=".project"/>
<exclude name="**/*.java"/>
<exclude name="**/*.db"/>
<exclude name="**/*.g"/>
<exclude name="**/package.html"/>
</patternset>
<target name="copy_resources">
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/>
<delete dir="tmp"/>
<copy todir="tmp">
<fileset dir="${resources_from}/src/main/resources">
<patternset refid="resources4Jar"/>
</fileset>
</copy>
<copy todir="${classes}">
<fileset dir="tmp"/>
</copy>
<delete dir="tmp"/>
</target>
<target name="compile_javas">
<echo message="编译${compile_files}下的Java文件"/>
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}"
target="${target_jdk_version}"
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}"
executable="${compile_jdk_version}/bin/javac">
<src path="${basedir}/src/main/java"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>
</target>
<target name="jar_classes">
<echo message="打Jar包:${jar_name}"/>
<delete file="${basedir}/${jar_name}"/>
<jar jarfile="${basedir}/${jar_name}">
<fileset dir="${classes}">
</fileset>
</jar>
</target>
<target name="super_jar" depends="prepare">
<antcall target="copy_resources">
<param name="resources_from" value="${basedir}"/>
</antcall>
<antcall target="compile_javas">
<param name="source_jdk_version" value="1.6"/>
<param name="target_jdk_version" value="1.6"/>
<param name="compile_jdk_version" value="${jdk.home}"/>
<param name="compile_files" value="${basedir}/src"/>
</antcall>
<echo message="compile plugin success!"/>
<antcall target="jar_classes">
<param name="jar_name" value="${plugin-jar}"/>
</antcall>
<delete dir="${classes}"/>
</target>
<target name="jar" depends="super_jar">
<antcall target="zip"/>
</target>
<target name="zip">
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/>
<echo message="----------zip files----------"/>
<mkdir dir="${plugin-folder}"/>
<copy todir="${plugin-folder}">
<fileset dir=".">
<include name="${plugin-jar}"/>
<include name="plugin.xml"/>
</fileset>
<fileset dir="${libs}">
<include name="*.jar"/>
<include name="*.dll"/>
</fileset>
</copy>
<zip destfile="${basedir}/${plugin-folder}.zip" basedir=".">
<include name="${plugin-folder}/*.jar"/>
<include name="${plugin-folder}/*.dll"/>
<include name="${plugin-folder}/plugin.xml"/>
</zip>
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/>
</target>
</project>

23
plugin.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.decision.batch.role</id>
<name><![CDATA[批量设置角色管理权限]]></name>
<active>yes</active>
<hidden>no</hidden>
<version>1.0.1</version>
<env-version>10.0~</env-version>
<jartime>2020-4-20</jartime>
<vendor>zed</vendor>
<description><![CDATA[可以批量设置角色权限]]></description>
<change-notes><![CDATA[
<p>[2019-04-28]实现批量设置角色逻辑</p>
]]></change-notes>
<function-recorder class="com.fr.plugin.decision.role.auth.BatchRoleController"/>
<extra-core>
<LocaleFinder class="com.fr.plugin.decision.role.auth.BatchRoleI18n"/>
</extra-core>
<extra-decision>
<ControllerRegisterProvider class="com.fr.plugin.decision.role.auth.ControllerRegisterImpl"/>
<WebResourceProvider class="com.fr.plugin.decision.role.auth.BatchRoleResource"/>
</extra-decision>
</plugin>

41
pom.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.fr.decision</groupId>
<artifactId>decision-feature</artifactId>
<version>10.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fr.decision</groupId>
<artifactId>decision-feature</artifactId>
<version>10.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId>
<version>10.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>decision.message.event</artifactId>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.decision.batch.role-1.0/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

11
readme.md

@ -0,0 +1,11 @@
# 平台角色权限批量设置
客户的角色非常多,安装该插件可以一键批量设置角色权限
# 效果截图
![result](screenshots/result1.png)
![result](screenshots/result2.png)

BIN
screenshots/result1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
screenshots/result2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

22
src/main/java/com/fr/plugin/decision/role/auth/BatchRoleComponent.java

@ -0,0 +1,22 @@
package com.fr.plugin.decision.role.auth;
import com.fr.web.struct.Component;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/30
*/
public class BatchRoleComponent extends Component {
public static BatchRoleComponent KEY = new BatchRoleComponent();
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("com/fr/plugin/decision/batch/role/plugin.min.js");
}
}

53
src/main/java/com/fr/plugin/decision/role/auth/BatchRoleController.java

@ -0,0 +1,53 @@
package com.fr.plugin.decision.role.auth;
import com.fanruan.api.decision.AuthorityKit;
import com.fanruan.api.decision.role.CustomRoleKit;
import com.fanruan.api.decision.user.UserKit;
import com.fr.decision.webservice.Response;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.third.springframework.stereotype.Controller;
import com.fr.third.springframework.web.bind.annotation.RequestBody;
import com.fr.third.springframework.web.bind.annotation.RequestMapping;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.third.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/29
*/
@FunctionRecorder
@Controller
public class BatchRoleController {
private static final String DEP = "depost";
private static final String ROLE = "role";
private static final String USER = "user";
@RequestMapping(value = "/batch/role", method = RequestMethod.POST)
@ResponseBody
public Response batch(HttpServletRequest req,
HttpServletResponse res,
@RequestBody RequestBean bean) throws Exception {
String id = UserKit.getCurrentUserId(req);
List<String> roleIds = CustomRoleKit.getCustomRoleIds(id, bean.getKeyword());
String roleType = bean.getRoleType();
for (String roleId : roleIds) {
if (DEP.equals(roleType)) {
AuthorityKit.setDepAuth(bean.getRoleId(), bean.getAuthValue(), roleId, bean.getAuthType());
} else if (USER.equals(roleType)) {
AuthorityKit.setUserAuth(bean.getRoleId(), bean.getAuthValue(), roleId, bean.getAuthType());
} else if (ROLE.equals(roleType)) {
AuthorityKit.setCustomRoleAuth(bean.getRoleId(), bean.getAuthValue(), roleId, bean.getAuthType());
}
}
return Response.success();
}
}

16
src/main/java/com/fr/plugin/decision/role/auth/BatchRoleI18n.java

@ -0,0 +1,16 @@
package com.fr.plugin.decision.role.auth;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/30
*/
public class BatchRoleI18n extends AbstractLocaleFinder {
@Override
public String find() {
return "com/fr/plugin/decision/batch/role/i18n";
}
}

23
src/main/java/com/fr/plugin/decision/role/auth/BatchRoleResource.java

@ -0,0 +1,23 @@
package com.fr.plugin.decision.role.auth;
import com.fr.decision.fun.impl.AbstractWebResourceProvider;
import com.fr.decision.web.CommonComponent;
import com.fr.web.struct.Atom;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/30
*/
public class BatchRoleResource extends AbstractWebResourceProvider {
@Override
public Atom attach() {
return CommonComponent.KEY;
}
@Override
public Atom client() {
return BatchRoleComponent.KEY;
}
}

17
src/main/java/com/fr/plugin/decision/role/auth/ControllerRegisterImpl.java

@ -0,0 +1,17 @@
package com.fr.plugin.decision.role.auth;
import com.fr.decision.fun.impl.AbstractControllerRegisterProvider;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/29
*/
public class ControllerRegisterImpl extends AbstractControllerRegisterProvider {
@Override
public Class<?>[] getControllers() {
return new Class[]{BatchRoleController.class};
}
}

62
src/main/java/com/fr/plugin/decision/role/auth/RequestBean.java

@ -0,0 +1,62 @@
package com.fr.plugin.decision.role.auth;
import java.io.Serializable;
/**
* @author Zed
* @version 10.0
* Created by Zed on 2020/4/29
*/
public class RequestBean implements Serializable {
private static final long serialVersionUID = -987496184258324246L;
private String roleType;
private String roleId;
private String keyword;
private int authType;
private int authValue;
public RequestBean() {
}
public String getRoleType() {
return roleType;
}
public void setRoleType(String roleType) {
this.roleType = roleType;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public int getAuthType() {
return authType;
}
public void setAuthType(int authType) {
this.authType = authType;
}
public int getAuthValue() {
return authValue;
}
public void setAuthValue(int authValue) {
this.authValue = authValue;
}
}

0
src/main/resources/.gitkeep

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n_en_US.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n_ja_JP.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n_ko_KR.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n_zh_CN.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

7
src/main/resources/com/fr/plugin/decision/batch/role/i18n_zh_TW.properties

@ -0,0 +1,7 @@
Dec-Plugin_Authority_Role_De_Authorization=\u5168\u90E8\u89E3\u9664
Dec-Plugin_Authority_Role_De_Authorization_Tip=\u786E\u5B9A\u89E3\u9664\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Full_Authorization=\u5168\u90E8\u6388\u6743
Dec-Plugin_Authority_Role_Full_Authorization_Tip=\u786E\u5B9A\u6388\u4E88\u5DF2\u9009{}\u5BF9\u4EE5\u4E0B\u6240\u6709\u89D2\u8272\u7684\u7BA1\u7406\u6743\u9650\uFF1F
Dec-Plugin_Authority_Role_Processing=\u5904\u7406\u4E2D
Dec-Plugin_Authority_Role_Processing_Fail=\u5904\u7406\u5931\u8D25
Dec-Plugin_Authority_Role_Processing_Success=\u5904\u7406\u5B8C\u6210

2
src/main/resources/com/fr/plugin/decision/batch/role/plugin.min.js vendored

@ -0,0 +1,2 @@
/** simple-template 20-04-30 17:26:21 */
!function(){var t=BI.inherit(BI.BasicButton,{props:{baseCls:"",text:"",items:[{value:!0,text:BI.i18nText("Dec-Plugin_Authority_Role_Full_Authorization")},{value:!1,text:BI.i18nText("Dec-Plugin_Authority_Role_De_Authorization")}]},render:function(){var e=this,t=this.options;return{type:"bi.center_adapt",items:[{type:"bi.combo",trigger:"click",adjustXOffset:60,adjustYOffset:-8,el:{type:"bi.vertical_adapt",height:36,items:[{type:"bi.label",text:t.text,ref:function(t){e.text=t}},{type:"bi.icon_button",height:16,tgap:5,cls:"trigger-triangle-font",ref:function(t){e.trigger=t}}]},popup:{el:{type:"bi.text_value_combo_popup",chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,items:t.items,textAlign:"center",listeners:[{eventName:BI.IconComboPopup.EVENT_CHANGE,action:function(){e.combo.hideView(),e.fireEvent("EVENT_CHANGE",this.getValue()[0]),this.setValue()}}]}},ref:function(t){e.combo=t}}]}},doHighLight:function(){this.text.doHighLight()},unHighLight:function(){this.text.unHighLight()}});BI.shortcut("dec.plugin.role.list.header.auth",t)}(),Dec.Utils=Dec.Utils||{},BI.extend(Dec.Utils,{setPluginRoleAuthority:function(t,e){Dec.reqPost("/batch/role",t,e)}}),function(){var t=BI.inherit(BI.NodeButton,{props:{baseCls:"dec-expander-trigger bi-background",texts:[],items:[],iconWidth:30},_store:function(){return BI.Models.getModel("dec.model.plugin.role.trigger")},watch:{status:function(t){this.statusMasker&&this.statusMasker.setStatus(t)}},render:function(){var e=this,i=this.options;return{type:"bi.htape",items:[{el:{type:"dec.screening.combo",ref:function(t){e.combo=t},text:i.texts.all,defaultValue:1,items:[{text:i.texts.all,iconCls1:"check-mark-e-font",value:1},{text:i.texts.onlyOpen,iconCls1:"check-mark-e-font",value:2}],listeners:[{eventName:"EVENT_CHANGE",action:function(){}}]}},{el:{type:"bi.button_group",ref:function(t){e.authItemsGroup=t},layouts:[{type:"bi.right_vertical_adapt"}],items:this._formatItems(i.items)},width:300},{el:{type:"dec.display.selector",ref:function(t){e.displaySelecter=t},items:i.items,listeners:[{eventName:"EVENT_CHANGE",action:function(t){i.onAuthItemsChange(t)}}]},width:30},{type:"bi.default",width:i.iconWidth}]}},_formatItems:function(t){var i=this,o=[];return BI.each(t,function(t,e){e.selected&&o.push(BI.extend({type:"dec.plugin.role.list.header.auth",width:i.options.itemWidth,listeners:[{eventName:"EVENT_CHANGE",action:function(t){i._doAuth(t)}}]},e))}),o},_doAuth:function(e){var i=this,t=BI.i18nText(e?"Dec-Plugin_Authority_Role_Full_Authorization_Tip":"Dec-Plugin_Authority_Role_De_Authorization_Tip",this.model.carrierText);BI.Msg.confirm(BI.i18nText("BI-Basic_Sure"),t,function(t){t&&i._startSet(e)})},_startSet:function(t){var e=this,i=BI.UUID();BI.Maskers.create(i,null,{render:{type:"dec.test.status",waitingText:BI.i18nText("Dec-Plugin_Authority_Role_Processing"),successText:BI.i18nText("Dec-Plugin_Authority_Role_Processing_Success"),failText:BI.i18nText("Dec-Plugin_Authority_Role_Processing_Fail"),listeners:[{eventName:"EVENT_CLOSE",action:function(){BI.Maskers.hide(i),BI.Maskers.remove(i)}}],ref:function(t){e.statusMasker=t}}}),BI.Maskers.show(i),e.store.doAuthorization(t)},doHighLight:function(i){var t=this.authItemsGroup.getAllButtons();BI.each(t,function(t,e){e.getValue()===i?e.doHighLight():e.unHighLight()})},unHighLight:function(){var t=this.authItemsGroup.getAllButtons();BI.each(t,function(t,e){e.unHighLight()})},populate:function(t){this.options.authItems=t,this.authItemsGroup.populate(this._formatItems(t))}});t.EVENT_CHANGE="EVENT_CHANGE",t.EVENT_RESIZE="EVENT_RESIZE",BI.shortcut("dec.plugin.role.list.header",t)}(),function(){var t=BI.inherit(Fix.Model,{state:function(){return{status:{}}},context:["keyword","entityInfo","carrierInfo"],computed:{carrierText:function(){var t=this.model.carrierInfo.carrierType;return t===DecCst.Authority.CARRIER_TYPE.USER?BI.i18nText("Dec-Basic_User"):t===DecCst.Authority.CARRIER_TYPE.DEPOST?BI.i18nText("Dec-Department"):t===DecCst.Authority.CARRIER_TYPE.DEPOST?BI.i18nText("Dec-Role"):""}},actions:{doAuthorization:function(t){var e=this;Dec.Utils.setPluginRoleAuthority({roleType:this.model.carrierInfo.carrierType,roleId:this.model.carrierInfo.carrierId,authType:2,authValue:t?2:1,keyword:this.model.keyword},function(t){e.model.status=t,BI.isNotNull(t.data)&&(e.model.carrierInfo=BI.extend({},e.model.carrierInfo))})}}});BI.model("dec.model.plugin.role.trigger",t)}(),BI.config("dec.role.expander",function(t){return BI.extend(t,{header:"dec.plugin.role.list.header"})});
Loading…
Cancel
Save