Browse Source

主从表审核状态绑定调整

zhuth 7 years ago
parent
commit
382680a438

+ 102 - 94
frontend/saas-web/Readme.md

@@ -1,94 +1,102 @@
-# saas
-
-This folder is primarily a container for the top-level pieces of the application.
-While you can remove some files and folders that this application does not use,
-be sure to read below before deciding what can be deleted and what needs to be
-kept in source control.
-
-The following files are all needed to build and load the application.
-
- - `"app.json"` - The application descriptor which controls how the application is
-   built and loaded.
- - `"app.js"` - The file that launches the application. This is primarily used to
-   launch an instance of the `MyApp.Application` class.
- - `"index.html"` - The default web page for this application. This can be customized
-   in `"app.json"`.
- - `"build.xml"` - The entry point for Sencha Cmd to access the generated build
-   script. This file is a place where you can hook into these processes and tune
-   them. See the comments in that file for more information.
-
-These files can be ignored from source control as they are regenerated by the build
-process.
-
- - `"build"` - This folder contain the output of the build. The generated CSS file,
-   consolidated resources and concatenated JavaScript file are all stored in this
-   folder.
- - `"bootstrap.*"` - These files are generated by the build and watch commands to
-   enable the application to load in "development mode".
-
-## Basic Application Structure
-
-Applications that target a single toolkit will have the following structure.
-
-    app/                # Contains JavaScript and Theme code
-        model/          # Data model classes
-        view/           # Views as well as ViewModels and ViewControllers
-        store/          # Data stores
-        controller/     # Global / application-level controllers
-
-    overrides/          # JavaScript code that is automatically required
-
-    resources/          # Assets such as images, fonts, etc.
-
-### app/
-
-This folder contains JavaScript (.js files) and styling (.scss files) common
-for all builds of the application.
-
-#### app/controller/
-
-This folder contains the application's global controllers. ViewControllers are located
-alongside their respective view class in `"./view"`. These controllers are used for routing
-and other activities that span all views.
-
-#### app/model/
-
-This folder contains the application's (data) Model classes.
-
-#### app/view/
-
-This folder contains the views as well as ViewModels and ViewControllers depending on the
-application's architecture. Pure MVC applications may not have ViewModels, for example. For
-MVCVM applications or MVC applications that use ViewControllers, the following directory
-structure is recommended:
-
-    app/view/
-        foo/                    # Some meaningful grouping of one or more views
-            Foo.js              # The view class
-            Foo.scss            # The view class styling
-            FooController.js    # The controller for Foo (a ViewController)
-            FooModel.js         # The ViewModel for Foo
-
-This structure helps keep these closely related classes together and easily identifiable in
-most tabbed IDE's or text editors.
-
-#### app/store/
-
-This folder contains any number of store instances or types that can then be reused in the
-application.
-
-## Overrides
-
-The contents of "overrides" folders are automatically required and included in
-builds. These should not be explicitly mentioned in "requires" or "uses" in code.
-This area is intended for overrides like these:
-
-    Ext.define('saas.overrides.foo.Bar', {
-        override: 'Ext.foo.Bar',
-        ...
-    });
-
-Such overrides, while automatically required, will only be included if their target
-class ("Ext.foo.Bar" in this case) is also required. This simplifies applying
-patches or extensions to other classes.
-
+# 精简SaaS前端界面配置说明
+## 导航栏配置
+
+- 配置文件:
+```
+resources/json/navigation.json
+```
+- 格式样例:
+```json
+[{
+    "text": "采购",
+    "iconCls": "x-fa fa-shopping-basket",
+    "items": [{
+        "text": "制单",
+        "items": [{
+            "id": "purchase",
+            "text": "采购单",
+            "addType": "purchase-purchase-formpanel",
+            "viewType": "purchase-purchase-querypanel"
+        }]
+    }, {
+        "text": "报表",
+        "items": [{
+            "id": "puchasedetail",
+            "text": "采购明细表"
+        }]
+    }]
+}]
+```
+- 字段说明
+```
+text: 一级菜单项名称
+iconCls: 一级菜单项图标
+items:  二级菜单
+items[0].text:  二级菜单项标题(左)
+items[1].text: 二级菜单项标题(右)
+items[i].items: 二级菜单项
+items[i].items[i].id: 二级菜单项id
+items[i].items[i].text: 二级菜单项名称
+items[i].items[i].viewType: 点击名称进入的界面的xtype
+items[i].items[i].addType: 可选设置,添加“新增”按钮,点击进入xtype对应界面
+```
+
+## 主从表配置
+- 基础主从表组件
+```
+view: view.core.form.FormPanel
+controller: view.core.form.FormPanelController
+viewModel: view.core.form.FormPanelModel
+```
+自定义的主从表view、controller、viewModel需要继承自以上基础组件。
+
+- 配置字段说明
+
+| 字段名 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| extend | 继承,默认继承基础主从表 | √ | "saas.view.core.form.FormPanel" |
+| xtype | 格式为'-'连接的该文件全小写路径 | √ | "purchase-purchase-formpanel" |
+| controller | 控制层,可定义自定义的方法等。命名与xtype一致 | x | "purchase-purchase-formpanel" |
+| viewModel | Model层,可定义数据绑定关系等。命名与xtype一致 | x | "purchase-purchase-formpanel" |
+| viewName | 用于获取界面自定义配置 | x | "purchase-purchase-formpanel" |
+| addTitle | 新增时打开的页面标题 | √ | "采购单" |
+| idField | id字段 | √ | "id" |
+| codeField | 编号字段 | √ | "pu_code" |
+| statusField | 状态字段 | √ | "pu_status" |
+| statusCodeField | 状态码字段 | √ |  "pu_statuscode" |
+| readUrl | 取数接口 | √ | basePath + "purchase/purchase/read" |
+| saveUrl | 保存接口 | √ | basePath + "purchase/purchase/save" |
+| auditUrl | 审核接口 | √ | basePath + "purchase/purchase/audit" |
+| deleteUrl | 删除接口 | √ | basePath + "purchase/purchase/delete" |
+| deleteDetailUrl | 删除明细接口 | √ | basePath + "purchase/purchase/deleteItem" |
+| toolBtns | 自定义按钮 | x | [ Button ] |
+| defaultItems | 界面字段 | √ | [ Fields ]|
+
+主表字段配置说明
+
+_包括部分原有配置和主从表专属配置_
+
+| 字段 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| name | 字段名,根据该值设置字段绑定 | √ | "pu_vendcode" |
+| ignore | 是否忽略,为真时getFormData方法不会得到该字段值 | x | true |
+| defaultValue | 默认值 | x | "1001" |
+
+从表配置说明
+
+从表被定义为一个formfield(_xtype=detailGridField_),可以与其他字段一同放到主从表的items中。
+
+| 字段 | 说明 | 必填 | 样例 |
+| --- | --- | --- | --- |
+| storeModel | grid model | √ | "saas.model.purchase.purchasedetail" |
+| detnoColumn | 序号列 | √ | "pud_detno" |
+| columns[i].ignore | 是否忽略,为真时在调用保存方法时不会取到该列值 | x | true |
+
+
+## 查询列表配置
+- 基础组件
+```
+view: view.core.query.QueryPanel
+controller: view.core.query.QuertPanelController
+viewModel: view.core.query.QueryPanelModel
+```

