Browse Source

Merge branch 'dev' of humingfen/patient-co-management into dev

huangwenjie 7 years ago
parent
commit
4fd1d7e706

+ 90 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/healthbank/TaskController.java

@ -0,0 +1,90 @@
package com.yihu.wlyy.controller.manager.healthbank;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.manager.healthbank.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by humingfen on 2018/6/21.
 * 健康任务管理
 */
@Controller
@RequestMapping("admin/task")
public class TaskController extends BaseController {
    @Autowired
    private TaskService taskService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initListPage(){
        return "healthbank/task_list";
    }
    @RequestMapping(value = "infoInit")
    public String initInfoPage(@RequestParam(value = "id") String id, String type){
        request.setAttribute("id",id);
        request.setAttribute("type",type);
        return "healthbank/task_modify";
    }
    @RequestMapping(value = "init")
    public String init(String type){
        request.setAttribute("type",type);
        return "healthbank/task_modify";
    }
    @RequestMapping(value ="list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(name = "task") String task,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            return write(200,"操作成功","detailModelList",taskService.searchList(task, page, pageSize).get("detailModelList"));
//            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "findById")
    @ResponseBody
    public String findById(@RequestParam(value = "id") String id){
        try {
            String task = "{\"id\":\""+ id + "\"}";
            return  write(200,"操作成功","data",taskService.searchList(task, 1, 1));
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String update(String jsonData) {
        try {
            taskService.update(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String create(String jsonData) {
        try {
            taskService.create(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 90 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/healthbank/TaskRuleController.java

@ -0,0 +1,90 @@
package com.yihu.wlyy.controller.manager.healthbank;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.manager.healthbank.TaskRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by humingfen on 2018/6/22.
 * 健康任务规则管理
 */
@Controller
@RequestMapping("admin/taskRule")
public class TaskRuleController extends BaseController {
    @Autowired
    private TaskRuleService taskRuleService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initListPage(){
        return "healthbank/taskRule_list";
    }
    @RequestMapping(value = "infoInit")
    public String initInfoPage(@RequestParam(value = "id") String id, String type){
        request.setAttribute("id",id);
        request.setAttribute("type",type);
        return "healthbank/taskRule_modify";
    }
    @RequestMapping(value = "init")
    public String init(String type){
        request.setAttribute("type",type);
        return "healthbank/taskRule_modify";
    }
    @RequestMapping(value ="list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(name = "taskRule") String taskRule,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            return write(200,"操作成功","detailModelList",taskRuleService.searchList(taskRule, page, pageSize).get("detailModelList"));
//            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "findById")
    @ResponseBody
    public String findById(@RequestParam(value = "id") String id){
        try {
            String taskRule = "{\"id\":\""+ id + "\"}";
            return  write(200,"操作成功","data",taskRuleService.searchList(taskRule, 1, 1));
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String update(String jsonData) {
        try {
            taskRuleService.update(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String create(String jsonData) {
        try {
            taskRuleService.create(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/healthbank/ActivityService.java

@ -15,7 +15,7 @@ import java.util.Map;
 */
@Service
public class ActivityService {
    @Value("${healthbank.activity}")
    @Value("${healthbank.url}")
    private String baseUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;

+ 70 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/healthbank/TaskRuleService.java

@ -0,0 +1,70 @@
package com.yihu.wlyy.service.manager.healthbank;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by humingfen on 2018/6/22.
 * wlyy_health_bank_task_rule数据库
 */
@Service
public class TaskRuleService {
    @Value("${healthbank.url}")
    private String baseUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 查看活动列表
     * @param taskRule
     * @param page
     * @param pageSize
     * @return
     */
    public JSONObject searchList(String taskRule, Integer page, Integer pageSize) {
        String url = baseUrl + "findTaskRule";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("taskRule",taskRule);
        params.put("page",page.toString());
        params.put("size",pageSize.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject update(String jsonData) {
        String url = baseUrl + "updateTaskRule";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("taskRule",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject create(String jsonData) {
        String url = baseUrl + "createTaskRule";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("taskRule",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
}

+ 70 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/healthbank/TaskService.java

@ -0,0 +1,70 @@
package com.yihu.wlyy.service.manager.healthbank;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by humingfen on 2018/6/21.
 * wlyy_health_bank_task数据库
 */
@Service
public class TaskService {
    @Value("${healthbank.url}")
    private String baseUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 查看活动列表
     * @param task
     * @param page
     * @param pageSize
     * @return
     */
    public JSONObject searchList(String task, Integer page, Integer pageSize) {
        String url = baseUrl + "findTask";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("task",task);
        params.put("page",page.toString());
        params.put("size",pageSize.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject update(String jsonData) {
        String url = baseUrl + "updateTask";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("task",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject create(String jsonData) {
        String url = baseUrl + "createTask";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("task",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
}

+ 3 - 3
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -102,7 +102,7 @@ reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
  url: http://localhost:10051/svr-health-bank/
wechat:
  appId: wxd03f859efdf0873d
@ -210,7 +210,7 @@ reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
  url: http://localhost:10051/svr-health-bank/
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
@ -317,7 +317,7 @@ reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
  url: http://localhost:10051/svr-health-bank/
wechat:
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/activity_list_js.jsp

@ -30,7 +30,7 @@
                $searchBtn: $('#btn_search'),
                $addBtn: $('#btn_add'),
                $title: $("#inp_title"),//设备厂商名称
                $title: $("#inp_title"),//活动名称
                $type: $("#inp_type"),
                $location: $("#inp_location"),
                $startTime: $("#inp_start_time"),

+ 54 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_list.jsp

@ -0,0 +1,54 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/21 0019
  Time: 上午 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../head/page_head.jsp" %>
    <title>健康任务管理</title>
</head>
<body>
<div id="div_wrapper">
    <!-- 检索条件 -->
    <div class="m-task-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
        <div class="m-form-group f-mt10">
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_title" placeholder="请输入任务标题" class="f-ml10" data-attr-scan="title"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_type" placeholder="请输入任务类型" class="f-ml10" data-attr-scan="type"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_period" placeholder="请输入周期性" class="f-ml10" data-attr-scan="period"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_status" placeholder="请输入是否有效" class="f-ml10" data-attr-scan="status"/>
            </div>
            <sec:authorize url="/admin/task/list">
                <div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>查询</span>
                </div>
            </sec:authorize>
            <sec:authorize url="/admin/task/create">
                <div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>新增</span>
                </div>
            </sec:authorize>
        </div>
    </div>
    <!-- 列表 -->
    <div id="div_task_list">
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp" %>
<%@ include file="task_list_js.jsp" %>
</html>

+ 236 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_list_js.jsp

@ -0,0 +1,236 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
    (function ($, win) {
        $(function () {
            /* ************************** 变量定义 ******************************** */
            // 通用工具类库
            var Util = $.Util;
            var task = null;
            var master = null;
            var isFirstPage = false;
            /* *************************** 函数定义 ******************************* */
            function pageInit() {
                task.init();
                master.init();
            }
            function reloadGrid(params) {
                if (isFirstPage) {
                    this.grid.options.newPage = 1;
                }
                this.grid.setOptions({parms: params});
                this.grid.loadData(true);
            }
            /* *************************** 模块初始化 ***************************** */
            task = {
                $element: $('.m-task-area'),
                $searchBtn: $('#btn_search'),
                $addBtn: $('#btn_add'),
                $title: $("#inp_title"),//任务标题
                $type: $("#inp_type"),//任务类型
                $period: $("#inp_period"),//周期
                $status: $("#inp_status"),//状态
                init: function () {
                    this.$element.show();
                    this.$element.attrScan();
                    window.form = this.$element;
                    this.$title.ligerTextBox({width: 200});
                    this.typeBox = this.$type.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '普通任务', id: 'NORMAL_TASK'},
                            {text: '活动任务', id: 'ACTIVITY_TASK'},
                            {text: '规则任务', id: 'RULE_TASK'},
                        ]
                    });
                    this.periodBox =this.$period.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '一次性', id: '1'},
                            {text: '每天', id: '0'},
                        ]
                    });
                    this.statusBox = this.$status.ligerComboBox({
                        width: 200,
                        data: [
                            {text: '有效', id: '1'},
                            {text: '失效', id: '0'},
                        ]
                    });
                    this.bindEvents();
                },
                bindEvents: function () {
                    var self = this;
                    self.$searchBtn.click(function () {
                        master.grid.options.newPage = 1;
                        master.reloadGrid();
                    });
                    self.$addBtn.click(function () {
                        $.publish("task:info:create", [0]);
                    });
                }
            };
            master = {
                taskInfoDialog: null,
                grid: null,
                init: function () {
                    this.grid = $("#div_task_list").ligerGrid($.LigerGridEx.config({
                        url: ctx + '/admin/task/list',
                        parms: {"task": JSON.stringify(task.$element.Fields.getValues())},
                        ajaxHeader: ajaxHeaderName,
                        ajaxHeaderValue: ajaxHeaderValue,
                        columns: [
                            {display: 'id', name: 'id', hide: true},
                            {display: '任务标题', name: 'title', width: '10%', align: "left"},
                            {display: '任务说明', name: 'content', width: '10%', align: "left"},
                            {display: '任务编码', name: 'taskCode', width: '10%', align: "left"},
                            {
                                display: '任务类型', name: 'type', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.type == "NORMAL_TASK") {
                                        return "普通任务"
                                    }
                                    if (row.type == "ACTIVITY_TASK") {
                                        return "活动任务"
                                    }
                                    if (row.type == "RULE_TASK") {
                                        return "规则任务"
                                    }
                                }
                            },
                            // {display: '业务Id', name: 'startTime', width: '10%', align: "left"},
                            {
                                display: '周期', name: 'period', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.period == 1) {
                                        return "一次性"
                                    }
                                    if (row.period == 0) {
                                        return "每天"
                                    }
                                }
                            },
                            {display: '开始时间', name: 'startTime', width: '10%', align: "left"},
                            {display: '结束时间', name: 'endTime', width: '10%', align: "left"},
                            {
                                display: '状态', name: 'status', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.status == 1) {
                                        return "有效"
                                    }
                                    if (row.status == 0) {
                                        return "失效"
                                    }
                                }
                            },
                            {
                                display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
                                render: function (row) {
                                    var html = '';
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "task:info:view", row.id) + '">查看</a>';
                                    <sec:authorize url="/admin/task/update">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "task:info:edit", row.id) + '">编辑</a>';
                                    </sec:authorize>
                                    <%--<sec:authorize url="/admin/task/delete">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "task:info:del", row.id) + '">删除</a>';
                                    </sec:authorize>--%>
                                    return html;
                                }
                            }
                        ],
                    }));
                    // 自适应宽度
                    this.grid.adjustToWidth();
                    this.bindEvents();
                },
                reloadGrid: function (msg) {
                    task.$element.attrScan();
                    var values = task.$element.Fields.getValues();
                    values.type = task.typeBox.getValue();
                    values.period = task.periodBox.getValue();
                    values.status = task.statusBox.getValue();
                    reloadGrid.call(this,{"task":JSON.stringify(values)});
                },
                delRecord: function (id, code) {
                    var self = this;
                    $.ajax({
                        url: ctx + "/admin/task/delete",
                        data: {"id": id},
                        method: "post",
                        dataType: "json",
                        success: function (result) {
                            if (result.status == '200') {
                                window.reloadMasterGrid(result.msg);
                            } else {
                                $.Notice.error(result.msg);
                            }
                        },
                        error: function (data) {
                            $.Notice.error("系统异常,请联系管理员!");
                        }
                    })
                },
                bindEvents: function () {
                    var self = this;
                    $.subscribe('task:info:view', function (event, id) {
                        var title = '查看信息';
                        self.deviceInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "view"},
                            title: title,
                            url: ctx + '/admin/task/infoInit'
                        })
                    });
                    $.subscribe('task:info:edit', function (event, id) {
                        var title = '编辑信息';
                        self.taskInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "edit"},
                            title: title,
                            url: ctx + '/admin/task/infoInit'
                        })
                    });
                    $.subscribe('task:info:create', function (event) {
                        var title = '新增活动';
                        self.taskInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"type": "create"},
                            title: title,
                            url: ctx + '/admin/task/init'
                        })
                    });
                    $.subscribe('task:info:del', function (event, id, code) {
                        $.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
                            if (yes) {
                                self.delRecord(id, code);
                            }
                        });
                    })
                }
            };
            /* ************************* Dialog页面回调接口 ************************** */
            win.reloadMasterGrid = function (msg) {
                if (isNoEmpty(msg)) {
                    $.Notice.success(msg);
                }
                master.reloadGrid(msg);
            };
            win.closetaskInfoDialog = function () {
                master.taskInfoDialog.close();
            };
            /* *************************** 页面初始化 **************************** */
            pageInit();
        });
    })(jQuery, window);
</script>

+ 95 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_modify.jsp

@ -0,0 +1,95 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/21
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <%@ include file="../head/page_head.jsp"%>
    <title>任务详情</title>
    <style type="text/css">
        .m-form-group label.label_title{width: 100px}
    </style>
</head>
<body>
<div id="div_task_info_form" data-role-form class="m-form-inline f-mt20 f-ml30" data-role-form>
    <input type="hidden" id="inp_id" value='${id}' data-attr-scan="id"/>
    <input type="hidden" id="type" value='${type}'/>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">任务标题</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_title" class="required useTitle f-w240 validate-special-char"  required-title="任务标题不能为空"  data-attr-scan="title"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">任务说明</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_content" class="required useTitle ajax f-w240 validate-special-char"  required-title="任务说明不能为空"  data-attr-scan="content"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">任务编码</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_taskCode" class="required useTitle ajax f-w240 validate-special-char"  required-title="任务编码不能为空" data-attr-scan="taskCode"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">任务类型</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_type" class="required useTitle ajax f-w240 validate-special-char" required-title="任务类型不能为空" data-attr-scan="type"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动类型</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_transactionId" class="required useTitle ajax f-w240 validate-special-char" required-title="活动类型不能为空" data-attr-scan="transactionId"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">积分规则</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_ruleCode" class="required useTitle ajax f-w240 validate-special-char" required-title="积分规则不能为空" data-attr-scan="ruleCode"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">开始时间</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_startTime"  class="required useTitle f-w240 validate-special-char" required-title="开始时间不能为空" data-attr-scan="startTime"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">结束时间</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_endTime" class="required useTitle f-w240 validate-special-char"  required-title="结束时间不能为空" data-attr-scan="endTime"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">周期</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_period" class="f-w240 validate-special-char"   data-attr-scan="period"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">状态</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_status" class="f-w240 validate-special-char" data-attr-scan="status"/>
        </div>
    </div>
    <div class="m-form-group f-pa" id="btn_save_close" style="right: 10px;bottom: 0;">
        <div class="m-form-control">
            <input type="button" value="保存" id="btn_save" class="l-button u-btn u-btn-primary u-btn-large f-ib f-vam" />
            <div id="btn_cancel" class="l-button u-btn u-btn-cancel u-btn-large f-ib f-vam" >
                <span>关闭</span>
            </div>
        </div>
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp"%>
<%@ include file="task_modify_js.jsp" %>
<%--<script src="${ctx}/static/js/device/device_modify.js"></script>--%>
</html>

+ 197 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/task_modify_js.jsp

@ -0,0 +1,197 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
    (function ($, win) {
        $(function () {
            var Util = $.Util;
            var type = $('#type').val();
            var id = $('#inp_id').val();
            var taskInfo = "";
            var jValidation = $.jValidation;
            function pageInit() {
                taskInfo.init();
                if(type != "create") {
                    taskInfo.initForm();
                }
                taskInfo.bindEvents();
            }
            taskInfo = {
                //变量
                $form: $("#div_task_info_form"),
                $transactionId: $("#inp_transactionId"),
                $ruleCode: $("#inp_ruleCode"),
                init: function () {
                    _this = this;
                    this.$form.attrScan();
                    $("#inp_title").ligerTextBox({width: 240})//任务标题
                    $("#inp_content").ligerTextBox({width: 240})//任务说明
                    $("#inp_taskCode").ligerTextBox({width: 240})//任务编码
                    _this.typeBox = $("#inp_type").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '普通任务', id: 'NORMAL_TASK'},
                            {text: '活动任务', id: 'ACTIVITY_TASK'},
                            {text: '规则任务', id: 'RULE_TASK'},
                        ]
                    });//任务类型
                    _this.periodBox = $("#inp_period").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '一次性', id: '1'},
                            {text: '每天', id: '0'},
                        ]
                    })//周期
                    $("#inp_startTime").ligerDateEditor({
                        format: "yyyy-MM-dd hh:mm:ss",
                        showTime: true,
                        width: 240,
                        labelAlign: 'center',
                        cancelable: true
                    });//开始时间
                    $("#inp_endTime").ligerDateEditor({
                        format: "yyyy-MM-dd hh:mm:ss",
                        showTime: true,
                        width: 240,
                        labelAlign: 'center',
                        cancelable: true
                    });//结束时间
                    _this.statusBox = $("#inp_status").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '有效', id: '1'},
                            {text: '失效', id: '0'},
                        ]
                    })//状态
                    //活动下拉框
                    _this.transactionBox = _this.$transactionId.ligerComboBox({
                        url: ctx + "/admin/activity/list",
                        parms: {"activity":"{}","page":1,"rows":10},
                        dataParmName: "detailModelList",
                        textField: "title",
                        valueField: "id",
                        isMultiSelect: false,
                        ajaxBeforeSend: function (xhr) {
                            if (ajaxHeaderName) {
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                            }
                        },
                    });
                    //积分规则下拉框
                    _this.ruleBox = _this.$ruleCode.ligerComboBox({
                        url: ctx + "/admin/taskRule/list",
                        parms: {"taskRule":"{}","page":1,"rows":10},
                        dataParmName: "detailModelList",
                        textField: "name",
                        valueField: "id",
                        isMultiSelect: false,
                        ajaxBeforeSend: function (xhr) {
                            if (ajaxHeaderName) {
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                            }
                        },
                    });
                },
                initForm: function () {
                    _this = this;
                    //修改、查看
                    $.ajax({
                        url: ctx + "/admin/task/findById",
                        method: "post",
                        dataType: "json",
                        async: false,
                        data: {id: id},
                        success: function (result) {
                            if (result.status == '200') {
                                var data = result.data.detailModelList[0];
                                _this.$form.Fields.fillValues({
                                    title: data.title,
                                    content: data.content,
                                    taskCode: data.taskCode,
                                    startTime: data.startTime,
                                    endTime: data.endTime,
                                });
                                //填值
                                _this.typeBox.selectValue(data.type);
                                _this.periodBox.selectValue(data.period);
                                _this.statusBox.selectValue(data.status);
                                _this.transactionBox.selectValue(data.transactionId);
                                _this.ruleBox.selectValue(data.ruleCode);
                            } else {
                                $.Notice.error(result.msg);
                            }
                        },
                        error: function (data) {
                            $.Notice.error("系统异常,请联系管理员!");
                        }
                    });
                    if (type == "view") {
                        _this.$form.addClass("m-form-readonly"); //表单只读
                        $(".essential").addClass("XXXtest");
                        $(".essential").removeClass("essential");
                        $("#btn_save_close").css("display", "none");
                    } else {
                        this.$form.removeClass("m-form-readonly");
                        $("#btn_save_close").css("display", "block");
                        $(".XXXtest").addClass("essential");
                    }
                    this.$form.show();
                },
                //绑定事件
                bindEvents: function () {
                    var validator = new jValidation.Validation(this.$form, {
                        immediate: true, onSubmit: false,
                        onElementValidateForAjax: function (elm) {
                        }
                    });
                    var self = this;
                    $("#btn_save").click(function () {
                        var values = self.$form.Fields.getValues();
                        values.type = self.typeBox.getValue();
                        values.status = self.statusBox.getValue();
                        values.period = self.periodBox.getValue();
                        values.transactionId = self.transactionBox.getValue();
                        values.ruleCode = self.ruleBox.getValue();
                        if (!validator.validate()) {
                            return;
                        }
                        update(values);
                    });
                    function update(values) {
                        var dataModel = $.DataModel.init();
                        var url = "update";
                        if (type == "create") {
                            url = "create";
                        }
                        dataModel.updateRemote(ctx + "/admin/task/" + url, {
                            data: {jsonData: JSON.stringify(values)},
                            success: function (data) {
                                if (data.status == 200) {
                                    parent.window.reloadMasterGrid(data.msg);
                                    parent.window.closetaskInfoDialog();
                                } else {
                                    $.Notice.error(data.msg);
                                }
                            }
                        });
                    }
                    $("#btn_cancel").click(function () {
                        parent.window.closetaskInfoDialog();
                    });
                },
            }
            pageInit();
        });
    })(jQuery, window)
</script>

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp

@ -131,6 +131,9 @@
							<sec:authorize url="/admin/activity/initial">
								<li><a href="javascript:locationMenu('activity');">活动管理</a></li>
							</sec:authorize>
                            <sec:authorize url="/admin/task/initial">
                                <li><a href="javascript:locationMenu('task');">任务管理</a></li>
                            </sec:authorize>
							<sec:authorize url="/admin/healthBank/center">
						</ul>
					</div>

+ 1 - 0
patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js

@ -24,6 +24,7 @@ var menu = {
    //健康银行管理
    "activity": "/admin/activity/initial",//健康活动管理页面
    "task": "/admin/task/initial",//健康任务管理页面
    //数据统计
    "static": "/admin/static/center",//数据统计