FormPanel.js 14 KB

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