|
|
@@ -1,9 +1,12 @@
|
|
|
Ext.define('saas.view.core.form.FormPanel', {
|
|
|
extend: 'Ext.form.Panel',
|
|
|
xtype: 'core-form-formpanel',
|
|
|
+
|
|
|
controller: 'core-form-formpanel',
|
|
|
viewModel: 'core-form-formpanel',
|
|
|
|
|
|
+ cls: 'x-core-form',
|
|
|
+
|
|
|
//工具类
|
|
|
FormUtil: Ext.create('saas.util.FormUtil'),
|
|
|
BaseUtil: Ext.create('saas.util.BaseUtil'),
|
|
|
@@ -46,7 +49,43 @@ Ext.define('saas.view.core.form.FormPanel', {
|
|
|
style: {
|
|
|
'border-bottom': '1px solid #35baf6 !important'
|
|
|
},
|
|
|
- items: ['->'].concat(me.toolBtns.map(function(btn){
|
|
|
+ items: [{
|
|
|
+ xtype: 'tbtext',
|
|
|
+ bind: {
|
|
|
+ html: '<span class="x-tb x-no">NO. </span>' +
|
|
|
+ '<span class="x-tb x-code">{base.codeEditable ? "" : form.' + me._codeField + '}</span>'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ minHeight: 24,
|
|
|
+ maxHeight: 24,
|
|
|
+ cls: 'x-codeeditor',
|
|
|
+ bind: {
|
|
|
+ value: '{form.' + me._codeField + '}',
|
|
|
+ hidden: '{!base.codeEditable}'
|
|
|
+ },
|
|
|
+ listeners: {
|
|
|
+ blur: 'codeEditorBlur',
|
|
|
+ show: function(field, eOpts) {
|
|
|
+ field.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ xtype: 'tbtext',
|
|
|
+ html: '已审核',
|
|
|
+ cls: 'x-audited',
|
|
|
+ bind: {
|
|
|
+ hidden: '{!(form.' + me._statusCodeField + ' == "AUDITED")}'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ xtype: 'button',
|
|
|
+ cls: 'x-codeeditor-btn',
|
|
|
+ iconCls: 'fa fa-edit',
|
|
|
+ bind: {
|
|
|
+ hidden: '{!base.editable}'
|
|
|
+ },
|
|
|
+ handler: 'codeEditorClick'
|
|
|
+ },'->'].concat(me.toolBtns.map(function(btn){
|
|
|
btn.cls = btn.cls ? btn.cls + ' x-formpanel-btn-blue':'x-formpanel-btn-blue';
|
|
|
return btn;
|
|
|
}).concat([{
|
|
|
@@ -84,23 +123,25 @@ Ext.define('saas.view.core.form.FormPanel', {
|
|
|
*/
|
|
|
initViewModel: function() {
|
|
|
var me = this,
|
|
|
+ codeField = me._codeField,
|
|
|
statusField = me._statusField,
|
|
|
statusCodeField = me._statusCodeField,
|
|
|
viewModel = me.getViewModel();
|
|
|
|
|
|
- var o = {};
|
|
|
- o['auditBtnText'] = {
|
|
|
- bind: '{form.' + statusCodeField + '}',
|
|
|
- get: function(value) {
|
|
|
- viewModel.set('form.' + statusField, value == 'AUDITED' ? '审核' : '反审核');
|
|
|
- return value == 'AUDITED' ? '反审核' : '审核'
|
|
|
- }
|
|
|
- };
|
|
|
- viewModel.setFormulas(o);
|
|
|
-
|
|
|
+ viewModel.set('form.' + codeField, '--------------');
|
|
|
viewModel.set('form.createTime', new Date());
|
|
|
viewModel.set('form.updateTime', new Date());
|
|
|
+
|
|
|
if(statusCodeField) {
|
|
|
+ var o = {};
|
|
|
+ o['auditBtnText'] = {
|
|
|
+ bind: '{form.' + statusCodeField + '}',
|
|
|
+ get: function(value) {
|
|
|
+ viewModel.set('form.' + statusField, value == 'AUDITED' ? '审核' : '反审核');
|
|
|
+ return value == 'AUDITED' ? '反审核' : '审核'
|
|
|
+ }
|
|
|
+ };
|
|
|
+ viewModel.setFormulas(o);
|
|
|
viewModel.set('form.' + statusCodeField, "UNAUDITED");
|
|
|
}else {
|
|
|
viewModel.set('auditBtnText', "审核");
|