FormPanel.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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. minValue:0,
  103. group: '交易信息',
  104. renderer : function(v) {
  105. return saas.util.BaseUtil.numberFormat(v, 2, true);
  106. },
  107. },{
  108. xtype : "numberfield",
  109. hideTrigger:true,
  110. name : "cu_beginprerecamount",
  111. fieldLabel : "期初预收",
  112. allowBlank : true,
  113. columnWidth : 0.25,
  114. decimalPrecision: 2,
  115. minValue:0,
  116. group: '交易信息',
  117. renderer : function(v) {
  118. return saas.util.BaseUtil.numberFormat(v, 2, true);
  119. },
  120. },{
  121. xtype:'textfield',
  122. name : "cu_leftamount",
  123. fieldLabel : "应收款余额",
  124. allowBlank : true,
  125. readOnly:true,
  126. columnWidth : 0.25,
  127. decimalPrecision: 2,
  128. group: '交易信息',
  129. renderer : function(v) {
  130. return saas.util.BaseUtil.numberFormat(v, 2, true);
  131. },
  132. },{
  133. xtype : "numberfield",
  134. name : "cu_taxrate",
  135. fieldLabel : "税率",
  136. allowBlank : false,
  137. columnWidth : 0.25,
  138. minValue:0,
  139. maxValue:100,
  140. group: '交易信息',
  141. },{
  142. xtype : "numberfield",
  143. hideTrigger:true,
  144. name : "cu_promisedays",
  145. fieldLabel : "结算天数",
  146. allowBlank : true,
  147. columnWidth : 0.25,
  148. decimalPrecision:0,
  149. minValue:0,
  150. group: '交易信息',
  151. }, {
  152. xtype : "hidden",
  153. name : "cu_sellerid",
  154. fieldLabel : "业务员id",
  155. defaultValue:saas.util.BaseUtil.getCurrentUser().id,
  156. group: '交易信息',
  157. }, {
  158. xtype : "hidden",
  159. name : "cu_sellercode",
  160. fieldLabel : "业务员code",
  161. group: '交易信息',
  162. }, {
  163. xtype : "employeeDbfindTrigger",
  164. name : "cu_sellername",
  165. fieldLabel : "业务员",
  166. columnWidth : 0.25,
  167. defaultValue:saas.util.BaseUtil.getCurrentUser().realname,
  168. group: '交易信息',
  169. },{
  170. xtype : "numberfield",
  171. hideTrigger:true,
  172. name : "cu_credit",
  173. fieldLabel : "额度",
  174. allowBlank : true,
  175. columnWidth : 0.25,
  176. decimalPrecision: 2,
  177. minValue:0,
  178. group: '交易信息',
  179. renderer : function(v) {
  180. return saas.util.BaseUtil.numberFormat(v, 2, true);
  181. },
  182. },{
  183. xtype : "hidden",
  184. name : "cu_nsrzh",
  185. fieldLabel : "纳税人识别号",
  186. allowBlank : true,
  187. columnWidth : 0.25
  188. },{
  189. xtype : "hidden",
  190. name : "cu_bankaccount",
  191. fieldLabel : "开户银行",
  192. allowBlank : true,
  193. columnWidth : 0.25
  194. },{
  195. xtype : "hidden",
  196. name : "cu_bankcode",
  197. fieldLabel : "银行账户",
  198. allowBlank : true,
  199. columnWidth : 0.25
  200. },{
  201. xtype:'hidden',
  202. name : "cu_uu",
  203. fieldLabel : "客户UU",
  204. allowBlank : true,
  205. readOnly:true,
  206. editable:false,
  207. columnWidth : 0.25
  208. },{
  209. xtype : "datefield",
  210. name : "createTime",
  211. fieldLabel : "创建时间",
  212. allowBlank : true,
  213. hidden:true,
  214. columnWidth : 0
  215. },{
  216. xtype : "datefield",
  217. name : "updateTime",
  218. fieldLabel : "更新时间",
  219. allowBlank : true,
  220. hidden:true,
  221. columnWidth : 0
  222. },{
  223. fieldLabel : "备注",
  224. xtype:'textfield',
  225. name : "cu_remark",
  226. columnWidth : 1
  227. }, {
  228. xtype : "detailGridField",
  229. storeModel:'saas.model.document.customercontact',
  230. detnoColumn: 'cc_detno',
  231. showCount: false,
  232. deleteDetailUrl:'/api/document/customer/deletecontact',
  233. // minHeight:145,
  234. emptyRows: 3,
  235. columns : [
  236. {
  237. text : "ID",
  238. dataIndex : "id",
  239. hidden : true,
  240. xtype : "numbercolumn"
  241. },
  242. {
  243. text : "关联ID",
  244. dataIndex : "cc_cuid",
  245. hidden : true,
  246. xtype : "numbercolumn"
  247. },
  248. {
  249. allowBlank:false,
  250. text : "联系人",
  251. editor : {
  252. xtype : "textfield"
  253. },
  254. dataIndex : "cc_name",
  255. width:110
  256. },
  257. {
  258. allowBlank:false,
  259. text : "电话",
  260. editor : {
  261. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  262. // regexText:'请输入正确的手机号码',
  263. hideTrigger:true,
  264. xtype : "textfield"
  265. },
  266. dataIndex : "cc_tel",
  267. width:200
  268. },
  269. {
  270. allowBlank:true,
  271. text : "微信/QQ",
  272. editor : {
  273. xtype : "textfield"
  274. },
  275. dataIndex : "cc_qq",
  276. width:110
  277. },
  278. {
  279. text : "邮箱",
  280. editor : {
  281. xtype : "textfield"
  282. },
  283. dataIndex : "cc_email",
  284. width:180
  285. },
  286. {
  287. text : "默认联系人",
  288. width:110 ,
  289. dataIndex : "cc_default",
  290. xtype : "yncolumn"
  291. }]
  292. } ,{
  293. xtype : "detailGridField",
  294. storeModel:'saas.model.document.customeraddress',
  295. detnoColumn: 'ca_detno',
  296. showCount: false,
  297. deleteDetailUrl:'/api/document/customer/deleteaddress',
  298. // height:145,
  299. emptyRows: 3,
  300. columns : [
  301. {
  302. text : "ID",
  303. dataIndex : "id",
  304. hidden : true,
  305. xtype : "numbercolumn"
  306. },
  307. {
  308. text : "关联ID",
  309. dataIndex : "ca_cuid",
  310. hidden : true,
  311. xtype : "numbercolumn"
  312. },
  313. {
  314. allowBlank:false,
  315. text : "送货地址",
  316. editor : {
  317. xtype : "textfield"
  318. },
  319. dataIndex : "ca_address",
  320. width:300
  321. },
  322. {
  323. allowBlank:true,
  324. text : "联系人",
  325. editor : {
  326. xtype : "textfield"
  327. },
  328. dataIndex : "ca_person",
  329. width:110
  330. },
  331. {
  332. allowBlank:true,
  333. text : "联系电话",
  334. editor : {
  335. // regex:/^1(3|4|5|7|8|9)\d{9}$/,
  336. // regexText:'请输入正确的手机号码',
  337. xtype : "textfield",
  338. hideTrigger:true,
  339. },
  340. dataIndex : "ca_phone",
  341. width:200
  342. },
  343. {
  344. text : "默认地址",
  345. dataIndex : "ca_default",
  346. width:110,
  347. xtype:'yncolumn'
  348. }]
  349. }],
  350. defaultButtons:[{
  351. cls: 'x-formpanel-btn-blue',
  352. xtype: 'button',
  353. text: '新增',
  354. bind: {
  355. hidden: '{!id}'
  356. },
  357. handler: 'add'
  358. }, {
  359. xtype: 'button',
  360. text: '保存',
  361. handler: 'onSave',
  362. }, {
  363. xtype: 'button',
  364. text: '删除',
  365. handler: 'delete'
  366. }, {
  367. xtype: 'button',
  368. bind: {
  369. text: '{auditBtnText}'
  370. },
  371. handler: "auditBtnClick",
  372. }],
  373. auditTexts: {
  374. auditCode: 'BANNED',
  375. auditText: '已禁用',
  376. unAuditCode: 'ENABLE',
  377. unAuditText: '已启用',
  378. auditBtnText: '禁用',
  379. unAuditBtnText: '启用',
  380. }
  381. });