FormPanel.js 17 KB

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