FormPanel.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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.apply(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. defaultValue: this.getViewModel().get('defaultCurrency') ,
  135. group: '交易信息',
  136. }, {
  137. xtype: "numberfield",
  138. name: "cu_taxrate",
  139. fieldLabel: "税率(%)",
  140. allowBlank: false,
  141. columnWidth: 0.25,
  142. minValue: 0,
  143. maxValue: 100,
  144. group: '交易信息',
  145. }, {
  146. xtype: "numberfield",
  147. hideTrigger: true,
  148. name: "cu_beginaramount",
  149. fieldLabel: "期初应收(元)",
  150. allowBlank: true,
  151. columnWidth: 0.25,
  152. decimalPrecision: 2,
  153. thousandSeparator: ',',
  154. minValue: 0,
  155. group: '交易信息',
  156. renderer: function(v, m, r) {
  157. return saas.util.BaseUtil.numberFormat(v, 2, true);
  158. },
  159. }, {
  160. xtype: "numberfield",
  161. hideTrigger: true,
  162. name: "cu_beginprerecamount",
  163. fieldLabel: "期初预收(元)",
  164. allowBlank: true,
  165. columnWidth: 0.25,
  166. decimalPrecision: 2,
  167. thousandSeparator: ',',
  168. minValue: 0,
  169. group: '交易信息',
  170. renderer: function(v, m, r) {
  171. return saas.util.BaseUtil.numberFormat(v, 2, true);
  172. },
  173. }, {
  174. xtype: "numberfield",
  175. hideTrigger: true,
  176. name: "cu_promisedays",
  177. fieldLabel: "结算天数",
  178. allowBlank: true,
  179. columnWidth: 0.25,
  180. decimalPrecision: 0,
  181. minValue: 0,
  182. group: '交易信息',
  183. }, {
  184. xtype: "hidden",
  185. name: "cu_sellerid",
  186. fieldLabel: "业务员id",
  187. defaultValue: saas.util.BaseUtil.getCurrentUser().id,
  188. group: '交易信息',
  189. }, {
  190. xtype: "hidden",
  191. name: "cu_sellercode",
  192. fieldLabel: "业务员code",
  193. group: '交易信息',
  194. }, {
  195. xtype: "employeeDbfindTrigger",
  196. name: "cu_sellername",
  197. fieldLabel: "业务员",
  198. columnWidth: 0.25,
  199. defaultValue: saas.util.BaseUtil.getCurrentUser().realname,
  200. group: '交易信息',
  201. }, {
  202. xtype: "hidden",
  203. hideTrigger: true,
  204. name: "cu_credit",
  205. fieldLabel: "额度",
  206. allowBlank: true,
  207. columnWidth: 0.25,
  208. decimalPrecision: 2,
  209. minValue: 0,
  210. group: '交易信息',
  211. renderer: function(v, m, r) {
  212. return saas.util.BaseUtil.numberFormat(v, 2, true);
  213. },
  214. }, {
  215. xtype: "hidden",
  216. name: "cu_nsrzh",
  217. fieldLabel: "纳税人识别号",
  218. allowBlank: true,
  219. columnWidth: 0.25
  220. }, {
  221. xtype: "hidden",
  222. name: "cu_bankaccount",
  223. fieldLabel: "开户银行",
  224. allowBlank: true,
  225. columnWidth: 0.25
  226. }, {
  227. xtype: "hidden",
  228. name: "cu_bankcode",
  229. fieldLabel: "银行账户",
  230. allowBlank: true,
  231. columnWidth: 0.25
  232. }, {
  233. xtype: 'hidden',
  234. name: "cu_uu",
  235. fieldLabel: "客户UU",
  236. allowBlank: true,
  237. readOnly: true,
  238. editable: false,
  239. columnWidth: 0.25
  240. }, {
  241. xtype: "datefield",
  242. name: "createTime",
  243. fieldLabel: "创建时间",
  244. allowBlank: true,
  245. hidden: true,
  246. columnWidth: 0
  247. }, {
  248. xtype: "datefield",
  249. name: "updateTime",
  250. fieldLabel: "更新时间",
  251. allowBlank: true,
  252. hidden: true,
  253. columnWidth: 0
  254. }, {
  255. fieldLabel: "备注",
  256. xtype: 'textfield',
  257. name: "cu_remark",
  258. columnWidth: 1
  259. }, {
  260. xtype: "detailGridField",
  261. name: 'detail1',
  262. storeModel: 'saas.model.document.customercontact',
  263. detnoColumn: 'cc_detno',
  264. showCount: false,
  265. deleteDetailUrl: '/api/document/customer/deletecontact',
  266. minHeight: 145,
  267. emptyRows: 3,
  268. columns: [{
  269. text: "ID",
  270. dataIndex: "id",
  271. initHidden: true,
  272. hidden: true,
  273. xtype: "numbercolumn"
  274. }, {
  275. text: "关联ID",
  276. dataIndex: "cc_cuid",
  277. hidden: true,
  278. xtype: "numbercolumn"
  279. }, {
  280. allowBlank: false,
  281. text: "联系人",
  282. editor: {
  283. xtype: "textfield"
  284. },
  285. dataIndex: "cc_name",
  286. width: 110
  287. }, {
  288. allowBlank: false,
  289. text: "电话",
  290. editor: {
  291. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  292. // regexText:'请输入正确的手机号码',
  293. hideTrigger: true,
  294. xtype: "textfield"
  295. },
  296. dataIndex: "cc_tel",
  297. width: 200
  298. }, {
  299. allowBlank: true,
  300. text: "微信/QQ",
  301. editor: {
  302. xtype: "textfield"
  303. },
  304. dataIndex: "cc_qq",
  305. width: 110
  306. }, {
  307. text: "邮箱",
  308. editor: {
  309. xtype: "textfield"
  310. },
  311. dataIndex: "cc_email",
  312. width: 180
  313. }, {
  314. text: "默认联系人",
  315. width: 110,
  316. dataIndex: "cc_default",
  317. xtype: "yncolumn"
  318. }, {
  319. dataIndex: "cc_text1",
  320. text: "自定义字段1",
  321. width: 100,
  322. hidden: true,
  323. editor: {
  324. xtype: "textfield"
  325. },
  326. }, {
  327. dataIndex: "cc_text2",
  328. text: "自定义字段2",
  329. width: 100,
  330. hidden: true,
  331. editor: {
  332. xtype: "textfield"
  333. },
  334. }, {
  335. dataIndex: "cc_text3",
  336. text: "自定义字段3",
  337. width: 100,
  338. hidden: true,
  339. editor: {
  340. xtype: "textfield"
  341. },
  342. }, {
  343. dataIndex: "cc_text4",
  344. text: "自定义字段4",
  345. width: 100,
  346. hidden: true,
  347. editor: {
  348. xtype: "textfield"
  349. },
  350. }, {
  351. dataIndex: "cc_text5",
  352. text: "自定义字段5",
  353. width: 100,
  354. hidden: true,
  355. editor: {
  356. xtype: "textfield"
  357. },
  358. }]
  359. }, {
  360. xtype: "detailGridField",
  361. name: 'detail2',
  362. storeModel: 'saas.model.document.customeraddress',
  363. detnoColumn: 'ca_detno',
  364. showCount: false,
  365. deleteDetailUrl: '/api/document/customer/deleteaddress',
  366. minHeight: 145,
  367. emptyRows: 3,
  368. columns: [{
  369. text: "ID",
  370. dataIndex: "id",
  371. hidden: true,
  372. xtype: "numbercolumn"
  373. }, {
  374. text: "关联ID",
  375. dataIndex: "ca_cuid",
  376. hidden: true,
  377. xtype: "numbercolumn"
  378. }, {
  379. allowBlank: false,
  380. text: "送货地址",
  381. editor: {
  382. xtype: "textfield"
  383. },
  384. dataIndex: "ca_address",
  385. width: 300
  386. }, {
  387. allowBlank: true,
  388. text: "联系人",
  389. editor: {
  390. xtype: "textfield"
  391. },
  392. dataIndex: "ca_person",
  393. width: 110
  394. }, {
  395. allowBlank: true,
  396. text: "联系电话",
  397. editor: {
  398. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  399. // regexText:'请输入正确的手机号码',
  400. xtype: "textfield",
  401. hideTrigger: true,
  402. },
  403. dataIndex: "ca_phone",
  404. width: 200
  405. }, {
  406. text: "默认地址",
  407. dataIndex: "ca_default",
  408. width: 110,
  409. xtype: 'yncolumn'
  410. }, {
  411. dataIndex: "ca_text1",
  412. text: "自定义字段1",
  413. width: 100,
  414. hidden: true,
  415. initHidden: false,
  416. editor: {
  417. xtype: "textfield"
  418. },
  419. }, {
  420. dataIndex: "ca_text2",
  421. text: "自定义字段2",
  422. width: 100,
  423. hidden: true,
  424. initHidden: false,
  425. editor: {
  426. xtype: "textfield"
  427. },
  428. }, {
  429. dataIndex: "ca_text3",
  430. text: "自定义字段3",
  431. width: 100,
  432. hidden: true,
  433. initHidden: false,
  434. editor: {
  435. xtype: "textfield"
  436. },
  437. }, {
  438. dataIndex: "ca_text4",
  439. text: "自定义字段4",
  440. width: 100,
  441. hidden: true,
  442. initHidden: false,
  443. editor: {
  444. xtype: "textfield"
  445. },
  446. }, {
  447. dataIndex: "ca_text5",
  448. text: "自定义字段5",
  449. width: 100,
  450. hidden: true,
  451. initHidden: false,
  452. editor: {
  453. xtype: "textfield"
  454. },
  455. }]
  456. }, {
  457. xtype: "textfield",
  458. name: "cu_text1",
  459. fieldLabel: "自定义字段1",
  460. hidden: true,
  461. initHidden: false
  462. }, {
  463. xtype: "textfield",
  464. name: "cu_text2",
  465. fieldLabel: "自定义字段2",
  466. hidden: true,
  467. initHidden: false
  468. }, {
  469. xtype: "textfield",
  470. name: "cu_text3",
  471. fieldLabel: "自定义字段3",
  472. hidden: true,
  473. initHidden: false
  474. }, {
  475. xtype: "textfield",
  476. name: "cu_text4",
  477. fieldLabel: "自定义字段4",
  478. hidden: true,
  479. initHidden: false
  480. }, {
  481. xtype: "textfield",
  482. name: "cu_text5",
  483. fieldLabel: "自定义字段5",
  484. hidden: true,
  485. initHidden: false
  486. }],
  487. });
  488. this.callParent(arguments);
  489. },
  490. });