FormPanel.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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 : "hidden",
  146. name : "cu_sellerid",
  147. fieldLabel : "业务员id"
  148. }, {
  149. xtype : "hidden",
  150. name : "cu_sellercode",
  151. fieldLabel : "业务员code",
  152. }, {
  153. xtype : "employeeDbfindTrigger",
  154. name : "cu_sellername",
  155. fieldLabel : "业务员",
  156. editable:false,
  157. allowBlank : true,
  158. columnWidth : 0.25
  159. },{
  160. xtype : "hidden",
  161. name : "cu_nsrzh",
  162. fieldLabel : "纳税人识别号",
  163. allowBlank : true,
  164. columnWidth : 0.25
  165. },{
  166. xtype : "hidden",
  167. name : "cu_bankaccount",
  168. fieldLabel : "开户银行",
  169. allowBlank : true,
  170. columnWidth : 0.25
  171. },{
  172. xtype : "hidden",
  173. name : "cu_bankcode",
  174. fieldLabel : "银行账户",
  175. allowBlank : true,
  176. columnWidth : 0.25
  177. },{
  178. xtype:'textfield',
  179. name : "cu_uu",
  180. fieldLabel : "客户UU",
  181. allowBlank : true,
  182. readOnly:true,
  183. editable:false,
  184. columnWidth : 0.25
  185. },{
  186. xtype:'textfield',
  187. name : "cu_leftamount",
  188. fieldLabel : "应收款余额",
  189. allowBlank : true,
  190. readOnly:true,
  191. columnWidth : 0.25,
  192. decimalPrecision: 8,
  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. fieldLabel : "备注",
  215. xtype:'textfield',
  216. name : "cu_text1",
  217. columnWidth : 0.75
  218. }, {
  219. xtype : "detailGridField",
  220. storeModel:'saas.model.document.customercontact',
  221. detnoColumn: 'cc_detno',
  222. showCount: false,
  223. deleteDetailUrl:'/api/document/customer/deletecontact',
  224. columns : [
  225. {
  226. text : "ID",
  227. dataIndex : "id",
  228. hidden : true,
  229. xtype : "numbercolumn"
  230. },
  231. {
  232. text : "关联ID",
  233. dataIndex : "cc_cuid",
  234. hidden : true,
  235. xtype : "numbercolumn"
  236. },
  237. {
  238. allowBlank:false,
  239. text : "联系人",
  240. editor : {
  241. xtype : "textfield"
  242. },
  243. dataIndex : "cc_name",
  244. width:110
  245. },
  246. {
  247. allowBlank:false,
  248. text : "电话",
  249. editor : {
  250. hideTrigger:true,
  251. xtype : "textfield"
  252. },
  253. dataIndex : "cc_tel",
  254. width:110
  255. },
  256. {
  257. allowBlank:true,
  258. text : "微信/QQ",
  259. editor : {
  260. xtype : "textfield"
  261. },
  262. dataIndex : "cc_qq",
  263. width:110
  264. },
  265. {
  266. text : "邮箱",
  267. editor : {
  268. xtype : "textfield"
  269. },
  270. dataIndex : "cc_email",
  271. width:180
  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:110 ,
  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. xtype : "detailGridField",
  321. storeModel:'saas.model.document.customeraddress',
  322. detnoColumn: 'ca_detno',
  323. showCount: false,
  324. deleteDetailUrl:'/api/document/customer/deleteaddress',
  325. columns : [
  326. {
  327. text : "ID",
  328. dataIndex : "id",
  329. hidden : true,
  330. xtype : "numbercolumn"
  331. },
  332. {
  333. text : "关联ID",
  334. dataIndex : "ca_cuid",
  335. hidden : true,
  336. xtype : "numbercolumn"
  337. },
  338. {
  339. allowBlank:false,
  340. text : "送货地址",
  341. editor : {
  342. xtype : "textfield"
  343. },
  344. dataIndex : "ca_address",
  345. width:110
  346. },
  347. {
  348. allowBlank:true,
  349. text : "联系人",
  350. editor : {
  351. xtype : "textfield"
  352. },
  353. dataIndex : "ca_person",
  354. width:110
  355. },
  356. {
  357. allowBlank:true,
  358. text : "联系电话",
  359. editor : {
  360. xtype : "textfield",
  361. hideTrigger:true,
  362. },
  363. dataIndex : "ca_phone",
  364. width:110
  365. },
  366. {
  367. editor : {
  368. displayField : "display",
  369. format : "",
  370. hideTrigger : false,
  371. maxLength : 100.0,
  372. minValue : null,
  373. positiveNum : false,
  374. queryMode : "local",
  375. valueField : "value",
  376. xtype : "combo",
  377. store:{
  378. fields: ['display', 'value'],
  379. data : [
  380. {"display":"是", "value":'1'},
  381. {"display":"否", "value":'0'}
  382. ]
  383. },
  384. listeners:{
  385. 'change':function(c,newVal,oldVal){
  386. if(newVal=='1'){
  387. var grid = c.ownerCt.column.ownerCt.ownerCt;
  388. var nowId = grid.selModel.lastSelected.id;
  389. var items = grid.store.data.items
  390. for (let index = 0; index < items.length; index++) {
  391. if(items[index].id!=nowId){
  392. items[index].set('ca_default',"")
  393. }
  394. }
  395. }
  396. }
  397. }
  398. },
  399. text : "默认地址",
  400. dataIndex : "ca_default",
  401. width:110,
  402. renderer: function (v, m, r) {
  403. if(v=='0'){
  404. return '';
  405. }else if(v=='1'){
  406. return '是';
  407. }
  408. return v;
  409. }
  410. }]
  411. }],
  412. defaultButtons:[{
  413. cls: 'x-formpanel-btn-orange',
  414. xtype: 'button',
  415. text: '新增',
  416. bind: {
  417. hidden: '{!id}'
  418. },
  419. handler: 'add'
  420. }, {
  421. xtype: 'button',
  422. text: '保存',
  423. handler: 'onSave',
  424. }, {
  425. xtype: 'button',
  426. text: '删除',
  427. handler: 'delete'
  428. }, {
  429. xtype: 'button',
  430. bind: {
  431. text: '{auditBtnText}'
  432. },
  433. handler: "auditBtnClick",
  434. }],
  435. auditTexts: {
  436. auditCode: 'CLOSE',
  437. auditText: '已关闭',
  438. unAuditCode: 'OPEN',
  439. unAuditText: '已开启',
  440. auditBtnText: '禁用',
  441. unAuditBtnText: '启用',
  442. }
  443. });