<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改涉密文件接收')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-filereceive-edit" th:object="${tdFileReceive}">
        <input name="receiveId" th:field="*{receiveId}" type="hidden">
        <input name="destoryState" th:value="1" type="hidden">
        <input name="destoryDepart" th:value="${user.dept.deptName}" type="hidden">
        <input name="destoryUsername" th:value="${user.userName}" type="hidden">
        <input name="destoryDate" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">文件标题：</label>
            <div class="col-sm-8">
                <input name="fileName" disabled th:field="*{fileName}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">保密期限：</label>
            <div class="col-sm-8">
                <input name="releaseSecretid" readonly th:field="${tdFileProvide.releaseSecretid}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">文件密级：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_file_miji')}">
                    <input type="radio" disabled th:id="${dict.dictCode}" name="fileSecret" th:value="${dict.dictValue}" th:field="${tdFileProvide.fileSecret}">
                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">文号：</label>
            <div class="col-sm-8">
                <input name="provideDepart" readonly th:value="${tdFileProvide.fileNum}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">定密依据：</label>
            <div class="col-sm-8">
                <textarea name="allianceFile" readonly class="form-control">[[${tdFileProvide.allianceFile}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">销毁数量：</label>
            <div class="col-sm-8">
                <input name="destoryCount"  digits="true" required th:field="*{destoryCount}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">销毁方式：</label>
            <div class="col-sm-8">
                <select name="destoryStyle" required class="form-control m-b" th:with="type=${@dict.getType('sys_destory_style')}">
                    <option value="">请选择</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{destoryStyle}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">销毁地点：</label>
            <div class="col-sm-8">
                <textarea name="destoryAddress" required class="form-control">[[*{destoryAddress}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注信息：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/filereceive";
    $("#form-filereceive-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-filereceive-edit').serialize());
        }
    }
    function conversionDate(date){
        var year = date.getFullYear();
        var month = String(date.getMonth() + 1).padStart(2, '0');  // 月份从 0 开始，需要加 1
        var day = String(date.getDate()).padStart(2, '0');  // 日可能是个位数，需要补零
        return year + '-' + month + '-' + day
    }
    $("input[name='destoryDate']").val(conversionDate(new Date()));
</script>
</body>
</html>
