Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2025-02-19 18:24:32 +08:00
commit b33826faac
21 changed files with 607 additions and 306 deletions

View File

@ -15,5 +15,6 @@ public class GsSubEvaluateApplication {
public static void main(String[] args) {
SpringApplication.run(GsSubEvaluateApplication.class, args);
System.err.println("甘肃考试分包商评价系统启动成功");
}
}

View File

@ -32,6 +32,7 @@ public class EvaluateDataBean {
private String subName;
private String isApprove;
private String isTwoApprove;
private String isThreeApprove;
private String name;
private String evaluateType;
private String leaderName;

View File

@ -39,6 +39,8 @@ public class OrganizationalBean {
private String keyWorld;
private String parentUserName;
private List<OrganizationalBean> children;
/**
* 是否是新增

View File

@ -92,6 +92,25 @@ public class EvalSummaryController extends BaseController<EvaluateBean> {
}
return ar;
}
/**
* 专员汇总列表
* @param bean 查询条件
* @return AjaxRes
*/
@RequestMapping(path = "dedicatedEvalSummaryList", method = RequestMethod.GET)
@ResponseBody
public AjaxRes dedicatedEvalSummaryList(EvalSummaryBean bean) {
AjaxRes ar = getAjaxRes();
try {
List<OutSourceBean> list = service.dedicatedEvalSummaryList(bean);
ar.setListSucceed(list);
} catch (Exception e) {
logger.error(e.toString(), e);
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
/**
* 线下评价汇总列表
* @param bean 查询条件

View File

@ -331,6 +331,12 @@ public class OutsourcerEvaluateController extends BaseController<EvaluateSubBean
}
return ar;
}
/**
* 查看第一级是否审核
* @param o
* @return
*/
@RequestMapping("isCheckOneIsAudit")
@ResponseBody
public AjaxRes isCheckOneIsAudit(EvaluateDataBean o) {
@ -343,6 +349,136 @@ public class OutsourcerEvaluateController extends BaseController<EvaluateSubBean
return ar;
}
/**
* 查看第二级是否审核
* @param o
* @return
*/
@RequestMapping("isCheckTwoIsAudit")
@ResponseBody
public AjaxRes isCheckTwoIsAudit(EvaluateDataBean o) {
AjaxRes ar = new AjaxRes();
try {
ar = outsourcerEvaluateService.isCheckTwoIsAudit(o);
} catch (Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
/**
* 专员审核
* @param o
* @return
*/
@RequestMapping("dedicatedAudit")
@ResponseBody
public synchronized AjaxRes dedicatedAudit(EvaluateDataBean o) {
AjaxRes ar = new AjaxRes();
List<String> stringList = outsourcerEvaluateDao.getExaminePersonByDeptAndRoleName("7","专责");
if(StringUtils.isBlank(o.getEvaluateId())){
ar.setFailMsg("评价ID不能为空");
return ar;
}
if(stringList==null || stringList.size() == 0){
ar.setFailMsg("请先配置专责审批人");
return ar;
}
try {
o.setUserId(String.valueOf(UserUtil.getLoginUser().getId()));
if (StringUtils.isBlank(o.getRejectReason())) {
o.setRejectReason("");
} else {
o.setIsApprove("2");
//修改pj_evaluate_details状态
outsourcerEvaluateDao.updatepjEvaluateDetailsStatus(o);
}
int code = outsourcerEvaluateDao.audit(o);
if (code > 0) {
ar.setSucceedMsg("审核成功");
} else {
ar.setFailMsg("审核失败");
}
//查询当前的审核状态
int count = outsourcerEvaluateDao.getCurrentIsApprove(o);
if (count == 0) {
//修改pj_evaluate状态
o.setIsApprove("1");
outsourcerEvaluateDao.updatepjEvaluateDetailsStatus(o);
}
} catch (Exception e) {
ar.setFailMsg("审核失败");
}
return ar;
}
@RequestMapping("dedicatedAllAudit")
@ResponseBody
public synchronized AjaxRes dedicatedAllAudit(EvaluateDataBean o) {
AjaxRes ar = new AjaxRes();
List<String> stringList = outsourcerEvaluateDao.getExaminePersonByDeptAndRoleName("7","专责");
if(StringUtils.isBlank(o.getEvaluateId())){
ar.setFailMsg("评价ID不能为空");
return ar;
}
if(stringList==null || stringList.size() == 0){
ar.setFailMsg("请先配置专责审批人");
return ar;
}
o.setUserId(String.valueOf(UserUtil.getLoginUser().getId()));
if (StringUtils.isBlank(o.getRejectReason())) {
o.setRejectReason("");
} else {
o.setIsApprove("2");
}
//修改pj_evaluate_details状态
outsourcerEvaluateDao.updatePjEvaluateDetailsStatusByThreeParams(o);
int code = outsourcerEvaluateDao.auditByThreeParams(o);
if (code > 0) {
ar.setSucceedMsg("审核成功");
} else {
ar.setFailMsg("审核失败");
}
//修改pj_evaluate状态
outsourcerEvaluateDao.updatePjEvaluateDetailsStatusByThreeParams(o);
int startId = outsourcerEvaluateService.startCollectExamineByEvaluateId(o);
String evaluateType = o.getEvaluateType();
System.err.println("startId:"+startId+" ,evaluateType="+evaluateType);
if(startId == 0 && ("1".equals(evaluateType) || "2".equals(evaluateType))){
int examineNum = outsourcerEvaluateDao.getExamineNumByEvaluateId(o.getEvaluateId(),"1");
if(examineNum == 0){
//新增二级审核
ExamineBean childBean = new ExamineBean();
childBean.setEvaluateId(o.getEvaluateId());
//添加汇总审核人id
childBean.setUserList(String.valueOf(String.join(",",stringList)));
//添加汇总审核人姓名
childBean.setPostId("7");
childBean.setEvaluateType("0");
childBean.setEvaluateNode("1");
outsourcerEvaluateDao.addExaminePerson(childBean);
}
} else if (startId == 0 && "3".equals(evaluateType)) {
//汇总审核结束 更新状态
outsourcerEvaluateDao.updateEvaluateRecordByEvaluateId("2",o.getEvaluateId());
}else{
//过程中 暂不做处理
}
return ar;
}
@RequestMapping("updateJsonData")
@ResponseBody
public AjaxRes updateJsonData(EvaluateDataBean o) {

View File

@ -33,4 +33,6 @@ public interface EvalSummaryDao {
List<OutSourceBean> getOfflineSummaryList(EvalSummaryBean bean);
int deleteOffEvaluateById(String id);
List<OutSourceBean> dedicatedEvalSummaryList(EvalSummaryBean bean);
}

View File

@ -139,4 +139,6 @@ public interface OutsourcerEvaluateDao {
List<EvaluateDataBean> getEvaluateSubInfo(EvaluateDataBean o);
int addMonthRank(@Param("bean") EvaluateDataBean bean,@Param("list") List<EvaluateDataBean> list);
int isCheckTwoIsAudit(EvaluateDataBean o);
}

View File

@ -33,4 +33,6 @@ public interface EvalSummaryService {
List<OutSourceBean> getOfflineSummaryList(EvalSummaryBean bean);
int deleteOffEvaluateById(String id);
List<OutSourceBean> dedicatedEvalSummaryList(EvalSummaryBean bean);
}

View File

@ -60,4 +60,9 @@ public class EvalSummaryServiceImpl implements EvalSummaryService {
public int deleteOffEvaluateById(String id) {
return dao.deleteOffEvaluateById(id);
}
@Override
public List<OutSourceBean> dedicatedEvalSummaryList(EvalSummaryBean bean) {
return dao.dedicatedEvalSummaryList(bean);
}
}

View File

@ -330,6 +330,9 @@ public class OrganizationalServiceImpl implements OrganizationalService {
.collect(Collectors.toList());
if (!children.isEmpty()) {
for (OrganizationalBean vo:children){
vo.setParentUserName(parent.getUserName());
}
parent.setChildren(children);
for (OrganizationalBean child : children) {
buildChildren(child, nodes);

View File

@ -71,4 +71,6 @@ public interface OutsourcerEvaluateService {
AjaxRes getSummaryCompareList(EvaluateSubBean o);
AjaxRes isCheckOneIsAudit(EvaluateDataBean o);
AjaxRes isCheckTwoIsAudit(EvaluateDataBean o);
}

View File

@ -864,6 +864,7 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
map.put("id", bean.getId());
map.put("isApprove", bean.getIsApprove());
map.put("isTwoApprove", bean.getIsTwoApprove());
map.put("isThreeApprove", bean.getIsThreeApprove());
map.put("detailsId", bean.getParentId());
childList.add(map);
}
@ -1244,4 +1245,16 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
}
return ar;
}
@Override
public AjaxRes isCheckTwoIsAudit(EvaluateDataBean o) {
AjaxRes ar = new AjaxRes();
int count = outsourcerEvaluateDao.isCheckTwoIsAudit(o);
if (count > 0) {
ar.setSucceed("1");
} else {
ar.setFailMsg("0");
}
return ar;
}
}

View File

@ -39,7 +39,7 @@
left join pj_evaluate_details ped on ped.evaluate_id = per.evaluate_id
left join (
select
count(if(check_two > 0,1,null)) as num,
count(if(check_three > 0,1,null)) as num,
count(1) as total,
evaluate_id
from pj_evaluate_details
@ -47,9 +47,9 @@
) m on m.evaluate_id = per.evaluate_id
left join(
SELECT
count(IF(check_two is null or check_two = 0 or check_two = '',1,null)) as num,
GROUP_CONCAT(DISTINCT IF(reject_two is null or reject_two = '',null,reject_two)) as rejectReason,
count(if(check_two = 2,1,null)) as failNum,
count(IF(check_three is null or check_three = 0 or check_three = '',1,null)) as num,
GROUP_CONCAT(DISTINCT IF(reject_three is null or reject_three = '',null,reject_three)) as rejectReason,
count(if(check_three = 2,1,null)) as failNum,
evaluate_id
from pj_evaluate_result
GROUP BY evaluate_id
@ -94,4 +94,69 @@
</if>
</select>
<select id="dedicatedEvalSummaryList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OutSourceBean">
select
per.evaluate_id as id,
ped.details_id as detailsId,
per.template_id as templateId,
poi.name as evaluateDept,
per.evaluate_name as evaluateTitle,
per.year_and_month as evaluateMonth,
per.create_time as createTime,
r.proNum as projectNum,
r.subNum as outsourcerNum,
ifnull(GROUP_CONCAT(ped.post_id),'') as deptId,
check_one as isApprove,
IF(rr.num > 0,1,if(rr.num = 0 and rr.failNum = 0,0,2)) as isAudit,
if(m.num = m.total,1,if(m.num > 0,2,0)) as status,
rr.rejectReason as rejectReason
from pj_evaluate_record per
left join (
select
evaluate_id,
count(distinct sub_id) as subNum,
count(distinct pro_id) as proNum
from pj_evaluate_sub pes where pes.is_active = 1
group by evaluate_id
)r on per.evaluate_id = r.evaluate_id
left join pj_template_config pt on pt.config_id = per.template_id and pt.is_active = 1
left join pm_org_info poi on per.dept_id = poi.id and poi.status = 1
left join pj_evaluate_details ped on ped.evaluate_id = per.evaluate_id
left join (
select
count(if(check_two > 0,1,null)) as num,
count(1) as total,
evaluate_id
from pj_evaluate_details
group by evaluate_id
) m on m.evaluate_id = per.evaluate_id
left join(
SELECT
count(IF(check_two is null or check_two = 0 or check_two = '',1,null)) as num,
GROUP_CONCAT(DISTINCT IF(reject_two is null or reject_two = '',null,reject_two)) as rejectReason,
count(if(check_two = 2,1,null)) as failNum,
evaluate_id
from pj_evaluate_result
GROUP BY evaluate_id
)rr on rr.evaluate_id = per.evaluate_id
where per.is_active = 1
<if test="evaluateDeptId != null and evaluateDeptId != ''">
and per.dept_id = #{evaluateDeptId}
</if>
<if test="searchDate != null and searchDate != ''">
and per.year_and_month = #{searchDate}
</if>
<if test="keyWord != null and keyWord != ''">
and per.evaluate_name like concat('%', #{keyWord}, '%' )
</if>
group by per.evaluate_id
<if test="status != null and status != ''">
having status = #{status}
</if>
<if test="type == 'view'">
having status = 1
</if>
order by MAX(per.create_time) desc
</select>
</mapper>

View File

@ -41,6 +41,11 @@
check_one = #{type}
where id = #{id}
</if>
<if test="evaluateType == 3 ">
update pj_evaluate_result set check_three = #{type},reject_three = #{rejectReason},check_person_three = #{userId},
check_one = #{type},check_two = #{type}
where id = #{id}
</if>
</update>
<update id="auditByThreeParams" >
@ -54,7 +59,11 @@
check_one = #{type}
where evaluate_id = #{evaluateId} and sub_evaluate_id = #{templateId} and dept_id = #{deptId}
</if>
<if test="evaluateType == 3 ">
update pj_evaluate_result set check_three = #{type},reject_three = #{rejectReason},check_person_three = #{userId},
check_two = #{type},check_one = #{type}
where evaluate_id = #{evaluateId} and sub_evaluate_id = #{templateId} and dept_id = #{deptId}
</if>
</update>
@ -70,9 +79,12 @@
update pj_evaluate_details set check_one = #{isApprove} where details_id = #{detailsId}
</if>
<if test=" evaluateType == 2 or evaluateType == 3 ">
<if test=" evaluateType == 2 ">
update pj_evaluate_details set check_two = #{isApprove},check_one = #{isApprove} where details_id = #{detailsId}
</if>
<if test=" evaluateType == 3 ">
update pj_evaluate_details set check_three = #{isApprove}, check_two = #{isApprove},check_one = #{isApprove} where details_id = #{detailsId}
</if>
</update>
<update id="updatePjEvaluateDetailsStatusByThreeParams">
@ -83,6 +95,9 @@
<if test=" evaluateType == 2 ">
update pj_evaluate_details set check_two = #{isApprove},check_one = #{isApprove} where evaluate_id = #{evaluateId} and post_id = #{deptId} and sub_evaluate_id = #{templateId}
</if>
<if test=" evaluateType == 3 ">
update pj_evaluate_details set check_three = #{isApprove},check_two = #{isApprove},check_one = #{isApprove} where evaluate_id = #{evaluateId} and post_id = #{deptId} and sub_evaluate_id = #{templateId}
</if>
</update>
<update id="updateJsonData">
@ -537,7 +552,8 @@
su.username as userName,
per.person_id as userId,
ifnull(per.check_one,'0') as isApprove,
ifnull(per.check_two,'0') as isTwoApprove
ifnull(per.check_two,'0') as isTwoApprove,
ifnull(per.check_three,'0') as isThreeApprove
from pj_evaluate_result per
left join sys_user su on per.person_id = su.id
where
@ -561,10 +577,12 @@
<if test="evaluateType == 1 ">
and check_one != '1'
</if>
<if test="evaluateType == 2 ">
and check_two != '1'
</if>
<if test="evaluateType == 3 ">
and check_three != '1'
</if>
</select>
<select id="getIsBusinessDivision" resultType="java.lang.String">
@ -689,7 +707,9 @@
<if test="evaluateType == 2 ">
and check_two ='0'
</if>
<if test="evaluateType == 3 ">
and check_three ='0'
</if>
</select>
<select id="getCurrentTwoIsApprove" resultType="java.lang.Integer">
select
@ -768,6 +788,11 @@
group by
pes.sub_id
</select>
<select id="isCheckTwoIsAudit" resultType="java.lang.Integer">
select count(1) from pj_evaluate_details where evaluate_id = #{evaluateId} and post_id = #{deptId} and
check_two = '1' and sub_evaluate_id = #{templateId}
</select>
<update id="updateEvaluateRecordByEvaluateId">
update pj_evaluate_record set task_status = #{taskStatus} where evaluate_id = #{evaluateId}

View File

@ -1,16 +1,15 @@
//form序列化为json
$.fn.serializeObject = function()
{
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
o[this.name].push(this.value || "");
} else {
o[this.name] = this.value || '';
o[this.name] = this.value || "";
}
});
return o;
@ -18,17 +17,24 @@ $.fn.serializeObject = function()
//获取url后的参数值
function getUrlParam(key) {
var href = window.location.href;
var url = href.split("?");
if(url.length <= 1){
return "";
}
var params = url[1].split("&");
for(var i=0; i<params.length; i++){
var param = params[i].split("=");
if(key == param[0]){
return param[1];
}
}
}
var href = window.location.href;
console.log("key+++++", key);
var url = href.split("?");
console.log("url+++++", url);
if (url.length <= 1) {
return "";
}
var params = url[1].split("&");
console.log("params+++++", params);
for (var i = 0; i < params.length; i++) {
var param = params[i].split("=");
console.log("param*****+++++", param);
if (key == param[0]) {
return param[1];
}
}
}

View File

@ -116,16 +116,21 @@ function initTreeTable() {
{
fixed: 'right', width: '20%', title: '操作', align: 'center', templet: d => {
let html = "";
if ([1, 2, 3, 4].includes(d.level)) {
if(user.roleId == 6 || user.roleId == 5){
html += '<a lay-event="add" style="color: #009688;cursor: pointer;font-size: 15px" id="add">新增</a>';
}
if(user.roleId == 7 && d.level == 4 && d.userName == user.nickname){
if(user.roleId == 7 && d.level == 4 &&(d.userName == user.nickname || d.parentUserName==user.nickname) ){
html += '<a lay-event="add" style="color: #009688;cursor: pointer;font-size: 15px" id="add">新增</a>';
}
if(user.roleId == 7 && d.level == 3 && d.userName == user.nickname){
html += '<a lay-event="add" style="color: #009688;cursor: pointer;font-size: 15px" id="add">新增</a>';
}
}
if (d.level === 5) {
if(user.roleId == 6 || user.roleId == 5){

View File

@ -1,3 +1,4 @@
// 专责审批 js文件
let layer, laydate, table, form;
$(function () {
layui.use(["layer", "laydate", "table", "form"], function () {
@ -27,7 +28,7 @@ function search(type) {
form.render("select");
}
table.reload("baseTable", {
url: ctxPath + "/backstage/evaluate/evalSummaryList",
url: ctxPath + "/backstage/evaluate/dedicatedEvalSummaryList",
page: {
curr: 1,
},
@ -47,7 +48,7 @@ function initTable() {
//渲染表格
table.render({
elem: "#baseTable",
url: ctxPath + "/backstage/evaluate/evalSummaryList", //数据接口
url: ctxPath + "/backstage/evaluate/dedicatedEvalSummaryList", //数据接口
method: "get", //方式默认是get
toolbar: "default", //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
where: {

View File

@ -2,6 +2,7 @@
<html lang="en">
<head>
<!-- 专责审批 页面 -->
<meta charset="UTF-8">
<title>汇总审核</title>
<link rel="stylesheet" href="../../../layui/css/layui.css" />

View File

@ -8,6 +8,7 @@
</head>
<body>
<div style="padding: 10px;">
<table class="layui-table" id="baseTable" lay-filter="test"></table>
</div>

View File

@ -127,17 +127,17 @@
console.log("ddddd:", d)
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isTwoApprove == 1 && d.isApprove == 1) {
if (d.isTwoApprove == 1 && d.isApprove == 1 && d.isThreeApprove == 0) {
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">通过</a>';
text +=
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="reject">驳回</a>';
} else {
if (d.isTwoApprove == 1 && d.isApprove == 1) {
if (d.isTwoApprove == 1 && d.isApprove == 1 && d.isThreeApprove == 1) {
text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">已通过</a>';
} else if (d.isTwoApprove == 2 && d.isApprove == 1) {
} else if (d.isThreeApprove == 2 && d.isTwoApprove == 1) {
text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
' id="reject">已驳回</a>';
} else {
@ -160,11 +160,11 @@
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isTwoApprove == 1) {
if (d.isThreeApprove == 1) {
text += '<a style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">已通过</a>';
}
if (d.isTwoApprove == 2) {
if (d.isThreeApprove == 2) {
text += '<a style="color: #a59e9e;cursor: pointer;font-size: 15px"' +
' id="reject">已驳回</a>';
}
@ -173,6 +173,8 @@
// text +=
// '<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
// ' id="reject">驳回</a>';
return text;
}
}

View File

@ -1,152 +1,158 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>汇总审核查看审批</title>
<link rel="stylesheet" href="../../../layui/css/layui.css"/>
<link rel="stylesheet" href="../../../layui/css/layui.css" />
</head>
<body>
<div style="padding: 10px;">
<div class="layui-btn-container" id="auditBtnGroup">
<div style="padding: 10px;">
<div class="layui-btn-container" id="auditBtnGroup">
</div>
<table class="layui-table" id="baseTable" lay-filter="test"></table>
</div>
<table class="layui-table" id="baseTable" lay-filter="test"></table>
</div>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script>
let headerRows;
let layer, laydate, table;
let tableLoading;
let code = 0;
$(function () {
layui.use(['layer', 'laydate', 'table'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
//自定义loading
tableLoading = layer.load(2, {shade: [0.1, '#fff']});
getAuditBtn();
initTable();
bindToolbarEvents();
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/common_methon.js"></script>
<script type="text/javascript" src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
<script>
let headerRows;
let layer, laydate, table;
let tableLoading;
let code = 0;
$(function () {
layui.use(['layer', 'laydate', 'table'], function () {
layer = layui.layer;
laydate = layui.laydate;
table = layui.table;
//自定义loading
tableLoading = layer.load(2, { shade: [0.1, '#fff'] });
getAuditBtn();
initTable();
bindToolbarEvents();
});
});
function getAuditBtn() {
$.ajax({
url: ctxPath + '/outsourcer/getAuditBtn',
type: 'post',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
if (res.res == '1') {
let data = res.obj;
let btnGroup = $('#auditBtnGroup');
btnGroup.empty();
for (let i = 0; i < data.length; i++) {
let btn = '';
if (data[i].isApprove == '0') {
btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}评价审批</button>`;
}else if (data[i].isApprove == '1') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
}else if (data[i].isApprove == '2') {
btn =
`<button class="layui-btn layui-btn-primary layui-border-red layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','2')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") === '查看'){
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
}
btnGroup.append(btn);
}
}
}
})
}
function initTable() {
code = 0;
getTitle();
}
function setCols(data, msg) {
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
});
headerRows = [];
headerRows = JSON.parse(data);
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
//动态生成表头
headerRows.forEach(rowData => {
rowData.forEach(cellData => {
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
cellData.fixed = 'left';
}
if (!['审核', '序号', '施工业务外包商', '工程名称'].includes(cellData.title)) {
if (cellData.field.split('-').length === 2) {
cellData.title =
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
title="计算方法" style="margin-left: 5px;"></i>`;
}
} else {
if (cellData.title === '施工业务外包商') {
cellData.fixed = 'left';
}
if (cellData.title === '工程名称') {
cellData.fixed = 'left';
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isApprove == 0) {
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">通过</a>';
text +=
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="reject">驳回</a>';
}
// text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
// ' id="pass">通过</a>';
// text +=
// '<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
// ' id="reject">驳回</a>';
return text;
}
}
});
});
table.render({
function getAuditBtn() {
$.ajax({
url: ctxPath + '/outsourcer/getAuditBtn',
type: 'post',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
if (res.res == '1') {
let data = res.obj;
let btnGroup = $('#auditBtnGroup');
btnGroup.empty();
for (let i = 0; i < data.length; i++) {
let btn = '';
if (data[i].isApprove == '0') {
btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}评价审批</button>`;
} else if (data[i].isApprove == '1') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
} else if (data[i].isApprove == '2') {
btn =
`<button class="layui-btn layui-btn-primary layui-border-red layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','2')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") === '查看') {
btn =
`<button class="layui-btn layui-btn-primary layui-border layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','1')">${data[i].name}</button>`;
}
if (localStorage.getItem("AllAuditTitle") == '审核') {
btn =
`<button class="layui-btn layui-btn-sm" onclick="openPage('${data[i].id}', '${data[i].name}','0')">${data[i].name}</button>`;
}
btnGroup.append(btn);
}
}
}
})
}
function initTable() {
code = 0;
getTitle();
}
function setCols(data, msg) {
//重新加载表格 清空之前的表头和内容
table.reload('baseTable', {
cols: []
});
headerRows = [];
headerRows = JSON.parse(data);
// Clear existing headers
const thead = document.querySelector('#baseTable thead');
if (thead) {
thead.innerHTML = '';
} else {
const newThead = document.createElement('thead');
document.querySelector('#baseTable').appendChild(newThead);
}
//动态生成表头
headerRows.forEach(rowData => {
rowData.forEach(cellData => {
cellData.align = 'center';
if (cellData.title === '序号') {
cellData.type = 'numbers';
cellData.fixed = 'left';
}
if (!['审核', '序号', '施工业务外包商', '工程名称'].includes(cellData.title)) {
if (cellData.field.split('-').length === 2) {
cellData.title =
`${cellData.title}<i class="layui-icon layui-icon-tips layui-font-14" lay-event="checkTips"
title="计算方法" style="margin-left: 5px;"></i>`;
}
} else {
if (cellData.title === '施工业务外包商') {
cellData.fixed = 'left';
}
if (cellData.title === '工程名称') {
cellData.fixed = 'left';
}
}
if (cellData.mergeType === "colspan") {
cellData.colspan = cellData.num;
} else if (cellData.mergeType === "rowspan") {
cellData.rowspan = cellData.num;
}
if (cellData.field === 'examineAndApprove') {
cellData.templet = function (d) {
//如果d.isApprove == 1 去除当前行的编辑功能
let text = "";
if (d.isApprove == 0) {
text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="pass">通过</a>';
text +=
'<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="reject">驳回</a>';
}
// text += '<a lay-event="pass" style="color: #009688;cursor: pointer;font-size: 15px"' +
// ' id="pass">通过</a>';
// text +=
// '<a lay-event="reject" style="color: #a59e9e;cursor: pointer;font-size: 15px;margin-left: 10px"' +
// ' id="reject">驳回</a>';
return text;
}
}
});
});
table.render({
elem: '#baseTable',
cols: headerRows,
data: JSON.parse(msg), // 使用从 API 获取的数据
@ -329,7 +335,7 @@
});
if (typeof value === 'number') {
itemData[totalField] = t.toFixed(2);
}else {
} else {
itemData[totalField] = t;
}
@ -338,7 +344,7 @@
})
//计算总得分
layui.each(res.data, function (i, itemData) {
//对每一行所有total结尾的进行加和
//对每一行所有total结尾的进行加和
let map = {};
for (let key in itemData) {
map[key] = itemData[key];
@ -409,139 +415,140 @@
}
}
)
;
table.on('tool(test)', function (obj) {
var data = obj.data; //当前行数据
var rowIndex = obj.index;
var layEvent = obj.event; //当前点击的事件名
if (layEvent === 'pass') {
data.isApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isApprove = 2;
audit(obj, 2, data);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(test)', function (obj) {
var event = obj.event;
if (event === 'checkTips') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
//设置500ms内仅弹出一次
if (!layer.alert.isShown) {
layer.alert.isShown = true;
layer.alert(text, {
title: `${obj.col.title}`,
end: function () {
setTimeout(function () {
layer.alert.isShown = false;
}, 500);
}
});
)
;
table.on('tool(test)', function (obj) {
var data = obj.data; //当前行数据
var rowIndex = obj.index;
var layEvent = obj.event; //当前点击的事件名
if (layEvent === 'pass') {
data.isApprove = 1;
audit(obj, 1, data);
}
if (layEvent === 'reject') {
data.isApprove = 2;
audit(obj, 2, data);
}
});
// 表头自定义元素工具事件 --- 2.8.8+
table.on('colTool(test)', function (obj) {
var event = obj.event;
if (event === 'checkTips') {
let text = `<span><span style="color: red">*</span>指标定义及计算方法:</span> ${obj.col.method}`;
text += `<br/><span><span style="color: red">*</span>积分标准:</span> ${obj.col.standard}`;
//设置500ms内仅弹出一次
if (!layer.alert.isShown) {
layer.alert.isShown = true;
layer.alert(text, {
title: `${obj.col.title}`,
end: function () {
setTimeout(function () {
layer.alert.isShown = false;
}, 500);
}
});
}
}
});
}
function getTitle() {
$.ajax({
url: ctxPath + '/outsourcer/getCollectData',
type: 'get',
data: {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
setCols(res.obj, res.resMsg);
}
})
}
function getTableData() {
//获取表格填写的数据
var tableData = table.cache.baseTable;
let filed = [];
//定义一个map
let obj = tableData[0];
for (let key in obj) {
if (key.indexOf('LAY') === -1 && !['subName', 'proName', 'subId', 'proId'].includes(key)) {
filed.push(key);
}
}
});
}
function getTitle() {
$.ajax({
url: ctxPath + '/outsourcer/getCollectData',
type: 'get',
data: {
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('evaluateId'),
type: 'audit',
},
success: function (res) {
setCols(res.obj, res.resMsg);
}
})
}
function getTableData() {
//获取表格填写的数据
var tableData = table.cache.baseTable;
let filed = [];
//定义一个map
let obj = tableData[0];
for (let key in obj) {
if (key.indexOf('LAY') === -1 && !['subName', 'proName', 'subId', 'proId'].includes(key)) {
filed.push(key);
}
}
//TODO 校验数据
let data = {
templateId: getUrlParam('templateId'),
evaluateId: getUrlParam('id'),
jsonData: JSON.stringify(tableData),
titleFiled: filed.join(',')
};
$.ajax({
url: ctxPath + '/outsourcer/saveEvaluateData',
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
evaluateId: getUrlParam('id'),
jsonData: JSON.stringify(tableData),
titleFiled: filed.join(',')
};
$.ajax({
url: ctxPath + '/outsourcer/saveEvaluateData',
type: 'post',
data: data,
success: function (res) {
if (res.res == '1') {
layer.msg('保存成功');
closePage();
} else {
layer.msg(res.resMsg);
}
}
}
})
}
function bindToolbarEvents() {
table.on('toolbar(test)', function (obj) {
var id = obj.config.id;
switch (obj.event) {
case 'getCheckData':
//获取带按钮的名称
const title = $(this).text();
const layerIndex = layer.open({
type: 2,
title: title,
shade: 0.3,
area: ['80%', '90%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: './reviewPage.html',
});
break;
case 'getData':
var getData = table.getData(id);
layer.alert(layui.util.escape(JSON.stringify(getData)));
break;
}
});
}
function openPage(id, name,type) {
let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
if (id == '0') {
url = './proEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
})
}
const layerIndex = layer.open({
type: 2,
title: name + "评价审批",
shade: 0.3,
area: ['98%', '98%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: url,
});
}
</script>
function bindToolbarEvents() {
table.on('toolbar(test)', function (obj) {
var id = obj.config.id;
switch (obj.event) {
case 'getCheckData':
//获取带按钮的名称
const title = $(this).text();
const layerIndex = layer.open({
type: 2,
title: title,
shade: 0.3,
area: ['80%', '90%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: './reviewPage.html',
});
break;
case 'getData':
var getData = table.getData(id);
layer.alert(layui.util.escape(JSON.stringify(getData)));
break;
}
});
}
function openPage(id, name, type) {
let url = './otherEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
if (id == '0') {
url = './proEvaluateAuditForm.html?deptId=' + id + '&evaluateId=' + getUrlParam('evaluateId') +
'&templateId=' + getUrlParam('templateId') + '&type=' + type;
}
const layerIndex = layer.open({
type: 2,
title: name + "评价审批",
shade: 0.3,
area: ['98%', '98%'],
scrollbar: true,
move: true,
anim: 2,
shadeClose: false,
content: url,
});
}
</script>
</body>
</html>
</html>