FormPanel.js 17 KB

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