FormPanel.js 14 KB

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