FormPanel.js 14 KB

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