9346167edc5305bb8acfc3ec821b421d5f2353da.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>应急制度规范文件上传</title>
  6. <!--框架必需start-->
  7. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
  8. <script type="text/javascript"
  9. src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
  10. <script type="text/javascript"
  11. src="/nwyj/scripts/qui/libs/js/framework.js"></script>
  12. <link href="/nwyj/scripts/qui/libs/css/import_basic.css"
  13. rel="stylesheet" type="text/css" />
  14. <link rel="stylesheet" type="text/css" id="skin"
  15. prePath="/nwyj/scripts/qui/" />
  16. <link rel="stylesheet" type="text/css" id="customSkin" />
  17. <!--框架必需end-->
  18. <script type="text/javascript"
  19. src="/nwyj/scripts/qui/libs/js/form/form.js"></script>
  20. <script type="text/javascript"
  21. src="/nwyj/scripts/qui/libs/js/form/validation.js"></script>
  22. <script type="text/javascript"
  23. src="/nwyj/scripts/qui/libs/js/form/validationRule.js"></script>
  24. <script type="text/javascript"
  25. src="/nwyj/scripts/qui/libs/js/popup/messager.js"></script>
  26. <!--弹窗组件start-->
  27. <script type="text/javascript"
  28. src="/nwyj/scripts/qui/libs/js/popup/drag.js"></script>
  29. <script type="text/javascript"
  30. src="/nwyj/scripts/qui/libs/js/popup/dialog.js"></script>
  31. <!--弹窗组件end-->
  32. <!--弹出式提示框start-->
  33. <script type="text/javascript"
  34. src="/nwyj/scripts/qui/libs/js/popup/messager.js"></script>
  35. <!--弹出式提示框end-->
  36. <!--数据表格start-->
  37. <script src="/nwyj/scripts/qui/libs/js/table/quiGrid.js"
  38. type="text/javascript"></script>
  39. <!--数据表格end-->
  40. <!--树组件start-->
  41. <link rel="stylesheet" type="text/css"
  42. href="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.css" />
  43. <script type="text/javascript"
  44. src="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.js"></script>
  45. <script type="text/javascript"
  46. src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
  47. <script type="text/javascript"
  48. src="/nwyj/scripts/qui/libs/js/form/listerTree.js"></script>
  49. <!--树组件end-->
  50. <!-- 日期选择框start -->
  51. <script type="text/javascript"
  52. src="/nwyj/scripts/qui/libs/js/form/datePicker/WdatePicker.js"></script>
  53. <!-- 日期选择框end -->
  54. <!-- 扩展工具js -->
  55. <script type="text/javascript" src="/nwyj/scripts/common/common.js"></script>
  56. <script type="text/javascript"
  57. src="/nwyj/scripts/jquery/plugins/jquery.extension.util.js"></script>
  58. <script type="text/javascript"
  59. src="/nwyj/scripts/freamwork/com/sinosoft/common/common.js"></script>
  60. <!-- 异步上传控件start -->
  61. <script type="text/javascript" src="/nwyj/scripts/qui/js/form/upload/fileUpload.js"></script>
  62. <script type="text/javascript" src="/nwyj/scripts/qui/js/form/upload/handlers.js"></script>
  63. <!-- 异步上传控件end -->
  64. <!--
  65. <script type="text/javascript"
  66. src="../../../../scripts/business/am/base/am-base-modify.js"></script> -->
  67. </head>
  68. <body>
  69. <div class="box1" id="formContent" style="overflow:auto;height:545px;border: 1px solid #E4E4E4;background: #F8F8F8;">
  70. <div style="height: 50px;background: #F8F8F8;" align="center">
  71. <img align="left" alt="返回" src="/nwyj/images/temp/back.png" title="返回" id="goback"/>
  72. <font style="font-weight: bold;font-size: 20px;line-height: 45px;" id="fileTitle"></font></div>
  73. <div>
  74. <form id="fillForm" mehtod="post" enctype="multipart/form-data">
  75. <table class="tableStyle" formMode="line">
  76. <tr><td colspan="4" align="right"><input value="保存" id="save" type="button"/>&nbsp;&nbsp;<input id="cancel" value="重置" type="button"/></tr>
  77. <tr style="display: none;">
  78. <td>
  79. <input type="hidden" id="fd_id230" name="FD_OBJECTID230" required="true" />
  80. <input type="hidden" name="classid" value="230" required="true" />
  81. <input type="hidden" id="FILE_STATUS_230" name="FILE_STATUS_230" required="true" />
  82. <input type="hidden" id="COLUMN_1_230" name="COLUMN_1_230" required="true" />
  83. <input type="hidden" id="COLUMN_2_230" name="COLUMN_2_230" required="true" value="0"/>
  84. <input type="hidden" id="SHANGBAO_230" name="SHANGBAO_230" required="true" value="2"/>
  85. <input type="hidden" id="FABU_230" name="FABU_230" required="true" value="4"/>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td><span class="star">*</span>标题:</td>
  90. <td><input id="FILE_TITLE_230" name="FILE_TITLE_230" type="text" class="validate[required,length[0,32]]" /></td>
  91. <td width="15%"><span class="star">*</span>分类:</td>
  92. <td width="35%"><select name="FILE_CLASSIFY_230" id="FILE_CLASSIFY_230" class="validate[required]" keepDefaultStyle="true" showList="true" prompt="请选择" ></select></td>
  93. </tr>
  94. <tr>
  95. <td width="15%"><span class="star">*</span>变更类型:</td>
  96. <td width="35%" colspan="3">
  97. <select name="CHANGE_TYPE_230" id="CHANGE_TYPE_230" class="validate[required]" keepDefaultStyle="true" showList="true" prompt="请选择" editable="false"></select>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td width="15%"><span class="star">*</span>归档人:</td>
  102. <td width="35%"><input id="PIGEONHOLE_MAN_ID_230_SHOW" name="PIGEONHOLE_MAN_ID_230" type="text" readOnly="true" />
  103. </td>
  104. <td width="15%"><span class="star">*</span>发文日期:</td>
  105. <td width="35%"><input id="FILE_ADD_DATE_230" name="FILE_ADD_DATE_230" class="date validate[required,custom[date]]" readOnly="true"
  106. type="text" readOnly="true"/>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td width="15%">变更说明:</td>
  111. <td width="35%" ><textarea id="CHANGE_DETAIL_230" name="CHANGE_DETAIL_230" rows="3" cols="5"
  112. type="textarea" ></textarea>
  113. <td width="15%">摘要:</td>
  114. <td width="35%">
  115. <textarea id="FILE_CONTENT_230" name="FILE_CONTENT_230" rows="3" cols="5" type="textarea" ></textarea>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td width="15%">电子文件:</td>
  120. <td width="35%" colspan ="3">
  121. <div id="fileDiv"></div>
  122. </td>
  123. </tr>
  124. </table>
  125. <!-- <span>电子文件:</span><input name="ELECTRONIC_FILE" id="ELECTRONIC_FILE" fileWidth="400" type="file" contenteditable="false" /> -->
  126. </form>
  127. </div>
  128. </div>
  129. <script type="text/javascript">
  130. //获取用户的Id
  131. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  132. //取得用户真实名字
  133. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  134. //部门id
  135. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  136. //部门名称
  137. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  138. //父部门id
  139. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  140. //
  141. var COLUMN_2=""
  142. //重置记录的值
  143. //var resetValue={};
  144. //标记是否归档或是新上传文件
  145. var flagPigeonhole;
  146. //附件框的值
  147. var fileName="";
  148. //标记是否有附件
  149. var flagFileName=false;
  150. //标记是否有标记id;
  151. var flagMarkId = false;
  152. function initComplete(){
  153. //绑定表单提交按钮和重置按钮
  154. $("#save").bind("click",function(){
  155. submitInfo();
  156. });
  157. $("#cancel").bind("click",function(){
  158. resetButton();
  159. });
  160. $("#goback").bind("click",function(){
  161. goBack();
  162. });
  163. var iframe = parent.document.getElementById("frmrightChild");
  164. var iframeUrl = iframe.src;
  165. if (iframeUrl.indexOf('?') > -1) {
  166. //判定修改--》更新界面显示的信息
  167. document.getElementById("fileTitle").innerHTML = "修改应急制度规范文件";
  168. var fd_id = (iframeUrl).split('?')[1];
  169. //初始化下拉框
  170. $('#FILE_CLASSIFY_230').initCanstSelect('BM_FILE_CLASSIFY');
  171. $('#CHANGE_TYPE_230').initCanstSelect('BM_CHANGETYPE');
  172. //加载附件上传容器
  173. $('#fileDiv').getUploadFileContent();
  174. var url = $.pathname() + "/ws/crud/CRUDService/getDataById/";
  175. var params = {
  176. classid : '230',
  177. objectID : fd_id
  178. };
  179. /* ajax请求 */
  180. $.ajax({
  181. url : url,
  182. type : 'post',
  183. timeout : 60000,
  184. data : params,
  185. dataType : 'json',
  186. success : function(data) {
  187. //resetValue=data;
  188. $('#fillForm').ajaxWrite({
  189. data : data
  190. });
  191. //给下拉框赋值为修改
  192. $("#CHANGE_TYPE_230").setValue("2");
  193. flagFileName = data.PIGEONHOLE_MAN_ID_230 !="" ? true:false;
  194. COLUMN_2 = data.COLUMN_2_230;
  195. },
  196. error : function(e) {
  197. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  198. }
  199. });
  200. } else {
  201. document.getElementById("fileTitle").innerHTML = "新增应急制度规范文件";
  202. //给下拉框赋值为新增
  203. $('#FILE_CLASSIFY_230').initCanstSelect('BM_FILE_CLASSIFY');
  204. $('#CHANGE_TYPE_230').initCanstSelect('BM_CHANGETYPE');
  205. //给下拉框赋值为新增
  206. $("#CHANGE_TYPE_230").setValue("1");
  207. //加载下载组件
  208. $('#fileDiv').getUploadFileContent();
  209. }
  210. }
  211. // 设定新增与修改的界面和方法 --点击保存按钮后触发事件
  212. function submitInfo() {
  213. if (document.getElementById("fileTitle").innerHTML == "修改应急制度规范文件") {
  214. editValidate();
  215. }
  216. if (document.getElementById("fileTitle").innerHTML == "新增应急制度规范文件") {
  217. addValidate();
  218. }
  219. };
  220. //新增表单验证
  221. function addValidate() {
  222. var valid = $("#fillForm").validationEngine({
  223. returnIsValid : true,
  224. });
  225. if (valid == true) {
  226. //文件有效状态和初始版本号
  227. $("#FILE_STATUS_230").val("1");
  228. $("#COLUMN_1_230").val("0");
  229. addfn();
  230. } else {
  231. top.Dialog.alert('表单填写不正确,请按要求填写!');
  232. }
  233. }
  234. //修改表单验证
  235. function editValidate() {
  236. var valid = $("#fillForm").validationEngine({
  237. returnIsValid : true,
  238. });
  239. if (valid == true) {
  240. //取上传附件容器的值,如果为空,则为单纯修改预案基本信息。如不为空,则为修订预案,重新上传预案。
  241. file = $("#fillForm input[name='fileData']").val();
  242. if(file!=null&&file!=undefined&&file!=""){
  243. //先删除原来记录。
  244. del();
  245. $("#fd_id230").val("");
  246. //再新增记录
  247. add();
  248. }else{
  249. edit();
  250. }
  251. } else {
  252. top.Dialog.alert('表单填写不正确,请按要求填写!');
  253. }
  254. }
  255. //新增
  256. function addfn(){
  257. fileToSave($('#fillForm'),null,null);
  258. }
  259. function outfileToSave($form,listGrid,msg){
  260. showProgressBar("正在提交中...");
  261. //表单异步提交处理
  262. $form.ajaxSubmit({
  263. type: 'post',
  264. url:$.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad",
  265. //表单提交成功后的回调
  266. success: function(responseText, statusText, xhr, $form){
  267. responseText = eval('('+responseText+')');
  268. top.Dialog.alert("保存成功",null,null,null,1);
  269. goBack();
  270. },
  271. error : function(){
  272. top.Dialog.alert('操作失败');
  273. }
  274. });
  275. }
  276. //修改——普通修改
  277. function edit(){
  278. var formValue = $('#fillForm').serialize();
  279. var url = $.pathname() + '/ws/crud/CRUDService/update';
  280. $.ajax({
  281. url : url,
  282. type : 'post',
  283. data : formValue,
  284. dataType : 'text',
  285. timeout : 60000,
  286. success : function(data){
  287. top.Dialog.alert("操作成功",null,null,null,1);
  288. goBack();
  289. },
  290. error : function(){
  291. top.Dialog.alert('操作失败');
  292. }
  293. });
  294. }
  295. //修改——带附件修改
  296. //删除原来信息
  297. function del(){
  298. // 删除记录
  299. $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
  300. "objectIDs" : fd_id,
  301. classid : 230
  302. }, function(result) {
  303. if (result.Msg.sucsess == true) {
  304. top.Dialog.alert("废止上一版本预案",null,null,null,1);
  305. // 刷新表格数据
  306. g.loadData();
  307. } else {
  308. top.Dialog.alert("废止失败!");
  309. }
  310. }, "json");
  311. }
  312. //新增新信息
  313. function add(containerId){
  314. file = $("#fillForm input[name='fileData']").val();
  315. var ldot = file.lastIndexOf(".");
  316. var type ="."+ file.substring(ldot + 1);
  317. var pos=file.lastIndexOf("\\");
  318. var filename = file.substring(pos+1,ldot);
  319. var valid = $(containerId).validationEngine({returnIsValid: true});
  320. if(valid == true){
  321. //取系统时间:年月日时分秒
  322. var date = new Date();
  323. var seperator1 = "";
  324. var seperator2 = "";
  325. var month = date.getMonth() + 1;
  326. var strDate = date.getDate();
  327. if (month >= 1 && month <= 9) {
  328. month = "0" + month;
  329. }
  330. if (strDate >= 0 && strDate <= 9) {
  331. strDate = "0" + strDate;
  332. }
  333. var time = date.getFullYear() + seperator1 + month + seperator1 + strDate
  334. + "" + date.getHours() + seperator2 + date.getMinutes()
  335. + seperator2 + date.getSeconds();
  336. $("#COLUMN_1_230").val(filename+time+type);
  337. //存上一个预案的主键 PLAN_BIAOZHI_214
  338. if(COLUMN_2=="0"){
  339. $("#COLUMN_2_230").val(fd_id);
  340. }else{
  341. $("#COLUMN_2_230").val(COLUMN_2);
  342. }
  343. var $form=$("#fillForm");
  344. var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
  345. fileToSaveAdd($form,null,null,url);
  346. }else{
  347. top.Dialog.alert('表单填写不正确,请按要求填写!');
  348. }
  349. }
  350. //预案修订的情况下调用新增的方法:
  351. function fileToSaveAdd($form,listGrid,msg,url){
  352. showProgressBar("正在提交中...");
  353. //表单异步提交处理
  354. $form.ajaxSubmit({
  355. type: 'post',
  356. url:url,
  357. //表单提交成功后的回调
  358. success: function(responseText, statusText, xhr, $form){
  359. responseText = eval('('+responseText+')');
  360. closeProgress();
  361. top.Dialog.alert("操作成功",null,null,null,1);//弹出提示
  362. goBack();
  363. }
  364. });
  365. }
  366. //返回按钮 返回到制度规范文件列表
  367. function goBack() {
  368. /* var iframe = parent.document.getElementById("frmright");
  369. iframe.src = "business/am/file/file-management.html"; */
  370. window.history.back();
  371. }
  372. function resetButton(){
  373. document.location.reload();
  374. /* $("#FILE_TITLE").val(resetValue.FILE_TITLE);
  375. $("#FILE_CLASSIFY").resetValue();
  376. $("#FILE_CHANGE_TYPE").resetValue();
  377. $("#CHANGE_DETAIL").val(resetValue.CHANGE_DETAIL);
  378. $("#FILE_CONTENT").val(resetValue.FILE_CONTENT);
  379. $("#FILE_ADD_DATE").val(resetValue.FILE_ADD_DATE); */
  380. }
  381. </script>
  382. </body>
  383. </html>