Merge branch 'dev_xd' of http://62.234.3.186:3000/jiangyq/YZProjectCloud into dev_xd
commit
16e131d60e
|
@ -179,6 +179,17 @@
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.41.2.2</version>
|
<version>3.41.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.hasor</groupId>
|
||||||
|
<artifactId>hasor-spring</artifactId>
|
||||||
|
<version>4.2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.hasor</groupId>
|
||||||
|
<artifactId>hasor-dataway</artifactId>
|
||||||
|
<version>4.2.5</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.yanzhu.manage;
|
||||||
import com.yanzhu.common.security.annotation.EnableCustomConfig;
|
import com.yanzhu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.yanzhu.common.security.annotation.EnableRyFeignClients;
|
import com.yanzhu.common.security.annotation.EnableRyFeignClients;
|
||||||
import com.yanzhu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.yanzhu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import net.hasor.spring.boot.EnableHasor;
|
||||||
|
import net.hasor.spring.boot.EnableHasorWeb;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableHasor()
|
||||||
|
@EnableHasorWeb()
|
||||||
public class YanZhuManageApplication
|
public class YanZhuManageApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.yanzhu.manage.hasor;
|
||||||
|
|
||||||
|
import net.hasor.core.ApiBinder;
|
||||||
|
import net.hasor.core.DimModule;
|
||||||
|
import net.hasor.dataql.DataQL;
|
||||||
|
import net.hasor.dataql.compiler.qil.QIL;
|
||||||
|
import net.hasor.dataway.DatawayApi;
|
||||||
|
import net.hasor.dataway.authorization.PermissionType;
|
||||||
|
import net.hasor.dataway.dal.FieldDef;
|
||||||
|
import net.hasor.dataway.service.InterfaceApiFilter;
|
||||||
|
import net.hasor.dataway.spi.ApiInfo;
|
||||||
|
import net.hasor.dataway.spi.AuthorizationChainSpi;
|
||||||
|
import net.hasor.dataway.spi.CompilerSpiListener;
|
||||||
|
import net.hasor.dataway.spi.PreExecuteChainSpi;
|
||||||
|
import net.hasor.db.JdbcModule;
|
||||||
|
import net.hasor.db.Level;
|
||||||
|
import net.hasor.spring.SpringModule;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@DimModule
|
||||||
|
@Component
|
||||||
|
public class HasorModule implements SpringModule {
|
||||||
|
@Autowired
|
||||||
|
private DataSource dataSource = null;
|
||||||
|
|
||||||
|
public void loadModule(ApiBinder apiBinder) throws Throwable {
|
||||||
|
// .DataSource form Spring boot into Hasor
|
||||||
|
apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource));
|
||||||
|
|
||||||
|
InterfaceApiFilter f;
|
||||||
|
apiBinder.bindSpiListener(PreExecuteChainSpi.class, (apiInfo, future) -> {
|
||||||
|
try{
|
||||||
|
Method method = apiInfo.getClass().getMethod("getObj");
|
||||||
|
Map<FieldDef, String> obj=(Map<FieldDef, String>)method.invoke(apiInfo);
|
||||||
|
Object a=obj;
|
||||||
|
}catch (Exception ex){
|
||||||
|
|
||||||
|
}
|
||||||
|
//String apiPath = apiInfo.getApiPath();
|
||||||
|
// String apiMethod = apiInfo.getMethod()
|
||||||
|
// if (...) {
|
||||||
|
// // (方式1)通过 future 设置异常信息
|
||||||
|
// future.failed(new StatusMessageException(401, "not power"));
|
||||||
|
// // (方式2)或者直接 throw 一个异常
|
||||||
|
// throw new StatusMessageException(401, "not power");
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
apiBinder.bindSpiListener(CompilerSpiListener.class, new CompilerSpiListener() {
|
||||||
|
@Override
|
||||||
|
public QIL compiler(ApiInfo apiInfo, String query, DataQL dataQL) throws IOException {
|
||||||
|
query = "hint FRAGMENT_SQL_COLUMN_CASE=\"hump\"\n hint FRAGMENT_SQL_QUERY_BY_PAGE_NUMBER_OFFSET = 1 \n" + query;
|
||||||
|
return CompilerSpiListener.super.compiler(apiInfo, query, dataQL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
package net.hasor.dataql.domain;
|
||||||
|
import net.hasor.dataql.Udf;
|
||||||
|
import net.hasor.dataql.runtime.operator.OperatorUtils;
|
||||||
|
import net.hasor.utils.ArrayUtils;
|
||||||
|
import net.hasor.utils.ref.BeanMap;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class DomainHelper {
|
||||||
|
public static ValueModel nullDomain() {
|
||||||
|
return ValueModel.NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ListModel newList() {
|
||||||
|
return new ListModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObjectModel newObject() {
|
||||||
|
return new ObjectModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataModel convertTo(Object object) {
|
||||||
|
if (object instanceof DataModel) {
|
||||||
|
// 已经是 DataModel
|
||||||
|
return (DataModel) object;
|
||||||
|
} else if (object == null) {
|
||||||
|
// 基础类型:空
|
||||||
|
return ValueModel.NULL;
|
||||||
|
} else if (OperatorUtils.isBoolean(object)) {
|
||||||
|
// 基础类型:boolean
|
||||||
|
if ((boolean) object) {
|
||||||
|
return ValueModel.TRUE;
|
||||||
|
} else {
|
||||||
|
return ValueModel.FALSE;
|
||||||
|
}
|
||||||
|
} else if (object instanceof CharSequence) {
|
||||||
|
// 基础类型:字符串
|
||||||
|
return new ValueModel(String.valueOf(object));
|
||||||
|
} else if (OperatorUtils.isNumber(object)) {
|
||||||
|
// 基础类型:数字
|
||||||
|
return new ValueModel(object);
|
||||||
|
} else if (object instanceof Date) {
|
||||||
|
// 外部类型:时间 -> Long
|
||||||
|
return new ValueModel(((Date) object).getTime());
|
||||||
|
} else if (object instanceof UUID) {
|
||||||
|
// 外部类型:UUID -> String
|
||||||
|
return new ValueModel(((UUID) object).toString());
|
||||||
|
} else if (object.getClass().isEnum()) {
|
||||||
|
// 外部类型:枚举 -> ValueModel(字符串)
|
||||||
|
return new ValueModel(((Enum<?>) object).name());
|
||||||
|
} else if (object instanceof Map) {
|
||||||
|
// 外部类型:Map -> ObjectModel
|
||||||
|
Map mapData = (Map) object;
|
||||||
|
Set entrySet = mapData.entrySet();
|
||||||
|
ObjectModel objectModel = new ObjectModel();
|
||||||
|
for (Object entry : entrySet) {
|
||||||
|
if (entry instanceof Map.Entry) {
|
||||||
|
Object key = ((Map.Entry) entry).getKey();
|
||||||
|
Object val = ((Map.Entry) entry).getValue();
|
||||||
|
objectModel.put(key.toString(), convertTo(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objectModel;
|
||||||
|
} else if (object.getClass().isArray()) {
|
||||||
|
// 外部类型:数组 -> ListModel
|
||||||
|
Class<?> componentType = object.getClass().getComponentType();
|
||||||
|
Object[] objectArrays = null;
|
||||||
|
if (componentType.isPrimitive()) {
|
||||||
|
/** */if (Boolean.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((boolean[]) object);
|
||||||
|
} else if (Byte.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((byte[]) object);
|
||||||
|
} else if (Short.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((short[]) object);
|
||||||
|
} else if (Integer.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((int[]) object);
|
||||||
|
} else if (Long.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((long[]) object);
|
||||||
|
} else if (Character.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((char[]) object);
|
||||||
|
} else if (Float.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((float[]) object);
|
||||||
|
} else if (Double.TYPE == componentType) {
|
||||||
|
objectArrays = ArrayUtils.toObject((double[]) object);
|
||||||
|
} else {
|
||||||
|
objectArrays = (Object[]) object;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
objectArrays = (Object[]) object;
|
||||||
|
}
|
||||||
|
return new ListModel(Arrays.asList(objectArrays));
|
||||||
|
} else if (object instanceof Collection) {
|
||||||
|
// 外部类型:集合 -> ListModel
|
||||||
|
return new ListModel((Collection<?>) object);
|
||||||
|
} else if (object instanceof Udf) {
|
||||||
|
// 外部类型:UDF -> CallModel
|
||||||
|
return new UdfModel((Udf) object);
|
||||||
|
} else if (object instanceof LocalDateTime) {
|
||||||
|
LocalDateTime localDateTime=(LocalDateTime)object;
|
||||||
|
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
return new ValueModel((date).getTime());
|
||||||
|
} else {
|
||||||
|
// 外部类型:Bean -> ObjectModel
|
||||||
|
BeanMap beanMap = new BeanMap(object);
|
||||||
|
ObjectModel objectModel = new ObjectModel();
|
||||||
|
for (String entryKey : beanMap.keySet()) {
|
||||||
|
if ("class".equals(entryKey)) {
|
||||||
|
//objectModel.put(entryKey, convertTo(beanMap.getBean().getClass().getName()));
|
||||||
|
} else {
|
||||||
|
objectModel.put(entryKey, convertTo(beanMap.get(entryKey)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objectModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
package net.hasor.dataway.service;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import net.hasor.core.Inject;
|
||||||
|
import net.hasor.core.spi.SpiTrigger;
|
||||||
|
import net.hasor.dataway.DatawayApi;
|
||||||
|
import net.hasor.dataway.config.DatawayUtils;
|
||||||
|
import net.hasor.dataway.config.LoggerUtils;
|
||||||
|
import net.hasor.dataway.dal.ApiDataAccessLayer;
|
||||||
|
import net.hasor.dataway.dal.ApiStatusEnum;
|
||||||
|
import net.hasor.dataway.dal.EntityDef;
|
||||||
|
import net.hasor.dataway.dal.FieldDef;
|
||||||
|
import net.hasor.dataway.spi.ApiInfo;
|
||||||
|
import net.hasor.dataway.spi.CallSource;
|
||||||
|
import net.hasor.utils.StringUtils;
|
||||||
|
import net.hasor.web.Invoker;
|
||||||
|
import net.hasor.web.InvokerChain;
|
||||||
|
import net.hasor.web.InvokerConfig;
|
||||||
|
import net.hasor.web.InvokerFilter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责处理 API 的执行
|
||||||
|
* @author 赵永春 (zyc@hasor.net)
|
||||||
|
* @version : 2020-03-20
|
||||||
|
*/
|
||||||
|
public class InterfaceApiFilter implements InvokerFilter {
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(InterfaceApiFilter.class);
|
||||||
|
@Inject
|
||||||
|
private ApiCallService callService;
|
||||||
|
@Inject
|
||||||
|
private SpiTrigger spiTrigger;
|
||||||
|
@Inject
|
||||||
|
private ApiDataAccessLayer dataAccessLayer;
|
||||||
|
@Inject
|
||||||
|
private CrossDomainService crossDomainService;
|
||||||
|
private final String apiBaseUri;
|
||||||
|
private final String adminBaseUri;
|
||||||
|
|
||||||
|
public InterfaceApiFilter(String apiBaseUri, String adminBaseUri) {
|
||||||
|
this.apiBaseUri = apiBaseUri;
|
||||||
|
this.adminBaseUri = adminBaseUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(InvokerConfig config) {
|
||||||
|
config.getAppContext().justInject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object doInvoke(Invoker invoker, InvokerChain chain) throws Throwable {
|
||||||
|
HttpServletRequest httpRequest = invoker.getHttpRequest();
|
||||||
|
String requestURI = invoker.getRequestPath();
|
||||||
|
String httpMethod = httpRequest.getMethod().toUpperCase().trim();
|
||||||
|
if (!requestURI.startsWith(this.apiBaseUri)) {
|
||||||
|
return chain.doNext(invoker);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// .Skip ui url
|
||||||
|
if (StringUtils.isNotBlank(this.adminBaseUri)) {
|
||||||
|
if (requestURI.startsWith(this.adminBaseUri)) {
|
||||||
|
return chain.doNext(invoker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
DatawayUtils.resetLocalTime();
|
||||||
|
String mimeType = invoker.getMimeType("json");
|
||||||
|
//
|
||||||
|
// .查询接口数据
|
||||||
|
ApiInfo apiInfo = new ApiInfo();
|
||||||
|
apiInfo.setCallSource(CallSource.External);
|
||||||
|
String script = null;
|
||||||
|
try {
|
||||||
|
Map<FieldDef, String> object = this.dataAccessLayer.getObjectBy(EntityDef.RELEASE, FieldDef.PATH, requestURI);
|
||||||
|
if (object == null) {
|
||||||
|
throw new IllegalStateException("API is not published.");
|
||||||
|
}
|
||||||
|
ApiStatusEnum anEnum = ApiStatusEnum.typeOf(object.get(FieldDef.STATUS));
|
||||||
|
if (anEnum != ApiStatusEnum.Published) {
|
||||||
|
throw new IllegalStateException("API is not published.");
|
||||||
|
}
|
||||||
|
String apiMethod = object.get(FieldDef.METHOD);
|
||||||
|
if (!StringUtils.equalsIgnoreCase(httpMethod, apiMethod)) {
|
||||||
|
throw new IllegalStateException("request method are not allowed.");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
apiInfo.setReleaseID(object.get(FieldDef.ID));
|
||||||
|
apiInfo.setApiID(object.get(FieldDef.API_ID));
|
||||||
|
apiInfo.setMethod(object.get(FieldDef.METHOD));
|
||||||
|
apiInfo.setApiPath(object.get(FieldDef.PATH));
|
||||||
|
apiInfo.setOptionMap(JSON.parseObject(object.get(FieldDef.OPTION)));
|
||||||
|
setApiInfoObj(apiInfo,object);
|
||||||
|
script = object.get(FieldDef.SCRIPT);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Object result = DatawayUtils.exceptionToResult(e).getResult();
|
||||||
|
LoggerUtils loggerUtils = LoggerUtils.create() //
|
||||||
|
.addLog("httpMethod", httpMethod) //
|
||||||
|
.addLog("apiPath", requestURI) //
|
||||||
|
.addLog("result", result) //
|
||||||
|
.logException(e);
|
||||||
|
logger.error("requestFailed - " + loggerUtils.toJson(), e);
|
||||||
|
return DatawayUtils.responseData(this.spiTrigger, apiInfo, mimeType, invoker, result);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// .准备参数
|
||||||
|
Map<String, Object> jsonParam;
|
||||||
|
if ("GET".equalsIgnoreCase(httpMethod)) {
|
||||||
|
jsonParam = new HashMap<>();
|
||||||
|
Enumeration<String> parameterNames = httpRequest.getParameterNames();
|
||||||
|
while (parameterNames.hasMoreElements()) {
|
||||||
|
String paramName = parameterNames.nextElement();
|
||||||
|
jsonParam.put(paramName + "Arrays", httpRequest.getParameterValues(paramName));
|
||||||
|
jsonParam.put(paramName, httpRequest.getParameter(paramName));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String jsonBody = invoker.getJsonBodyString();
|
||||||
|
if (StringUtils.isNotBlank(jsonBody)) {
|
||||||
|
jsonParam = JSON.parseObject(jsonBody);
|
||||||
|
} else {
|
||||||
|
jsonParam = new HashMap<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apiInfo.setParameterMap(jsonParam);
|
||||||
|
//
|
||||||
|
// .配置跨域
|
||||||
|
this.crossDomainService.configureCross( apiInfo, invoker);
|
||||||
|
//
|
||||||
|
// .执行调用
|
||||||
|
String finalScript = script;
|
||||||
|
Object objectMap = this.callService.doCallWithoutError(apiInfo, param -> finalScript);
|
||||||
|
return DatawayUtils.responseData(this.spiTrigger, apiInfo, mimeType, invoker, objectMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setApiInfoObj(ApiInfo apiInfo, Map<FieldDef, String> object) {
|
||||||
|
try{
|
||||||
|
Method method=apiInfo.getClass().getMethod("setObj",Map.class);
|
||||||
|
method.invoke(apiInfo,object);
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
package net.hasor.dataway.spi;
|
||||||
|
|
||||||
|
import net.hasor.dataql.Hints;
|
||||||
|
import net.hasor.dataway.DatawayApi;
|
||||||
|
import net.hasor.dataway.dal.FieldDef;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ApiInfo implements DatawayApi{
|
||||||
|
|
||||||
|
private CallSource callSource;
|
||||||
|
private String apiID;
|
||||||
|
private String releaseID;
|
||||||
|
private String method;
|
||||||
|
private String apiPath;
|
||||||
|
private Map<String, Object> parameterMap;
|
||||||
|
private Map<String, Object> optionMap;
|
||||||
|
private Hints prepareHint;
|
||||||
|
|
||||||
|
public Map<FieldDef, String> getObj() {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObj(Map<FieldDef, String> obj) {
|
||||||
|
this.obj = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<FieldDef, String> obj;
|
||||||
|
|
||||||
|
public ApiInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
|
@Deprecated
|
||||||
|
public boolean isPerform() {
|
||||||
|
return CallSource.InterfaceUI == this.callSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CallSource getCallSource() {
|
||||||
|
return this.callSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallSource(CallSource callSource) {
|
||||||
|
this.callSource = callSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiID() {
|
||||||
|
return this.apiID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiID(String apiID) {
|
||||||
|
this.apiID = apiID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReleaseID() {
|
||||||
|
return this.releaseID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleaseID(String releaseID) {
|
||||||
|
this.releaseID = releaseID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return this.method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiPath() {
|
||||||
|
return this.apiPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiPath(String apiPath) {
|
||||||
|
this.apiPath = apiPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getParameterMap() {
|
||||||
|
return this.parameterMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParameterMap(Map<String, Object> parameterMap) {
|
||||||
|
this.parameterMap = parameterMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getOptionMap() {
|
||||||
|
return this.optionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionMap(Map<String, Object> optionMap) {
|
||||||
|
this.optionMap = optionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hints getPrepareHint() {
|
||||||
|
return this.prepareHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrepareHint(Hints prepareHint) {
|
||||||
|
this.prepareHint = prepareHint;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9208
|
port: 9208
|
||||||
|
servlet:
|
||||||
|
encoding:
|
||||||
|
enabled: true
|
||||||
|
charset: UTF-8
|
||||||
|
force: true
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
@ -15,8 +20,10 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: @discovery.server-addr@
|
server-addr: @discovery.server-addr@
|
||||||
|
# 工作空间配置
|
||||||
|
namespace: a113aa27-4d61-46e0-81d6-9cede0457f0d
|
||||||
# 服务分组
|
# 服务分组
|
||||||
group: JiangYuQi
|
#group: lijun
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: @discovery.server-addr@
|
server-addr: @discovery.server-addr@
|
||||||
|
@ -32,3 +39,14 @@ logging:
|
||||||
|
|
||||||
bim:
|
bim:
|
||||||
dataPath: '/Users/mac/code/bimdata/'
|
dataPath: '/Users/mac/code/bimdata/'
|
||||||
|
|
||||||
|
#http://localhost:9208/interface-ui/
|
||||||
|
# 启用 Dataway 功能(默认不启用)
|
||||||
|
HASOR_DATAQL_DATAWAY: true
|
||||||
|
# 开启 ui 管理功能(注意生产环境必须要设置为 false,否则会造成严重的生产安全事故)
|
||||||
|
HASOR_DATAQL_DATAWAY_ADMIN: true
|
||||||
|
|
||||||
|
# (可选)API工作路径
|
||||||
|
HASOR_DATAQL_DATAWAY_API_URL: /api/
|
||||||
|
# (可选)ui 的工作路径,只有开启 ui 管理功能后才有效
|
||||||
|
HASOR_DATAQL_DATAWAY_UI_URL: /interface-ui/
|
|
@ -2,19 +2,16 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="所属公司" prop="comId" v-if="1 == 2">
|
<el-form-item label="所属公司" prop="comId" v-if="1 == 2">
|
||||||
<el-input v-model="queryParams.comId" placeholder="请输入所属公司" clearable @keyup.enter="handleQuery"/>
|
<el-input v-model="queryParams.comId" placeholder="请输入所属公司" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属项目" prop="projectId">
|
<el-form-item label="所属项目" prop="projectId">
|
||||||
<el-select :disabled="data.currentPrjId != ''" v-model="queryParams.projectId" placeholder="请选择所属项目" clearable style="width:192px;"
|
<el-select :disabled="data.currentPrjId != ''" v-model="queryParams.projectId" placeholder="请选择所属项目" clearable style="width:192px;" @change="handleQuery">
|
||||||
@change="handleQuery">
|
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id"></el-option>
|
||||||
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考勤厂商" prop="vendorsCode">
|
<el-form-item label="考勤厂商" prop="vendorsCode">
|
||||||
<el-select v-model="queryParams.vendorsCode" placeholder="请选择厂商" clearable @change="handleQuery" style="width:192px;">
|
<el-select v-model="queryParams.vendorsCode" placeholder="请选择厂商" clearable @change="handleQuery" style="width:192px;">
|
||||||
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value">
|
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="启停状态" prop="enabled">
|
<el-form-item label="启停状态" prop="enabled">
|
||||||
|
@ -31,8 +28,7 @@
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['manage:attendance_cfg:add']">新增</el-button>
|
||||||
v-hasPermi="['manage:attendance_cfg:add']">新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--
|
<!--
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
@ -60,9 +56,15 @@
|
||||||
<span style="color: var(--el-color-warning);">{{scope.row.vendorsName }}</span>
|
<span style="color: var(--el-color-warning);">{{scope.row.vendorsName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="实名制项目ID" align="center" prop="info.projectGuid" />
|
<el-table-column label="实名制项目ID" align="center" prop="info.projectGuid">
|
||||||
<el-table-column label="应用KEY" align="center" prop="info.AppKey" />
|
<template #default="scope">{{ scope.row.info.projectGuid||scope.row.info.appProjectId}}</template>
|
||||||
<el-table-column label="应用Secret" align="center" prop="info.AppSecret" />
|
</el-table-column>
|
||||||
|
<el-table-column label="应用KEY" align="center" prop="info.AppKey">
|
||||||
|
<template #default="scope">{{ scope.row.info.AppKey||scope.row.info.appId}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="应用Secret" align="center" prop="info.AppSecret">
|
||||||
|
<template #default="scope">{{ scope.row.info.AppSecret||scope.row.info.secret}}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="是否启用" align="center" prop="enabled">
|
<el-table-column label="是否启用" align="center" prop="enabled">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch v-model="scope.row.enabled" :active-value="1" @change="doUpdateRow(scope.row)" :inactive-value="0"></el-switch>
|
<el-switch v-model="scope.row.enabled" :active-value="1" @change="doUpdateRow(scope.row)" :inactive-value="0"></el-switch>
|
||||||
|
@ -76,33 +78,26 @@
|
||||||
<el-table-column label="添加用户" align="center" prop="createBy" />
|
<el-table-column label="添加用户" align="center" prop="createBy" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="240">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="240">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Football" @click="handleDeviceList(scope.row)"
|
<el-button link type="primary" v-if="scope.row.vendorsCode=='uni'" icon="Football" @click="handleDeviceList(scope.row)" v-hasPermi="['manage:attendance_cfg:edit']">设备列表</el-button>
|
||||||
v-hasPermi="['manage:attendance_cfg:edit']">设备列表</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:attendance_cfg:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:attendance_cfg:remove']">删除</el-button>
|
||||||
v-hasPermi="['manage:attendance_cfg:edit']">修改</el-button>
|
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['manage:attendance_cfg:remove']">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
||||||
|
|
||||||
<!-- 添加或修改考勤配置对话框 -->
|
<!-- 添加或修改考勤配置对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body :close-on-click-modal="false"
|
<el-dialog :title="title" v-model="open" width="800px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
:close-on-press-escape="false">
|
<el-form ref="attendance_cfgRef" :model="form" :rules="rules" label-width="100px" :key="data.formKey">
|
||||||
<el-form ref="attendance_cfgRef" :model="form" :rules="rules" label-width="100px">
|
|
||||||
<el-form-item label="所属项目" prop="projectId">
|
<el-form-item label="所属项目" prop="projectId">
|
||||||
<el-select :disabled="data.currentPrjId != ''||data.mode=='edit'" v-model="form.projectId" placeholder="请选择项目">
|
<el-select :disabled="data.currentPrjId != ''||data.mode=='edit'" v-model="form.projectId" placeholder="请选择项目">
|
||||||
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id">
|
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考勤厂商" prop="vendorsCode">
|
<el-form-item label="考勤厂商" prop="vendorsCode">
|
||||||
<el-select v-model="form.vendorsCode" placeholder="请选择厂商">
|
<el-select v-model="form.vendorsCode" placeholder="请选择厂商" @change="vendorsCodeChange">
|
||||||
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value">
|
<el-option v-for="dict in attendance_vendors" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="form.vendorsCode == 'uni'">
|
<template v-if="form.vendorsCode == 'uni'">
|
||||||
|
@ -116,9 +111,20 @@
|
||||||
<el-input v-model="form.projectGuid" placeholder="请输入内容" />
|
<el-input v-model="form.projectGuid" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="form.vendorsCode=='gld' || form.vendorsCode=='jgw'">
|
||||||
|
<el-form-item label="APPID" prop="appId">
|
||||||
|
<el-input v-model="form.appId" placeholder="请输AppId" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Secret" prop="secret">
|
||||||
|
<el-input v-model="form.secret" placeholder="请输Secret" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目ID" prop="appProjectId">
|
||||||
|
<el-input v-model="form.appProjectId" placeholder="请输项目ID" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
<el-form-item label="已启用" prop="enabled">
|
<el-form-item label="已启用" prop="enabled">
|
||||||
<el-switch v-model="form.enabled" :active-value="1" :inactive-value="0"/>
|
<el-switch v-model="form.enabled" :active-value="1" :inactive-value="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
@ -133,27 +139,34 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Attendance_cfg">
|
<script setup name="Attendance_cfg">
|
||||||
import { listAttendance_cfg, getAttendance_cfg, delAttendance_cfg, addAttendance_cfg, updateAttendance_cfg } from "@/api/manage/attendancecfg";
|
import {
|
||||||
import { findMyProjectList } from "@/api/publics";
|
listAttendance_cfg,
|
||||||
|
getAttendance_cfg,
|
||||||
|
delAttendance_cfg,
|
||||||
|
addAttendance_cfg,
|
||||||
|
updateAttendance_cfg,
|
||||||
|
} from '@/api/manage/attendancecfg'
|
||||||
|
import { findMyProjectList } from '@/api/publics'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import ubiDeviceDrawer from '../attendance_ubi_device/ubiDeviceDrawer.vue'
|
import ubiDeviceDrawer from '../attendance_ubi_device/ubiDeviceDrawer.vue'
|
||||||
|
import { reactive } from 'vue'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance()
|
||||||
const { attendance_vendors } = proxy.useDict('attendance_vendors');
|
const { attendance_vendors } = proxy.useDict('attendance_vendors')
|
||||||
|
|
||||||
|
const attendance_cfgList = ref([])
|
||||||
const attendance_cfgList = ref([]);
|
const open = ref(false)
|
||||||
const open = ref(false);
|
const loading = ref(true)
|
||||||
const loading = ref(true);
|
const showSearch = ref(true)
|
||||||
const showSearch = ref(true);
|
const ids = ref([])
|
||||||
const ids = ref([]);
|
const single = ref(true)
|
||||||
const single = ref(true);
|
const multiple = ref(true)
|
||||||
const multiple = ref(true);
|
const total = ref(0)
|
||||||
const total = ref(0);
|
const title = ref('')
|
||||||
const title = ref("");
|
const deviceDrawer = ref()
|
||||||
const deviceDrawer=ref();
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
|
formKey: 0,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -165,58 +178,98 @@ const data = reactive({
|
||||||
state: null,
|
state: null,
|
||||||
isDel: null,
|
isDel: null,
|
||||||
},
|
},
|
||||||
rules: {
|
|
||||||
projectId: [{ required: true, trigger: ['blur', 'change'], message: "请选择所属项目" }],
|
|
||||||
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: "请选择考勤厂商" }],
|
|
||||||
AppKey: [{ required: true, trigger: ['blur', 'change'], message: "请输入应用KEY" }],
|
|
||||||
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: "请输入应用Secret" }],
|
|
||||||
projectGuid: [{ required: true, trigger: ['blur', 'change'], message: "请输入项目Guid" }],
|
|
||||||
},
|
|
||||||
projects: [],
|
projects: [],
|
||||||
currentPrjId: '',
|
currentPrjId: '',
|
||||||
mode:'',
|
mode: '',
|
||||||
});
|
})
|
||||||
|
let rules = reactive({
|
||||||
|
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
||||||
|
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
||||||
|
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
||||||
|
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
||||||
|
projectGuid: [{ required: true, trigger: ['blur', 'change'], message: '请输入项目Guid' }],
|
||||||
|
})
|
||||||
|
const { queryParams, form } = toRefs(data)
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
function vendorsCodeChange() {
|
||||||
|
data.formKey++
|
||||||
function doUpdateRow(row){
|
if (form.value.vendorsCode == 'uni') {
|
||||||
updateAttendance_cfg(row).then(d=>{
|
rules = {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
projectId: [{ required: true, trigger: ['blur', 'change'], message: '请选择所属项目' }],
|
||||||
});
|
vendorsCode: [{ required: true, trigger: ['blur', 'change'], message: '请选择考勤厂商' }],
|
||||||
|
AppKey: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用KEY' }],
|
||||||
|
AppSecret: [{ required: true, trigger: ['blur', 'change'], message: '请输入应用Secret' }],
|
||||||
|
projectGuid: [{ required: true, trigger: ['blur', 'change'], message: '请输入项目Guid' }],
|
||||||
|
}
|
||||||
|
} else if (form.value.vendorsCode == 'jgw') {
|
||||||
|
rules = {
|
||||||
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
appProjectId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
enabled: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
phone: [{ required: true, trigger: 'blur', message: '输入' }],
|
||||||
|
}
|
||||||
|
} else if (form.value.vendorsCode == 'gld') {
|
||||||
|
rules = {
|
||||||
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
appProjectId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
enabled: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rules = {
|
||||||
|
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
appProjectId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
appTenantId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||||
|
enabled: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function doUpdateRow(row) {
|
||||||
|
updateAttendance_cfg(row).then((d) => {
|
||||||
|
proxy.$modal.msgSuccess('修改成功')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**设备列表 */
|
/**设备列表 */
|
||||||
function handleDeviceList(row){
|
function handleDeviceList(row) {
|
||||||
deviceDrawer.value.showDrawer(row);
|
deviceDrawer.value.showDrawer(row)
|
||||||
}
|
}
|
||||||
/** 查询项目列表 */
|
/** 查询项目列表 */
|
||||||
function getProjectList() {
|
function getProjectList() {
|
||||||
findMyProjectList({ pageNum: 1, pageSize: 100 }).then(response => {
|
findMyProjectList({ pageNum: 1, pageSize: 100 }).then((response) => {
|
||||||
data.projects = response.rows;
|
data.projects = response.rows
|
||||||
if (userStore.currentPrjId) {
|
if (userStore.currentPrjId) {
|
||||||
queryParams.value.projectId = userStore.currentPrjId
|
queryParams.value.projectId = userStore.currentPrjId
|
||||||
data.currentPrjId = userStore.currentPrjId;
|
data.currentPrjId = userStore.currentPrjId
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询考勤配置列表 */
|
/** 查询考勤配置列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true
|
||||||
listAttendance_cfg(queryParams.value).then(response => {
|
listAttendance_cfg(queryParams.value).then((response) => {
|
||||||
attendance_cfgList.value = (response.rows||[]).map(it=>{
|
attendance_cfgList.value = (response.rows || []).map((it) => {
|
||||||
it.info=proxy.$tryToJson(it.vendorsParameter);
|
it.info = proxy.$tryToJson(it.vendorsParameter)
|
||||||
return it;
|
return it
|
||||||
});
|
})
|
||||||
total.value = response.total;
|
total.value = response.total
|
||||||
loading.value = false;
|
loading.value = false
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false;
|
open.value = false
|
||||||
reset();
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
// 表单重置
|
||||||
|
@ -237,101 +290,132 @@ function reset() {
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null
|
updateTime: null,
|
||||||
};
|
}
|
||||||
proxy.resetForm("attendance_cfgRef");
|
proxy.resetForm('attendance_cfgRef')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1
|
||||||
getList();
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
proxy.resetForm("queryRef");
|
proxy.resetForm('queryRef')
|
||||||
handleQuery();
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id)
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
data.mode="add"
|
data.mode = 'add'
|
||||||
reset();
|
reset()
|
||||||
open.value = true;
|
open.value = true
|
||||||
title.value = "添加考勤配置";
|
title.value = '添加考勤配置'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
data.mode="edit"
|
data.mode = 'edit'
|
||||||
reset();
|
reset()
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getAttendance_cfg(_id).then(response => {
|
getAttendance_cfg(_id).then((response) => {
|
||||||
let obj=response.data;
|
let obj = response.data
|
||||||
let info=proxy.$tryToJson(obj.vendorsParameter||"{}");
|
let info = proxy.$tryToJson(obj.vendorsParameter || '{}')
|
||||||
form.value =obj;
|
form.value = obj
|
||||||
form.value.AppKey=info.AppKey;
|
if (form.value.vendorsCode == 'uni') {
|
||||||
form.value.AppSecret=info.AppSecret;
|
form.value.AppKey = info.AppKey
|
||||||
form.value.projectGuid=info.projectGuid;
|
form.value.AppSecret = info.AppSecret
|
||||||
open.value = true;
|
form.value.projectGuid = info.projectGuid
|
||||||
title.value = "修改考勤配置";
|
} else {
|
||||||
});
|
form.value.appId = info.appId
|
||||||
|
form.value.secret = info.secret
|
||||||
|
form.value.appProjectId = info.appProjectId
|
||||||
|
form.value.tenantId = info.tenantId
|
||||||
|
form.value.phone = info.phone
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.projectId = obj.projectId
|
||||||
|
}, 800)
|
||||||
|
open.value = true
|
||||||
|
title.value = '修改考勤配置'
|
||||||
|
vendorsCodeChange()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["attendance_cfgRef"].validate(valid => {
|
proxy.$refs['attendance_cfgRef'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let objs=data.projects.filter(d=>d.id==form.value.projectId);
|
let objs = data.projects.filter((d) => d.id == form.value.projectId)
|
||||||
form.value.comId=objs.length>0?objs[0].comId:userStore.currentComId;
|
form.value.comId = objs.length > 0 ? objs[0].comId : userStore.currentComId
|
||||||
|
if (form.value.vendorsCode == 'uni') {
|
||||||
form.value.vendorsParameter = JSON.stringify({
|
form.value.vendorsParameter = JSON.stringify({
|
||||||
AppKey: form.value.AppKey,
|
AppKey: form.value.AppKey,
|
||||||
AppSecret: form.value.AppSecret,
|
AppSecret: form.value.AppSecret,
|
||||||
projectGuid: form.value.projectGuid,
|
projectGuid: form.value.projectGuid,
|
||||||
})
|
})
|
||||||
form.value.enabled = form.value.enabled;
|
|
||||||
if (form.value.id != null) {
|
|
||||||
updateAttendance_cfg(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
|
||||||
open.value = false;
|
|
||||||
getList();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
addAttendance_cfg(form.value).then(response => {
|
let params = {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
appId: form.value.appId,
|
||||||
open.value = false;
|
secret: form.value.secret,
|
||||||
getList();
|
appProjectId: form.value.appProjectId,
|
||||||
});
|
tenantId: form.value.appTenantId,
|
||||||
|
phone: form.value.phone,
|
||||||
|
}
|
||||||
|
form.value.vendorsParameter = JSON.stringify(params)
|
||||||
|
}
|
||||||
|
form.value.enabled = form.value.enabled
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateAttendance_cfg(form.value).then((response) => {
|
||||||
|
proxy.$modal.msgSuccess('修改成功')
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addAttendance_cfg(form.value).then((response) => {
|
||||||
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value;
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除考勤配置编号为"' + _ids + '"的数据项?').then(function () {
|
proxy.$modal
|
||||||
return delAttendance_cfg(_ids);
|
.confirm('是否确认删除考勤配置编号为"' + _ids + '"的数据项?')
|
||||||
}).then(() => {
|
.then(function () {
|
||||||
getList();
|
return delAttendance_cfg(_ids)
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
})
|
||||||
}).catch(() => { });
|
.then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('manage/attendance_cfg/export', {
|
proxy.download(
|
||||||
...queryParams.value
|
'manage/attendance_cfg/export',
|
||||||
}, `attendance_cfg_${new Date().getTime()}.xlsx`)
|
{
|
||||||
|
...queryParams.value,
|
||||||
|
},
|
||||||
|
`attendance_cfg_${new Date().getTime()}.xlsx`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
getProjectList();
|
getProjectList()
|
||||||
getList();
|
getList()
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue