Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionForm.js (revision 38927) @@ -0,0 +1,210 @@ +var configWin; +var formPanel; + +function cancel() { + configWin.close(); +} + +//保存 +function saveConfig(id) { + var mask = new Ext4.LoadMask({ + msg: '正在保存,请稍候...', + target: formPanel + }); + mask.show(); + + var id = top.Ext4.getCmp('id').getValue(); + var satisfaction = top.Ext4.getCmp('satisfaction').getValue(); + var status = top.Ext4.getCmp('status').getValue(); + var recordReason = top.Ext4.getCmp('recordReason').getValue(); + var reasonNotNull = top.Ext4.getCmp('reasonNotNull').getValue(); + var weight = top.Ext4.getCmp('weight').getValue(); + + var params = { + id: id, + satisfaction: satisfaction, + status: status, + recordReason: recordReason, + reasonNotNull: reasonNotNull, + weight: weight + } + + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/saveSatisfactionOption.mhtml', + params: params, + success: function (response, options) { + var result = Ext4.decode(response.responseText); + if (result.success) { + configWin.close(); + listStore.load(); + showResult('保存成功'); + } else { + showResult(result.message); + } + mask.hide(); + }, + failure: function (response, options) { + mask.hide(); + showResult('保存失败!'); + } + }); +} + +//显示窗口 +function showAddOrEditWindow(item) { + formPanel = new top.Ext4.form.Panel({ + id: 'configForm', + frame: true, + bodyPadding: '5 5 0', + width: 600, + height: 100, + layout: 'column', + fieldDefaults: { + labelAlign: 'right', + labelWidth: 100 + }, + border: false, + items: [{ + xtype: 'hidden', + id: 'id', + name: 'id' + }, { + layout: 'form', + columnWidth: .48, + border: false, + items: [{ + xtype: 'textfield', + fieldLabel: '选项名称', + id: 'satisfaction', + name: 'satisfaction', + anchor: '96%', + maxLength: 20, + allowBlank: false + }] + }, { + layout: 'form', + columnWidth: .48, + border: false, + items: [{ + xtype: 'combo', + fieldLabel: "是否启用", + id: "status", + name: "status", + displayField: 'text', + valueField: 'value', + store: new Ext4.data.SimpleStore({ + fields: ['text', 'value'], + data: [['是', 1], ['否', 0]] + }), + allowBlank: false, + editable: false, + value: 1, + triggerAction: 'all', + mode: 'local', + anchor: '96%' + }] + }, { + layout: 'form', + columnWidth: .48, + border: false, + items: [{ + xtype: 'combo', + fieldLabel: "是否填写原因", + id: "recordReason", + name: "recordReason", + displayField: 'text', + valueField: 'text', + store: new Ext4.data.SimpleStore({ + fields: ['text'], + data: [['是'], ['否']] + }), + value: '否', + allowBlank: false, + editable: false, + triggerAction: 'all', + mode: 'local', + anchor: '96%' + }] + }, { + layout: 'form', + columnWidth: .48, + border: false, + items: [{ + xtype: 'combo', + fieldLabel: "原因是否必填", + id: "reasonNotNull", + name: "reasonNotNull", + displayField: 'text', + valueField: 'text', + store: new Ext4.data.SimpleStore({ + fields: ['text'], + data: [['是'], ['否']] + }), + value: '否', + allowBlank: false, + editable: false, + triggerAction: 'all', + mode: 'local', + anchor: '96%' + }] + }, { + layout: 'form', + columnWidth: .48, + border: false, + items: [{ + xtype: 'numberfield', + fieldLabel: '权重', + allowDecimals: false, + allowNegative: false, + name: "weight", + id: "weight", + anchor: '96%', + minValue: 1, + allowBlank: false + }] + }] + }); + configWin = new top.Ext4.window.Window({ + id: 'configWin', + layout: 'column', + title: '满意度选项设置', + width: 600, + height: 160, + border: false, + plain: true, + modal: true, + items: [{ + region: 'center', + layout: 'fit', + border: false, + items: [formPanel] + }], + buttonAlign: 'center', + buttons: [{ + id: 'saveBtn', + text: '保存', + handler: function () { + if (formPanel.getForm().isValid()) { + saveConfig(); + } else { + showResult('请填写表单!'); + return false; + } + } + }, { + text: '取消', + handler: cancel + }] + }); + configWin.show(); + + if(item){ + top.Ext4.getCmp('id').setValue(item.id); + top.Ext4.getCmp('satisfaction').setValue(item.satisfaction); + top.Ext4.getCmp('status').setValue(item.status); + top.Ext4.getCmp('recordReason').setValue(item.recordReason); + top.Ext4.getCmp('reasonNotNull').setValue(item.reasonNotNull); + top.Ext4.getCmp('weight').setValue(item.weight); + } +} + Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.jsp (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.jsp (revision 38927) @@ -0,0 +1,23 @@ +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/common/taglibs.jsp"%> +<%@page import="com.forgon.disinfectsystem.common.CssdUtils"%> + + + +<%@ include file="/common/includeExtJsAndCss.jsp"%> +<%@ include file="/common/includeExtJs4_2.jsp"%> + +满意度选项管理 + + + + + + + + + \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/satisfactionsurvey/satisfactionOptionView.js (revision 38927) @@ -0,0 +1,241 @@ +var listStore; +var satisfactionOptionGrid; + +function getEditData(sequenceNum) { + var item = listStore.getAt(sequenceNum); + showAddOrEditWindow(item.data); +} + +function renderCallModifyFunction(v, p, record) { + return "" + v + ""; +} + +function deleteConfig(grid) { + var selectedRecords = grid.getSelectionModel().getSelection(); + var selectedCount = grid.getSelectionModel().getCount(); + var ids = []; + if (selectedCount < 1) { + showResult("请选择要删除的数据"); + } else { + for (var i = 0, len = selectedRecords.length; i < len; i++) { + ids[i] = selectedRecords[i].data['id']; + } + Ext4.MessageBox.confirm("请确认", "确定要删除选中的信息吗?", function (button, text) { + if ("yes" == button) { + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/deleteSatisfactionOption.mhtml', + params: { ids: ids.join(';') }, + success: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); + var success = result.success; + if (true != success) { + showResult(result.message); + return; + } else { + showResult('删除成功!'); + listStore.load(); + } + }, + failure: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); + showResult(result.message); + } + }); + } + }); + } +} + +function search(listStore) { + var searchColumns = ''; + Ext4.getCmp('searchMenu').items.each(function (item) { + if (item.checked) { + searchColumns += item.name + ';'; + } + }); + searchColumns = searchColumns.substring(0, searchColumns.length - 1); + listStore.proxy.extraParams.searchKeyWord = Ext4.getCmp('searchKeyWord').getValue(); + listStore.proxy.extraParams.searchColumns = searchColumns; + listStore.loadPage(1); + Ext4.getCmp('searchKeyWord').setValue(''); +} + +//排序 +function moveSatisfactionOption(id, type) { + top.Ext4.MessageBox.wait('请稍候……', '请等待'); + var orderType = ''; + if (type == 0) {//top + orderType = 'top'; + } else if (type == 1) {//up + orderType = 'up'; + } else if (type == 2) {//down + orderType = 'down'; + } else if (type == 3) {//bottom + orderType = 'bottom'; + } + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/sortSatisfactionOption.mhtml', + params: { + id: id, + orderType: orderType + }, + success: function (response, options) { + var result = Ext4.decode(response.responseText); + if (result.success) { + showResult('已重新排序'); + listStore.loadPage(1); + } else { + showResult(result.message); + } + hideMessageBox4(true); + }, + failure: function (response, options) { + showResult('排序失败!'); + } + }); +} + +Ext4.onReady(function () { + Ext4.QuickTips.init(); + var columns = [ + { header: "选项名称", dataIndex: 'satisfaction', width: 300, renderer: renderCallModifyFunction }, + { + header: "是否启用", dataIndex: 'status', width: 150, renderer: function (v, p, record) { + if (v == 1) { + return '是' + } else { + return '否' + } + } + }, + { header: "是否填写原因", dataIndex: 'recordReason', width: 150 }, + { header: "原因是否必填", dataIndex: 'reasonNotNull', width: 150 }, + { header: "权重比值", dataIndex: 'weight', width: 150 }, + { + header: "操作", dataIndex: 'id', width: 200, renderer: function (v, p, record) { + var id = record.data.id; + var str = "" + + "" + + "" + + ""; + return str; + } + } + ]; + var tbar = [{ + text: '添加', + iconCls: 'btn_ext_application_add', + handler: function () { + showAddOrEditWindow(); + } + }, '-', { + text: '修改', + iconCls: 'btn_ext_application_edit', + handler: function () { + var selectedRecords = satisfactionOptionGrid.getSelectionModel().getSelection(); + var selectedCount = satisfactionOptionGrid.getSelectionModel().getCount(); + if (selectedCount < 1) { + showResult("请选择需要修改的记录!"); + } else if (selectedCount > 1) { + showResult("只能修改1条记录!"); + } else { + var item = selectedRecords[0]; + showAddOrEditWindow(item.data); + } + } + }, '-', { + text: '删除', + iconCls: 'btn_ext_application_del', + handler: function () { + deleteConfig(satisfactionOptionGrid); + } + }, '->', { + width: 70, + text: '搜索列', + id: 'searchButton', + menu: { + id: 'searchMenu', + items: [{ + xtype: 'menucheckitem', + name: 'satisfaction', + checked: true, + text: '名称' + }] + }, + listeners: { + focus: function (thisButton, The, eOpts) { + Ext4.getCmp('searchKeyWord').focus(); + } + } + }, { + xtype: 'textfield', + name: 'searchKeyWord', + id: 'searchKeyWord', + enableKeyEvents: true, + listeners: { + keydown: function (thisTextfield, e, eOpts) { + if (e.keyCode == 13) { + search(listStore); + } + } + } + }, { + text: '搜索', + handler: function (thisButton) { + search(listStore); + } + }]; + + listStore = new Ext4.data.JsonStore({ + pageSize: 10, + proxy: { + type: 'ajax', + url: WWWROOT + '/disinfectSystem/baseData/satisfactionOption/satisfactionOptionController/loadSatisfactionOption.mhtml', + reader: { + root: 'data', + totalProperty: 'count' + }, + extraParams: {} + }, + fields: [ + { name: 'id' }, + { name: 'satisfaction' }, + { name: 'status' }, + { name: 'recordReason' }, + { name: 'reasonNotNull' }, + { name: 'sequenceNum' }, + { name: 'weight' } + ] + }); + + listStore.loadPage(1); + + satisfactionOptionGrid = new Ext4.grid.GridPanel({ + title: '满意度选项管理', + columns: columns, + frame: false, + autoScroll: false, + store: listStore, + tbar: tbar, + dockedItems: [{ + xtype: 'pagingtoolbar', + store: listStore, // same store GridPanel is using + dock: 'bottom', + displayInfo: true + }], + viewConfig: { + autoFill: true + }, + selModel: new Ext4.selection.CheckboxModel() + }); + + new Ext4.container.Viewport({ + layout: 'border', + items: [{ + region: 'center', + layout: 'fit', + items: [satisfactionOptionGrid] + }] + }); + +}); \ No newline at end of file