FormPanel.js 11 KB

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