123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>应急制度规范文件上传</title>
- <!--框架必需start-->
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/framework.js"></script>
- <link href="/nwyj/scripts/qui/libs/css/import_basic.css"
- rel="stylesheet" type="text/css" />
- <link rel="stylesheet" type="text/css" id="skin"
- prePath="/nwyj/scripts/qui/" />
- <link rel="stylesheet" type="text/css" id="customSkin" />
- <!--框架必需end-->
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/form.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/validation.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/validationRule.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/popup/messager.js"></script>
- <!--弹窗组件start-->
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/popup/drag.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/popup/dialog.js"></script>
- <!--弹窗组件end-->
- <!--弹出式提示框start-->
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/popup/messager.js"></script>
- <!--弹出式提示框end-->
- <!--数据表格start-->
- <script src="/nwyj/scripts/qui/libs/js/table/quiGrid.js"
- type="text/javascript"></script>
- <!--数据表格end-->
- <!--树组件start-->
- <link rel="stylesheet" type="text/css"
- href="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.css" />
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/listerTree.js"></script>
- <!--树组件end-->
- <!-- 日期选择框start -->
- <script type="text/javascript"
- src="/nwyj/scripts/qui/libs/js/form/datePicker/WdatePicker.js"></script>
- <!-- 日期选择框end -->
- <!-- 扩展工具js -->
- <script type="text/javascript" src="/nwyj/scripts/common/common.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/jquery/plugins/jquery.extension.util.js"></script>
- <script type="text/javascript"
- src="/nwyj/scripts/freamwork/com/sinosoft/common/common.js"></script>
-
- <!-- 异步上传控件start -->
- <script type="text/javascript" src="/nwyj/scripts/qui/js/form/upload/fileUpload.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/js/form/upload/handlers.js"></script>
- <!-- 异步上传控件end -->
-
- <!--
- <script type="text/javascript"
- src="../../../../scripts/business/am/base/am-base-modify.js"></script> -->
- </head>
- <body>
- <div class="box1" id="formContent" style="overflow:auto;height:545px;border: 1px solid #E4E4E4;background: #F8F8F8;">
- <div style="height: 50px;background: #F8F8F8;" align="center">
- <img align="left" alt="返回" src="/nwyj/images/temp/back.png" title="返回" id="goback"/>
- <font style="font-weight: bold;font-size: 20px;line-height: 45px;" id="fileTitle"></font></div>
- <div>
- <form id="fillForm" mehtod="post" enctype="multipart/form-data">
- <table class="tableStyle" formMode="line">
- <tr><td colspan="4" align="right"><input value="保存" id="save" type="button"/> <input id="cancel" value="重置" type="button"/></tr>
- <tr style="display: none;">
- <td>
- <input type="hidden" id="fd_id230" name="FD_OBJECTID230" required="true" />
- <input type="hidden" name="classid" value="230" required="true" />
- <input type="hidden" id="FILE_STATUS_230" name="FILE_STATUS_230" required="true" />
- <input type="hidden" id="COLUMN_1_230" name="COLUMN_1_230" required="true" />
- <input type="hidden" id="COLUMN_2_230" name="COLUMN_2_230" required="true" value="0"/>
- <input type="hidden" id="SHANGBAO_230" name="SHANGBAO_230" required="true" value="2"/>
- <input type="hidden" id="FABU_230" name="FABU_230" required="true" value="4"/>
- </td>
- </tr>
- <tr>
- <td><span class="star">*</span>标题:</td>
- <td><input id="FILE_TITLE_230" name="FILE_TITLE_230" type="text" class="validate[required,length[0,32]]" /></td>
- <td width="15%"><span class="star">*</span>分类:</td>
- <td width="35%"><select name="FILE_CLASSIFY_230" id="FILE_CLASSIFY_230" class="validate[required]" keepDefaultStyle="true" showList="true" prompt="请选择" ></select></td>
- </tr>
- <tr>
- <td width="15%"><span class="star">*</span>变更类型:</td>
- <td width="35%" colspan="3">
- <select name="CHANGE_TYPE_230" id="CHANGE_TYPE_230" class="validate[required]" keepDefaultStyle="true" showList="true" prompt="请选择" editable="false"></select>
- </td>
- </tr>
- <tr>
- <td width="15%"><span class="star">*</span>归档人:</td>
- <td width="35%"><input id="PIGEONHOLE_MAN_ID_230_SHOW" name="PIGEONHOLE_MAN_ID_230" type="text" readOnly="true" />
- </td>
- <td width="15%"><span class="star">*</span>发文日期:</td>
- <td width="35%"><input id="FILE_ADD_DATE_230" name="FILE_ADD_DATE_230" class="date validate[required,custom[date]]" readOnly="true"
- type="text" readOnly="true"/>
- </td>
- </tr>
- <tr>
- <td width="15%">变更说明:</td>
- <td width="35%" ><textarea id="CHANGE_DETAIL_230" name="CHANGE_DETAIL_230" rows="3" cols="5"
- type="textarea" ></textarea>
- <td width="15%">摘要:</td>
- <td width="35%">
- <textarea id="FILE_CONTENT_230" name="FILE_CONTENT_230" rows="3" cols="5" type="textarea" ></textarea>
- </td>
- </tr>
- <tr>
-
- <td width="15%">电子文件:</td>
- <td width="35%" colspan ="3">
- <div id="fileDiv"></div>
- </td>
- </tr>
- </table>
-
- <!-- <span>电子文件:</span><input name="ELECTRONIC_FILE" id="ELECTRONIC_FILE" fileWidth="400" type="file" contenteditable="false" /> -->
- </form>
- </div>
- </div>
- <script type="text/javascript">
- //获取用户的Id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- //取得用户真实名字
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //部门id
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- //父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- //
- var COLUMN_2=""
-
- //重置记录的值
- //var resetValue={};
- //标记是否归档或是新上传文件
- var flagPigeonhole;
- //附件框的值
- var fileName="";
- //标记是否有附件
- var flagFileName=false;
- //标记是否有标记id;
- var flagMarkId = false;
- function initComplete(){
-
- //绑定表单提交按钮和重置按钮
- $("#save").bind("click",function(){
- submitInfo();
- });
-
- $("#cancel").bind("click",function(){
- resetButton();
- });
-
- $("#goback").bind("click",function(){
- goBack();
- });
-
- var iframe = parent.document.getElementById("frmrightChild");
- var iframeUrl = iframe.src;
- if (iframeUrl.indexOf('?') > -1) {
- //判定修改--》更新界面显示的信息
- document.getElementById("fileTitle").innerHTML = "修改应急制度规范文件";
- var fd_id = (iframeUrl).split('?')[1];
- //初始化下拉框
- $('#FILE_CLASSIFY_230').initCanstSelect('BM_FILE_CLASSIFY');
- $('#CHANGE_TYPE_230').initCanstSelect('BM_CHANGETYPE');
- //加载附件上传容器
- $('#fileDiv').getUploadFileContent();
-
- var url = $.pathname() + "/ws/crud/CRUDService/getDataById/";
- var params = {
- classid : '230',
- objectID : fd_id
- };
- /* ajax请求 */
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data) {
- //resetValue=data;
-
- $('#fillForm').ajaxWrite({
- data : data
- });
-
- //给下拉框赋值为修改
- $("#CHANGE_TYPE_230").setValue("2");
-
- flagFileName = data.PIGEONHOLE_MAN_ID_230 !="" ? true:false;
-
- COLUMN_2 = data.COLUMN_2_230;
-
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- } else {
- document.getElementById("fileTitle").innerHTML = "新增应急制度规范文件";
- //给下拉框赋值为新增
- $('#FILE_CLASSIFY_230').initCanstSelect('BM_FILE_CLASSIFY');
- $('#CHANGE_TYPE_230').initCanstSelect('BM_CHANGETYPE');
- //给下拉框赋值为新增
- $("#CHANGE_TYPE_230").setValue("1");
- //加载下载组件
- $('#fileDiv').getUploadFileContent();
- }
- }
- // 设定新增与修改的界面和方法 --点击保存按钮后触发事件
- function submitInfo() {
- if (document.getElementById("fileTitle").innerHTML == "修改应急制度规范文件") {
- editValidate();
- }
- if (document.getElementById("fileTitle").innerHTML == "新增应急制度规范文件") {
- addValidate();
- }
- };
- //新增表单验证
- function addValidate() {
- var valid = $("#fillForm").validationEngine({
- returnIsValid : true,
- });
- if (valid == true) {
- //文件有效状态和初始版本号
- $("#FILE_STATUS_230").val("1");
- $("#COLUMN_1_230").val("0");
- addfn();
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //修改表单验证
- function editValidate() {
- var valid = $("#fillForm").validationEngine({
- returnIsValid : true,
- });
- if (valid == true) {
- //取上传附件容器的值,如果为空,则为单纯修改预案基本信息。如不为空,则为修订预案,重新上传预案。
- file = $("#fillForm input[name='fileData']").val();
- if(file!=null&&file!=undefined&&file!=""){
- //先删除原来记录。
- del();
- $("#fd_id230").val("");
- //再新增记录
- add();
-
- }else{
-
- edit();
- }
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //新增
- function addfn(){
- fileToSave($('#fillForm'),null,null);
- }
- function outfileToSave($form,listGrid,msg){
- showProgressBar("正在提交中...");
- //表单异步提交处理
- $form.ajaxSubmit({
- type: 'post',
- url:$.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad",
- //表单提交成功后的回调
- success: function(responseText, statusText, xhr, $form){
- responseText = eval('('+responseText+')');
- top.Dialog.alert("保存成功",null,null,null,1);
- goBack();
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- //修改——普通修改
- function edit(){
- var formValue = $('#fillForm').serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/update';
-
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- top.Dialog.alert("操作成功",null,null,null,1);
- goBack();
- },
- error : function(){
- top.Dialog.alert('操作失败');
- }
- });
- }
- //修改——带附件修改
- //删除原来信息
- function del(){
- // 删除记录
- $.post($.pathname() +"/ws/crud/CRUDService/delete/", {
- "objectIDs" : fd_id,
- classid : 230
- }, function(result) {
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("废止上一版本预案",null,null,null,1);
- // 刷新表格数据
- g.loadData();
- } else {
- top.Dialog.alert("废止失败!");
- }
- }, "json");
- }
-
- //新增新信息
- function add(containerId){
-
- file = $("#fillForm input[name='fileData']").val();
- var ldot = file.lastIndexOf(".");
- var type ="."+ file.substring(ldot + 1);
- var pos=file.lastIndexOf("\\");
- var filename = file.substring(pos+1,ldot);
-
-
- var valid = $(containerId).validationEngine({returnIsValid: true});
- if(valid == true){
- //取系统时间:年月日时分秒
- var date = new Date();
- var seperator1 = "";
- var seperator2 = "";
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var time = date.getFullYear() + seperator1 + month + seperator1 + strDate
- + "" + date.getHours() + seperator2 + date.getMinutes()
- + seperator2 + date.getSeconds();
- $("#COLUMN_1_230").val(filename+time+type);
- //存上一个预案的主键 PLAN_BIAOZHI_214
- if(COLUMN_2=="0"){
- $("#COLUMN_2_230").val(fd_id);
- }else{
- $("#COLUMN_2_230").val(COLUMN_2);
- }
-
- var $form=$("#fillForm");
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
- fileToSaveAdd($form,null,null,url);
- }else{
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //预案修订的情况下调用新增的方法:
- function fileToSaveAdd($form,listGrid,msg,url){
- showProgressBar("正在提交中...");
- //表单异步提交处理
- $form.ajaxSubmit({
- type: 'post',
- url:url,
- //表单提交成功后的回调
- success: function(responseText, statusText, xhr, $form){
- responseText = eval('('+responseText+')');
- closeProgress();
- top.Dialog.alert("操作成功",null,null,null,1);//弹出提示
- goBack();
- }
- });
- }
- //返回按钮 返回到制度规范文件列表
- function goBack() {
- /* var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/file/file-management.html"; */
- window.history.back();
- }
- function resetButton(){
- document.location.reload();
- /* $("#FILE_TITLE").val(resetValue.FILE_TITLE);
- $("#FILE_CLASSIFY").resetValue();
- $("#FILE_CHANGE_TYPE").resetValue();
- $("#CHANGE_DETAIL").val(resetValue.CHANGE_DETAIL);
- $("#FILE_CONTENT").val(resetValue.FILE_CONTENT);
- $("#FILE_ADD_DATE").val(resetValue.FILE_ADD_DATE); */
- }
- </script>
- </body>
- </html>
|