Index: ssts-web/src/main/webapp/disinfectsystem/deviceMaintenance/deviceMaintenanceCostomInsForm.js
===================================================================
diff -u -r38391 -r38667
--- ssts-web/src/main/webapp/disinfectsystem/deviceMaintenance/deviceMaintenanceCostomInsForm.js (.../deviceMaintenanceCostomInsForm.js) (revision 38391)
+++ ssts-web/src/main/webapp/disinfectsystem/deviceMaintenance/deviceMaintenanceCostomInsForm.js (.../deviceMaintenanceCostomInsForm.js) (revision 38667)
@@ -10,6 +10,195 @@
formInstanceWin.close();
}
+function downLoadAttachFile(id) {
+ location.href = WWWROOT + "/disinfectsystem/staffArchives/downloadAttachFile.jsp?id=" + id;
+}
+
+function deleteAttachFile(id) {
+ if (id != null && id != "") {
+ top.Ext.MessageBox.confirm("请确认", "是否确定要删除此附件?", function (button, text) {
+ if ("yes" == button) {
+ Ext.Ajax.request({
+ url: WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!deleteAttachFile.do',
+ params: { attachId: id },
+ success: function (response, options) {
+ showResult("删除成功");
+ fileManageStore.load();
+ grid.dwrReload();
+ },
+ failure: function (response, options) {
+ showResult("删除失败");
+ }
+ });
+ }
+ });
+ }
+}
+
+function deleteOrDownLoad(v, p, record) {
+ var html = '';
+ html += ' ';
+ html += '';
+ html += '
';
+ return html;
+}
+
+function uploadFileWindow() {
+ var id = top.Ext.getCmp('id').getValue();
+ var tempObjectID = top.Ext.getCmp('tempObjectID').getValue();
+ if (id == '') {
+ id = tempObjectID;
+ }
+ var dialog = new top.Ext.ux.UploadDialog.Dialog({
+ title: "上传附件",
+ url: WWWROOT + '/disinfectSystem/deviceMaintenanceCusInsAction!uploadAttachFile.do?attachType=' + encodeURI("设备维护信息") + '&objectId=' + id,
+ post_var_name: 'uploadFiles',//这里是自己定义的,默认的名字叫file
+ width: 450,
+ height: 300,
+ minWidth: 450,
+ minHeight: 300,
+ draggable: true,
+ resizable: true,
+ constraintoviewport: true,
+ modal: true,
+ reset_on_hide: false,
+ allow_close_on_upload: false, //关闭上传窗口是否仍然上传文件
+ upload_autostart: false
+ });
+
+
+ dialog.show();
+ dialog.on('uploadsuccess', function (dialog) {
+ showResult("文件上传成功!");
+ fileManageStore.reload();
+ dialog.hide();
+ }); //定义上传完成回调函数
+ dialog.on('uploadfailed', function (dialog) {
+ showResult("文件上传失败!");
+ fileManageStore.reload();
+ dialog.hide();
+ }); //定义上传完成回调函数
+}
+
+//BJ309YY-33:添加上传附件
+function uploadAttachFileFun() {
+ var id = top.Ext.getCmp('id').getValue();
+ var tempObjectID = top.Ext.getCmp('tempObjectID').getValue();
+ if (id == '') {
+ id = tempObjectID;
+ }
+ fileManageStore = new top.Ext.data.Store({
+ proxy: new Ext.data.HttpProxy({
+ url: WWWROOT + '/disinfectSystem/baseData/staffArchiveAction!loadStaffArchiveAttach.do?attachType=' + encodeURI("设备维护信息") + '&objectId=' + id,
+ method: 'POST'
+ }),
+ reader: new Ext.data.JsonReader({
+ totalProperty: 'totalCount',
+ root: 'data'
+ }, [
+ { name: 'id', mapping: 'id' },
+ { name: 'fileName', mapping: 'fileName' }
+ ]),
+ listeners:{
+ load:function(store,records) {
+ var html = '';
+ var attachFileIds = '';
+ for (var i = 0; i < records.length; i++) {
+ var items = records[i].data;
+ if(attachFileIds == ''){
+ attachFileIds += items.id;
+ }else {
+ attachFileIds += ';' + items.id
+ }
+ html += "
" + (i + 1) + ',' + items.fileName + "
"; + } + documentGetElementsByClassName('fileDisplayClass', top.Ext.getCmp('fileDisplay').el.dom)[0].innerHTML = html; + top.Ext.getCmp('attachFileIds').setValue(attachFileIds); + } + } + }); + fileManageStore.load(); + + var cm = new top.Ext.grid.ColumnModel([{ + name: 'id1', + hidden: true, + dataIndex: 'id1' + }, { + menuDisabled: true, + header: "附件名称", + width: 200, + dataIndex: 'fileName' + }, { + id: 'deleteAction', + menuDisabled: true, + header: '删除 | 下载', + width: 100, + renderer: deleteOrDownLoad, + dataIndex: 'button' + }]); + + var tbar = [{ + text: '上传附件', + handler: function () { + uploadFileWindow(); + } + }]; + + var attachFilePanel = new top.Ext.FormPanel({ + id: 'attachFileForm', + frame: true, + labelAlign: 'right', + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px', + autoWidth: true, + autoHeight: true, + autoScroll: true, + items: [{ + layout: 'column', + items: [{ + columnWidth: 1, + layout: 'form', + items: [ + new top.Ext.grid.GridPanel({ + id: 'attachFileGrid', + store: fileManageStore, + tbar: tbar, + cm: cm, + height: 240, + frame: false, + autoExpandColumn: 'deleteAction', + bodyStyle: 'border:1px solid #afd7af', + anchor: '100%', + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false + }) + }) + ] + }] + }], + buttons: [{ + id: 'cancleBtn', + text: '取消', + handler: function () { + formWindow.close(); + } + }] + }); + + var formWindow = new top.Ext.Window({ + id: 'fileWin', + layout: 'fit', + title: "上传设备维护附件", + width: 600, + modal: true, + autoHeight: true, + border: false, + plain: true, + items: [attachFilePanel] + }); + formWindow.show(); +} + //触发项事件,用于触发对应的监测细则显示或隐藏 function triggerItemAction(valueTriggerItemIds,action){ if(valueTriggerItemIds != null && valueTriggerItemIds != ""){ @@ -404,6 +593,49 @@ } } top.Ext.getCmp('formDefinitionItemIds').setValue(itemIds); + + if(result.data.uploadAttachFile == '是'){ + var fileHtml = '