Ext.define('school.view.basic.class.ClassDetail', { extend: 'school.view.core.form.FormPanel', xtype: 'classdetail', controller: 'classdetail', viewModel: 'classdetail', //字段属性 _title: '班级信息', _idField: 'clazz_id', _codeField: null, // _readUrl: 'http://10.1.80.180:9520/api/school/class/read', _readUrl: '/api/school/class/read', // _saveUrl: 'http://10.1.80.180:9520/api/school/class/save', _saveUrl: '/api/school/class/save', _deleteUrl: '/api/school/class/delete', initId: 0, initComponent: function () { Ext.apply(this, { defaultItems: [{ xtype: 'hidden', name: 'clazz_id', fieldLabel: 'id', group: '班级信息', }, { xtype: "textfield", name: "clazz_name", fieldLabel: "班级名称", readOnly: true, columnWidth: 0.5, group: '班级信息', allowBlank: false }, { // xtype: 'textfield', // name: 'code', // fieldLabel: '班级代码', // }, { xtype: 'gradecombo', name: 'clazz_grade', fieldLabel: '所属年级', columnWidth: 0.5, readOnly: true, group: '班级信息', allowBlank: false }, { xtype: "textfield", name: "clazz_adress", fieldLabel: "班级地址", columnWidth: 1, group: '班级信息', }, { xtype: "textfield", name: 'clazz_status', fieldLabel: "状态", columnWidth: 0.5, hidden: true, group: '班级信息', }, { xtype: "textfield", name: 'clazz_remarks', fieldLabel: '备注', columnWidth: 0.5, group: '班级信息', }, { name: "detail0", xtype: "detailGridField", detnoColumn: 'sd_detno', storeModel: 'school.model.basic.Student', allowEmpty: true, showCount: false, readOnly: true, group: '学生信息', columns: [{ text: 'id', dataIndex: 'stu_id', hidden: true }, { text: '编号', dataIndex: 'stu_number' }, { text: '姓名', dataIndex: 'stu_name' }, { text: '性别', dataIndex: 'stu_sex', renderer: function(v, m , r) { return v == 1 ? '男' : (v == 0 ? '女' : '未知') } }, { text: '出生日期', dataIndex: 'stu_birthday', xtype: 'datecolumn', format: 'Y-m-d' }, { text: '年龄', dataIndex: 'stu_age' }, { text: '家庭住址', dataIndex: 'stu_address' }, { text: '入学时间', dataIndex: 'stu_enroll_date', xtype: 'datecolumn', format: 'Y-m-d' }, { text: '毕业时间', dataIndex: 'stu_graduate_date', xtype: 'datecolumn', format: 'Y-m-d' }, { text: '备注', dataIndex: 'stu_remarks' }] }, { name: "detail1", xtype: "detailGridField", idColumn: 'teacher_clazz_id', detnoColumn: 'no', storeModel: 'school.model.basic.Subject', // deleteDetailUrl: 'http://10.1.80.180:9520/api/school/class/deleteDetail', deleteDetailUrl: '/api/school/class/deleteDetail', allowEmpty: true, showCount: false, group: '学科信息', columns: [{ text: 'id', dataIndex: 'teacher_clazz_id', hidden: true }, { text: '学科id', dataIndex: 'subject_id', hidden: true, editor: { xtype: 'textfield' } /** * TODO 未写入学科id */ }, { text: '学科', dataIndex: 'subject_name', xtype: 'subjectcolumn', listeners: { select: function(column, combo, record, e) { column.up('grid').selection.set('subject_id', record.get('subject_id')); } } }, { text: '任课教师id', dataIndex: 'teacher_id', hidden: true, editor: { xtype: 'textfield' } }, { text: '任课教师', dataIndex: 'teacher_name', editor: { addTitle: '教师', xtype: 'dbfindtrigger', //数据接口 dataUrl:'/api/school/mirror/findTeacher', //联想设置 dbtpls:[{ field:'teacher_name',width:150 }], dbfinds:[{ from: 'teacher_name', to: 'teacher_name', }, { from: 'teacher_id', to: 'teacher_id' }], defaultCondition: "1=1", dbSearchFields:[{ emptyText:'请输入教师工号或姓名', xtype : "textfield", name : "search", getCondition: function(v) { return "(upper(teacher_name) like '%"+v.toUpperCase()+"%' or upper(teacher_number) like '%"+v.toUpperCase()+"%')"; }, allowBlank : true, width:300 }], //放大镜窗口列表 dbColumns:[{ text: "ID", dataIndex: "teacher_id", hidden:true, xtype: "numbercolumn" }, { text: '工号', dataIndex: 'teacher_number', width: 110 }, { text: "姓名", dataIndex: "teacher_name", width: 110 }] } }] }] }); this.callParent(); }, });