FormPanel.js 11 KB

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