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_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. }, {
  155. xtype : "hidden",
  156. name : "cu_sellercode",
  157. fieldLabel : "业务员code",
  158. }, {
  159. xtype : "employeeDbfindTrigger",
  160. name : "cu_sellername",
  161. fieldLabel : "业务员",
  162. columnWidth : 0.25
  163. },{
  164. xtype : "hidden",
  165. name : "cu_nsrzh",
  166. fieldLabel : "纳税人识别号",
  167. allowBlank : true,
  168. columnWidth : 0.25
  169. },{
  170. xtype : "hidden",
  171. name : "cu_bankaccount",
  172. fieldLabel : "开户银行",
  173. allowBlank : true,
  174. columnWidth : 0.25
  175. },{
  176. xtype : "hidden",
  177. name : "cu_bankcode",
  178. fieldLabel : "银行账户",
  179. allowBlank : true,
  180. columnWidth : 0.25
  181. },{
  182. xtype:'hidden',
  183. name : "cu_uu",
  184. fieldLabel : "客户UU",
  185. allowBlank : true,
  186. readOnly:true,
  187. editable:false,
  188. columnWidth : 0.25
  189. },{
  190. xtype:'textfield',
  191. name : "cu_leftamount",
  192. fieldLabel : "应收款余额",
  193. allowBlank : true,
  194. readOnly:true,
  195. columnWidth : 0.25,
  196. decimalPrecision: 8,
  197. renderer : function(v) {
  198. var arr = (v + '.').split('.');
  199. var xr = (new Array(arr[1].length)).fill('0');
  200. var format = '0.' + xr.join('');
  201. return Ext.util.Format.number(v, format);
  202. },
  203. },{
  204. xtype : "datefield",
  205. name : "createTime",
  206. fieldLabel : "创建时间",
  207. allowBlank : true,
  208. hidden:true,
  209. columnWidth : 0
  210. },{
  211. xtype : "datefield",
  212. name : "updateTime",
  213. fieldLabel : "更新时间",
  214. allowBlank : true,
  215. hidden:true,
  216. columnWidth : 0
  217. },{
  218. fieldLabel : "备注",
  219. xtype:'textfield',
  220. name : "cu_remark",
  221. columnWidth : 0.75
  222. }, {
  223. xtype : "detailGridField",
  224. storeModel:'saas.model.document.customercontact',
  225. detnoColumn: 'cc_detno',
  226. showCount: false,
  227. deleteDetailUrl:'/api/document/customer/deletecontact',
  228. columns : [
  229. {
  230. text : "ID",
  231. dataIndex : "id",
  232. hidden : true,
  233. xtype : "numbercolumn"
  234. },
  235. {
  236. text : "关联ID",
  237. dataIndex : "cc_cuid",
  238. hidden : true,
  239. xtype : "numbercolumn"
  240. },
  241. {
  242. allowBlank:false,
  243. text : "联系人",
  244. editor : {
  245. xtype : "textfield"
  246. },
  247. dataIndex : "cc_name",
  248. width:110
  249. },
  250. {
  251. allowBlank:false,
  252. text : "电话",
  253. editor : {
  254. hideTrigger:true,
  255. xtype : "textfield"
  256. },
  257. dataIndex : "cc_tel",
  258. width:110
  259. },
  260. {
  261. allowBlank:true,
  262. text : "微信/QQ",
  263. editor : {
  264. xtype : "textfield"
  265. },
  266. dataIndex : "cc_qq",
  267. width:110
  268. },
  269. {
  270. text : "邮箱",
  271. editor : {
  272. xtype : "textfield"
  273. },
  274. dataIndex : "cc_email",
  275. width:180
  276. },
  277. {
  278. editor : {
  279. displayField : "display",
  280. format : "",
  281. hideTrigger : false,
  282. maxLength : 100.0,
  283. minValue : null,
  284. positiveNum : false,
  285. queryMode : "local",
  286. valueField : "value",
  287. xtype : "combo",
  288. store:{
  289. fields: ['display', 'value'],
  290. data : [
  291. {"display":"是", "value":'1'},
  292. {"display":"否", "value":'0'}
  293. ]
  294. },
  295. listeners:{
  296. 'change':function(c,newVal,oldVal){
  297. if(newVal=='1'){
  298. var grid = c.ownerCt.column.ownerCt.ownerCt;
  299. var nowId = grid.selModel.lastSelected.id;
  300. var items = grid.store.data.items
  301. for (let index = 0; index < items.length; index++) {
  302. if(items[index].id!=nowId){
  303. items[index].set('cc_default',"")
  304. }
  305. }
  306. }
  307. }
  308. }
  309. },
  310. text : "默认联系人",
  311. width:110 ,
  312. dataIndex : "cc_default",
  313. xtype : "",
  314. renderer: function (v, m, r) {
  315. if(v=='0'){
  316. return '';
  317. }else if(v=='1'){
  318. return '是';
  319. }
  320. return v;
  321. }
  322. }]
  323. } ,{
  324. xtype : "detailGridField",
  325. storeModel:'saas.model.document.customeraddress',
  326. detnoColumn: 'ca_detno',
  327. showCount: false,
  328. deleteDetailUrl:'/api/document/customer/deleteaddress',
  329. columns : [
  330. {
  331. text : "ID",
  332. dataIndex : "id",
  333. hidden : true,
  334. xtype : "numbercolumn"
  335. },
  336. {
  337. text : "关联ID",
  338. dataIndex : "ca_cuid",
  339. hidden : true,
  340. xtype : "numbercolumn"
  341. },
  342. {
  343. allowBlank:false,
  344. text : "送货地址",
  345. editor : {
  346. xtype : "textfield"
  347. },
  348. dataIndex : "ca_address",
  349. width:300
  350. },
  351. {
  352. allowBlank:true,
  353. text : "联系人",
  354. editor : {
  355. xtype : "textfield"
  356. },
  357. dataIndex : "ca_person",
  358. width:110
  359. },
  360. {
  361. allowBlank:true,
  362. text : "联系电话",
  363. editor : {
  364. xtype : "textfield",
  365. hideTrigger:true,
  366. },
  367. dataIndex : "ca_phone",
  368. width:110
  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. width:110,
  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-blue',
  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: 'BANNED',
  441. auditText: '已禁用',
  442. unAuditCode: 'ENABLE',
  443. unAuditText: '已启用',
  444. auditBtnText: '禁用',
  445. unAuditBtnText: '启用',
  446. }
  447. });