FormPanel.js 11 KB

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