FormPanel.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. Ext.define('saas.view.document.customer.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'document-customer-formpanel',
  4. controller: 'document-customer-formpanel',
  5. viewModel: 'document-customer-formpanel',
  6. caller:'Customer',
  7. //字段属性
  8. _title:'客户资料',
  9. _idField: 'id',
  10. _codeField: 'cu_code',
  11. _statusField: 'cu_status',
  12. _statusCodeField: 'cu_statuscode',
  13. _readUrl:'/api/document/customer/read',
  14. _saveUrl:'/api/document/customer/save',
  15. _openUrl:'/api/document/customer/open',
  16. _closeUrl:'/api/document/customer/close',
  17. _deleteUrl:'/api/document/customer/delete',
  18. initId:0,
  19. codeInHeader: false,
  20. defaultItems: [{
  21. xtype: 'hidden',
  22. name: 'id',
  23. fieldLabel: 'id',
  24. allowBlank: true,
  25. columnWidth: 0.25
  26. },{
  27. xtype: 'textfield',
  28. name: 'cu_code',
  29. fieldLabel: '客户编号',
  30. allowBlank: false,
  31. columnWidth: 0.25
  32. },{
  33. xtype: 'textfield',
  34. name: 'cu_shortname',
  35. fieldLabel: '客户简称',
  36. allowBlank: false,
  37. columnWidth: 0.25
  38. },{
  39. xtype: 'textfield',
  40. name: 'cu_name',
  41. fieldLabel: '客户名称',
  42. allowBlank: false,
  43. columnWidth: 0.25
  44. },{
  45. editable:false,
  46. xtype : "remotecombo",
  47. storeUrl:'/api/document/customerkind/getCombo',
  48. name : "cu_type",
  49. fieldLabel : "客户类型",
  50. columnWidth : 0.25,
  51. hiddenBtn:false,//true 则会关闭新增按钮功能
  52. addHandler:function(b){
  53. var document = Ext.create('saas.view.document.kind.Kind',{});
  54. var form = this.ownerCmp.ownerCt;
  55. this.dialog = form.getController().getView().add({
  56. xtype: 'document-kind-childwin',
  57. bind: {
  58. title: '新增客户类型'
  59. },
  60. dataKind:'customerkind',
  61. belong:document.etc['customerkind'],
  62. _parent:form,
  63. _combo:this.ownerCmp,
  64. record:null,
  65. session: true
  66. });
  67. this.dialog.show();
  68. }
  69. },{
  70. xtype: 'hidden',
  71. name: 'cu_status',
  72. fieldLabel: '状态',
  73. allowBlank: true,
  74. columnWidth: 0
  75. },{
  76. xtype: 'hidden',
  77. name: 'cu_statuscode',
  78. fieldLabel: '状态码',
  79. allowBlank: true,
  80. columnWidth: 0.25
  81. },{
  82. xtype : "datefield",
  83. name : "cu_begindate",
  84. format:'Y-m-d',
  85. fieldLabel : "期初日期",
  86. allowBlank : true,
  87. columnWidth : 0.25
  88. },{
  89. xtype : "numberfield",
  90. hideTrigger:true,
  91. name : "cu_beginaramount",
  92. fieldLabel : "期初应收",
  93. allowBlank : true,
  94. columnWidth : 0.25,
  95. decimalPrecision: 2,
  96. minValue:0,
  97. renderer : function(v) {
  98. var arr = (v + '.').split('.');
  99. var xr = (new Array(arr[1].length)).fill('0');
  100. var format = '0.' + xr.join('');
  101. return Ext.util.Format.number(v, format);
  102. },
  103. },{
  104. xtype : "numberfield",
  105. hideTrigger:true,
  106. name : "cu_beginprerecamount",
  107. fieldLabel : "期初预收",
  108. allowBlank : true,
  109. columnWidth : 0.25,
  110. decimalPrecision: 2,
  111. minValue:0,
  112. renderer : function(v) {
  113. var arr = (v + '.').split('.');
  114. var xr = (new Array(arr[1].length)).fill('0');
  115. var format = '0.' + xr.join('');
  116. return Ext.util.Format.number(v, format);
  117. },
  118. },{
  119. xtype : "numberfield",
  120. name : "cu_taxrate",
  121. fieldLabel : "税率",
  122. allowBlank : false,
  123. columnWidth : 0.25,
  124. minValue:0,
  125. maxValue:100,
  126. },{
  127. xtype : "numberfield",
  128. hideTrigger:true,
  129. name : "cu_promisedays",
  130. fieldLabel : "结算天数",
  131. allowBlank : true,
  132. columnWidth : 0.25,
  133. decimalPrecision:0,
  134. minValue:0
  135. },{
  136. xtype : "numberfield",
  137. hideTrigger:true,
  138. name : "cu_credit",
  139. fieldLabel : "额度",
  140. allowBlank : true,
  141. columnWidth : 0.25,
  142. decimalPrecision: 8,
  143. minValue:0,
  144. renderer : function(v) {
  145. var arr = (v + '.').split('.');
  146. var xr = (new Array(arr[1].length)).fill('0');
  147. var format = '0.' + xr.join('');
  148. return Ext.util.Format.number(v, format);
  149. },
  150. }, {
  151. xtype : "hidden",
  152. name : "cu_sellerid",
  153. fieldLabel : "业务员id",
  154. defaultValue:saas.util.BaseUtil.getCurrentUser().id
  155. }, {
  156. xtype : "hidden",
  157. name : "cu_sellercode",
  158. fieldLabel : "业务员code",
  159. }, {
  160. xtype : "employeeDbfindTrigger",
  161. name : "cu_sellername",
  162. fieldLabel : "业务员",
  163. columnWidth : 0.25,
  164. defaultValue:saas.util.BaseUtil.getCurrentUser().realname
  165. },{
  166. xtype : "hidden",
  167. name : "cu_nsrzh",
  168. fieldLabel : "纳税人识别号",
  169. allowBlank : true,
  170. columnWidth : 0.25
  171. },{
  172. xtype : "hidden",
  173. name : "cu_bankaccount",
  174. fieldLabel : "开户银行",
  175. allowBlank : true,
  176. columnWidth : 0.25
  177. },{
  178. xtype : "hidden",
  179. name : "cu_bankcode",
  180. fieldLabel : "银行账户",
  181. allowBlank : true,
  182. columnWidth : 0.25
  183. },{
  184. xtype:'hidden',
  185. name : "cu_uu",
  186. fieldLabel : "客户UU",
  187. allowBlank : true,
  188. readOnly:true,
  189. editable:false,
  190. columnWidth : 0.25
  191. },{
  192. xtype:'textfield',
  193. name : "cu_leftamount",
  194. fieldLabel : "应收款余额",
  195. allowBlank : true,
  196. readOnly:true,
  197. columnWidth : 0.25,
  198. decimalPrecision: 8,
  199. renderer : function(v) {
  200. var arr = (v + '.').split('.');
  201. var xr = (new Array(arr[1].length)).fill('0');
  202. var format = '0.' + xr.join('');
  203. return Ext.util.Format.number(v, format);
  204. },
  205. },{
  206. xtype : "datefield",
  207. name : "createTime",
  208. fieldLabel : "创建时间",
  209. allowBlank : true,
  210. hidden:true,
  211. columnWidth : 0
  212. },{
  213. xtype : "datefield",
  214. name : "updateTime",
  215. fieldLabel : "更新时间",
  216. allowBlank : true,
  217. hidden:true,
  218. columnWidth : 0
  219. },{
  220. fieldLabel : "备注",
  221. xtype:'textfield',
  222. name : "cu_remark",
  223. columnWidth : 0.75
  224. }, {
  225. xtype : "detailGridField",
  226. storeModel:'saas.model.document.customercontact',
  227. detnoColumn: 'cc_detno',
  228. showCount: false,
  229. deleteDetailUrl:'/api/document/customer/deletecontact',
  230. height:145,
  231. columns : [
  232. {
  233. text : "ID",
  234. dataIndex : "id",
  235. hidden : true,
  236. xtype : "numbercolumn"
  237. },
  238. {
  239. text : "关联ID",
  240. dataIndex : "cc_cuid",
  241. hidden : true,
  242. xtype : "numbercolumn"
  243. },
  244. {
  245. allowBlank:false,
  246. text : "联系人",
  247. editor : {
  248. xtype : "textfield"
  249. },
  250. dataIndex : "cc_name",
  251. width:110
  252. },
  253. {
  254. allowBlank:false,
  255. text : "电话",
  256. editor : {
  257. hideTrigger:true,
  258. xtype : "textfield"
  259. },
  260. dataIndex : "cc_tel",
  261. width:110
  262. },
  263. {
  264. allowBlank:true,
  265. text : "微信/QQ",
  266. editor : {
  267. xtype : "textfield"
  268. },
  269. dataIndex : "cc_qq",
  270. width:110
  271. },
  272. {
  273. text : "邮箱",
  274. editor : {
  275. xtype : "textfield"
  276. },
  277. dataIndex : "cc_email",
  278. width:180
  279. },
  280. {
  281. editor : {
  282. displayField : "display",
  283. format : "",
  284. hideTrigger : false,
  285. maxLength : 100.0,
  286. minValue : null,
  287. positiveNum : false,
  288. queryMode : "local",
  289. valueField : "value",
  290. xtype : "combo",
  291. store:{
  292. fields: ['display', 'value'],
  293. data : [
  294. {"display":"是", "value":'1'},
  295. {"display":"否", "value":'0'}
  296. ]
  297. },
  298. listeners:{
  299. 'change':function(c,newVal,oldVal){
  300. if(newVal=='1'){
  301. var grid = c.ownerCt.column.ownerCt.ownerCt;
  302. var nowId = grid.selModel.lastSelected.id;
  303. var items = grid.store.data.items
  304. for (let index = 0; index < items.length; index++) {
  305. if(items[index].id!=nowId){
  306. items[index].set('cc_default',"")
  307. }
  308. }
  309. }
  310. }
  311. }
  312. },
  313. text : "默认联系人",
  314. width:110 ,
  315. dataIndex : "cc_default",
  316. xtype : "",
  317. renderer: function (v, m, r) {
  318. if(v=='0'){
  319. return '';
  320. }else if(v=='1'){
  321. return '是';
  322. }
  323. return v;
  324. }
  325. }]
  326. } ,{
  327. xtype : "detailGridField",
  328. storeModel:'saas.model.document.customeraddress',
  329. detnoColumn: 'ca_detno',
  330. showCount: false,
  331. deleteDetailUrl:'/api/document/customer/deleteaddress',
  332. height:145,
  333. columns : [
  334. {
  335. text : "ID",
  336. dataIndex : "id",
  337. hidden : true,
  338. xtype : "numbercolumn"
  339. },
  340. {
  341. text : "关联ID",
  342. dataIndex : "ca_cuid",
  343. hidden : true,
  344. xtype : "numbercolumn"
  345. },
  346. {
  347. allowBlank:false,
  348. text : "送货地址",
  349. editor : {
  350. xtype : "textfield"
  351. },
  352. dataIndex : "ca_address",
  353. width:300
  354. },
  355. {
  356. allowBlank:true,
  357. text : "联系人",
  358. editor : {
  359. xtype : "textfield"
  360. },
  361. dataIndex : "ca_person",
  362. width:110
  363. },
  364. {
  365. allowBlank:true,
  366. text : "联系电话",
  367. editor : {
  368. xtype : "textfield",
  369. hideTrigger:true,
  370. },
  371. dataIndex : "ca_phone",
  372. width:110
  373. },
  374. {
  375. editor : {
  376. displayField : "display",
  377. format : "",
  378. hideTrigger : false,
  379. maxLength : 100.0,
  380. minValue : null,
  381. positiveNum : false,
  382. queryMode : "local",
  383. valueField : "value",
  384. xtype : "combo",
  385. store:{
  386. fields: ['display', 'value'],
  387. data : [
  388. {"display":"是", "value":'1'},
  389. {"display":"否", "value":'0'}
  390. ]
  391. },
  392. listeners:{
  393. 'change':function(c,newVal,oldVal){
  394. if(newVal=='1'){
  395. var grid = c.ownerCt.column.ownerCt.ownerCt;
  396. var nowId = grid.selModel.lastSelected.id;
  397. var items = grid.store.data.items
  398. for (let index = 0; index < items.length; index++) {
  399. if(items[index].id!=nowId){
  400. items[index].set('ca_default',"")
  401. }
  402. }
  403. }
  404. }
  405. }
  406. },
  407. text : "默认地址",
  408. dataIndex : "ca_default",
  409. width:110,
  410. renderer: function (v, m, r) {
  411. if(v=='0'){
  412. return '';
  413. }else if(v=='1'){
  414. return '是';
  415. }
  416. return v;
  417. }
  418. }]
  419. }],
  420. defaultButtons:[{
  421. cls: 'x-formpanel-btn-blue',
  422. xtype: 'button',
  423. text: '新增',
  424. bind: {
  425. hidden: '{!id}'
  426. },
  427. handler: 'add'
  428. }, {
  429. xtype: 'button',
  430. text: '保存',
  431. handler: 'onSave',
  432. }, {
  433. xtype: 'button',
  434. text: '删除',
  435. handler: 'delete'
  436. }, {
  437. xtype: 'button',
  438. bind: {
  439. text: '{auditBtnText}'
  440. },
  441. handler: "auditBtnClick",
  442. }],
  443. auditTexts: {
  444. auditCode: 'BANNED',
  445. auditText: '已禁用',
  446. unAuditCode: 'ENABLE',
  447. unAuditText: '已启用',
  448. auditBtnText: '禁用',
  449. unAuditBtnText: '启用',
  450. }
  451. });