FormPanel.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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_name',
  29. fieldLabel: '客户名称',
  30. allowBlank: false,
  31. columnWidth: 0.5
  32. },{
  33. xtype: 'textfield',
  34. name: 'cu_code',
  35. fieldLabel: '客户编号',
  36. allowBlank: true,
  37. columnWidth: 0.25
  38. },{
  39. xtype : "remotecombo",
  40. storeUrl:'/api/document/customerkind/getCombo',
  41. name : "cu_type",
  42. fieldLabel : "客户类型",
  43. allowBlank : false,
  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. fieldLabel : "期初日期",
  79. allowBlank : true,
  80. columnWidth : 0.25
  81. },{
  82. xtype : "numberfield",
  83. hideTrigger:true,
  84. name : "cu_beginaramount",
  85. fieldLabel : "期初应收",
  86. allowBlank : true,
  87. columnWidth : 0.25,
  88. decimalPrecision: 8,
  89. minValue:0,
  90. renderer : function(v) {
  91. var arr = (v + '.').split('.');
  92. var xr = (new Array(arr[1].length)).fill('0');
  93. var format = '0.' + xr.join();
  94. return Ext.util.Format.number(v, format);
  95. },
  96. },{
  97. xtype : "numberfield",
  98. hideTrigger:true,
  99. name : "cu_beginprerecamount",
  100. fieldLabel : "期初预收",
  101. allowBlank : true,
  102. columnWidth : 0.25,
  103. decimalPrecision: 8,
  104. minValue:0,
  105. renderer : function(v) {
  106. var arr = (v + '.').split('.');
  107. var xr = (new Array(arr[1].length)).fill('0');
  108. var format = '0.' + xr.join();
  109. return Ext.util.Format.number(v, format);
  110. },
  111. },{
  112. xtype : "numberfield",
  113. name : "cu_taxrate",
  114. fieldLabel : "税率",
  115. allowBlank : false,
  116. columnWidth : 0.25,
  117. minValue:0,
  118. maxValue:100,
  119. },{
  120. xtype : "numberfield",
  121. hideTrigger:true,
  122. name : "cu_promisedays",
  123. fieldLabel : "承付天数",
  124. allowBlank : true,
  125. columnWidth : 0.25,
  126. decimalPrecision:0,
  127. minValue:0
  128. },{
  129. xtype : "numberfield",
  130. hideTrigger:true,
  131. name : "cu_credit",
  132. fieldLabel : "额度",
  133. allowBlank : true,
  134. columnWidth : 0.25,
  135. decimalPrecision: 8,
  136. minValue:0,
  137. renderer : function(v) {
  138. var arr = (v + '.').split('.');
  139. var xr = (new Array(arr[1].length)).fill('0');
  140. var format = '0.' + xr.join();
  141. return Ext.util.Format.number(v, format);
  142. },
  143. },{
  144. xtype : "textfield",
  145. name : "cu_sellername",
  146. fieldLabel : "业务员",
  147. ignore:true,
  148. editable:false,
  149. readOnly:true,
  150. allowBlank : true,
  151. columnWidth : 0.25
  152. },{
  153. ignore:true,
  154. xtype : "hidden",
  155. name : "cu_nsrzh",
  156. fieldLabel : "纳税人识别号",
  157. allowBlank : true,
  158. columnWidth : 0.25
  159. },{
  160. ignore:true,
  161. xtype : "hidden",
  162. name : "cu_bankaccount",
  163. fieldLabel : "开户银行",
  164. allowBlank : true,
  165. columnWidth : 0.25
  166. },{
  167. ignore:true,
  168. xtype : "hidden",
  169. name : "cu_bankcode",
  170. fieldLabel : "银行账户",
  171. allowBlank : true,
  172. columnWidth : 0.25
  173. },{
  174. xtype:'textfield',
  175. name : "cu_uu",
  176. fieldLabel : "客户UU",
  177. allowBlank : true,
  178. readOnly:true,
  179. editable:false,
  180. columnWidth : 0.25
  181. },{
  182. xtype:'textfield',
  183. name : "cu_leftamount",
  184. fieldLabel : "应收款余额",
  185. allowBlank : true,
  186. readOnly:true,
  187. ignore:true,
  188. columnWidth : 0.25,
  189. decimalPrecision: 8,
  190. minValue:0,
  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. height: 169,
  213. xtype : "detailGridField",
  214. storeModel:'saas.model.document.customercontact',
  215. detnoColumn: 'cc_detno',
  216. showCount: false,
  217. deleteDetailUrl:'/api/document/customer/deletecontact/',
  218. columns : [
  219. {
  220. text : "ID",
  221. dataIndex : "id",
  222. hidden : true,
  223. xtype : "numbercolumn"
  224. },
  225. {
  226. text : "关联ID",
  227. dataIndex : "cc_cuid",
  228. hidden : true,
  229. xtype : "numbercolumn"
  230. },
  231. {
  232. allowBlank:false,
  233. text : "联系人",
  234. editor : {
  235. xtype : "textfield"
  236. },
  237. dataIndex : "cc_name",
  238. xtype : "",
  239. items : null
  240. },
  241. {
  242. allowBlank:false,
  243. text : "电话",
  244. editor : {
  245. hideTrigger:true,
  246. xtype : "textfield"
  247. },
  248. dataIndex : "cc_tel",
  249. xtype : "",
  250. items : null
  251. },
  252. {
  253. allowBlank:true,
  254. text : "微信/QQ",
  255. editor : {
  256. xtype : "textfield"
  257. },
  258. dataIndex : "cc_qq",
  259. xtype : "",
  260. items : null
  261. },
  262. {
  263. text : "邮箱",
  264. editor : {
  265. xtype : "textfield"
  266. },
  267. dataIndex : "cc_email",
  268. xtype : "",
  269. items : null
  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 : 200.0,
  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. height: 169,
  319. xtype : "detailGridField",
  320. storeModel:'saas.model.document.customeraddress',
  321. detnoColumn: 'ca_detno',
  322. showCount: false,
  323. deleteDetailUrl:'/api/document/customer/deleteaddress/',
  324. columns : [
  325. {
  326. text : "ID",
  327. dataIndex : "id",
  328. hidden : true,
  329. xtype : "numbercolumn"
  330. },
  331. {
  332. text : "关联ID",
  333. dataIndex : "ca_cuid",
  334. hidden : true,
  335. xtype : "numbercolumn"
  336. },
  337. {
  338. allowBlank:false,
  339. text : "送货地址",
  340. editor : {
  341. xtype : "textfield"
  342. },
  343. dataIndex : "ca_address",
  344. xtype : "",
  345. items : null
  346. },
  347. {
  348. allowBlank:true,
  349. text : "联系人",
  350. editor : {
  351. xtype : "textfield"
  352. },
  353. dataIndex : "ca_person",
  354. xtype : "",
  355. items : null
  356. },
  357. {
  358. allowBlank:true,
  359. text : "联系电话",
  360. editor : {
  361. xtype : "textfield",
  362. hideTrigger:true,
  363. },
  364. dataIndex : "ca_phone",
  365. xtype : "",
  366. items : null
  367. },
  368. {
  369. allowBlank:false,
  370. editor : {
  371. displayField : "display",
  372. format : "",
  373. hideTrigger : false,
  374. maxLength : 100.0,
  375. minValue : null,
  376. positiveNum : false,
  377. queryMode : "local",
  378. valueField : "value",
  379. xtype : "combo",
  380. store:{
  381. fields: ['display', 'value'],
  382. data : [
  383. {"display":"是", "value":'1'},
  384. {"display":"否", "value":'0'}
  385. ]
  386. },
  387. listeners:{
  388. 'change':function(c,newVal,oldVal){
  389. if(newVal=='1'){
  390. var grid = c.ownerCt.column.ownerCt.ownerCt;
  391. var nowId = grid.selModel.lastSelected.id;
  392. var items = grid.store.data.items
  393. for (let index = 0; index < items.length; index++) {
  394. if(items[index].id!=nowId){
  395. items[index].set('ca_default',"")
  396. }
  397. }
  398. }
  399. }
  400. }
  401. },
  402. text : "是否默认地址",
  403. dataIndex : "ca_default",
  404. xtype : "",
  405. renderer: function (v, m, r) {
  406. if(v=='0'){
  407. return '';
  408. }else if(v=='1'){
  409. return '是';
  410. }
  411. return v;
  412. }
  413. }]
  414. }],
  415. defaultButtons:[{
  416. cls: 'x-formpanel-btn-orange',
  417. xtype: 'button',
  418. text: '新增',
  419. bind: {
  420. hidden: '{!id}'
  421. },
  422. handler: 'add'
  423. }, {
  424. xtype: 'button',
  425. text: '保存',
  426. handler: 'onSave',
  427. }, {
  428. xtype: 'button',
  429. text: '删除',
  430. handler: 'delete'
  431. }, {
  432. xtype: 'button',
  433. bind: {
  434. text: '{auditBtnText}'
  435. },
  436. handler: "auditBtnClick",
  437. }],
  438. auditTexts: {
  439. auditCode: 'CLOSE',
  440. auditText: '已关闭',
  441. unAuditCode: 'OPEN',
  442. unAuditText: '已开启',
  443. auditBtnText: '禁用',
  444. unAuditBtnText: '启用',
  445. }
  446. });