agricloud / foodprint

1 stars 0 forks source link

標準作業防呆,中文化,回應訊息,處理中狀態,layout 處理 #17

Open smlsunxie opened 11 years ago

smlsunxie commented 11 years ago

標準作業防呆

不是寫死的中文字,必須用變數代替需要顯示文字的地方

目前統一由Utilites元件處理語系轉換,一般的轉換可參考commonCreateBtn,直接呼叫Utilities中的getMsg方法,並傳入指定的語系標籤即可。

processCommonCreateBtn(config){
    config.text=Utilities.getMsg('common.createBtn.label');
    return config;
}

grid、form轉換可參考ItemGrid、ItemForm,使用Utilities.processConfigBundle(config, 'item')指定語系類型為item即可自動轉換。

processItemGrid(config){
    return Utilities.createFiltersFeature(Utilities.processConfigBundle(config, 'item'));
}

關於語系替換的方式可參考下列文章:Extjs-8-30:在 Sencha Architect 中的多語系處理

回應訊息

以MainContainer為例,左方功能列表將動態新增各功能tab頁面,在產生Tab時應同時指定layout。

tab =  {
        xtype: 'panel',
        layout: {
            type: 'fit'
        },
        title: tabName,
        closable:true,
        items: [{ xtype: xtypeStr }]
   };

ps. 請參考OperationEditorCt。

結構調整

當function需操作多個物件時,才定義於controller當中。 若是單純操作自身物件,則定義於該物件之view中。 品項、批號、生產線、製程等維護作業資本上應只有一個controller,若有特殊需求需mixin其他controller請提出討論。 如batchViewerController中的doDisplay,其實只有操作batchForm物件,因此重新定義於batchForm之中而非Controller,請參考批號維護(batchEditor)結構。

交易安全處理

@Transactional 

   def deleteBatch(batchInstance) {
      batchInstance.delete(flush:true)
   }

如有其他需要調整,會陸續加上...