| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.javaweb.common.config.Global; |
| | | import com.javaweb.common.config.ServerConfig; |
| | | import com.javaweb.common.utils.file.FileUploadUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import com.javaweb.common.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 材料出入库记录Controller |
| | | * |
| | |
| | | |
| | | @Autowired |
| | | private ITubLogService tubLogService; |
| | | |
| | | @Autowired |
| | | private ServerConfig serverConfig; |
| | | |
| | | @RequiresPermissions("geo:TubLog:view") |
| | | @GetMapping() |
| | |
| | | return tubLogService.countTubLogDate(projectId); |
| | | } |
| | | |
| | | /** |
| | | * 上传图片 |
| | | */ |
| | | @PostMapping("/uploadTubLogFile") |
| | | @ResponseBody |
| | | public AjaxResult uploadTubLogFile(MultipartFile file){ |
| | | try { |
| | | // 上传文件路径 |
| | | String filePath = Global.getUploadPath() +"/tublogfile"; |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.upload(filePath, file); |
| | | String url = serverConfig.getUrl() + fileName; |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("fileName", fileName); |
| | | ajax.put("url", url); |
| | | return ajax; |
| | | }catch (Exception e){ |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date createDate; |
| | | |
| | | /** 图片/扫描件路径 */ |
| | | @Excel(name = "图片/扫描件路径") |
| | | private String fileUrl; |
| | | |
| | | /** 出入库数量统计 */ |
| | | private Double outboundNumber; |
| | | private Double inboundNumber; |
| | |
| | | { |
| | | return unit; |
| | | } |
| | | public void setCreateDate(Date createDate) |
| | | |
| | | public String getFileUrl() { |
| | | return fileUrl; |
| | | } |
| | | |
| | | public void setFileUrl(String fileUrl) { |
| | | this.fileUrl = fileUrl; |
| | | } |
| | | |
| | | public void setCreateDate(Date createDate) |
| | | { |
| | | this.createDate = createDate; |
| | | } |
| | |
| | | <result property="number" column="number" /> |
| | | <result property="unit" column="unit" /> |
| | | <result property="createDate" column="create_date" /> |
| | | <result property="fileUrl" column="file_url" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="outboundNumber" column="outbound_number" /> |
| | | <result property="inboundNumber" column="inbound_number" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectTubLogVo"> |
| | | select id, code, project_id, tub_name, type, outbound_date, inbound_date, opt_user, apply_user, number, unit, create_date, remark from js_tub_log |
| | | select id, code, project_id, tub_name, type, outbound_date, inbound_date, opt_user, apply_user, number, unit, create_date, file_url, remark from js_tub_log |
| | | </sql> |
| | | |
| | | <select id="selectTubLogList" parameterType="TubLog" resultMap="TubLogResult"> |
| | |
| | | <if test="number != null ">number,</if> |
| | | <if test="unit != null and unit != ''">unit,</if> |
| | | <if test="createDate != null ">create_date,</if> |
| | | <if test="fileUrl != null and fileUrl != ''">file_url,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="number != null ">#{number},</if> |
| | | <if test="unit != null and unit != ''">#{unit},</if> |
| | | <if test="createDate != null ">#{createDate},</if> |
| | | <if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="number != null ">number = #{number},</if> |
| | | <if test="unit != null and unit != ''">unit = #{unit},</if> |
| | | <if test="createDate != null ">create_date = #{createDate},</if> |
| | | <if test="fileUrl != null and fileUrl != ''">file_url = #{fileUrl},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | </trim> |
| | | where id = #{id} |
| | |
| | | field : 'unit', |
| | | title : '数据单位' |
| | | }, |
| | | { |
| | | field : 'documentPath', |
| | | title : '图片/扫描件', |
| | | formatter: function(value, row, index) { |
| | | return `<a onclick="viewTubLogFile('${row.fileUrl}')" href="#">图片/扫描件</a>`; |
| | | } |
| | | }, |
| | | { |
| | | field : 'remark', |
| | | title : '备注' |
| | |
| | | window.location.href = ctx + "common/download?fileName=" + encodeURI(filename) + "&delete=" + false; |
| | | } |
| | | |
| | | //查看证件照片 |
| | | function viewTubLogFile(path) { |
| | | var filepath = "/bjfw/"+path; |
| | | window.open(filepath) |
| | | } |
| | | </script> |
| | | </body> |
| | | |
| | |
| | | <textarea id="remark" name="remark" class="form-control"></textarea> |
| | | </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" /> |
| | |
| | | }); |
| | | |
| | | function submitHandler() { |
| | | 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)) { |
| | |
| | | |
| | | if ($.validate.form()) { |
| | | let formData = $('#form-TubLog-add').serialize(); |
| | | let data = formData + "&projectId=" + projectId + "&code=" + code; |
| | | let data = formData + "&projectId=" + projectId + "&code=" + code +"&fileUrl="+documentFile; |
| | | $.operate.save(prefix + "/add", 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({ |
| | | format: "yyyy-mm-dd", |
| | | minView: "month", |
| | |
| | | </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" /> |
| | |
| | | }); |
| | | |
| | | function submitHandler() { |
| | | 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)) { |
| | |
| | | return; |
| | | } |
| | | if ($.validate.form()) { |
| | | $.operate.save(prefix + "/edit", $('#form-TubLog-edit').serialize()); |
| | | 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({ |
| | | format: "yyyy-mm-dd", |
| | | minView: "month", |