<%--
  Created by IntelliJ IDEA.
  User: xuan
  Date: 2021/9/15
  Time: 11:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../common/common.jsp" %>
<html>
<head>
    <title>批量激活</title>
</head>
<body>
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
    <h4 class="modal-title">批量激活关键词</h4>
</div>
<div class="modal-body">
    <form id="userForm" method="post">
        <div class="form_group">
            <label class="form_label col-xs-3"><b>企业ID:</b></label>
            <div class="col-xs-9">
                <textarea name="sp_ids" id="sp_ids" class="form_control" style="width:100%;min-height: 150px;"
                          placeholder="支持多个企业ID,请用换行符[回车]或者英文逗号[,]分隔,为空将应用全部企业"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-3"><b>起止时间:</b></label>
            <div class="col-xs-9">
                <input
                        id="d12" name="starttime" type="text" class="Wdate form_control form_white2"
                        onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'d13\')||\'%y-%M-%d %H:%m:%s\'}',
                    dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false,readOnly:true})"/>
                --
                <input id="d13" name="endtime" type="text" class="Wdate form_control form_white2"
                       onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d12\',{d:0});}',maxDate:'%y-%M-%d %H:%m:%s',
                   dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false,readOnly:true})"/>
            </div>
        </div>
        <div style="margin-bottom: 20px;height:10px"></div>
    </form>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn_blue" onclick="confirm()">激活</button>
    <button type="button" class="btn default" data-dismiss="modal">关闭</button>
</div>
</body>

<script>
    function confirm() {
        // 	var url =  "setStatus.html?starttime=" + starttime+"&endtime="+endtime;
        // 	jqeury.post(url, function(data) {
        // 		if (data == "success") {
        // 			alert("批量生效成功！");
        // 			window.location.reload();
        // 		} else {
        // 			alert(data);
        // 		}
        // 	});
        // }
        let startTime = $("#d12").val();
        let endTime = $("#d13").val();
        if (startTime && endTime) {
            submitForm('userForm', 'setStatus.html',
                function (data) {
                    if (data && data.returnCode === 200) {
                        Dialog.alertSucc(data.msg);
                        window.location.reload();
                    }
                }, function (data) {
                    if (data && data.returnCode === 201) {
                        Dialog.alertError(data.msg);
                    }
                })
        }else{
            Dialog.alertError("起止时间不能为空")
        }
    }
</script>
</html>
