人人人妻人人人妻人人人,99精品国产综合久久久久五月天 ,欧美白人最猛性XXXXX,日韩AV无码免费播放

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁(yè)      樂(lè)道系統(tǒng)FAQ      基于yaf框架和uploadify插件,做的一個(gè)導(dǎo)入excel文件,查看并保存數(shù)據(jù)的功能

基于yaf框架和uploadify插件,做的一個(gè)導(dǎo)入excel文件,查看并保存數(shù)據(jù)的功能

標(biāo)簽: 發(fā)布日期:2017-01-24 00:00:00 256

思路:

1.首先,頁(yè)面前端,上傳附件,提交給后臺(tái),并帶一個(gè)隨機(jī)性的參數(shù)(可以用時(shí)間戳);

2.后端接收附件,做一系列的邏輯處理,無(wú)誤后,將對(duì)應(yīng)的文件存儲(chǔ)在上傳的目錄下;

3.然后前端,上傳附件成功后,進(jìn)行請(qǐng)求后端,讀取數(shù)據(jù),后端接口對(duì)應(yīng)將附件數(shù)據(jù)讀取出來(lái),前端進(jìn)行顯示(ajax請(qǐng)求);

4.前端展示數(shù)據(jù),用戶對(duì)數(shù)據(jù)檢測(cè)無(wú)誤,點(diǎn)擊保存(ajax請(qǐng)求后端保存代碼的接口),當(dāng)然也可以有選擇性的選擇某些數(shù)據(jù)記錄進(jìn)行保存,樓主這里做的是全部保存(后端處理接口,自動(dòng)過(guò)濾重復(fù)數(shù)據(jù));

5.拿到對(duì)應(yīng)的所需有用數(shù)據(jù)即可, 對(duì)應(yīng)的excel表格,因?yàn)樾枰@取到人員排期數(shù)據(jù),所以樓主是通過(guò)判斷單元格的背景色來(lái)識(shí)別

代碼如下:(關(guān)鍵代碼)

前端 對(duì)應(yīng)html:

<!--導(dǎo)入數(shù)據(jù)操作層-->
<div id="import" class="modal fade bs-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog modal-lg">
 <div class="modal-content">
  <div class="modal-header bg-primary">
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  <h4 class="modal-title">文件導(dǎo)入</h4>
  </div>
  <div class="modal-body">
  <div style="text-align:right;padding:5px">
   <a href="/public/uploadFile/人員資源動(dòng)態(tài)匹配表-模板.xlsx" onclick="javascript:;">
   <img alt="人員資源動(dòng)態(tài)匹配表-模板" src="/public/images/excel.jpg" />
   <span style="font-size:larger;font-weight:200;color:red">人員資源動(dòng)態(tài)匹配表-模板.xlsx</span>
   </a>
  </div>
  <hr/>
  <form id="ffImport" method="post">
   <div title="Excel導(dǎo)入操作" style="padding: 5px" data-options="iconCls:'icon-key'">
   <input class="easyui-validatebox" type="hidden" id="AttachGUID" name="AttachGUID" /> 
   <input id="file_upload" name="file_upload" type="file" multiple="multiple">   
   <a href="javascript:;" class="btn btn-primary" id="btnUpload" onclick="javascript: $('#file_upload').uploadify('upload', '*')">上傳</a>
   <a href="javascript:;" class="btn btn-default" id="btnCancelUpload" onclick="javascript: $('#file_upload').uploadify('cancel', '*')">取消</a>
   <div id="fileQueue" class="fileQueue"></div>
   <br />   
   <hr style="width:98%" />   
   <div id="div_files"></div>
   <br />   
   </div>
  </form>
  <!--數(shù)據(jù)顯示表格-->
  <table id="gridImport" class="table table-striped table-bordered table-hover" cellpadding="0" cellspacing="0" border="0" class="display" width="100%">
   <thead id="gridImport_head">
   <tr>
    <th>項(xiàng)目名稱</th>
    <th>項(xiàng)目編號(hào)</th>
    <th>功 能</th>
    <th>人 員</th>
    <th>日 期</th>
   </tr>
   </thead>
   <tbody id="gridImport_body"></tbody>
  </table>
  </div>
  <div class="modal-footer">
  <button type="button" class="btn btn-default" data-dismiss="modal" id="close_window">關(guān)閉</button>
  <button type="button" class="btn btn-primary" onclick="javascript:SaveImport();">保存</button>
  </div>
 </div>
 </div>
</div>