FormPanel.js 16 KB

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