This commit is contained in:
Paidax
2024-07-24 15:10:07 +08:00
parent e2f6a9f4b1
commit 020b6c48ed
79 changed files with 7733 additions and 3760 deletions
@@ -28,7 +28,7 @@ import javax.servlet.http.HttpSession;
public class LoginUtil { public class LoginUtil {
public enum LoginOrigin { public enum LoginOrigin {
APP, WEB, WEB_H5, CAS, QI_YE_WEI_XIN, WEI_XIN; APP, WEB, WEB_H5, CAS, QI_YE_WEI_XIN, WEI_XIN, SMS_CODE;
} }
@Inject @Inject
@@ -23,7 +23,9 @@ import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author zxy * @author zxy
@@ -265,4 +267,5 @@ public class MsgApi {
return access_token; return access_token;
} }
} }
@@ -1,5 +1,7 @@
package io.v.nutz.base.utils; package io.v.nutz.base.utils;
import io.v.nutz.zhgh.msgNotify.models.Orm_Msg;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
@@ -9,7 +11,11 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.Mvcs;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@@ -22,6 +28,7 @@ import java.util.List;
* Created by wizzer on 2017/5/24. * Created by wizzer on 2017/5/24.
*/ */
@IocBean @IocBean
@Slf4j
public class RCSCloudAPI { public class RCSCloudAPI {
/** /**
* 账号 * 账号
@@ -50,10 +57,29 @@ public class RCSCloudAPI {
* *
* String * String
*/ */
public static String sendTplSms(String tplId,String mobile,String content,String extno){ public static String sendTplSms(String tplId, String mobile, String content, String extno, Orm_Msg orm_msg) {
/* DefaultHttpClient httpclient = new DefaultHttpClient(); String tplJson = queryTplById(tplId);
NutMap tplJsonMap = Json.fromJson(NutMap.class, tplJson);
NutMap tplContentMap = tplJsonMap.getAs("tpl", NutMap.class);
String tplContent = tplContentMap.getString("content");
DefaultHttpClient httpclient = new DefaultHttpClient();
String resultJson = ""; String resultJson = "";
try { try {
String[] contentSplit = content.split("\\|\\|");
for (int i = 0; i < contentSplit.length; i++) {
String s = "@" + (i + 1) + "@=";
String replace = contentSplit[i].replace(s, "");
System.out.println(replace);
tplContent = tplContent.replace("@" + (i + 1) + "@", replace);
}
if (!"暂无".equals(orm_msg.getMsgCode())){
orm_msg.setContent(tplContent);
Dao dao = Mvcs.getIoc().get(Dao.class);
dao.insert(orm_msg);
}
//签名:Md5(sid+key+tplid+mobile+content) //签名:Md5(sid+key+tplid+mobile+content)
StringBuilder signStr = new StringBuilder(); StringBuilder signStr = new StringBuilder();
signStr.append(ACCOUNT_SID).append(ACCOUNT_APIKEY).append(tplId).append(mobile).append(content); signStr.append(ACCOUNT_SID).append(ACCOUNT_APIKEY).append(tplId).append(mobile).append(content);
@@ -62,7 +88,7 @@ public class RCSCloudAPI {
String sign = md5Digest(changeCharset(signStr.toString(), "utf-8")); String sign = md5Digest(changeCharset(signStr.toString(), "utf-8"));
//String sign = md5Digest(changeCharset(signStr.toString(), "GB2312")); //String sign = md5Digest(changeCharset(signStr.toString(), "GB2312"));
//创建HttpPost请求 //创建HttpPost请求
HttpPost httppost = new HttpPost(HttpUrl +"/sms/sendtplsms.json");//?sid="+ACCOUNT_SID+"&sign="+sign HttpPost httppost = new HttpPost(HttpUrl + "/sms/sendtplsms.json");//?sid="+ACCOUNT_SID+"&sign="+sign
//构建form //构建form
List<NameValuePair> nvps = new ArrayList<NameValuePair>(); List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("sid", ACCOUNT_SID)); nvps.add(new BasicNameValuePair("sid", ACCOUNT_SID));
@@ -71,7 +97,7 @@ public class RCSCloudAPI {
nvps.add(new BasicNameValuePair("mobile", mobile)); nvps.add(new BasicNameValuePair("mobile", mobile));
nvps.add(new BasicNameValuePair("content", content)); nvps.add(new BasicNameValuePair("content", content));
nvps.add(new BasicNameValuePair("extno", extno)); nvps.add(new BasicNameValuePair("extno", extno));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nvps,CHARSET_UTF8); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nvps, CHARSET_UTF8);
httppost.setEntity(entity); httppost.setEntity(entity);
//设置请求表头信息,POST请求必须采用application/x-www-form-urlencoded否则提示415错误 //设置请求表头信息,POST请求必须采用application/x-www-form-urlencoded否则提示415错误
@@ -79,27 +105,29 @@ public class RCSCloudAPI {
httppost.setHeader("Content-Encoding", CHARSET_UTF8); httppost.setHeader("Content-Encoding", CHARSET_UTF8);
//执行请求 //执行请求
HttpResponse response = httpclient.execute(httppost); HttpResponse response = httpclient.execute(httppost);
//获取响应Entity //获取响应Entity
HttpEntity httpEntity = response.getEntity(); HttpEntity httpEntity = response.getEntity();
//返回JSON字符串格式,用户根据实际业务进行解析处理 //返回JSON字符串格式,用户根据实际业务进行解析处理
if (httpEntity != null) if (httpEntity != null) {
resultJson = EntityUtils.toString(httpEntity, CHARSET_UTF8); resultJson = EntityUtils.toString(httpEntity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" +resultJson); log.info(resultJson);
return resultJson;*/ log.info("手机号="+mobile);
return ""; log.info("发送成功==================");
return resultJson;
} }
/** /**
@@ -121,16 +149,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -154,16 +184,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -187,16 +219,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -220,8 +254,9 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
@@ -229,8 +264,9 @@ public class RCSCloudAPI {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -256,16 +292,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -293,16 +331,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -329,16 +369,18 @@ public class RCSCloudAPI {
HttpGet httpget = new HttpGet(url.toString()); HttpGet httpget = new HttpGet(url.toString());
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) if (entity != null) {
resultJson = EntityUtils.toString(entity, CHARSET_UTF8); resultJson = EntityUtils.toString(entity, CHARSET_UTF8);
}
EntityUtils.consume(entity); EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (httpclient != null) if (httpclient != null) {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
}
} }
System.out.println("resultJson=" + resultJson); System.out.println("resultJson=" + resultJson);
return resultJson; return resultJson;
@@ -363,8 +405,9 @@ public class RCSCloudAPI {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < b.length; ++i) { for (int i = 0; i < b.length; ++i) {
String s = Integer.toHexString(b[i] & 0xFF); String s = Integer.toHexString(b[i] & 0xFF);
if (s.length() == 1) if (s.length() == 1) {
sb.append("0"); sb.append("0");
}
sb.append(s.toUpperCase()); sb.append(s.toUpperCase());
} }
return sb.toString(); return sb.toString();
@@ -12,13 +12,16 @@ import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUnitService; import io.v.nutz.sys.services.SysUnitService;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals; import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.captcha.services.CaptchaService;
import io.v.nutz.web.commons.exception.CaptchaException; import io.v.nutz.web.commons.exception.CaptchaException;
import io.v.nutz.web.commons.exception.SmsException;
import io.v.nutz.web.commons.ext.validate.ValidateService; import io.v.nutz.web.commons.ext.validate.ValidateService;
import io.v.nutz.web.commons.shiro.exception.CaptchaEmptyException; import io.v.nutz.web.commons.shiro.exception.CaptchaEmptyException;
import io.v.nutz.web.commons.shiro.exception.CaptchaIncorrectException; import io.v.nutz.web.commons.shiro.exception.CaptchaIncorrectException;
import io.v.nutz.web.commons.shiro.filter.PlatformAuthenticationFilter; import io.v.nutz.web.commons.shiro.filter.PlatformAuthenticationFilter;
import io.v.nutz.web.commons.slog.SLogService; import io.v.nutz.web.commons.slog.SLogService;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*; import org.apache.shiro.authc.*;
@@ -73,6 +76,8 @@ public class SysLoginController {
private ValidateService validateService; private ValidateService validateService;
@Inject @Inject
private LoginUtil loginUtil; private LoginUtil loginUtil;
@Inject
private CaptchaService captchaService;
@At("") @At("")
@@ -157,6 +162,20 @@ public class SysLoginController {
} }
@At
public Object validVerify(String nonceStr, String value) {
if(StringUtils.isBlank(nonceStr) || StringUtils.isBlank(value)) {
return cn.wizzer.framework.base.Result.error("验证字符信息不能为空!");
}
String s = captchaService.checkImageCode(nonceStr, value);
if(StringUtils.isNotBlank(s)) {
return cn.wizzer.framework.base.Result.error(s);
}
return cn.wizzer.framework.base.Result.success();
}
/** /**
* 登陆验证 * 登陆验证
* *
@@ -167,10 +186,14 @@ public class SysLoginController {
@At("/doLogin") @At("/doLogin")
@Ok("json") @Ok("json")
@Filters(@By(type = PlatformAuthenticationFilter.class)) @Filters(@By(type = PlatformAuthenticationFilter.class))
public Object doLogin(@Attr("platformLoginToken") AuthenticationToken token, HttpServletRequest req, HttpSession session) { public Object doLogin(@Attr("platformLoginToken") AuthenticationToken token,String loginType, HttpServletRequest req, HttpSession session) {
int errCount = NumberUtils.toInt(Strings.sNull(SecurityUtils.getSubject().getSession(true).getAttribute("platformErrCount"))); int errCount = NumberUtils.toInt(Strings.sNull(SecurityUtils.getSubject().getSession(true).getAttribute("platformErrCount")));
try { try {
loginUtil.doLogin(token, req, session, LoginUtil.LoginOrigin.WEB); if ("SMS_CODE".equals(loginType)){
loginUtil.doLogin(token, req, session, LoginUtil.LoginOrigin.SMS_CODE);
} else {
loginUtil.doLogin(token, req, session, LoginUtil.LoginOrigin.WEB);
}
return Result.success("login.success"); return Result.success("login.success");
} catch (CaptchaIncorrectException e) { } catch (CaptchaIncorrectException e) {
return Result.error(1, "login.error.captcha"); return Result.error(1, "login.error.captcha");
@@ -185,7 +208,7 @@ public class SysLoginController {
} catch (AuthenticationException e) { } catch (AuthenticationException e) {
errCount++; errCount++;
SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount); SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount);
return Result.error(5, "login.error.user"); return Result.error(5, e.getMessage());
} catch (Exception e) { } catch (Exception e) {
errCount++; errCount++;
SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount); SecurityUtils.getSubject().getSession(true).setAttribute("platformErrCount", errCount);
@@ -193,6 +216,7 @@ public class SysLoginController {
} }
} }
/** /**
* 退出系统 * 退出系统
*/ */
@@ -241,6 +265,28 @@ public class SysLoginController {
return Result.success(validateService.getCode()); return Result.success(validateService.getCode());
} }
@At("/mobileCaptcha")
@Ok("json")
public Object mobileLoginSmsCode(String mobile) {
try {
return Result.success(validateService.getSMSCode(mobile));
} catch (SmsException e) {
return Result.error(e.getMessage());
}
}
@At
@Ok("json")
public Object validMobile(String mobile) {
if(StringUtils.isBlank(mobile)) {
return Result.error("手机号不能为空!");
}
int mobileCount = sysUserService.count(Cnd.where("mobile", "=", mobile));
return mobileCount <= 0 ? Result.error("手机号不存在") : Result.success();
}
@At("/doReg") @At("/doReg")
@Ok("json") @Ok("json")
public Object doReg(@Param("mobile") String mobile, @Param("password") String password, @Param("code") String code, HttpServletRequest req) { public Object doReg(@Param("mobile") String mobile, @Param("password") String password, @Param("code") String code, HttpServletRequest req) {
@@ -264,12 +310,14 @@ public class SysLoginController {
user.setMenuTheme("left"); user.setMenuTheme("left");
user.setCreatedBy(ShiroUtil.getPlatformUid()); user.setCreatedBy(ShiroUtil.getPlatformUid());
Sys_unit unit = sysUnitService.fetch(Cnd.where("unitcode", "=", Globals.MyConfig.getString("AppDefaultUserUnit"))); Sys_unit unit = sysUnitService.fetch(Cnd.where("unitcode", "=", Globals.MyConfig.getString("AppDefaultUserUnit")));
if (unit != null) if (unit != null) {
user.setUnitid(unit.getId()); user.setUnitid(unit.getId());
}
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", Globals.MyConfig.getString("AppDefaultUserRole"))); Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", Globals.MyConfig.getString("AppDefaultUserRole")));
sysUserService.insert(user); sysUserService.insert(user);
if (role != null) if (role != null) {
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", user.getId())); sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", user.getId()));
}
sysUserService.clearCache(); sysUserService.clearCache();
return Result.success(); return Result.success();
} catch (CaptchaException e) { } catch (CaptchaException e) {
@@ -323,7 +323,7 @@ public class Sys_user extends BaseModel implements Serializable {
private String hobby; private String hobby;
@Column @Column
@Comment("婚否") @Comment("婚姻状况")
@ColDefine(type = ColType.VARCHAR, width = 10) @ColDefine(type = ColType.VARCHAR, width = 10)
private String marriage; private String marriage;
@@ -394,9 +394,17 @@ public class Sys_user extends BaseModel implements Serializable {
@Data @Data
public static class Family implements Serializable { public static class Family implements Serializable {
//与本人关系
private String relation; private String relation;
//姓名
private String name; private String name;
//是否慰问
private String isCondolence;
//慰问时间
private String condolenceTime;
//单位
private String unit; private String unit;
//备注
private String remark; private String remark;
} }
@@ -661,6 +669,11 @@ public class Sys_user extends BaseModel implements Serializable {
@ColDefine(type = ColType.DATE) @ColDefine(type = ColType.DATE)
private String workDate; private String workDate;
@Column
@Comment("起薪日期")
@ColDefine(type = ColType.DATE)
private Date startSalaryDate;
/** /**
* 前端菜单 * 前端菜单
*/ */
@@ -1,108 +0,0 @@
package io.v.nutz.task.job.asset;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @version 1.0
* @Author zzr
* @name:AssetScrapJob
* @Date 2024/6/12 17:44
* @注释
*/
@IocBean
public class AssetScrapJob implements Job {
@Inject
private BaseService baseService;
@Override
@Aop(TransAop.READ_COMMITTED)
public void execute(JobExecutionContext context) throws JobExecutionException {
Sql sql = Sqls.create("""
SELECT
xx.*,
lb.categoryName AS assetStatusName,
CASE
WHEN TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()) < 1 THEN '不足1月'
ELSE CONCAT(TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()),'年',
TIMESTAMPDIFF(MONTH, xx.storageDate + INTERVAL TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()) YEAR, CURDATE()),'月')
END AS yearsAndMonths
FROM
`zgfw_zcxx` xx
LEFT JOIN zgfw_zclb lb ON xx.assetStatus = lb.contentCode
$condition
""");
Cnd cnd = Cnd.NEW();
SqlExpressionGroup seg = new SqlExpressionGroup();
//工会在用
seg.or(new Static("JSON_CONTAINS(xx.assetStatus, CAST('\"%s\"' AS JSON), '$')".formatted("1001")));
//异地在用
seg.or(new Static("JSON_CONTAINS(xx.assetStatus, CAST('\"%s\"' AS JSON), '$')".formatted("1002")));
cnd.and(seg);
sql.setCondition(cnd);
List<NutMap> list = baseService.listMap(sql);
List<Zgfw_Zcxx> zcList = new ArrayList<>();
list.forEach(v->{
if (StrUtil.isBlank(v.getString("minimumUsageYear")) && StrUtil.isBlank(v.getString("yearsAndMonths"))) {
return;
}
String minimumUsageYear = v.getString("minimumUsageYear");
String yearsAndMonths = v.getString("yearsAndMonths");
boolean yearsAndMonthsExceeded = isYearsAndMonthsExceeded(minimumUsageYear, yearsAndMonths);
if (yearsAndMonthsExceeded){
Zgfw_Zcxx zgfwZcxx = new Zgfw_Zcxx();
String assetStatus = v.getString("assetStatus");
List<String> assetList = JSONUtil.parseArray(assetStatus).toList(String.class);
assetList.add("1003");
zgfwZcxx.setId(v.getString("id"));
zgfwZcxx.setAssetStatus(assetList);
zcList.add(zgfwZcxx);
}
});
baseService.dao().updateIgnoreNull(zcList);
}
public boolean isYearsAndMonthsExceeded(String minimumUsageYear, String yearsAndMonths) {
// 提取yearsAndMonths中的年份部分
String yearPart = yearsAndMonths.split("年")[0];
// 将提取的年份转换为整数
int year = Integer.parseInt(yearPart);
// 将minimumUsageYear转换为整数
int minimumYear = Integer.parseInt(minimumUsageYear);
// 比较年份
return year > minimumYear;
}
}
@@ -0,0 +1,24 @@
package io.v.nutz.web.commons.captcha;
import cn.wizzer.framework.base.Result;
import io.v.nutz.web.commons.captcha.models.Captcha;
import io.v.nutz.web.commons.captcha.services.CaptchaService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@At("/captcha")
@Ok("json:full")
@IocBean
public class CaptchaController {
@Inject
private CaptchaService captchaService;
@At("/get-captcha")
public Object getCaptcha(Captcha captcha) {
captcha.setPlace(1);
return Result.success(captchaService.getCaptcha(captcha));
}
}
@@ -0,0 +1,151 @@
package io.v.nutz.web.commons.captcha.models;
import java.io.Serializable;
public class Captcha implements Serializable {
/**
* 随机字符串
**/
private String nonceStr;
/**
* 验证值
**/
private String value;
/**
* 生成的画布的base64
**/
private String canvasSrc;
/**
* 画布宽度
**/
private Integer canvasWidth;
/**
* 画布高度
**/
private Integer canvasHeight;
/**
* 生成的阻塞块的base64
**/
private String blockSrc;
/**
* 阻塞块宽度
**/
private Integer blockWidth;
/**
* 阻塞块高度
**/
private Integer blockHeight;
/**
* 阻塞块凸凹半径
**/
private Integer blockRadius;
/**
* 阻塞块的横轴坐标
**/
private Integer blockX;
/**
* 阻塞块的纵轴坐标
**/
private Integer blockY;
/**
* 图片获取位置
**/
private Integer place;
public String getNonceStr() {
return nonceStr;
}
public void setNonceStr(String nonceStr) {
this.nonceStr = nonceStr;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getCanvasSrc() {
return canvasSrc;
}
public void setCanvasSrc(String canvasSrc) {
this.canvasSrc = canvasSrc;
}
public Integer getCanvasWidth() {
return canvasWidth;
}
public void setCanvasWidth(Integer canvasWidth) {
this.canvasWidth = canvasWidth;
}
public Integer getCanvasHeight() {
return canvasHeight;
}
public void setCanvasHeight(Integer canvasHeight) {
this.canvasHeight = canvasHeight;
}
public String getBlockSrc() {
return blockSrc;
}
public void setBlockSrc(String blockSrc) {
this.blockSrc = blockSrc;
}
public Integer getBlockWidth() {
return blockWidth;
}
public void setBlockWidth(Integer blockWidth) {
this.blockWidth = blockWidth;
}
public Integer getBlockHeight() {
return blockHeight;
}
public void setBlockHeight(Integer blockHeight) {
this.blockHeight = blockHeight;
}
public Integer getBlockRadius() {
return blockRadius;
}
public void setBlockRadius(Integer blockRadius) {
this.blockRadius = blockRadius;
}
public Integer getBlockX() {
return blockX;
}
public void setBlockX(Integer blockX) {
this.blockX = blockX;
}
public Integer getBlockY() {
return blockY;
}
public void setBlockY(Integer blockY) {
this.blockY = blockY;
}
public Integer getPlace() {
return place;
}
public void setPlace(Integer place) {
this.place = place;
}
}
@@ -0,0 +1,85 @@
package io.v.nutz.web.commons.captcha.services;
import io.v.nutz.web.commons.captcha.models.Captcha;
import io.v.nutz.web.commons.captcha.util.CaptchaUtils;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import java.awt.image.BufferedImage;
import java.util.UUID;
@IocBean
public class CaptchaService {
/**
* 拼图验证码允许偏差
**/
private static Integer ALLOW_DEVIATION = 3;
@Inject
private RedisService stringRedisTemplate;
/**
* 校验验证码
* @param imageKey
* @param imageCode
* @return boolean
**/
public String checkImageCode(String imageKey, String imageCode) {
String text = stringRedisTemplate.get("imageCode:" + imageKey);
if(Strings.isBlank(text)){
return "验证码已失效,请刷新";
}
// 根据移动距离判断验证是否成功
if (Math.abs(Integer.parseInt(text) - Integer.parseInt(imageCode)) > ALLOW_DEVIATION) {
return "验证失败,请控制拼图对齐缺口";
}
return null;
}
/**
* 缓存验证码,有效期15分钟
* @param key
* @param code
**/
public void saveImageCode(String key, String code) {
stringRedisTemplate.setex("imageCode:" + key, 60 * 15, code);
}
/**
* 获取验证码拼图(生成的抠图和带抠图阴影的大图及抠图坐标)
**/
public Object getCaptcha(Captcha captcha) {
//参数校验
CaptchaUtils.checkCaptcha(captcha);
//获取画布的宽高
int canvasWidth = captcha.getCanvasWidth();
int canvasHeight = captcha.getCanvasHeight();
//获取阻塞块的宽高/半径
int blockWidth = captcha.getBlockWidth();
int blockHeight = captcha.getBlockHeight();
int blockRadius = captcha.getBlockRadius();
//获取资源图
BufferedImage canvasImage = CaptchaUtils.getBufferedImage(captcha.getPlace());
//调整原图到指定大小
canvasImage = CaptchaUtils.imageResize(canvasImage, canvasWidth, canvasHeight);
//随机生成阻塞块坐标
int blockX = CaptchaUtils.getNonceByRange(blockWidth, canvasWidth - blockWidth - 10);
int blockY = CaptchaUtils.getNonceByRange(10, canvasHeight - blockHeight + 1);
//阻塞块
BufferedImage blockImage = new BufferedImage(blockWidth, blockHeight, BufferedImage.TYPE_4BYTE_ABGR);
//新建的图像根据轮廓图颜色赋值,源图生成遮罩
CaptchaUtils.cutByTemplate(canvasImage, blockImage, blockWidth, blockHeight, blockRadius, blockX, blockY);
// 移动横坐标
String nonceStr = UUID.randomUUID().toString().replaceAll("-", "");
// 缓存
saveImageCode(nonceStr,String.valueOf(blockX));
//设置返回参数
captcha.setNonceStr(nonceStr);
captcha.setBlockY(blockY);
captcha.setBlockSrc(CaptchaUtils.toBase64(blockImage, "png"));
captcha.setCanvasSrc(CaptchaUtils.toBase64(canvasImage, "png"));
return captcha;
}
}
@@ -0,0 +1,237 @@
package io.v.nutz.web.commons.captcha.util;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import io.v.nutz.web.commons.captcha.models.Captcha;
import org.apache.commons.lang3.RandomUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Base64;
import java.util.Objects;
import java.util.Random;
public class CaptchaUtils {
/**
* 网络图片地址
**/
private final static String IMG_URL = "https://loyer.wang/view/ftp/wallpaper/%s.jpg";
/**
* 本地图片地址
**/
private final static String IMG_PATH = "E:/wallpaper/%s.jpg";
/**
* 入参校验设置默认值
**/
public static void checkCaptcha(Captcha captcha) {
//设置画布宽度默认值
if (captcha.getCanvasWidth() == null) {
captcha.setCanvasWidth(320);
}
//设置画布高度默认值
if (captcha.getCanvasHeight() == null) {
captcha.setCanvasHeight(155);
}
//设置阻塞块宽度默认值
if (captcha.getBlockWidth() == null) {
captcha.setBlockWidth(65);
}
//设置阻塞块高度默认值
if (captcha.getBlockHeight() == null) {
captcha.setBlockHeight(55);
}
//设置阻塞块凹凸半径默认值
if (captcha.getBlockRadius() == null) {
captcha.setBlockRadius(9);
}
//设置图片来源默认值
if (captcha.getPlace() == null) {
captcha.setPlace(0);
}
}
/**
* 获取指定范围内的随机数
**/
public static int getNonceByRange(int start, int end) {
Random random = new Random();
return random.nextInt(end - start + 1) + start;
}
/**
* 获取验证码资源图
**/
public static BufferedImage getBufferedImage(Integer place) {
try {
// //随机图片
// int nonce = getNonceByRange(0, 6);
// nonce = 0;
// //获取网络资源图片
// if (0 == place) {
// String imgUrl = String.format(IMG_URL, getNonceByRange(0, 100));
// URL url = new URL(imgUrl);
// return ImageIO.read(url.openStream());
// }
// //获取本地图片
// else {
// String imgPath = String.format(IMG_PATH, nonce);
// File file = new File(imgPath);
// return ImageIO.read(file);
// }
String imgUrl = String.format(IMG_URL, getNonceByRange(0, 100));
// 创建HttpRequest对象
HttpRequest request = HttpRequest.get(imgUrl);
// 发送请求并获取响应
HttpResponse response = request.execute();
// 获取输入流
return ImageIO.read(response.bodyStream());
} catch (Exception e) {
System.out.println("获取拼图资源失败");
//异常处理
return null;
}
}
/**
* 调整图片大小
**/
public static BufferedImage imageResize(BufferedImage bufferedImage, int width, int height) {
Image image = bufferedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage resultImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics2D = resultImage.createGraphics();
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();
return resultImage;
}
/**
* 抠图,并生成阻塞块
**/
public static void cutByTemplate(BufferedImage canvasImage, BufferedImage blockImage, int blockWidth, int blockHeight, int blockRadius, int blockX, int blockY) {
BufferedImage waterImage = new BufferedImage(blockWidth, blockHeight, BufferedImage.TYPE_4BYTE_ABGR);
//阻塞块的轮廓图
int[][] blockData = getBlockData(blockWidth, blockHeight, blockRadius);
//创建阻塞块具体形状
for (int i = 0; i < blockWidth; i++) {
for (int j = 0; j < blockHeight; j++) {
try {
//原图中对应位置变色处理
if (blockData[i][j] == 1) {
//背景设置为黑色
waterImage.setRGB(i, j, Color.BLACK.getRGB());
blockImage.setRGB(i, j, canvasImage.getRGB(blockX + i, blockY + j));
//轮廓设置为白色,取带像素和无像素的界点,判断该点是不是临界轮廓点
if (blockData[i + 1][j] == 0 || blockData[i][j + 1] == 0 || blockData[i - 1][j] == 0 || blockData[i][j - 1] == 0) {
blockImage.setRGB(i, j, Color.WHITE.getRGB());
waterImage.setRGB(i, j, Color.WHITE.getRGB());
}
}
//这里把背景设为透明
else {
blockImage.setRGB(i, j, Color.TRANSLUCENT);
waterImage.setRGB(i, j, Color.TRANSLUCENT);
}
} catch (ArrayIndexOutOfBoundsException e) {
//防止数组下标越界异常
}
}
}
//在画布上添加阻塞块水印
addBlockWatermark(canvasImage, waterImage, blockX, blockY);
}
/**
* 构建拼图轮廓轨迹
**/
private static int[][] getBlockData(int blockWidth, int blockHeight, int blockRadius) {
int[][] data = new int[blockWidth][blockHeight];
double po = Math.pow(blockRadius, 2);
//随机生成两个圆的坐标,在4个方向上 随机找到2个方向添加凸/凹
//凸/凹1
int face1 = RandomUtils.nextInt(0,4);
//凸/凹2
int face2;
//保证两个凸/凹不在同一位置
do {
face2 = RandomUtils.nextInt(0,4);
} while (face1 == face2);
//获取凸/凹起位置坐标
int[] circle1 = getCircleCoords(face1, blockWidth, blockHeight, blockRadius);
int[] circle2 = getCircleCoords(face2, blockWidth, blockHeight, blockRadius);
//随机凸/凹类型
int shape = getNonceByRange(0, 1);
//圆的标准方程 (x-a)²+(y-b)²=r²,标识圆心(a,b),半径为r的圆
//计算需要的小图轮廓,用二维数组来表示,二维数组有两张值,0和1,其中0表示没有颜色,1有颜色
for (int i = 0; i < blockWidth; i++) {
for (int j = 0; j < blockHeight; j++) {
data[i][j] = 0;
//创建中间的方形区域
if ((i >= blockRadius && i <= blockWidth - blockRadius && j >= blockRadius && j <= blockHeight - blockRadius)) {
data[i][j] = 1;
}
double d1 = Math.pow(i - Objects.requireNonNull(circle1)[0], 2) + Math.pow(j - circle1[1], 2);
double d2 = Math.pow(i - Objects.requireNonNull(circle2)[0], 2) + Math.pow(j - circle2[1], 2);
//创建两个凸/凹
if (d1 <= po || d2 <= po) {
data[i][j] = shape;
}
}
}
return data;
}
/**
* 根据朝向获取圆心坐标
*/
private static int[] getCircleCoords(int face, int blockWidth, int blockHeight, int blockRadius) {
//上
if (0 == face) {
return new int[]{blockWidth / 2 - 1, blockRadius};
}
//左
else if (1 == face) {
return new int[]{blockRadius, blockHeight / 2 - 1};
}
//下
else if (2 == face) {
return new int[]{blockWidth / 2 - 1, blockHeight - blockRadius - 1};
}
//右
else if (3 == face) {
return new int[]{blockWidth - blockRadius - 1, blockHeight / 2 - 1};
}
return null;
}
/**
* 在画布上添加阻塞块水印
*/
private static void addBlockWatermark(BufferedImage canvasImage, BufferedImage blockImage, int x, int y) {
Graphics2D graphics2D = canvasImage.createGraphics();
graphics2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.8f));
graphics2D.drawImage(blockImage, x, y, null);
graphics2D.dispose();
}
/**
* BufferedImage转BASE64
*/
public static String toBase64(BufferedImage bufferedImage, String type) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, type, byteArrayOutputStream);
String base64 = Base64.getEncoder().encodeToString(byteArrayOutputStream.toByteArray());
return String.format("data:image/%s;base64,%s", type, base64);
} catch (Exception e) {
System.out.println("图片资源转换BASE64失败");
//异常处理
return null;
}
}
}
@@ -1,15 +1,20 @@
package io.v.nutz.web.commons.ext.validate; package io.v.nutz.web.commons.ext.validate;
import cn.hutool.core.date.DateUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.constant.RedisConstant; import io.v.nutz.base.constant.RedisConstant;
import io.v.nutz.base.utils.RCSCloudAPI;
import io.v.nutz.web.commons.exception.CaptchaException; import io.v.nutz.web.commons.exception.CaptchaException;
import io.v.nutz.web.commons.exception.SmsException; import io.v.nutz.web.commons.exception.SmsException;
import io.v.nutz.web.commons.ext.sms.SmsService; import io.v.nutz.web.commons.ext.sms.SmsService;
import com.wf.captcha.ArithmeticCaptcha; import com.wf.captcha.ArithmeticCaptcha;
import io.v.nutz.web.commons.shiro.exception.CaptchaEmptyException; import io.v.nutz.web.commons.shiro.exception.CaptchaEmptyException;
import io.v.nutz.web.commons.shiro.exception.CaptchaIncorrectException; import io.v.nutz.web.commons.shiro.exception.CaptchaIncorrectException;
import io.v.nutz.zhgh.msgNotify.models.Orm_Msg;
import org.nutz.integration.jedis.RedisService; import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.lang.random.R; import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
@@ -38,19 +43,31 @@ public class ValidateService {
return NutMap.NEW().addv("key", uuid).addv("codeUrl", captcha.toBase64()); return NutMap.NEW().addv("key", uuid).addv("codeUrl", captcha.toBase64());
} }
public void getSMSCode(String mobile) throws SmsException { public NutMap getSMSCode(String mobile) throws SmsException {
String text = R.captchaNumber(4); String text = R.captchaNumber(6);
String codeFromRedis = redisService.get(RedisConstant.REDIS_SMSCODE_KEY + mobile + ":LOCK"); String codeFromRedis = redisService.get(RedisConstant.REDIS_SMSCODE_KEY + mobile + ":LOCK");
if (Strings.isNotBlank(codeFromRedis)) { if (Strings.isNotBlank(codeFromRedis)) {
throw new SmsException("请1分钟之后再试"); throw new SmsException("请1分钟之后再试");
} }
if (smsService.sendCode(mobile, text)) { if (redisService.exists(RedisConstant.REDIS_SMSCODE_KEY + mobile)){
log.debug("sms code:::" + text); return NutMap.NEW().addv("key", RedisConstant.REDIS_SMSCODE_KEY + mobile);
redisService.setex(RedisConstant.REDIS_SMSCODE_KEY + mobile, 300, text);
redisService.setex(RedisConstant.REDIS_SMSCODE_KEY + mobile + ":LOCK", 60, text);
} }
Orm_Msg ormMsgJsr = new Orm_Msg();
ormMsgJsr.setMsgCode(DateUtil.current() + "-" + mobile);
ormMsgJsr.setMobile(mobile);
ormMsgJsr.setSendTime(DateUtil.now());
String result = RCSCloudAPI.sendTplSms("beb041c66b654817927fb4bfc4dc327a", mobile, "@1@=" + text, null, ormMsgJsr);
NutMap map = Json.fromJson(NutMap.class, result);
if ("0".equals(map.getString("code"))) {
log.debug("sms code:::" + text);
redisService.setex(RedisConstant.REDIS_SMSCODE_KEY + mobile, 43200, text);
redisService.setex(RedisConstant.REDIS_SMSCODE_KEY + mobile + ":LOCK", 60, text);
return NutMap.NEW().addv("key", RedisConstant.REDIS_SMSCODE_KEY + mobile);
}
throw new SmsException("发送验证码失败,请联系管理员或稍后重试");
} }
public void checkCode(String key, String code) { public void checkCode(String key, String code) {
@@ -69,7 +69,7 @@ public class NutShiroProcessor extends AbstractProcessor {
String[] authIgnoreUrlArr = Lang.array("/", String[] authIgnoreUrlArr = Lang.array("/",
"/sso/login", "/sso/login",
"/platform/login", "/platform/login",
"/platform/login(/doLogin|/logout|/captcha)", "/platform/login(/doLogin|/logout|/captcha|/mobileLoginSmsCode|/validMobile|/validVerify|/mobileCaptcha)",
"/platform/qywechat/.*", "/platform/qywechat/.*",
"/platform/home/(500|403|404|UnknownAccountError|LockedAccountError)", "/platform/home/(500|403|404|UnknownAccountError|LockedAccountError)",
"/mobile/login", "/mobile/login",
@@ -88,7 +88,8 @@ public class NutShiroProcessor extends AbstractProcessor {
"/platform/fitnessWalk/punchLottery/getPunchWining", "/platform/fitnessWalk/punchLottery/getPunchWining",
"/platform/fitnessWalk/punchLottery/doReadLottery", "/platform/fitnessWalk/punchLottery/doReadLottery",
"/platform/fitnessWalk/stepWining/prizeOption", "/platform/fitnessWalk/stepWining/prizeOption",
"/platform/fitnessWalk/stepWining/prizeUsers" "/platform/fitnessWalk/stepWining/prizeUsers",
"/captcha/get-captcha"
); );
if (Arrays.stream(authIgnoreUrlArr).noneMatch(v -> Pattern.compile(v).matcher(requestURI).matches())) { if (Arrays.stream(authIgnoreUrlArr).noneMatch(v -> Pattern.compile(v).matcher(requestURI).matches())) {
if (match) { if (match) {
@@ -35,9 +35,13 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
return true; return true;
} }
Object tokenHashedCredentials = hashProvidedCredentials(token, info); if (loginOrigin.equals(LoginUtil.LoginOrigin.SMS_CODE)) {
Object accountCredentials = getCredentials(info); return true;
return equals(tokenHashedCredentials, accountCredentials); } else {
Object tokenHashedCredentials = hashProvidedCredentials(token, info);
Object accountCredentials = getCredentials(info);
return equals(tokenHashedCredentials, accountCredentials);
}
} }
} }
@@ -8,6 +8,7 @@ import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysRoleService; import io.v.nutz.sys.services.SysRoleService;
import io.v.nutz.sys.services.SysUnionService; import io.v.nutz.sys.services.SysUnionService;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.exception.CaptchaException;
import io.v.nutz.web.commons.ext.validate.ValidateService; import io.v.nutz.web.commons.ext.validate.ValidateService;
import io.v.nutz.web.commons.shiro.config.EasyCredentialsMatch; import io.v.nutz.web.commons.shiro.config.EasyCredentialsMatch;
import io.v.nutz.web.commons.shiro.token.PlatformCaptchaToken; import io.v.nutz.web.commons.shiro.token.PlatformCaptchaToken;
@@ -73,15 +74,34 @@ public class PlatformAuthorizingRealm extends AuthorizingRealm {
Session session = SecurityUtils.getSubject().getSession(true); Session session = SecurityUtils.getSubject().getSession(true);
if (!loginOrigin.equals(LoginUtil.LoginOrigin.CAS) && !loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN)) { Sys_user user = new Sys_user();
if (loginOrigin.equals(LoginUtil.LoginOrigin.SMS_CODE)){
String mobile = "";
try {
int lastIndex = key.lastIndexOf(":");
// 截取最后一个冒号之后的部分作为手机号
mobile = lastIndex != -1 ? key.substring(lastIndex + 1) : null;
if (StrUtil.isBlank(mobile)){
throw Lang.makeThrow(AuthenticationException.class, "手机号不可为空");
}
try {
validateService.checkSMSCode(mobile, captcha);
} catch (CaptchaException e) {
throw Lang.makeThrow(AuthenticationException.class, e.getMessage());
}
} catch (NullPointerException e) {
throw Lang.makeThrow(AuthenticationException.class, "验证码失效,请重新获取");
}
user = sysUserService.fetch(Cnd.NEW().and("mobile", "=", mobile));
}else if (!loginOrigin.equals(LoginUtil.LoginOrigin.CAS) && !loginOrigin.equals(LoginUtil.LoginOrigin.QI_YE_WEI_XIN)) {
validateService.checkCode(key, captcha); validateService.checkCode(key, captcha);
if (Strings.isBlank(loginname)) {
throw Lang.makeThrow(AuthenticationException.class, "登录账号不可为空");
}
user = getUserService().fetch(Cnd.NEW().and("loginname", "=", loginname));
} }
if (Strings.isBlank(loginname)) {
throw Lang.makeThrow(AuthenticationException.class, "登录账号不可为空");
}
Sys_user user = getUserService().fetch(Cnd.NEW().and("loginname", "=", loginname));
if (Lang.isEmpty(user)) { if (Lang.isEmpty(user)) {
throw Lang.makeThrow(UnknownAccountException.class, "账号不存在", loginname); throw Lang.makeThrow(UnknownAccountException.class, "账号不存在", loginname);
@@ -137,8 +157,9 @@ public class PlatformAuthorizingRealm extends AuthorizingRealm {
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.addRoles(getUserService().getRoleCodeList(user)); info.addRoles(getUserService().getRoleCodeList(user));
for (Sys_role role : user.getRoles()) { for (Sys_role role : user.getRoles()) {
if (!role.isDisabled()) if (!role.isDisabled()) {
info.addStringPermissions(getRoleService().getPermissionNameList(role)); info.addStringPermissions(getRoleService().getPermissionNameList(role));
}
} }
return info; return info;
} else { } else {
@@ -13,6 +13,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
public class PlatformCaptchaToken extends UsernamePasswordToken { public class PlatformCaptchaToken extends UsernamePasswordToken {
private static final long serialVersionUID = 4676958151524148623L; private static final long serialVersionUID = 4676958151524148623L;
private String mobile;
private String captcha; private String captcha;
private String key; private String key;
private LoginUtil.LoginOrigin loginOrigin; private LoginUtil.LoginOrigin loginOrigin;
@@ -28,6 +29,11 @@ public class PlatformCaptchaToken extends UsernamePasswordToken {
this.captcha = captcha; this.captcha = captcha;
} }
public PlatformCaptchaToken(String username, String host, String key) {
super(username, "", false, host);
this.key = key;
}
/** /**
* cas免密登录 * cas免密登录
* *
@@ -165,9 +165,9 @@ public class ActivityRemindController {
public Object sendRemind(@Param(value = "phone", required = false) String phone, public Object sendRemind(@Param(value = "phone", required = false) String phone,
@Param(value = "unionname", required = false) String unionname) { @Param(value = "unionname", required = false) String unionname) {
String[] pe = phone.split(","); String[] pe = phone.split(",");
for (String p : pe) { /*for (String p : pe) {
RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", p, "@1@=" + unionname + "", ""); RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", p, "@1@=" + unionname + "", "");
} }*/
return null; return null;
} }
@@ -203,9 +203,9 @@ public class ActivityRemindController {
return v.getInt("num") <= 0 && v.getString("telephone") != null; return v.getInt("num") <= 0 && v.getString("telephone") != null;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
collect.forEach(v -> { /*collect.forEach(v -> {
RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", v.getString("telephone"), "@1@=" + v.getString("unionname") + "", ""); RCSCloudAPI.sendTplSms("399ac7a7901c49df9f5939d0f10d566b", v.getString("telephone"), "@1@=" + v.getString("unionname") + "", "");
}); });*/
return null; return null;
} }
@@ -73,11 +73,15 @@ public class MemberCommonController {
} }
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
u.*,unit.`name` unitname,un.unionname,unit.unionid u.*,unit.`name` unitname,un.unionname,unit.unionid,
su.registeredResidence,
su.homeAddress,
su.specialSkill
FROM FROM
$source u $source u
LEFT JOIN sys_unit unit ON u.unitid = unit.id LEFT JOIN sys_unit unit ON u.unitid = unit.id
left join sys_union un on unit.unionid = un.id left join sys_union un on unit.unionid = un.id
left join sys_user su on su.id = u.id
WHERE u.id = @id WHERE u.id = @id
""").setVar("source", StringUtils.isEmpty(source) ? "user" : source).setParam("id", userId); """).setVar("source", StringUtils.isEmpty(source) ? "user" : source).setParam("id", userId);
NutMap user = sysUserViService.fetch(sql); NutMap user = sysUserViService.fetch(sql);
@@ -296,4 +300,17 @@ public class MemberCommonController {
} }
/**
* 会员历史变更记录
* @param userId
* @return
*/
@At
@ViReturn
@RequiresAuthentication
public Object memberHistoryRecords(String userId) {
return memberService.memberHistoryRecordsByUserId(userId);
}
} }
@@ -1,9 +1,17 @@
package io.v.nutz.zhgh.member.controller.apply; package io.v.nutz.zhgh.member.controller.apply;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Roles; import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.models.Sys_signature;
import io.v.nutz.sys.services.SysSignatureService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.zhgh.member.constant.MemberApplyState; import io.v.nutz.zhgh.member.constant.MemberApplyState;
import io.v.nutz.zhgh.member.handle.MemberApplyAuditHandle; import io.v.nutz.zhgh.member.handle.MemberApplyAuditHandle;
import io.v.nutz.zhgh.member.model.MemberApplyRecord; import io.v.nutz.zhgh.member.model.MemberApplyRecord;
@@ -13,12 +21,15 @@ import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.ddr.poi.html.HtmlRenderPolicy;
import org.nutz.dao.Chain; import org.nutz.dao.Chain;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap; import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
@@ -26,6 +37,10 @@ import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans; import org.nutz.trans.Trans;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
@At("/platform/member/apply/submit") @At("/platform/member/apply/submit")
@@ -48,6 +63,12 @@ public class MemberApplyController {
@Inject @Inject
private SysUserService sysUserService; private SysUserService sysUserService;
@Inject
private SysSignatureService sysSignatureService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
/** /**
* 获取信息 * 获取信息
* *
@@ -63,6 +84,9 @@ public class MemberApplyController {
u.username, u.username,
u.loginname, u.loginname,
u.member, u.member,
u.unitid,
u.nation,
u.marriage,
un.id unionid, un.id unionid,
un.unioncode, un.unioncode,
un.unionname, un.unionname,
@@ -165,4 +189,84 @@ public class MemberApplyController {
}); });
return null; return null;
} }
@At
@Ok("void")
@RequiresPermissions("member.apply.submit")
public void exportApply(@Param(value = "userId", required = false) String userId, HttpServletResponse response) {
try (ServletOutputStream os = response.getOutputStream()) {
Sql sql = Sqls.create("""
SELECT
u.username,
u.sex,
u.nation,
u.education,
concat(u.username, '、', u.jobTitle) as workUnit,
u.marriage,
u.academicDegree,
u.political,
u.idcard,
u.mobile,
u.registeredResidence,
u.homeAddress,
u.vita,
u.specialSkill,
u.family,
mar.signId,
mar.applyTime
FROM
sys_user u
left join member_apply_record mar on mar.userId = u.id
WHERE u.id = @id
""").setParam("id", Strings.isNotBlank(userId) ? userId : ShiroUtil.getUserId());
NutMap userMap = memberApplyRecordViService.fetch(sql);
MemberApplyRecord applyRecord = memberApplyRecordViService.fetch(Cnd.where("userId", "=", Strings.isNotBlank(userId) ? userId : ShiroUtil.getUserId()).desc("applyTime"));
//and("stateId", "=", 30)
memberApplyRecordViService.fetchLinks(applyRecord, null);
if (Strings.isNotBlank(userMap.getString("signId"))) {
Sys_signature signature = sysSignatureService.fetch(userMap.getString("signId"));
userMap.setv("userSign", signature != null ? Vi.getImg(signature.getData()) : null);
}
if (Lang.isNotEmpty(applyRecord) && applyRecord.getUnionAudit() != null) {
userMap.put("unionOpinion", applyRecord.getUnionAudit().getAuditOpinion());
userMap.put("unionUserName", applyRecord.getUnionAudit().getUsername());
if (StrUtil.isNotBlank(applyRecord.getUnionAudit().getAuditSign())) {
// userMap.put("unionUserSign", ViTool.poiBase64Image7030(applyRecord.getUnionAudit().getAuditSign()));
userMap.put("unionUserSign", Vi.getImg(applyRecord.getUnionAudit().getAuditSign()));
}
userMap.put("unionDate", DateUtil.format(applyRecord.getUnionAudit().getAuditTime(), "yyyy年MM月dd日"));
}
if (Lang.isNotEmpty(applyRecord) && applyRecord.getSchoolAudit() != null) {
userMap.put("schoolOpinion", applyRecord.getSchoolAudit().getAuditOpinion());
if (StrUtil.isNotBlank(applyRecord.getSchoolAudit().getAuditSign())) {
// userMap.put("schoolSign", ViTool.poiBase64Image7030(applyRecord.getSchoolAudit().getAuditSign()));
userMap.put("schoolSign", Vi.getImg(applyRecord.getSchoolAudit().getAuditSign()));
}
userMap.put("schoolDate", DateUtil.format(applyRecord.getSchoolAudit().getAuditTime(), "yyyy年MM月dd日"));
}
Date applyTime = applyRecord.getApplyTime();
Calendar calendar = Calendar.getInstance();
calendar.setTime(applyTime);
userMap.put("year", DateUtil.year(userMap.getTime("applyTime")));
userMap.put("month", DateUtil.month(userMap.getTime("applyTime")) + 1);
userMap.put("day", DateUtil.dayOfMonth(userMap.getTime("applyTime")));
userMap.put("schoolName", Globals.MyConfig.getString("GxName"));
ViTool.excelResponse(response, userMap.getString("username") + "-工会入会申请表.docx");
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
Configure configure = Configure.builder().bind("vita", htmlRenderPolicy).build();
XWPFTemplate.compile(officeTemplateUtil.getPath("memberApply"), configure).render(userMap).writeAndClose(os);
System.out.println(Json.toJson(userMap));
} catch (Exception e) {
e.printStackTrace();
}
}
} }
@@ -1,15 +1,23 @@
package io.v.nutz.zhgh.member.controller.change; package io.v.nutz.zhgh.member.controller.change;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.PageUtil; import io.v.nutz.base.utils.PageUtil;
import io.v.nutz.base.utils.RCSCloudAPI; import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.dao.CndPlus; import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.models.*;
import io.v.nutz.web.commons.slog.annotation.SLog;
import io.v.nutz.zhgh.data.constant.UserChangeType; import io.v.nutz.zhgh.data.constant.UserChangeType;
import io.v.nutz.base.lang.Lang;
import io.v.nutz.zhgh.member.MemberMode; import io.v.nutz.zhgh.member.MemberMode;
import io.v.nutz.zhgh.member.UserMode; import io.v.nutz.zhgh.member.UserMode;
import io.v.nutz.zhgh.member.WelfareMemberMode; import io.v.nutz.zhgh.member.WelfareMemberMode;
@@ -17,18 +25,17 @@ import io.v.nutz.zhgh.member.constant.*;
import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle; import io.v.nutz.zhgh.member.handle.MemberChangeAuditHandle;
import io.v.nutz.zhgh.member.model.MemberChangeRecord; import io.v.nutz.zhgh.member.model.MemberChangeRecord;
import io.v.nutz.zhgh.member.service.MemberService; import io.v.nutz.zhgh.member.service.MemberService;
import io.v.nutz.zhgh.member.template.MemberTemp;
import io.v.nutz.zhgh.member.utils.MemberUtils; import io.v.nutz.zhgh.member.utils.MemberUtils;
import io.v.nutz.base.model.Audit; import io.v.nutz.base.model.Audit;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.AuditService; import io.v.nutz.base.service.AuditService;
import io.v.nutz.base.service.ViService; import io.v.nutz.base.service.ViService;
import io.v.nutz.sys.models.Sys_config;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.User;
import io.v.nutz.sys.services.SysUnitService; import io.v.nutz.sys.services.SysUnitService;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain; import org.nutz.dao.Chain;
@@ -42,18 +49,26 @@ import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json; import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.trans.Trans; import org.nutz.trans.Trans;
import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@At("/platform/member/change/mange") @At("/platform/member/change/mange")
@Ok("json:full") @Ok("json:full")
@IocBean @IocBean
@Slf4j
public class MemberChangeManageController { public class MemberChangeManageController {
@At("") @At("")
@@ -155,7 +170,7 @@ public class MemberChangeManageController {
cnd.andEX("u.personType", "=", personType); cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState); cnd.andEX("u.userState", "=", userState);
if (Lang.notNull(changeDateBefore, changeDateEnd)) { if (StrUtil.isNotBlank(changeDateBefore) && StrUtil.isNotBlank(changeDateEnd)) {
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd))); cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
} }
@@ -163,10 +178,11 @@ public class MemberChangeManageController {
cnd.orderBy((List.of("changeTime", "changeType", "changeTypes").contains(pageForm.getPageOrderName()) ? "his." : "u.") + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy())); cnd.orderBy((List.of("changeTime", "changeType", "changeTypes").contains(pageForm.getPageOrderName()) ? "his." : "u.") + pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
} }
if (org.nutz.lang.Lang.isNotEmpty(changeTypes)) {
if (Lang.isNotEmpty(changeTypes)) {
SqlExpressionGroup seg = new SqlExpressionGroup(); SqlExpressionGroup seg = new SqlExpressionGroup();
for (Integer type : changeTypes) { for (Integer type : changeTypes) {
seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type))); seg.or(new Static("JSON_CONTAINS(his.changeTypes, CAST(%d AS JSON), '$')".formatted(type)));
} }
cnd.and(seg); cnd.and(seg);
} }
@@ -247,7 +263,7 @@ public class MemberChangeManageController {
cnd.andEX("u.sex", "=", sex); cnd.andEX("u.sex", "=", sex);
cnd.andEX("u.personType", "=", personType); cnd.andEX("u.personType", "=", personType);
cnd.andEX("u.userState", "=", userState); cnd.andEX("u.userState", "=", userState);
if (Lang.notNull(changeDateBefore, changeDateEnd)) { if (StrUtil.isNotBlank(changeDateBefore) && StrUtil.isNotBlank(changeDateEnd)) {
cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd))); cnd.and(new Static(String.format("Date(his.changeTime) >= '%s' and Date(his.changeTime) <= '%s'", changeDateBefore, changeDateEnd)));
} }
cnd.andEX("his.changeType", "=", changeType); cnd.andEX("his.changeType", "=", changeType);
@@ -312,9 +328,9 @@ public class MemberChangeManageController {
@RequiresPermissions("member.change.mange") @RequiresPermissions("member.change.mange")
public Object sendSms(String userid) { public Object sendSms(String userid) {
Sys_user user = userService.fetch(userid); Sys_user user = userService.fetch(userid);
if (Strings.isNotBlank(user.getMobile())) { /*if (Strings.isNotBlank(user.getMobile())) {
RCSCloudAPI.sendTplSms("9159ed9ef1654c0ea2d7475520049a6f", user.getMobile(), "@1@=" + user.getUsername(), ""); RCSCloudAPI.sendTplSms("9159ed9ef1654c0ea2d7475520049a6f", user.getMobile(), "@1@=" + user.getUsername(), "");
} }*/
return null; return null;
} }
@@ -546,4 +562,146 @@ public class MemberChangeManageController {
} }
@At
@Ok("void")
public void downloadImport(HttpServletResponse response) {
try {
ViTool.excelResponse(response, "会员导入模版.xlsx");
List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("工号", "loginname", 20));
entityList.add(new ExcelExportEntity("姓名", "username", 20));
entityList.add(new ExcelExportEntity("性别", "sex", 10));
entityList.add(new ExcelExportEntity("单位名称", "unitName", 20));
entityList.add(new ExcelExportEntity("联系方式", "mobile", 20));
if (ShiroUtil.hasAnyRoles("sysadmin,A06")) {
entityList.add(new ExcelExportEntity("身份证号", "idcard", 30));
}
entityList.add(new ExcelExportEntity("在职状态", "userState", 20));
entityList.add(new ExcelExportEntity("人员类型", "personType", 20));
entityList.add(new ExcelExportEntity("入会时间", "memberJoinTime", 20));
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, new ArrayList<>());
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
private final ReentrantLock lock = new ReentrantLock(true);
@At
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@Aop(TransAop.READ_COMMITTED)
@SLog(type = "会员管理系统", tag = "信息维护-会员高级管理", msg = "导入会员", param = true, result = true)
public Object doImport(TempFile file) {
try {
lock.lock();
List<MemberTemp> memberImportList = ExcelImportUtil.importExcel(file.getFile(), MemberTemp.class, new ImportParams());
//获取系统用户
List<Sys_user> dataUserList = dao.query(Sys_user.class, Cnd.NEW());
Map<String, Sys_user> userMap = dataUserList.stream().collect(Collectors.toMap(Sys_user::getLoginname, v -> v));
List<Sys_unit> unitList = sysUnitService.query(Cnd.where("unitlevel","=",2));
//判断单位
Map<String, String> unitMap = unitList.stream().collect(Collectors.toMap(Sys_unit::getName, Sys_unit::getId));
//系统中有此用户,修改
List<String> needUpdateUserIds = new ArrayList<>();
//系统中没有,新增
List<Sys_user> needInsertUser = new ArrayList<>();
//赋予角色
List<Sys_user_role> userRoles = new ArrayList<>();
//返回错误记录
List<MemberTemp> errorInfos = new ArrayList<>();
List<Sys_user> needUpdateUser = new ArrayList<>();
memberImportList.forEach(v -> {
//判断是否填写单位、单位是否存在
String unitId = unitMap.get(v.getUnitName());
if (Strings.isNotBlank(v.getUnitName()) && Strings.isBlank(unitId)) {
v.setErrorInfo("获取不到该用户的单位信息!");
errorInfos.add(v);
return;
}
//判断是否在系统中
Sys_user user = userMap.get(v.getLoginname());
Sys_user_role userRole = new Sys_user_role();
if (org.nutz.lang.Lang.isNotEmpty(user)) {
user.setUnitid(unitId);
user.setSex(v.getSex());
user.setMobile(v.getMobile());
user.setMember(1);
user.setUserState(v.getUserState());
user.setPersonType(v.getPersonType());
if (StrUtil.isNotBlank(v.getIdcard())) {
user.setIdcard(v.getIdcard());
}
userRole.setUserId(user.getId());
needUpdateUser.add(user);
needUpdateUserIds.add(user.getId());
} else {
//不在就初始化新用户,工号用导入表中的
Sys_user initUser = UserMode.initUser(new Sys_user());
initUser.setUnitid(unitId);
initUser.setUsername(v.getUsername());
initUser.setLoginname(v.getLoginname());
initUser.setMember(1);
initUser.setSex(v.getSex());
initUser.setMobile(v.getMobile());
initUser.setUserState(v.getUserState());
initUser.setPersonType(v.getPersonType());
if (StrUtil.isNotBlank(v.getIdcard())) {
initUser.setIdcard(v.getIdcard());
}
userRole.setUserId(initUser.getId());
needInsertUser.add(initUser);
}
userRole.setRoleId(Roles.MEMBER);
userRoles.add(userRole);
});
//需要删除角色的用户ID
List<String> doCleanRoleUsers = needInsertUser.stream().map(Sys_user::getId).collect(Collectors.toList());
doCleanRoleUsers.addAll(needUpdateUserIds);
sysUnitService.dao().clear(Sys_user_role.class, Cnd.where("userId", "in", doCleanRoleUsers).and("roleId", "=", Roles.MEMBER));
//新增会员角色
sysUnitService.dao().insert(userRoles);
//系统中存在就修改
sysUnitService.dao().update(Sys_user.class, Chain.make("member", 1), Cnd.where("id", "in", needUpdateUserIds));
//系统中不存在就新增
sysUnitService.dao().insert(needInsertUser);
sysUnitService.dao().updateIgnoreNull(needUpdateUser);
//如果有错误数据就返回给前端
if (org.nutz.lang.Lang.isNotEmpty(errorInfos)) {
NutMap nutMap = NutMap.NEW();
nutMap.setv("totalCount", memberImportList.size());
nutMap.setv("successCount", doCleanRoleUsers.size());
nutMap.setv("errorCount", errorInfos.size());
nutMap.setv("errorList", errorInfos.stream().map(v -> {
return NutMap.NEW().addv("工号", v.getLoginname()).addv("姓名", v.getUsername()).addv("错误原因", v.getErrorInfo());
}).collect(Collectors.toList()));
return io.v.nutz.base.result.Result.success(nutMap);
}
sysUnitService.dao().clear(Sys_user.class,Cnd.where("loginname","is",null));
lock.unlock();
return Result.success();
} catch (Exception e) {
log.error(e.getMessage());
return Result.error();
}
}
} }
@@ -34,4 +34,11 @@ public interface MemberService extends ViService<Sys_user> {
* @return * @return
*/ */
Pagination memberChangeRecords(PageForm pageForm, CndPlus cnd); Pagination memberChangeRecords(PageForm pageForm, CndPlus cnd);
/**
* 某会员历史变更记录
* @param userId
* @return
*/
List<NutMap> memberHistoryRecordsByUserId(String userId);
} }
@@ -76,4 +76,43 @@ public class MemberServiceImpl extends ViServiceImpl<Sys_user> implements Member
Sql sql = Sqls.create(MEMBER_CHANGE_RECORDS).setCondition(cnd); Sql sql = Sqls.create(MEMBER_CHANGE_RECORDS).setCondition(cnd);
return list(pageForm, sql); return list(pageForm, sql);
} }
@Override
public List<NutMap> memberHistoryRecordsByUserId(String userId) {
Sql sql = Sqls.create("""
SELECT
his.id,
his.changeTime,
his.loginname,
his.username,
his.mobile,
his.birthday,
his.userState,
his.personType,
his.sex,
his.changeTypes,
his.changeOrigin,
his.changeOperator,
his.memberChangeRecordId,
his.changeReason,
his.lastHistoryId,
u.unitname,
u.unionname,
mcr.stateId,
state.stateName,
state.stateColor
FROM
`user_history` his
LEFT JOIN member_change_record mcr ON mcr.id = his.memberChangeRecordId
LEFT JOIN audit_state state ON mcr.stateId = state.stateId
LEFT JOIN `user` u ON u.loginname = his.loginname
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("u.id", "=", userId);
cnd.desc("his.changeTime");
sql.setCondition(cnd);
return listMap(sql);
}
} }
@@ -0,0 +1,37 @@
package io.v.nutz.zhgh.member.template;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class MemberTemp {
@Excel(name = "工号")
private String loginname;
@Excel(name = "姓名")
private String username;
@Excel(name = "性别")
private String sex;
@Excel(name = "单位名称")
private String unitName;
@Excel(name = "联系方式")
private String mobile;
@Excel(name = "身份证号")
private String idcard;
@Excel(name = "在职状态")
private String userState;
@Excel(name = "人员类型")
private String personType;
@Excel(name = "入会时间")
private String memberJoinTime;
private String errorInfo;
}
@@ -70,7 +70,7 @@ public class MemberMobileController {
@At("/query") @At("/query")
@Ok("beetl:/mobile/member/query.html") @Ok("beetl:/mobile/member/query.html")
@RequiresRoles(value = {"H04", "A06"}, logical = Logical.OR) @RequiresRoles(value = {"H04", "A06", "sysadmin"}, logical = Logical.OR)
public void query() { public void query() {
} }
@@ -88,7 +88,7 @@ public class MemberMobileController {
@At @At
@ViReturn @ViReturn
@RequiresRoles(value = {"H04", "A06"}, logical = Logical.OR) @RequiresRoles(value = {"H04", "A06", "sysadmin"}, logical = Logical.OR)
public Object getMemberData(PageForm pageForm, String unionId, String unitId) { public Object getMemberData(PageForm pageForm, String unionId, String unitId) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
@@ -119,13 +119,13 @@ public class MemberMobileController {
@At @At
@ViReturn @ViReturn
@RequiresRoles(value = {"H04", "A06"}, logical = Logical.OR) @RequiresRoles(value = {"H04", "A06", "sysadmin"}, logical = Logical.OR)
public Object viewInfo(String id) { public Object viewInfo(String id) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
u.username, u.username,
u.sex, u.sex,
u.age, u.birthday,
u.nation, u.nation,
u.education, u.education,
u.political, u.political,
@@ -0,0 +1,80 @@
package io.v.nutz.zhgh.msgNotify.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @version 1.0
* @Author zzr
* @name:Orm_Msg
* @Date 2024/7/23 10:16
* @注释
*/
@Table
@Data
public class Orm_Msg {
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("短信编号")
private String msgCode;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人姓名")
private String username;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人工号")
private String loginname;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人工会")
private String schoolName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人工会id")
private String schoolId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人二级工会id")
private String unitId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人二级工会")
private String unitName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("接收人手机号")
private String mobile;
@Column
@ColDefine(type = ColType.VARCHAR, width = 300)
@Comment("发送内容")
private String content;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("发送时间")
private String sendTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("发送人")
private String senderUsername;
}
@@ -84,7 +84,7 @@ public class ProposalUrgeServiceImpl extends ViServiceImpl<ProposalUrge> impleme
if (!list.isEmpty()) { if (!list.isEmpty()) {
list.forEach(v -> { list.forEach(v -> {
if (Strings.isNotBlank(v.getString("mobile"))) { if (Strings.isNotBlank(v.getString("mobile"))) {
RCSCloudAPI.sendTplSms("002595a3587449738e458d8766738317", v.getString("mobile"), "@1@=" + "[" + fetch.getProposalName() + "]", " "); // RCSCloudAPI.sendTplSms("002595a3587449738e458d8766738317", v.getString("mobile"), "@1@=" + "[" + fetch.getProposalName() + "]", " ");
} else { } else {
arrayList.add(v.getString("unitName")); arrayList.add(v.getString("unitName"));
} }
@@ -311,13 +311,13 @@ public class TheRapyRecuperationAuditController {
Sys_user user = auditService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName)); Sys_user user = auditService.dao().fetch(Sys_user.class, Cnd.where("loginname", "=", loginName));
TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", takePartInLineId)); TheRapyRecuperationLine theRapyRecuperationLine = auditService.dao().fetch(TheRapyRecuperationLine.class, Cnd.where("id", "=", takePartInLineId));
AuditState auditState = auditService.dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateId)); AuditState auditState = auditService.dao().fetch(AuditState.class, Cnd.where("stateId", "=", stateId));
if (stateId.equals(TheRapyRecuperationState.UNITFAIL)) { /*if (stateId.equals(TheRapyRecuperationState.UNITFAIL)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
} else if (stateId.equals(TheRapyRecuperationState.LINEUNITFAIL)) { } else if (stateId.equals(TheRapyRecuperationState.LINEUNITFAIL)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
} else if (stateId.equals(TheRapyRecuperationState.PASS)) { } else if (stateId.equals(TheRapyRecuperationState.PASS)) {
RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", ""); RCSCloudAPI.sendTplSms("3a96eeb38ca7406aaf39dcf305507816", user.getMobile(), "@1@=" + user.getUsername() + "||@2@=" + theRapyRecuperationLine.getLineName() + "||@3@=" + auditState.getStateName() + "", "");
} }*/
} }
@@ -0,0 +1,63 @@
package io.v.nutz.zhgh.zc.controller;
import cn.hutool.core.date.DateUtil;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.service.ViService;
import io.v.nutz.zhgh.zc.model.ZcPdPlan;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName ZcDjPlanController
* @Description TODO
* @Author zhf
* @Date 2024/2/27 14:13
*/
@IocBean
@Ok("json:full")
@At("/platform/zcgl/zcdj/plan")
public class ZcPdPlanController {
@Inject("ZcPdPlan")
private ViService<ZcPdPlan> viService;
@At("")
@Ok("beetl:/platform/zcgl/zcPdPlan.html")
@RequiresPermissions("zc.pdPlan")
public void index() {
}
@At
@ViReturn
public Object pageData(PageForm page, String year) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", "=", year);
cnd.asc("startDate");
return viService.list(page, cnd);
}
@At
@ViReturn
public Object doSubmit(ZcPdPlan zcPdPlan) {
zcPdPlan.setCreateDate(DateUtil.now());
viService.insertOrUpdate(zcPdPlan);
return null;
}
@At
@ViReturn
public Object doDelete(String id) {
viService.delete(id);
return null;
}
}
@@ -1,48 +1,36 @@
package io.v.nutz.zhgh.zc.controller; package io.v.nutz.zhgh.zc.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination; import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_unit;
import io.v.nutz.sys.models.Sys_user; import io.v.nutz.sys.models.Sys_user;
import io.v.nutz.sys.models.User;
import io.v.nutz.sys.services.SysUnionService; import io.v.nutz.sys.services.SysUnionService;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx; import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.zcDepreciationRecord; import io.v.nutz.zhgh.zc.model.zcDepreciationRecord;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.Period; import java.time.Period;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.time.format.DateTimeFormatter;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@@ -50,6 +38,8 @@ import java.util.List;
* 资产登记 * 资产登记
*/ */
@IocBean @IocBean
@Ok("json:full")
@RequiresAuthentication
@At("/platform/zcgl/zcdj") @At("/platform/zcgl/zcdj")
public class ZgfwAddZcxxController { public class ZgfwAddZcxxController {
@@ -65,89 +55,156 @@ public class ZgfwAddZcxxController {
@At("") @At("")
@Ok("beetl:/platform/zcgl/addzcxx.html") @Ok("beetl:/platform/zcgl/addzcxx.html")
@RequiresPermissions("zc.dj") @RequiresPermissions("zc.dj")
public void index() { public void index(String id, HttpSession session) {
}
@At
@ViReturn
@RequiresPermissions("zc.dj")
public Object findOne(String id) {
if (Strings.isNotBlank(id)) {
return zgfwZcxxService.fetch(id);
}
return null;
} }
@At @At("/SearchUserByName")
@Ok("json") @RequiresPermissions("zc.dj")
@ViReturn public Object SearchUserByName(String query) {
public Object findOne(String id) { try {
if (Strings.isBlank(id)) { Cnd cnd = Cnd.NEW();
if (query.length() == 32) {
List<Sys_user> sys_users = sysUserService.query(Cnd.where("id", "=", query));
return Result.success().addData(sys_users);
} else {
cnd.and("username", "like", "%" + query + "%").or("loginname", "like", "%" + query + "%");
io.v.nutz.base.page.Pagination pagination = sysUserService.listPage(1, 10, cnd, "^id|username|loginname$");
return Result.success().addData(pagination.getList());
}
} catch (Exception e) {
return Result.error(); return Result.error();
} }
return zgfwZcxxService.fetch(id);
} }
/** @At("/SearchUnitByName")
* 读取excel内容 @RequiresPermissions("zc.dj")
* public Object SearchUnitByName(String query) {
* @param tempFile try {
* @return Cnd cnd = Cnd.NEW();
*/ if (query.length() == 32) {
@At("/readExcel") List<Sys_union> list = sysUnionService.query(Cnd.where("id", "=", query));
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"}) return Result.success().addData(list);
@Ok("json:full") } else {
@ViReturn cnd.and("unionname", "like", "%" + query + "%").or("dwcode", "like", "%" + query + "%");
public Object readExcel(@Param("file") TempFile tempFile) { Pagination pagination = sysUnionService.listPage(1, 10, cnd, "^id|unionname|dwcode$");
ImportParams params = new ImportParams(); return Result.success().addData(pagination.getList());
List<Zgfw_Zcxx> importList = ExcelImportUtil.importExcel(tempFile.getFile(), Zgfw_Zcxx.class, params); }
return zgfwZcxxService.matchAssetSataus(importList);
} catch (Exception e) {
return Result.error();
}
} }
@At("/doSubmit")
@At @RequiresPermissions("zc.dj")
@Ok("json") @Aop(TransAop.READ_COMMITTED)
@ViReturn @ViReturn
public Object doSubmit(Zgfw_Zcxx zcxx) { public Object doSubmit(Zgfw_Zcxx zcxx) {
List<String> unitIds = new ArrayList<>();
unitIds.add(zcxx.getUnitId());
unitIds.add(zcxx.getThreeUnitId());
List<Sys_unit> units = sysUserService.dao().query(Sys_unit.class, Cnd.where("id", "in", unitIds));
if (StrUtil.isNotBlank(zcxx.getRecipientUserId())) { LocalDate rkLocalDate = zcxx.getDepreciationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
Sys_user user = sysUserService.fetch(zcxx.getRecipientUserId()); Period period = Period.between(LocalDate.now(), rkLocalDate);
zcxx.setRecipientUsername(user.getUsername());
zcxx.setRecipientLoginName(user.getLoginname()); // 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 使用定义的格式解析字符串
LocalDate zcgzrqLocalData = LocalDate.parse(zcxx.getZcgzrq(), formatter);
// 计算两个日期之间的差异
Period allMonths = Period.between(zcgzrqLocalData, rkLocalDate);
// 获取月份数
int months = allMonths.getYears() * 12 + allMonths.getMonths();
Double zcDjDouble = Double.parseDouble(zcxx.getZcdj());
Double monthsZcDj = zcDjDouble / months;
int surplusMonths = Math.max(period.getYears() * 12 + period.getMonths(), 0);
int year = Calendar.getInstance().get(Calendar.YEAR);
if (StrUtil.isBlank(zcxx.getZcbh())) {
Sql sql = Sqls.create("""
SELECT count(1) FROM `zgfw_zcxx` where LEFT(zcbh,4) = @year and LENGTH(zcbh) = 8
""").setParam("year", year);
int count = zgfwZcxxService.count(sql);
String bh = String.format("%04d", count + 1);
zcxx.setZcbh(year + bh);
} }
zcxx.setUnitName(units.stream().filter(v->v.getId().equals(zcxx.getUnitId())).findFirst().get().getName()); zcxx.setAllMoney(zcDjDouble * zcxx.getSl());
zcxx.setThreeUnitName(units.stream().filter(v->v.getId().equals(zcxx.getThreeUnitId())).findFirst().get().getName()); zcxx.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * zcxx.getSl(), 2).doubleValue());
zgfwZcxxService.insert(zcxx); zgfwZcxxService.insert(zcxx);
if (period.getYears() * 12 + period.getMonths() >= 0) {
zcDepreciationRecord record = new zcDepreciationRecord();
record.setZcid(zcxx.getZcid());
record.setOperationTime(DateUtil.now());
record.setDepreciationDate(zcxx.getDepreciationDate());
record.setSurplus(surplusMonths);
record.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * zcxx.getSl(), 2).doubleValue());
zgfwZcxxService.insert(record);
}
return null; return null;
} }
@At @At
@Ok("json") @RequiresPermissions("zc.dj")
@ViReturn @Aop(TransAop.READ_COMMITTED)
public Object doEdit(Zgfw_Zcxx zcxx) { public Object doEdit(Zgfw_Zcxx zcxx, HttpSession session) {
zgfwZcxxService.updateIgnoreNull(zcxx);
return null;
}
/**
* 下载模板
*
* @param response
*/
@At("/downLoadTemp")
@Ok("void")
public void downLoadTemp(HttpServletResponse response) {
try { try {
ExportParams exportParams = new ExportParams(); LocalDate rkLocalDate = zcxx.getDepreciationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
exportParams.setType(ExcelType.XSSF); Period period = Period.between(LocalDate.now(), rkLocalDate);
List<Zgfw_Zcxx> list = new ArrayList<>();
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, Zgfw_Zcxx.class, list); // 定义日期格式
ViTool.excelResponse(response, "资产导入模板.xlsx"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
workbook.write(response.getOutputStream()); // 使用定义的格式解析字符串
} catch (IOException e) { LocalDate zcgzrqLocalData = LocalDate.parse(zcxx.getZcgzrq(), formatter);
// 计算两个日期之间的差异
Period allMonths = Period.between(zcgzrqLocalData, rkLocalDate);
// 获取月份数
int months = allMonths.getYears() * 12 + allMonths.getMonths();
Double zcDjDouble = Double.parseDouble(zcxx.getZcdj());
Double monthsZcDj = zcDjDouble / months;
int surplusMonths = Math.max(period.getYears() * 12 + period.getMonths(), 0);
if (period.getYears() * 12 + period.getMonths() >= 0) {
zgfwZcxxService.dao().clear(zcDepreciationRecord.class, Cnd.where("zcid", "=", zcxx.getZcid()));
zcDepreciationRecord record = new zcDepreciationRecord();
record.setZcid(zcxx.getZcid());
record.setOperationTime(DateUtil.now());
record.setDepreciationDate(zcxx.getDepreciationDate());
record.setSurplus(surplusMonths);
record.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * zcxx.getSl(), 2).doubleValue());
zgfwZcxxService.insert(record);
}
zcxx.setAllMoney(zcDjDouble * zcxx.getSl());
zcxx.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * zcxx.getSl(), 2).doubleValue());
zgfwZcxxService.updateIgnoreNull(zcxx);
session.removeAttribute("id");
return Result.success().addMsg("修改成功");
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.error();
} }
} }
@At @At
@Ok("json") @RequiresPermissions("zc.dj")
@ViReturn @ViReturn
public Object doExcelSubmit(@Param(value = "data", required = false) Zgfw_Zcxx[] zxccList) { public Object doExcelSubmit(@Param(value = "data", required = false) Zgfw_Zcxx[] zxccList) {
@@ -155,12 +212,5 @@ public class ZgfwAddZcxxController {
return null; return null;
} }
@At("/readExcelTable")
@Ok("json:full")
@ViReturn
public Object readExcelTable(@Param(value = "zxccList", required = false) Zgfw_Zcxx[] zxccList) {
// return zgfwZcxxService.matchUserId(zxccList);
return null;
}
} }
@@ -1,38 +1,60 @@
package io.v.nutz.zhgh.zc.controller; package io.v.nutz.zhgh.zc.controller;
import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination; import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.dao.CndPlus; import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_user; import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.services.SysUserService; import io.v.nutz.sys.services.SysUserService;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil; import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.zc.model.ZcPdPlan;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx; import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx_bdxx; import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx_bdxx;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings; import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import java.text.SimpleDateFormat; import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 资产变更 * 资产变更
*/ */
@IocBean @IocBean
@Ok("json:full")
@At("/platform/zcgl/gdzcbg") @At("/platform/zcgl/gdzcbg")
public class ZgfwGdzcbgController { public class ZgfwGdzcbgController {
@Inject @Inject
@@ -43,6 +65,12 @@ public class ZgfwGdzcbgController {
@Inject @Inject
private SysUserService sysUserService; private SysUserService sysUserService;
@Inject
private FtpService ftpService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@At("") @At("")
@Ok("beetl:/platform/zcgl/gdzcbg.html") @Ok("beetl:/platform/zcgl/gdzcbg.html")
@@ -52,156 +80,272 @@ public class ZgfwGdzcbgController {
} }
@At("/data") @At("/data")
@Ok("json")
@ViReturn @ViReturn
@RequiresPermissions("zc.bg") @RequiresPermissions("zc.bg")
public Object data(@Param("pageNumber") Integer pageNumber, @Param("pageSize") Integer pageSize, @Param("searchName") String searchName, @Param("searchKeyword") String searchKeyword, public Object data(PageForm pageForm,
Integer isPd,
String zcpdid,
@Param(value = "zcghlx", required = false) String zcghlx, @Param(value = "zcghlx", required = false) String zcghlx,
@Param(value = "zcgzrq", required = false) String zcgzrq, @Param(value = "zcgzrq", required = false) String zcgzrq,
@Param(value = "zclydwh", required = false) String zclydwh, @Param(value = "zclydwh", required = false) String zclydwh,
@Param(value = "zcrksj", required = false) String zcrksj, String pageOrderName, String pageOrderBy) { @Param(value = "zcrksj", required = false) String zcrksj,
@Param(value = "zczt", required = false) String zczt,
@Param(value = "contentCode", required = false) String contentCode) {
Sql sql = Sqls.create("""
SELECT
xx.*,
lb.content,
bd.zcbdid,
COUNT(bd.zcid) AS isPd
FROM
`zgfw_zcxx` xx
LEFT JOIN zgfw_zcxx_bdxx bd ON bd.pdPlanId=@zcpdid and bd.zcid = xx.zcid
LEFT JOIN zgfw_zclb lb ON xx.contentCode = lb.contentCode
$condition
""").setParam("zcpdid", zcpdid);
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword()) && StrUtil.isNotBlank(pageForm.getSearchName())) {
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
}
cnd.andEX("xx.zczt", "=", zczt);
cnd.andEX("xx.contentCode", "=", contentCode);
cnd.andEX("xx.zcghlx", "=", zcghlx);
cnd.andEX("xx.zcgzrq", "=", zcgzrq);
cnd.andEX("xx.zclydwh", "=", zclydwh);
cnd.andEX("xx.zcrksj", "=", zcrksj);
if (isPd != 0) {
cnd.and("( SELECT COUNT(*) FROM zgfw_zcxx_bdxx WHERE pdPlanId = '%s' AND zcid = xx.zcid )".formatted(zcpdid), isPd == 1 ? ">=" : "<", 1);
}
if (StrUtil.isNotBlank(pageForm.getPageOrderBy()) && StrUtil.isNotBlank(pageForm.getPageOrderName())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("desc") ? "desc" : "asc");
} else {
cnd.desc("xx.zcghlx");
}
cnd.groupBy("xx.zcid");
sql.setCondition(cnd);
Pagination pagination = zgfwZcxxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return pagination;
}
@At
@ViReturn
public Object queryChangeData(String zcid) {
Sql sql = Sqls.create("""
SELECT
shr.`username` shrname,
bd.*
FROM
zgfw_zcxx_bdxx bd
LEFT JOIN sys_user oldlyr ON bd.zcoldlyrid = oldlyr.`id`
LEFT JOIN sys_union oldlydw ON bd.`zcoldlydwh` = oldlydw.`id`
LEFT JOIN sys_user nowlyr ON bd.`zcnowlyrid` = nowlyr.`id`
LEFT JOIN sys_union nowlydw ON bd.`zcnowlydwh` = nowlydw.`id`
LEFT JOIN sys_user shr ON bd.`zcbdshrid` = shr.`id`
WHERE
bd.`zcid` = @zcid and bd.pdzt is not null
ORDER BY
bd.`zcbdsj` DESC
""").setParam("zcid", zcid);
return zgfwZcxxBdService.list(sql);
}
@At
@Ok("json")
@Aop(TransAop.READ_COMMITTED)
@ViReturn
public Object doSubmit(Zgfw_Zcxx_bdxx zcxxBdxx, String zclyrname, String zclyrgh, String zclydwh, String zclydwhid, String zclyrid) {
Zgfw_Zcxx zcxx = zgfwZcxxService.fetch(zcxxBdxx.getZcid());
zgfwZcxxBdService.insert(zcxxBdxx);
zcxx.setZczt(zcxxBdxx.getZczt());
zcxx.setZclyrid(zclyrid);
zcxx.setZclyrname(zclyrname);
zcxx.setZclyrgh(zclyrgh);
zcxx.setZclydwh(zclydwh);
zcxx.setZccfdmc(zcxxBdxx.getZcnowcfdmc());
zcxx.setZclydwhid(zclydwhid);
zgfwZcxxService.update(zcxx);
return null;
}
@At
@Ok("json")
@Aop(TransAop.READ_COMMITTED)
@ViReturn
public Object doPdDelete(String zcbdid) {
zgfwZcxxBdService.delete(zcbdid);
return null;
}
@At
@Ok("json")
@ViReturn
public Object getPdPlan(String year) {
return zgfwZcxxService.dao().query(ZcPdPlan.class, Cnd.NEW().andEX("year", "=", year).desc("startDate"));
}
@At
@Ok("void")
@RequiresAuthentication
public void doExcel(String zcpdid, String zcghlx, HttpServletResponse response) {
String unitname = "校工会";
Sql sql = Sqls.create("""
SELECT
zc.zcdj,
zc.sl,
zc.zczt
FROM
zgfw_zcxx zc
LEFT JOIN zgfw_zcxx_bdxx bd ON bd.zcid=zc.zcid AND bd.pdPlanId=@zcpdid
left join sys_unit it on it.id=zc.zclydwhid
LEFT JOIN `user` u ON u.id=bd.zcbdshrid
$condition
""").setParam("zcpdid", zcpdid);
Cnd cnd = Cnd.NEW();
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("zc.zcghlx", "=", "1");
cnd.andEX("zc.zclydwhid", "=", Vi.getUnionId());
unitname = Vi.getUnit().getName();
}
cnd.andEX("zc.zcghlx", "=", zcghlx);
cnd.groupBy("zc.zcbh");
cnd.asc("zc.zcbh");
sql.setCondition(cnd);
List<NutMap> maps = sysUserService.listMap(sql);
Map<String, Object> map = new HashMap<String, Object>();
int zSl = maps.stream().mapToInt(m -> m.getInt("sl")).sum();
String zZcdj = String.format("%.2f", maps.stream().mapToDouble(m -> m.getFloat("zcdj")).sum());
map.put("zSl", zSl);
map.put("zZcdj", zZcdj);
Map<String, String> zcLxMap = Map.of("one", "正常",
"two", "损坏",
"three", "丢失",
"four", "待报废",
"five", "使用信息不符",
"six", "盘盈");
zcLxMap.forEach((k, v) -> {
String slName = k + "Sl";
String zcdjName = k + "Zcdj";
int sl = maps.stream().filter(m -> m.getString("zczt").equals(v))
.mapToInt(m -> m.getInt("sl")).sum();
String zcdj = String.format("%.2f", maps.stream().filter(m -> m.getString("zczt").equals(v))
.mapToDouble(m -> m.getFloat("zcdj")).sum());
map.put(slName, sl);
map.put(zcdjName, zcdj);
});
System.out.println();
if (Lang.isNotEmpty(maps)) {
map.put("unitname", unitname);
}
map.put("schoolName", Globals.MyConfig.getString("GxName"));
String fileName = Globals.MyConfig.getString("GxName") + "资产清查统计表";
Configure config = Configure.builder().build();
try { try {
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
XWPFTemplate.compile(officeTemplateUtil.getPath("zcQc"), config).render(map, response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
@At
@Ok("void")
@RequiresAuthentication
public void doHzExcel(String zcpdid, String zcghlx, HttpServletResponse response) {
try {
Map<String, Object> map = new HashMap<String, Object>();
String unitname = "校工会";
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
zc.*, zc.zcbh,
lyrur.username lyr, zc.zcmc,
jsrur.username jsr, bd.zcgzrq,
ut.unionname u.username,
bd.mobile,
zc.zccfdmc,
bd.pdzt,
bd.wpdzt,
bd.zczt,
it.name unitname,
bd.zcFile
FROM FROM
zgfw_zcxx zc zgfw_zcxx zc
LEFT JOIN sys_user lyrur ON zc.zclyrid = lyrur.id LEFT JOIN zgfw_zcxx_bdxx bd ON bd.zcid=zc.zcid AND bd.pdPlanId=@zcpdid
LEFT JOIN sys_user jsrur ON zc.zcjsrid = jsrur.id left join sys_unit it on it.id=zc.zclydwhid
LEFT JOIN sys_union ut ON ut.`id` = zc.zclydwh $condition LEFT JOIN `user` u ON u.id=bd.zcbdshrid
"""); $condition
CndPlus cndPlus = CndPlus.create(); """).setParam("zcpdid", zcpdid);
cndPlus.andEx(searchName, "like", "%" + searchKeyword + "%"); Cnd cnd = Cnd.NEW();
cndPlus.andEx("zc.zcghlx", "=", zcghlx); if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cndPlus.andEx("zc.zcgzrq", "=", zcgzrq); /*if (ShiroUtil.hasRole("H04")) {
cndPlus.andEx("zc.zclydwh", "=", zclydwh); cnd.andEX("zc.zcghlx", "=", "1");
cndPlus.andEx("zc.zcrksj", "=", zcrksj); cnd.andEX("zc.zclydwhid", "=", Vi.getUnionId());
if (StrUtil.isNotBlank(pageOrderName) && StrUtil.isNotBlank(pageOrderBy)) { unitname = Vi.getUnit().getName();
cndPlus.orderBy(pageOrderName, pageOrderBy.equals("desc") ? "desc" : "asc"); } else {
} else { cnd.andEX("zc.zcghlx", "=", "2");
cndPlus.desc("zc.zcghlx"); }*/
} cnd.andEX("zc.zcghlx", "=", "1");
sql.setCondition(cndPlus); cnd.andEX("zc.zclydwhid", "=", Vi.getUnionId());
Pagination pagination = zgfwZcxxService.listPage(pageNumber, pageSize, sql); unitname = Vi.getUnit().getName();
return Result.success().addData(pagination);
} catch (Exception e) {
return Result.error();
}
}
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@At
@Ok("json")
public Object doChange(@Param("..") Zgfw_Zcxx_bdxx zcxxBdxx, String zczt) {
try {
Zgfw_Zcxx zcxx = zgfwZcxxService.fetch(zcxxBdxx.getZcid());
Sys_user user = null;
if (zczt.equals("报废") || zczt.equals("待报废")) {
zcxxBdxx.setZcnowlyrid(Strings.isBlank(zcxxBdxx.getZcnowlyrid()) ? zcxxBdxx.getZcoldlyrid() : zcxxBdxx.getZcnowlyrid());
zcxxBdxx.setZcnowlydwh(Strings.isBlank(zcxxBdxx.getZcnowlydwh()) ? zcxxBdxx.getZcoldlydwh() : zcxxBdxx.getZcnowlydwh());
zcxxBdxx.setZcnowcfdmc(Strings.isBlank(zcxxBdxx.getZcnowcfdmc()) ? zcxxBdxx.getZcoldcfdmc() : zcxxBdxx.getZcnowcfdmc());
} else {
user = zgfwZcxxBdService.dao().fetch(Sys_user.class, zcxxBdxx.getZcnowlyrid());
zcxxBdxx.setZcnowlyrid(Strings.isBlank(zcxxBdxx.getZcnowlyrid()) ? zcxxBdxx.getZcoldlyrid() : zcxxBdxx.getZcnowlyrid());
zcxxBdxx.setZcnowlydwh(Strings.isBlank(zcxxBdxx.getZcnowlydwh()) ? zcxxBdxx.getZcoldlydwh() : zcxxBdxx.getZcnowlydwh());
zcxxBdxx.setZcnowcfdmc(Strings.isBlank(zcxxBdxx.getZcnowcfdmc()) ? zcxxBdxx.getZcoldcfdmc() : zcxxBdxx.getZcnowcfdmc());
} }
// zcxxBdxx.setZcoldlyrid(zcxx.getZclyrid()); cnd.andEX("zc.zcghlx", "=", zcghlx);
// zcxxBdxx.setZcbdsj(DateUtil.now()); cnd.groupBy("zc.zcbh");
// zcxxBdxx.setZcbdshrid(ShiroUtil.getPrincipalProperty("id").toString()); cnd.asc("zc.zcbh");
// zgfwZcxxBdService.insert(zcxxBdxx);
// zcxx.setZclyrid(zcxxBdxx.getZcnowlyrid()); sql.setCondition(cnd);
// zcxx.setZclydwh(zcxxBdxx.getZcnowlydwh()); List<NutMap> maps = sysUserService.listMap(sql);
// zcxx.setZccfdmc(zcxxBdxx.getZcnowcfdmc());
// zcxx.setZclyrname(user == null ? null : user.getUsername()); for (int i = 0; i < maps.size(); i++) {
// zcxx.setZclyrgh(user == null ? null : user.getLoginname()); maps.get(i).put("index", i + 1);
// zcxx.setZczt(zczt); String zcFile1 = maps.get(i).getString("zcFile");
// zcxx.setZcjsrid(ShiroUtil.getPrincipalProperty("id").toString()); if (StrUtil.isNotBlank(zcFile1)) {
// zcxx.setZcjsrname(ShiroUtil.getPrincipalProperty("username").toString()); List<NutMap> zcFile = Json.fromJsonAsList(NutMap.class, zcFile1);
// zcxx.setZcjsrgh(Vi.getUnion().getUnionname()); ByteArrayOutputStream signOs = new ByteArrayOutputStream();
// zgfwZcxxService.update(zcxx); ftpService.download(zcFile.get(0).getString("filepath"), signOs);
return Result.success(); ByteArrayInputStream bais = new ByteArrayInputStream(signOs.toByteArray());
BufferedImage bufferImg = ImageIO.read(bais);
ImageIO.write(bufferImg, "jpg", signOs);
ImageEntity imageEntity = new ImageEntity(signOs.toByteArray(), 200, 1000);
maps.get(i).put("img", imageEntity);
} else {
maps.get(i).put("img", null);
}
}
map.put("maplist", maps);
map.put("applyDate", DateUtil.format(new Date(), "yyyy年MM月dd日"));
if (Lang.isNotEmpty(maps)) {
map.put("unitname", unitname);
}
map.put("schoolName", Globals.MyConfig.getString("GxName"));
// String templateUrl = "C:\\Users\\mayn\\Desktop\\pdHz.xlsx";
String templateUrl = officeTemplateUtil.getPath("pdHz");
response.setContentType("application/octet-stream");
ViTool.excelResponse(response, Globals.MyConfig.getString("GxName") + "固定资产盘点汇总表.xlsx");
TemplateExportParams params = new TemplateExportParams(
templateUrl);
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
workbook.write(response.getOutputStream());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.error();
} }
} }
@At
@Ok("json")
@RequiresPermissions("zc.bg")
public Object queryChangeData(String zcid) {
try {
Sql sql = Sqls.create("""
SELECT
bd.`zcoldcfdmc` oldcfd,
bd.`zcnowcfdmc` nowcfd,
shr.`username` shrname,
bd.`zcbdsj`,
bd.zcnowlydwh,
bd.zcoldlydwh,
oldlyr.username oldlyrusername,
nowlyr.username nowlyrusername
FROM
zgfw_zcxx_bdxx bd
LEFT JOIN `sys_user` oldlyr ON bd.zcoldlyrid = oldlyr.`id`
LEFT JOIN `sys_user` nowlyr ON bd.`zcnowlyrid` = nowlyr.`id`
LEFT JOIN sys_user shr ON bd.`zcbdshrid` = shr.`id`
WHERE
bd.`zcid` = @zcid
ORDER BY
bd.`zcbdsj` DESC
""").setParam("zcid", zcid);
return Result.success().addData(zgfwZcxxBdService.list(sql));
} catch (Exception e) {
return Result.error();
}
}
@At
@Ok("json")
public Object queryDw(String query) {
try {
Sql sql = Sqls.create("SELECT * FROM sys_union WHERE unionname LIKE @query").setParam("query", "%" + query + "%");
return Result.success().addData(sysUserService.list(sql));
} catch (Exception e) {
return Result.error();
}
}
@At
@Ok("json")
public Object queryUser(String username, String excUserId) {
try {
Cnd cnd = Cnd.NEW();
cnd.where().andLike("username", username).orLike("loginname", username);
if (Strings.isNotBlank(excUserId)) {
cnd.and("id", "!=", excUserId);
}
return Result.success().addData(sysUserService.query(cnd));
} catch (Exception e) {
return Result.error();
}
}
@At
@Ok("json")
@RequiresPermissions("zc.bg")
public Object openEditData(String zcid) {
try {
Sql sql = Sqls.create("SELECT xx.*,u.`username`,un.`unionname` FROM zgfw_zcxx xx \n" +
"LEFT JOIN sys_user u ON xx.`zclyrid` = u.`id`\n" +
"LEFT JOIN sys_union un ON xx.`zclydwh` = un.`id` WHERE xx.zcid=@zcid").setParam("zcid", zcid);
Record record = zgfwZcxxService.list(sql).get(0);
return Result.success().addData(record);
} catch (Exception e) {
return Result.error();
}
}
} }
@@ -0,0 +1,169 @@
package io.v.nutz.zhgh.zc.controller;
import cn.hutool.core.date.DateUtil;
import cn.wizzer.framework.page.Pagination;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.User;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx_bdxx;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @ClassName ZgfwZcBfListController
* @Description TODO
* @Author zhf
* @Date 2024/7/16 14:22
*/
@At("/platform/zcgl/bfList")
@IocBean
@Ok("json:full")
public class ZgfwZcBfListController {
@Inject
private ZgfwZcxxBdService zgfwZcxxBdService;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@At("")
@Ok("beetl:/platform/zcgl/bfList.html")
@RequiresPermissions("zc.bfList")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("zc.bfList")
public Object pageData(PageForm pageForm, Integer year) {
Sql sql = Sqls.create("""
SELECT
zcbdid,
zcbdsj,
COUNT( zcbdsj ) bfNum
FROM
`zgfw_zcxx_bdxx`
WHERE
YEAR ( zcbdsj )= @year
GROUP BY
zcbdsj
ORDER BY
zcbdsj
""").setParam("year", year);
Pagination pagination = zgfwZcxxBdService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> ListMap = pagination.getList();
List<Zgfw_Zcxx_bdxx> bdxxes = zgfwZcxxBdService.query(Cnd.where("YEAR(zcbdsj)", "=", year));
List<Zgfw_Zcxx> zcxxList = zgfwZcxxBdService.dao().query(Zgfw_Zcxx.class, Cnd.NEW());
ListMap.forEach(v -> {
String zcbdsj = v.getString("zcbdsj");
List<Zgfw_Zcxx_bdxx> bdxxList = bdxxes.stream().filter(b -> b.getZcbdsj().equals(zcbdsj)).collect(Collectors.toList());
List<String> zcids = bdxxList.stream().map(Zgfw_Zcxx_bdxx::getZcid).collect(Collectors.toList());
List<Zgfw_Zcxx> zcxxs = zcxxList.stream().filter(z -> zcids.contains(z.getZcid())).collect(Collectors.toList());
int slSum = zcxxs.stream().mapToInt(z -> z.getSl()).sum();
double djSum = zcxxs.stream().mapToDouble(z -> Double.parseDouble(z.getZcdj())).sum();
v.setv("slSum", slSum);
v.setv("djSum", djSum);
v.setv("zcxxs", zcxxs);
});
pagination.setList(ListMap);
return pagination;
}
@At
@Ok("void")
@RequiresPermissions("zc.tzgl")
public void exportDetails(String zcbdid, HttpServletResponse response) {
Zgfw_Zcxx_bdxx bdxx = zgfwZcxxBdService.fetch(zcbdid);
List<Zgfw_Zcxx_bdxx> bdxxes = zgfwZcxxBdService.query(Cnd.where("zcbdsj", "=", bdxx.getZcbdsj()).groupBy("zcbdsj"));
List<String> ids = bdxxes.stream().map(Zgfw_Zcxx_bdxx::getZcid).collect(Collectors.toList());
List<Zgfw_Zcxx> zcxxes = zgfwZcxxBdService.dao().query(Zgfw_Zcxx.class, Cnd.where("zcid", "in", ids));
List<NutMap> zcxxList = new ArrayList<>();
NutMap map = new NutMap();
String fileName = Globals.MyConfig.getString("GxName") + "仪器设备报废申请表";
int zsl = 0;
Double zje = 0.00;
for (int i = 0; i < zcxxes.size(); i++) {
Zgfw_Zcxx zcxx = zcxxes.get(i);
NutMap xxMap = new NutMap();
Double zcdj = Double.parseDouble(zcxx.getZcdj());
int sl = zcxx.getSl() == null ? 1 : zcxx.getSl();
xxMap.setv("index", i + 1);
xxMap.setv("zcbh", zcxx.getZcbh());
xxMap.setv("zcmc", zcxx.getZcmc());
xxMap.setv("zcxh", zcxx.getZcxh());
xxMap.setv("zcsl", sl);
xxMap.setv("zcdj", zcdj);
xxMap.setv("zccj", zcxx.getZccj());
xxMap.setv("zccfdmc", zcxx.getZccfdmc());
xxMap.setv("zcgzrq", zcxx.getZcgzrq());
zcxxList.add(xxMap);
zsl = zsl + sl;
zje = zje + sl * zcdj;
}
if (zcxxes.get(0).getZcghlx().equals("2")) {
map.setv("unionName", "工会");
} else {
String zclyrgh = zcxxes.get(0).getZclyrgh();
User user = zgfwZcxxBdService.dao().fetch(User.class, Cnd.where("loginname", "=", zclyrgh));
map.setv("unionName", user.getUnionname());
}
map.setv("zsl", zsl);
map.setv("zje", String.format("%.2f", zje));
map.setv("zcxxList", zcxxList);
map.setv("fileName", fileName);
map.setv("bfyy", bdxx.getWpdzt());
map.setv("userName", ShiroUtil.getPlatformUsername());
map.setv("applyDate", DateUtil.today());
map.setv("djh", DateUtil.thisYear() + String.format("%03d", bdxxes.size()));
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.newBuilder().bind("zcxxList", policy).build();
try {
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".docx");
XWPFTemplate.compile(officeTemplateUtil.getPath("zcmxb"), config).render(map, response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -2,8 +2,12 @@ package io.v.nutz.zhgh.zc.controller;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.zgfwZclb;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
@@ -26,21 +30,27 @@ public class ZgfwZcSjkbController {
@At("") @At("")
@Ok("beetl:/platform/zcgl/zcsjkb.html") @Ok("beetl:/platform/zcgl/zcsjkb.html")
@RequiresPermissions("zc.sjkb") @RequiresPermissions("zc.sjkb")
public void index(){} public void index() {
}
@Inject @Inject
private ZgfwZcxxBdService zgfwZcxxBdService; private ZgfwZcxxBdService zgfwZcxxBdService;
@Inject
private SysDictService sysDictService;
@At @At
@Ok("json") @Ok("json")
@RequiresPermissions("zc.sjkb") @RequiresPermissions("zc.sjkb")
public Object data(){ public Object data() {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
SUM(CASE WHEN assetStatus = '1001' THEN 1 ELSE 0 END) AS zy, count( CASE WHEN zczt = '在用' THEN '在用' END ) AS zy,
SUM(CASE WHEN assetStatus = '1002' THEN 1 ELSE 0 END) AS ydcf, count( CASE WHEN zczt = '闲置' THEN '闲置' END ) AS xz,
SUM(CASE WHEN assetStatus = '1003' THEN 1 ELSE 0 END) AS dbf, count( CASE WHEN zczt = '未使用' THEN '未使用' END ) AS wsy,
SUM(CASE WHEN assetStatus = '1004' THEN 1 ELSE 0 END) AS ybf count( CASE WHEN zczt = '待报废' THEN '待报废' END ) AS dbf,
count( CASE WHEN zczt = '校外转入' THEN '校外转入' END ) AS xwzr,
count( CASE WHEN zczt = '校内转入' THEN '校内转入' END ) AS xnzr,
count( CASE WHEN zczt = '其它' THEN '其它' END ) AS qt
FROM FROM
zgfw_zcxx zgfw_zcxx
"""); """);
@@ -61,17 +71,42 @@ public class ZgfwZcSjkbController {
List<Record> list = zgfwZcxxBdService.list(Sqls.create("SELECT SUBSTR(MIN(zcgzrq),1,4) ksnf,SUBSTR(MAX(zcgzrq),1,4) jsnf FROM zgfw_zcxx")); List<Record> list = zgfwZcxxBdService.list(Sqls.create("SELECT SUBSTR(MIN(zcgzrq),1,4) ksnf,SUBSTR(MAX(zcgzrq),1,4) jsnf FROM zgfw_zcxx"));
Record record = list.get(0); Record record = list.get(0);
List nftj=new ArrayList(); List nftj = new ArrayList();
for (int i = record.getInt("ksnf"); i <=record.getInt("jsnf") ; i++) { for (int i = record.getInt("ksnf"); i <= record.getInt("jsnf"); i++) {
List<Record> nf = zgfwZcxxBdService.list(Sqls.create("SELECT count(*) sl," + i + " YEAR FROM zgfw_zcxx WHERE zcgzrq LIKE '" + i + "%'")); List<Record> nf = zgfwZcxxBdService.list(Sqls.create("SELECT count(*) sl," + i + " YEAR FROM zgfw_zcxx WHERE zcgzrq LIKE '" + i + "%'"));
nftj.add(nf.get(0)); nftj.add(nf.get(0));
} }
NutMap nutMap=new NutMap(); NutMap nutMap = new NutMap();
nutMap.put("fghtj",new ArrayList<Record>()); nutMap.put("fghtj", new ArrayList<Record>());
nutMap.put("zttj",zttj); nutMap.put("zttj", zttj);
nutMap.put("jgtj",jgtj); nutMap.put("jgtj", jgtj);
nutMap.put("nftj",nftj); nutMap.put("nftj", nftj);
return Result.success().addData(nutMap); return Result.success().addData(nutMap);
} }
@At
@Ok("json")
@ViReturn
@RequiresPermissions("zc.sjkb")
public Object pageData(String zczt) {
List<zgfwZclb> zclbList = zgfwZcxxBdService.dao().query(zgfwZclb.class, Cnd.NEW().asc("contentCode"));
List<Zgfw_Zcxx> zcxxList = zgfwZcxxBdService.dao().query(Zgfw_Zcxx.class, Cnd.NEW().andEX("zczt", "=", zczt));
List<NutMap> list = new ArrayList<>();
zclbList.forEach(z -> {
int sl = zcxxList.stream().filter(zc -> zc.getContentCode().equals(z.getContentCode())).mapToInt(zc -> zc.getSl()).sum();
Double je = zcxxList.stream().filter(zc -> zc.getContentCode().equals(z.getContentCode())).mapToDouble(Zgfw_Zcxx::getAllMoney).sum();
NutMap map = new NutMap();
map.setv("typeCode", z.getContentCode());
map.setv("type", z.getContent());
map.setv("sl", sl);
map.setv("je", String.format("%.2f", je));
list.add(map);
});
return list;
}
} }
@@ -1,48 +1,56 @@
package io.v.nutz.zhgh.zc.controller; package io.v.nutz.zhgh.zc.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.wizzer.framework.base.Result; import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination; import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import com.alibaba.fastjson.JSON;
import io.v.nutz.base.utils.DateUtil; import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.OfficeTemplateUtil; import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx; import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.zhgh.zc.model.zcDepreciationRecord; import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.zc.model.*;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos; import org.nutz.ioc.aop.Aop;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import org.nutz.trans.Trans; import org.nutz.trans.Trans;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.Period; import java.time.Period;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
/** /**
* 台账管理 * 台账管理
@@ -66,61 +74,47 @@ public class ZgfwZcTzglController {
@Inject @Inject
private ZgfwZcxxBdService zgfwZcxxBdService; private ZgfwZcxxBdService zgfwZcxxBdService;
@Inject
private SysDictService sysDictService;
@Inject @Inject
private OfficeTemplateUtil officeTemplateUtil; private OfficeTemplateUtil officeTemplateUtil;
/**
* @param pageForm
* @param assetStatus 资产状态
* @param purchaseDate 购置日期
* @param storageDate 入库日期
* @return
*/
@At @At
@ViReturn @ViReturn
@RequiresPermissions("zc.tzgl") @RequiresPermissions("zc.tzgl")
public Object pageData(PageForm pageForm, public Object data(PageForm pageForm,
@Param(value = "assetStatus", required = false) String assetStatus, @Param(value = "zcghlx", required = false) String zcghlx,
@Param(value = "purchaseDate", required = false) String purchaseDate, @Param(value = "zcgzrq", required = false) String zcgzrq,
@Param(value = "storageDate", required = false) String storageDate) { @Param(value = "zclydwh", required = false) String zclydwh,
@Param(value = "zcrksj", required = false) String zcrksj,
@Param(value = "zczt", required = false) String zczt,
@Param(value = "contentCode", required = false) String contentCode) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
xx.*, xx.*,
lb.categoryName AS assetStatusName, lb.content
CASE
WHEN TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()) < 1 THEN '不足1月'
ELSE
CONCAT(
TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()),
'年',
TIMESTAMPDIFF(MONTH, xx.storageDate + INTERVAL TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()) YEAR, CURDATE()),
'月'
)
END AS yearsAndMonths
FROM FROM
`zgfw_zcxx` xx `zgfw_zcxx` xx
LEFT JOIN zgfw_zclb lb ON xx.assetStatus = lb.contentCode LEFT JOIN zgfw_zclb lb ON xx.contentCode = lb.contentCode
$condition $condition
ORDER BY CASE WHEN xx.zczt = '报废' THEN 1 ELSE 0 END, zczt
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(pageForm.getSearchKeyword()) && StrUtil.isNotBlank(pageForm.getSearchName())) { if (StrUtil.isNotBlank(pageForm.getSearchKeyword()) && StrUtil.isNotBlank(pageForm.getSearchName())) {
cnd.andEX(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%"); cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword()));
} }
cnd.andEX("xx.contentCode", "=", contentCode);
// cnd.andEX("xx.assetStatus", "=", assetStatus); cnd.andEX("xx.zcghlx", "=", zcghlx);
cnd.andEX("xx.zcgzrq", "=", zcgzrq);
if (StrUtil.isNotBlank(assetStatus)) { cnd.andEX("xx.zclydwh", "=", zclydwh);
cnd.and(new Static("JSON_CONTAINS(xx.assetStatus, CAST('\"%s\"' AS JSON), '$')".formatted(assetStatus))); cnd.andEX("xx.zcrksj", "=", zcrksj);
} cnd.andEX("xx.zczt", "=", zczt);
/* if (StrUtil.isNotBlank(pageForm.getPageOrderBy()) && StrUtil.isNotBlank(pageForm.getPageOrderName())) {
cnd.andEX("xx.purchaseDate", "=", purchaseDate);
cnd.andEX("xx.storageDate", "=", storageDate);
if (StrUtil.isNotBlank(pageForm.getPageOrderBy()) && StrUtil.isNotBlank(pageForm.getPageOrderName())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("desc") ? "desc" : "asc"); cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("desc") ? "desc" : "asc");
} else { } else {
cnd.asc("lb.contentCode"); cnd.desc("xx.zcghlx");
} }*/
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = zgfwZcxxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = zgfwZcxxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success().addData(pagination); return Result.success().addData(pagination);
@@ -128,12 +122,11 @@ public class ZgfwZcTzglController {
@At @At
@ViReturn @ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zc.tzgl") @RequiresPermissions("zc.tzgl")
public Object doDel(String id) { public Object doDel(String id) {
Trans.exec(() -> { zgfwZcxxService.delete(id);
zgfwZcxxService.delete(id); zgfwZcxxBdService.clear(Cnd.where("zcid", "=", id));
zgfwZcxxBdService.clear(Cnd.where("zcid", "=", id));
});
return null; return null;
} }
@@ -142,7 +135,7 @@ public class ZgfwZcTzglController {
@RequiresPermissions("zc.tzgl") @RequiresPermissions("zc.tzgl")
public Object bgzt(String zcid, String zczt) { public Object bgzt(String zcid, String zczt) {
Zgfw_Zcxx fetch = zgfwZcxxService.fetch(zcid); Zgfw_Zcxx fetch = zgfwZcxxService.fetch(zcid);
// fetch.setZczt(zczt); fetch.setZczt(zczt);
zgfwZcxxService.updateIgnoreNull(fetch); zgfwZcxxService.updateIgnoreNull(fetch);
return null; return null;
} }
@@ -182,70 +175,184 @@ public class ZgfwZcTzglController {
public Object doZj() { public Object doZj() {
Trans.exec(() -> { Trans.exec(() -> {
List<Zgfw_Zcxx> zgfw_zcxxes = zgfwZcxxService.query(Cnd.where("depreciationDate", "!=", DateUtil.getDate())); List<Zgfw_Zcxx> zgfw_zcxxes = zgfwZcxxService.query(Cnd.where("depreciationDate", "!=", DateUtil.getDate()).and("zczt", "not in", List.of("报废")));
zgfw_zcxxes.forEach(v -> { zgfw_zcxxes.forEach(v -> {
// LocalDate rkLocalDate = v.getDepreciationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate rkLocalDate = v.getDepreciationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// Period period = Period.between(LocalDate.now(), rkLocalDate); Period period = Period.between(LocalDate.now(), rkLocalDate);
// zcDepreciationRecord zcDepreciationRecord = zgfwZcxxService.dao().fetch(zcDepreciationRecord.class, Cnd.where("zcid", "=", v.getZcid()).and("date_format( operationTime, '%Y-%m' )", "=", cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM"))); zcDepreciationRecord zcDepreciationRecord = zgfwZcxxService.dao().fetch(zcDepreciationRecord.class,
// if (zcDepreciationRecord == null && v.getDepreciationDate() != null && (period.getYears() * 12 + period.getMonths()) > 0) { Cnd.where("zcid", "=", v.getZcid())
// zcDepreciationRecord record = new zcDepreciationRecord(); .and("date_format( operationTime, '%Y-%m' )", "=", cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM"))
// record.setZcid(v.getZcid()); );
// record.setOperationTime(cn.hutool.core.date.DateUtil.now()); if (!List.of("报废", "丢失").contains(v.getZczt()) && zcDepreciationRecord == null && v.getDepreciationDate() != null && (period.getYears() * 12 + period.getMonths()) > 0) {
// record.setDepreciationDate(v.getDepreciationDate()); String zcdj = v.getZcdj();
// record.setSurplus(Math.max(period.getYears() * 12 + period.getMonths(), 0)); Integer sl = v.getSl();
// zgfwZcxxService.insert(record); String zcgzrq = v.getZcgzrq();
// } // 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 使用定义的格式解析字符串
LocalDate zcgzrqLocalData = LocalDate.parse(zcgzrq, formatter);
// 计算两个日期之间的差异
Period allMonths = Period.between(zcgzrqLocalData, rkLocalDate);
// 获取月份数
int months = allMonths.getYears() * 12 + allMonths.getMonths();
//得到了这个物品使用的月,通过金额/月就等于每个月多少钱
Double zcDjDouble = Double.parseDouble(zcdj);
Double monthsZcDj = zcDjDouble / months;
int surplusMonths = Math.max(period.getYears() * 12 + period.getMonths(), 0);
zcDepreciationRecord record = new zcDepreciationRecord();
record.setZcid(v.getZcid());
record.setOperationTime(cn.hutool.core.date.DateUtil.now());
record.setDepreciationDate(v.getDepreciationDate());
record.setSurplus(surplusMonths);
record.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * sl, 2).doubleValue());
zgfwZcxxService.insert(record);
v.setSurplusMoney(NumberUtil.round(surplusMonths * monthsZcDj * sl, 2).doubleValue());
} else {
v.setSurplusMoney(null);
}
}); });
zgfwZcxxService.update(zgfw_zcxxes);
}); });
return null; return null;
} }
/**
@At * 下载模板
@ViReturn *
* @param response
*/
@At("/downLoadTemp")
@Ok("void")
@RequiresPermissions("zc.tzgl") @RequiresPermissions("zc.tzgl")
public Object findAssetById(String id) { public void downLoadTemp(HttpServletResponse response) {
Sql sql = Sqls.create(""" try {
SELECT
xx.*, Class<ZgfwZcxxTemp> excelModeClass = ZgfwZcxxTemp.class;
lb.categoryName AS assetStatusName, Field[] excelModeClassDeclaredFields = excelModeClass.getDeclaredFields();
CASE //字段过滤
WHEN TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()) = 0 THEN '不足1月' List<Field> needAddReplaceFields = Arrays.stream(excelModeClassDeclaredFields)
WHEN TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()) = 0 THEN CONCAT(TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()), '月') .filter(v -> List.of("zczt", "fundingSubject", "contentCode", "zcghlx").contains(v.getName())).collect(Collectors.toList());
ELSE CONCAT(TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()), '年', TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()), '月')
END AS yearsAndMonths List<Sys_dict> zcztList = sysDictService.getSubListByCode("zczt");
FROM List<String> zczztCodeList = zcztList.stream().map(v -> v.getCode() + "_" + v.getCode()).collect(Collectors.toList());
`zgfw_zcxx` xx String[] zczztCodeArrs = zczztCodeList.toArray(new String[zczztCodeList.size()]);
LEFT JOIN zgfw_zclb lb ON xx.assetStatus = lb.contentCode
$condition List<zgfwZclb> zgfwZclbList = sysDictService.dao().query(zgfwZclb.class, Cnd.NEW().asc("contentCode"));
"""); List<String> contentList = zgfwZclbList.stream().map(v -> v.getContent() + "_" + v.getContentCode()).collect(Collectors.toList());
Cnd cnd = Cnd.NEW(); String[] contentArrs = contentList.toArray(new String[contentList.size()]);
cnd.and("xx.id", "=", id);
sql.setCondition(cnd); for (Field field : needAddReplaceFields) {
return Daos.query(zgfwZcxxService.dao(), sql.toString(), Sqls.callback.map()); Excel excelAnnotation = field.getAnnotation(Excel.class);
if (Lang.isNotEmpty(excelAnnotation)) {
InvocationHandler invocationHandler = Proxy.getInvocationHandler(excelAnnotation);
Field memberValues = invocationHandler.getClass().getDeclaredField("memberValues");
memberValues.setAccessible(true);
Map e = (Map) memberValues.get(invocationHandler);
e.put("addressList", true);
if (field.getName().equals("zczt")) {
e.put("replace", zczztCodeArrs);
} else if (field.getName().equals("fundingSubject")) {
e.put("replace", new String[]{"行政_行政", "自筹_自筹"});
} else if (field.getName().equals("contentCode")) {
e.put("replace", contentArrs);
} else if (field.getName().equals("zcghlx")) {
e.put("replace", new String[]{"院级工会_1", "校工会_2"});
}
}
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ZgfwZcxxTemp.class, new ArrayList<>());
ViTool.excelResponse(response, "固定资产模板.xlsx");
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**
* 报废资产 * 读取excel内容
* @param ids *
* @param file
* @return * @return
*/ */
@At @At("/readExcel")
@ViReturn
@RequiresPermissions("zc.tzgl") @RequiresPermissions("zc.tzgl")
public Object doScrap(@Param("ids") String ids,@Param("flag")Boolean flag) { @AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
List<String> idList = JSONUtil.parseArray(ids).toList(String.class); public Object readExcel(TempFile file) {
if (Lang.isEmpty(idList)) return Result.error(); ImportParams params = new ImportParams();
List<String> assetList = new ArrayList<>(); List<ZgfwZcxxTemp> importList = ExcelImportUtil.importExcel(file.getFile(), ZgfwZcxxTemp.class, params);
if (flag){ ZgfwZcxxTemp[] zxccList = importList.stream().toArray(ZgfwZcxxTemp[]::new);
assetList.add("1004"); return zgfwZcxxService.matchUserId(zxccList);
} else {
assetList.add("1005");
}
zgfwZcxxService.update(Chain.make("assetStatus",assetList),Cnd.where("id","in",idList));
return Result.success();
} }
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zc.tzgl")
public Object doExcelData(Zgfw_Zcxx[] excelData) {
zgfwZcxxService.insert(excelData);
return null;
}
@At
@ViReturn
@RequiresPermissions("zc.tzgl")
public Object getExcelLyr(String[] userNames) {
if (Lang.isEmpty(userNames)) {
return null;
}
Sql sql = Sqls.create("select id,username,loginname,unionid,unionname from `user` where username in (@usernames)").setParam("usernames", JSON.toJSON(userNames));
List<Record> list = zgfwZcxxService.list(sql);
return list;
}
@At
@ViReturn
@RequiresPermissions("zc.tzgl")
public Object findOne(String id) {
return zgfwZcxxService.findOne(id);
}
@At
@ViReturn
@RequiresPermissions("zc.tzgl")
public Object doBatchBf(String[] ids, String bfyy) {
if (Lang.isEmpty(ids)) {
return Result.error("请勾选所要报废的资产");
}
List<Zgfw_Zcxx> zcxxList = zgfwZcxxService.query(Cnd.where("zcid", "in", ids));
List<Zgfw_Zcxx_bdxx> zcxxBdxxes = new ArrayList<>();
zcxxList.forEach(v -> {
Zgfw_Zcxx_bdxx bdxx = new Zgfw_Zcxx_bdxx();
bdxx.setZcid(v.getZcid());
bdxx.setZcnowlydwh(v.getZclydwh());
bdxx.setZcnowcfdmc(v.getZccfdmc());
bdxx.setZcbdsj(DateUtil.getDate());
bdxx.setZcbdshrid(ShiroUtil.getUserId());
bdxx.setZczt("报废");
bdxx.setWpdzt(bfyy);
v.setZczt("报废");
zcxxBdxxes.add(bdxx);
});
zgfwZcxxService.insert(zcxxBdxxes);
zgfwZcxxService.update(zcxxList);
return null;
}
} }
@@ -1,20 +1,13 @@
package io.v.nutz.zhgh.zc.controller; package io.v.nutz.zhgh.zc.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus; import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.services.SysUnionService; import io.v.nutz.sys.services.SysUnionService;
import io.v.nutz.base.utils.ViTool; import io.v.nutz.base.utils.ViTool;
import io.v.nutz.zhgh.zc.model.ZgfwZclb;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxBdService;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@@ -24,7 +17,6 @@ import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record; import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
@@ -35,7 +27,6 @@ import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 综合查询 * 综合查询
@@ -67,160 +58,105 @@ public class ZgfwZcZhcxController {
@Ok("json") @Ok("json")
@ViReturn @ViReturn
@RequiresPermissions("zc.zhcx") @RequiresPermissions("zc.zhcx")
public Object pageData(PageForm pageForm, public Object data(@Param(value = "pageNumber", required = false) Integer pageNumber,
@Param(value = "assetStatus", required = false) String assetStatus, @Param(value = "pageSize", required = false) Integer pageSize,
@Param(value = "purchaseStartTime", required = false) String purchaseStartTime, @Param(value = "searchName", required = false) String searchName,
@Param(value = "purchaseEndTime", required = false) String purchaseEndTime, @Param(value = "searchKeyword", required = false) String searchKeyword,
@Param(value = "storageStartTime", required = false) String storageStartTime, @Param(value = "zczt", required = false) String zczt,
@Param(value = "storageEndTime", required = false) String storageEndTime) { @Param(value = "startTime", required = false) String startTime,
@Param(value = "endTime", required = false) String endTime,
@Param(value = "zcghlx", required = false) String zcghlx,
@Param(value = "zcrksj", required = false) String zcrksj,
@Param(value = "ghid", required = false) String ghid,
@Param(value = "pageOrderName", required = false) String pageOrderName,
@Param(value = "pageOrderBy", required = false) String pageOrderBy) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
xx.*, xx.*,
lb.categoryName AS assetStatusName, lb.content
CASE
WHEN TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()) < 1 THEN '不足1月'
ELSE
CONCAT(
TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()),
'年',
TIMESTAMPDIFF(MONTH, xx.storageDate + INTERVAL TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()) YEAR, CURDATE()),
'月'
)
END AS yearsAndMonths
FROM FROM
`zgfw_zcxx` xx `zgfw_zcxx` xx
LEFT JOIN zgfw_zclb lb ON xx.assetStatus = lb.contentCode LEFT JOIN zgfw_zclb lb ON xx.contentCode = lb.contentCode
LEFT JOIN sys_union us ON us.id = xx.zclydwhid
$condition $condition
"""); """);
CndPlus cnd = CndPlus.create(); CndPlus cndPlus = CndPlus.create();
cndPlus.andEx(searchName, "like", "%" + searchKeyword + "%");
if (StrUtil.isNotBlank(pageForm.getSearchName()) && StrUtil.isNotBlank(pageForm.getSearchKeyword())) { cndPlus.andEx("xx.zczt", "=", zczt);
cnd.and(Cnd.likeEX(pageForm.getSearchName(), pageForm.getSearchKeyword())); cndPlus.andEx("xx.zcghlx", "=", zcghlx);
} cndPlus.andEx("xx.zczt", "=", zczt);
cndPlus.andEx("xx.zcrksj", "=", zcrksj);
if (StrUtil.isNotBlank(pageForm.getPageOrderBy()) && StrUtil.isNotBlank(pageForm.getPageOrderName())) { cndPlus.andEx("us.id", "=", ghid);
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy().equals("desc") ? "desc" : "asc"); if (StrUtil.isNotBlank(pageOrderName) && StrUtil.isNotBlank(pageOrderBy)) {
cndPlus.orderBy(pageOrderName, pageOrderBy.equals("desc") ? "desc" : "asc");
} else { } else {
cnd.asc("lb.contentCode"); cndPlus.desc("xx.zcghlx");
} }
if (StrUtil.isNotBlank(assetStatus)) { if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
cnd.and(new Static("JSON_CONTAINS(xx.assetStatus, CAST('\"%s\"' AS JSON), '$')".formatted(assetStatus))); cndPlus.and(Cnd.cri().where().andBetween("zcgzrq", startTime, endTime));
} }
sql.setCondition(cndPlus);
if (StrUtil.isNotBlank(purchaseStartTime) && StrUtil.isNotBlank(purchaseEndTime)) { return zgfwZcxxService.listPageMap(pageNumber, pageSize, sql);
cnd.and(Cnd.cri().where().andBetween("xx.purchaseDate", purchaseStartTime, purchaseEndTime));
}
if (StrUtil.isNotBlank(storageEndTime) && StrUtil.isNotBlank(storageStartTime)) {
cnd.and(Cnd.cri().where().andBetween("xx.storageDate", storageStartTime, storageEndTime));
}
sql.setCondition(cnd);
return zgfwZcxxService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
} }
@At
@Ok("json")
public Object getUnion() {
List<Sys_union> query = sysUnionService.query();
return Result.success().addData(query);
}
@At @At
@Ok("void") @Ok("void")
@RequiresPermissions("zc.zhcx") @RequiresPermissions("zc.zhcx")
public void doExport(@Param(value = "searchName",required = false) String searchName, public void doExport(String searchKeyword, String searchName, String zczt, String zcghlx, String ghid, String startTime, String endTime, HttpServletResponse response) {
@Param(value = "searchKeyword",required = false) String searchKeyword,
@Param(value = "assetStatus",required = false)String assetStatus,
@Param(value = "purchaseStartTime",required = false) String purchaseStartTime,
@Param(value = "purchaseEndTime",required = false) String purchaseEndTime,
@Param(value = "purchaseStartTime",required = false) String storageStartTime,
@Param(value = "purchaseEndTime",required = false) String storageEndTime,
@Param(value = "purchaseDate",required = false) String purchaseDate,
@Param(value = "storageDate",required = false) String storageDate,
HttpServletResponse response) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
xx.*, xx.*
lb.categoryName AS assetStatusName,
CASE
WHEN TIMESTAMPDIFF(MONTH, xx.storageDate, CURDATE()) < 1 THEN '不足1月'
ELSE
CONCAT(
TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()),
'年',
TIMESTAMPDIFF(MONTH, xx.storageDate + INTERVAL TIMESTAMPDIFF(YEAR, xx.storageDate, CURDATE()) YEAR, CURDATE()),
'月'
)
END AS yearsAndMonths
FROM FROM
`zgfw_zcxx` xx `zgfw_zcxx` xx
LEFT JOIN zgfw_zclb lb ON xx.assetStatus = lb.contentCode LEFT JOIN `user` us ON us.loginname = xx.zclyrgh
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) { if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
cnd.andEX(searchName, "like", "%" + searchKeyword + "%"); cnd.andEX(searchName, "like", "%" + searchKeyword + "%");
} }
cnd.andEX("xx.zczt", "=", zczt);
if (StrUtil.isNotBlank(assetStatus)) { cnd.andEX("xx.zcghlx", "=", zcghlx);
cnd.and(new Static("JSON_CONTAINS(xx.assetStatus, CAST('\"%s\"' AS JSON), '$')".formatted(assetStatus))); cnd.andEX("xx.zczt", "=", zczt);
cnd.andEX("us.unionid", "=", ghid);
if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
cnd.and(Cnd.cri().where().andBetween("zcgzrq", startTime, endTime));
} }
if (StrUtil.isNotBlank(purchaseStartTime) && StrUtil.isNotBlank(purchaseEndTime)) {
cnd.and(Cnd.cri().where().andBetween("xx.purchaseDate", purchaseStartTime, purchaseEndTime));
}
if (StrUtil.isNotBlank(storageEndTime) && StrUtil.isNotBlank(storageStartTime)) {
cnd.and(Cnd.cri().where().andBetween("xx.storageDate", storageStartTime, storageEndTime));
}
if (StrUtil.isNotBlank(storageDate)) {
cnd.and("xx.storageDate","=", storageDate);
}
if (StrUtil.isNotBlank(purchaseDate)) {
cnd.and("xx.purchaseDate","=", purchaseDate);
}
sql.setCondition(cnd); sql.setCondition(cnd);
List<Record> list = zgfwZcxxService.list(sql); List<Record> list = zgfwZcxxService.list(sql);
List<ZgfwZclb> lbList = dao.query(ZgfwZclb.class, Cnd.NEW());
list.forEach(v->{
String assetCode = v.getString("assetStatus");
List<String> assetList = JSONUtil.parseArray(assetCode).toList(String.class);
String assetStatusName = lbList.stream().filter(item -> assetList.contains(item.getContentCode()))
.map(item -> item.getCategoryName()).collect(Collectors.joining(","));
v.set("assetStatusName", assetStatusName);
});
List<ExcelExportEntity> entityList = new ArrayList<>(); List<ExcelExportEntity> entityList = new ArrayList<>();
entityList.add(new ExcelExportEntity("资产编号", "assetNumber", 20)); entityList.add(new ExcelExportEntity("领用单位号", "zclydwh", 20));
entityList.add(new ExcelExportEntity("资产名称", "assetName", 20)); entityList.add(new ExcelExportEntity("仪器编号", "zcbh", 20));
entityList.add(new ExcelExportEntity("财政六大类名称", "financeSixName", 20)); entityList.add(new ExcelExportEntity("仪器名称", "zcmc", 20));
// entityList.add(new ExcelExportEntity("所属学院", "unitName", 20)); entityList.add(new ExcelExportEntity("型号", "zcxh", 20));
// entityList.add(new ExcelExportEntity("领用单位", "threeUnitName", 20)); entityList.add(new ExcelExportEntity("规格", "zcgg", 20));
entityList.add(new ExcelExportEntity("型号", "assetModel", 20)); entityList.add(new ExcelExportEntity("单价", "zcdj", 20));
entityList.add(new ExcelExportEntity("原值", "originalValue", 20)); entityList.add(new ExcelExportEntity("厂家", "zccj", 20));
entityList.add(new ExcelExportEntity("资产来源", "assetSources", 20)); entityList.add(new ExcelExportEntity("出厂号", "zccch", 20));
entityList.add(new ExcelExportEntity("现状", "assetStatusName", 20)); entityList.add(new ExcelExportEntity("购置日期", "zcgzrq", 20));
entityList.add(new ExcelExportEntity("最低使用年限", "yearsAndMonths", 20)); entityList.add(new ExcelExportEntity("现状", "zczt", 20));
entityList.add(new ExcelExportEntity("领用人", "recipientUsername", 20)); entityList.add(new ExcelExportEntity("存放地名称", "zccfdmc", 20));
entityList.add(new ExcelExportEntity("存放地", "storageLocation", 20)); entityList.add(new ExcelExportEntity("领用人", "zclyrname", 20));
// entityList.add(new ExcelExportEntity("购置日期", "purchaseDate", 20)); entityList.add(new ExcelExportEntity("经手人", "zcjsrname", 20));
entityList.add(new ExcelExportEntity("入库日期", "storageDate", 20)); entityList.add(new ExcelExportEntity("入库时间", "zcrksj", 20));
entityList.add(new ExcelExportEntity("已使用年限", "yearsAndMonths", 20)); entityList.add(new ExcelExportEntity("单据号", "zcdjh", 20));
entityList.add(new ExcelExportEntity("备注", "remark", 30)); entityList.add(new ExcelExportEntity("合同号", "zchth", 20));
// entityList.add(new ExcelExportEntity("主管部门备注", "competentDepartmentRemark", 30)); entityList.add(new ExcelExportEntity("经费卡号", "zcjfkh", 20));
entityList.add(new ExcelExportEntity("经费卡金额", "zcjfkje", 20));
entityList.add(new ExcelExportEntity("国标分类号", "zcgbflh", 20));
entityList.add(new ExcelExportEntity("国别", "zcgb", 20));
entityList.add(new ExcelExportEntity("发票号", "zcfph", 20));
entityList.add(new ExcelExportEntity("供货商", "zcghs", 20));
try { try {
ViTool.excelResponse(response, "资产总账表.xlsx"); ViTool.excelResponse(response, "资产总账表.xls");
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, list); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), entityList, list);
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
} }
@@ -1,100 +0,0 @@
package io.v.nutz.zhgh.zc.controller;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.zc.model.ZgfwZclb;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* TODO
*
* @Author zhf
* @Date 2022/10/25 9:51
*/
@IocBean
@Ok("json:full")
@At("/platform/zcgl/zclb")
public class ZgfwZclbController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/zcgl/zclb.html")
@RequiresPermissions("zcgl.zclb")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object pageData(PageForm pageForm,
@Param(value = "categoryName", required = false) String categoryName) {
Sql sql = Sqls.create("SELECT * FROM `zgfw_zclb` $condition");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(categoryName)) {
cnd.and(Cnd.likeEX("categoryName", categoryName));
}
cnd.asc("contentCode");
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doEdit(ZgfwZclb zgfw_zclb) {
ZgfwZclb zgfwZclb = baseService.dao().fetch(ZgfwZclb.class, Cnd.where("contentCode", "=", zgfw_zclb.getContentCode())
.and("id","!=",zgfw_zclb.getId()));
if (Lang.isNotEmpty(zgfwZclb)) {
return Result.error("编号重复");
}
baseService.dao().update(zgfw_zclb);
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doAdd(ZgfwZclb zgfw_zclb) {
int count = baseService.dao().count(ZgfwZclb.class, Cnd.where("contentCode", "=", zgfw_zclb.getContentCode()));
if (count > 0) {
return Result.error("编号重复");
}
zgfw_zclb.setId(R.UU32());
baseService.dao().fastInsert(zgfw_zclb);
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doDelete(String id) {
baseService.dao().clear(ZgfwZclb.class, Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object queryLb() {
return baseService.dao().query(ZgfwZclb.class, Cnd.NEW().asc("contentCode"));
}
}
@@ -0,0 +1,28 @@
package io.v.nutz.zhgh.zc.controller.mobile;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName ZcPdMobileController
* @Description TODO
* @Author zhf
* @Date 2024/3/3 15:44
*/
@IocBean
@Ok("json:full")
@At("/mobile/zc/zcPd")
public class ZcPdMobileController {
@At("")
@Ok("beetl:/mobile/zc/zcPd.html")
@RequiresPermissions("zc.bg")
public void index() {
}
}
@@ -1,9 +1,9 @@
package io.v.nutz.zhgh.zc.controller; package io.v.nutz.zhgh.zc.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.annontation.ViReturn; import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.zcDepreciationRecord; import io.v.nutz.zhgh.zc.model.zcDepreciationRecord;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
@@ -15,6 +15,9 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import java.util.List;
import java.util.Map;
/** /**
* TODO * TODO
* 资产折旧列表 * 资产折旧列表
@@ -25,7 +28,7 @@ import org.nutz.mvc.annotation.Param;
@IocBean @IocBean
@Ok("json:full") @Ok("json:full")
@At("/platform/zcgl/zjlb") @At("/platform/zcgl/zjlb")
public class ZczjlbController { public class zczjlbController {
@Inject @Inject
private BaseService baseService; private BaseService baseService;
@@ -43,12 +46,13 @@ public class ZczjlbController {
@Param(value = "year", required = false) Integer year) { @Param(value = "year", required = false) Integer year) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
zdr.id, zdr.id AS zjjlId,
zdr.surplus, zdr.surplus,
zdr.operationTime, zdr.operationTime,
zc.* , zc.* ,
lb.content, lb.content,
zdr.depreciationDate zdrDepreciationDate zdr.depreciationDate zdrDepreciationDate,
zdr.surplusMoney zdrSurplusMoney
FROM FROM
`zc_depreciation_record` zdr `zc_depreciation_record` zdr
LEFT JOIN zgfw_zcxx zc ON zdr.zcid = zc.zcid LEFT JOIN zgfw_zcxx zc ON zdr.zcid = zc.zcid
@@ -76,5 +80,19 @@ public class ZczjlbController {
return null; return null;
} }
@At
@ViReturn
@RequiresPermissions("zcgl.zjlb")
public Object getZcMoney(@Param(value = "contentCode", required = false) String contentCode) {
List<Zgfw_Zcxx> zcxxes = baseService.dao().query(Zgfw_Zcxx.class, Cnd.NEW().andEX("contentCode", "=", contentCode));
//资产原值
Double allMoney = zcxxes.stream().mapToDouble(Zgfw_Zcxx::getAllMoney).sum();
//固定资产净值
Double surplusMoney = zcxxes.stream().filter(z -> !List.of("报废", "丢失").contains(z.getZczt())).mapToDouble(Zgfw_Zcxx::getSurplusMoney).sum();
//累计折旧
Double depreciationMoney = allMoney - surplusMoney;
return Map.of("allMoney", allMoney, "surplusMoney", surplusMoney, "depreciationMoney", depreciationMoney);
}
} }
@@ -0,0 +1,125 @@
package io.v.nutz.zhgh.zc.controller;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import io.v.nutz.base.annontation.ViReturn;import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.model.zgfwZclb;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.List;
/**
* TODO
*
* @Author zhf
* @Date 2022/10/25 9:51
*/
@IocBean
@Ok("json:full")
@At("/platform/zcgl/zclb")
public class zgfwZclbController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/zcgl/zclb.html")
@RequiresPermissions("zcgl.zclb")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doEdit(zgfwZclb zgfw_zclb,
@Param(value = "oldContentCode", required = false) String oldContentCode,
@Param(value = "oldDepreciationYear", required = false) String oldDepreciationYear) {
if (!oldContentCode.equals(zgfw_zclb.getContentCode())) {
zgfwZclb zgfwZclb = baseService.dao().fetch(zgfwZclb.class, Cnd.where("contentCode", "=", zgfw_zclb.getContentCode()));
if (zgfwZclb != null) {
return Result.error("编号重复");
}
}
if (!oldDepreciationYear.equals(zgfw_zclb.getDepreciationYear())) {
List<Zgfw_Zcxx> zcxxList = baseService.dao().query(Zgfw_Zcxx.class, Cnd.where("contentCode", "=", zgfw_zclb.getContentCode()));
if (zcxxList != null) {
zcxxList.forEach(v -> {
LocalDate rkLocalDate = v.getDepreciationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
Period period = Period.between(LocalDate.now(), rkLocalDate);
if ((period.getYears() * 12 + period.getMonths()) > 0) {
DateTime dateTime = DateUtil.parse(v.getZcgzrq(), "yyyy-MM-dd");
DateTime offsetDateTime = DateUtil.offset(dateTime, DateField.YEAR, zgfw_zclb.getDepreciationYear());
v.setDepreciationDate(offsetDateTime);
baseService.updateIgnoreNull(v);
}
});
}
}
baseService.update(zgfw_zclb);
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doAdd(zgfwZclb zgfw_zclb) {
zgfwZclb zgfwZclb = baseService.dao().fetch(zgfwZclb.class, Cnd.where("contentCode", "=", zgfw_zclb.getContentCode()));
if (zgfwZclb != null) {
return Result.error("编号重复");
}
baseService.insert(zgfw_zclb);
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object pageData(PageForm page,
@Param(value = "category", required = false) String category) {
Sql sql = Sqls.create("SELECT * FROM `zgfw_zclb` $condition");
Cnd cnd = Cnd.NEW();
if (StrUtil.isNotBlank(page.getSearchName()) && StrUtil.isNotBlank(page.getSearchKeyword())) {
cnd.and(Cnd.likeEX(page.getSearchName(), page.getSearchKeyword()));
}
cnd.andEX("category", "=", category);
cnd.asc("contentCode");
sql.setCondition(cnd);
return baseService.listPageMap(page.getPageNumber(), page.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object doDelete(String id) {
baseService.dao().clear(zgfwZclb.class, Cnd.where("id", "=", id));
return null;
}
@At
@ViReturn
@RequiresPermissions("zcgl.zclb")
public Object queryLb() {
return baseService.dao().query(zgfwZclb.class, Cnd.NEW().asc("contentCode"));
}
}
@@ -0,0 +1,48 @@
package io.v.nutz.zhgh.zc.model;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
/**
* @ClassName ZcDJPlan
* @Description TODO
* @Author zhf
* @Date 2024/2/27 14:16
*/
@Data
@Table
public class ZcPdPlan {
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("年度")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String year;
@Column
@Comment("开始时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String startDate;
@Column
@Comment("时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String endDate;
@Column
@Comment("说明")
@ColDefine(type = ColType.VARCHAR, width = 300)
private String note;
@Column
@Comment("创建时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String createDate;
}
@@ -0,0 +1,64 @@
package io.v.nutz.zhgh.zc.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* @ClassName ZgfwZcxxTemp
* @Description TODO
* @Author zhf
* @Date 2024/5/23 17:42
*/
@Data
public class ZgfwZcxxTemp {
@Excel(name = "资产编号", width = 20)
private String zcbh;
@Excel(name = "分类号", width = 20)
private String zcgbflh;
@Excel(name = "资产名称", width = 20)
private String zcmc;
@Excel(name = "型号规格", width = 20)
private String zcxh;
@Excel(name = "资产所属类别", width = 20)
private String contentCode;
@Excel(name = "数量", width = 10)
private Integer sl;
@Excel(name = "单价", width = 10)
private String zcdj;
@Excel(name = "厂家", width = 20)
private String zccj;
@Excel(name = "购置日期", importFormat = "yyyy-MM-dd", exportFormat = "yyyy-MM-dd", width = 20)
private String zcgzrq;
@Excel(name = "经费科目", width = 15)
private String fundingSubject;
@Excel(name = "存放地点", width = 20)
private String zccfdmc;
@Excel(name = "资产状态", width = 15)
private String zczt;
@Excel(name = "资产类型", width = 15)
private String zcghlx;
@Excel(name = "领用人", width = 20)
private String zclyrname;
private String zclyrid;
private String zclyrgh;
private String zclydwh;
}
@@ -1,16 +1,13 @@
package io.v.nutz.zhgh.zc.model; package io.v.nutz.zhgh.zc.model;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data; import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@Comment("资产信息")
@Table("Zgfw_Zcxx") @Table("Zgfw_Zcxx")
public class Zgfw_Zcxx implements Serializable { public class Zgfw_Zcxx implements Serializable {
@@ -19,187 +16,182 @@ public class Zgfw_Zcxx implements Serializable {
@Comment("ID") @Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")}) @Prev(els = {@EL("uuid()")})
private String id; private String zcid;
@Column @Column
@Comment("编号") @Comment("编号")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "编号", width = 20) private String zcbh;
private String assetNumber;
@Column @Column
@Comment("名称") @Comment("名称")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "名称", width = 20) private String zcmc;
private String assetName;
@Column
@Comment("财政六大类名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "财政六大类名称", width = 20)
private String financeSixName;
@Column
@Comment("领用单位id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String threeUnitId;
@Column
@Comment("领用单位")
@ColDefine(type = ColType.VARCHAR, width = 32)
// @Excel(name = "领用单位", width = 20)
private String threeUnitName;
@Column
@Comment("所属学院id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("所属学院")
@ColDefine(type = ColType.VARCHAR, width = 32)
// @Excel(name = "所属学院", width = 20)
private String unitName;
@Column @Column
@Comment("型号") @Comment("型号")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "型号", width = 20) private String zcxh;
private String assetModel;
@Column @Column
@Comment("原值") @Comment("规格")
@ColDefine(customType = "decimal", width = 10, precision = 2) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "原值", width = 20) private String zcgg;
private BigDecimal originalValue;
@Column @Column
@Comment("资产来源") @Comment("单价")
@ColDefine(type = ColType.VARCHAR, width = 50) @ColDefine(type = ColType.FLOAT, width = 30)
@Excel(name = "资产来源", width = 50) private String zcdj;
private String assetSources;
@Column @Column
@Comment("现状") @Comment("厂家")
@ColDefine(type = ColType.MYSQL_JSON) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "现状", width = 20) private String zccj;
private List<String> assetStatus;
@Column @Column
@Comment("最低使用年限") @Comment("出厂号")
@ColDefine(type = ColType.VARCHAR, width = 10) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "最低使用年限", width = 20) private String zccch;
private String minimumUsageYear;
@Column
@Comment("购置日期")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String zcgzrq;
@Column
@Comment("存放地名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String zccfdmc;
@Column @Column
@Comment("领用人id") @Comment("领用人id")
@ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
private String recipientUserId; private String zclyrid;
@Column @Column
@Comment("领用人姓名") @Comment("领用人姓名")
@ColDefine(type = ColType.VARCHAR, width = 50)
@Excel(name = "领用人姓名", width = 20)
private String recipientUsername;
@Column
@Comment("领用人工号")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String recipientLoginName;
@Column
@Comment("存放地")
@ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "存放地", width = 20) private String zclyrname;
private String storageLocation;
@Column @Column
@Comment("购置日期") @Comment("领用人工资号")
@ColDefine(type = ColType.VARCHAR, width = 20) @ColDefine(type = ColType.VARCHAR, width = 100)
// @Excel(name = "购置日期", importFormat = "yyyy-MM-dd", exportFormat = "yyyy-MM-dd", width = 30) private String zclyrgh;
private String purchaseDate;
@Column @Column
@Comment("入库日期") @Comment("经手人id")
@ColDefine(type = ColType.VARCHAR, width = 20) @ColDefine(type = ColType.VARCHAR, width = 32)
@Excel(name = "入库日期", importFormat = "yyyy-MM-dd", exportFormat = "yyyy-MM-dd", width = 30) private String zcjsrid;
private String storageDate;
@Column @Column
@Comment("主管部门备注") @Comment("经手人姓名")
@ColDefine(type = ColType.TEXT) @ColDefine(type = ColType.VARCHAR, width = 100)
// @Excel(name = "主管部门备注", width = 20) private String zcjsrname;
private String competentDepartmentRemark;
@Column @Column
@Comment("备注") @Comment("经手人工号")
@ColDefine(type = ColType.TEXT) @ColDefine(type = ColType.VARCHAR, width = 100)
@Excel(name = "备注", width = 20) private String zcjsrgh;
private String remark;
// @Column @Column
// @Comment("规格") @Comment("入库时间")
// @ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 30)
// private String zcgg; private String zcrksj;
// @Column @Column
// @Comment("单价") @Comment("单据号")
// @ColDefine(type = ColType.FLOAT, width = 30) @ColDefine(type = ColType.VARCHAR, width = 100)
// @Excel(name = "单价", width = 30) private String zcdjh;
// private String zcdj;
// @Column @Column
// @Comment("厂家") @Comment("合同号")
// @ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
// private String zccj; private String zchth;
// @Column @Column
// @Comment("出厂号") @Comment("经费卡号")
// @ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
// private String zccch; private String zcjfkh;
// @Column @Column
// @Comment("领用人id") @Comment("经费卡金额")
// @ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.FLOAT, width = 30)
// private String zclyrid; private BigDecimal zcjfkje;
// @Column @Column
// @Comment("领用人姓名") @Comment("国标分类号")
// @ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 50)
// private String zclyrname; private String zcgbflh;
// @Column @Column
// @Comment("领用人工资号") @Comment("分类号")
// @ColDefine(type = ColType.VARCHAR, width = 100) @ColDefine(type = ColType.VARCHAR, width = 50)
// private String zclyrgh; private String zcflh;
// @Column @Column
// @Comment("经手人id") @Comment("国别")
// @ColDefine(type = ColType.VARCHAR, width = 32) @ColDefine(type = ColType.VARCHAR, width = 10)
// private String zcjsrid; private String zcgb;
//
// @Column
// @Comment("经手人姓名")
// @ColDefine(type = ColType.VARCHAR, width = 100)
// private String zcjsrname;
//
// @Column
// @Comment("经手人工号")
// @ColDefine(type = ColType.VARCHAR, width = 100)
// private String zcjsrgh;
// @Column @Column
// @Comment("分工会资产、校工会资产") @Comment("发票号")
// @ColDefine(type = ColType.VARCHAR, width = 10) @ColDefine(type = ColType.VARCHAR, width = 100)
// @Excel(name = "所属工会类型", width = 30) private String zcfph;
// private String zcghlx;
// @Column @Column
// @Comment("数量") @Comment("供货商")
// @ColDefine(type = ColType.INT) @ColDefine(type = ColType.VARCHAR, width = 100)
// @Excel(name = "数量", width = 30) private String zcghs;
// private Integer sl;
@Column
@Comment("状态")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String zczt;
@Column
@Comment("领用单位")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String zclydwh;
@Column
@Comment("领用单位id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String zclydwhid;
@Column
@Comment("分工会资产、校工会资产")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String zcghlx;
@Column
@Comment("数量")
@ColDefine(type = ColType.INT)
private Integer sl;
@Column
@Comment("资产所属类别")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String contentCode;
@Column
@Comment("经费科目")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String fundingSubject;
@Column
@Comment("资产折旧到期时间")
@ColDefine(type = ColType.DATE)
private Date depreciationDate;
@Column
@Comment("剩余价值")
@ColDefine(type = ColType.DOUBLE)
private Double surplusMoney;
@Column
@Comment("资产全部的价值")
@ColDefine(type = ColType.DOUBLE)
private Double allMoney;
} }
@@ -1,143 +1,114 @@
package io.v.nutz.zhgh.zc.model; package io.v.nutz.zhgh.zc.model;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*; import org.nutz.dao.entity.annotation.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Comment("资产变更信息表") /**
* 表的字段名称以前端页面显示为准
*/
@Data
@Table("Zgfw_Zcxx_bdxx") @Table("Zgfw_Zcxx_bdxx")
public class Zgfw_Zcxx_bdxx implements Serializable { public class Zgfw_Zcxx_bdxx implements Serializable {
@Name @Name
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")}) @Prev(els = {@EL("uuid()")})
@Comment("资产变动信息id") @Comment("资产变动信息id")
private String zcbdid; private String zcbdid;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("资产id") @Comment("资产id")
private String zcid; private String zcid;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("原先领用人id") @Comment("原先领用人id")
private String zcoldlyrid; private String zcoldlyrid;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("原先单位id") @Comment("原先单位id")
private String zcoldlydwh; private String zcoldlydwh;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("原先存放地点") @Comment("原先存放地点")
private String zcoldcfdmc; private String zcoldcfdmc;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("现在领用人id") @Comment("现在领用人id")
private String zcnowlyrid; private String zcnowlyrid;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("现在单位id") @Comment("现在单位id")
private String zcnowlydwh; private String zcnowlydwh;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("现在单位id")
private String zcnowlydwhid;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 100) @ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("现在存放地点") @Comment("现在存放地点")
private String zcnowcfdmc; private String zcnowcfdmc;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 20) @ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("变动日期") @Comment("变动日期")
private String zcbdsj; private String zcbdsj;
@Column @Column
@ColDefine(type = ColType.VARCHAR,width = 32) @ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("变动审核人") @Comment("变动审核人")
private String zcbdshrid; private String zcbdshrid;
@Column
@Comment("购置时间")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String zcgzrq;
public String getZcbdid() { @Column
return zcbdid; @Comment("账面价值")
} @ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
private Integer zmjz;
public void setZcbdid(String zcbdid) { @Column
this.zcbdid = zcbdid; @Comment("联系电话")
} @ColDefine(type = ColType.VARCHAR, width = 20)
private String mobile;
public String getZcid() { @Column
return zcid; @Comment("盘点状态")
} @ColDefine(type = ColType.VARCHAR, width = 10)
private String pdzt;
public void setZcid(String zcid) { @Column
this.zcid = zcid; @Comment("未盘点原因")
} @ColDefine(type = ColType.VARCHAR, width = 10)
private String wpdzt;
public String getZcoldlyrid() { @Column
return zcoldlyrid; @Comment("状态")
} @ColDefine(type = ColType.VARCHAR, width = 10)
private String zczt;
public void setZcoldlyrid(String zcoldlyrid) { @Column
this.zcoldlyrid = zcoldlyrid; @Comment("盘点计划id")
} @ColDefine(type = ColType.VARCHAR, width = 32)
private String pdPlanId;
public String getZcoldlydwh() { @Column
return zcoldlydwh; @Comment("资产照片")
} @ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> zcFile;
public void setZcoldlydwh(String zcoldlydwh) {
this.zcoldlydwh = zcoldlydwh;
}
public String getZcoldcfdmc() {
return zcoldcfdmc;
}
public void setZcoldcfdmc(String zcoldcfdmc) {
this.zcoldcfdmc = zcoldcfdmc;
}
public String getZcnowlyrid() {
return zcnowlyrid;
}
public void setZcnowlyrid(String zcnowlyrid) {
this.zcnowlyrid = zcnowlyrid;
}
public String getZcnowlydwh() {
return zcnowlydwh;
}
public void setZcnowlydwh(String zcnowlydwh) {
this.zcnowlydwh = zcnowlydwh;
}
public String getZcnowcfdmc() {
return zcnowcfdmc;
}
public void setZcnowcfdmc(String zcnowcfdmc) {
this.zcnowcfdmc = zcnowcfdmc;
}
public String getZcbdsj() {
return zcbdsj;
}
public void setZcbdsj(String zcbdsj) {
this.zcbdsj = zcbdsj;
}
public String getZcbdshrid() {
return zcbdshrid;
}
public void setZcbdshrid(String zcbdshrid) {
this.zcbdshrid = zcbdshrid;
}
} }
@@ -13,7 +13,6 @@ import java.util.Date;
*/ */
@Data @Data
@Table @Table
@Comment("资产折旧记录表")
public class zcDepreciationRecord { public class zcDepreciationRecord {
@Column @Column
@@ -35,6 +34,11 @@ public class zcDepreciationRecord {
@ColDefine(type = ColType.INT, width = 30) @ColDefine(type = ColType.INT, width = 30)
private int surplus; private int surplus;
@Column
@Comment("剩余价值")
@ColDefine(type = ColType.DOUBLE)
private Double surplusMoney;
@Column @Column
@Comment("操作日期") @Comment("操作日期")
@@ -11,8 +11,7 @@ import org.nutz.dao.entity.annotation.*;
*/ */
@Table @Table
@Data @Data
@Comment("资产类型") public class zgfwZclb {
public class ZgfwZclb {
@Column @Column
@Name @Name
@@ -32,8 +31,14 @@ public class ZgfwZclb {
private String contentCode; private String contentCode;
@Column @Column
@Comment("状态名称") @Comment("所属类别")
@ColDefine(type = ColType.VARCHAR, width = 30) @ColDefine(type = ColType.VARCHAR, width = 30)
private String categoryName; private String category;
@Column
@Comment("折旧年限(年)")
@ColDefine(type = ColType.INT, width = 30)
private int depreciationYear;
} }
@@ -2,9 +2,9 @@ package io.v.nutz.zhgh.zc.service;
import cn.wizzer.framework.base.service.BaseService; import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.zhgh.zc.model.ZgfwZcxxTemp;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx; import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import org.nutz.lang.util.NutMap;
import java.util.List;
public interface ZgfwZcxxService extends BaseService<Zgfw_Zcxx> { public interface ZgfwZcxxService extends BaseService<Zgfw_Zcxx> {
/** /**
@@ -27,14 +27,16 @@ public interface ZgfwZcxxService extends BaseService<Zgfw_Zcxx> {
* @param zgfw_zcxxes * @param zgfw_zcxxes
* @return * @return
*/ */
List<Zgfw_Zcxx> matchAssetSataus(List<Zgfw_Zcxx> zgfw_zcxxes); ZgfwZcxxTemp[] matchUserId(ZgfwZcxxTemp[] zgfw_zcxxes);
/** /**
* 不解释 * 不解释
* *
* @param userName 不解释 * @param userName 不解释
* @param loginName 不解释
* @return * @return
*/ */
String getUserId(String userName, String loginName); Object getUserId(String userName);
NutMap findOne(String id);
} }
@@ -1,28 +1,17 @@
package io.v.nutz.zhgh.zc.service.impl; package io.v.nutz.zhgh.zc.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import io.v.nutz.base.service.impl.ViServiceImpl; import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.zhgh.zc.model.ZgfwZclb; import io.v.nutz.zhgh.zc.model.ZgfwZcxxTemp;
import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx; import io.v.nutz.zhgh.zc.model.Zgfw_Zcxx;
import io.v.nutz.zhgh.zc.service.ZgfwZcxxService; import io.v.nutz.zhgh.zc.service.ZgfwZcxxService;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@IocBean(args = {"refer:dao"}) @IocBean(args = {"refer:dao"})
public class ZgfwZcxxServiceImpl extends ViServiceImpl<Zgfw_Zcxx> implements ZgfwZcxxService { public class ZgfwZcxxServiceImpl extends ViServiceImpl<Zgfw_Zcxx> implements ZgfwZcxxService {
@@ -30,18 +19,12 @@ public class ZgfwZcxxServiceImpl extends ViServiceImpl<Zgfw_Zcxx> implements Zgf
super(dao); super(dao);
} }
@Override @Override
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
public void doAddByExcelImport(Zgfw_Zcxx[] zxccList) { public void doAddByExcelImport(Zgfw_Zcxx[] zxccList) {
for (Zgfw_Zcxx zgfw_zcxx : zxccList) {
Arrays.stream(zxccList).forEach(v->{ zgfw_zcxx.setZcghlx(zgfw_zcxx.getZcghlx().equals("院级工会固定资产") ? "1" : "2");
if (v.getOriginalValue() != null && !v.getOriginalValue().equals(BigDecimal.ZERO)) { }
BigDecimal originalValue = v.getOriginalValue().setScale(2, RoundingMode.HALF_UP);
v.setOriginalValue(originalValue);
}
});
dao().insert(zxccList); dao().insert(zxccList);
} }
@@ -51,24 +34,49 @@ public class ZgfwZcxxServiceImpl extends ViServiceImpl<Zgfw_Zcxx> implements Zgf
} }
@Override @Override
public List<Zgfw_Zcxx> matchAssetSataus(List<Zgfw_Zcxx> zxccList) { public ZgfwZcxxTemp[] matchUserId(ZgfwZcxxTemp[] zxccList) {
List<ZgfwZclb> query = dao().query(ZgfwZclb.class, Cnd.NEW()); for (ZgfwZcxxTemp zcxx : zxccList) {
zxccList.forEach(v->{ if (StrUtil.isNotBlank(zcxx.getZclyrname())) {
List<String> collect = query.stream().filter(item -> v.getAssetStatus() NutMap user = getUserId(zcxx.getZclyrname());
.contains(item.getCategoryName())).map(ZgfwZclb::getContentCode).collect(Collectors.toList()); zcxx.setZclyrid(user.getString("id"));
if (Lang.isNotEmpty(collect)) return; zcxx.setZclyrgh(user.getString("loginname"));
v.setAssetStatus(collect); }
}); if (StrUtil.isNotBlank(zcxx.getZcghlx())) {
if (zcxx.getZcghlx().equals("1")) {
} else if (zcxx.getZcghlx().equals("2")) {
zcxx.setZclydwh("工会");
}
}
}
return zxccList; return zxccList;
} }
@Override @Override
public String getUserId(String userName, String loginName) { public NutMap getUserId(String userName) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT id FROM sys_user where username = @username and loginname = @loginname SELECT id,loginname FROM sys_user where username = @username
"""); """);
sql.setParam("username", userName); sql.setParam("username", userName);
sql.setParam("loginname", loginName); return fetch(sql);
return (String) Daos.query(dao(), sql.toString(), Sqls.callback.str()); }
@Override
public NutMap findOne(String id) {
Sql sql = Sqls.create("""
SELECT
xx.*,
lb.content
FROM
`zgfw_zcxx` xx
LEFT JOIN zgfw_zclb lb ON xx.contentCode = lb.contentCode
WHERE xx.zcid=@id
""").setParam("id", id);
sql.setCallback(Sqls.callback.map());
dao().execute(sql);
NutMap viewData = sql.getObject(NutMap.class);
return viewData;
} }
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,608 @@
<template>
<div class="slide-verify" :style="'width:' + canvaswidth + 'px'" onselectstart="return false;">
<!-- 图片加载遮蔽罩 -->
<div :class="isLoading ? 'img-loading' : ''" :style="'height:' + canvasheight + 'px'" v-if="isLoading"></div>
<!-- 认证成功后的文字提示 -->
<div class="success-hint" :style="'height:' + canvasheight + 'px'" v-if="verifySuccess">{{ successHint }}</div>
<!--前端生成-->
<template v-if="isFrontCheck">
<!--验证图片-->
<canvas ref="canvas" class="slide-canvas" :width="canvaswidth" :height="canvasheight"/>
<!--阻塞块-->
<canvas ref="block" class="slide-block" :width="canvaswidth" :height="canvasheight"/>
</template>
<!--后端生成-->
<template v-else>
<!--验证图片-->
<img ref="canvas" class="slide-canvas" :width="canvaswidth" :height="canvasheight"/>
<!--阻塞块-->
<img ref="block" :class="verifyFail ? 'slide-block verify-fail' : 'slide-block'"/>
</template>
<!--刷新按钮-->
<div class="refresh" @click="refresh"><i class="el-icon-refresh-right"></i>刷新</div>
<!-- 滑动条 -->
<div :class="getClass()">
<!--滑块-->
<div class="slider-box" :style="'width:' + sliderBoxWidth">
<!-- 按钮 -->
<div class="slider-button" id="slider-button" :style="'left:' + sliderButtonLeft">
<!-- 按钮图标 -->
<div class="slider-button-icon"></div>
</div>
</div>
<!--滑动条提示文字-->
<span class="slider-hint">{{ sliderhint }}</span>
</div>
</div>
</template>
<script>
function sum(x, y) {
return x + y;
}
function square(x) {
return x * x;
}
module.exports = {
props: {
// 阻塞块长度
blocklength: {
type: Number,
default: 42,
},
// 阻塞块弧度
blockradius: {
type: Number,
default: 10,
},
// 画布宽度
canvaswidth: {
type: Number,
default: 320,
},
// 画布高度
canvasheight: {
type: Number,
default: 155,
},
// 滑块操作提示
sliderhint: {
type: String,
default: '向右滑动',
},
// 可允许的误差范围小;为1时,则表示滑块要与凹槽完全重叠,才能验证成功。默认值为5,若为 -1 则不进行机器判断
accuracy: {
type: Number,
default: 3,
},
// 图片资源数组
imagelist: {
type: Array,
default: () => [],
},
},
data() {
return {
// 前端校验
isFrontCheck: false,
// 校验进行状态
verifyActive: false,
// 校验成功状态
verifySuccess: false,
// 校验失败状态
verifyFail: false,
// 阻塞块对象
blockObj: null,
// 图片画布对象
canvasCtx: null,
// 阻塞块画布对象
blockCtx: null,
// 阻塞块宽度
blockWidth: this.blocklength * 2,
// 阻塞块的横轴坐标
blockX: undefined,
// 阻塞块的纵轴坐标
blockY: undefined,
// 图片对象
image: undefined,
// 移动的X轴坐标
originX: undefined,
// 移动的Y轴做坐标
originY: undefined,
// 拖动距离数组
dragDistanceList: [],
// 滑块箱拖动宽度
sliderBoxWidth: 0,
// 滑块按钮距离左侧起点位置
sliderButtonLeft: 0,
// 鼠标按下状态
isMouseDown: false,
// 图片加载提示,防止图片没加载完就开始验证
isLoading: true,
// 时间戳,计算滑动时长
timestamp: null,
// 成功提示
successHint: '',
// 随机字符串
nonceStr: undefined,
};
},
mounted() {
this.init();
},
methods: {
getClass() {
let str = 'slider '
if(this.verifyActive) {
str += 'verify-active '
}
if(this.verifySuccess) {
str += 'verify-success '
}
if(this.verifyFail) {
str += 'verify-fail '
}
return str
},
/* 初始化*/
init() {
this.initDom();
this.bindEvents();
},
/* 初始化DOM对象*/
initDom() {
this.blockObj = this.$refs.block;
if (this.isFrontCheck) {
this.canvasCtx = this.$refs.canvas.getContext('2d');
this.blockCtx = this.blockObj.getContext('2d');
this.initImage();
} else {
this.getCaptcha();
}
},
/* 后台获取验证码*/
async getCaptcha() {
let self = this;
//取后端默认值
const response = await $.post('/captcha/get-captcha')
const data = response.data;
self.nonceStr = data.nonceStr;
self.$refs.block.src = data.blockSrc;
self.$refs.block.style.top = data.blockY + 'px';
self.$refs.canvas.src = data.canvasSrc;
self.isLoading = false;
},
/* 前端获取验证码*/
initImage() {
const image = this.createImage(() => {
this.drawBlock();
let {canvaswidth, canvasheight, blockX, blockY, blockradius, blockWidth} = this;
this.canvasCtx.drawImage(image, 0, 0, canvaswidth, canvasheight);
this.blockCtx.drawImage(image, 0, 0, canvaswidth, canvasheight);
// 将抠图防止最左边位置
let yAxle = blockY - blockradius * 2;
let ImageData = this.blockCtx.getImageData(blockX, yAxle, blockWidth, blockWidth);
this.blockObj.width = blockWidth;
this.blockCtx.putImageData(ImageData, 0, yAxle);
// 图片加载完关闭遮蔽罩
this.isLoading = false;
// 前端校验设置特殊值
this.nonceStr = 'loyer';
});
this.image = image;
},
/* 创建image对象*/
createImage(onload) {
const image = document.createElement('img');
image.crossOrigin = 'Anonymous';
image.onload = onload;
image.onerror = () => {
image.src = '/assets/platform/img/bjt.jpg';
};
image.src = this.getImageSrc();
return image;
},
/* 获取imgSrc*/
getImageSrc() {
const len = this.imagelist.length;
return len > 0 ? this.imagelist[this.getNonceByRange(0, len)] : `https://loyer.wang/view/ftp/wallpaper/${this.getNonceByRange(1, 1000)}.jpg`;
},
/* 根据指定范围获取随机数*/
getNonceByRange(start, end) {
return Math.round(Math.random() * (end - start) + start);
},
/* 绘制阻塞块*/
drawBlock() {
this.blockX = this.getNonceByRange(this.blockWidth + 10, this.canvaswidth - (this.blockWidth + 10));
this.blockY = this.getNonceByRange(10 + this.blockradius * 2, this.canvasheight - (this.blockWidth + 10));
this.draw(this.canvasCtx, 'fill');
this.draw(this.blockCtx, 'clip');
},
/* 绘制事件*/
draw(ctx, operation) {
const PI = Math.PI;
let {blockX: x, blockY: y, blocklength: l, blockradius: r} = this;
// 绘制
ctx.beginPath();
ctx.moveTo(x, y);
ctx.arc(x + l / 2, y - r + 2, r, 0.72 * PI, 2.26 * PI);
ctx.lineTo(x + l, y);
ctx.arc(x + l + r - 2, y + l / 2, r, 1.21 * PI, 2.78 * PI);
ctx.lineTo(x + l, y + l);
ctx.lineTo(x, y + l);
ctx.arc(x + r - 2, y + l / 2, r + 0.4, 2.76 * PI, 1.24 * PI, true);
ctx.lineTo(x, y);
// 修饰
ctx.lineWidth = 2;
ctx.fillStyle = 'rgba(255, 255, 255, 0.9)';
ctx.strokeStyle = 'rgba(255, 255, 255, 0.9)';
ctx.stroke();
ctx[operation]();
ctx.globalCompositeOperation = 'destination-over';
},
/* 事件绑定*/
bindEvents() {
// 监听鼠标按下事件
document.getElementById('slider-button').addEventListener('mousedown', (event) => {
this.startEvent(event.clientX, event.clientY);
});
// 监听鼠标移动事件
document.addEventListener('mousemove', (event) => {
this.moveEvent(event.clientX, event.clientY);
});
// 监听鼠标离开事件
document.addEventListener('mouseup', (event) => {
this.endEvent(event.clientX);
});
// 监听触摸开始事件
document.getElementById('slider-button').addEventListener('touchstart', (event) => {
this.startEvent(event.changedTouches[0].pageX, event.changedTouches[0].pageY);
});
// 监听触摸滑动事件
document.addEventListener('touchmove', (event) => {
this.moveEvent(event.changedTouches[0].pageX, event.changedTouches[0].pageY);
});
// 监听触摸离开事件
document.addEventListener('touchend', (event) => {
this.endEvent(event.changedTouches[0].pageX);
});
},
/* 校验图片是否存在*/
checkImgSrc() {
if (this.isFrontCheck) {
return true;
}
return !!this.$refs.canvas.src;
},
/* 滑动开始事件*/
startEvent(originX, originY) {
if (!this.checkImgSrc() || this.isLoading || this.verifySuccess) {
return;
}
this.originX = originX;
this.originY = originY;
this.isMouseDown = true;
this.timestamp = +new Date();
},
/* 滑动事件*/
moveEvent(originX, originY) {
if (!this.isMouseDown) {
return false;
}
const moveX = originX - this.originX;
const moveY = originY - this.originY;
if (moveX < 0 || moveX + 40 >= this.canvaswidth) {
return false;
}
this.sliderButtonLeft = moveX + 'px';
let blockLeft = (this.canvaswidth - 40 - 20) / (this.canvaswidth - 40) * moveX;
this.blockObj.style.left = blockLeft + 'px';
this.verifyActive = true;
this.sliderBoxWidth = moveX + 'px';
this.dragDistanceList.push(moveY);
},
/* 滑动结束事件*/
endEvent(originX) {
if (!this.isMouseDown) {
return false;
}
this.isMouseDown = false;
if (originX === this.originX) {
return false;
}
// 开始校验
this.isLoading = true;
// 校验结束
this.verifyActive = false;
// 滑动时长
this.timestamp = +new Date() - this.timestamp;
// 移动距离
const moveLength = parseInt(this.blockObj.style.left);
// 限制操作时长10S,超出判断失败
if (this.timestamp > 10000) {
this.verifyFailEvent();
} else
// 人为操作判定
if (!this.turingTest()) {
this.verifyFail = true;
this.$emit('again');
} else
// 是否前端校验
if (this.isFrontCheck) {
const accuracy = this.accuracy <= 1 ? 1 : this.accuracy > 10 ? 10 : this.accuracy; // 容错精度值
const spliced = Math.abs(moveLength - this.blockX) <= accuracy; // 判断是否重合
if (!spliced) {
this.verifyFailEvent();
} else {
// 设置特殊值,后台特殊处理,直接验证通过
this.$emit('success', {nonceStr: this.nonceStr, value: moveLength});
}
} else {
this.$emit('success', {nonceStr: this.nonceStr, value: moveLength});
}
},
/* 图灵测试*/
turingTest() {
const arr = this.dragDistanceList; // 拖动距离数组
const average = arr.reduce(sum) / arr.length; // 平均值
const deviations = arr.map((x) => x - average); // 偏离值
const stdDev = Math.sqrt(deviations.map(square).reduce(sum) / arr.length); // 标准偏差
return average !== stdDev; // 判断是否人为操作
},
/* 校验成功*/
verifySuccessEvent() {
this.isLoading = false;
this.verifySuccess = true;
const elapsedTime = (this.timestamp / 1000).toFixed(1);
if (elapsedTime < 1) {
this.successHint = `仅仅${elapsedTime}S,你的速度快如闪电`;
} else if (elapsedTime < 2) {
this.successHint = `只用了${elapsedTime}S,这速度简直完美`;
} else {
this.successHint = `耗时${elapsedTime}S,争取下次再快一点`;
}
},
/* 校验失败*/
verifyFailEvent(msg) {
this.verifyFail = true;
this.$emit('fail', msg);
this.refresh();
},
/* 刷新图片验证码*/
refresh() {
// 延迟class的删除,等待动画结束
setTimeout(() => {
this.verifyFail = false;
}, 500);
this.isLoading = true;
this.verifyActive = false;
this.verifySuccess = false;
this.blockObj.style.left = 0;
this.sliderBoxWidth = 0;
this.sliderButtonLeft = 0;
if (this.isFrontCheck) {
// 刷新画布
let {canvaswidth, canvasheight} = this;
this.canvasCtx.clearRect(0, 0, canvaswidth, canvasheight);
this.blockCtx.clearRect(0, 0, canvaswidth, canvasheight);
this.blockObj.width = canvaswidth;
// 刷新图片
this.image.src = this.getImageSrc();
} else {
this.getCaptcha();
}
},
},
};
</script>
<style scoped>
.slide-verify {
position: relative;
}
/*图片加载样式*/
.img-loading {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 999;
animation: loading 1.5s infinite;
background-image: url(/assets/platform/img/captcha/loading.gif);
background-repeat: no-repeat;
background-position: center center;
background-size: 100px;
background-color: #737c8e;
border-radius: 5px;
}
@keyframes loading {
0% {
opacity: .7;
}
100% {
opacity: 9;
}
}
/*认证成功后的文字提示*/
.success-hint {
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.8);
color: #2CD000;
font-size: large;
}
/*刷新按钮*/
.refresh-icon {
position: absolute;
right: 0;
top: 0;
width: 35px;
height: 35px;
cursor: pointer;
background: url("/assets/platform/img/captcha/refresh.svg") 0 -432px;
background-size: 35px 470px;
}
/*验证图片*/
.slide-canvas {
border-radius: 5px;
}
/*阻塞块*/
.slide-block {
position: absolute;
left: 0;
top: 0;
}
/*校验失败时的阻塞块样式*/
.slide-block.verify-fail {
transition: left 0.5s linear;
}
/*滑动条*/
.slider {
position: relative;
text-align: center;
width: 100%;
height: 40px;
line-height: 40px;
margin-top: 15px;
background: #f7f9fa;
color: #45494c;
border: 1px solid #e4e7eb;
border-radius: 5px;
}
/*滑动盒子*/
.slider-box {
position: absolute;
left: 0;
top: 0;
height: 40px;
border: 0 solid #1991FA;
background: #D1E9FE;
border-radius: 5px;
}
/*滑动按钮*/
.slider-button {
position: absolute;
top: 0;
left: 0;
width: 40px;
height: 40px;
background: #fff;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
cursor: pointer;
transition: background .2s linear;
border-radius: 5px;
}
/*鼠标悬浮时的按钮样式*/
.slider-button:hover {
background: #1991FA
}
/*鼠标悬浮时的按钮图标样式*/
.slider-button:hover .slider-button-icon {
/*background-position: 0 -13px*/
background-image: url("/assets/platform/img/captcha/white_right.svg");
}
/*滑动按钮图标*/
.slider-button-icon {
position: absolute;
top: 15px;
left: 13px;
width: 15px;
height: 13px;
background-image: url("/assets/platform/img/captcha/right.svg");
background-repeat: no-repeat;
background-position: center center;
}
/*校验时的按钮样式*/
.verify-active .slider-button {
height: 38px;
top: -1px;
border: 1px solid #1991FA;
}
/*校验时的滑动箱样式*/
.verify-active .slider-box {
height: 38px;
border-width: 1px;
}
/*校验成功时的滑动箱样式*/
.verify-success .slider-box {
height: 38px;
border: 1px solid #52CCBA;
background-color: #D2F4EF;
}
/*校验成功时的按钮样式*/
.verify-success .slider-button {
height: 38px;
top: -1px;
border: 1px solid #52CCBA;
background-color: #52CCBA !important;
}
/*校验成功时的按钮图标样式*/
.verify-success .slider-button-icon {
/*background-position: 0 0 !important;*/
background-image: url("/assets/platform/img/captcha/ok.svg");
}
/*校验失败时的滑动箱样式*/
.verify-fail .slider-box {
height: 38px;
border: 1px solid #f57a7a;
background-color: #fce1e1;
transition: width 0.5s linear;
}
/*校验失败时的按钮样式*/
.verify-fail .slider-button {
height: 38px;
top: -1px;
border: 1px solid #f57a7a;
background-color: #f57a7a !important;
transition: left 0.5s linear;
}
/*校验失败时的按钮图标样式*/
.verify-fail .slider-button-icon {
top: 14px;
/*background-position: 0 -82px !important;*/
background-image: url("/assets/platform/img/captcha/close.svg");
}
/*校验状态下的提示文字隐藏*/
.verify-active .slider-hint,
.verify-success .slider-hint,
.verify-fail .slider-hint {
display: none;
}
.refresh {
text-align: right;
font-size: 16px;
cursor: pointer;
}
</style>
@@ -37,11 +37,14 @@
</el-form-item> </el-form-item>
<el-form-item prop="type" label="变更类型"> <el-form-item prop="type" label="变更类型">
<dict-select v-model="formData.type" style="width: 100%" clearable placeholder="变更类型" <!-- <dict-select v-model="formData.type" style="width: 100%" clearable placeholder="变更类型"-->
code="MemberChangeType" @change="typeChange"></dict-select> <!-- code="MemberChangeType" @change="typeChange"></dict-select>-->
<el-select v-model="formData.type" style="width: 100%" clearable placeholder="变更类型" @change="typeChange">
<el-option v-for="item in userChangeTypeList" :label="item.name" :value="item.code" :key="item.id"></el-option>
</el-select>
</el-form-item> </el-form-item>
<!--单位异动--> <!--异动-->
<div v-if="formData.type==='1'"> <div v-if="formData.type==='1'">
<el-form-item prop="type" label="新&ensp;单&ensp;位"> <el-form-item prop="type" label="新&ensp;单&ensp;位">
<el-select v-model="formData.currentUnitId" style="width: 100%" filterable clearable <el-select v-model="formData.currentUnitId" style="width: 100%" filterable clearable
@@ -81,30 +84,102 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!--离校 离退休--> <div v-else-if="welfare_member&&['2'].includes(formData.type)">
<div v-if="formData.type && !['1','7','8'].includes(formData.type)"> <el-form-item prop="updateWelfareMember" label="福利会员">
<div> <el-radio-group v-model="formData.updateWelfareMember" size="small">
<el-form-item prop="updateMember" label="工会会员资格"> <el-radio :label="true" border>享受福利</el-radio>
<el-switch <el-radio :label="false" border>不享受福利</el-radio>
v-model="formData.updateMember" </el-radio-group>
active-text="移除" </el-form-item>
inactive-text="添加"> <el-form-item prop="insertMember" label="工会会员">
</el-switch> <el-radio-group v-model="formData.insertMember" size="small">
</el-form-item> <el-radio :label="true" border>成为会员</el-radio>
</div> <el-radio :label="false" border>不成为会员</el-radio>
</el-radio-group>
<el-form-item prop="updateWelfare" label="福利会员资格">
<el-switch
v-model="formData.updateWelfare"
active-text="移除"
inactive-text="添加">
</el-switch>
</el-form-item> </el-form-item>
</div> </div>
<div v-else-if="welfare_member&&['7'].includes(formData.type)">
<el-form-item prop="updateWelfareMember" label="福利会员">
<el-radio-group v-model="formData.updateWelfareMember" size="small">
<el-radio :label="true" border>享受福利</el-radio>
<el-radio :label="false" border>不享受福利</el-radio>
</el-radio-group>
</el-form-item>
</div>
<div v-else-if="welfare_member&&['3','4','5','6','8'].includes(formData.type)">
<el-form-item prop="updateWelfare" label="福利会员">
<el-radio-group v-model="formData.updateWelfare" size="small">
<el-radio :label="true" border>取消享受福利</el-radio>
<el-radio :label="false" border>保留享受福利</el-radio>
</el-radio-group>
<!-- <span style="color: red">&emsp;&emsp;&emsp;温馨提醒:此操作将取消该教工正式会员资格</span>-->
</el-form-item>
<el-form-item prop="updateMember" label="工会会员">
<el-radio-group v-model="formData.updateMember" size="small">
<el-radio :label="true" border>取消会员资格</el-radio>
<el-radio :label="false" border>保留会员资格</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="updateUserState" label="是否改变在职状态" style="width: 100%"
v-if="welfare_member&&['3','4','5','6','8'].includes(formData.type)">
<dict-select v-model="formData.userState" style="width: 100%" clearable placeholder="变更类型"
code="userState"></dict-select>
</el-form-item>
<el-form-item prop="updateUserState" label="是否改变人员类型" style="width: 100%"
v-if="welfare_member&&['3','4','5','6','8'].includes(formData.type)">
<dict-select v-model="formData.personType" style="width: 100%" clearable
placeholder="人员类型"
code="UserType"></dict-select>
</el-form-item>
</div>
<div v-else-if="formData.type==='10'">
<el-form-item prop="oldIdCard" label="原身份证号" style="width: 100%">
<el-input v-model="formData.oldIdCard" readonly type="text"></el-input>
</el-form-item>
<el-form-item prop="idCard" label="新的身份证号" style="width: 100%">
<el-input v-model="formData.idCard" placeholder="请输入新的身份证号" type="text"></el-input>
</el-form-item>
</div>
<div v-else-if="formData.type==='11'">
<el-form-item prop="oldMobile" label="原手机号码" style="width: 100%">
<el-input v-model="formData.oldMobile" readonly type="text"></el-input>
</el-form-item>
<el-form-item prop="mobile" label="新的手机号码" style="width: 100%">
<el-input v-model="formData.mobile" placeholder="请输入新的手机号码" type="text"></el-input>
</el-form-item>
</div>
<div v-else-if="formData.type==='12'">
<el-form-item prop="oldEducation" label="原学历" style="width: 100%">
<el-input v-model="formData.oldEducation" readonly type="text"></el-input>
</el-form-item>
<el-form-item prop="education" label="新的学历" style="width: 100%">
<dict-select v-model="formData.education" style="width: 100%" clearable placeholder="请选择新的学历"
code="Education"></dict-select>
</el-form-item>
</div>
<!-- <div v-else-if="welfare_member&&['2','7'].includes(formData.type)">
<el-form-item prop="updateWelfareMember" label="是否享受福利">
<el-switch
v-model="formData.updateWelfareMember"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
<span style="color: red">&emsp;&emsp;&emsp;温馨提醒:此操作将该教工设为正式会员</span>
</el-form-item>
</div>-->
<el-form-item prop="remark" label="变化原因"> <el-form-item prop="remark" label="变化原因">
<el-input v-model="formData.remark" placeholder="变化原因" type="textarea" :rows="4"></el-input> <el-input v-model="formData.remark" placeholder="变化原因" type="textarea" :rows="4"></el-input>
</el-form-item> </el-form-item>
@@ -122,10 +197,11 @@
<script> <script>
module.exports = { module.exports = {
components: { components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
}, },
props: { props: {
userid: {type: String}, userid: {type: String},
welfare_member: {type: Boolean, default: false}, welfare_member: {type: Boolean, default: true},
}, },
data() { data() {
return { return {
@@ -136,18 +212,22 @@ module.exports = {
formData: {}, formData: {},
formRules: { formRules: {
type: [{required: true, message: '必选', trigger: ['blur', 'change']}], type: [{required: true, message: '必选', trigger: ['blur', 'change']}],
updateWelfareMember: [{required: true, message: '必选', trigger: ['blur', 'change']}],
updateMember: [{required: true, message: '必选', trigger: ['blur', 'change']}], updateMember: [{required: true, message: '必选', trigger: ['blur', 'change']}],
updateWelfare: [{required: true, message: '必选', trigger: ['blur', 'change']}], updateWelfare: [{required: true, message: '必选', trigger: ['blur', 'change']}],
currentUnitId: [{required: true, message: '必选', trigger: ['blur', 'change']}], currentUnitId: [{required: true, message: '必选', trigger: ['blur', 'change']}],
currentThreeUnitId: [{required: true, message: '请选择新三级单位', trigger: 'change'}] currentThreeUnitId: [{required: true, message: '请选择新三级单位', trigger: 'change'}],
idCard: [{required: true, message: '必填', trigger: ['blur', 'change']}],
mobile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
education: [{required: true, message: '必填', trigger: ['blur', 'change']}],
insertMember: [{required: true, message: '必填', trigger: ['blur', 'change']}],
}, },
unitOptions: [], unitOptions: [],
threeUnits: [], threeUnits: [],
isThreeUnit: false, isThreeUnit: false,
memberChangeTypeOptions: [] userChangeTypeList:[],
} }
}, },
watch: { watch: {
@@ -157,16 +237,14 @@ module.exports = {
}, },
methods: { methods: {
typeChange() { typeChange() {
console.log(this.formData.type) this.$set(this.formData, "updateWelfareMember", ['2','7'].includes(this.formData.type))
this.$set(this.formData, "updateWelfare", ['3', '5'].includes(this.formData.type)) this.$set(this.formData, "updateWelfare", ['2', '3', '4', '5', '6', '8'].includes(this.formData.type))
this.$set(this.formData, "updateMember", ['3', '5'].includes(this.formData.type)) this.$set(this.formData, "updateMember", ['2', '3', '4', '5', '6', '8'].includes(this.formData.type))
this.$set(this.formData, "insertMember", ['2'].includes(this.formData.type))
}, },
async doSubmit() { async doSubmit() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.formData.type != 1) {
this.formData.userState = this.memberChangeTypeOptions.find(v => v.code === this.formData.type)?.name
}
this.submitLoading = true this.submitLoading = true
this.$emit("submit", this.formData) this.$emit("submit", this.formData)
} }
@@ -239,9 +317,13 @@ module.exports = {
originUnitId: resp.data.unitid, originUnitId: resp.data.unitid,
originThreeUnitId: resp.data.threeUnitId, originThreeUnitId: resp.data.threeUnitId,
originUnionId: resp.data.unionid, originUnionId: resp.data.unionid,
// userState: resp.data.userState, userState: resp.data.userState,
personType: resp.data.personType,
auditTime: moment().format('YYYY-MM-DD'), auditTime: moment().format('YYYY-MM-DD'),
notes: null notes: null,
oldIdCard:resp.data.idcard,
oldMobile:resp.data.mobile,
oldEducation:resp.data.education
} }
this.disabled = false this.disabled = false
} else { } else {
@@ -258,17 +340,19 @@ module.exports = {
if (resp.code === 0) { if (resp.code === 0) {
this.unitOptions = resp.data this.unitOptions = resp.data
} }
} },
async getUserChangeType(){
const resp = await $.get('/platform/member/common/getUserChangType')
if (resp.code === 0){
this.userChangeTypeList = resp.data
}
},
}, },
async created() { async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true' this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
this.getUnits() await this.getUnits()
this.flush() await this.flush()
await this.getUserChangeType()
getDictOptions('MemberChangeType').then(res => {
this.memberChangeTypeOptions = res
})
// getUnits(null).then(res => this.unitOptions = res) // getUnits(null).then(res => this.unitOptions = res)
} }
} }
@@ -34,7 +34,7 @@
<script> <script>
module.exports = { module.exports = {
components: { components: {
'user-change-history': httpVueLoader('/components/userChangeHistory/userChangeHistory.vue?v=' + new Date().getTime()), 'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=' + new Date().getTime()),
}, },
props: { props: {
records: {type: Array, default: []}, records: {type: Array, default: []},
@@ -84,16 +84,30 @@
<el-input v-model="formData.birthPlace" placeholder="出生地点"></el-input> <el-input v-model="formData.birthPlace" placeholder="出生地点"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="婚&emsp;&emsp;否"> <el-form-item label="婚姻状况">
<el-radio-group v-model="formData.marriage" size="small"> <dict-select v-model="formData.marriage" style="width: 100%" placeholder="请选择婚姻状况"
code="maritalStatus"></dict-select>
<!-- <el-radio-group v-model="formData.marriage" size="small">
<el-radio label="已婚" border></el-radio> <el-radio label="已婚" border></el-radio>
<el-radio label="未婚" border></el-radio> <el-radio label="未婚" border></el-radio>
</el-radio-group> </el-radio-group>-->
</el-form-item> </el-form-item>
</div> </div>
<div class="is-flex"> <div class="is-flex">
<el-form-item prop="schoolTime" label="入校时间">
<el-date-picker style="width: 100%" v-model="formData.schoolTime" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" type="date"
placeholder="入校时间"></el-date-picker>
</el-form-item>
<el-form-item prop="startSalaryDate" label="起薪日期">
<el-date-picker style="width: 100%" v-model="formData.startSalaryDate" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" type="date"
placeholder="起薪日期"></el-date-picker>
</el-form-item>
</div>
<div class="is-flex">
<el-form-item prop="education" label="学&emsp;&emsp;历"> <el-form-item prop="education" label="学&emsp;&emsp;历">
<dict-select v-model="formData.education" style="width: 100%" placeholder="请选择学历" <dict-select v-model="formData.education" style="width: 100%" placeholder="请选择学历"
code="Education"></dict-select> code="Education"></dict-select>
@@ -125,8 +139,10 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="political" label="政治面貌"> <el-form-item prop="political" label="政治面貌">
<el-input maxlength="100" placeholder="政治面貌" <dict-select v-model="formData.political" style="width: 100%" placeholder="请选择政治面貌"
v-model="formData.political"></el-input> code="JobTitle"></dict-select>
<!-- <el-input maxlength="100" placeholder="政治面貌"
v-model="formData.political"></el-input>-->
</el-form-item> </el-form-item>
</div> </div>
@@ -211,6 +227,17 @@
</el-form-item> </el-form-item>
</div> </div>
<div class="is-flex">
<el-form-item prop="renewTime" label="更新时间">
<el-date-picker style="width: 100%" v-model="formData.renewTime" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" type="date"
placeholder="更新时间"></el-date-picker>
</el-form-item>
<el-form-item prop="email" label="邮箱号">
<el-input v-model="formData.email" placeholder="邮箱号" maxlength="50"></el-input>
</el-form-item>
</div>
<div class="is-flex"> <div class="is-flex">
<el-form-item prop="householdType" label="户籍类型"> <el-form-item prop="householdType" label="户籍类型">
<dict-select <dict-select
@@ -272,9 +299,9 @@
<!-- </el-form>--> <!-- </el-form>-->
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="工作信息" :name="2"> <!-- <el-tab-pane label="工作信息" :name="2">
<!-- <el-form :model="formData" ref="form" :rules="formRules" label-width="140px" v-loading="loading">--> &lt;!&ndash; <el-form :model="formData" ref="form" :rules="formRules" label-width="140px" v-loading="loading">&ndash;&gt;
<vi-title title="工作信息"></vi-title> <vi-title title="工作信息"></vi-title>
@@ -339,7 +366,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="会员信息" :name="3"> <el-tab-pane label="会员信息" :name="3">
<!-- <el-form :model="formData" ref="form" :rules="formRules" label-width="160px" v-loading="loading">--> &lt;!&ndash; <el-form :model="formData" ref="form" :rules="formRules" label-width="160px" v-loading="loading">&ndash;&gt;
<vi-title title="会员信息"></vi-title> <vi-title title="会员信息"></vi-title>
<div class="is-flex"> <div class="is-flex">
@@ -428,8 +455,8 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</div> </div>
<!-- </el-form>--> &lt;!&ndash; </el-form>&ndash;&gt;
</el-tab-pane> </el-tab-pane>-->
<el-tab-pane label="家庭及社会信息" :name="4"> <el-tab-pane label="家庭及社会信息" :name="4">
<!-- <el-form :model="formData" ref="form" :rules="formRules" label-width="120px" v-loading="loading">--> <!-- <el-form :model="formData" ref="form" :rules="formRules" label-width="120px" v-loading="loading">-->
@@ -521,12 +548,25 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位" align="center" header-align="center"> <el-table-column prop="isCondolence" label="是否慰问" align="center" header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入单位" maxlength="100" v-model="scope.row.unit" <el-radio-group v-model="scope.row.isCondolence" size="mini">
clearable></el-input> <el-radio label="是">是</el-radio>
<el-radio label="否">否</el-radio>
</el-radio-group>
<!-- <el-input placeholder="请输入单位" maxlength="100" v-model="scope.row.unit"
clearable></el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="condolenceTime" label="慰问时间" align="center" header-align="center">
<template slot-scope="scope">
<el-date-picker style="width: 100%" v-model="scope.row.condolenceTime" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" type="date"
placeholder="慰问时间"></el-date-picker>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" header-align="center"> <el-table-column prop="remark" label="备注" align="center" header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入备注" maxlength="100" v-model="scope.row.remark" <el-input placeholder="请输入备注" maxlength="100" v-model="scope.row.remark"
@@ -555,192 +595,58 @@
</div> </div>
<div v-else> <div v-else>
<el-form label-width="100px" v-loading="loading" label-position="left" label-suffix=":">
<el-row gutter="20"> <h3 style="text-align: center; letter-spacing: 6px;">工会会员登记表</h3>
<el-col :span="18"> <div style="text-align: right; letter-spacing: 2px;">填表日期:{{ moment(formData.applyTime).format('YYYY年MM月DD日') }}</div>
<el-row gutter="20">
<el-col :span="8">
<el-form-item label="姓&emsp;&emsp;名">
{{ formData.username }}
</el-form-item>
</el-col>
<el-col :span="8"> <el-descriptions :column="3" border class="descriptions-form">
<el-form-item label="工&emsp;&emsp;号"> <el-descriptions-item label="姓名">{{ formData.username}}</el-descriptions-item>
{{ formData.loginname }} <el-descriptions-item label="性别">{{ formData.sex}}</el-descriptions-item>
</el-form-item> <el-descriptions-item label="民族">{{ formData.nation}}</el-descriptions-item>
</el-col> <el-descriptions-item label="学历">{{ formData.education}}</el-descriptions-item>
<el-descriptions-item label="政治面貌">{{ formData.political}}</el-descriptions-item>
<el-col :span="8"> <el-descriptions-item label="婚姻状况">{{ formData.marriage}}</el-descriptions-item>
<el-form-item label="性&emsp;&emsp;别"> <el-descriptions-item label="身份证号码" span="2">{{ formData.idcard}}</el-descriptions-item>
{{ formData.sex }} <el-descriptions-item label="联系电话">{{ formData.mobile}}</el-descriptions-item>
</el-form-item> <el-descriptions-item label="户口所在地" span="3">
</el-col> <template slot="label">户口所在地</template>
</el-row> <div class="text-left" v-html="formData.registeredResidence"></div>
<el-row gutter="20"> </el-descriptions-item>
<el-col :span="8"> <el-descriptions-item label="现居住地" span="3">
<el-form-item label="所在科室"> <template slot="label">现居住地</template>
{{ formData.threeUnitName }} <div class="text-left" v-html="formData.homeAddress"></div>
</el-form-item> </el-descriptions-item>
</el-col> <el-descriptions-item label="工作部门(学院)及岗位" span="3">
<template slot="label">工作部门(学院)及岗位</template>
<el-col :span="8"> <div class="text-left">{{ formData.unitname + '' + (formData.jobTitle ? '、' + formData.jobTitle : "") }}</div>
<el-form-item label="所在单位"> </el-descriptions-item>
{{ formData.unitname }} <el-descriptions-item label="简历" span="3">
</el-form-item> <template slot="label">简历</template>
</el-col> <div class="text-left" v-html="formData.vita"></div>
</el-descriptions-item>
<el-col :span="8"> <el-descriptions-item label="有何特长" span="3">
<el-form-item label="所在工会"> <template slot="label">有何特长</template>
{{ formData.unionname }} <div class="text-left" v-html="formData.specialSkill"></div>
</el-form-item> </el-descriptions-item>
</el-col> </el-descriptions>
<vi-title title="家庭成员" class="mt20"></vi-title>
<el-col :span="8"> <el-table
<el-form-item label="政治面貌"> v-if="formData.family&&formData.family.length"
{{ formData.political }} :data="formData.family"
</el-form-item> size="mini" border :header-cell-style="{background:'#eff3f6'}"
</el-col> style="width: 100%">
<el-table-column prop="relation" label="与本人关系" align="center" header-align="center">
<el-col :span="8"> </el-table-column>
<el-form-item label="入校时间"> <el-table-column prop="name" label="姓名" align="center" header-align="center">
{{ formData.schoolTime }} </el-table-column>
</el-form-item> <el-table-column prop="isCondolence" label="是否慰问" align="center" header-align="center">
</el-col> </el-table-column>
<el-table-column prop="condolenceTime" label="慰问时间" align="center" header-align="center">
<el-col :span="8"> </el-table-column>
<el-form-item label="出生日期"> <el-table-column prop="remark" label="备注" align="center" header-align="center">
{{ formData.birthday }} </el-table-column>
</el-form-item> </el-table>
</el-col> <el-empty v-else description="暂无家庭成员信息"></el-empty>
</el-row>
<el-row gutter="20">
<el-col :span="8">
<el-form-item label="籍&emsp;&emsp;贯">
{{ formData.hometown }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="民&emsp;&emsp;族">
{{ formData.nation }}
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="6">
<el-image :src="APP_DOMAIN+FILE_STREAM_PREVIEW_ADDRESS + '?id=' +formData.avatar"
style="width: 180px;height: 180px;display: flex;justify-content: center;align-items: center;background-color: #f5f7fa">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline" style="font-size: 24px"></i>
</div>
</el-image>
</el-col>
</el-row>
<el-row gutter="20">
<el-col :span="6">
<el-form-item label="兴趣爱好">
{{ formData.hobby }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="婚&emsp;&emsp;否">
{{ formData.marriage }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学&emsp;&emsp;历">
{{ formData.education }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="工&emsp;&emsp;资">
{{ formData.wage }}
</el-form-item>
</el-col>
</el-row>
<el-row gutter="20">
<el-col :span="6">
<el-form-item label="人事编制">
{{ formData.preparedBy }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="职&emsp;&emsp;务">
{{ formData.position }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="职&emsp;&emsp;称">
{{ formData.jobTitle }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="在职状态">
{{ formData.userState }}
</el-form-item>
</el-col>
</el-row>
<el-row gutter="20">
<el-col :span="6">
<el-form-item label="人员类型">
{{ formData.personType }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="手&ensp;机&ensp;号">
{{ formData.mobile }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="银行账号">
{{ formData.bank_number }}
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="身份证号">
{{ formData.idcard }}
</el-form-item>
</el-col>
</el-row>
<el-form-item label="个人简历">
<div v-html="formData.vita"></div>
</el-form-item>
<el-form-item label="家庭成员">
<el-table
v-if="formData.family&&formData.family.length"
:data="formData.family"
size="mini" border :header-cell-style="{background:'#eff3f6'}"
style="width: 100%">
<el-table-column prop="relation" label="与本人关系" align="center" header-align="center">
</el-table-column>
<el-table-column prop="name" label="姓名" align="center" header-align="center">
</el-table-column>
<el-table-column prop="unit" label="单位" align="center" header-align="center">
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" header-align="center">
</el-table-column>
</el-table>
</el-form-item>
</el-form>
</div> </div>
</div> </div>
</template> </template>
@@ -1001,4 +907,9 @@ module.exports = {
.el-picker-panel { .el-picker-panel {
z-index: 9999999 !important; z-index: 9999999 !important;
} }
.el-descriptions-item__cell {
width: 200px;
text-align: center !important;
}
</style> </style>
@@ -13,15 +13,16 @@
<van-field label="性别" :value="viewData.sex" left-icon="ellipsis"></van-field> <van-field label="性别" :value="viewData.sex" left-icon="ellipsis"></van-field>
<van-field label="民族" left-icon="bar-chart-o" :value="viewData.nation"></van-field> <van-field label="民族" left-icon="bar-chart-o" :value="viewData.nation"></van-field>
<van-field label="学历" left-icon="coupon-o" :value="viewData.education"></van-field> <van-field label="学历" left-icon="coupon-o" :value="viewData.education"></van-field>
<van-field label="学位" left-icon="comment-o" :value="viewData.academicDegree"></van-field> <!-- <van-field label="学位" left-icon="comment-o" :value="viewData.academicDegree"></van-field>-->
<van-field label="政治面貌" left-icon="label-o" :value="viewData.political"></van-field> <van-field label="政治面貌" left-icon="label-o" :value="viewData.political"></van-field>
<van-field :value="viewData.personType" label="人员类型" left-icon="label-o"></van-field> <van-field label="婚否" left-icon="label-o" :value="viewData.marriage"></van-field>
<van-field label="身份证" left-icon="idcard" :value="viewData.idcard"></van-field> <!-- <van-field :value="viewData.personType" label="人员类型" left-icon="label-o"></van-field>-->
<van-field label="身份证号码" left-icon="idcard" :value="viewData.idcard"></van-field>
<van-field label="联系电话" left-icon="phone-o" :value="viewData.mobile"></van-field> <van-field label="联系电话" left-icon="phone-o" :value="viewData.mobile"></van-field>
<van-field label="户口所在地" left-icon="wap-home-o" :value="viewData.registeredResidence"></van-field> <van-field label="户口所在地" left-icon="wap-home-o" :value="viewData.registeredResidence"></van-field>
<van-field label="现居住地" left-icon="home-o" :value="viewData.homeAddress"></van-field> <van-field label="现居住地" left-icon="home-o" :value="viewData.homeAddress"></van-field>
<van-field label="工作单位" left-icon="cluster-o" :value="viewData.unitname"></van-field> <van-field label="工作部门(学院)及岗位" left-icon="cluster-o" :value="viewData.unitname + '、' + viewData.jobTitle"></van-field>
<van-field label="职务" left-icon="debit-pay" :value="viewData.position"></van-field> <!-- <van-field label="职务" left-icon="debit-pay" :value="viewData.position"></van-field>-->
</van-cell-group> </van-cell-group>
</van-form> </van-form>
<van-cell-group class="mt10 up_down"> <van-cell-group class="mt10 up_down">
@@ -31,7 +32,7 @@
<i class="van-icon van-icon-notes-o"></i> <i class="van-icon van-icon-notes-o"></i>
</div> </div>
<div class="van-cell__title van-field__label"> <div class="van-cell__title van-field__label">
<span>个人工作简历</span> <span>简历</span>
</div> </div>
</div> </div>
@@ -39,11 +40,10 @@
<van-field readonly> <van-field readonly>
<template #input> <template #input>
<div v-html="viewData.position"></div> <div v-html="viewData.vita"></div>
</template> </template>
</van-field> </van-field>
</div> </div>
</van-cell-group> </van-cell-group>
<van-cell-group class="mt10 up_down"> <van-cell-group class="mt10 up_down">
@@ -53,7 +53,7 @@
<i class="van-icon van-icon-award-o"></i> <i class="van-icon van-icon-award-o"></i>
</div> </div>
<div class="van-cell__title van-field__label"> <div class="van-cell__title van-field__label">
<span>特长</span> <span>有何特长</span>
</div> </div>
</div> </div>
<van-divider></van-divider> <van-divider></van-divider>
@@ -74,7 +74,7 @@
<i class="van-icon van-icon-friends-o"></i> <i class="van-icon van-icon-friends-o"></i>
</div> </div>
<div class="van-cell__title van-field__label" style="width: auto"> <div class="van-cell__title van-field__label" style="width: auto">
<span>家庭主要成员及联系方式</span> <span>家庭成员</span>
</div> </div>
</div> </div>
</div> </div>
@@ -87,14 +87,16 @@
<span>成员{{ toChinesNum(i + 1) }}</span> <span>成员{{ toChinesNum(i + 1) }}</span>
</div> </div>
<van-form readonly input-align="right"> <van-form readonly input-align="right">
<van-field label="关系" :value="o.relation" left-icon="exchange"></van-field> <van-field label="与本人关系" :value="o.relation" left-icon="exchange"></van-field>
<van-field label="姓名" :value="o.name" left-icon="user-o"></van-field> <van-field label="姓名" :value="o.name" left-icon="user-o"></van-field>
<van-field label="联系方式" :value="o.mobile" left-icon="phone-o"></van-field> <van-field label="是否慰问" :value="o.isCondolence" left-icon="shield-o"></van-field>
<van-field label="慰问时间" :value="o.condolenceTime" left-icon="guide-o"></van-field>
<van-field label="备注" :value="o.remark" left-icon="coupon-o"></van-field>
</van-form> </van-form>
</div> </div>
</div> </div>
<div v-else style="height: 100px"> <div v-else style="height: 100px">
暂无家庭成员信息
</div> </div>
</div> </div>
@@ -102,9 +104,9 @@
<template v-if="unionAudit!=null"> <template v-if="unionAudit!=null">
<div class="van-cell-group__title mt20"> <div class="van-cell-group__title mt5">
<div class="van-sidebar-item van-sidebar-item--select"> <div class="van-sidebar-item van-sidebar-item--select">
院级工会审核信息 部门工会审核信息
</div> </div>
</div> </div>
<van-cell-group> <van-cell-group>
@@ -112,11 +114,17 @@
<van-field label="审核时间" :value="moment(unionAudit.auditTime).format('YYYY-MM-DD')" left-icon="clock-o" <van-field label="审核时间" :value="moment(unionAudit.auditTime).format('YYYY-MM-DD')" left-icon="clock-o"
readonly></van-field> readonly></van-field>
<van-field label="审核意见" left-icon="chat-o" :value="unionAudit.auditOpinion" readonly></van-field> <van-field label="审核意见" left-icon="chat-o" :value="unionAudit.auditOpinion" readonly></van-field>
<van-field name="auditSign" left-icon="friends-o" label="签&emsp;&emsp;字">
<template #input>
<van-image width="200" height="100" :src="unionAudit.auditSign" v-if="unionAudit.auditSign"/>
<span v-else>暂无</span>
</template>
</van-field>
</van-cell-group> </van-cell-group>
</template> </template>
<template v-if="schoolAudit!=null"> <template v-if="schoolAudit!=null">
<div class="van-cell-group__title mt20"> <div class="van-cell-group__title mt5">
<div class="van-sidebar-item van-sidebar-item--select"> <div class="van-sidebar-item van-sidebar-item--select">
校工会审核信息 校工会审核信息
</div> </div>
@@ -126,6 +134,12 @@
<van-field label="审核时间" :value="moment(schoolAudit.auditTime).format('YYYY-MM-DD')" left-icon="clock-o" <van-field label="审核时间" :value="moment(schoolAudit.auditTime).format('YYYY-MM-DD')" left-icon="clock-o"
readonly></van-field> readonly></van-field>
<van-field label="审核意见" left-icon="chat-o" :value="schoolAudit.auditOpinion" readonly></van-field> <van-field label="审核意见" left-icon="chat-o" :value="schoolAudit.auditOpinion" readonly></van-field>
<van-field name="auditSign" left-icon="friends-o" label="签&emsp;&emsp;字">
<template #input>
<van-image width="200" height="100" :src="schoolAudit.auditSign" v-if="schoolAudit.auditSign"/>
<span v-else>暂无</span>
</template>
</van-field>
</van-cell-group> </van-cell-group>
</template> </template>
@@ -205,4 +219,4 @@ module.exports = {
.van-sidebar-item--select::before { .van-sidebar-item--select::before {
left: 5px !important; left: 5px !important;
} }
</style> </style>
@@ -0,0 +1,220 @@
<template>
<div style="padding: 20px 50px">
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" style="width: 200px"
@click="location.href=temp_url"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-form>
<el-form-item label="请选择更新模式" v-if="is_show_radio">
<el-radio-group v-model="importData.isFlag">
<el-radio-button label="true">清空更新</el-radio-button>
<el-radio-button label="false">追加</el-radio-button>
</el-radio-group>
</el-form-item>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList);
importResult={
errorCount:0,
successCount:0,
totalCount:0,
errorList:[]
}
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-form>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{ errorInfoData.totalCount }}</p>
<p>成功数:<span class="text-success">{{ errorInfoData.successCount }}</span></p>
<p>错误数:<span class="text-danger">{{ errorInfoData.errorCount }}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
</el-timeline>
<div style="text-align: right">
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="importVisible = false" :disabled="importLoading">取 消</el-button>-->
<el-button type="primary" @click="doImport" :loading="importLoading">确 定</el-button>
</span>
</div>
</div>
</template>
<script>
module.exports = {
props: {
temp_url: {type: String},
post_url: {type: String},
project_id: {type: String, default: ''},
is_show_radio: {type: Boolean, default: false}
},
mounted() {
const s = document.createElement('script');
s.type = 'text/javascript';
s.src = '/assets/platform/js/xlsx.full.min.js';
document.body.appendChild(s);
},
data() {
return {
// importVisible: false,
importLoading: false,
importData: {
fileList: [],
isFlag: false
},
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
}
},
methods: {
resetImportData() {
this.importData = {
fileList: [],
isFlag: false
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
}
this.importLoading = false
},
doImport() {
if (this.importData.fileList.length === 0) {
this.$notify.error({
title: '错误',
message: '请选择文件!'
});
// this.notifyWarning("请选择文件!")
return
}
const data = new FormData();
data.append("isFlag", this.importData.isFlag)
data.append("projectId", this.project_id)
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
this.importLoading = true
$.ajax({
url: this.post_url,
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0 && data.data === null) {
this.$notify.success("导入成功")
this.importVisible = false
this.$emit("flush")
} else {
this.$notify.warning("导入失败")
this.errorInfoData = data.data
}
},
error: (data) => {
this.$notify.warning("导入失败")
this.importLoading = false
}
});
this.importLoading = false
},
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '错误记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
fileHandleRemove(file, fileList) {
return fileList;
},
fileHandleChange(file, fileList, {type, size}) {
const removeFile = () => {
fileList.splice(fileList.findIndex(v => v === file))
}
if (!file.size) {
this.$notify.warning('您选择的是空文件!')
removeFile()
}
if (type && type.length && !type.includes(file.name.split('.').pop().toLowerCase())) {
this.$notify.warning(`文件只能是 ${type.map(v => v.toUpperCase()).join('/')} 格式!`)
removeFile()
}
if (size && !file.size < size) {
this.$notify.warning(`文件大小不能超过 ${size / 1024 / 1024}MB!`)
removeFile()
}
return fileList;
},
}
}
</script>
<style>
.el-card__body {
padding: 25px;
}
</style>
@@ -0,0 +1,327 @@
<template>
<el-card style="margin: 20px" shadow="never" v-loading="loading">
<template #header v-if="!formData.zcid">
<h3 style="color: #1867b0">资产登记</h3>
</template>
<el-form :model="formData" :rules="ruleForm" label-width="120px" ref="AddForm"
class="formClass">
<el-descriptions :column="3" border class="table_fixed">
<el-descriptions-item label="资产名称">
<div slot="label" class="required-form-item">资产名称</div>
<el-form-item prop="zcmc" label-width="0">
<el-input placeholder="资产名称" v-model="formData.zcmc"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="单价">
<div slot="label" class="required-form-item">单价</div>
<el-form-item prop="zcdj" label-width="0">
<el-input-number :precision="2" placeholder="单价" style="width: 100%"
v-model="formData.zcdj">
</el-input-number>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="数量">
<div slot="label" class="required-form-item">数量</div>
<el-form-item prop="sl" label-width="0">
<el-input-number :precision="2" placeholder="数量" style="width: 100%"
v-model="formData.sl">
</el-input-number>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="资产类型">
<div slot="label" class="required-form-item">资产类型</div>
<el-form-item prop="zcghlx" label-width="0">
<el-radio-group @change="zcghlxChange" v-model="formData.zcghlx">
<el-radio label="1">院级工会</el-radio>
<el-radio label="2">校工会</el-radio>
</el-radio-group>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="资产规格型号">
<el-form-item prop="zcxh" label-width="0">
<el-input placeholder="资产规格型号" v-model="formData.zcxh"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="资产所属类别">
<div slot="label" class="required-form-item">资产所属类别</div>
<el-form-item prop="contentCode" label-width="0">
<el-select @change="contentCodeChange" clearable placeholder="所属类别"
style="width: 100%" v-model="formData.contentCode">
<el-option :label="item.content+'('+item.contentCode+')'"
:value="item.contentCode"
v-for="item in lbList"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="厂家">
<el-form-item prop="zccj" label-width="0">
<el-input placeholder="厂家" v-model="formData.zccj"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="存放地点">
<el-form-item prop="zccfdmc" label-width="0">
<el-input placeholder="存放地点" v-model="formData.zccfdmc"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="购置日期">
<div slot="label" class="required-form-item">购置日期</div>
<el-form-item prop="zcgzrq" label-width="0">
<el-date-picker @change="zcrksjChange" placeholder="购置日期"
style="width: 100%" v-model="formData.zcgzrq"
value-format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="折旧到期时间">
<el-form-item prop="depreciationDate" label-width="0">
<el-date-picker disabled placeholder="折旧到期时间"
style="width: 100%"
v-model="formData.depreciationDate"
value-format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="资产编号">
<el-form-item prop="zcbh" label-width="0">
<el-input placeholder="不填为系统自动生成或自己编写"
v-model="formData.zcbh"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="分类号">
<el-form-item prop="zcgbflh" label-width="0">
<el-input placeholder="分类号" v-model="formData.zcgbflh"></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="领用人">
<el-form-item prop="zclyrid" label-width="0">
<el-select :loading="loading"
:remote-method="searchLyr"
@change="zclyrChange"
clearable
filterable
placeholder="可输入姓名或者工资号查询"
remote
style="width: 100%"
v-model="formData.zclyrid">
<el-option :label="item.username+'-'+item.loginname"
:value="item.id"
v-for="item in LyrOption"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="领用工会">
<template v-if="formData.zcghlx==='2'">
<el-form-item prop="zclydwh" label-width="0">
<el-input :value="formData.zclydwh" disabled
></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item prop="zclydwhid" label-width="0">
<el-select @change="zclydwhidChange" clearable
filterable="true" placeholder="所属工会"
style="width: 100%"
v-model="formData.zclydwhid">
<el-option :label="item.unionname" :value="item.id"
v-for="item in unions"></el-option>
</el-select>
</el-form-item>
</template>
</el-descriptions-item>
<el-descriptions-item label="资产状态">
<el-form-item prop="zczt" label-width="0">
<dict-select v-model="formData.zczt" style="width: 100%" placeholder="请选择资产状态"
code="zczt"></dict-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="经费科目" span="1">
<el-form-item prop="fundingSubject" label-width="0">
<el-select clearable placeholder="请选择经费科目"
style="width: 100%"
v-model="formData.fundingSubject">
<el-option label="行政" value="行政"></el-option>
<el-option label="自筹" value="自筹"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item>
</el-descriptions-item>
</el-descriptions>
</el-form>
<div style="float: right;margin: 20px 0" v-if="!formData.zcid">
<el-button @click="doSubmit" type="primary">确 定
</el-button>
</div>
</el-card>
</template>
<script>
module.exports = {
data() {
return {
loading: false,
lbList: [],
formData: {},
LyrOption: [],
ruleForm: {
zcmc: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcgg: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcdj: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcgzrq: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zclyrname: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcrksj: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcjfkh: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcjfkje: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcfph: [{required: true, message: '必填', trigger: ['blur', 'change']}],
sl: [{required: true, message: '必填', trigger: ['blur', 'change']}],
contentCode: [{required: true, message: '必填', trigger: ['blur', 'change']}],
zcghlx: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
unions: [],
}
},
components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
},
methods: {
zclydwhidChange(val) {
const union = this.unions.find(v => v.id === val)
if (union) {
this.$set(this.formData, "zclydwh", union.unionname)
} else {
this.$set(this.formData, "zclydwh", null)
}
},
zcghlxChange(val) {
if (val === "2") {
this.$set(this.formData, "zclydwh", "工会")
} else {
this.$set(this.formData, "zclydwh", null)
this.$set(this.formData, "zclydwhid", null)
}
},
contentCodeChange() {
if (this.formData.zcgzrq) {
this.zcrksjChange(this.formData.zcgzrq)
} else {
this.$set(this.formData, "zcgzrq", null);
}
},
zcrksjChange(val) {
if (!this.formData.contentCode) {
this.$message.warning('请选择资产所属类别');
this.formData.zcgzrq = null
return
}
const lbList = clone(this.lbList)
const data = lbList.find(v => v.contentCode === this.formData.contentCode)
const depreciationDate = moment(val).add(data.depreciationYear, 'y').format('YYYY-MM-DD')
this.$set(this.formData, "depreciationDate", depreciationDate)
},
zclyrChange(val) {
const {
loginname,
unionname,
username,
unionid
} = this.LyrOption.find(v => v.id === val)
this.formData.zclyrgh = loginname
this.formData.zclydwhid = unionid
this.formData.zclyrname = username
if (this.formData.zcghlx === '2') {
this.formData.zclydwh = "工会"
} else {
this.formData.zclydwh = unionname
}
},
async searchLyr(query) {
if (query != '') {
this.loading = true;
this.LyrOption = await searchUser(query)
this.loading = false;
}
},
doSubmit() {
this.$refs["AddForm"].validate((valid) => {
if (valid) {
let url = this.formData.zcid ? "/platform/zcgl/zcdj/doEdit" : "/platform/zcgl/zcdj/doSubmit"
$.post(url, this.formData).then(resp => {
if (resp.code === 0) {
this.$refs.AddForm.resetFields()
this.$message.success(resp.msg);
} else {
this.$message.warning(resp.msg);
}
})
}
})
},
async findOne(id) {
this.loading = true;
const resp = await $.post("/platform/zcgl/zcdj/findOne", {id})
if (resp.code === 0) {
await this.searchLyr(resp.data.zclyrgh);
this.formData = resp.data;
}
this.loading = false
},
async findLb() {
const data = await $.post("/platform/zcgl/zclb/queryLb")
this.lbList = data.data
}
},
async created() {
await this.findLb();
this.unions = await getUnions(null)
},
}
</script>
<style>
.formClass .el-form-item {
margin-bottom: 0px !important;
}
.required-form-item::before {
content: '*';
color: #f56c6c;
margin-right: 3px;
}
</style>
@@ -0,0 +1,222 @@
<template>
<div>
<el-tabs tab-position="top" v-model="activeName" v-loading="loading">
<el-tab-pane label="基本信息" name="1" class="tabPane">
<el-descriptions :column="2" border class="table_fixed">
<el-descriptions-item label="资产编号">
{{ viewData.zcbh }}
</el-descriptions-item>
<el-descriptions-item label="名称">
{{ viewData.zcmc }}
</el-descriptions-item>
<el-descriptions-item label="单价">
{{ viewData.zcdj }}元
</el-descriptions-item>
<el-descriptions-item label="数量">
{{ viewData.sl }}
</el-descriptions-item>
<el-descriptions-item label="规格型号">
{{ viewData.zcxh }}
</el-descriptions-item>
<el-descriptions-item label="资产所属类别">
<template v-if="viewData.contentCode">
{{ viewData.content }}({{ viewData.contentCode }})
</template>
</el-descriptions-item>
<el-descriptions-item label="厂家">
{{ viewData.zccj }}
</el-descriptions-item>
<el-descriptions-item label="存放地名称">
{{ viewData.zccfdmc }}
</el-descriptions-item>
<el-descriptions-item label="购置日期">
{{ viewData.zcgzrq }}
</el-descriptions-item>
<el-descriptions-item label="折旧到期时间">
{{ viewData.depreciationDate }}
</el-descriptions-item>
<el-descriptions-item label="分类号">
{{ viewData.zcgbflh }}
</el-descriptions-item>
<el-descriptions-item label="领用人">
{{ viewData.zclyrname }}
</el-descriptions-item>
<el-descriptions-item label="领用工会">
{{ viewData.zclydwh }}
</el-descriptions-item>
<el-descriptions-item label="资产状态">
{{ viewData.zczt }}
</el-descriptions-item>
<el-descriptions-item label="经费科目">
{{ viewData.fundingSubject }}
</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane label="盘点信息" name="2">
<el-table :data="viewData.bdData"
class="tabInfo"
header-align="center"
size="small"
style="width: 100%"
>
<el-table-column
align="center"
header-align="center"
label="院级工会"
prop="zcnowlydwh"
show-overflow-tooltip>
</el-table-column>
<!-- <el-table-column
align="center"
header-align="center"
label="账面价值"
prop="zmjz" show-overflow-tooltip>
</el-table-column>-->
<el-table-column
align="center"
header-align="center"
label="购置日期" prop="zcgzrq"
show-overflow-tooltip>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="责任人" prop="shrname"
show-overflow-tooltip>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="联系方式" prop="mobile"
show-overflow-tooltip>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="存放地点" prop="zcnowcfdmc"
show-overflow-tooltip>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="资产照片"
prop="zcfile"
width="250">
<template scope="{row}">
<span v-if="!row.zcfile">暂无</span>
<div v-else>
<file-upload :files.sync="row.zcfile"
view></file-upload>
</div>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="盘点情况" prop="pdzt"
show-overflow-tooltip
width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="情况说明" prop="wpdzt"
show-overflow-tooltip
width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="使用情况"
prop="zczt" show-overflow-tooltip
width="100">
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="盘点时间" prop="zcbdsj"
show-overflow-tooltip>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane v-if="handle" :label="label" name="999">
<slot name="handle"></slot>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
module.exports = {
props: {
id: String,
handle: {
type: Boolean,
default: false,
},
label: {
type: String,
default: '审核'
},
panes: {
type: Array,
default: []
}
},
data() {
return {
loading: true,
viewData: {},
activeName: '1',
}
},
methods: {
hasPane(name) {
if (!this.handle) {
return true
}
return this.panes.includes(name)
},
async findOne(id) {
const resp = await $.get("/platform/zcgl/tzgl/findOne", {id})
if (resp.code === 0) {
const pdData = await $.post("/platform/zcgl/gdzcbg/queryChangeData", {zcid: id})
if (pdData.code === 0) {
pdData.data.forEach(v => {
if (v.zcfile) {
v.zcfile = JSON.parse(v.zcfile)
}
})
resp.data.bdData = pdData.data
} else {
resp.data.bdData = []
}
this.viewData = resp.data
} else {
}
this.loading = false
}
}
}
</script>
<style>
.tabPane .el-descriptions-item__label.is-bordered-label {
display: flex;
justify-content: center;
}
</style>
@@ -129,6 +129,10 @@
Vue.component('dict-tag', httpVueLoader('/components/plugins/sysDict/DictTag.vue')) Vue.component('dict-tag', httpVueLoader('/components/plugins/sysDict/DictTag.vue'))
Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue')) Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue'))
Vue.component('text-editor', httpVueLoader('/components/plugins/TextEditor.vue')) Vue.component('text-editor', httpVueLoader('/components/plugins/TextEditor.vue'))
Vue.component('el-tab-plus', httpVueLoader('/components/plugins/ELTabPlus.vue'))
Vue.component('dict-select', httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.1'))
Vue.component('enum-select', httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'))
Vue.component('custom-message', httpVueLoader('/components/plugins/CustomMessage.vue'))
Vue.use(httpVueLoader) Vue.use(httpVueLoader)
Vue.component(VueQrcode.name, VueQrcode) Vue.component(VueQrcode.name, VueQrcode)
+199 -103
View File
@@ -19,6 +19,7 @@ layout("/mobile/platform.html"){
@click="sexPicker = true" @click="sexPicker = true"
placeholder="请选择性别" placeholder="请选择性别"
clickable clickable
:rules="[{ required:true, message: '请选择性别' }]"
left-icon="ellipsis"></van-field> left-icon="ellipsis"></van-field>
<van-popup v-model="sexPicker" position="bottom"> <van-popup v-model="sexPicker" position="bottom">
<van-picker <van-picker
@@ -55,89 +56,66 @@ layout("/mobile/platform.html"){
></van-picker> ></van-picker>
</van-popup> </van-popup>
<van-field label="学位" v-model="formData.academicDegree" readonly clickable <van-field label="政治面貌" v-model="formData.political" readonly clickable
left-icon="comment-o" left-icon="label-o"
@click="academicDegreePicker = true" placeholder="请选择学位" @click="politicalPicker = true" placeholder="请选择政治面貌"
:rules="[{ required:true, message: '请选择学位' }]"></van-field> :rules="[{ required:true, message: '请选择政治面貌' }]"></van-field>
<van-popup v-model="academicDegreePicker" position="bottom"> <van-popup v-model="politicalPicker" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="academicDegreeColumns" :columns="politicalColumns"
@confirm="(v)=>{formData.academicDegree = v;academicDegreePicker = false}" @confirm="(v)=>{formData.political = v;politicalPicker = false}"
@cancel="academicDegreePicker = false" @cancel="politicalPicker = false"
></van-picker>
</van-popup>
<van-field label="婚否" v-model="formData.marriage" readonly clickable
left-icon="flower-o"
@click="marriagePicker = true" placeholder="请选择婚否"
:rules="[{ required:true, message: '请选择婚否' }]"></van-field>
<van-popup v-model="marriagePicker" position="bottom">
<van-picker
show-toolbar
:columns="marriageColumns"
@confirm="(v)=>{formData.marriage = v;marriagePicker = false}"
@cancel="marriagePicker = false"
></van-picker> ></van-picker>
</van-popup> </van-popup>
<van-field label="政治面貌" v-model="formData.political" placeholder="请填写政治面貌"
left-icon="label-o"
:rules="[{ required:true, message: '请填写政治面貌' }]"></van-field>
<van-field label="身份证" v-model="formData.idcard" placeholder="请填写身份证号码" <van-field label="身份证" v-model="formData.idcard" placeholder="请填写身份证号码"
left-icon="idcard" left-icon="idcard"
:rules="[{ required:true, message: '请填写身份证号码' }]"></van-field> :rules="[{ required:true, message: '请填写身份证号码' },{pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '身份证号码格式错误'}]"></van-field>
<van-field label="联系电话" v-model="formData.mobile" type="tel" placeholder="请填写联系电话" <van-field label="联系电话" v-model="formData.mobile" type="tel" placeholder="请填写联系电话"
left-icon="phone-o" left-icon="phone-o"
:rules="[{ required:true, message: '请填写联系电话' }]"></van-field> :rules="[{ required:true, message: '请填写联系电话' },{pattern: /^1[3456789]\d{9}$/, message: '联系电话格式错误'}]"></van-field>
</van-cell-group>
<van-field label="所属单位" v-model="formData.unitname" readonly clickable
left-icon="flower-o"
@click="unitPicker = true" placeholder="请选择所属单位"
:rules="[{ required:true, message: '请选择所属单位' }]"></van-field>
<van-popup v-model="unitPicker" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="unitColumns"
@confirm="(v)=>{formData.unitname = v.name;formData.unitid = v.id;unitPicker = false}"
@cancel="unitPicker = false"
></van-picker>
</van-popup>
<van-cell-group inset class="mt10">
<van-field label="户口所在地" v-model="formData.registeredResidence" placeholder="请填写户口所在地" <van-field label="户口所在地" v-model="formData.registeredResidence" placeholder="请填写户口所在地"
left-icon="wap-home-o" left-icon="wap-home-o"
:rules="[{ required:true, message: '请填写户口所在地' }]"></van-field> :rules="[{ required:true, message: '请填写户口所在地' }]"></van-field>
<van-field label="现居住地" v-model="formData.homeAddress" placeholder="请填写现居住地" <van-field label="现居住地" v-model="formData.homeAddress" placeholder="请填写现居住地"
left-icon="home-o" left-icon="home-o"
:rules="[{ required:true, message: '请填写现居住地' }]"></van-field> :rules="[{ required:true, message: '请填写现居住地' }]"></van-field>
<van-field label="工作单位" value="${@shiro.getPrincipalProperty('unit').getName()}" <!-- <van-field label="工作单位" value="${@shiro.getPrincipalProperty('unit').getName()}"-->
left-icon="cluster-o" <!-- left-icon="cluster-o"-->
readonly></van-field> <!-- readonly></van-field>-->
<van-field label="职务" v-model="formData.position" placeholder="请填写职务" <van-field label="岗位" placeholder="请填写岗位" v-model="formData.jobTitle"
left-icon="debit-pay" left-icon="debit-pay"
:rules="[{ required:true, message: '请填写职务' }]"></van-field> :rules="[{ required:true, message: '请填写岗位' }]"></van-field>
</van-cell-group>
<van-cell-group inset class="mt10 up_down">
<div class="van-cell">
<div class="van-cell__title van-field__label" style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div class="van-field__left-icon">
<i class="van-icon van-icon-friends-o"></i>
</div>
<div class="van-cell__title van-field__label" style="width: auto">
<span>家庭主要成员及联系方式</span>
</div>
</div>
<van-button v-if="family && family.length>0 && family.length<3" style="width: 40px"
icon="plus" type="primary" round size="mini"
@click="family.push({})"
native-type="button"></van-button>
</div>
<van-divider></van-divider>
<template v-if="family && family.length>0">
<div v-for="o,i in family" class="mt5">
<div style="font-weight: 700;display: flex;justify-content: space-between">
<span>成员{{toChinesNum(i+1)}}</span>
<van-button style="width: 40px"
icon="minus" type="danger" round size="mini"
@click="family.splice(i,1)"
native-type="button"></van-button>
</div>
<van-field label="关系" v-model="o.relation" placeholder="请填写与本人关系"
:rules="[{ required:true, message: '请填写与本人关系' }]"></van-field>
<van-field label="姓名" v-model="o.name" placeholder="请填写姓名"
:rules="[{ required:true, message: '请填写姓名' }]"></van-field>
<van-field label="联系方式" v-model="o.mobile" type="tel" placeholder="请填写联系方式"
:rules="[{ required:true, message: '请填写联系方式' }]"></van-field>
</div>
</template>
<template v-else>
<div style="padding: 50px;text-align: center">
<van-button style="width: 50px"
icon="plus" type="primary" round size="mini"
@click="family.push({})"
native-type="button"></van-button>
</div>
</template>
</div>
</van-cell-group> </van-cell-group>
<van-cell-group inset class="mt10 up_down"> <van-cell-group inset class="mt10 up_down">
@@ -147,14 +125,14 @@ layout("/mobile/platform.html"){
<i class="van-icon van-icon-notes-o"></i> <i class="van-icon van-icon-notes-o"></i>
</div> </div>
<div class="van-cell__title van-field__label"> <div class="van-cell__title van-field__label">
<span>个人工作简历</span> <span>工作经历</span>
</div> </div>
</div> </div>
<van-divider></van-divider> <van-divider></van-divider>
<van-field <van-field
v-model="formData.vita" v-model="formData.vita"
:rules="[{ required:true, message: '请填写个人工作简历' }]" :rules="[{ required:true, message: '请填写工作经历' }]"
style="padding: 0" style="padding: 0"
input-align="left" input-align="left"
autosize autosize
@@ -162,7 +140,7 @@ layout("/mobile/platform.html"){
autosize autosize
type="textarea" type="textarea"
maxlength="200" maxlength="200"
placeholder="请输入个人工作简历" placeholder="请输入工作经历"
show-word-limit show-word-limit
></van-field> ></van-field>
</div> </div>
@@ -176,7 +154,7 @@ layout("/mobile/platform.html"){
<i class="van-icon van-icon-award-o"></i> <i class="van-icon van-icon-award-o"></i>
</div> </div>
<div class="van-cell__title van-field__label"> <div class="van-cell__title van-field__label">
<span>特长</span> <span>有何特长</span>
</div> </div>
</div> </div>
@@ -197,9 +175,84 @@ layout("/mobile/platform.html"){
</div> </div>
</van-cell-group> </van-cell-group>
<van-cell-group class="mt10" inset>
<van-field label="签字" required style="flex-flow: column">
<template #label>
<div class="mb10">签&emsp;&emsp;字</div>
</template>
<template #input>
<mobile-sign :my_sign.sync="formData.sign" ref="signature"></mobile-sign>
</template>
</van-field>
</van-cell-group>
<van-cell-group inset class="mt10 up_down">
<div class="van-cell">
<div class="van-cell__title van-field__label" style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div class="van-field__left-icon">
<i class="van-icon van-icon-friends-o"></i>
</div>
<div class="van-cell__title van-field__label" style="width: auto">
<span>家庭成员</span>
</div>
</div>
<van-button v-if="formData.family && formData.family.length>0 && formData.family.length<3"
style="width: 40px"
icon="plus" type="primary" round size="mini"
@click="formData.family.push({})"
native-type="button"></van-button>
</div>
<van-divider></van-divider>
<template v-if="formData.family && formData.family.length>0">
<div v-for="o,i in formData.family" class="mt5">
<div style="font-weight: 700;display: flex;justify-content: space-between">
<span>成员{{toChinesNum(i+1)}}</span>
<van-button style="width: 40px"
icon="minus" type="danger" round size="mini"
@click="formData.family.splice(i,1)"
native-type="button"></van-button>
</div>
<van-field label="与本人关系" v-model="o.relation" placeholder="请填写与本人关系"
:rules="[{ required:true, message: '请填写与本人关系' }]"></van-field>
<van-field label="姓名" v-model="o.name" placeholder="请填写姓名"
:rules="[{ required:true, message: '请填写姓名' }]"></van-field>
<van-field name="isCondolence" label="是否慰问">
<template #input>
<van-radio-group v-model="o.isCondolence" direction="horizontal">
<van-radio name="是">是</van-radio>
<van-radio name="否">否</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field label="慰问时间" v-model="o.condolenceTime"
placeholder="请选择慰问时间" @click="doShowCondolenceCalendar(i)"></van-field>
<van-calendar v-model="condolenceShow" :min-date="new Date('1999-01-01')" :show-confirm="false"
@confirm="condolenceConfirm"></van-calendar>
<van-field label="备注" v-model="o.remark" type="tel" placeholder="请填写备注"></van-field>
</div>
</template>
<template v-else>
<div style="padding: 50px;text-align: center">
<van-button style="width: 50px"
icon="plus" type="primary" round size="mini"
@click="formData.family.push({})"
native-type="button"></van-button>
</div>
</template>
</div>
</van-cell-group>
<div style="margin: 20px 20px 10px;"> <div style="margin: 20px 20px 10px;">
<van-button native-type="submit" style="border-radius: 10px" block type="info" :color="themeColor"> <van-button
提 交 :disabled="!(unionInfo.apply||unionInfo.reApply)"
native-type="submit" style="border-radius: 10px" block type="info" :color="themeColor">
<span v-if="unionInfo.apply||unionInfo.reApply">{{unionInfo.reApply?'重新申请':'申请加入'}}</span>
<span v-else-if="unionInfo.record">{{unionInfo.record.stateName}}</span>
<span v-else>您已是会员</span>
</van-button> </van-button>
</div> </div>
</van-form> </van-form>
@@ -212,16 +265,14 @@ layout("/mobile/platform.html"){
mixins: [mobileMixins], mixins: [mobileMixins],
data() { data() {
return { return {
unionInfo: {},
sexPicker: false, sexPicker: false,
applyRecords: [], applyRecords: [],
formData: {}, formData: {},
nationPicker: false, nationPicker: false,
educationPicker: false, educationPicker: false,
academicDegreePicker: false, academicDegreePicker: false,
family: [], educationColumns: [],
educationColumns: [
'博士研究生', '硕士研究生', '本科', '专科', '中专中技', '高中', '初中以下'
],
academicDegreeColumns: [ academicDegreeColumns: [
'学士', '硕士', '博士' '学士', '硕士', '博士'
], ],
@@ -231,30 +282,83 @@ layout("/mobile/platform.html"){
APPLYING: 2, APPLYING: 2,
NOTMEBMER: 3, NOTMEBMER: 3,
}, },
memberStatus: null memberStatus: null,
politicalPicker: false,
politicalColumns: [],
marriagePicker: false,
marriageColumns: [],
unitPicker: false,
unitColumns: [],
condolenceShow: false,
familyIndex: null,
} }
}, },
components: {
'mobile-sign': httpVueLoader('/components/sign/mobileSign.vue'),
},
methods: { methods: {
doShowCondolenceCalendar(index){
console.log(index)
this.condolenceShow = true
this.familyIndex = index
},
condolenceConfirm(val){
if (val) {
this.formData.family[this.familyIndex].condolenceTime = moment(val).format('YYYY-MM-DD')
this.condolenceShow = false
this.familyIndex = null
}
console.log(val)
},
async doSubmit() { async doSubmit() {
this.$refs.signature.submitSign()
if (this.$refs.signature.checkNull()) {
vant.Toast('请签字')
return
}
await this.$refs.signature.updateSign()
const formData = clone(this.formData) const formData = clone(this.formData)
formData.family = JSON.stringify(this.family) formData.family = JSON.stringify(this.formData.family)
const loading = this.$toast.loading({
message: '数据提交中...',
forbidClick: true,
overlay: true,
duration: 0
})
const resp = await $.post("/platform/member/apply/submit/doEdit", formData) const resp = await $.post("/platform/member/apply/submit/doEdit", formData)
const data = await $.get("/platform/member/apply/submit/doApply", {memberStates: 1}) const data = await $.post("/platform/member/apply/submit/doApply", {
memberStates: 1,
sign: formData.sign,
})
setTimeout(() => { setTimeout(() => {
this.$toast.success('提交成功'); this.$toast.success('提交成功');
loading.close()
setTimeout(() => { setTimeout(() => {
location.replace('/mobile/index') location.replace('/mobile/index')
}, 300) }, 300)
}, 500) }, 500)
}, },
addFamily() { async getUnionInfo() {
this.family.push({}) const resp = await $.get("/platform/member/apply/submit/unionInfo")
} if (resp.code === 0) {
this.unionInfo = resp.data
this.formData = resp.data
this.$set(this.formData, "family", resp.data.family ? JSON.parse(resp.data.family) : [])
this.formData = resp.data
} else {
this.$toast(resp.msg)
}
},
}, },
async created() { async created() {
this.$set(this.formData, "isMember", "${@shiro.getPrincipalProperty('member')}") this.$set(this.formData, "isMember", "${@shiro.getPrincipalProperty('member')}")
this.$set(this.formData, "sex", "${@shiro.getPrincipalProperty('sex')}") if ("${@shiro.getPrincipalProperty('sex')}" === '未知') {
this.$set(this.formData, "sex", '')
} else {
this.$set(this.formData, "sex", "${@shiro.getPrincipalProperty('sex')}")
}
this.$set(this.formData, "position", "${@shiro.getPrincipalProperty('position')}") this.$set(this.formData, "position", "${@shiro.getPrincipalProperty('position')}")
this.$set(this.formData, "marriage", "${@shiro.getPrincipalProperty('marriage')}")
this.$set(this.formData, "nation", "${@shiro.getPrincipalProperty('nation')}") this.$set(this.formData, "nation", "${@shiro.getPrincipalProperty('nation')}")
this.$set(this.formData, "mobile", "${@shiro.getPrincipalProperty('mobile')}") this.$set(this.formData, "mobile", "${@shiro.getPrincipalProperty('mobile')}")
this.$set(this.formData, "political", "${@shiro.getPrincipalProperty('political')}") this.$set(this.formData, "political", "${@shiro.getPrincipalProperty('political')}")
@@ -266,25 +370,21 @@ layout("/mobile/platform.html"){
this.$set(this.formData, "homeAddress", "${@shiro.getPrincipalProperty('homeAddress')}") this.$set(this.formData, "homeAddress", "${@shiro.getPrincipalProperty('homeAddress')}")
this.$set(this.formData, "vita", "${@shiro.getPrincipalProperty('vita')}") this.$set(this.formData, "vita", "${@shiro.getPrincipalProperty('vita')}")
this.$set(this.formData, "specialSkill", "${@shiro.getPrincipalProperty('specialSkill')}") this.$set(this.formData, "specialSkill", "${@shiro.getPrincipalProperty('specialSkill')}")
// const {data} = await $.get("/mobile/member/getAllNation"); this.$set(this.formData, "jobTitle", "${@shiro.getPrincipalProperty('jobTitle')}")
/* this.nationColumns = data.map(v => { this.$set(this.formData, "unitname", "${@shiro.getPrincipalProperty('unit').getName()}")
return v.mzmc this.$set(this.formData, "unitid", "${@shiro.getPrincipalProperty('unit').getId()}")
}) */
this.nationColumns = nation this.nationColumns = nation
const resp = await $.get("/platform/member/apply/submit/unionInfo") const education = await getDictByCode('Education')
this.applyRecords = resp.data.records this.educationColumns = education.map(o => o.code)
if (resp.data.member === 1) { const political = await getDictByCode('political')
this.memberStatus = this.memberStatusColumn.MEMBER this.politicalColumns = political.map(o => o.code)
} else { const marriage = await getDictByCode('maritalStatus')
if (resp.data.record != null) { this.marriageColumns = marriage.map(o => o.code)
this.memberStatus = this.memberStatusColumn.APPLYING
} else {
this.memberStatus = this.memberStatusColumn.NOTMEBMER
}
}
this.unitColumns = await getUnionUnits()
await this.getUnionInfo()
} }
}) })
</script> </script>
@@ -298,10 +398,6 @@ layout("/mobile/platform.html"){
width: 100%; width: 100%;
} }
.van-cell, .van-picker button, .submit .van-button--normal {
font-size: 16px;
}
.van-divider { .van-divider {
margin: 10px 0; margin: 10px 0;
} }
@@ -309,4 +405,4 @@ layout("/mobile/platform.html"){
</style> </style>
<!--# <!--#
} }
#--> #-->
@@ -98,28 +98,94 @@ layout("/mobile/platform.html"){
</div> </div>
</div> </div>
<van-cell-group> <van-cell-group>
<van-cell title="姓名">{{ viewData.username }}</van-cell> <van-field :value="viewData.loginname" label="工号" left-icon="contact"></van-field>
<van-cell title="性别">{{ viewData.sex }}</van-cell> <van-field label="姓名" :value="viewData.username" left-icon="contact"></van-field>
<van-cell title="年龄">{{ viewData.birthday }}</van-cell> <van-field label="性别" :value="viewData.sex" left-icon="ellipsis"></van-field>
<van-cell title="民族">{{ viewData.mz }}</van-cell> <van-field label="民族" left-icon="bar-chart-o" :value="viewData.nation"></van-field>
<van-cell title="文化程度">{{ viewData.xl }}</van-cell> <van-field label="学历" left-icon="coupon-o" :value="viewData.education"></van-field>
<van-cell title="政治面貌">{{ viewData.zzmm }}</van-cell> <!-- <van-field label="学位" left-icon="comment-o" :value="viewData.academicDegree"></van-field>-->
<van-cell title="部门">{{ viewData.unitname }}</van-cell> <van-field label="政治面貌" left-icon="label-o" :value="viewData.political"></van-field>
<van-cell title="职称">{{ viewData.zc }}</van-cell> <van-field label="婚否" left-icon="label-o" :value="viewData.marriage"></van-field>
<van-cell title="职务">{{ viewData.zw }}</van-cell> <!-- <van-field :value="viewData.personType" label="人员类型" left-icon="label-o"></van-field>-->
<van-field label="身份证号码" left-icon="idcard" :value="viewData.idcard"></van-field>
<van-field label="联系电话" left-icon="phone-o" :value="viewData.mobile"></van-field>
<van-field label="户口所在地" left-icon="wap-home-o" :value="viewData.registeredResidence"></van-field>
<van-field label="现居住地" left-icon="home-o" :value="viewData.homeAddress"></van-field>
<van-field label="工作部门(学院)及岗位" left-icon="cluster-o" :value="viewData.unitname + '、' + viewData.jobTitle"></van-field>
</van-cell-group> </van-cell-group>
<div class="van-cell-group__title"> <van-cell-group class="mt10 up_down">
<div class="van-sidebar-item van-sidebar-item--select"> <div class="van-cell" style="flex-flow: column">
个人简历 <div style="display: flex">
<div class="van-field__left-icon">
<i class="van-icon van-icon-notes-o"></i>
</div>
<div class="van-cell__title van-field__label">
<span>简历</span>
</div>
</div>
<van-divider></van-divider>
<van-field readonly>
<template #input>
<div v-html="viewData.vita"></div>
</template>
</van-field>
</div>
</van-cell-group>
<van-cell-group class="mt10 up_down">
<div class="van-cell" style="flex-flow: column">
<div style="display: flex">
<div class="van-field__left-icon">
<i class="van-icon van-icon-award-o"></i>
</div>
<div class="van-cell__title van-field__label">
<span>有何特长</span>
</div>
</div>
<van-divider></van-divider>
<van-field readonly>
<template #input>
<div v-html="viewData.specialSkill"></div>
</template>
</van-field>
</div>
</van-cell-group>
<van-cell-group class="mt10 up_down">
<div class="van-cell" style="flex-flow: column">
<div class="van-cell__title van-field__label" style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div class="van-field__left-icon">
<i class="van-icon van-icon-friends-o"></i>
</div>
<div class="van-cell__title van-field__label" style="width: auto">
<span>家庭成员</span>
</div>
</div>
</div>
<van-divider></van-divider>
<div v-if="family && family.length>0">
<div v-for="(o,i) in family" class="mt5">
<div style="font-weight: 700;display: flex;justify-content: space-between">
<span>成员{{ toChinesNum(i + 1) }}</span>
</div>
<van-form readonly input-align="right">
<van-field label="与本人关系" :value="o.relation" left-icon="exchange"></van-field>
<van-field label="姓名" :value="o.name" left-icon="user-o"></van-field>
<van-field label="是否慰问" :value="o.isCondolence" left-icon="shield-o"></van-field>
<van-field label="慰问时间" :value="o.condolenceTime" left-icon="guide-o"></van-field>
<van-field label="备注" :value="o.remark" left-icon="coupon-o"></van-field>
</van-form>
</div>
</div>
<div v-else style="height: 100px">
暂无家庭成员信息
</div>
</div> </div>
</div>
<van-cell-group>
<van-cell>
<template>
<div v-html="viewData.grjl" v-if="viewData.grjl!=null"></div>
<div v-else>暂无</div>
</template>
</van-cell>
</van-cell-group> </van-cell-group>
</van-popup> </van-popup>
@@ -142,6 +208,7 @@ layout("/mobile/platform.html"){
unionList: [], unionList: [],
unitList: [], unitList: [],
viewData: {}, viewData: {},
family: []
} }
}, },
methods: { methods: {
@@ -170,9 +237,10 @@ layout("/mobile/platform.html"){
}, 300) }, 300)
}, },
async viewInfo(id) { async viewInfo(id) {
const resp = await $.post('/mobile/member/viewInfo', {id: id}) const resp = await $.post('/platform/member/common/userInfo', {userId: id})
if (resp.code === 0) { if (resp.code === 0) {
this.viewData = resp.data this.viewData = resp.data
this.family = JSON.parse(resp.data.family)
this.infoShow = true this.infoShow = true
} }
}, },
@@ -225,4 +293,4 @@ layout("/mobile/platform.html"){
<!--# <!--#
} }
#--> #-->
@@ -34,6 +34,14 @@ layout("/mobile/platform.html"){
placeholder="请输入审核意见" placeholder="请输入审核意见"
></van-field> ></van-field>
<van-field label="签字" style="flex-flow: column">
<template #label>
<div class="mb10">签&emsp;&emsp;字</div>
</template>
<template #input>
<mobile-sign ref="signature" :my_sign.sync="formData.auditSign"></mobile-sign>
</template>
</van-field>
<van-row gutter="20" style="margin-top: 30px;padding: 0 25px"> <van-row gutter="20" style="margin-top: 30px;padding: 0 25px">
<van-col span="12"> <van-col span="12">
@@ -69,6 +77,7 @@ layout("/mobile/platform.html"){
}, },
components: { components: {
'member-menber-info': httpVueLoader('/components/mobile/member/MobileMemberInfo.vue?v=' + new Date().getTime()), 'member-menber-info': httpVueLoader('/components/mobile/member/MobileMemberInfo.vue?v=' + new Date().getTime()),
'mobile-sign': httpVueLoader('/components/sign/mobileSign.vue'),
}, },
methods: { methods: {
async doAudit(pass) { async doAudit(pass) {
@@ -109,4 +118,4 @@ layout("/mobile/platform.html"){
<!--# <!--#
} }
#--> #-->
@@ -35,6 +35,14 @@ layout("/mobile/platform.html"){
placeholder="请输入审核意见" placeholder="请输入审核意见"
></van-field> ></van-field>
<van-field label="签字" style="flex-flow: column">
<template #label>
<div class="mb10">签&emsp;&emsp;字</div>
</template>
<template #input>
<mobile-sign ref="signature" :my_sign.sync="formData.auditSign"></mobile-sign>
</template>
</van-field>
<van-row gutter="20" style="margin-top: 30px;padding: 0 25px"> <van-row gutter="20" style="margin-top: 30px;padding: 0 25px">
<van-col span="12"> <van-col span="12">
@@ -69,6 +77,7 @@ layout("/mobile/platform.html"){
}, },
components: { components: {
'member-menber-info': httpVueLoader('/components/mobile/member/MobileMemberInfo.vue?v=' + new Date().getTime()), 'member-menber-info': httpVueLoader('/components/mobile/member/MobileMemberInfo.vue?v=' + new Date().getTime()),
'mobile-sign': httpVueLoader('/components/sign/mobileSign.vue'),
}, },
methods: { methods: {
@@ -111,4 +120,4 @@ layout("/mobile/platform.html"){
<!--# <!--#
} }
#--> #-->
@@ -0,0 +1,690 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.van-card {
background: #ffffff;
margin: 10px auto 0;
width: 96%;
border-radius: 10px;
padding: 14px 12px;
}
.van-card__thumb {
display: flex;
align-items: center;
justify-content: center;
}
.van-card__content > div {
height: 100%;
display: flex;
flex-direction: column;
}
.train-title {
flex: 0.6;
margin-top: 4px;
}
.van-doc-card {
margin: 14px;
padding: 12px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
font-size: 12px;
}
.van-divider {
margin: 6px 0 5px 0px;
border-color: #081776;
}
.van-tabs {
z-index: 0 !important;
}
.van-empty {
height: 70%;
top: 54%;
background-color: #F6F7F9;
}
</style>
<div id="app" v-cloak>
<van-nav-bar
@click-left="history.back()"
fixed
left-arrow
placeholder
title="资产列表"
></van-nav-bar>
<div class="search-fixed">
<van-dropdown-menu :active-color="themeColor">
<van-dropdown-item :options="yearOption" @change="getPdPlan"
v-model="pageForm.year"></van-dropdown-item>
<van-dropdown-item :options="pdPlanList" v-model="pageForm.zcpdid"></van-dropdown-item>
<van-dropdown-item :options="zcLxList" @change="doSearch"
v-model="pageForm.zcghlx"></van-dropdown-item>
</van-dropdown-menu>
</div>
<van-tabs @click="doSearch" style="margin-top: 53px" v-model="pageForm.isPd">
<van-tab title="全部"></van-tab>
<van-tab title="已盘点"></van-tab>
<van-tab title="未盘点"></van-tab>
</van-tabs>
<div style="margin: 0px auto 0 auto">
<van-list
:finished="finished"
:finished-text="tableData.length>0?'没有更多了':''"
:loading="mLoading"
@load="onLoad" v-if="tableData.length>0"
v-model="mLoading">
<div class="van-doc-card" v-for="o in tableData">
<div @click="welfareClick(o)" style="position: relative">
<div>
<div class="van-ellipsis"
style="margin-top: 6px; font-size: 15px;font-weight: bold;flex: 1">
{{o.zcmc}}({{o.zcbh}})
</div>
</div>
<div>
<div class="train-title"><span
style="color: grey">资产规格:</span>{{o.zcxh?o.zcxh:'暂无'}}
</div>
<div class="train-title"><span style="color: grey">资产类型:</span>{{o.zcghlx==='1'?'院级工会':'校工会'}}
</div>
<div class="train-title"><span style="color: grey">购置日期:</span>{{o.zcgzrq}}
</div>
<div class="train-title"><span style="color: grey">存放地名称:</span>{{o.zccfdmc}}
</div>
<van-divider></van-divider>
</div>
<div class="train-title"><span style="color: grey">领用人:</span>
{{o.zclyrname?o.zclyrname:'暂无'}}
</div>
<div class="train-title"><span style="color: grey">领用工会:</span>
{{o.zclydwh}}
</div>
<van-button :color="themeColor" @click.stop="openView(o)" plain round
size="mini"
style="position: absolute; left: 55%; bottom: 0%; width: 74px; height: 28px"
type="primary">
查看
</van-button>
<van-button :color="themeColor"
:disabled="pdPlanList.length==0||!pageForm.zcpdid||!pdPlanList.find(p=>p.id===pageForm.zcpdid).isShow"
@click.stop="openPd(o)"
round size="mini"
style="position: absolute; left: 77%; bottom: 0%; width: 74px; height: 28px"
type="primary"
v-if="!o.isPd">
开始盘点
</van-button>
<van-button
:disabled="pdPlanList.length==0||!pageForm.zcpdid||!pdPlanList.find(p=>p.id===pageForm.zcpdid).isShow"
@click.stop="doDelete(o)"
round size="mini"
style="position: absolute; left: 77%; bottom: 0%; width: 74px; height: 28px"
type="danger"
v-if="o.isPd">
删除盘点
</van-button>
</div>
</div>
</van-list>
<div :style="{color:themeColor}"
style="text-align: right;position: fixed;bottom: 20px;right: 20px">
<van-button :color="themeColor" hairline size="mini" type="primary">
总:{{pageForm.totalCount}}条
</van-button>
<van-button :color="themeColor" @click="doHzExcel" hairline size="mini" type="primary">
导出盘点汇总表
</van-button>
</div>
<van-empty
class="custom-image"
description="暂无数据"
image="/none.svg"
v-if="mLoading==false&&tableData.length==0"
></van-empty>
</div>
<van-popup :style="{ height: '100%',width:'100%' }" position="right" v-model="addPdShow">
<van-nav-bar
@click-left="addPdShow=false;doSearch()"
fixed
left-arrow
placeholder
title="新增盘点"
></van-nav-bar>
<van-form @submit="onSubmit">
<van-field :value="formData.zcbh" label="资产编号" readonly required></van-field>
<van-field :value="formData.zcmc" label="资产名称" readonly required></van-field>
<!-- <van-field :value="formData.zmjz" @touchstart.native.stop="zmjzShow = true" clickable
label="账面价值" placeholder="请输入账面价值"
readonly></van-field>
<van-number-keyboard
:show="zmjzShow"
@blur="zmjzShow = false"
close-button-text="完成"
extra-key="."
hide-on-click-outside
safe-area-inset-bottom
theme="custom"
v-model="formData.zmjz"
></van-number-keyboard>-->
<van-field :rules="[{ required: true, message: '' }]" :value="formData.zcgzrq"
@click="zcrksjShow = true"
clickable label="购置日期" placeholder="请输入购置日期"
readonly
required></van-field>
<van-calendar :color="themeColor" :min-date="new Date('1999-01-01')"
@confirm="onConfirmZcrksj" v-model="zcrksjShow"></van-calendar>
<van-field :rules="[{ required: true, message: '' }]" :value="formData.zcbdsj"
@click="zcbdsjShow = true"
clickable label="盘点日期" placeholder="请输入盘点日期"
readonly
required></van-field>
<van-calendar :color="themeColor" :min-date="new Date('1999-01-01')"
@confirm="onConfirmZcbdsj"
required v-model="zcbdsjShow"></van-calendar>
<van-field :rules="[{ required: true, message: '' }]"
@input="userRemoteMethod"
clickable
label="责任人" placeholder="请输入责任人"
required
v-model="formData.zcbdshr_name"></van-field>
<van-action-sheet :actions="userList"
:close-on-click-overlay="false"
@cancel="userList = []"
@select="onUserSelect"
cancel-text="重新输入姓名或工号查询"
v-model="zcbdshrShow">
</van-action-sheet>
<van-field :rules="[{ required: true, message: '' }]" :value="formData.zcnowlydwh"
label="院级工会" placeholder="输入责任人联动"
readonly required></van-field>
<template v-if="formData.zcghlx==='2'">
<van-field @input="lyrRemoteMethod"
clickable
label="领用人" placeholder="请输入领用人"
v-model="formData.zclyrname"></van-field>
<van-action-sheet :actions="userList"
:close-on-click-overlay="false"
@cancel="userList = []"
@select="onLyrUserSelect"
cancel-text="重新输入姓名或工号查询"
v-model="zclyrnameShow">
</van-action-sheet>
</template>
<van-field :rules="[{ required: true, message: '' }]"
clickable
label="存放地点"
maxlength="20" placeholder="请输入存放地点"
required
v-model="formData.zcnowcfdmc"></van-field>
<van-field :rules="[{ required: true, message: '' }]" :value="formData.pdzt"
@click="pdztShow = true"
clickable label="盘点情况" placeholder="请选择盘点情况"
readonly
required></van-field>
<van-popup :style="{ height: '40%' }" position="bottom" v-model="pdztShow">
<van-picker
:columns="pdztColumns"
@cancel="pdztShow = false"
@confirm="(v)=>{formData.pdzt = v;pdztShow = false}"
show-toolbar
title="盘点情况"
></van-picker>
</van-popup>
<van-field :rules="[{ required: true, message: '' }]" clickable label="盘点情况"
placeholder="请输入盘点情况"
required v-if="formData.pdzt!='已盘点'&&formData.pdzt!=null"
v-model="formData.wpdzt"
></van-field>
<!-- <van-popup :style="{ height: '40%' }" position="bottom" v-model="wpdztShow">
<van-picker
:columns="wpdztColumns"
@cancel="wpdztShow = false"
@confirm="(v)=>{formData.wpdzt = v;wpdztShow = false}"
show-toolbar
title="盘点情况"
></van-picker>
</van-popup>-->
<van-field :rules="[{ required: true, message: '' }]" :value="formData.zczt"
@click="zcztShow = true"
clickable label="使用现状" placeholder="请选择使用现状"
readonly
required></van-field>
<van-popup :style="{ height: '40%' }" position="bottom" v-model="zcztShow">
<van-picker
:columns="zcztColumns"
@cancel="zcztShow = false"
@confirm="(v)=>{formData.zczt = v;zcztShow = false}"
show-toolbar
show-toolbar
title="使用现状"
></van-picker>
</van-popup>
<van-field :rules="[{ required: true, message: '请上传资产照片' }]" input-align="left"
label="资产照片"
name="files" required
style="flex-flow: column">
<template #label>
<div class="mb10">资产照片</div>
</template>
<template #input>
<vant-file-upload :files.sync="formData.zcFile" :max="1"></vant-file-upload>
</template>
</van-field>
<div style="margin: 16px;">
<van-button :color="themeColor" block native-type="submit" round type="info">提交
</van-button>
</div>
</van-form>
</van-popup>
<van-popup :style="{ height: '100%',width:'100%' }" position="right" v-model="viewPdShow">
<van-nav-bar
@click-left="viewPdShow=false"
fixed
left-arrow
placeholder
title="查看盘点信息"
></van-nav-bar>
<van-tabs @click="openVIewTab" v-model="viewTabs">
<van-tab :name="1" title="基本信息">
<van-cell-group>
<van-field :value="viewData.zcmc" label="资产名称" readonly></van-field>
<van-field :value="viewData.zcbh" label="资产编号" readonly></van-field>
<van-field :value="viewData.zcdj" label="单价" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.sl" label="数量" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zcghlx==='1'?'院级工会':'校工会'" label="资产类型"
readonly></van-field>
<van-field :value="viewData.zcxh" label="规格型号" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.contentCode" label="类别编号" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.content" label="类别名称" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zccfdmc" label="存放地点" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zcgzrq" label="购置日期" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zclyrname" label="领用人" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zclydwh" label="领用工会" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.pdzt" label="盘点情况" placeholder="暂无"
readonly></van-field>
<van-field :value="viewData.zczt" label="使用现状" placeholder="暂无"
readonly></van-field>
</van-cell-group>
</van-tab>
<van-tab :name="2" title="盘点信息">
<van-collapse accordion v-if="viewData.bdData&&viewData.bdData.length>0"
v-model="collapseName">
<van-collapse-item :name="i" :title="o.zcbdsj" v-for="(o,i) in viewData.bdData">
<van-field :value="o.zcnowlydwh" label="院级工会" readonly></van-field>
<!-- <van-field :value="o.zmjz" label="账面价值" placeholder="暂无"
readonly></van-field>-->
<van-field :value="o.zcgzrq" label="购置日期" placeholder="暂无"
readonly></van-field>
<van-field :value="o.shrname" label="责任人" placeholder="暂无"
readonly></van-field>
<van-field :value="o.mobile" label="联系方式" placeholder="暂无"
readonly></van-field>
<van-field :value="o.pdzt" label="盘点情况" placeholder="暂无"
readonly></van-field>
<van-field :value="o.wpdzt" label="情况说明" placeholder="暂无"
readonly></van-field>
<van-field :value="o.zczt" label="使用现状" placeholder="暂无"
readonly></van-field>
<van-field abel="资产照片" name="zcfile"
required style="flex-flow: column">
<template #label>
<div class="mb10">资产照片</div>
</template>
<template #input>
<vant-file-upload :del="false" :files.sync="o.zcfile"
view></vant-file-upload>
</template>
</van-field>
</van-collapse-item>
</van-collapse>
<van-empty class="custom-image"
description="暂无数据"
image="/none.svg"
style="z-index: 1;position: fixed;height: 75%"
v-if="viewData.bdData&&viewData.bdData.length==0"
></van-empty>
</van-tab>
</van-tabs>
</van-popup>
</div>
<script>
let vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
collapseName: "",
viewTabs: 1,
viewData: {
bdData: []
},
viewPdShow: false,
zcztColumns: ["在用", "闲置", '未使用', '报废', '校外转入', '校内转入', '其它'],
zcztShow: false,
pdztColumns: ["已盘点", "盘亏", "盘盈", "报废"],
pdztShow: false,
wpdztColumns: ["盘亏", "报废已清拖", "其他"],
wpdztShow: false,
userList: [],
zcbdshrShow: false,
zcbdsjShow: false,
zcrksjShow: false,
zmjzShow: false,
addPdShow: false,
yearOption: [],
pdPlanList: [],
zcLxList: [
{value: '', text: "全部类型"},
{value: 2, text: "校工会"},
{value: 1, text: "院级工会"},
],
pageForm: {
isPd: 2,
zcghlx: ''
},
zclyrnameShow: false
}
},
components: {
'vant-file-upload': httpVueLoader('/components/plugins/VantFileUpload.vue')
},
methods: {
doHzExcel() {
window.open("/platform/zcgl/gdzcbg/doHzExcel?zcpdid=" + this.pageForm.zcpdid + "&zcghlx=" + this.pageForm.zcghlx)
},
doDelete(o) {
vant.Dialog.confirm({
title: '温馨提示',
message: '确认要删除本次盘点吗?',
}).then(async () => {
const loading = this.$toast.loading({
message: '删除中...',
forbidClick: true,
overlay: true,
duration: 0
})
const resp = await $.post("/platform/zcgl/gdzcbg/doPdDelete", {zcbdid: o.zcbdid})
if (resp.code === 0) {
await this.doSearch()
this.$toast.success(resp.msg);
} else {
this.$toast.fail(resp.msg);
}
loading.close()
})
},
async openVIewTab(val) {
if (val === 2) {
await this.getPdData(this.viewData.zcid)
if (this.viewData.bdData && this.viewData.bdData.length > 0) {
this.collapseName = 0
}
} else {
this.collapseName = ""
}
},
async openView(row) {
this.viewTabs = 1
this.viewData = clone(row)
this.viewPdShow = true
},
async getPdData(zcid) {
const data = await $.post("/platform/zcgl/gdzcbg/queryChangeData", {zcid: zcid})
if (data.code === 0) {
data.data.forEach(v => {
if (v.zcfile) {
v.zcfile = JSON.parse(v.zcfile)
}
})
this.$set(this.viewData, "bdData", data.data)
} else {
this.$set(this.viewData, "bdData", [])
}
},
onUserSelect(u) {
this.$set(this.formData, 'zcbdshrid', u.id)
this.$set(this.formData, 'zcbdshr_name', u.name)
if (this.formData.zcghlx === "2") {
this.$set(this.formData, "zcnowlydwh", "工会")
} else {
this.$set(this.formData, "zcnowlydwh", u.unionname)
this.$set(this.formData, "zcnowlydwhid", u.unionid)
}
this.$set(this.formData, "mobile", u.mobile)
this.zcbdshrShow = false
},
onLyrUserSelect(u) {
console.log(u)
this.$set(this.formData, "zclyrgh", u.loginname)
this.$set(this.formData, "zclyrname", u.username)
if (this.formData.zcghlx === "2") {
this.$set(this.formData, "zclydwh", "工会")
} else {
this.$set(this.formData, "zclydwh", u.unionname)
}
this.$set(this.formData, "zclydwhid", u.unionid)
this.zclyrnameShow = false
},
onConfirmZcbdsj(date) {
this.$set(this.formData, "zcbdsj", moment(date).format('YYYY/MM/DD'))
this.zcbdsjShow = false
},
onConfirmZcrksj(date) {
this.$set(this.formData, "zcgzrq", moment(date).format('YYYY/MM/DD'))
this.zcrksjShow = false
},
async onSubmit() {
let formData = clone(this.formData)
formData.pdPlanId = this.pageForm.zcpdid
formData.zcFile = JSON.stringify(formData.zcFile)
const resp = await $.post("/platform/zcgl/gdzcbg/doSubmit", formData)
if (resp.code === 0) {
this.$toast.success('新增盘点成功');
// await this.doSearch();
this.tableData = this.tableData.filter(t => t.zcid !== formData.zcid)
this.pageForm.totalCount = this.pageForm.totalCount - 1
this.addPdShow = false
} else {
this.$toast.fail('新增盘点失败');
}
},
async openPd(row) {
this.formData = row
this.$set(this.formData, "zcgzrq", row.zcgzrq)
this.$set(this.formData, "zcbdsj", moment(new Date()).format('YYYY/MM/DD'))
this.$set(this.formData, "zcnowcfdmc", row.zccfdmc)
this.addPdShow = true
},
async userRemoteMethod(event) {
if (event) {
let arr = []
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}") {
arr = await searchUser(event, null, null, null, null)
} else {
arr = await searchUser(event, "${@shiro.getPrincipalProperty('unit').getUnionid()}", null, null, null)
}
this.userList = arr.map(v => {
return {
name: v.username + "(" + v.loginname + ")",
id: v.id,
mobile: v.mobile,
unionname: v.unionname,
loginname: v.loginname,
username: v.username,
}
})
this.zcbdshrShow = true
}
},
async lyrRemoteMethod(event) {
if (event) {
let arr = []
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}") {
arr = await searchUser(event, null, null, null, null)
} else {
arr = await searchUser(event, "${@shiro.getPrincipalProperty('unit').getUnionid()}", null, null, null)
}
this.userList = arr.map(v => {
return {
name: v.username + "(" + v.loginname + ")",
id: v.id,
mobile: v.mobile,
unionname: v.unionname,
loginname: v.loginname,
username: v.username,
unionid: v.unionid,
}
})
this.zclyrnameShow = true
}
},
async doSearch() {
this.tableKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.finished = false;
this.pageForm.totalCount = 0
this.tableData = []
await this.onLoad();
},
async onLoad() {
this.mLoading = true
const res = await $.post('/platform/zcgl/gdzcbg/data', this.pageForm)
const {code, data} = res
if (this.refreshing) {
this.tableData = [];
this.refreshing = false;
}
this.mLoading = false;
if (code === 0) {
this.tableData = this.tableData.concat(data.list)
this.pageForm.totalCount = data.totalCount
if (this.tableData.length === 0) {
this.finished = true;
} else {
if (this.tableData.length >= this.pageForm.totalCount) {
this.finished = true;
this.pageForm.pageNumber++
} else {
this.pageForm.pageNumber++
}
}
}
},
async getPdPlan() {
const resp = await $.post("/platform/zcgl/gdzcbg/getPdPlan", {year: this.pageForm.year})
resp.data.forEach(v => {
const startDate = moment(v.startDate).format('YYYY-MM-DD')
const endDate = moment(v.endDate).format('YYYY-MM-DD')
v.text = startDate + "至" + endDate
v.value = v.id
v.isShow = (moment().format('YYYY-MM-DD hh:mm:ss') > v.startDate && moment().format('YYYY-MM-DD hh:mm:ss') < v.endDate)
})
this.pdPlanList = resp.data
if (this.pdPlanList && this.pdPlanList.length > 0) {
this.$set(this.pageForm, "zcpdid", this.pdPlanList[0].id)
} else {
this.$set(this.pageForm, "zcpdid", '')
}
//
}
},
async created() {
const toast = vant.Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true,
message: '数据查询中',
});
this.mLoading = true
for (let i = new Date().getFullYear() - 5; i <= new Date().getFullYear(); i++) {
this.yearOption.unshift({value: i, text: i + '年'},)
}
this.$set(this.pageForm, "year", this.yearOption[0].value)
await this.getPdPlan();
setTimeout(async () => {
toast.clear();
this.mLoading = false
await this.doSearch()
}, 500)
}
})
</script>
<!--#
}
#-->
@@ -72,40 +72,41 @@
</div> </div>
</div> </div>
<div class="search-item"> <template v-if="isThreeUnit">
<div class="search-item-label">工会小组:</div> <div class="search-item">
<div class="search-item-option"> <div class="search-item-label">工会小组:</div>
<el-select v-model="pageForm.unionGroupId" style="width: 100%" <div class="search-item-option">
filterable <el-select v-model="pageForm.unionGroupId" style="width: 100%"
clearable filterable
@change="getThreeUnits" clearable
placeholder="请选择"> @change="getThreeUnits"
<el-option placeholder="请选择">
v-for="item in unionGroups" <el-option
:key="item.id" v-for="item in unionGroups"
:label="item.groupName" :key="item.id"
:value="item.id"> :label="item.groupName"
</el-option> :value="item.id">
</el-select> </el-option>
</el-select>
</div>
</div> </div>
</div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">组成科室:</div> <div class="search-item-label">组成科室:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable <el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable
clearable clearable
placeholder="请选择"> placeholder="请选择">
<el-option <el-option
v-for="item in threeUnits" v-for="item in threeUnits"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</div>
</div> </div>
</div> </template>
<div class="search-query"> <div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
@@ -203,69 +204,8 @@
placeholder="请填写您的审核意见"></el-input> placeholder="请填写您的审核意见"></el-input>
</el-form-item> </el-form-item>
<div style="float: right;margin: 20px 0"> <el-form-item prop="auditSign" label="签字">
<el-button @click="doAudit(false)" :loading="submitLoading">拒 <sign v-model="formData.auditSign"></sign>
绝
</el-button>
<el-button type="primary" @click="doAudit(true)"
:loading="submitLoading">通
过
</el-button>
</div>
</template>
<template v-else>
<el-row :gutter="20" v-if="info&&info.unionAudit">
<el-col :span="12">
<el-form-item label="审核人员">
<span>{{ info.unionAudit.username }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核时间">
<span>{{ info.unionAudit.auditTime }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="审核意见">
<span>{{ info.unionAudit.auditOpinion }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row v-else type="flex" justify="center">
<el-form-item label="暂无审核信息">
</el-form-item>
</el-row>
</template>
</el-form>
</el-tab-pane>
<el-tab-pane label="校工会审核" name="school"
v-if="info.unionAudit">
<el-form class="demo-table-expand" :model="formData" ref="form" :rules="formRules"
label-width="120px" label-suffix=":">
<vi-title title="审核信息"></vi-title>
<template v-if="!info.schoolAudit&&source==2">
<el-row gutter="20">
<el-col :span="12">
<el-form-item prop="username" label="审核人员">
<el-input v-model="formData.username"
disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="auditTime" label="审核时间">
<el-input v-model="formData.auditTime" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item prop="opinion" label="审核意见">
<el-input type="textarea" v-model="formData.auditOpinion" rows="4" maxlength="500"
placeholder="请填写您的审核意见"></el-input>
</el-form-item> </el-form-item>
<div style="float: right;margin: 20px 0"> <div style="float: right;margin: 20px 0">
@@ -279,24 +219,77 @@
</div> </div>
</template> </template>
<template v-else> <template v-else>
<el-row :gutter="20" v-if="info&&info.schoolAudit"> <el-descriptions :column="2" border class="descriptions-form" v-if="info&&info.unionAudit">
<el-col :span="12"> <el-descriptions-item label="审核人员">{{ info.unionAudit.username }}</el-descriptions-item>
<el-form-item label="审核人员"> <el-descriptions-item label="审核时间">{{ info.unionAudit.auditTime }}</el-descriptions-item>
<span>{{ info.schoolAudit.username }}</span> <el-descriptions-item label="审核意见" span="2">{{ info.unionAudit.auditOpinion }}</el-descriptions-item>
</el-form-item> <el-descriptions-item label="签字" span="2">
</el-col> <el-image
<el-col :span="12"> v-if="info.unionAudit.auditSign"
<el-form-item label="审核时间"> :src="info.unionAudit.auditSign"
<span>{{ info.schoolAudit.auditTime }}</span> style="width: 100px; height: 100px"></el-image>
</el-form-item> <span v-else>暂无</span>
</el-col> </el-descriptions-item>
</el-descriptions>
<el-col :span="24"> <el-row v-else type="flex" justify="center">
<el-form-item label="审核意见"> <el-form-item label="暂无审核信息">
<span>{{ info.schoolAudit.auditOpinion }}</span> </el-form-item>
</el-row>
</template>
</el-form>
</el-tab-pane>
<el-tab-pane label="校工会审核" name="school"
v-if="info.unionAudit">
<el-form class="demo-table-expand" :model="formData" ref="form" :rules="formRules"
label-width="120px" label-suffix=":">
<vi-title title="审核信息"></vi-title>
<template v-if="!info.schoolAudit&&source==2">
<el-row gutter="20">
<el-col :span="12">
<el-form-item prop="username" label="审核人员">
<el-input v-model="formData.username"
disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="auditTime" label="审核时间">
<el-input v-model="formData.auditTime" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item prop="opinion" label="审核意见">
<el-input type="textarea" v-model="formData.auditOpinion" rows="4" maxlength="500"
placeholder="请填写您的审核意见"></el-input>
</el-form-item>
<el-form-item prop="auditSign" label="签字">
<sign v-model="formData.auditSign"></sign>
</el-form-item>
<div style="float: right;margin: 20px 0">
<el-button @click="doAudit(false)" :loading="submitLoading">拒
绝
</el-button>
<el-button type="primary" @click="doAudit(true)"
:loading="submitLoading">通
过
</el-button>
</div>
</template>
<template v-else>
<el-descriptions :column="2" border class="descriptions-form" v-if="info&&info.schoolAudit">
<el-descriptions-item label="审核人员">{{ info.schoolAudit.username }}</el-descriptions-item>
<el-descriptions-item label="审核时间">{{ info.schoolAudit.auditTime }}</el-descriptions-item>
<el-descriptions-item label="审核意见" span="2">{{ info.schoolAudit.auditOpinion }}</el-descriptions-item>
<el-descriptions-item label="签字" span="2">
<el-image
v-if="info.schoolAudit.auditSign"
:src="info.schoolAudit.auditSign"
style="width: 100px; height: 100px"></el-image>
<span v-else>暂无</span>
</el-descriptions-item>
</el-descriptions>
<el-row v-else type="flex" justify="center"> <el-row v-else type="flex" justify="center">
<el-form-item label="暂无审核信息"> <el-form-item label="暂无审核信息">
@@ -348,12 +341,13 @@
{prop: 'mobile', label: '联系电话'}, {prop: 'mobile', label: '联系电话'},
{prop: 'unionname', label: '所属工会', sortable: true}, {prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true}, {prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true}, {prop: 'threeUnitName', label: '所在科室', sortable: true ,checked: 0},
{prop: 'unionGroupName', label: '工会小组', sortable: true}, {prop: 'unionGroupName', label: '工会小组', sortable: true ,checked: 0},
{prop: 'applyDate', label: '申请时间', sortable: true}, {prop: 'applyDate', label: '申请时间', sortable: true},
{prop: 'stateId', label: '状态', sortable: true}, {prop: 'stateId', label: '状态', sortable: true},
], ],
units: [] units: [],
isThreeUnit: null,
} }
}, },
components: { components: {
@@ -367,10 +361,10 @@
this.submitLoading = true this.submitLoading = true
const resp = await $.post("/platform/member/apply/audit/doAudit", this.formData) const resp = await $.post("/platform/member/apply/audit/doAudit", this.formData)
this.submitLoading = false this.submitLoading = false
if(resp.code===0){ if (resp.code === 0) {
this.pageData() this.pageData()
this.$refs.guava.index() this.$refs.guava.index()
}else{ } else {
this.notifyWarning(resp.msg) this.notifyWarning(resp.msg)
} }
}, },
@@ -378,8 +372,8 @@
this.$set(row, "loading", true) this.$set(row, "loading", true)
const resp = await $.get("/platform/member/common/findApplyInfo", {id: row.id}) const resp = await $.get("/platform/member/common/findApplyInfo", {id: row.id})
this.$set(row, "loading", false) this.$set(row, "loading", false)
if(resp.code===0){ if (resp.code === 0) {
const data = resp.data const data = resp.data
data.audit = audit data.audit = audit
this.info = data this.info = data
@@ -403,7 +397,7 @@
username: "${@shiro.getPrincipalProperty('username')}", username: "${@shiro.getPrincipalProperty('username')}",
auditTime: moment().format('YYYY-MM-DD'), auditTime: moment().format('YYYY-MM-DD'),
} }
}else{ } else {
this.notifyWarning(resp.msg) this.notifyWarning(resp.msg)
this.info = {} this.info = {}
} }
@@ -438,6 +432,15 @@
} }
}, },
async created() { async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
if (this.isThreeUnit) {
this.tableColumns.forEach(v => {
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
v.checked = 1
}
})
}
this.pageData(); this.pageData();
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false) this.unions = await getUnions(null, false)
@@ -71,7 +71,7 @@ layout("/layouts/platform.html"){
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button <el-button
:disabled="!((unionInfo.apply||unionInfo.reApply)&&reading)" :disabled="!((unionInfo.apply||unionInfo.reApply))"
type="primary" type="primary"
@click="apply" @click="apply"
style="width: 70%;margin-left: 15%;margin-top: 20px"> style="width: 70%;margin-left: 15%;margin-top: 20px">
@@ -80,12 +80,15 @@ layout("/layouts/platform.html"){
<span v-else>您已是会员</span> <span v-else>您已是会员</span>
</el-button> </el-button>
<el-radio <!--<el-radio
style="width: 70%;margin-left: 15%;margin-top: 20px;color: #F56C6C" style="width: 70%;margin-left: 15%;margin-top: 20px;color: #F56C6C"
v-model="reading" :label="true"> v-model="reading" :label="true">
阅读须知:我自愿加入工会 阅读须知:我自愿加入工会
</el-radio> </el-radio>-->
<el-button style="width: 70%;margin-top: 10px;margin-left: 15%;" type="primary" @click="exportApply">
导出申请表
</el-button>
</div> </div>
</el-card> </el-card>
</div> </div>
@@ -209,8 +212,18 @@ layout("/layouts/platform.html"){
</template> </template>
<template #edit> <template #edit>
<el-form :model="formData" :rules="rules" ref="AddForm" label-width="170px">
<div style="width: 800px;margin: 0 auto;">
<h3 style="text-align: center">中华全国总工会</h3>
<h3 style="text-align: center">入会申请书</h3>
<p style="text-indent: 2em">
我自愿加入中华全国总工会,遵守工会章程,执行工会决议,积极参加工会活动,为全面建成小康社会、把我国建设成为富强民主文明和谐美丽的社会主义现代化强国、实现中华民族伟大复兴的中国梦而奋斗。
</p>
</div>
<el-divider></el-divider>
<el-form :model="formData" :rules="rules" ref="AddForm" label-width="170px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="姓名" prop="username"> <el-form-item label="姓名" prop="username">
@@ -219,13 +232,6 @@ layout("/layouts/platform.html"){
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="工号" prop="loginname">
<el-input disabled placeholder="工号"
v-model="formData.loginname"></el-input>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="性别" prop="sex"> <el-form-item label="性别" prop="sex">
<el-radio v-model="formData.sex" label="男" border size="small">男 <el-radio v-model="formData.sex" label="男" border size="small">男
@@ -237,7 +243,7 @@ layout("/layouts/platform.html"){
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="nation" label="民族"> <el-form-item prop="nation" label="民族">
<el-select placeholder="民族" style="width: 100%" filterable v-model="formData.nation"> <el-select placeholder="请选择民族" style="width: 100%" filterable v-model="formData.nation">
<el-option v-for="nation in nationOptions" :key="nation" :value="nation" <el-option v-for="nation in nationOptions" :key="nation" :value="nation"
:label="nation"></el-option> :label="nation"></el-option>
</el-select> </el-select>
@@ -246,31 +252,24 @@ layout("/layouts/platform.html"){
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="education" label="学历"> <el-form-item prop="education" label="学历">
<dict-select v-model="formData.education" style="width: 100%" <dict-select code="Education" placeholder="请选择学历"
placeholder="请选择学历" style="width: 100%"
code="Education"></dict-select> v-model="formData.education"></dict-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="academicDegree" label="学位">
<dict-select v-model="formData.academicDegree" style="width: 100%"
placeholder="请选择学位"
code="academicDegree"></dict-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="political" label="政治面貌"> <el-form-item prop="political" label="政治面貌">
<el-input maxlength="100" placeholder="政治面貌" <dict-select code="political" placeholder="请选择政治面貌"
v-model="formData.political"></el-input> style="width: 100%"
v-model="formData.political"></dict-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="userState" label="人员类型"> <el-form-item prop="marriage" label="婚姻状况">
<dict-select v-model="formData.personType" style="width: 100%" placeholder="请选择人员类型" <dict-select v-model="formData.marriage" style="width: 100%" placeholder="请选择婚姻状况"
code="UserType"></dict-select> code="maritalStatus"></dict-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -301,42 +300,52 @@ layout("/layouts/platform.html"){
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="8">
<el-form-item prop="registeredResidence" label="户口所在地"> <el-form-item prop="registeredResidence" label="户口所在地">
<el-input maxlength="50" placeholder="请填写户口所在地" <el-input maxlength="50" placeholder="请填写户口所在地"
v-model="formData.registeredResidence" type="textarea" v-model="formData.registeredResidence"></el-input>
rows="3"></el-input> </el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="homeAddress" label="现居住地">
<el-input placeholder="请填写现居住地"
v-model="formData.homeAddress"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item prop="jobTitle" label="岗位">
<el-input placeholder="请填写岗位"
v-model="formData.jobTitle"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="homeAddress" label="现居住地"> <el-form-item prop="vita" label="简历">
<el-input maxlength="50" placeholder="请填写现居住地" <el-input maxlength="500" placeholder="请填写简历"
v-model="formData.homeAddress" type="textarea"
rows="3"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="vita" label="个人工作简历">
<el-input maxlength="50" placeholder="请填写个人工作简历"
v-model="formData.vita" type="textarea" v-model="formData.vita" type="textarea"
rows="3"></el-input> rows="3"></el-input>
</el-form-item> </el-form-item>
<div style="margin: -10px 0 10px 170px">
<span style="color: #ac3111">填写简历时请从大学开始填写,并填写毕业院校</span>
</div>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="specialSkill" label="特长"> <el-form-item prop="specialSkill" label="有何特长">
<el-input maxlength="50" placeholder="请填写特长" <el-input maxlength="50" placeholder="请填写特长"
v-model="formData.specialSkill" type="textarea" v-model="formData.specialSkill" type="textarea"
rows="3"></el-input> rows="3"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="签&emsp;&emsp;字" prop="sign">
<sign :qz.sync="formData.sign" prefix="memberApply"></sign>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="家庭成员"> <el-form-item label="家庭成员">
<span style="color: red">(已结婚填配偶信息,未结婚填父母信息)</span> <span style="color: red">(已结婚填配偶信息,未结婚填父母信息)</span>
<el-button style="float: right;margin-bottom: 10px" icon="el-icon-plus"
size="mini"
@click="formData.family.push({})"> 添加成员
</el-button>
<el-table <el-table
:data="formData.family" :data="formData.family"
border border
@@ -358,13 +367,27 @@ layout("/layouts/platform.html"){
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位" align="center" <el-table-column prop="isCondolence" label="是否慰问" align="center"
header-align="center"> header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入单位" maxlength="100" <el-radio-group v-model="scope.row.isCondolence" size="mini">
v-model="scope.row.unit" clearable></el-input> <el-radio label="是">是</el-radio>
<el-radio label="否">否</el-radio>
</el-radio-group>
<!--<el-input placeholder="请输入单位" maxlength="100"
v-model="scope.row.unit" clearable></el-input>-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="condolenceTime" label="慰问时间" align="center"
header-align="center">
<template slot-scope="scope">
<el-date-picker style="width: 100%" v-model="scope.row.condolenceTime" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" type="date"
placeholder="慰问时间"></el-date-picker>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" <el-table-column prop="remark" label="备注" align="center"
header-align="center"> header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -375,8 +398,17 @@ layout("/layouts/platform.html"){
<el-table-column label="操作" width="100px" align="center" <el-table-column label="操作" width="100px" align="center"
header-align="center"> header-align="center">
<template slot="header" slot-scope="scope">
<el-button type="primary"
size="mini"
icon="el-icon-plus"
@click="formData.family.push({})">
</el-button>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="danger" icon="el-icon-delete" circle <el-button type="danger" icon="el-icon-delete"
size="mini"
:disabled="formData.family.length===0" :disabled="formData.family.length===0"
@click="formData.family.splice(scope.$index,1)"></el-button> @click="formData.family.splice(scope.$index,1)"></el-button>
</template> </template>
@@ -387,12 +419,11 @@ layout("/layouts/platform.html"){
</el-row> </el-row>
</el-form> </el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()">取消</el-button>
<!-- <member ref="member" :id="'${@shiro.getPrincipalProperty('id')}'" @save="doApply"></member>--> <el-button type="primary" @click="doSubmit">提交</el-button>
</el-row>
</template> </template>
<template #view> <template #view>
@@ -516,6 +547,9 @@ layout("/layouts/platform.html"){
} }
}, },
exportApply() {
window.open(loc() + '/exportApply')
}
}, },
async created() { async created() {
this.getUnionInfo() this.getUnionInfo()
@@ -11,6 +11,9 @@ layout("/layouts/platform.html"){
.div-enum .el-select__caret{ .div-enum .el-select__caret{
line-height: 10px; line-height: 10px;
} }
.search .search-query{
width: 300px;
}
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
@@ -187,6 +190,8 @@ layout("/layouts/platform.html"){
<div class="search-query"> <div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索 <el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button> </el-button>
<el-button v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}"
type="primary" icon="el-icon-printer" @click="openImport">导入会员</el-button>
<more v-model="searchMore"></more> <more v-model="searchMore"></more>
</div> </div>
</div> </div>
@@ -217,8 +222,10 @@ layout("/layouts/platform.html"){
</el-radio-group> </el-radio-group>
<div v-if="pageForm.changed == '1'" class="div-enum"> <div v-if="pageForm.changed == '1'" class="div-enum">
<enum-select clearable enum="UserChangeType" <enum-select enum="UserChangeType"
label="description" label="description"
clearable
style="width: 100%"
placeholder="异动类型" placeholder="异动类型"
@change="doSearch" @change="doSearch"
v-model="pageForm.changeTypes" v-model="pageForm.changeTypes"
@@ -738,6 +745,10 @@ layout("/layouts/platform.html"){
<user-change-history ref="userChangeHistory"></user-change-history> <user-change-history ref="userChangeHistory"></user-change-history>
<el-dialog title="会员导入" :visible.sync="dialogVisible" width="50%" :close-on-click-modal="false">
<file-import ref="viewImport" :temp_url="tempUrl"
:post_url="postUrl" :is_show_radio="isShowRadio"></file-import>
</el-dialog>
</div> </div>
<script> <script>
@@ -839,6 +850,11 @@ layout("/layouts/platform.html"){
batchFormDataUserState: {}, batchFormDataUserState: {},
batchEditVisibleUserState: false, batchEditVisibleUserState: false,
dialogVisible:false,
tempUrl:'/platform/member/change/mange/downloadImport',
postUrl:'/platform/member/change/mange/doImport',
isShowRadio:false,
} }
}, },
components: { components: {
@@ -850,8 +866,12 @@ layout("/layouts/platform.html"){
'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'), 'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'),
'member-user-select': httpVueLoader('/components/plugins/MemberUserTableSelect.vue?v=1.0.0'), 'member-user-select': httpVueLoader('/components/plugins/MemberUserTableSelect.vue?v=1.0.0'),
'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=' + new Date().getTime()), 'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=' + new Date().getTime()),
'file-import': httpVueLoader('/components/plugins/FileImport.vue')
}, },
methods: { methods: {
openImport(){
this.dialogVisible = true;
},
async openUserChangeInfo({hisId}) { async openUserChangeInfo({hisId}) {
this.$refs.userChangeHistory.openUserChangeInfo(hisId) this.$refs.userChangeHistory.openUserChangeInfo(hisId)
}, },
@@ -1136,6 +1156,9 @@ layout("/layouts/platform.html"){
sublime.showLoadingbar(); sublime.showLoadingbar();
this.tableLoading = true this.tableLoading = true
const pageForm = clone(this.pageForm) const pageForm = clone(this.pageForm)
if (pageForm.changeTypes === ""){
pageForm.changeTypes = []
}
pageForm.changeTypes = JSON.stringify(pageForm.changeTypes) pageForm.changeTypes = JSON.stringify(pageForm.changeTypes)
$.post(loc() + '/pageData', pageForm, (data) => { $.post(loc() + '/pageData', pageForm, (data) => {
sublime.closeLoadingbar(); sublime.closeLoadingbar();
@@ -1171,7 +1194,6 @@ layout("/layouts/platform.html"){
this.unitMoveUnions = clone(this.unions) this.unitMoveUnions = clone(this.unions)
this.campusOptions = await getCampus() this.campusOptions = await getCampus()
this.changeType = await this.getChangeType() this.changeType = await this.getChangeType()
} }
}) })
</script> </script>
@@ -78,40 +78,42 @@ layout("/layouts/platform.html"){
</div> </div>
<template v-if="searchMore"> <template v-if="searchMore">
<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select v-model="pageForm.unionGroupId" style="width: 100%"
filterable
clearable
@change="getThreeUnits"
placeholder="请选择">
<el-option
v-for="item in unionGroups"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item"> <template v-if="isThreeUnit">
<div class="search-item-label">组成科室:</div> <div class="search-item">
<div class="search-item-option"> <div class="search-item-label">工会小组:</div>
<el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable <div class="search-item-option">
clearable <el-select v-model="pageForm.unionGroupId" style="width: 100%"
placeholder="请选择"> filterable
<el-option clearable
v-for="item in threeUnits" @change="getThreeUnits"
:key="item.id" placeholder="请选择">
:label="item.name" <el-option
:value="item.id"> v-for="item in unionGroups"
</el-option> :key="item.id"
</el-select> :label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
</div> </div>
</div>
<div class="search-item">
<div class="search-item-label">组成科室:</div>
<div class="search-item-option">
<el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable
clearable
placeholder="请选择">
<el-option
v-for="item in threeUnits"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<!--<div class="search-item"> <!--<div class="search-item">
<div class="search-item-label">人员类型:</div> <div class="search-item-label">人员类型:</div>
@@ -386,8 +388,8 @@ layout("/layouts/platform.html"){
{prop: 'userState', label: '在职状态', sortable: true}, {prop: 'userState', label: '在职状态', sortable: true},
{prop: 'unionname', label: '所属工会', sortable: true}, {prop: 'unionname', label: '所属工会', sortable: true},
{prop: 'unitname', label: '所属单位', sortable: true}, {prop: 'unitname', label: '所属单位', sortable: true},
{prop: 'threeUnitName', label: '所在科室', sortable: true}, {prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
{prop: 'unionGroupName', label: '工会小组', sortable: true}, {prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0}, {prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
{prop: 'marriage', label: '婚否', checked: 0}, {prop: 'marriage', label: '婚否', checked: 0},
{prop: 'education', label: '学历', checked: 0}, {prop: 'education', label: '学历', checked: 0},
@@ -407,6 +409,7 @@ layout("/layouts/platform.html"){
); );
} }
}, },
isThreeUnit: null,
} }
}, },
components: { components: {
@@ -559,6 +562,14 @@ layout("/layouts/platform.html"){
}, },
}, },
async created() { async created() {
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
if (this.isThreeUnit) {
this.tableColumns.forEach(v => {
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
v.checked = 1
}
})
}
this.pageData(); this.pageData();
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false) this.unions = await getUnions(null, false)
@@ -574,4 +585,4 @@ layout("/layouts/platform.html"){
</script> </script>
<!--# <!--#
} }
#--> #-->
+216 -77
View File
@@ -114,19 +114,19 @@
} }
} }
.login-code{ .icp {
color: black;
bottom: 33px;
position: absolute;
display: inline-block; display: inline-block;
float: right; left: 50%;
width: 38%; transform: translateX(-50%);
height: 38px;
} }
.icp a {
.login-code img{ text-decoration: none;
vertical-align: middle; color: black;
cursor: pointer;
} }
</style> </style>
</head> </head>
@@ -151,6 +151,7 @@
<div class="login-container"> <div class="login-container">
<div class="login-content"> <div class="login-content">
<div class="mobile-login-img"> <div class="mobile-login-img">
<embed src="/m-login.svg" style="width: 100%" type="image/svg+xml"/> <embed src="/m-login.svg" style="width: 100%" type="image/svg+xml"/>
</div> </div>
@@ -160,79 +161,112 @@
${AppName!}系统登录 ${AppName!}系统登录
</h4> </h4>
<el-tabs class="login-tabs"> <el-tabs class="login-tabs">
<el-tab-pane label="用户名登录"> <!--<el-tab-pane label="用户名登录" name="1">
<el-form :model="loginForm" :rules="loginRules" auto-complete="on" <el-form v-if="activeName == '1'" :model="loginForm" :rules="loginRules" auto-complete="on" class="login-form"
class="login-form"
ref="loginForm"> ref="loginForm">
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
placeholder="账号或手机号码" placeholder="请输入用户名"
prefix-icon="el-icon-user" prefix-icon="el-icon-user"
type="text" type="text"
v-model="loginForm.username" v-model="loginForm.username">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input
@keyup.enter.native="doLogin" @keyup.enter.native="doLogin"
placeholder="密码" placeholder="请输入密码"
prefix-icon="el-icon-lock" prefix-icon="el-icon-lock"
type="password" type="password"
v-model="loginForm.password" v-model="loginForm.password">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="platformCaptcha">
<el-input
@keyup.enter.native="doLogin"
placeholder="验证码"
prefix-icon="el-icon-lock"
style="width: 60%"
type="password"
v-model="loginForm.platformCaptcha"
>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" alt="">
</div>
</el-form-item>
<el-form-item> <el-form-item>
<el-button :disabled="disabled" <el-button :disabled="disabled"
:loading="loading" :loading="loading"
@click.native.prevent="doLogin" @click.native.prevent="handleLogin"
class="login-button"
type="primary">
<span v-if="!loading">登 录</span>
<span v-else>登录中...</span>
</el-button>
</el-form-item>
</el-form>
</el-tab-pane>-->
<el-tab-pane label="短信快捷登陆">
<el-form :model="loginForm" :rules="loginRules" auto-complete="on" class="login-form"
ref="loginForm">
<el-form-item prop="mobile">
<el-input
placeholder="请输入手机号"
prefix-icon="el-icon-phone-outline"
type="text" maxlength="11"
v-model.number="loginForm.mobile">
</el-input>
</el-form-item>
<el-form-item prop="platformCaptcha">
<el-input @keyup.enter.native="doLogin" placeholder="请输入手机动态码" prefix-icon="el-icon-unlock" v-model="loginForm.platformCaptcha">
<el-button @click="sendCode()" type="primary" slot="append">{{ codeMsg }}</el-button>
</el-input>
</el-form-item>
<el-form-item>
<el-button :disabled="disabled"
:loading="loading"
@click.native.prevent="handleLogin"
class="login-button" class="login-button"
type="primary"> type="primary">
<span v-if="!loading">登 录</span> <span v-if="!loading">登 录</span>
<span v-else>登录中...</span> <span v-else>登录中...</span>
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</div> </div>
<!--滑块验证-->
<el-dialog title="请拖动滑块完成拼图" width="360px" :visible.sync="isShowSliderVerify" :close-on-click-modal="false" @closed="refresh" append-to-body>
<slider-verify ref="sliderVerify" @success="onSuccess" @fail="onFail" @again="onAgain"></slider-verify>
</el-dialog>
<!--<div class="icp">
ICP证:<a href="https://beian.miit.gov.cn/" target="_blank">鄂ICP备16009506号-5</a>
</div>-->
</div> </div>
</div> </div>
</body> </body>
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script> <script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script> <script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
<script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script> <script src="${base!}/assets/platform/plugins/jquery/jquery-3.5.1.min.js"></script>
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
<script> <script>
var vue = new Vue({ Vue.use(httpVueLoader)
</script>
<script>
const vue = new Vue({
el: '#app', el: '#app',
data() { data() {
return { return {
// 是否禁用按钮
codeDisabled: false,
// 倒计时秒数
countdown: 60,
// 按钮上的文字
codeMsg: '获取动态码',
// 定时器
timer: null,
// 是否显示滑块验证
isShowSliderVerify: false,
loginForm: { loginForm: {
username: '', username: '',
password: '', password: '',
platformKey: '', platformKey: '',
platformCaptcha: "", platformCaptcha: '',
// 随机字符串
nonceStr: '',
// 验证值
value: '',
}, },
loginRules: { loginRules: {
username: [ username: [
@@ -241,46 +275,159 @@
password: [ password: [
{required: true, trigger: ['blur', 'change'], message: '密码不能为空'}, {required: true, trigger: ['blur', 'change'], message: '密码不能为空'},
], ],
mobile: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确', trigger: 'blur' }
],
platformCaptcha: [ platformCaptcha: [
{required: true, trigger: ['blur', 'change'], message: '验证码不能为空'}, {required: true, trigger: ['blur', 'change'], message: '动态码不能为空'},
], ],
}, },
loading: false, loading: false,
disabled: false, disabled: false,
codeUrl: "${base!}/platform/login/captcha",
} }
}, },
components: {
'slider-verify': httpVueLoader('/components/captcha/sliderVerify.vue'),
},
methods: { methods: {
async doLogin() { sendCode() {
try { if(this.codeDisabled) {
const valid = await this.$refs['loginForm'].validate() return
if (valid) { }
this.loading = true this.$refs.loginForm.validateField('mobile', async (valid) => {
const resp = await $.post("${base!}/platform/login/doLogin", this.loginForm) if(!valid) {
this.loading = false const resp = await this.validMobile();
if (resp.code === 0) { if (resp.code !== 0){
this.$message.success(resp.msg) this.$message.warning(resp.msg)
this.disabled = true return
setTimeout(() => { }
const redirect = this.getQueryString("redirect")
if (redirect) { /*发送验证码功能*/
window.location.href = redirect //若发送验证码成功,则调用倒计时函数
} else if (this.isMobile()) { const {code, data} = await $.post('/platform/login/mobileCaptcha', {mobile: this.loginForm.mobile})
window.location.href = "${base!}/mobile/index" if(code === 0) {
} else { this.loginForm.platformKey = data.key
window.location.href = "${base!}/platform/home" this.getCode();
}
}, 1000)
} else { } else {
this.$message.error(resp.msg) this.$message({showClose: true, type: 'warning', message: '动态码发送失败,请联系管理员'});
this.getCode()
} }
} }
} catch (e) { })
console.log(e) },
// 获取验证码
getCode() {
// 验证码60秒倒计时
if (!this.timer) {
this.timer = setInterval(() => {
if (this.countdown > 0 && this.countdown <= 60) {
this.countdown--;
if (this.countdown !== 0) {
this.codeDisabled = true;
this.codeMsg = "重新发送(" + this.countdown + ")";
} else {
clearInterval(this.timer);
this.codeMsg = "获取动态码";
this.countdown = 60;
this.timer = null;
this.codeDisabled = false;
}
}
}, 1000)
} }
}, },
//验证手机号是否存在
async validMobile() {
return await $.post('${base!}/platform/login/validMobile', {mobile: this.loginForm.mobile})
},
//验证图片滑动
async validVerify() {
return await $.post('${base!}/platform/login/validVerify', {
nonceStr: this.loginForm.nonceStr,
value: this.loginForm.value,
})
},
/* 滑动验证成功*/
async onSuccess(captcha) {
Object.assign(this.loginForm, captcha);
const resp = await this.validVerify()
if(resp.code === 0) {
await this.doLogin();
} else {
this.$refs.sliderVerify.verifyFailEvent(resp.msg);
}
},
/* 滑动验证失败*/
onFail(msg) {
this.message('error', msg || '验证失败,请控制拼图对齐缺口');
},
/* 滑动验证异常*/
onAgain() {
this.message('error', '滑动操作异常,请重试');
this.$refs.sliderVerify.refresh();
},
/* 刷新验证码*/
refresh() {
this.$refs.sliderVerify.refresh();
},
/* 提示弹框*/
message(type, message) {
this.$message({
showClose: true,
type: type,
message: message,
duration: 1500,
});
},
handleLogin() {
let self = this;
self.$refs.loginForm.validate((flag) => {
self.isShowSliderVerify = flag;
});
},
async doLogin() {
const valid = await this.$refs['loginForm'].validate()
if (valid) {
this.loginForm.loginType = 'SMS_CODE'
const resp = await $.post('${base!}/platform/login/doLogin', this.loginForm)
if (resp.code === 0) {
this.$message.success(resp.msg)
setTimeout(() => {
const redirect = this.getQueryString("redirect")
if (redirect) {
window.location.href = redirect
} else if (this.isMobile()) {
window.location.href = "${base!}/mobile/index"
} else {
window.location.href = "${base!}/platform/home"
}
}, 1000)
} else {
this.$message.error(resp.msg)
this.isShowSliderVerify = false;
}
}
/*$.post(url, self.loginForm, function (d) {
if (d.code == 0) {
self.$refs.sliderVerify.verifySuccessEvent();
self.$message({
showClose: true,
type: 'success',
message: '登录成功,正在跳转首页...',
duration: 1000
});
setTimeout(() => {
window.location.href = "${base!}/platform/home"
}, 500);
} else {
self.$message({
message: d.msg,
type: 'error'
})
self.isShowSliderVerify = false;
}
}, "json");*/
},
getQueryString(name) { getQueryString(name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
let r = window.location.search.substr(1).match(reg); let r = window.location.search.substr(1).match(reg);
@@ -303,24 +450,16 @@
isMobile = true; isMobile = true;
} }
return isMobile; return isMobile;
},
async getCode() {
const {data} = await $.get('/platform/login/captcha')
this.codeUrl = data.codeUrl
this.loginForm.platformKey = data.key
} }
},
created() {
this.year = new Date().getFullYear()
}, },
mounted() { mounted() {
window.addEventListener('pageshow', (event) => { window.addEventListener('pageshow', (event) => {
console.log(event)
this.loading = false this.loading = false
this.disabled = false this.disabled = false
}) })
},
created(){
this.getCode()
} }
}) })
</script> </script>
@@ -674,7 +674,7 @@ layout("/layouts/platform.html"){
'user-select': httpVueLoader('/components/plugins/UserTableSelect.vue?v=1.0.0'), 'user-select': httpVueLoader('/components/plugins/UserTableSelect.vue?v=1.0.0'),
'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'), 'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'),
'mem-change-apply': httpVueLoader('/components/member/MemChangeApply.vue?v=' + new Date().getTime()), 'mem-change-apply': httpVueLoader('/components/member/MemChangeApply.vue?v=' + new Date().getTime()),
'user-change-history': httpVueLoader('/components/userChangeHistory/userChangeHistory.vue?v=1.0.1'), 'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=1.0.1'),
}, },
methods: { methods: {
async openUserChangeInfo({hisId}) { async openUserChangeInfo({hisId}) {
@@ -466,7 +466,7 @@ layout("/layouts/platform.html"){
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'), 'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'), 'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'), 'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
'user-change-history': httpVueLoader('/components/userChangeHistory/userChangeHistory.vue?v=1.0.1'), 'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=1.0.1'),
}, },
data() { data() {
return { return {
@@ -412,7 +412,7 @@ layout("/layouts/platform.html"){
'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'), 'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'),
'user-select': httpVueLoader('/components/plugins/UserTableSelect.vue?v=1.0.0'), 'user-select': httpVueLoader('/components/plugins/UserTableSelect.vue?v=1.0.0'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.4'), 'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.4'),
'user-change-history': httpVueLoader('/components/userChangeHistory/userChangeHistory.vue?v=1.0.1'), 'user-change-history': httpVueLoader('/components/userChangeHistory/UserChangeHistory.vue?v=1.0.1'),
}, },
computed: { computed: {
allowOperationTask() { allowOperationTask() {
@@ -1,355 +1,63 @@
<!--# <!--#
layout("/layouts/platform.html"){ layout("/layouts/platform.html"){
#--> #-->
<style> <style>
.card-title {
margin-bottom: 20px;
letter-spacing: 2px;
display: flex;
justify-content: space-between;
height: 30px;
line-height: 30px;
}
.card-title .title-left {
font-size: 25px;
}
.card-title .title-right {
text-align: right;
font-size: 15px;
color: #0e78c5;
cursor: pointer;
}
.card-title .title-right:hover {
text-decoration: underline;
}
.el-date-editor.el-input, .el-select, .el-input-number {
width: 100%;
}
.addFormCard {
}
.excelCard {
min-height: 650px;
}
.excelBack {
font-size: 15px;
color: #0e78c5;
cursor: pointer;
}
.excelBack:hover {
text-decoration: underline;
}
.el-icon-loading {
font-size: 30px;
}
.el-input-number__decrease, .el-input-number__increase {
display: none;
}
.el-input-number .el-input__inner {
padding: 0 15px;
text-align: left;
}
.el-icon-eleme:before {
content: '元';
}
.submitClass {
text-align: right;
}
.ivu-upload {
display: inline;
}
.el-table th.gutter {
display: table-cell !important
}
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
<guava> <zc-add ref="zcAdd"></zc-add>
<template>
<el-card shadow="never">
<div slot="header" class="clearfix">
<span style="color: #409EFF;font-size: 18px"><h3>资产登记</h3></span>
<div style="padding: 20px;margin-top: 10px">
<el-form :model="formData" ref="form" :rules="formRules" label-width="140px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item prop="assetNumber" label="资产编号">
<el-input v-model="formData.assetNumber" placeholder="资产编号"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="assetName" label="资产名称">
<el-input v-model="formData.assetName" placeholder="资产名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="financeSixName" label="财政六大类名称">
<el-input v-model="formData.financeSixName" placeholder="财政六大类名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="unitId" label="所属学院">
<el-select placeholder="所属单位" v-model="formData.unitId" style="width: 100%;"
clearable="true"
@change="flushUnits"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:key="item.id" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="threeUnitId" label="领用单位(科室)">
<el-select placeholder="请选择领用单位(科室)"
v-model="formData.threeUnitId" style="width: 100%;"
clearable="true"
filterable="true">
<el-option v-for="item in threeUnits" :key="item.id"
:label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="assetModel" label="型号">
<el-input v-model="formData.assetModel" placeholder="型号"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="originalValue" label="原值">
<el-input-number v-model="formData.originalValue"
:min="0"
:max="9999999"
:precision="2"
placeholder="原值"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="assetSources" label="资产来源">
<el-input v-model="formData.assetSources" placeholder="资产来源"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="assetStatus" label="现状">
<el-select placeholder="请选择现状" v-model="formData.assetStatus" style="width: 100%;"
clearable="true"
multiple
filterable="true">
<el-option v-for="item in asseStatusList" :label="item.categoryName"
:key="item.contentCode" :value="item.contentCode"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="minimumUsageYear" label="最低使用年限">
<el-input-number v-model="formData.minimumUsageYear"
placeholder="最低使用年限"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="recipientUserId" label="领用人">
<el-select v-model="formData.recipientUserId" placeholder="可根据工号或姓名搜索领用人"
filterable
remote
clearable
reserve-keyword
:remote-method="remoteMethod"
:loading="selectLoading"
style="width: 100%">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+'-'+item.loginname+'-'+item.unitname"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col span="24">
<el-form-item prop="remark" label="备注">
<el-input v-model="formData.remark"
rows="2" type="textarea"
placeholder="请填写备注"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col span="12">
<el-form-item prop="storageLocation" label="存放地">
<el-input v-model="formData.storageLocation"
placeholder="存放地"></el-input>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item prop="purchaseDate" label="购置日期">
<el-date-picker
style="width: 100%"
v-model="formData.purchaseDate"
value-format="yyyy-MM-dd"
type="datetime"
placeholder="请选择购置日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item prop="storageDate" label="入库日期">
<el-date-picker
style="width: 100%"
v-model="formData.storageDate"
value-format="yyyy-MM-dd"
type="datetime"
placeholder="请选择入库日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col span="24">
<el-form-item prop="competentDepartmentRemark" label="主管部门备注">
<el-input v-model="formData.competentDepartmentRemark"
rows="2" type="textarea"
placeholder="请填写主管部门备注"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row justify="center" type="flex">
<el-button @click="history.go(-1)" type="primary"
v-if="this.formData.id"
style="width: 200px">返 回</el-button>
<!--<el-button @click="doSave" type="primary"
style="width: 200px">保 存</el-button>-->
<el-button @click="doSubmit" type="primary"
style="width: 200px">提 交</el-button>
</el-button>
</el-row>
</div>
</div>
</el-card>
</template>
</guava>
</div> </div>
<script> <script>
const vue = new Vue({ const vue = new Vue({
el: '#app', el: '#app',
mixins:[initTableMixins], data() {
data(){ return {}
return{ },
id:GetQueryString("id"), components: {
units: [], 'zc-add': httpVueLoader('/components/zcgl/zcAdd.vue?v=' + new Date().getTime()),
threeUnits: [],
asseStatusList:[],
userList:[],
selectLoading: false,
formRules: {
assetNumber: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
}
}, },
methods: { methods: {
async doSubmit(){ doSubExcel: function () {
var self = this;
let postUrl = this.formData.id ? '/platform/zcgl/zcdj/doEdit' : '/platform/zcgl/zcdj/doSubmit' if (!self.tableData.length > 0) {
this.$refs["form"].validate(async (valid) => { self.$message.warning('请先上传excel');
if (valid) { return;
const loading = this.$loading({ }
lock: true, const loading = this.$loading({
text: '正在提交...', lock: true,
spinner: 'el-icon-loading', text: '上传中',
background: COVER_LAYER_COLOR spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.post(base + '/platform/zcgl/zcdj/doExcelSubmit', {data: JSON.stringify(self.tableData)}, function (data) {
if (data.code == 0) {
self.$message({
message: data.msg,//提示的信息
type: 'success',  //类型是成功
offset: 225,  //距离窗口顶部的偏移量
duration: 2000,  //显示时间, 毫秒。设为 0 则不会自动关闭
onClose: () => {
self.tableData = [];
self.file = null;
window.location.href = '/platform/zcgl/tzgl';
}
}); });
this.formData.assetStatus = JSON.stringify(this.formData.assetStatus)
const resp = await $.post(postUrl, this.formData)
loading.close()
if (resp.code === 0) {
this.$message.success('操作成功')
setTimeout(()=>{
window.location.href = '/platform/zcgl/tzgl'
},500)
} else {
this.$message.warning('操作失败')
}
}
})
},
async remoteMethod(query) {
if (query) {
this.selectLoading = true;
this.userList = await searchUser(query, '${@shiro.getPrincipalProperty("union").getId()}', null, null, null)
this.selectLoading = false;
}
},
async getAllAsseStatus(){
const resp = await $.post('/platform/zcgl/zclb/queryLb')
if (resp.code === 0){
this.asseStatusList = resp.data
}
},
async findOne(){
const resp = await $.post('/platform/zcgl/zcdj/findOne',{id:this.formData.id})
if (resp.code === 0){
this.formData.assetStatus = []
this.formData = resp.data
this.formData.assetStatus = resp.data.assetStatus
if (this.formData.recipientUserId) {
this.userList = await searchUser(this.formData.recipientLoginName, null, null, null, null)
console.log(this.userList)
} else { } else {
this.formData.recipientUserId = resp.data.recipientUsername self.$message.error(data.msg);
this.formData.threeUnitId = resp.data.threeUnitName
this.formData.unitId = resp.data.unitName
} }
} }).complete(function () {
}, loading.close();
async flushUnits() { });
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits()
this.threeUnits = await threeUnitsByUnionGroupOrUnitId(this.formData.unitId,null)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
this.threeUnits = await threeUnitsByUnionGroupOrUnitId(this.formData.unitId,null)
}
}, },
}, },
async created() { async created() {
if (GetQueryString("id")) {
this.formData.id = this.id
await this.findOne()
}
this.flushUnits()
await this.getAllAsseStatus();
},
},
}); });
</script> </script>
<!--# <!--#
@@ -0,0 +1,129 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
@change="doSearch"
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</el-card>
<el-card class="mt20" shadow="never">
<table-tool :app="this" label="报废列表">
<template #func>
</template>
</table-tool>
<el-table :data="tableData"
header-align="center" ref="table"
row-key="zcbdid">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号"
type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column label="操作" width="300">
<template scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看
</el-button>
<el-button @click="exportDetails(row)" size="mini" type="primary">
导出报废申请表
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<el-table :data="findData.zcxxs"
header-align="center" ref="table"
row-key="zcbdid">
<el-table-column label="序号"
type="index"
width="80px"></el-table-column>
<el-table-column align="center" header-align="center" label="资产编号"
prop="zcbh"></el-table-column>
<el-table-column align="center" header-align="center" label="资产名称"
prop="zcmc"></el-table-column>
<el-table-column align="center" header-align="center" label="单价"
prop="zcdj"></el-table-column>
<el-table-column align="center" header-align="center" label="台件"
prop="sl"></el-table-column>
<el-table-column align="center" header-align="center" label="资产规格型号"
prop="zcxh"></el-table-column>
<el-table-column align="center" header-align="center" label="购置日期"
prop="zcgzrq"></el-table-column>
<el-table-column align="center" header-align="center" label="领用人"
prop="zclyrname"></el-table-column>
</el-table>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: moment().format('YYYY') + ""
},
tableColumns: [
{prop: 'zcbdsj', label: '报废时间'},
{prop: 'bfNum', label: '报废条数'},
{prop: 'slSum', label: '报废总台件'},
{prop: 'djSum', label: "报废资产总价"},
],
findData: [],
}
},
methods: {
exportDetails(row) {
window.open("/platform/zcgl/bfList/exportDetails?zcbdid=" + row.zcbdid)
},
openView(row) {
this.findData = row
this.$refs.guava.view()
}
},
async created() {
this.pageData();
}
})
</script>
<!--#
}
#-->
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,224 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
@change="doSearch"
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</el-card>
<el-card class="mt20" shadow="never">
<table-tool :app="this" label="计划列表">
<template #func>
<el-button @click="openAdd" icon="el-icon-s-promotion" size="small"
type="primary">新建盘点计划
</el-button>
</template>
</table-tool>
<el-table :data="tableData"
class="vi-table"
ref="table"
row-key="id" style="width: 100%">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column label="操作" width="300">
<template scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看
</el-button>
<el-button @click="openEdit(row)" size="mini" type="primary">编辑
</el-button>
<el-button @click="doDelete(row)" size="mini" type="danger">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
<el-dialog
:close-on-click-modal="false"
:title="title"
:visible.sync="dialogVisible"
width="40%">
<el-form :model="formData" :rules="formRules" label-width="100px" ref="addForm">
<el-form-item label="年度" prop="year">
<el-date-picker
:disabled="isView"
placeholder="选择年度"
style="width: 100%"
type="year"
v-model="formData.year"
value-format="yyyy">
</el-date-picker>
</el-form-item>
<el-form-item label="计划时间" prop="planDate">
<el-date-picker
:disabled="isView"
end-placeholder="结束日期"
start-placeholder="开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.planDate"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
<el-form-item label="说明" prop="note">
<el-input
:disabled="isView"
:rows="3"
placeholder="请输入说明"
type="textarea"
v-model="formData.note">
</el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer" v-if="!isView">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button @click="doSubmit" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
isView: false,
title: "",
dialogVisible: false,
pageForm: {
year: moment().format('YYYY') + ""
},
formData: {
year: null,
planDate: [],
note: null,
},
formRules: {
year: [{required: true, message: '必选', trigger: ['blur', 'change']}],
planDate: [{
required: true,
message: '必选',
trigger: ['blur', 'change']
}],
},
tableColumns: [
{prop: 'year', label: '年度'},
{prop: 'startDate', label: '开始时间'},
{prop: 'endDate', label: '结束时间'},
{prop: 'createDate', label: "创建时间"},
],
}
},
methods: {
openView(row) {
this.isView = true
this.title = "查看计划"
this.formData = {
year: row.year,
planDate: [row.startDate, row.endDate],
note: row.note
}
this.dialogVisible = true
},
openEdit(row) {
this.isView = false
this.title = "编辑计划"
this.formData = {
id: row.id,
year: row.year,
planDate: [row.startDate, row.endDate],
note: row.note
}
this.dialogVisible = true
},
async doDelete(row) {
const confirm = await this.$confirm('确定删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
const resp = await $.post(loc() + '/doDelete', {id: row.id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyError(resp.msg)
}
}
},
doSubmit() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
const formData = clone(this.formData)
formData.startDate = formData.planDate[0]
formData.endDate = formData.planDate[1]
const resp = await $.post('/platform/zcgl/zcdj/plan/doSubmit', formData)
if (resp.code === 0) {
this.doSearch()
this.notifySuccess(resp.msg)
} else {
this.notifyError(resp.msg)
}
this.dialogVisible = false
}
})
},
openAdd() {
this.title = "新增计划"
this.formData = {
year: moment().format('YYYY') + "",
planDate: [],
note: null
}
this.dialogVisible = true
},
},
async created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -6,30 +6,36 @@ layout("/layouts/platform.html"){
<guava ref="guava"> <guava ref="guava">
<el-card shadow="never"> <el-card shadow="never">
<div class="search"> <div class="btn-group tool-button mt5">
<div class="search-item"> <el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable @keyup.enter.native="doSearch">
<div class="search-item-label">状态名称</div> <el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 120px;">
<div class="search-item-option"> <el-option label="内容" value="content"></el-option>
<el-input v-model="pageForm.categoryName" placeholder="请输入状态名称" clearable></el-input> </el-select>
</div> </el-input>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索
</el-button>
</div>
</div> </div>
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.category" clearable placeholder="所属类别">
<el-option v-for="item in categoryList" :label="item" :value="item"></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button type="primary" @click="openAdd">
<i class="ti-plus"></i>
新增内容
</el-button>
</div>
</el-card> </el-card>
<el-card shadow="never" class="mt10"> <el-card shadow="never" class="mt10">
<table-tool label="状态列表" :app="this"> <table-tool label="类别列表" :app="this"></table-tool>
<template #func>
<el-button type="primary" size="small" @click="openAdd">
<i class="ti-plus"></i>
新增
</el-button>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" style="width: 100%"> <el-table :data="tableData" :size="tableSize" style="width: 100%">
<el-table-column type="index" label="序号" width="80px"></el-table-column> <el-table-column type="index" label="序号" width="80px"></el-table-column>
<el-table-column <el-table-column
@@ -41,6 +47,7 @@ layout("/layouts/platform.html"){
:prop="column.prop" :prop="column.prop"
:sortable="column.sortable" :sortable="column.sortable"
> >
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="250"> <el-table-column align="center" header-align="center" label="操作" width="250">
<template scope="{row}"> <template scope="{row}">
@@ -55,17 +62,25 @@ layout("/layouts/platform.html"){
</guava> </guava>
<el-dialog <el-dialog
:title="dialogTitle" title=""
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="40%" width="40%"
:close-on-click-modal="false"> :close-on-click-modal="false">
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="80px"> <el-form :model="formData" :rules="rules" ref="ruleForm" label-width="120px">
<el-form-item label="编码" prop="contentCode"> <el-form-item label="编码" prop="contentCode">
<el-input v-model="formData.contentCode" maxlength="30" placeholder="编码" type="number"></el-input> <el-input v-model="formData.contentCode" maxlength="30" placeholder="编码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态名称" prop="categoryName"> <el-form-item label="内容" prop="content">
<el-input v-model="formData.categoryName" maxlength="30" placeholder="状态名称"></el-input> <el-input v-model="formData.content" maxlength="30" placeholder="内容"></el-input>
</el-form-item>
<el-form-item label="折旧年限(年)" prop="depreciationYear">
<el-input v-model="formData.depreciationYear" maxlength="30" placeholder="折旧年限(年)"></el-input>
</el-form-item>
<el-form-item label="所属类别" prop="content">
<el-select v-model="formData.category" clearable placeholder="所属类别" style="width: 100%">
<el-option v-for="item in categoryList" :label="item" :value="item"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -84,20 +99,29 @@ layout("/layouts/platform.html"){
return { return {
tableColumns: [ tableColumns: [
{prop: 'contentCode', label: '编码'}, {prop: 'contentCode', label: '编码'},
{prop: 'categoryName', label: '状态名称'}, {prop: 'content', label: '内容'},
{prop: 'category', label: '所属类别'},
{prop: 'depreciationYear', label: '折旧年限(年)'},
], ],
dialogVisible: false, dialogVisible: false,
categoryList: ['房屋及构筑物', '通用设备', '专用设备', '家具、用具及装具'],
pageForm: {
searchName: 'content'
},
rules: { rules: {
contentCode: [{required: true, message: '请输入编码', trigger: ['change', 'blur']}], contentCode: [{required: true, message: '请输入编码', trigger: ['change', 'blur']}],
categoryName: [{required: true, message: '请输入状态名称', trigger: ['change', 'blur']}], content: [{required: true, message: '请输入内容', trigger: ['change', 'blur']}],
category: [{required: true, message: '请选择所属类别', trigger: ['change', 'blur']}],
depreciationYear: [{required: true, message: '请输入折旧年限', trigger: ['change', 'blur']}],
}, },
dialogTitle:'',
} }
}, },
methods: { methods: {
openEdit(row) { openEdit(row) {
this.dialogTitle = '编辑状态' const data = clone(row)
this.formData = clone(row) this.formData = data
this.$set(this.formData, "oldContentCode", data.contentCode)
this.$set(this.formData, "oldDepreciationYear", data.depreciationYear)
this.dialogVisible = true this.dialogVisible = true
}, },
openAdd() { openAdd() {
@@ -105,7 +129,6 @@ layout("/layouts/platform.html"){
if (this.$refs['ruleForm']) { if (this.$refs['ruleForm']) {
this.$refs['ruleForm'].resetFields() this.$refs['ruleForm'].resetFields()
} }
this.dialogTitle = '新增状态'
this.dialogVisible = true this.dialogVisible = true
}, },
async doDelete(id) { async doDelete(id) {
@@ -117,7 +140,7 @@ layout("/layouts/platform.html"){
if (confirm === 'confirm') { if (confirm === 'confirm') {
const resp = await $.post(loc() + '/doDelete', {id}) const resp = await $.post(loc() + '/doDelete', {id})
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success(resp.msg) this.$notify.success(resp.msg)
this.doSearch() this.doSearch()
} }
} }
@@ -125,14 +148,27 @@ layout("/layouts/platform.html"){
async doEdit() { async doEdit() {
const valid = await this.$refs['ruleForm'].validate() const valid = await this.$refs['ruleForm'].validate()
if (valid) { if (valid) {
const resp = await $.post(loc() + "/doEdit", this.formData) let resp = {}
if (this.formData.oldDepreciationYear !== this.formData.depreciationYear) {
const confirm = await this.$confirm('修改了折旧年限将会同步修改资产的折旧到期时间!是否修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === 'confirm') {
resp = await $.post(loc() + "/doEdit", this.formData)
}
}
resp = await $.post(loc() + "/doEdit", this.formData)
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success(resp.msg) this.notifySuccess(resp.msg)
this.doSearch() this.doSearch()
this.dialogVisible = false this.dialogVisible = false
} else { } else {
this.$message.warning(resp.msg) this.notifyError(resp.msg)
} }
} }
}, },
async doAdd() { async doAdd() {
@@ -140,12 +176,13 @@ layout("/layouts/platform.html"){
if (valid) { if (valid) {
const resp = await $.post(loc() + "/doAdd", this.formData) const resp = await $.post(loc() + "/doAdd", this.formData)
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success(resp.msg) this.notifySuccess(resp.msg)
this.doSearch() this.doSearch()
this.dialogVisible = false this.dialogVisible = false
} else { } else {
this.$message.warning(resp.msg) this.notifyError(resp.msg)
} }
} }
} }
}, },
@@ -160,4 +197,4 @@ layout("/layouts/platform.html"){
<!--# <!--#
} }
#--> #-->
+287 -209
View File
@@ -2,245 +2,323 @@
layout("/layouts/platform.html"){ layout("/layouts/platform.html"){
#--> #-->
<style> <style>
* {
margin: 0;
padding: 0;
}
.el-card { .el-card {
margin-bottom: 30px; margin-bottom: 30px;
} }
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
<div class="p10"> <guava ref="guava">
<el-card shadow="never"> <el-card shadow="never">
<div id="zttj" style="width: 47%;height: 450px;display: inline-block;"></div> <dict-select @change="data" code="zczt" placeholder="请选择资产状态" style="width: 20%"
<div style="height: 400px;width: 1px;background-color: gainsboro;display: inline-block;"></div> v-model="pageForm.zczt"></dict-select>
<div id="jgtj" style="width: 47%;height: 450px;display: inline-block;"></div>
</el-card> </el-card>
<!-- <el-card>
<div id="fghtj" style="width: 100%;height: 450px;display: inline-block;"></div> <el-card class="mt20" shadow="never">
</el-card>--> <el-table
<el-card shadow="never"> :data="tableData"
<div id="nftj" style="width: 100%;height: 450px;display: inline-block;"></div> :summary-method="getSummaries"
header-align="center"
ref="table"
row-key="typeCode"
show-summary
style="width: 100%">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="分类" prop="type"></el-table-column>
<el-table-column label="数量(台件)" prop="sl"></el-table-column>
<el-table-column label="金额(元)" prop="je"></el-table-column>
</el-table>
</el-card> </el-card>
</div> </guava>
<!-- <el-card>
<div id="zttj" style="width: 47%;height: 450px;display: inline-block;"></div>
<div style="height: 400px;width: 1px;background-color: gainsboro;display: inline-block;"></div>
<div id="jgtj" style="width: 47%;height: 450px;display: inline-block;"></div>
</el-card>
&lt;!&ndash; <el-card>
<div id="fghtj" style="width: 100%;height: 450px;display: inline-block;"></div>
</el-card>&ndash;&gt;
<el-card>
<div id="nftj" style="width: 100%;height: 450px;display: inline-block;"></div>
</el-card>-->
</div> </div>
<script> <script>
const vue = new Vue({ const vue = new Vue({
el: "#app", el: "#app",
data: function () { data() {
return { return {
pageForm: {
zczt: "正常"
},
ghlist: [], ghlist: [],
nflist: [] nflist: [],
tableData: []
} }
}, },
components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
},
methods: { methods: {
data: function () { /* data: function () {
var self = this; var self = this;
$.post(base + "/platform/zcgl/sjkb/data", function (data) { $.post(base + "/platform/zcgl/sjkb/data", function (data) {
self.initZttj(data.data.zttj); self.initZttj(data.data.zttj);
var union = data.data.fghtj; var union = data.data.fghtj;
var sl = [] var sl = []
union.forEach(function (val) { union.forEach(function (val) {
self.ghlist.push(val.unionname); self.ghlist.push(val.unionname);
sl.push(val.sl) sl.push(val.sl)
}) })
var jg = data.data.jgtj[0]; var jg = data.data.jgtj[0];
var jgsl = []; var jgsl = [];
jgsl.push(jg.a); jgsl.push(jg.a);
jgsl.push(jg.b); jgsl.push(jg.b);
jgsl.push(jg.c); jgsl.push(jg.c);
jgsl.push(jg.d); jgsl.push(jg.d);
jgsl.push(jg.e); jgsl.push(jg.e);
jgsl.push(jg.f); jgsl.push(jg.f);
var nf = data.data.nftj; var nf = data.data.nftj;
var nfsl = [] var nfsl = []
nf.forEach(function (val) { nf.forEach(function (val) {
self.nflist.push(val.year); self.nflist.push(val.year);
nfsl.push(val.sl); nfsl.push(val.sl);
}) })
//self.initFghtj(sl) //self.initFghtj(sl)
self.initjgtj(jgsl); self.initjgtj(jgsl);
self.initNftj(nfsl); self.initNftj(nfsl);
}) })
}, },
initZttj: function (data) { initZttj: function (data) {
var self = this; var self = this;
var lmxjHj = echarts.init(document.getElementById("zttj")); var lmxjHj = echarts.init(document.getElementById("zttj"));
var option = { var option = {
title: { title: {
text: '固定资产状态统计', text: '固定资产状态统计',
subtext: '', subtext: '',
left: 'center' left: 'center'
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)' formatter: '{a} <br/>{b} : {c} ({d}%)'
}, },
legend: { legend: {
orient: 'vertical', orient: 'vertical',
left: 'left', left: 'left',
data: ['在用', '异地存放', '待报废', '已报废'] data: ['在用', '闲置', '未使用', '待报废', '校外转入', '校内转入', '其它']
}, },
series: [ series: [
{ {
name: '资产状态', name: '资产状态',
type: 'pie', type: 'pie',
radius: '55%', radius: '55%',
center: ['50%', '60%'], center: ['50%', '60%'],
data: [ data: [
{value: data[0].zy, name: '在用'}, {value: data[0].zy, name: '在用'},
{value: data[0].ydcf, name: '异地存放'}, {value: data[0].xz, name: '闲置'},
{value: data[0].dbf, name: '待报废'}, {value: data[0].wsy, name: '未使用'},
{value: data[0].ybf, name: '已报废'} {value: data[0].dbf, name: '待报废'},
], {value: data[0].xwzr, name: '校外转入'},
emphasis: { {value: data[0].xnzr, name: '校内转入'},
itemStyle: { {value: data[0].qt, name: '其它'}
shadowBlur: 10, ],
shadowOffsetX: 0, emphasis: {
shadowColor: 'rgba(0, 0, 0, 0.5)' itemStyle: {
} shadowBlur: 10,
} shadowOffsetX: 0,
} shadowColor: 'rgba(0, 0, 0, 0.5)'
] }
}; }
lmxjHj.setOption(option); }
]
};
lmxjHj.setOption(option);
}, },
initFghtj: function (data) { initFghtj: function (data) {
var dom = document.getElementById("fghtj"); var dom = document.getElementById("fghtj");
var myChart = echarts.init(dom); var myChart = echarts.init(dom);
optionwwrstj = null; optionwwrstj = null;
//加载柱状图 //加载柱状图
optionwwrstj = { optionwwrstj = {
color: ['#3398DB'], color: ['#3398DB'],
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效 axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
} }
}, },
title: { title: {
text: '固定资产所属分工会统计', text: '固定资产所属分工会统计',
}, },
grid: { // 控制图的大小,调整下面这些值就可以, grid: { // 控制图的大小,调整下面这些值就可以,
x: 40, x: 40,
x2: 100, x2: 100,
y2: 150,// y2可以控制 X轴跟Zoom控件之间的间隔,避免以为倾斜后造成 label重叠到zoom上 y2: 150,// y2可以控制 X轴跟Zoom控件之间的间隔,避免以为倾斜后造成 label重叠到zoom上
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: this.ghlist, data: this.ghlist,
axisLabel: { axisLabel: {
interval: 0, interval: 0,
formatter: function (value) { formatter: function (value) {
return value.split("").join("\n"); return value.split("").join("\n");
}, },
} }
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [{ series: [{
data: data, data: data,
label: { label: {
normal: { normal: {
show: true, show: true,
position: 'top' position: 'top'
} }
}, },
type: 'bar' type: 'bar'
}] }]
}; };
if (optionwwrstj && typeof optionwwrstj === "object") { if (optionwwrstj && typeof optionwwrstj === "object") {
myChart.setOption(optionwwrstj, true); myChart.setOption(optionwwrstj, true);
}
},
initjgtj: function (data) {
var dom = document.getElementById("jgtj");
var myChart = echarts.init(dom);
optionwwrstj = null;
//加载柱状图
optionwwrstj = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
title: {
text: '固定资产购置价格统计',
},
xAxis: {
type: 'category',
data: ["2000以下", "2000-4000", "4000-6000", "6000-8000", "8000-10000", "10000以上"],
axisLabel: {
interval: 0,
}
},
yAxis: {
type: 'value'
},
series: [{
data: data,
label: {
normal: {
show: true,
position: 'top'
}
},
type: 'bar'
}]
};
if (optionwwrstj && typeof optionwwrstj === "object") {
myChart.setOption(optionwwrstj, true);
}
},
initNftj: function (data) {
var dom = document.getElementById("nftj");
var myChart = echarts.init(dom);
optionwwrstj = null;
//加载柱状图
optionwwrstj = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
title: {
text: '固定资产年度数量统计',
},
xAxis: {
type: 'category',
data: this.nflist,
},
yAxis: {
type: 'value'
},
series: [{
data: data,
label: {
normal: {
show: true,
position: 'top'
}
},
type: 'line'
}]
};
if (optionwwrstj && typeof optionwwrstj === "object") {
myChart.setOption(optionwwrstj, true);
}
}*/
async data() {
const resp = await $.post(loc() + "/pageData", this.pageForm)
if (resp.code === 0) {
this.tableData = resp.data
} }
}, },
initjgtj: function (data) { getSummaries(param) {
var dom = document.getElementById("jgtj"); const {columns, data} = param;
var myChart = echarts.init(dom); const sums = [];
optionwwrstj = null; columns.forEach((column, index) => {
//加载柱状图 if (index === 0) {
optionwwrstj = { sums[index] = '合计';
color: ['#3398DB'], return;
tooltip: { }
trigger: 'axis', const values = data.map(item => Number(item[column.property]));
axisPointer: { // 坐标轴指示器,坐标轴触发有效 if (!values.every(value => isNaN(value))) {
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' sums[index] = values.reduce((prev, curr) => {
} const value = Number(curr);
}, if (!isNaN(value)) {
title: { return prev + curr;
text: '固定资产购置价格统计', } else {
}, return prev;
xAxis: {
type: 'category',
data: ["2000以下", "2000-4000", "4000-6000", "6000-8000", "8000-10000", "10000以上"],
axisLabel: {
interval: 0,
}
},
yAxis: {
type: 'value'
},
series: [{
data: data,
label: {
normal: {
show: true,
position: 'top'
} }
}, }, 0);
type: 'bar' if (index === 3) {
}] sums[index] = sums[index].toFixed(2)
}; sums[index] += ' 元';
if (optionwwrstj && typeof optionwwrstj === "object") {
myChart.setOption(optionwwrstj, true);
}
},
initNftj: function (data) {
var dom = document.getElementById("nftj");
var myChart = echarts.init(dom);
optionwwrstj = null;
//加载柱状图
optionwwrstj = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
} }
}, if (index === 2) {
title: { sums[index] += ' 台件';
text: '固定资产年度数量统计', }
},
xAxis: { } else {
type: 'category', sums[index] = '';
data: this.nflist, }
}, });
yAxis: { return sums;
type: 'value'
},
series: [{
data: data,
label: {
normal: {
show: true,
position: 'top'
}
},
type: 'line'
}]
};
if (optionwwrstj && typeof optionwwrstj === "object") {
myChart.setOption(optionwwrstj, true);
}
} }
}, },
created: function () { created() {
this.data(); this.data();
}, }
mounted: function () { ,
mounted() {
} }
}) })
</script> </script>
+157 -184
View File
@@ -16,122 +16,117 @@ layout("/layouts/platform.html"){
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
<guava ref="guava"> <guava ref="guava">
<template> <el-card shadow="never">
<el-card shadow="never"> <div class="btn-group tool-button mt5">
<div class="search"> <el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
<div class="search-item"> v-model="pageForm.searchKeyword">
<div class="search-item-label">条件查询</div> <el-select clearable placeholder="查询类型" slot="prepend"
<div class="search-item-option"> style="width: 120px;"
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword" v-model="pageForm.searchName">
@keyup.enter.native="doSearch"> <el-option label="编号" value="zcbh"></el-option>
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" <el-option label="名称" value="zcmc"></el-option>
style="width: 120px;"> <el-option label="存放地" value="zccfdmc"></el-option>
<el-option label="资产编号" value="xx.assetNumber"></el-option> </el-select>
<el-option label="资产名称" value="xx.assetName"></el-option> </el-input>
<el-option label="存放地" value="xx.storageLocation"></el-option> </div>
</el-select> <div class="btn-group tool-button mt5">
</el-input> <dict-select v-model="pageForm.zczt" style="width: 100%" placeholder="请选择资产状态"
</div> code="zczt"></dict-select>
</div> </div>
<div class="btn-group tool-button mt5">
<el-date-picker
end-placeholder="购置日期"
format="yyyy 年 MM 月 dd 日"
range-separator="-"
start-placeholder="购置日期"
type="daterange"
v-model="time"
value-format="yyyy-MM-dd">
</el-date-picker>
</div>
<div class="btn-group tool-button mt5">
<el-select clearable placeholder="请选择资产类型" v-model="pageForm.zcghlx">
<el-option label="工会固定资产" value="2"></el-option>
<el-option label="分工会固定资产" value="1"></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5" v-if="pageForm.zcghlx==='1'">
<el-select clearable placeholder="领用工会" style="width: 180px;"
v-model="pageForm.ghid">
<el-option :label="item.unionname" :value="item.id"
v-for="item in ghlist"></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
<div class="search-item"> <div class="pull-right offscreen-right mt5">
<div class="search-item-label">资产状态</div> <el-button @click="doAllExport" icon="el-icon-download" type="primary">总账导出
<div class="search-item-option"> </el-button>
<el-select v-model="pageForm.assetStatus" slot="prepend" </div>
clearable
@change="doSearch"
placeholder="查询类型"
style="width: 100%">
<el-option v-for="item in lbList" :label="item.categoryName"
:key="item.contentCode" :value="item.contentCode"></el-option>
</el-select>
</div>
</div>
<div class="search-item"> </el-card>
<div class="search-item-label">购置日期</div>
<div class="search-item-option">
<el-date-picker
v-model="purchaseTime"
type="daterange"
range-separator="-"
style="width: 100%;"
start-placeholder="购置日期"
end-placeholder="购置日期"
format="yyyy年MM月dd日"
value-format="yyyy-MM-dd">
</el-date-picker>
</div>
</div>
<div class="search-item"> <el-card class="mt20" shadow="never">
<div class="search-item-label">入库日期</div> <!--个人-->
<div class="search-item-option"> <el-table
<el-date-picker :data="tableData"
v-model="storageTime" header-align="center"
type="daterange" style="width: 100%">
range-separator="-" <el-table-column :index="indexMethod" align="center" header-align="center"
style="width: 100%;" label="序号"
start-placeholder="购置日期" type="index"
end-placeholder="购置日期" width="80px"></el-table-column>
format="yyyy年MM月dd日"
value-format="yyyy-MM-dd">
</el-date-picker>
</div>
</div>
<div class="search-query"> <el-table-column
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button> :label="column.label"
</div> :prop="column.prop"
:sortable="column.sortable"
</div> align="center"
</el-card> header-align="center"
show-overflow-tooltip
<el-card class="mt10" shadow="never"> v-for="column in tableColumns"
<table-tool label="资产列表" :app="this"> >
<template #func> <template scope="{row}" v-if="column.prop=='zcghlx'">
<el-button type="primary" size="small" @click="doAllExport" icon="el-icon-download">总账导出 {{row.zcghlx==='1'?'院级工会':'校工会'}}
</el-button>
</template> </template>
</table-tool> </el-table-column>
<el-table :data="tableData" header-align="center" style="width: 100%">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号" <el-table-column
width="80px"></el-table-column> align="center"
<el-table-column header-align="center"
align="center" label="操作"
header-align="center" width="200">
v-for="column in tableColumns" <template slot-scope="scope">
show-overflow-tooltip <el-button @click="viewInfo(scope)" size="mini" type="primary">查看
:label="column.label" </el-button><!--
:prop="column.prop" <el-button @click="doExport(scope.row.zcid)" size="mini" type="primary">导出
:sortable="column.sortable" </el-button>-->
> </template>
<template scope="{row}" v-if="column.prop=='assetStatusName'"> </el-table-column>
<span style="color: #0e78c5;cursor: pointer"> </template>
{{getAssetTypes(row.assetStatus)}} </el-table>
</span> <el-row class="el-pagination-container">
</template> <el-pagination
</el-table-column> :current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageNumberChange"
@size-change="pageSizeChange"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-row>
</el-card>
<el-table-column
width="200"
label="操作"
header-align="center"
align="center">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="viewInfo(scope)">查看</el-button>
<!--<el-button size="mini" type="primary" @click="doExport(scope.row.id)">导出</el-button>-->
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view> <template #view>
<asset-management ref="asset"></asset-management> <zc-info ref="zcInfo"></zc-info>
</template> </template>
</guava> </guava>
</div> </div>
<script> <script>
@@ -141,112 +136,90 @@ layout("/layouts/platform.html"){
data() { data() {
return { return {
pageForm: { pageForm: {
searchName: "xx.assetName", searchName: "zcmc",
searchKeyword: "", zczt: "",
assetStatus:'', startTime: "",
purchaseDate : '', endTime: "",
storageDate:'', zcghlx: "",
ghid: ''
}, },
viewData: {}, viewData: {},
zcid: "",
ghlist: [],
time: [],
tableColumns: [ tableColumns: [
{prop: 'assetNumber', label: '编号', sortable: true}, {prop: 'zcbh', label: '资产编号'},
{prop: 'assetName', label: '名称', sortable: true}, {prop: 'zcmc', label: '资产名称'},
{prop: 'financeSixName', label: '财政六大类名称', sortable: true,checked: 0}, {prop: 'zcxh', label: '资产规格型号'},
{prop: 'assetModel', label: '型号', sortable: true}, {prop: 'content', label: '资产所属类别'},
{prop: 'originalValue', label: '原值', sortable: true}, {prop: 'zcgzrq', label: '购置日期'},
// {prop: 'purchaseDate', label: '购置日期', sortable: true}, {prop: 'zclyrname', label: '领用人'},
{prop: 'storageDate', label: '入库日期', sortable: true}, {prop: 'zclydwh', label: '领用单位'},
{prop: 'minimumUsageYear', label: '最低使用年限', sortable: true}, {prop: 'fundingSubject', label: '经费科目'},
{prop: 'yearsAndMonths', label: '已使用年限', sortable: true}, {prop: 'zczt', label: '资产状态'},
{prop: 'assetStatusName', label: '当前状态', sortable: true}, {prop: 'zcghlx', label: '资产类型'},
{prop: 'recipientUsername', label: '领用人', sortable: true},
{prop: 'remark', label: '备注', sortable: true},
], ],
purchaseTime: [],
storageTime: [],
lbList: [],
} }
}, },
components: { components: {
'asset-management': httpVueLoader('/components/zgfw/zcgl/AssetManagement.vue?v=1.0.2'), 'zc-info': httpVueLoader('/components/zcgl/zcInfo.vue?v=' + new Date().getTime()),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
}, },
methods: { methods: {
getAssetTypes(assetTypes) {
if (assetTypes) {
const c = JSON.parse(assetTypes)
return this.lbList.filter(item =>
c.includes(item.contentCode))
.map(item => item.categoryName).join(',')
}
return null
},
doAllExport() { doAllExport() {
const {searchKeyword, searchName , assetStatus } = this.pageForm const {searchKeyword, searchName, zczt, zcghlx, ghid} = this.pageForm
//购置时间 let startTime = ''
let purchaseStartTime = '' let endTime = ''
let purchaseEndTime = '' if (this.time && this.time.length > 0) {
if (this.purchaseTime && this.purchaseTime.length > 0) { startTime = this.time[0];
purchaseStartTime = this.purchaseTime[0]; endTime = this.time[1];
purchaseEndTime = this.purchaseTime[1];
} }
//入库时间 window.location.href = '/platform/zcgl/zhcx/doExport?searchKeyword=' + searchKeyword +
let storageStartTime = '' '&searchName=' + searchName +
let storageEndTime = '' '&zczt=' + zczt +
if (this.storageTime && this.storageTime.length > 0) { '&zcghlx=' + zcghlx +
storageStartTime = this.storageTime[0]; "&ghid=" + ghid +
storageEndTime = this.storageTime[1]; '&startTime=' + startTime +
} '&endTime=' + endTime
window.open('/platform/zcgl/zhcx/doExport?searchName=' + searchName + '&searchKeyword=' + searchKeyword +
'&assetStatus=' + assetStatus + '&purchaseStartTime=' + purchaseStartTime + '&purchaseEndTime=' + purchaseEndTime +
'&storageStartTime=' + storageStartTime + '&storageEndTime=' + storageEndTime)
// window.location.href = '/platform/zcgl/zhcx/doExport?searchKeyword=' + searchKeyword +
// '&searchName=' + searchName +
// '&zczt=' + zczt +
// '&zcghlx=' + zcghlx +
// "&ghid=" + ghid +
// '&startTime=' + startTime +
// '&endTime=' + endTime
}, },
doExport(id) { doExport(id) {
window.location.href = '/platform/zcgl/tzgl/downloadrzd?id=' + id window.location.href = '/platform/zcgl/tzgl/downloadrzd?id=' + id
}, },
doSearch() { doSearch() {
if (this.purchaseTime && this.purchaseTime.length > 0) { if (!this.time) {
this.pageForm.purchaseStartTime = this.purchaseTime[0]; this.pageForm.startTime = this.time[0];
this.pageForm.purchaseEndTime = this.purchaseTime[1]; this.pageForm.endTime = this.time[1];
} else { } else {
this.pageForm.purchaseStartTime = null; this.pageForm.startTime = null;
this.pageForm.purchaseEndTime = null; this.pageForm.endTime = null;
} }
if (this.storageTime && this.storageTime.length > 0) {
this.pageForm.storageStartTime = this.storageTime[0];
this.pageForm.storageEndTime = this.storageTime[1];
} else {
this.pageForm.storageStartTime = null;
this.pageForm.storageEndTime = null;
}
this.pageForm.pageNumber = 1; this.pageForm.pageNumber = 1;
this.pageData(); this.pageData();
}, },
async getAllAsseStatus() { pageData() {
const resp = await $.post("/platform/zcgl/zclb/queryLb") sublime.showLoadingbar();
if (resp.code === 0) { this.tableLoading = true
this.lbList = resp.data $.post("/platform/zcgl/zhcx/data", this.pageForm, (data) => {
} sublime.closeLoadingbar();
this.tableLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
}, },
viewInfo(scope) {
this.$refs.asset.getInfo(scope.row.id) async viewInfo(scope) {
this.$refs.guava.view() this.$refs.guava.view()
await this.$refs.zcInfo.findOne(scope.row.zcid)
}, },
}, },
async created() { async created() {
this.pageData(); this.pageData();
await this.getAllAsseStatus(); this.ghlist = await getUnions(null)
} }
}) })
</script> </script>
@@ -9,51 +9,64 @@ layout("/layouts/platform.html"){
<el-card shadow="never"> <el-card shadow="never">
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-date-picker <el-date-picker
placeholder="年度"
value-format="yyyy"
format="yyyy年" format="yyyy年"
placeholder="年度"
type="year"
v-model="pageForm.year" v-model="pageForm.year"
type="year"> value-format="yyyy">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable @keyup.enter.native="doSearch"> <el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 120px;"> v-model="pageForm.searchKeyword">
<el-select placeholder="查询类型" slot="prepend" style="width: 120px;"
v-model="pageForm.searchName">
<el-option label="内容" value="zcmc"></el-option> <el-option label="内容" value="zcmc"></el-option>
<el-option label="编号" value="zcbh"></el-option> <el-option label="编号" value="zcbh"></el-option>
</el-select> </el-select>
</el-input> </el-input>
</div> </div>
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-select v-model="pageForm.contentCode" clearable placeholder="所属类别"> <el-select clearable placeholder="所属类别" v-model="pageForm.contentCode">
<el-option v-for="item in lbList" :label="item.content+'('+item.contentCode+')'" <el-option :label="item.content+'('+item.contentCode+')'"
:value="item.contentCode"></el-option> :value="item.contentCode"
v-for="item in lbList"></el-option>
</el-select> </el-select>
</div> </div>
<div class="btn-group tool-button mt5"> <div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button> <el-button @click="doSearch();getZcMoney()" icon="el-icon-search" type="primary">
搜索
</el-button>
</div> </div>
</el-card> </el-card>
<el-card shadow="never" class="mt10"> <el-card class="mt10" shadow="never">
<table-tool label="资产折旧信息" :app="this"></table-tool> <table-tool :app="this" label="资产折旧信息">
<template #func>
<span style="color: #1867B0;font-weight: bold">
现固定资产原值为{{zcMoney.allMoney}}元,累计折旧{{zcMoney.depreciationMoney}}元,固定资产净值{{zcMoney.surplusMoney}}元。
</span>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" style="width: 100%"> <el-table :data="tableData" :size="tableSize" style="width: 100%">
<el-table-column type="index" label="序号" width="80px"></el-table-column> <el-table-column label="序号" type="index" width="80px"></el-table-column>
<el-table-column <el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:sortable="column.sortable" :sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
> >
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="操作" width="150"> <el-table-column align="center" header-align="center" label="操作" width="150">
<template scope="{row}"> <template scope="{row}">
<el-button size="mini" type="danger" @click="doDelete(row.id)">删除</el-button> <el-button @click="doDelete(row.zjjlId)" size="mini" type="danger">删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -71,6 +84,7 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins], mixins: [initTableMixins],
data() { data() {
return { return {
zcMoney: {},
pageForm: { pageForm: {
searchName: 'zcmc' searchName: 'zcmc'
}, },
@@ -78,17 +92,25 @@ layout("/layouts/platform.html"){
tableColumns: [ tableColumns: [
{prop: 'zcbh', label: '编号'}, {prop: 'zcbh', label: '编号'},
{prop: 'zcmc', label: '名称'}, {prop: 'zcmc', label: '名称'},
{prop: 'zcxh', label: '型号规格'}, {prop: 'zcxh', label: '资产规格型号'},
{prop: 'content', label: '资产所属类别'}, {prop: 'content', label: '资产所属类别'},
{prop: 'zcgzrq', label: '购置日期'}, {prop: 'zcgzrq', label: '购置日期'},
{prop: 'zcrksj', label: '入库日期'},
{prop: 'zdrDepreciationDate', label: '折旧到期时间'}, {prop: 'zdrDepreciationDate', label: '折旧到期时间'},
{prop: 'surplus', label: '折旧到期时间(月)'}, {prop: 'surplus', label: '折旧到期时间(月)'},
{prop: 'zdrSurplusMoney', label: '剩余价值(元)'},
{prop: 'operationTime', label: '折旧时间'}, {prop: 'operationTime', label: '折旧时间'},
], ],
} }
}, },
methods: { methods: {
async getZcMoney() {
const resp = await $.get("/platform/zcgl/zjlb/getZcMoney", {
contentCode: this.pageForm.contentCode
})
if (resp.code === 0) {
this.zcMoney = resp.data
}
},
async doDelete(id) { async doDelete(id) {
const confirm = await this.$confirm('确定要删除当前折旧信息吗?', '提示', { const confirm = await this.$confirm('确定要删除当前折旧信息吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -96,7 +118,7 @@ layout("/layouts/platform.html"){
type: 'warning' type: 'warning'
}) })
if (confirm === "confirm") { if (confirm === "confirm") {
const data = await $.post(loc()+"/doDelete", {id:id}) const data = await $.post(loc() + "/doDelete", {id: id})
if (data.code == 0) { if (data.code == 0) {
this.$message({ this.$message({
message: data.msg, message: data.msg,
@@ -116,6 +138,7 @@ layout("/layouts/platform.html"){
const data = await $.post("/platform/zcgl/zclb/queryLb") const data = await $.post("/platform/zcgl/zclb/queryLb")
this.lbList = data.data this.lbList = data.data
this.pageData() this.pageData()
await this.getZcMoney()
} }
}) })
</script> </script>
@@ -123,4 +146,4 @@ layout("/layouts/platform.html"){
<!--# <!--#
} }
#--> #-->