+ 1 - 1
frontend/saas-web/app/util/FormUtil.js

@@ -135,7 +135,7 @@ Ext.define('saas.util.FormUtil', {
                         grid.add10EmptyRow();
                     });
                     if(code){
-                        viewModel.set(form._codeField,code);
+                        viewModel.set('form.' + form._codeField,code);
                     }
                 }
             }).catch(function() {

+ 6 - 7
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -89,15 +89,10 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel();
         
         var o = {};
-        o[statusField] = {
-            bind: '{form.' + statusCodeField + '}',
-            get: function(value) {
-                return value == 'AUDITED' ? '已审核' : '未审核'
-            }
-        };
         o['auditBtnText'] = {
             bind: '{form.' + statusCodeField + '}',
             get: function(value) {
+                viewModel.set('form.' + statusField, value == 'AUDITED' ? '审核' : '反审核');
                 return value == 'AUDITED' ? '反审核' : '审核'
             }
         };
@@ -105,7 +100,11 @@ Ext.define('saas.view.core.form.FormPanel', {
 
         viewModel.set('form.createTime', new Date());
         viewModel.set('form.updateTime', new Date());
-        statusCodeField ? viewModel.set('form.' + statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
+        if(statusCodeField) {
+            viewModel.set('form.' + statusCodeField, "UNAUDITED");
+        }else {
+            viewModel.set('auditBtnText', "审核");
+        }
     },
 
     addItems: function(items) {