FormPanel.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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. viewName: 'document-customer-formpanel',
  7. caller: 'Customer',
  8. //字段属性
  9. _title: '客户资料',
  10. _idField: 'id',
  11. _codeField: 'cu_code',
  12. _statusField: 'cu_status',
  13. _statusCodeField: 'cu_statuscode',
  14. _readUrl: '/api/document/customer/read',
  15. _saveUrl: '/api/document/customer/save',
  16. _openUrl: '/api/document/customer/open',
  17. _closeUrl: '/api/document/customer/close',
  18. _deleteUrl: '/api/document/customer/delete',
  19. initId: 0,
  20. codeInHeader: false,
  21. defaultButtons: [{
  22. cls: 'x-formpanel-btn-blue',
  23. xtype: 'button',
  24. text: '新增',
  25. bind: {
  26. hidden: '{!id}'
  27. },
  28. handler: 'add'
  29. }, {
  30. xtype: 'button',
  31. text: '保存',
  32. handler: 'onSave',
  33. }, {
  34. xtype: 'button',
  35. text: '删除',
  36. handler: 'delete'
  37. }, {
  38. xtype: 'button',
  39. bind: {
  40. text: '{auditBtnText}'
  41. },
  42. handler: "auditBtnClick",
  43. }],
  44. auditTexts: {
  45. auditCode: 'BANNED',
  46. auditText: '已禁用',
  47. unAuditCode: 'ENABLE',
  48. unAuditText: '已启用',
  49. auditBtnText: '禁用',
  50. unAuditBtnText: '启用',
  51. },
  52. initComponent: function () {
  53. Ext.applyIf(this, {
  54. defaultItems: [{
  55. xtype: 'hidden',
  56. name: 'id',
  57. fieldLabel: 'id',
  58. allowBlank: true,
  59. columnWidth: 0.25,
  60. group: '基础信息',
  61. }, {
  62. xtype: 'textfield',
  63. name: 'cu_code',
  64. fieldLabel: '客户编号',
  65. allowBlank: false,
  66. columnWidth: 0.25,
  67. group: '基础信息',
  68. }, {
  69. xtype: 'textfield',
  70. name: 'cu_name',
  71. fieldLabel: '客户名称',
  72. allowBlank: false,
  73. columnWidth: 0.25,
  74. group: '基础信息',
  75. }, {
  76. xtype: 'textfield',
  77. name: 'cu_shortname',
  78. fieldLabel: '客户简称',
  79. columnWidth: 0.25,
  80. hidden: true,
  81. group: '基础信息',
  82. }, {
  83. editable: false,
  84. xtype: "remotecombo",
  85. storeUrl: '/api/document/customerkind/getCombo',
  86. name: "cu_type",
  87. fieldLabel: "客户类型",
  88. columnWidth: 0.25,
  89. hiddenBtn: false, //true 则会关闭新增按钮功能,
  90. group: '基础信息',
  91. addHandler: function (b) {
  92. var document = Ext.create('saas.view.document.kind.Kind', {});
  93. var form = this.ownerCmp.ownerCt;
  94. this.dialog = form.getController().getView().add({
  95. xtype: 'document-kind-childwin',
  96. bind: {
  97. title: '新增客户类型'
  98. },
  99. dataKind: 'customerkind',
  100. belong: document.etc['customerkind'],
  101. _parent: form,
  102. _combo: this.ownerCmp,
  103. record: null,
  104. session: true
  105. });
  106. this.dialog.show();
  107. }
  108. }, {
  109. xtype: 'hidden',
  110. name: 'cu_status',
  111. fieldLabel: '状态',
  112. allowBlank: true,
  113. columnWidth: 0
  114. }, {
  115. xtype: 'hidden',
  116. name: 'cu_statuscode',
  117. fieldLabel: '状态码',
  118. allowBlank: true,
  119. columnWidth: 0.25
  120. }, {
  121. xtype: "datefield",
  122. name: "cu_begindate",
  123. format: 'Y-m-d',
  124. fieldLabel: "期初日期",
  125. allowBlank: true,
  126. columnWidth: 0.25,
  127. group: '交易信息',
  128. }, {
  129. xtype: "currencyDbfindTrigger",
  130. name: "cu_currency",
  131. fieldLabel: "币别",
  132. allowBlank: false,
  133. columnWidth: 0.25,
  134. group: '交易信息',
  135. },{
  136. xtype: "numberfield",
  137. hideTrigger: true,
  138. name: "cu_beginaramount",
  139. fieldLabel: "期初应收(元)",
  140. allowBlank: true,
  141. columnWidth: 0.25,
  142. decimalPrecision: 2,
  143. thousandSeparator: ',',
  144. minValue: 0,
  145. group: '交易信息',
  146. renderer: function(v, m, r) {
  147. return saas.util.BaseUtil.numberFormat(v, 2, true);
  148. },
  149. }, {
  150. xtype: "numberfield",
  151. hideTrigger: true,
  152. name: "cu_beginprerecamount",
  153. fieldLabel: "期初预收(元)",
  154. allowBlank: true,
  155. columnWidth: 0.25,
  156. decimalPrecision: 2,
  157. thousandSeparator: ',',
  158. minValue: 0,
  159. group: '交易信息',
  160. renderer: function(v, m, r) {
  161. return saas.util.BaseUtil.numberFormat(v, 2, true);
  162. },
  163. }, {
  164. xtype: 'textfield',
  165. name: "cu_leftamount",
  166. fieldLabel: "应收余额(元)",
  167. allowBlank: true,
  168. readOnly: true,
  169. columnWidth: 0.25,
  170. decimalPrecision: 2,
  171. thousandSeparator: ',',
  172. group: '交易信息',
  173. renderer: function(v, m, r) {
  174. return saas.util.BaseUtil.numberFormat(v, 2, true);
  175. },
  176. }, {
  177. xtype: "numberfield",
  178. name: "cu_taxrate",
  179. fieldLabel: "税率(%)",
  180. allowBlank: false,
  181. columnWidth: 0.25,
  182. minValue: 0,
  183. maxValue: 100,
  184. group: '交易信息',
  185. }, {
  186. xtype: "numberfield",
  187. hideTrigger: true,
  188. name: "cu_promisedays",
  189. fieldLabel: "结算天数",
  190. allowBlank: true,
  191. columnWidth: 0.25,
  192. decimalPrecision: 0,
  193. minValue: 0,
  194. group: '交易信息',
  195. }, {
  196. xtype: "hidden",
  197. name: "cu_sellerid",
  198. fieldLabel: "业务员id",
  199. defaultValue: saas.util.BaseUtil.getCurrentUser().id,
  200. group: '交易信息',
  201. }, {
  202. xtype: "hidden",
  203. name: "cu_sellercode",
  204. fieldLabel: "业务员code",
  205. group: '交易信息',
  206. }, {
  207. xtype: "employeeDbfindTrigger",
  208. name: "cu_sellername",
  209. fieldLabel: "业务员",
  210. columnWidth: 0.25,
  211. defaultValue: saas.util.BaseUtil.getCurrentUser().realname,
  212. group: '交易信息',
  213. }, {
  214. xtype: "hidden",
  215. hideTrigger: true,
  216. name: "cu_credit",
  217. fieldLabel: "额度",
  218. allowBlank: true,
  219. columnWidth: 0.25,
  220. decimalPrecision: 2,
  221. minValue: 0,
  222. group: '交易信息',
  223. renderer: function(v, m, r) {
  224. return saas.util.BaseUtil.numberFormat(v, 2, true);
  225. },
  226. }, {
  227. xtype: "hidden",
  228. name: "cu_nsrzh",
  229. fieldLabel: "纳税人识别号",
  230. allowBlank: true,
  231. columnWidth: 0.25
  232. }, {
  233. xtype: "hidden",
  234. name: "cu_bankaccount",
  235. fieldLabel: "开户银行",
  236. allowBlank: true,
  237. columnWidth: 0.25
  238. }, {
  239. xtype: "hidden",
  240. name: "cu_bankcode",
  241. fieldLabel: "银行账户",
  242. allowBlank: true,
  243. columnWidth: 0.25
  244. }, {
  245. xtype: 'hidden',
  246. name: "cu_uu",
  247. fieldLabel: "客户UU",
  248. allowBlank: true,
  249. readOnly: true,
  250. editable: false,
  251. columnWidth: 0.25
  252. }, {
  253. xtype: "datefield",
  254. name: "createTime",
  255. fieldLabel: "创建时间",
  256. allowBlank: true,
  257. hidden: true,
  258. columnWidth: 0
  259. }, {
  260. xtype: "datefield",
  261. name: "updateTime",
  262. fieldLabel: "更新时间",
  263. allowBlank: true,
  264. hidden: true,
  265. columnWidth: 0
  266. }, {
  267. fieldLabel: "备注",
  268. xtype: 'textfield',
  269. name: "cu_remark",
  270. columnWidth: 1
  271. }, {
  272. xtype: "detailGridField",
  273. name: 'detail1',
  274. storeModel: 'saas.model.document.customercontact',
  275. detnoColumn: 'cc_detno',
  276. showCount: false,
  277. deleteDetailUrl: '/api/document/customer/deletecontact',
  278. minHeight: 145,
  279. emptyRows: 3,
  280. columns: [{
  281. text: "ID",
  282. dataIndex: "id",
  283. initHidden: true,
  284. hidden: true,
  285. xtype: "numbercolumn"
  286. }, {
  287. text: "关联ID",
  288. dataIndex: "cc_cuid",
  289. hidden: true,
  290. xtype: "numbercolumn"
  291. }, {
  292. allowBlank: false,
  293. text: "联系人",
  294. editor: {
  295. xtype: "textfield"
  296. },
  297. dataIndex: "cc_name",
  298. width: 110
  299. }, {
  300. allowBlank: false,
  301. text: "电话",
  302. editor: {
  303. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  304. // regexText:'请输入正确的手机号码',
  305. hideTrigger: true,
  306. xtype: "textfield"
  307. },
  308. dataIndex: "cc_tel",
  309. width: 200
  310. }, {
  311. allowBlank: true,
  312. text: "微信/QQ",
  313. editor: {
  314. xtype: "textfield"
  315. },
  316. dataIndex: "cc_qq",
  317. width: 110
  318. }, {
  319. text: "邮箱",
  320. editor: {
  321. xtype: "textfield"
  322. },
  323. dataIndex: "cc_email",
  324. width: 180
  325. }, {
  326. text: "默认联系人",
  327. width: 110,
  328. dataIndex: "cc_default",
  329. xtype: "yncolumn"
  330. }, {
  331. dataIndex: "cc_text1",
  332. text: "自定义字段1",
  333. width: 100,
  334. hidden: true,
  335. editor: {
  336. xtype: "textfield"
  337. },
  338. }, {
  339. dataIndex: "cc_text2",
  340. text: "自定义字段2",
  341. width: 100,
  342. hidden: true,
  343. editor: {
  344. xtype: "textfield"
  345. },
  346. }, {
  347. dataIndex: "cc_text3",
  348. text: "自定义字段3",
  349. width: 100,
  350. hidden: true,
  351. editor: {
  352. xtype: "textfield"
  353. },
  354. }, {
  355. dataIndex: "cc_text4",
  356. text: "自定义字段4",
  357. width: 100,
  358. hidden: true,
  359. editor: {
  360. xtype: "textfield"
  361. },
  362. }, {
  363. dataIndex: "cc_text5",
  364. text: "自定义字段5",
  365. width: 100,
  366. hidden: true,
  367. editor: {
  368. xtype: "textfield"
  369. },
  370. }]
  371. }, {
  372. xtype: "detailGridField",
  373. name: 'detail2',
  374. storeModel: 'saas.model.document.customeraddress',
  375. detnoColumn: 'ca_detno',
  376. showCount: false,
  377. deleteDetailUrl: '/api/document/customer/deleteaddress',
  378. minHeight: 145,
  379. emptyRows: 3,
  380. columns: [{
  381. text: "ID",
  382. dataIndex: "id",
  383. hidden: true,
  384. xtype: "numbercolumn"
  385. }, {
  386. text: "关联ID",
  387. dataIndex: "ca_cuid",
  388. hidden: true,
  389. xtype: "numbercolumn"
  390. }, {
  391. allowBlank: false,
  392. text: "送货地址",
  393. editor: {
  394. xtype: "textfield"
  395. },
  396. dataIndex: "ca_address",
  397. width: 300
  398. }, {
  399. allowBlank: true,
  400. text: "联系人",
  401. editor: {
  402. xtype: "textfield"
  403. },
  404. dataIndex: "ca_person",
  405. width: 110
  406. }, {
  407. allowBlank: true,
  408. text: "联系电话",
  409. editor: {
  410. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  411. // regexText:'请输入正确的手机号码',
  412. xtype: "textfield",
  413. hideTrigger: true,
  414. },
  415. dataIndex: "ca_phone",
  416. width: 200
  417. }, {
  418. text: "默认地址",
  419. dataIndex: "ca_default",
  420. width: 110,
  421. xtype: 'yncolumn'
  422. }, {
  423. dataIndex: "ca_text1",
  424. text: "自定义字段1",
  425. width: 100,
  426. hidden: true,
  427. initHidden: false,
  428. editor: {
  429. xtype: "textfield"
  430. },
  431. }, {
  432. dataIndex: "ca_text2",
  433. text: "自定义字段2",
  434. width: 100,
  435. hidden: true,
  436. initHidden: false,
  437. editor: {
  438. xtype: "textfield"
  439. },
  440. }, {
  441. dataIndex: "ca_text3",
  442. text: "自定义字段3",
  443. width: 100,
  444. hidden: true,
  445. initHidden: false,
  446. editor: {
  447. xtype: "textfield"
  448. },
  449. }, {
  450. dataIndex: "ca_text4",
  451. text: "自定义字段4",
  452. width: 100,
  453. hidden: true,
  454. initHidden: false,
  455. editor: {
  456. xtype: "textfield"
  457. },
  458. }, {
  459. dataIndex: "ca_text5",
  460. text: "自定义字段5",
  461. width: 100,
  462. hidden: true,
  463. initHidden: false,
  464. editor: {
  465. xtype: "textfield"
  466. },
  467. }]
  468. }, {
  469. xtype: "textfield",
  470. name: "cu_text1",
  471. fieldLabel: "自定义字段1",
  472. hidden: true,
  473. initHidden: false
  474. }, {
  475. xtype: "textfield",
  476. name: "cu_text2",
  477. fieldLabel: "自定义字段2",
  478. hidden: true,
  479. initHidden: false
  480. }, {
  481. xtype: "textfield",
  482. name: "cu_text3",
  483. fieldLabel: "自定义字段3",
  484. hidden: true,
  485. initHidden: false
  486. }, {
  487. xtype: "textfield",
  488. name: "cu_text4",
  489. fieldLabel: "自定义字段4",
  490. hidden: true,
  491. initHidden: false
  492. }, {
  493. xtype: "textfield",
  494. name: "cu_text5",
  495. fieldLabel: "自定义字段5",
  496. hidden: true,
  497. initHidden: false
  498. }],
  499. });
  500. this.callParent(arguments);
  501. },
  502. });