Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

rainco 7 years ago
parent
commit
702ece48c4

+ 3 - 0
frontend/saas-web/app.json

@@ -280,6 +280,7 @@
     "builds": {
         "dev": {
             "server": {
+                "mail":"https://test-mall.uuzcc.cn",
                 "accountCenter":"https://saas-dev.usoftchina.com:5443",
                 "accountEnterprise":"https://saas-dev.usoftchina.com:5443/#/enterprise",
                 "basePath": {
@@ -292,6 +293,7 @@
         },
         "test": {
             "server": {
+                "mail":"https://test-mall.uuzcc.cn",
                 "accountCenter": "https://saas-test.usoftchina.com:5443",
                 "accountEnterprise": "https://saas-test.usoftchina.com:5443/#/enterprise",
                 "basePath": {
@@ -304,6 +306,7 @@
         },
         "prod": {
             "server": {
+                "mail":"https://mall.usoftchina.com",
                 "accountCenter":"https://saas.usoftchina.com",
                 "accountEnterprise":"https://saas.usoftchina.com/#/enterprise",
                 "basePath": "https://saas-api.usoftchina.com",

+ 1 - 1
frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js

@@ -132,7 +132,7 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
         f.blur(f);
         //判断dbfindtrigger归属
         f.judge(f); //form
-        var panel = f.up('core-tab-panel'),
+        var panel = f.up('core-tab-panel') || Ext.getCmp('mainView'),
             panelEl;
         if (!f.column && f.ownerCt.ownerCt.id.indexOf('window-') > -1 && f.ownerCt.ownerCt.id.indexOf('document-') <0) {
             panelEl = f.ownerCt.ownerCt.getEl()

+ 95 - 0
frontend/saas-web/app/view/document/currencys/AddWindow.js

@@ -0,0 +1,95 @@
+/**
+ * Created by zhouy on 2018/10/18.
+ */
+Ext.define('saas.view.document.currencys.AddWindow', {
+    extend: 'saas.view.document.kind.ChildForm',
+    xtype: 'document-currencys-addwindow',
+    dataKind:'currencysadd',//类型标识
+    height: 325,
+    belong:{
+        columns: [{
+            text: '币别',
+            dataIndex: 'cr_name',
+            flex: 1
+        },{
+            text: '默认汇率',
+            dataIndex: 'cr_rate',
+            flex: 1
+        }],
+        keyField:'id',
+        reqUrl:'/api/document/currency/save'
+    },
+    etc:{
+        currencysadd:{
+            items:[{
+                xtype:'hidden',
+                name:'id'
+            },{
+                xtype:'textfield',
+                name:'cr_name',
+                allowBlank:false,
+                fieldLabel:'币别',
+                maxLength: 20
+            },{
+                xtype:'numberfield',
+                hideTrigger:true,
+                name:'cr_rate',
+                allowBlank:false,
+                fieldLabel:'汇率',
+                maxLength: 20,
+                defaultValue: 1,
+                decimalPrecision: 6,
+                vtype: 'positiveNumber'
+            }]
+        }
+    },
+    // onSave:function(){
+    //     var me = this;
+    //     var belong = this.belong;
+    //     me.setLoading(true);
+    //     var form=this.down('form');
+    //     var params = {};
+    //     var names = belong.columns.map(column => column.dataIndex);
+
+    //     Ext.Array.each(names,function(name) {
+    //         if(name){
+    //             var dataField = form.down('[name='+name+']');
+    //             if(dataField&&dataField.value){
+    //                 params[name] = dataField.value;
+    //             }
+    //             if(dataField.name=='mobile'){
+    //                 params['hasRegister'] = dataField.hasRegister;
+    //             }
+    //         }
+    //     });
+
+    //     //更改参数
+    //     var o = '';
+    //     var dataField = form.down('[name=roleIds]');
+    //     Ext.Array.each(dataField.value,function(item) {
+    //         o+=item+','
+    //     });
+    //     o = o.substring(0,o.length-1);
+    //     params['username'] = params['mobile'];
+    //     params['type'] = 1;
+    //     params['roleIds'] = o;
+    //     //保存接口
+    //     saas.util.BaseUtil.request({
+    //         url: belong.reqUrl,
+    //         params: JSON.stringify(params),
+    //         method: 'POST'
+    //     })
+    //     .then(function(localJson) {
+    //         me.setLoading(false);
+    //         if(localJson.success){
+    //             form.ownerCt._parent.store.load();
+    //             saas.util.BaseUtil.showSuccessToast('保存成功');
+    //             form.ownerCt.close();
+    //         }
+    //     })
+    //     .catch(function(e) {
+    //         me.setLoading(false);
+    //         saas.util.BaseUtil.showErrorToast('保存失败: ' + e.message);
+    //     });
+    // }
+});

+ 20 - 1
frontend/saas-web/app/view/document/currencys/DataList.js

@@ -10,7 +10,6 @@ Ext.define('saas.view.document.currencys.DataList', {
     windowType:'document-currencys-window',
     tbar: ['->',{
         xtype:'button',
-        hidden:true,
         text:'新增',
         listeners: {
             click: 'onAdd'
@@ -24,6 +23,26 @@ Ext.define('saas.view.document.currencys.DataList', {
     }],
     etc:{
         currencys:{
+            columns: [{
+                text: '币别',
+                dataIndex: 'cr_name',
+                flex: 1,
+                renderer:function(a,b,c){
+                    if(c.get('cr_standard')==1){
+                        return a + '(本位币)'
+                    }
+                    return a;
+                }
+            },{
+                text: '默认汇率',
+                dataIndex: 'cr_rate',
+                flex: 1
+            }],
+            keyField:'id',
+            reqUrl:'/api/document/currency/save',
+            delUrl:'/api/document/currency/delete'
+        },
+        currencysadd:{
             columns: [{
                 text: '币别',
                 dataIndex: 'cr_name',

+ 2 - 1
frontend/saas-web/app/view/document/currencys/DataListModel.js

@@ -9,7 +9,8 @@ Ext.define('saas.view.document.currencys.DataListModel', {
             fields:[
                 {name: 'id', type: 'int'},
                 {name: 'cr_rate',  type: 'float'},
-                {name: 'cr_name',  type: 'string'}
+                {name: 'cr_name',  type: 'string'},
+                {name: 'cr_standard',  type: 'int'},
             ],
             proxy: {
                 type: 'ajax',

+ 14 - 1
frontend/saas-web/app/view/document/currencys/DatalistController.js

@@ -21,5 +21,18 @@ Ext.define('saas.view.document.currencys.DatalistController', {
             }]);
         }
         return columns;
-    }
+    },
+    onAdd:function(b){
+        var form = this.view;
+        this.dialog = form.add({
+            xtype: 'document-currencys-addwindow',
+            bind: {
+                title: '新增币别'
+            },
+            _parent:form,
+            record:null,
+            session: true
+        });
+        this.dialog.show();
+    },
 });

+ 4 - 1
frontend/saas-web/app/view/document/currencys/Window.js

@@ -28,7 +28,10 @@ Ext.define('saas.view.document.currencys.Window', {
                 name:'cr_rate',
                 allowBlank:false,
                 fieldLabel:'汇率',
-                maxLength: 20
+                maxLength: 20,
+                defaultValue: 1,
+                decimalPrecision: 6,
+                vtype: 'positiveNumber'
             }]
         }
     }

+ 4 - 0
frontend/saas-web/app/view/home/Home.js

@@ -76,6 +76,7 @@ Ext.define('saas.view.home.Home', {
     }],
 
     initComponent: function() {
+        var me = this;
         this.lastTime = Ext.Date.now();
         //判断当前是否未完成新手导航
         saas.util.BaseUtil.request({
@@ -84,6 +85,9 @@ Ext.define('saas.view.home.Home', {
             if(!res.data.begin){
                 saas.util.BaseUtil.openTab('sys-guide-formpanel', '新手导航', 'sys-guide-formpanel')
             }
+            if(!res.data.currency){
+                me.getController().setDefaultCurrency();
+            }
         }).catch(function(e) {
             saas.util.BaseUtil.showErrorToast(e.message);
         })

+ 84 - 0
frontend/saas-web/app/view/home/HomeController.js

@@ -6,4 +6,88 @@ Ext.define('saas.view.home.HomeController', {
         return v + '%';
     },
     
+    setDefaultCurrency:function(){
+        var win = Ext.create('Ext.window.Window', {  
+            id:'x-defaultcurrency',
+            cls:'x-window-dbfind', 
+            height: 100,
+            width: 450,
+            modal:true,
+            title: '本位币设置',
+            bodyPadding: 10,
+            constrain: true,
+            closable: false,
+            layout: {
+                type: 'vbox',
+                align: 'center'
+            },
+            items:[{
+                xtype:'panel',
+                layout:'hbox',
+                items:[{
+                    belong:'form',
+                    dbfinds:[{
+                        from:'cr_name',to:'defaultCurrency'
+                    }],
+                    margin:'0 10 0 0',
+                    labelWidth:60,
+                    allowBlank:false,
+                    xtype : "currencyDbfindTrigger", 
+                    name : "defaultCurrency",
+                    fieldLabel : "本位币", 
+                    beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
+                    onAddClick: function() {
+                        var me=this;
+                        var tab = me.ownerCt;
+                        // this.isEdit = !!record;
+                        this.dialog = tab.add({
+                            xtype: 'document-currencys-addwindow',
+                            _parent:this,
+                            session: true
+                        });
+                        this.dialog.show();
+                    }
+                },{
+                    margin:'0 0 0 5',
+                    xtype:'button',
+                    text:'确认',
+                    handler:function(b){
+                        var v = b.ownerCt.down('[name=defaultCurrency]').value;
+                        if(!v||v==''||v==null){
+                            saas.util.BaseUtil.showErrorToast('请选择币别');
+                            return;
+                        }
+                        saas.util.BaseUtil.showConfirm('提示', '确定使用选择的币别: '+v+' 作为本位币吗(无法修改)?')
+                        .then(function(yes) {
+                            if(yes == 'yes') {
+                                var formData = [];
+                                formData.push({
+                                    code:'defaultCurrency',
+                                    data:v
+                                })
+                                saas.util.BaseUtil.request({
+                                    url: '/api/commons/configs/update',
+                                    params: JSON.stringify(formData),
+                                    method: 'POST',
+                                })
+                                .then(function(localJson) {
+                                    if(localJson.success){
+                                        saas.util.BaseUtil.showSuccessToast('本位币设置成功');
+                                        Ext.getCmp('x-defaultcurrency').close();
+                                    }
+                                })
+                                .catch(function(res) {
+                                    console.error(res);
+                                    saas.util.BaseUtil.showErrorToast('本位币设置失败: ' + res.message);
+                                });
+                            }else {
+                                throw new Error();
+                            }
+                        })
+                    }
+                }]
+            }]
+        });
+        win.show();
+    }
 });

+ 1 - 1
frontend/saas-web/app/view/money/othreceipts/FormPanel.js

@@ -71,7 +71,7 @@ Ext.define('saas.view.money.othreceipts.FormPanel', {
                 xtype: "numberfield",
                 name: "or_rate",
                 fieldLabel: "汇率",
-                defaultValue: '1',
+                defaultValue: 1,
                 decimalPrecision: 6,
                 vtype: 'positiveNumber'
             }, {

+ 2 - 2
frontend/saas-web/app/view/sys/baseconfig/FormPanel.js

@@ -62,9 +62,9 @@ Ext.define('saas.view.sys.baseconfig.FormPanel', {
         fieldLabel : "库存计算方式", 
         allowBlank : false, 
     },{
-        bind:'{currency}',
+        bind:'{defaultCurrency}',
         xtype : "textfield", 
-        name : "currency",
+        name : "defaultCurrency",
         fieldLabel : "本位币", 
         beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
         readOnly:true,