| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- Ext.define('saas.view.document.employee.FormController', {
- extend: 'saas.view.core.form.FormPanelController',
- alias: 'controller.document-employee-formpanel',
- init: function (form) {
- var me = this;
- this.control({
- //主表单选放大镜模板
- 'dbfindtrigger[name=pr_vendcode]':{
- beforerender:function(f){
- Ext.apply(f,{
- //数据接口
- dataUrl:'/api/document/vendor/getVendorsByCondition',
- //赋值
- dbfinds:[{
- from:'id',to:'pr_vendid',ignore:true
- },{
- from:'ve_code',to:'pr_vendcode'
- },{
- from:'ve_name',to:'pr_vendname'
- }],
- //新增地址
- addXtype:'document-vendor-formpanel',
- //新增标题
- addTitle:'供应商资料',
- //联想设置
- dbtpls:[{
- field:'ve_code',width:100
- },{
- field:'ve_name',width:100
- }],
- defaultCondition: 've_statuscode="OPEN"',
- //放大镜窗口字段
- dbSearchFields:[{
- xtype : "textfield",
- name: 'name',
- getCondition: function(v) {
- return "((ve_code) like '%"+v.toUpperCase()+"%' or (ve_name) like '%"+v.toUpperCase()+"%')";
- },
- emptyText : "请输入供应商编号或名称",
- columnWidth : 0.25
- }],
- //放大镜窗口列表
- dbColumns:[{
- "text": "供应商ID",
- "flex": 0,
- "dataIndex": "id",
- "width": 0,
- "xtype": "",
- },{
- "text": "供应商编号",
- "flex": 1,
- "dataIndex": "ve_code",
- "width": 100,
- "xtype": "",
- }, {
- "text": "供应商名称",
- "flex": 1,
- "dataIndex": "ve_name",
- "xtype": "",
- }, {
- "text": "供应商类型",
- "flex": 0,
- "dataIndex": "ve_type",
- "width": 200,
- "xtype": "",
- }]
- }) ;
- }
- },
- // 仓库编号
- 'dbfindtrigger[name=pr_whcode]':{
- beforerender:function(f){
- Ext.apply(f,{
- //数据接口
- dataUrl:'/api/document/warehouse/list',
- //放大镜赋值设置
- dbfinds:[{
- from:'id',to:'pr_whid',ignore:true
- },{
- from:'wh_code',to:'pr_whcode'
- },{
- from:'wh_description',to:'pr_whname'
- }],
- //新增地址
- addXtype:'other-warehouse',
- //新增标题
- addTitle:'仓库资料',
- //联想查询条件
- defaultCondition:"wh_statuscode='OPEN'",
- //联想设置
- dbtpls:[{
- field:'wh_code',width:180
- },{
- field:'wh_description',width:100
- }],
- //窗口字段设置
- dbSearchFields:[{
- emptyText:'输入仓库编号或仓库名称或仓库类型',
- xtype : "textfield",
- name : "name",
- allowBlank : true,
- width:260,
- getCondition:function(v){
- return "((wh_code) like '%"+v.toUpperCase()+"%' or (wh_description) like '%"+v.toUpperCase()+"%'"+
- " or (wh_type) like '%"+v.toUpperCase()+"%')";
- }
- }],
- //窗口列设置
- dbColumns:[{
- "text": "ID",
- "flex": 0,
- "dataIndex": "id",
- "width": 0,
- "xtype": "",
- },{
- "text": "仓库编号",
- "flex": 1,
- "dataIndex": "wh_code",
- "width": 100,
- "xtype": "",
- },{
- "text": "仓库名称",
- "flex": 1,
- "dataIndex": "wh_description",
- "xtype": "",
- },{
- "text": "仓库类型",
- "flex": 1,
- "dataIndex": "wh_type",
- "xtype": "",
- }]
- }) ;
- }
- }
- });
- },
- auditBtnClick: function() {
- var me = this,
- form = me.getView(),
- statusCodeField = form._statusCodeField,
- viewModel = me.getViewModel(),
- status = viewModel.data[statusCodeField];
- status == 'OPEN' ? me.unAudit() : me.audit();
- },
- audit: function(){
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- me.BaseUtil.request({
- url: form._openUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- form.initId = localJson.data.id;
- form.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- showToast('启用成功');
- }
- })
- .catch(function(res) {
- console.error(res);
- showToast('启用失败: ' + res.message);
- });
- },
- unAudit: function() {
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- me.BaseUtil.request({
- url: form._closeUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- form.initId = localJson.data.id;
- form.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- showToast('禁用成功');
- }
- })
- .catch(function(res) {
- console.error(res);
- showToast('禁用失败: ' + res.message);
- });
- }
- });
|