commit
This commit is contained in:
@@ -7,6 +7,7 @@ import io.v.nutz.annontation.ViReturn;
|
|||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.utils.FileService;
|
import io.v.nutz.base.utils.FileService;
|
||||||
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
||||||
|
import io.v.nutz.hd.models.Hd_wm_xx;
|
||||||
import io.v.nutz.hd.services.HdWmLbService;
|
import io.v.nutz.hd.services.HdWmLbService;
|
||||||
import io.v.nutz.hd.services.HdWmZplbService;
|
import io.v.nutz.hd.services.HdWmZplbService;
|
||||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||||
@@ -21,6 +22,7 @@ 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.Lang;
|
||||||
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
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;
|
||||||
@@ -69,17 +71,27 @@ public class HdJzgAddZpController {
|
|||||||
public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
public Object doSubmit(@Param("data") String data, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
||||||
try {
|
try {
|
||||||
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
||||||
|
Result checkResult = checkActivityTime(sbxx);
|
||||||
|
if (checkResult != null) {
|
||||||
|
return checkResult;
|
||||||
|
}
|
||||||
sbxx.setHdsbrid(ShiroUtil.getPrincipalProperty("id").toString());
|
sbxx.setHdsbrid(ShiroUtil.getPrincipalProperty("id").toString());
|
||||||
sbxx.setHdsbsj(DateUtil.getDateTime());
|
sbxx.setHdsbsj(DateUtil.getDateTime());
|
||||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
sbxx.setAuditState("4400");
|
||||||
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
||||||
|
|
||||||
for (TempFile file : files) {
|
if (files != null) {
|
||||||
fileService.upload(file, insert.getId(), "/hd/hdwm/");
|
for (TempFile file : files) {
|
||||||
|
if (file != null) {
|
||||||
|
fileService.upload(file, insert.getId(), "/hd/hdwm/");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Result.success().addMsg("上传成功!");
|
return Result.success().addMsg("上传成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Result.error().addMsg("上传失败!");
|
e.printStackTrace();
|
||||||
|
String message = Strings.isBlank(e.getMessage()) ? e.getClass().getSimpleName() : e.getMessage();
|
||||||
|
return Result.error("上传失败:" + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,22 +101,72 @@ public class HdJzgAddZpController {
|
|||||||
public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
public Object doEdit(@Param("data") String data, String readytodelfile, @Param(value = "file", required = false) TempFile[] files, boolean flag) {
|
||||||
try {
|
try {
|
||||||
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
Hd_wm_sbxx sbxx = Json.fromJson(Hd_wm_sbxx.class, data);
|
||||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
Result checkResult = checkActivityTime(sbxx);
|
||||||
|
if (checkResult != null) {
|
||||||
|
return checkResult;
|
||||||
|
}
|
||||||
|
sbxx.setAuditState("4400");
|
||||||
hdWmsbxxService.updateIgnoreNull(sbxx);
|
hdWmsbxxService.updateIgnoreNull(sbxx);
|
||||||
|
|
||||||
List<String> dellist = Json.fromJsonAsList(String.class, readytodelfile);
|
if (Strings.isNotBlank(readytodelfile)) {
|
||||||
for (String f : dellist) {
|
List<String> dellist = Json.fromJsonAsList(String.class, readytodelfile);
|
||||||
fileService.delete(f, f);
|
for (String f : dellist) {
|
||||||
|
fileService.delete(f, f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (TempFile file : files) {
|
if (files != null) {
|
||||||
fileService.upload(file, sbxx.getId(), "/hd/hdwm/");
|
for (TempFile file : files) {
|
||||||
|
if (file != null) {
|
||||||
|
fileService.upload(file, sbxx.getId(), "/hd/hdwm/");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Result.success().addMsg("修改成功!");
|
return Result.success().addMsg("修改成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Result.error().addMsg("上传失败!");
|
e.printStackTrace();
|
||||||
|
String message = Strings.isBlank(e.getMessage()) ? e.getClass().getSimpleName() : e.getMessage();
|
||||||
|
return Result.error("上传失败:" + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result checkActivityTime(Hd_wm_sbxx sbxx) throws Exception {
|
||||||
|
if (sbxx == null) {
|
||||||
|
return Result.error("操作失败:未接收到作品信息,请重新填写后提交!");
|
||||||
|
}
|
||||||
|
String hdid = sbxx.getHdid();
|
||||||
|
if (Strings.isBlank(hdid) && Strings.isNotBlank(sbxx.getId())) {
|
||||||
|
Hd_wm_sbxx old = hdWmsbxxService.fetch(sbxx.getId());
|
||||||
|
hdid = old == null ? null : old.getHdid();
|
||||||
|
}
|
||||||
|
if (Strings.isBlank(hdid)) {
|
||||||
|
return Result.error("操作失败:缺少活动信息,请重新进入活动页面提交!");
|
||||||
|
}
|
||||||
|
Hd_wm_xx hd = baseService.dao().fetch(Hd_wm_xx.class, hdid);
|
||||||
|
if (hd == null) {
|
||||||
|
return Result.error("操作失败:活动不存在,请刷新后重试!");
|
||||||
|
}
|
||||||
|
if (!Boolean.TRUE.equals(hd.getHdflag())) {
|
||||||
|
return Result.error("操作失败:当前活动未开启!");
|
||||||
|
}
|
||||||
|
Date startTime = parseActivityTime(hd.getHdkssj());
|
||||||
|
Date endTime = parseActivityTime(hd.getHdjssj());
|
||||||
|
Date now = new Date();
|
||||||
|
if (startTime == null || endTime == null || now.before(startTime) || now.after(endTime)) {
|
||||||
|
return Result.error("操作失败:不在活动时间范围内!");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date parseActivityTime(String time) throws Exception {
|
||||||
|
if (Strings.isBlank(time)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String pattern = time.trim().length() <= 10 ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss";
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||||
|
format.setLenient(false);
|
||||||
|
return format.parse(time.trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@@ -120,6 +182,7 @@ public class HdJzgAddZpController {
|
|||||||
sbr.username AS sbrname,
|
sbr.username AS sbrname,
|
||||||
sbr.loginname,
|
sbr.loginname,
|
||||||
hd.hdname,
|
hd.hdname,
|
||||||
|
hd.hdflag,
|
||||||
hd.hdkssj,
|
hd.hdkssj,
|
||||||
hd.hdjssj,
|
hd.hdjssj,
|
||||||
dw.name as dwname,
|
dw.name as dwname,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import io.v.nutz.base.utils.Office2Pdf;
|
|||||||
import io.v.nutz.base.utils.PageUtil;
|
import io.v.nutz.base.utils.PageUtil;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
||||||
|
import io.v.nutz.hd.models.Hd_wm_xx;
|
||||||
import io.v.nutz.hd.services.HdWmLbService;
|
import io.v.nutz.hd.services.HdWmLbService;
|
||||||
import io.v.nutz.hd.services.HdWmZplbService;
|
import io.v.nutz.hd.services.HdWmZplbService;
|
||||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||||
@@ -55,6 +56,7 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -350,7 +352,7 @@ public class HdWmInfoController {
|
|||||||
cnd.andEX("xx.hdzplx2", "=", zplb);
|
cnd.andEX("xx.hdzplx2", "=", zplb);
|
||||||
cnd.andEX("u.unionid", "=", union);
|
cnd.andEX("u.unionid", "=", union);
|
||||||
cnd.andEX("u.unitid", "=", unit);
|
cnd.andEX("u.unitid", "=", unit);
|
||||||
cnd.andEX("xx.auditState", "=", 4400);
|
cnd.andEX("xx.auditState", "=", stateId);
|
||||||
cnd.andEX("xx.isExcellent", "=", isExcellent);
|
cnd.andEX("xx.isExcellent", "=", isExcellent);
|
||||||
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
if (!ShiroUtil.hasRole("A06") && !ShiroUtil.hasRole("sysadmin")) {
|
||||||
if (ShiroUtil.hasRole("H04")) {
|
if (ShiroUtil.hasRole("H04")) {
|
||||||
@@ -690,12 +692,50 @@ public class HdWmInfoController {
|
|||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||||
public Object doDelete(String id) {
|
public Object doDelete(String id) throws Exception {
|
||||||
|
Result checkResult = checkActivityTimeByWorkId(id);
|
||||||
|
if (checkResult != null) {
|
||||||
|
return checkResult;
|
||||||
|
}
|
||||||
dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id));
|
dao.clear(Hd_wm_sbxx.class, Cnd.where("id", "=", id));
|
||||||
dao.clear(Sys_file.class, Cnd.where("reid", "=", id));
|
dao.clear(Sys_file.class, Cnd.where("reid", "=", id));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result checkActivityTimeByWorkId(String id) throws Exception {
|
||||||
|
if (Strings.isBlank(id)) {
|
||||||
|
return Result.error("删除失败:缺少作品信息!");
|
||||||
|
}
|
||||||
|
Hd_wm_sbxx sbxx = dao.fetch(Hd_wm_sbxx.class, id);
|
||||||
|
if (sbxx == null) {
|
||||||
|
return Result.error("删除失败:作品不存在或已删除!");
|
||||||
|
}
|
||||||
|
Hd_wm_xx hd = dao.fetch(Hd_wm_xx.class, sbxx.getHdid());
|
||||||
|
if (hd == null) {
|
||||||
|
return Result.error("删除失败:活动不存在,请刷新后重试!");
|
||||||
|
}
|
||||||
|
if (!Boolean.TRUE.equals(hd.getHdflag())) {
|
||||||
|
return Result.error("删除失败:当前活动未开启!");
|
||||||
|
}
|
||||||
|
Date startTime = parseActivityTime(hd.getHdkssj());
|
||||||
|
Date endTime = parseActivityTime(hd.getHdjssj());
|
||||||
|
Date now = new Date();
|
||||||
|
if (startTime == null || endTime == null || now.before(startTime) || now.after(endTime)) {
|
||||||
|
return Result.error("删除失败:不在活动时间范围内!");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date parseActivityTime(String time) throws Exception {
|
||||||
|
if (Strings.isBlank(time)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String pattern = time.trim().length() <= 10 ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss";
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||||
|
format.setLenient(false);
|
||||||
|
return format.parse(time.trim());
|
||||||
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("hd.wmhd.zpxx1")
|
@RequiresPermissions("hd.wmhd.zpxx1")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.v.nutz.hd.controller.wmhd.mobile;
|
|||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.utils.FileService;
|
import io.v.nutz.base.utils.FileService;
|
||||||
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
import io.v.nutz.hd.models.Hd_wm_sbxx;
|
||||||
|
import io.v.nutz.hd.models.Hd_wm_xx;
|
||||||
import io.v.nutz.hd.services.HdWmsbxxService;
|
import io.v.nutz.hd.services.HdWmsbxxService;
|
||||||
import io.v.nutz.hd.services.HdWmsbxxfjService;
|
import io.v.nutz.hd.services.HdWmsbxxfjService;
|
||||||
import io.v.nutz.sys.services.SysUserService;
|
import io.v.nutz.sys.services.SysUserService;
|
||||||
@@ -13,6 +14,7 @@ import org.nutz.dao.entity.Record;
|
|||||||
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.lang.Strings;
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
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;
|
||||||
@@ -21,7 +23,8 @@ import org.nutz.mvc.upload.TempFile;
|
|||||||
import org.nutz.mvc.upload.UploadAdaptor;
|
import org.nutz.mvc.upload.UploadAdaptor;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.File;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,21 +84,70 @@ public class StaffActivitiesCon {
|
|||||||
@RequiresAuthentication
|
@RequiresAuthentication
|
||||||
public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files, boolean flag) {
|
public Object doSubmit(@Param("..") Hd_wm_sbxx sbxx, @Param("files") TempFile[] files, boolean flag) {
|
||||||
try {
|
try {
|
||||||
String path = new File("").getCanonicalPath();
|
// 上传入口先校验核心参数,避免主表未落库时前端只能看到笼统失败提示。
|
||||||
sbxx.setAuditState(flag ? "4400" : "3999");
|
if (sbxx == null) {
|
||||||
|
return Result.error("上传失败:未接收到作品信息,请重新填写后提交!");
|
||||||
|
}
|
||||||
|
if (Strings.isBlank(sbxx.getHdid())) {
|
||||||
|
return Result.error("上传失败:缺少活动信息,请重新进入活动页面提交!");
|
||||||
|
}
|
||||||
|
if (Strings.isBlank(sbxx.getHdsbrid())) {
|
||||||
|
return Result.error("上传失败:缺少上传人信息,请重新登录后提交!");
|
||||||
|
}
|
||||||
|
Result checkResult = checkActivityTime(sbxx.getHdid());
|
||||||
|
if (checkResult != null) {
|
||||||
|
return checkResult;
|
||||||
|
}
|
||||||
|
sbxx.setAuditState("4400");
|
||||||
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
Hd_wm_sbxx insert = hdWmsbxxService.insert(sbxx);
|
||||||
|
if (insert == null || Strings.isBlank(insert.getId())) {
|
||||||
|
return Result.error("上传失败:作品信息保存失败,请重新提交!");
|
||||||
|
}
|
||||||
|
|
||||||
// 保存时可能没有上传附件,避免空文件数组导致提交接口异常。
|
// 保存时可能没有上传附件,避免空文件数组导致提交接口异常。
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (TempFile file : files) {
|
for (TempFile file : files) {
|
||||||
fileService.upload(file, insert.getId(), "/hd/hdwm/");
|
if (file != null) {
|
||||||
|
fileService.upload(file, insert.getId(), "/hd/hdwm/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.success().addMsg("上传成功!");
|
return Result.success().addMsg("上传成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return Result.error().addMsg("上传失败!");
|
String message = Strings.isBlank(e.getMessage()) ? e.getClass().getSimpleName() : e.getMessage();
|
||||||
|
return Result.error("上传失败:" + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result checkActivityTime(String hdid) throws Exception {
|
||||||
|
if (Strings.isBlank(hdid)) {
|
||||||
|
return Result.error("上传失败:缺少活动信息,请重新进入活动页面提交!");
|
||||||
|
}
|
||||||
|
Hd_wm_xx hd = hdWmsbxxService.dao().fetch(Hd_wm_xx.class, hdid);
|
||||||
|
if (hd == null) {
|
||||||
|
return Result.error("上传失败:活动不存在,请刷新后重试!");
|
||||||
|
}
|
||||||
|
if (!Boolean.TRUE.equals(hd.getHdflag())) {
|
||||||
|
return Result.error("上传失败:当前活动未开启!");
|
||||||
|
}
|
||||||
|
Date startTime = parseActivityTime(hd.getHdkssj());
|
||||||
|
Date endTime = parseActivityTime(hd.getHdjssj());
|
||||||
|
Date now = new Date();
|
||||||
|
if (startTime == null || endTime == null || now.before(startTime) || now.after(endTime)) {
|
||||||
|
return Result.error("上传失败:不在活动时间范围内!");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date parseActivityTime(String time) throws Exception {
|
||||||
|
if (Strings.isBlank(time)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String pattern = time.trim().length() <= 10 ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss";
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||||
|
format.setLenient(false);
|
||||||
|
return format.parse(time.trim());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ layout("/mobile/platform.html"){
|
|||||||
v-model="mLoading">
|
v-model="mLoading">
|
||||||
|
|
||||||
<div @click.stop="openView(o)" class="list-card" v-for="o in tableData">
|
<div @click.stop="openView(o)" class="list-card" v-for="o in tableData">
|
||||||
<van-swipe-cell :disabled="o.auditstate!=='3999'">
|
<van-swipe-cell :disabled="!isActivityTime(o)">
|
||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<image @click.stop="openEdit(o.id,o.hdid)" class="register-icon"
|
<image @click.stop="openEdit(o.id,o.hdid)" class="register-icon"
|
||||||
src="/assets/mobile/svg/wmhd/bianji.svg"
|
src="/assets/mobile/svg/wmhd/bianji.svg"
|
||||||
v-if="o.auditstate==='3999'||o.auditstate==='4100'||o.auditstate==='4250'"></image>
|
v-if="isActivityTime(o)"></image>
|
||||||
<van-cell :border="false" title="姓名">{{o.sbrname}}</van-cell>
|
<van-cell :border="false" title="姓名">{{o.sbrname}}</van-cell>
|
||||||
<van-cell :border="false" title="工号">{{o.loginname}}</van-cell>
|
<van-cell :border="false" title="工号">{{o.loginname}}</van-cell>
|
||||||
<van-cell :border="false" title="单位">{{o.dwname}}</van-cell>
|
<van-cell :border="false" title="单位">{{o.dwname}}</van-cell>
|
||||||
@@ -60,7 +60,7 @@ layout("/mobile/platform.html"){
|
|||||||
</van-cell>-->
|
</van-cell>-->
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<template #right>
|
<template #right>
|
||||||
<van-button @click="doDelete(o.id)" square style="height: 100%;" text="删除"
|
<van-button @click="doDelete(o)" square style="height: 100%;" text="删除"
|
||||||
type="danger"></van-button>
|
type="danger"></van-button>
|
||||||
</template>
|
</template>
|
||||||
</van-swipe-cell>
|
</van-swipe-cell>
|
||||||
@@ -116,19 +116,34 @@ layout("/mobile/platform.html"){
|
|||||||
'mobile-wmhd-info': httpVueLoader('/components/mobile/wmhd/info.vue?v=' + new Date().getTime()),
|
'mobile-wmhd-info': httpVueLoader('/components/mobile/wmhd/info.vue?v=' + new Date().getTime()),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isActivityTime(o) {
|
||||||
|
if (!o || !o.hdflag || !o.hdkssj || !o.hdjssj) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const startTime = new Date(o.hdkssj.replace(/-/g, '/')).getTime()
|
||||||
|
const endTime = new Date(o.hdjssj.replace(/-/g, '/')).getTime()
|
||||||
|
const nowTime = new Date().getTime()
|
||||||
|
return startTime <= nowTime && nowTime <= endTime
|
||||||
|
},
|
||||||
openEdit(id, hdid) {
|
openEdit(id, hdid) {
|
||||||
window.location.href = '/platform/staffActivities?client=mobile&id=' + hdid + '&zpid=' + id
|
window.location.href = '/platform/staffActivities?client=mobile&id=' + hdid + '&zpid=' + id
|
||||||
},
|
},
|
||||||
async doDelete(id) {
|
async doDelete(o) {
|
||||||
|
if (!this.isActivityTime(o)) {
|
||||||
|
vant.Toast('不在活动时间范围内,不能删除')
|
||||||
|
return
|
||||||
|
}
|
||||||
const confirm = await vant.Dialog.confirm({
|
const confirm = await vant.Dialog.confirm({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
message: '确定要删除此次作品吗?',
|
message: '确定要删除此次作品吗?',
|
||||||
})
|
})
|
||||||
if (confirm === 'confirm') {
|
if (confirm === 'confirm') {
|
||||||
const data = await $.post("/platform/hd/wmhd/dodelete", {id: id})
|
const data = await $.post("/platform/hd/wmhd/dodelete", {id: o.id})
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
await this.yearChange()
|
await this.yearChange()
|
||||||
vant.Toast.success('删除成功');
|
vant.Toast.success('删除成功');
|
||||||
|
} else {
|
||||||
|
vant.Toast(data.msg || '删除失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -481,28 +481,12 @@
|
|||||||
</van-tabs>
|
</van-tabs>
|
||||||
|
|
||||||
<div style="margin: 16px;">
|
<div style="margin: 16px;">
|
||||||
<van-row gutter="20">
|
<van-button :color="boxData.hdcolor" :disabled="subDis"
|
||||||
<van-col span="12">
|
@click="doSubmit(true)" block
|
||||||
<van-button :color="boxData.hdcolor" :disabled="subDis"
|
round
|
||||||
@click="doSubmit(false)" block
|
type="info">
|
||||||
plain
|
提交
|
||||||
round
|
</van-button>
|
||||||
type="info">
|
|
||||||
保存
|
|
||||||
</van-button>
|
|
||||||
</van-col>
|
|
||||||
<van-col span="12">
|
|
||||||
<van-button :color="boxData.hdcolor" :disabled="subDis"
|
|
||||||
@click="doSubmit(true)" block
|
|
||||||
round
|
|
||||||
type="info">
|
|
||||||
提交
|
|
||||||
</van-button>
|
|
||||||
</van-col>
|
|
||||||
|
|
||||||
</van-row>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</van-form>
|
</van-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -699,7 +683,7 @@
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
const msg = '您当前选择的是“' + this.boxData.lbs[i].lname + '”,是否确认上传?' + (flag ? '上传后您将不能对已上传的作品进行更改' : '保存后如需提交请到我的作品进行提交')
|
const msg = '您当前选择的是“' + this.boxData.lbs[i].lname + '”,是否确认提交?活动时间内可编辑或删除已提交作品'
|
||||||
const confirm = await this.$dialog.confirm({
|
const confirm = await this.$dialog.confirm({
|
||||||
title: '提醒',
|
title: '提醒',
|
||||||
message: msg
|
message: msg
|
||||||
@@ -709,6 +693,7 @@
|
|||||||
this.showMsg = true
|
this.showMsg = true
|
||||||
this.showPlan = true
|
this.showPlan = true
|
||||||
this.percent = 0
|
this.percent = 0
|
||||||
|
this.$set(this, 'flag', false)
|
||||||
this.msg = ''
|
this.msg = ''
|
||||||
|
|
||||||
let formData1 = {}
|
let formData1 = {}
|
||||||
@@ -792,22 +777,22 @@
|
|||||||
Cookies.remove('sa_formData');
|
Cookies.remove('sa_formData');
|
||||||
|
|
||||||
|
|
||||||
vue.msg = '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>')
|
||||||
this.flag = true
|
vue.$set(vue, 'flag', true)
|
||||||
|
location.href = '/mobile/wmhd/list'
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">' + (data.msg || '非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!') + '</p>')
|
||||||
this.flag = false
|
vue.$set(vue, 'flag', false)
|
||||||
}
|
}
|
||||||
vue.showPlan = false
|
vue.$set(vue, 'showPlan', false)
|
||||||
location.href = '/mobile/wmhd/list'
|
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>')
|
||||||
this.flag = false
|
vue.$set(vue, 'flag', false)
|
||||||
vue.showPlan = false
|
vue.$set(vue, 'showPlan', false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -842,20 +827,19 @@
|
|||||||
Cookies.remove('sa_formData');
|
Cookies.remove('sa_formData');
|
||||||
|
|
||||||
|
|
||||||
vue.msg = '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">我们已收到您的作品!<br/>非常感谢您的支持!</p>')
|
||||||
|
vue.$set(vue, 'flag', true)
|
||||||
this.flag = true
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">' + (data.msg || '非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!') + '</p>')
|
||||||
this.flag = false
|
vue.$set(vue, 'flag', false)
|
||||||
}
|
}
|
||||||
vue.showPlan = false
|
vue.$set(vue, 'showPlan', false)
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
vue.msg = '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>'
|
vue.$set(vue, 'msg', '<p class="weui-msg__desc">非常抱歉对您造成的不便!<br/>请联系系统管理员进行修复!</p>')
|
||||||
this.flag = false
|
vue.$set(vue, 'flag', false)
|
||||||
vue.showPlan = false
|
vue.$set(vue, 'showPlan', false)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,13 +282,13 @@ layout("/layouts/platform.html"){
|
|||||||
<el-button @click="viewInfo(scope)" size="mini" type="primary">查看
|
<el-button @click="viewInfo(scope)" size="mini" type="primary">查看
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- v-if="scope.row.auditstate==='3999'||scope.row.auditstate==='4100'||scope.row.auditstate==='4250'"-->
|
<!-- v-if="scope.row.auditstate==='3999'||scope.row.auditstate==='4100'||scope.row.auditstate==='4250'"-->
|
||||||
<el-button :disabled="scope.row.auditstate!=='3999'"
|
<el-button :disabled="!isActivityTime(scope.row)"
|
||||||
@click="openEdit(scope)" size="mini"
|
@click="openEdit(scope)" size="mini"
|
||||||
type="primary">
|
type="primary">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :disabled="scope.row.auditstate!=='3999'"
|
<el-button :disabled="!isActivityTime(scope.row)"
|
||||||
@click="dodelete(scope.row.id)"
|
@click="dodelete(scope.row)"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="danger">删除
|
type="danger">删除
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -413,8 +413,7 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="float: right;margin: 20px 0">
|
<div style="float: right;margin: 20px 0">
|
||||||
<el-button @click="doAdd(false)">保 存</el-button>
|
<el-button @click="doAdd" type="primary">提 交</el-button>
|
||||||
<el-button @click="doAdd(true)" type="primary">提 交</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -525,8 +524,7 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="float: right;margin: 20px 0">
|
<div style="float: right;margin: 20px 0">
|
||||||
<el-button @click="doEdit(false)">保 存</el-button>
|
<el-button @click="doEdit" type="primary">提 交</el-button>
|
||||||
<el-button @click="doEdit(true)" type="primary">提 交</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -616,6 +614,15 @@ layout("/layouts/platform.html"){
|
|||||||
changeHdzplx2(id) {
|
changeHdzplx2(id) {
|
||||||
this.zplb2Config = this.formhdzplblist.find(v => v.zid === id)
|
this.zplb2Config = this.formhdzplblist.find(v => v.zid === id)
|
||||||
},
|
},
|
||||||
|
isActivityTime(row) {
|
||||||
|
if (!row || !row.hdkssj || !row.hdjssj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const startTime = new Date(row.hdkssj.replace(/-/g, '/')).getTime();
|
||||||
|
const endTime = new Date(row.hdjssj.replace(/-/g, '/')).getTime();
|
||||||
|
const nowTime = new Date().getTime();
|
||||||
|
return startTime <= nowTime && nowTime <= endTime;
|
||||||
|
},
|
||||||
yearChange(val) {
|
yearChange(val) {
|
||||||
let activityList = []
|
let activityList = []
|
||||||
if (val === null) {
|
if (val === null) {
|
||||||
@@ -743,10 +750,10 @@ layout("/layouts/platform.html"){
|
|||||||
this.$refs['AddForm'].resetFields();
|
this.$refs['AddForm'].resetFields();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doAdd(flag) {
|
doAdd() {
|
||||||
this.$refs['AddForm'].validate((valid) => {
|
this.$refs['AddForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (flag && ((this.zplb2Config.isUploadPhoto && this.picturelist.length === 0) ||
|
if (((this.zplb2Config.isUploadPhoto && this.picturelist.length === 0) ||
|
||||||
(this.zplb2Config.isUploadOther && this.vadlist.length === 0) ||
|
(this.zplb2Config.isUploadOther && this.vadlist.length === 0) ||
|
||||||
(this.zplb2Config.isUploadZip && this.ziplist.length === 0))) {
|
(this.zplb2Config.isUploadZip && this.ziplist.length === 0))) {
|
||||||
this.$message.warning('请上传您的作品');
|
this.$message.warning('请上传您的作品');
|
||||||
@@ -759,7 +766,7 @@ layout("/layouts/platform.html"){
|
|||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("flag", flag);
|
formdata.append("flag", true);
|
||||||
formdata.append("data", JSON.stringify(this.AddFormData));
|
formdata.append("data", JSON.stringify(this.AddFormData));
|
||||||
if(this.picturelist && this.picturelist.length > 0) {
|
if(this.picturelist && this.picturelist.length > 0) {
|
||||||
this.picturelist.forEach(val => {
|
this.picturelist.forEach(val => {
|
||||||
@@ -789,7 +796,7 @@ layout("/layouts/platform.html"){
|
|||||||
this.$refs.guava.index()
|
this.$refs.guava.index()
|
||||||
this.$message.success('上传成功');
|
this.$message.success('上传成功');
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('上传失败');
|
this.$message.error(res.msg || '上传失败');
|
||||||
}
|
}
|
||||||
loading.close();
|
loading.close();
|
||||||
})
|
})
|
||||||
@@ -797,6 +804,10 @@ layout("/layouts/platform.html"){
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
openEdit(scope) {
|
openEdit(scope) {
|
||||||
|
if (!this.isActivityTime(scope.row)) {
|
||||||
|
this.$message.warning('不在活动时间范围内,不能编辑');
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.readytodelfile = [];
|
this.readytodelfile = [];
|
||||||
this.picturelist = [];
|
this.picturelist = [];
|
||||||
this.vadlist = [];
|
this.vadlist = [];
|
||||||
@@ -821,10 +832,10 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
doEdit(flag) {
|
doEdit() {
|
||||||
this.$refs['EditForm'].validate((valid) => {
|
this.$refs['EditForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (flag && ((this.zplb2Config.isUploadPhoto && this.picturelist.length === 0) ||
|
if (((this.zplb2Config.isUploadPhoto && this.picturelist.length === 0) ||
|
||||||
(this.zplb2Config.isUploadOther && this.vadlist.length === 0) ||
|
(this.zplb2Config.isUploadOther && this.vadlist.length === 0) ||
|
||||||
(this.zplb2Config.isUploadZip && this.ziplist.length === 0))) {
|
(this.zplb2Config.isUploadZip && this.ziplist.length === 0))) {
|
||||||
this.$message.warning('请上传您的作品');
|
this.$message.warning('请上传您的作品');
|
||||||
@@ -838,7 +849,7 @@ layout("/layouts/platform.html"){
|
|||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("flag", flag);
|
formdata.append("flag", true);
|
||||||
formdata.append("data", JSON.stringify(this.EditFormData));
|
formdata.append("data", JSON.stringify(this.EditFormData));
|
||||||
formdata.append("readytodelfile", JSON.stringify(this.readytodelfile));
|
formdata.append("readytodelfile", JSON.stringify(this.readytodelfile));
|
||||||
if(this.picturelist && this.picturelist.length > 0) {
|
if(this.picturelist && this.picturelist.length > 0) {
|
||||||
@@ -877,7 +888,7 @@ layout("/layouts/platform.html"){
|
|||||||
this.$refs.guava.index()
|
this.$refs.guava.index()
|
||||||
this.$message.success('上传成功');
|
this.$message.success('上传成功');
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('上传失败');
|
this.$message.error(res.msg || '上传失败');
|
||||||
}
|
}
|
||||||
loading.close();
|
loading.close();
|
||||||
|
|
||||||
@@ -971,16 +982,22 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
dodelete(id) {
|
dodelete(row) {
|
||||||
|
if (!this.isActivityTime(row)) {
|
||||||
|
this.$message.warning('不在活动时间范围内,不能删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$confirm('此操作将永久删除该记录, 确定吗?', '提示', {
|
this.$confirm('此操作将永久删除该记录, 确定吗?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
$.post('/platform/hd/wmhd/doDelete', {id: id}).then(data => {
|
$.post('/platform/hd/wmhd/doDelete', {id: row.id}).then(data => {
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
this.doSearch();
|
this.doSearch();
|
||||||
this.$message.success(data.msg);
|
this.$message.success(data.msg);
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg || '删除失败');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user