FormPanel.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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. caller:'Customer',
  7. //字段属性
  8. _title:'客户资料',
  9. _idField: 'id',
  10. _codeField: 'cu_code',
  11. _statusField: 'cu_status',
  12. _statusCodeField: 'cu_statuscode',
  13. _readUrl:'/api/document/customer/read',
  14. _saveUrl:'/api/document/customer/save',
  15. _openUrl:'/api/document/customer/open',
  16. _closeUrl:'/api/document/customer/close',
  17. _deleteUrl:'/api/document/customer/delete',
  18. initId:0,
  19. codeInHeader: false,
  20. defaultButtons:[{
  21. cls: 'x-formpanel-btn-blue',
  22. xtype: 'button',
  23. text: '新增',
  24. bind: {
  25. hidden: '{!id}'
  26. },
  27. handler: 'add'
  28. }, {
  29. xtype: 'button',
  30. text: '保存',
  31. handler: 'onSave',
  32. }, {
  33. xtype: 'button',
  34. text: '删除',
  35. handler: 'delete'
  36. }, {
  37. xtype: 'button',
  38. bind: {
  39. text: '{auditBtnText}'
  40. },
  41. handler: "auditBtnClick",
  42. }],
  43. auditTexts: {
  44. auditCode: 'BANNED',
  45. auditText: '已禁用',
  46. unAuditCode: 'ENABLE',
  47. unAuditText: '已启用',
  48. auditBtnText: '禁用',
  49. unAuditBtnText: '启用',
  50. },
  51. initComponent: function () {
  52. Ext.applyIf(this, {
  53. defaultItems: [{
  54. xtype: 'hidden',
  55. name: 'id',
  56. fieldLabel: 'id',
  57. allowBlank: true,
  58. columnWidth: 0.25,
  59. group: '基础信息',
  60. },{
  61. xtype: 'textfield',
  62. name: 'cu_code',
  63. fieldLabel: '客户编号',
  64. allowBlank: false,
  65. columnWidth: 0.25,
  66. group: '基础信息',
  67. },{
  68. xtype: 'textfield',
  69. name: 'cu_name',
  70. fieldLabel: '客户名称',
  71. allowBlank: false,
  72. columnWidth: 0.25,
  73. group: '基础信息',
  74. },{
  75. xtype: 'textfield',
  76. name: 'cu_shortname',
  77. fieldLabel: '客户简称',
  78. columnWidth: 0.25,
  79. hidden: true,
  80. group: '基础信息',
  81. },{
  82. editable:false,
  83. xtype : "remotecombo",
  84. storeUrl:'/api/document/customerkind/getCombo',
  85. name : "cu_type",
  86. fieldLabel : "客户类型",
  87. columnWidth : 0.25,
  88. hiddenBtn:false,//true 则会关闭新增按钮功能,
  89. group: '基础信息',
  90. addHandler:function(b){
  91. var document = Ext.create('saas.view.document.kind.Kind',{});
  92. var form = this.ownerCmp.ownerCt;
  93. this.dialog = form.getController().getView().add({
  94. xtype: 'document-kind-childwin',
  95. bind: {
  96. title: '新增客户类型'
  97. },
  98. dataKind:'customerkind',
  99. belong:document.etc['customerkind'],
  100. _parent:form,
  101. _combo:this.ownerCmp,
  102. record:null,
  103. session: true
  104. });
  105. this.dialog.show();
  106. }
  107. },{
  108. xtype: 'hidden',
  109. name: 'cu_status',
  110. fieldLabel: '状态',
  111. allowBlank: true,
  112. columnWidth: 0
  113. },{
  114. xtype: 'hidden',
  115. name: 'cu_statuscode',
  116. fieldLabel: '状态码',
  117. allowBlank: true,
  118. columnWidth: 0.25
  119. },{
  120. xtype : "datefield",
  121. name : "cu_begindate",
  122. format:'Y-m-d',
  123. fieldLabel : "期初日期",
  124. allowBlank : true,
  125. columnWidth : 0.25,
  126. group: '交易信息',
  127. },{
  128. xtype : "numberfield",
  129. hideTrigger:true,
  130. name : "cu_beginaramount",
  131. fieldLabel : "期初应收(元)",
  132. allowBlank : true,
  133. columnWidth : 0.25,
  134. decimalPrecision: 2,
  135. thousandSeparator: ',',
  136. minValue:0,
  137. group: '交易信息',
  138. renderer : function(v) {
  139. return saas.util.BaseUtil.numberFormat(v, 2, true);
  140. },
  141. },{
  142. xtype : "numberfield",
  143. hideTrigger:true,
  144. name : "cu_beginprerecamount",
  145. fieldLabel : "期初预收(元)",
  146. allowBlank : true,
  147. columnWidth : 0.25,
  148. decimalPrecision: 2,
  149. thousandSeparator: ',',
  150. minValue:0,
  151. group: '交易信息',
  152. renderer : function(v) {
  153. return saas.util.BaseUtil.numberFormat(v, 2, true);
  154. },
  155. },{
  156. xtype:'textfield',
  157. name : "cu_leftamount",
  158. fieldLabel : "应收余额(元)",
  159. allowBlank : true,
  160. readOnly:true,
  161. columnWidth : 0.25,
  162. decimalPrecision: 2,
  163. thousandSeparator: ',',
  164. group: '交易信息',
  165. renderer : function(v) {
  166. return saas.util.BaseUtil.numberFormat(v, 2, true);
  167. },
  168. },{
  169. xtype : "numberfield",
  170. name : "cu_taxrate",
  171. fieldLabel : "税率(%)",
  172. allowBlank : false,
  173. columnWidth : 0.25,
  174. minValue:0,
  175. maxValue:100,
  176. group: '交易信息',
  177. },{
  178. xtype : "numberfield",
  179. hideTrigger:true,
  180. name : "cu_promisedays",
  181. fieldLabel : "结算天数",
  182. allowBlank : true,
  183. columnWidth : 0.25,
  184. decimalPrecision:0,
  185. minValue:0,
  186. group: '交易信息',
  187. }, {
  188. xtype : "hidden",
  189. name : "cu_sellerid",
  190. fieldLabel : "业务员id",
  191. defaultValue:saas.util.BaseUtil.getCurrentUser().id,
  192. group: '交易信息',
  193. }, {
  194. xtype : "hidden",
  195. name : "cu_sellercode",
  196. fieldLabel : "业务员code",
  197. group: '交易信息',
  198. }, {
  199. xtype : "employeeDbfindTrigger",
  200. name : "cu_sellername",
  201. fieldLabel : "业务员",
  202. columnWidth : 0.25,
  203. defaultValue:saas.util.BaseUtil.getCurrentUser().realname,
  204. group: '交易信息',
  205. },{
  206. xtype : "numberfield",
  207. hideTrigger:true,
  208. name : "cu_credit",
  209. fieldLabel : "额度",
  210. allowBlank : true,
  211. columnWidth : 0.25,
  212. decimalPrecision: 2,
  213. minValue:0,
  214. group: '交易信息',
  215. renderer : function(v) {
  216. return saas.util.BaseUtil.numberFormat(v, 2, true);
  217. },
  218. },{
  219. xtype : "hidden",
  220. name : "cu_nsrzh",
  221. fieldLabel : "纳税人识别号",
  222. allowBlank : true,
  223. columnWidth : 0.25
  224. },{
  225. xtype : "hidden",
  226. name : "cu_bankaccount",
  227. fieldLabel : "开户银行",
  228. allowBlank : true,
  229. columnWidth : 0.25
  230. },{
  231. xtype : "hidden",
  232. name : "cu_bankcode",
  233. fieldLabel : "银行账户",
  234. allowBlank : true,
  235. columnWidth : 0.25
  236. },{
  237. xtype:'hidden',
  238. name : "cu_uu",
  239. fieldLabel : "客户UU",
  240. allowBlank : true,
  241. readOnly:true,
  242. editable:false,
  243. columnWidth : 0.25
  244. },{
  245. xtype : "datefield",
  246. name : "createTime",
  247. fieldLabel : "创建时间",
  248. allowBlank : true,
  249. hidden:true,
  250. columnWidth : 0
  251. },{
  252. xtype : "datefield",
  253. name : "updateTime",
  254. fieldLabel : "更新时间",
  255. allowBlank : true,
  256. hidden:true,
  257. columnWidth : 0
  258. },{
  259. fieldLabel : "备注",
  260. xtype:'textfield',
  261. name : "cu_remark",
  262. columnWidth : 1
  263. }, {
  264. xtype : "detailGridField",
  265. name: 'detailGridField',
  266. storeModel:'saas.model.document.customercontact',
  267. detnoColumn: 'cc_detno',
  268. showCount: false,
  269. deleteDetailUrl:'/api/document/customer/deletecontact',
  270. minHeight:145,
  271. emptyRows: 3,
  272. columns : [
  273. {
  274. text : "ID",
  275. dataIndex : "id",
  276. hidden : true,
  277. xtype : "numbercolumn"
  278. },
  279. {
  280. text : "关联ID",
  281. dataIndex : "cc_cuid",
  282. hidden : true,
  283. xtype : "numbercolumn"
  284. },
  285. {
  286. allowBlank:false,
  287. text : "联系人",
  288. editor : {
  289. xtype : "textfield"
  290. },
  291. dataIndex : "cc_name",
  292. width:110
  293. },
  294. {
  295. allowBlank:false,
  296. text : "电话",
  297. editor : {
  298. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  299. // regexText:'请输入正确的手机号码',
  300. hideTrigger:true,
  301. xtype : "textfield"
  302. },
  303. dataIndex : "cc_tel",
  304. width:200
  305. },
  306. {
  307. allowBlank:true,
  308. text : "微信/QQ",
  309. editor : {
  310. xtype : "textfield"
  311. },
  312. dataIndex : "cc_qq",
  313. width:110
  314. },
  315. {
  316. text : "邮箱",
  317. editor : {
  318. xtype : "textfield"
  319. },
  320. dataIndex : "cc_email",
  321. width:180
  322. },
  323. {
  324. text : "默认联系人",
  325. width:110 ,
  326. dataIndex : "cc_default",
  327. xtype : "yncolumn"
  328. }]
  329. } ,{
  330. xtype : "detailGridField",
  331. name: 'detailGridField',
  332. storeModel:'saas.model.document.customeraddress',
  333. detnoColumn: 'ca_detno',
  334. showCount: false,
  335. deleteDetailUrl:'/api/document/customer/deleteaddress',
  336. minHeight:145,
  337. emptyRows: 3,
  338. columns : [
  339. {
  340. text : "ID",
  341. dataIndex : "id",
  342. hidden : true,
  343. xtype : "numbercolumn"
  344. },
  345. {
  346. text : "关联ID",
  347. dataIndex : "ca_cuid",
  348. hidden : true,
  349. xtype : "numbercolumn"
  350. },
  351. {
  352. allowBlank:false,
  353. text : "送货地址",
  354. editor : {
  355. xtype : "textfield"
  356. },
  357. dataIndex : "ca_address",
  358. width:300
  359. },
  360. {
  361. allowBlank:true,
  362. text : "联系人",
  363. editor : {
  364. xtype : "textfield"
  365. },
  366. dataIndex : "ca_person",
  367. width:110
  368. },
  369. {
  370. allowBlank:true,
  371. text : "联系电话",
  372. editor : {
  373. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  374. // regexText:'请输入正确的手机号码',
  375. xtype : "textfield",
  376. hideTrigger:true,
  377. },
  378. dataIndex : "ca_phone",
  379. width:200
  380. },
  381. {
  382. text : "默认地址",
  383. dataIndex : "ca_default",
  384. width:110,
  385. xtype:'yncolumn'
  386. }]
  387. }],
  388. });
  389. this.callParent(arguments);
  390. },
  391. });