| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- /**
- * 制造类型编辑
- */
- Ext.define('make.view.make.makeKind.MakeKindWindow', {
- extend: 'Ext.window.Window',
- xtype: 'make-makekind-window',
- cls: 'x-window-dbfind ',
- viewModel: {
- data: {
- theKind: {
- },
- zeropricehide:false,//是否隐藏允许0单价
- }
- },
- controller: {
- handleSave: function () {
- var me = this,
- vm = me.getViewModel(),
- data = vm.get('theKind'),
- view = me.getView(),
- combo = view._combo;
- for( k in data) {
- if (Ext.isBoolean(data[k])) {
- data[k] = data[k] ? 1 : 0;
- }
- }
- if (data.id) {
- delete data.createTime,
- delete data.updateTime;
- } else {
- data.id = 0;
- data.mk_statuscode = 'ENABLE';
- data.mk_status = '已启用';
- }
- if(data.mk_makind == null || data.mk_makind== ''){
- data.mk_makind='MAKE';
- }
- view.mask('保存中');
- Ext.Ajax.post({
- url: '/api/make/kind/save',
- jsonData: data
- }).then(res => {
- view.unmask();
- if (res.success) {
- saas.util.BaseUtil.showSuccessToast('保存成功');
- view.close();
- view.onConfirm(view, data);
- var remotecombo = Ext.ComponentQuery.query("[xtype='remotecombo']");
- Ext.each(remotecombo, (i) => {
- if (i) {
- i.store.load(function () {
- //重新设置combo高度
- var count = i.store.getCount();
- var newHeight = count > 5 ? 248 - (i.hiddenBtn ? 50 : 0) : (33 * (count - 0.5) + (i.hiddenBtn ? 0 : 50));
- i.picker && i.picker.setHeight(newHeight);
- });
- }
- })
- if (combo) {
- combo.store.load(function () {
- typeof combo.setValue == 'function' && combo.setValue(data.mk_name);
- //重新设置combo高度
- var count = combo.store.getCount();
- var newHeight = count > 5 ? 248 - (combo.hiddenBtn ? 50 : 0) : (33 * (count - 0.5) + (combo.hiddenBtn ? 0 : 50));
- combo.picker && combo.picker.setHeight(newHeight);
- });
- }
- }
- }).catch(function (e) {
- view.unmask();
- saas.util.BaseUtil.showErrorToast('保存失败: ' + e.message);
- });
- },
- handleClose: function () {
- this.getView().close();
- }
- },
- title: '新增制造类型',
- modal: true,
- width: 500,
- bodyStyle: {
- margin: '10px 0 0 0'
- },
- bodyPadding: 20,
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- initComponent: function () {
- var me = this;
- Ext.apply(me, {
- items: [{
- xtype: 'form',
- bodyPadding: '10 30 10 10',
- border: false,
- autoScroll: true,
- layout: 'column',
- defaults: {
- margin: '0 0 10 0',
- labelWidth: 110,
- columnWidth: 1
- },
- items: [
- {
- xtype: "hidden",
- name: "id",
- allowBlank: false,
- fieldLabel: 'ID',
- bind: '{theKind.id}'
- }, {
- xtype: "textfield",
- name: "mk_name",
- allowBlank: false,
- fieldLabel: '类型名称',
- bind: '{theKind.mk_name}',
- columnWidth: 0.7
- },{
- xtype: "checkbox",
- name: "mk_ifmrpkind",
- boxLabel: "默认类型",
- margin: '0 0 10 10',
- bind: '{theKind.mk_ifmrpkind}',
- columnWidth: 0.2,
- minWidth:80
- },{
- xtype: 'radiogroup',
- name: "mk_makind",
- fieldLabel: "生产类型",
- cls: 'x-check-group-alt',
- simpleValue: true,
- bind: '{theKind.mk_makind}',
- items: [
- {boxLabel: '自制', inputValue: 'MAKE', checked: true},
- {boxLabel: '外协', inputValue: 'OSMAKE'}
- ]
- },{
- xtype: "checkbox",
- name: "mk_allowover",
- boxLabel: "允许超工单发料",
- allowBlank: false,
- bind: '{theKind.mk_allowover}'
- },{
- xtype: "checkbox",
- name: "mk_overfinish",
- boxLabel: "允许超工单完工",
- allowBlank: false,
- bind: '{theKind.mk_overfinish}'
- }, {
- xtype: "checkbox",
- name: "mk_unsetfinish",
- boxLabel: "领料齐套才允许完工",
- bind: '{theKind.mk_unsetfinish}'
- }, {
- xtype: "checkbox",
- name: "mk_zeroprice",
- boxLabel: "允许0单价完工入库",
- bind:{
- value: '{theKind.mk_zeroprice}',
- hidden: '{zeropricehide}'
- }
- }, {
- xtype: "checkbox",
- name: "mk_autoend",
- boxLabel: "工单完工自动结案",
- bind: '{theKind.mk_autoend}'
- }, {
- xtype: "numberfield",
- name: "mk_reminddays",
- allowBlank: false,
- fieldLabel: '未结案提醒天数',
- minValue: 1,
- maxValue: 360,
- columnWidth: 0.7,
- bind: '{theKind.mk_reminddays}'
- }, {
- xtype: 'toolbar',
- items: ['->', {
- xtype: 'button',
- text: '保存',
- formBind: true,
- handler: 'handleSave',
- bind: {
- disabled: '{!form.typeId||!form.name}'
- }
- }, {
- xtype: 'button',
- text: '取消',
- handler: 'handleClose'
- }, '->']
- }],
- }]
- })
- me.callParent(arguments);
- },
- onConfirm: Ext.emptyFn
- });
|