|
|
@@ -0,0 +1,459 @@
|
|
|
+Ext.define('saas.view.document.uusetting.UUSettingWin', {
|
|
|
+ extend: 'Ext.window.Window',
|
|
|
+ xtype: 'uusettingwin',
|
|
|
+
|
|
|
+ title: '设置企业UU',
|
|
|
+ width: 680,
|
|
|
+ cls: 'x-window-dbfind',
|
|
|
+ closlayout: 'fit',
|
|
|
+ modal: true,
|
|
|
+ resizable: false,
|
|
|
+ bodyPadding: 20,
|
|
|
+
|
|
|
+ etc: {
|
|
|
+ vendorkind: {
|
|
|
+ uuName: 've_uu',
|
|
|
+ getUUUrl: '/api/document/vendor/getVendorUU',
|
|
|
+ saveUrl: '/api/document/vendor/save',
|
|
|
+ formItems: [{
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 'id',
|
|
|
+ bind: '{id}',
|
|
|
+ fieldLabel: 'id'
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 've_code',
|
|
|
+ bind: '{ve_code}',
|
|
|
+ fieldLabel: '供应商编号'
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 've_name',
|
|
|
+ bind: '{ve_name}',
|
|
|
+ fieldLabel: '供应商名称',
|
|
|
+ hidden: false
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 've_shortname',
|
|
|
+ bind: '{ve_shortname}',
|
|
|
+ fieldLabel: '供应商简称'
|
|
|
+ }, {
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 've_status',
|
|
|
+ bind: '{ve_status}',
|
|
|
+ fieldLabel: '状态'
|
|
|
+ }, {
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 've_statuscode',
|
|
|
+ bind: '{ve_statuscode}',
|
|
|
+ fieldLabel: '状态码'
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_type",
|
|
|
+ bind: '{ve_type}',
|
|
|
+ fieldLabel: "供应商类型"
|
|
|
+ }, {
|
|
|
+ xtype: "datefield",
|
|
|
+ name: "ve_begindate",
|
|
|
+ format: 'Y-m-d H:i:s',
|
|
|
+ bind: '{ve_begindate}',
|
|
|
+ fieldLabel: "期初日期"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_currency",
|
|
|
+ bind: '{ve_currency}',
|
|
|
+ fieldLabel: "币别"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "ve_taxrate",
|
|
|
+ bind: '{ve_taxrate}',
|
|
|
+ fieldLabel: "税率(%)"
|
|
|
+ },{
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "ve_beginapamount",
|
|
|
+ bind: '{ve_beginapamount}',
|
|
|
+ fieldLabel: "期初应付(元)"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ hideTrigger: true,
|
|
|
+ name: "ve_beginprepayamount",
|
|
|
+ bind: '{ve_beginprepayamount}',
|
|
|
+ fieldLabel: "期初预付(元)"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "ve_leftamount",
|
|
|
+ bind: '{ve_leftamount}',
|
|
|
+ fieldLabel: "应付余额(元)",
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "ve_promisedays",
|
|
|
+ bind: '{ve_promisedays}',
|
|
|
+ fieldLabel: "结算天数",
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_nsrzh",
|
|
|
+ bind: '{ve_nsrzh}',
|
|
|
+ fieldLabel: "纳税人识别号"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_bankcode",
|
|
|
+ bind: '{ve_bankcode}',
|
|
|
+ fieldLabel: "开户银行"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_bankaccount",
|
|
|
+ bind: '{ve_bankaccount}',
|
|
|
+ fieldLabel: "银行账户"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "ve_buyercode",
|
|
|
+ bind: '{ve_buyercode}',
|
|
|
+ fieldLabel: "采购员编号"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_buyername",
|
|
|
+ bind: '{ve_buyername}',
|
|
|
+ fieldLabel: "采购员"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "ve_buyerid",
|
|
|
+ bind: '{ve_buyerid}',
|
|
|
+ fieldLabel: "采购员ID"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_address",
|
|
|
+ bind: '{ve_address}',
|
|
|
+ fieldLabel: "公司地址"
|
|
|
+ }, {
|
|
|
+ fieldLabel: "备注",
|
|
|
+ xtype: 'textfield',
|
|
|
+ bind: '{ve_remark}',
|
|
|
+ name: "ve_remark"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_text1",
|
|
|
+ bind: '{ve_text1}',
|
|
|
+ fieldLabel: "自定义字段1"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_text2",
|
|
|
+ bind: '{ve_text2}',
|
|
|
+ fieldLabel: "自定义字段2"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_text3",
|
|
|
+ bind: '{ve_text3}',
|
|
|
+ fieldLabel: "自定义字段3"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_text4",
|
|
|
+ bind: '{ve_text4}',
|
|
|
+ fieldLabel: "自定义字段4"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "ve_text5",
|
|
|
+ bind: '{ve_text5}',
|
|
|
+ fieldLabel: "自定义字段5"
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ fieldLabel: '企业UU',
|
|
|
+ name: 've_uu',
|
|
|
+ bind: '{ve_uu}',
|
|
|
+ hidden: false,
|
|
|
+ allowBlank: false,
|
|
|
+ readOnly: true,
|
|
|
+ beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ customerkind: {
|
|
|
+ uuName: 'cu_uu',
|
|
|
+ getUUUrl: '/api/document/customer/getCustomerUU',
|
|
|
+ saveUrl: '/api/document/customer/save',
|
|
|
+ formItems: [{
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 'id',
|
|
|
+ bind: '{id}',
|
|
|
+ fieldLabel: 'id'
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 'cu_code',
|
|
|
+ bind: '{cu_code}',
|
|
|
+ fieldLabel: '客户编号'
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 'cu_name',
|
|
|
+ bind: '{cu_name}',
|
|
|
+ fieldLabel: '客户名称',
|
|
|
+ hidden: false
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: 'cu_shortname',
|
|
|
+ bind: '{cu_shortname}',
|
|
|
+ fieldLabel: '客户简称'
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_type",
|
|
|
+ bind: '{cu_type}',
|
|
|
+ fieldLabel: "客户类型"
|
|
|
+ }, {
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 'cu_status',
|
|
|
+ bind: '{cu_status}',
|
|
|
+ fieldLabel: '状态'
|
|
|
+ }, {
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 'cu_statuscode',
|
|
|
+ bind: '{cu_statuscode}',
|
|
|
+ fieldLabel: '状态码'
|
|
|
+ }, {
|
|
|
+ xtype: "datefield",
|
|
|
+ name: "cu_begindate",
|
|
|
+ format: 'Y-m-d H:i:s',
|
|
|
+ bind: '{cu_begindate}',
|
|
|
+ fieldLabel: "期初日期"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_currency",
|
|
|
+ bind: '{cu_currency}',
|
|
|
+ fieldLabel: "币别"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "cu_taxrate",
|
|
|
+ bind: '{cu_taxrate}',
|
|
|
+ fieldLabel: "税率(%)"
|
|
|
+ },{
|
|
|
+ xtype: "numberfield",
|
|
|
+ hideTrigger: true,
|
|
|
+ name: "cu_beginaramount",
|
|
|
+ bind: '{cu_beginaramount}',
|
|
|
+ fieldLabel: "期初应收(元)"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "cu_beginprerecamount",
|
|
|
+ bind: '{cu_beginprerecamount}',
|
|
|
+ fieldLabel: "期初预收(元)"
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: "cu_leftamount",
|
|
|
+ bind: '{cu_leftamount}',
|
|
|
+ fieldLabel: "应收余额(元)"
|
|
|
+ }, {
|
|
|
+ xtype: "numberfield",
|
|
|
+ name: "cu_promisedays",
|
|
|
+ bind: '{cu_promisedays}',
|
|
|
+ fieldLabel: "结算天数"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "cu_sellerid",
|
|
|
+ bind: '{cu_sellerid}',
|
|
|
+ fieldLabel: "业务员id"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "cu_sellercode",
|
|
|
+ bind: '{cu_sellercode}',
|
|
|
+ fieldLabel: "业务员code"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_sellername",
|
|
|
+ bind: '{cu_sellername}',
|
|
|
+ fieldLabel: "业务员"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "cu_nsrzh",
|
|
|
+ bind: '{cu_nsrzh}',
|
|
|
+ fieldLabel: "纳税人识别号"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "cu_bankaccount",
|
|
|
+ bind: '{cu_bankaccount}',
|
|
|
+ fieldLabel: "开户银行"
|
|
|
+ }, {
|
|
|
+ xtype: "hidden",
|
|
|
+ name: "cu_bankcode",
|
|
|
+ bind: '{cu_bankcode}',
|
|
|
+ fieldLabel: "银行账户"
|
|
|
+ }, {
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: "cu_uu",
|
|
|
+ bind: '{cu_uu}',
|
|
|
+ fieldLabel: "企业UU",
|
|
|
+ hidden: false,
|
|
|
+ allowBlank: false,
|
|
|
+ readOnly: true,
|
|
|
+ beforeLabelTextTpl: "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>"
|
|
|
+ }, {
|
|
|
+ fieldLabel: "备注",
|
|
|
+ xtype: 'textfield',
|
|
|
+ name: "cu_remark",
|
|
|
+ bind: '{cu_remark}'
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_text1",
|
|
|
+ bind: '{cu_text1}',
|
|
|
+ fieldLabel: "自定义字段1"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_text2",
|
|
|
+ bind: '{cu_text2}',
|
|
|
+ fieldLabel: "自定义字段2"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_text3",
|
|
|
+ bind: '{cu_text3}',
|
|
|
+ fieldLabel: "自定义字段3"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_text4",
|
|
|
+ bind: '{cu_text4}',
|
|
|
+ fieldLabel: "自定义字段4"
|
|
|
+ }, {
|
|
|
+ xtype: "textfield",
|
|
|
+ name: "cu_text5",
|
|
|
+ bind: '{cu_text5}',
|
|
|
+ fieldLabel: "自定义字段5"
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ initComponent: function () {
|
|
|
+ var me = this;
|
|
|
+ var kind = me.kind;
|
|
|
+ me.uuName = me.etc[kind].uuName;
|
|
|
+ me.getUUUrl = me.etc[kind].getUUUrl;
|
|
|
+ me.saveUrl = me.etc[kind].saveUrl;
|
|
|
+ var items = Ext.Array.merge(me.etc[kind].formItems, [{
|
|
|
+ xtype: 'detailGridField',
|
|
|
+ detnoColumn: null,
|
|
|
+ minHeight: 145,
|
|
|
+ emptyRows: 3,
|
|
|
+ showCount: false,
|
|
|
+ width: 280,
|
|
|
+ editable: false,
|
|
|
+ emptyText: '<span style="color: red;">没有查找到匹配的企业,请确认该企业已注册优软商务平台</span>',
|
|
|
+ store: Ext.create('Ext.data.Store', {
|
|
|
+ fields: [{
|
|
|
+ name: 'name',
|
|
|
+ type: 'string'
|
|
|
+ }, {
|
|
|
+ name: 'uu',
|
|
|
+ type: 'string'
|
|
|
+ }],
|
|
|
+ data: []
|
|
|
+ }),
|
|
|
+ columns: [{
|
|
|
+ text: '企业名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ }, {
|
|
|
+ text: 'UU',
|
|
|
+ dataIndex: 'uu'
|
|
|
+ }, {
|
|
|
+ xtype:'actioncolumn',
|
|
|
+ text:'操作',
|
|
|
+ align: 'center',
|
|
|
+ items: [{
|
|
|
+ xtype: 'button',
|
|
|
+ tooltip: '选择此项填入',
|
|
|
+ iconCls: 'x-sa sa-edit',
|
|
|
+ handler: function(tableView, rowIdx, colIdx, btn, e, record, tr) {
|
|
|
+ var form = tableView.up('form');
|
|
|
+ var uuField = form.query('[name=' + me.uuName + ']')[0];
|
|
|
+ uuField.setValue(record.data.uu);
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ }]);
|
|
|
+ Ext.apply(me, {
|
|
|
+ items: [{
|
|
|
+ xtype: 'form',
|
|
|
+ layout: 'column',
|
|
|
+ fieldDefaults: {
|
|
|
+ hidden: true,
|
|
|
+ margin: '0 0 10 0',
|
|
|
+ labelAlign: 'right',
|
|
|
+ labelWidth: 90,
|
|
|
+ columnWidth: 0.5,
|
|
|
+ },
|
|
|
+ items: items
|
|
|
+ }],
|
|
|
+ buttonAlign: 'center',
|
|
|
+ buttons: [{
|
|
|
+ text: '确定',
|
|
|
+ formBind: true,
|
|
|
+ handler: function () {
|
|
|
+ var win = this.up('window'),
|
|
|
+ form = win.down('form');
|
|
|
+
|
|
|
+ var uuField = form.query('[name=' + win.uuName + ']')[0];
|
|
|
+ if (form.isValid()) {
|
|
|
+ var values = form.getValues();
|
|
|
+ me.onSave(values);
|
|
|
+ } else {
|
|
|
+ saas.util.BaseUtil.showErrorToast('表单校验失败,请检查字段是否合法');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ text: '取消',
|
|
|
+ handler: function () {
|
|
|
+ me.close();
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ });
|
|
|
+ me.callParent(arguments);
|
|
|
+ },
|
|
|
+
|
|
|
+ listeners: {
|
|
|
+ boxready: function (win) {
|
|
|
+ win.setLoading(true);
|
|
|
+ var name = win.cname;
|
|
|
+ saas.util.BaseUtil.request({
|
|
|
+ url: win.getUUUrl,
|
|
|
+ method: 'GET',
|
|
|
+ params: {
|
|
|
+ name: name
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ var resData = res.data;
|
|
|
+ var data = [];
|
|
|
+ if (!Ext.Object.isEmpty(resData) && resData[name]) {
|
|
|
+ data.push({
|
|
|
+ name: name,
|
|
|
+ uu: resData[name].uu
|
|
|
+ });
|
|
|
+ }
|
|
|
+ win.setLoading(false);
|
|
|
+ var grid = win.down('grid');
|
|
|
+ var store = grid.store;
|
|
|
+ store.loadData(data);
|
|
|
+ }).catch(function (e) {
|
|
|
+ win.setLoading(false);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ onSave: function (values) {
|
|
|
+ var view = this;
|
|
|
+ var kind = view.kind;
|
|
|
+ var main = values;
|
|
|
+ var params = {
|
|
|
+ codeModified: false,
|
|
|
+ main: main,
|
|
|
+ items: [],
|
|
|
+ items1: [],
|
|
|
+ items2: []
|
|
|
+ };
|
|
|
+
|
|
|
+ view.setLoading(true);
|
|
|
+ saas.util.BaseUtil.request({
|
|
|
+ url: 'http://10.1.80.23:8560' + view.saveUrl,
|
|
|
+ params: JSON.stringify(params),
|
|
|
+ method: 'POST'
|
|
|
+ }).then(function (res) {
|
|
|
+ view.setLoading(false);
|
|
|
+ saas.util.BaseUtil.showSuccessToast('修改UU号成功');
|
|
|
+ view.close();
|
|
|
+ view.listView.refresh();
|
|
|
+ }).catch(function (e) {
|
|
|
+ view.setLoading(false);
|
|
|
+ saas.util.BaseUtil.showErrorToast('修改UU号失败: ' + e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+});
|