Browse Source

校长信箱详情页

zhuth 6 years ago
parent
commit
2cae8ceea8

+ 93 - 0
frontend/pc-web/app/view/Interaction/mailbox/Detail.js

@@ -0,0 +1,93 @@
+Ext.define('school.view.interaction.maibox.Detail', {
+    extend: 'school.view.core.form.FormPanel',
+    xtype: 'interaction-maibox-Detail',
+
+    controller: 'interaction-maibox-Detail',
+    viewModel: 'interaction-maibox-Detail',
+
+    _title: '校长信箱',
+    _idField: 'mailbox_id',
+    _codeField: null,
+    // _readUrl: 'http://10.1.80.47:9520/api/school/principal/read',
+    _readUrl: '/api/school/principal/read',
+    initId: 0,
+
+    initComponent: function () {
+        Ext.apply(this, {
+            defaultItems: [{
+                xtype: 'hidden',
+                name: 'mailbox_id',
+                fieldLabel: 'id'
+            }, {
+                xtype: "textfield",
+                name: "mailbox_title",
+                fieldLabel: "标题",
+                columnWidth: 0.5,
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'mb_creatorname',
+                fieldLabel: '提出人',
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'mb_grade',
+                fieldLabel: '年级',
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'mb_class',
+                fieldLabel: '班级',
+                readOnly: true
+            }, {
+                xtype: 'datefield',
+                name: 'create_date',
+                fieldLabel: '提出时间',
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'mailbox_status_text',
+                fieldLabel: '回复状态',
+                readOnly: true,
+            }, {
+                xtype: 'textfield',
+                name: 'mb_ignore_text',
+                fieldLabel: '忽略状态',
+                readOnly: true,
+            }, {
+                xtype: "textareafield",
+                name: "mailbox_context",
+                fieldLabel: "内容",
+                columnWidth: 1,
+                readOnly: true
+            }, {
+                xtype: 'textareafield',
+                name: 'mb_reply',
+                fieldLabel: '回复内容',
+                columnWidth: 1
+            }],
+            toolBtns: [{
+                xtype: 'button',
+                text: '回复',
+                handler: 'onReply'
+            }, {
+                xtype: 'button',
+                text: '忽略',
+                handler: 'onIgnore',
+                hidden: true,
+                bind: {
+                    hidden: '{!!mb_ignore}'
+                }
+            }, {
+                xtype: 'button',
+                text: '取消忽略',
+                handler: 'onUnIgnore',
+                hidden: true,
+                bind: {
+                    hidden: '{!mb_ignore}'
+                }
+            }]
+        });
+        this.callParent();
+    }
+});

+ 90 - 0
frontend/pc-web/app/view/Interaction/mailbox/DetailController.js

@@ -0,0 +1,90 @@
+Ext.define('school.view.interaction.mailbox.DetailController', {
+    extend: 'school.view.core.form.FormPanelController',
+    alias: 'controller.interaction-maibox-Detail',
+
+    onReply: function () {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        data = viewModel.data,
+        params, headers;
+        
+        params = {
+            id: data.mailbox_id,
+            msg: data.mb_reply
+        };
+
+        headers = {
+            "Content-Type": 'application/x-www-form-urlencoded; charset=UTF-8'
+        }
+
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.47:9520/api/school/principal/reply',
+            url: '/api/school/principal/reply',
+            method: 'POST',
+            params: params,
+            headers: headers
+        }).then(function (res) {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('回复成功');
+            me.refresh();
+        }).catch(function (e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('回复失败: ' + e.message);
+        });
+    },
+
+    onIgnore: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.get('mailbox_id');
+
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.47:9520/api/school/principal/batchIgnore',
+            url: '/api/school/principal/batchIgnore',
+            method: 'POST',
+            params: JSON.stringify({
+                baseDTOs: [{
+                    id: id
+                }]
+            })
+        }).then(function(res) {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('设置忽略成功');
+            me.refresh();
+        }).catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('设置忽略失败: ' + e.message);
+        });
+    },
+
+    onUnIgnore: function() {
+
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.get('mailbox_id');
+
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.47:9520/api/school/principal/batchUnIgnore',
+            url: '/api/school/principal/batchUnIgnore',
+            method: 'POST',
+            params: JSON.stringify({
+                baseDTOs: [{
+                    id: id
+                }]
+            })
+        }).then(function(res) {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('取消忽略成功');
+            me.refresh();
+        }).catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('取消忽略失败: ' + e.message);
+        });
+    },
+});

+ 26 - 0
frontend/pc-web/app/view/Interaction/mailbox/DetailModel.js

@@ -0,0 +1,26 @@
+Ext.define('school.view.interaction.mailbox.DetailModel', {
+    extend: 'school.view.core.form.FormPanelModel',
+    alias: 'viewmodel.interaction-maibox-Detail',
+
+    data: {
+        showAddBtn: false,
+        showSaveBtn: false,
+        showDeleteBtn: false
+    },
+
+    formulas: {
+        mb_ignore_text: {
+            bind: '{mb_ignore}',
+            get: function(v) {
+                return v == 1 ? '已忽略' : '正常'
+            }
+        },
+        mailbox_status_text: {
+            bind: '{mailbox_status}',
+            get: function(v) {
+                return v == 3 ? '已回复' : '未回复'
+            }
+        }
+    }
+
+});

+ 4 - 16
frontend/pc-web/app/view/Interaction/mailbox/List.js

@@ -91,7 +91,9 @@ Ext.define('school.view.interaction.mailbox.List', {
 
             gridConfig: {
                 idField: 'mailbox_id',
-                codeField: null,
+                codeField: 'mailbox_title',
+                addTitle: '校长信箱',
+                addXtype: 'interaction-maibox-Detail',
                 statusCodeField: null,
                 dataUrl: me.dataUrl,
                 caller: null,
@@ -105,7 +107,7 @@ Ext.define('school.view.interaction.mailbox.List', {
                     ignoreRightMouseSelection: false
                 },
                 hiddenTools: false,
-                disableDetail: true,
+                disableDetail: false,
                 toolBtns: [{
                     xtype: 'button',
                     text: '忽略',
@@ -138,20 +140,6 @@ Ext.define('school.view.interaction.mailbox.List', {
                     renderer: function(v, m, r) {
                         return v == 3 ? '已回复' : '未回复';
                     }
-                }, {
-                    xtype:'actioncolumn',
-                    width:70,
-                    dataIndex:'actioncolumn',
-                    text:'回复',
-                    align: 'center',
-                    items: [{
-                        tooltip: '回复',
-                        iconCls: 'x-ss ss-reply fa-fw',
-                        scope:this
-                    }],
-                    listeners: {
-                        click: 'onActionClick'
-                    }
                 }, {
                     text: '回复信息',
                     dataIndex: 'mb_reply',

+ 2 - 2
frontend/pc-web/app/view/Interaction/mailbox/ListController.js

@@ -81,11 +81,11 @@ Ext.define('school.view.interaction.mailbox.ListController', {
                             }).then(function (res) {
                                 view.setLoading(false);
                                 win.close();
-                                school.util.BaseUtil.showSuccessToast('添加成功');
+                                school.util.BaseUtil.showSuccessToast('回复成功');
                                 view.refresh();
                             }).catch(function (e) {
                                 view.setLoading(false);
-                                school.util.BaseUtil.showErrorToast('添加失败: ' + e.message);
+                                school.util.BaseUtil.showErrorToast('回复失败: ' + e.message);
                             });
                         }
                     }]