地质所 沉降监测网建设项目
suerwei
2024-07-02 18c509d71b6b382aa2bf846ba7c9b6d64ade1182
javaweb-plus/javaweb-cms/src/main/resources/templates/geo/TubLog/edit.html
@@ -34,7 +34,7 @@
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="outboundDate" th:value="${#dates.format(tubLog.outboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <input id="outboundDateId" name="outboundDate" th:value="${#dates.format(tubLog.outboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
@@ -43,7 +43,7 @@
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="inboundDate" th:value="${#dates.format(tubLog.inboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <input id="inboundDateId" name="inboundDate" th:value="${#dates.format(tubLog.inboundDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
@@ -78,6 +78,13 @@
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">上传图片/扫描件:</label>
                <div class="col-sm-8">
                    <input type="file" name= "file" id="file"/>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
@@ -90,9 +97,49 @@
        });
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-TubLog-edit').serialize());
            var result = doSubmitFile();
            var documentFile =null;
            if(result !=null){
                if(result.code == web_status.SUCCESS){
                    documentFile= result.fileName;
                }
            }
            let inboundDateValue = $("#inboundDateId").val();
            let outboundDateValue = $("#outboundDateId").val();
            if ($.common.isEmpty(inboundDateValue) && $.common.isEmpty(outboundDateValue)) {
                $.modal.alertWarning("出入库时间,请选择一条记录");
                return;
            }
            if ($.validate.form()) {
                let formData = $('#form-TubLog-edit').serialize();
                let data = formData  +"&fileUrl="+documentFile;
                $.operate.save(prefix + "/edit", data);
            }
        }
        //上传文件
        function doSubmitFile(){
            var file = $('#file').val();
            if (file == '' || file ==null){
                return null;
            }
            var formData = new FormData();
            formData.append("file", $('#file')[0].files[0]);
            var data = null;
            $.ajax({
                url: ctx + "geo/TubLog/uploadTubLogFile",
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                type: 'POST',
                async:false,
                success: function (result) {
                    data=  result;
                }
            });
            return data;
        }
        $("input[name='outboundDate']").datetimepicker({