FormPanel.js 13 KB

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