| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- Ext.define('saas.view.purchase.purchase.FormPanel', {
- extend: 'saas.view.core.form.FormPanel',
- xtype: 'purchase-purchase-formpanel',
- controller: 'purchase-purchase-formpanel',
- viewModel: 'purchase-purchase-formpanel',
- viewName: 'purchase-purchase-formpanel',
- caller: 'Purchase',
- //字段属性
- _title: '采购订单',
- _idField: 'id',
- _codeField: 'pu_code',
- _statusField: 'pu_status',
- _statusCodeField: 'pu_statuscode',
- _auditmanField: 'pu_auditman',
- _auditdateField: 'pu_auditdate',
- _relationColumn: 'pd_puid',
- _readUrl: '/api/purchase/purchase/read',
- _saveUrl: '/api/purchase/purchase/save',
- _auditUrl: '/api/purchase/purchase/audit',
- _unAuditUrl: '/api/purchase/purchase/unAudit',
- _deleteUrl: '/api/purchase/purchase/delete',
- _turnInUrl: '/api/purchase/purchase/turnProdin',
- initId: 0,
- initComponent: function () {
- Ext.apply(this, {
- defaultItems: [{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id'
- }, {
- xtype: "hidden",
- name: "pu_vendid",
- fieldLabel: "供应商ID"
- }, {
- xtype: "hidden",
- name: "pu_vendcode",
- fieldLabel: "供应商编号"
- }, {
- xtype: "vendorDbfindTrigger",
- name: "pu_vendname",
- fieldLabel: "供应商名称",
- allowBlank: false,
- columnWidth: 0.5
- }, {
- xtype: 'condbfindtrigger',
- fieldLabel: '币别汇率',
- allowBlank: false,
- dbType: 'currencyDbfindTrigger',
- dbfinds: [{
- from: 'cr_name',
- to: 'pu_currency'
- }, {
- from: 'cr_rate',
- to: 'pu_rate'
- }],
- // defaultValue: {
- // pu_currency: 'RMB',
- // pu_rate: 1
- // },
- supFieldConfig: {
- xtype: 'numberfield',
- readOnly: false,
- defaultReadOnly: false,
- defaultValue: 1,
- decimalPrecision: 6,
- vtype: 'positiveNumber',
- listeners: {
- change: function (f, v) {
- var defaultCurrency = Ext.getCmp('mainView').getViewModel().get('defaultCurrency');
- f.setReadOnly(f.ownerCt.items.items[0].value == defaultCurrency);
- }
- }
- }
- }, {
- xtype: "datefield",
- name: "pu_delivery",
- fieldLabel: "需求日期",
- allowBlank: false,
- defaultValue: new Date(),
- columnWidth: 0.25,
- }, {
- name: "pu_shipaddresscode",
- editable: false,
- xtype: "remotecombo",
- storeUrl: '/api/document/address/getCombo',
- fieldLabel: "交货地址",
- allowBlank: false,
- columnWidth: 0.5,
- hiddenBtn: false, //true 则会关闭新增按钮功能
- addHandler: function (b) {
- var form = this.ownerCmp.ownerCt;
- this.dialog = form.add({
- xtype: 'document-address-window',
- bind: {
- title: '新增交货地址'
- },
- _parent: form,
- _combo: this.ownerCmp,
- record: null,
- session: true
- });
- this.dialog.show();
- }
- }, {
- xtype: 'textfield',
- name: 'ssstatus',
- fieldLabel: '上传状态',
- bind: {
- hidden: '{!enableB2B}'
- }
- }, {
- name: "detailGridField",
- xtype: "detailGridField",
- storeModel: 'saas.model.purchase.Purchasedetail',
- detnoColumn: 'pd_detno',
- deleteDetailUrl: '/api/purchase/purchase/deleteDetail',
- allowEmpty: false,
- columns: [{
- text: "id",
- dataIndex: "id",
- xtype: "numbercolumn",
- hidden: true
- }, {
- text: "物料id",
- dataIndex: "pd_prodid",
- xtype: "numbercolumn",
- hidden: true
- }, {
- text: "物料编号",
- width: 150.0,
- dataIndex: "pd_prodcode",
- allowBlank: false,
- editor: {
- xtype: "productMultiDbfindTrigger"
- }
- }, {
- text: "品牌",
- width: 100.0,
- dataIndex: "pr_brand",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "物料名称",
- width: 150.0,
- dataIndex: "pr_detail",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "型号",
- width: 200.0,
- dataIndex: "pr_orispeccode",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: 'model映射需要',
- dataIndex: 'productDTO',
- hidden: true,
- }, {
- text: "规格",
- width: 200,
- dataIndex: "pr_spec",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "数量",
- dataIndex: "pd_qty",
- xtype: 'numbercolumn',
- width: 110.0,
- allowBlank: false,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 3,
- minValue: 0
- },
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 3, false);
- },
- summaryType: 'sum',
- summaryRenderer: function (v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 3, false);
- }
- }, {
- text: "单位",
- width: 65.0,
- dataIndex: "pr_unit",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "单价(元)",
- xtype: 'numbercolumn',
- dataIndex: "pd_taxprice",
- width: 120,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 4,
- minValue: 0
- },
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 4, true);
- }
- }, {
- text: "含税单价(元)",
- xtype: 'numbercolumn',
- dataIndex: "pd_price",
- width: 120,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 4,
- minValue: 0
- },
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 4, true);
- },
- listeners: {
- edit: function (value, grid) {
- var r = grid.getSelection()[0],
- pd_taxrate = r.get('pd_taxrate');
- var v = value / (1 + pd_taxrate / 100);
- r.set('pd_taxprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
- }
- }
- }, {
- text: "金额(元)",
- xtype: 'numbercolumn',
- dataIndex: "pd_taxtotal",
- width: 120,
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function (v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "税率(%)",
- xtype: 'numbercolumn',
- dataIndex: "pd_taxrate",
- width: 80,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 0,
- minValue: 0,
- maxValue: 100
- },
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, false);
- }
- }, {
- text: "税额(元)",
- xtype: 'numbercolumn',
- dataIndex: "pd_taxamount",
- width: 120,
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function (v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "价税合计(元)",
- xtype: 'numbercolumn',
- dataIndex: "pd_total",
- width: 120,
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function (v, d, f, m) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text: "需求日期",
- dataIndex: "pd_delivery",
- xtype: 'datecolumn',
- width: 110.0,
- editor: {
- xtype: "datefield",
- editable: false,
- hideTrigger: false
- }
- }, {
- text: "最小包装数",
- xtype: 'numbercolumn',
- dataIndex: "pr_zxbzs",
- width: 100.0,
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "关联销售单号",
- dataIndex: "pd_salecode",
- width: 150.0,
- ignore: true,
- }, {
- text: "备注",
- dataIndex: "pd_remark",
- width: 250,
- items: null,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "pd_text1",
- text: "自定义字段1",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "pd_text2",
- text: "自定义字段2",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "pd_text3",
- text: "自定义字段3",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "pd_text4",
- text: "自定义字段4",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }, {
- dataIndex: "pd_text5",
- text: "自定义字段5",
- width: 100,
- hidden: true,
- initHidden: false,
- editor: {
- xtype: "textfield"
- },
- }]
- }, {
- xtype: "textfield",
- name: "pu_remark",
- fieldLabel: "备注",
- columnWidth: 1
- }, {
- xtype: "datefield",
- name: "pu_date",
- fieldLabel: "单据日期",
- defaultValue: new Date()
- }, {
- xtype: "numberfield",
- name: "pu_total",
- fieldLabel: "价税合计(元)",
- readOnly: true,
- thousandSeparator: ',',
- columnWidth: 0.25,
- }, {
- xtype: "hidden",
- name: "pu_buyercode",
- fieldLabel: "采购员编号"
- }, {
- xtype: "employeeDbfindTrigger",
- name: "pu_buyername",
- fieldLabel: "采购员",
- columnWidth: 0.25
- }, {
- xtype: "hidden",
- name: "pu_buyerid",
- fieldLabel: "采购员ID"
- }, {
- xtype: "hidden",
- name: "creatorId",
- fieldLabel: "录入人ID",
- readOnly: true
- }, {
- xtype: "textfield",
- name: "creatorName",
- fieldLabel: "录入人",
- readOnly: true
- }, {
- xtype: "datefield",
- name: "createTime",
- fieldLabel: "录入日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: "hidden",
- name: "updaterId",
- fieldLabel: "更新人ID",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updaterName",
- fieldLabel: "更新人",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updateTime",
- fieldLabel: "更新日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: "textfield",
- name: "pu_auditman",
- fieldLabel: "审核人",
- readOnly: true
- }, {
- xtype: "datefield",
- name: "pu_auditdate",
- fieldLabel: "审核日期",
- readOnly: true
- }, {
- xtype: "textfield",
- name: "pu_text1",
- fieldLabel: "自定义字段1",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "pu_text2",
- fieldLabel: "自定义字段2",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "pu_text3",
- fieldLabel: "自定义字段3",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "pu_text4",
- fieldLabel: "自定义字段4",
- hidden: true,
- initHidden: false
- }, {
- xtype: "textfield",
- name: "pu_text5",
- fieldLabel: "自定义字段5",
- hidden: true,
- initHidden: false
- }]
- });
- this.callParent();
- },
- toolBtns: [{
- xtype: 'button',
- text: '转采购验收单',
- hidden: true,
- bind: {
- hidden: '{turnHidden}'
- },
- handler: 'turnIn'
- }],
- initFormData: function (data) {
- var me = this;
- me.setFormData(data);
- if (data.main.pu_statuscode != 'AUDITED' && !data.main.pu_shipaddresscode) {
- //读取默认地址
- saas.util.BaseUtil.request({
- url: '/api/document/address/getDefault',
- method: 'GET',
- })
- .then(function (localJson) {
- var data = localJson.data;
- if (data && data.ad_address) {
- var f = me.down('[name=pu_shipaddresscode]');
- f.setValue(data.ad_address)
- } else {
- saas.util.BaseUtil.showErrorToast('未设置默认采购交货地址,维护后新增会自动给采购交货地址赋默认值');
- }
- })
- .catch(function (e) {
- saas.util.BaseUtil.showErrorToast('获取默认采购交货地址失败: ' + e.message);
- });
- }
- me.clearDirty();
- }
- });
|