FormPanel.js 18 KB

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