FormPanel.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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_name',
  29. fieldLabel: '客户名称',
  30. allowBlank: false,
  31. columnWidth: 0.5
  32. },{
  33. xtype: 'textfield',
  34. name: 'cu_code',
  35. fieldLabel: '客户编号',
  36. allowBlank: true,
  37. columnWidth: 0.25
  38. },{
  39. editable:false,
  40. xtype : "remotecombo",
  41. storeUrl:'/api/document/customerkind/getCombo',
  42. name : "cu_type",
  43. fieldLabel : "客户类型",
  44. allowBlank : false,
  45. columnWidth : 0.25,
  46. hiddenBtn:false,//true 则会关闭新增按钮功能
  47. addHandler:function(b){
  48. var document = Ext.create('saas.view.document.kind.Kind',{});
  49. var form = this.ownerCmp.ownerCt;
  50. this.dialog = form.getController().getView().add({
  51. xtype: 'document-kind-childwin',
  52. bind: {
  53. title: '新增客户类型'
  54. },
  55. dataKind:'customerkind',
  56. belong:document.etc['customerkind'],
  57. _parent:form,
  58. _combo:this.ownerCmp,
  59. record:null,
  60. session: true
  61. });
  62. this.dialog.show();
  63. }
  64. },{
  65. xtype: 'hidden',
  66. name: 'cu_status',
  67. fieldLabel: '状态',
  68. allowBlank: true,
  69. columnWidth: 0
  70. },{
  71. xtype: 'hidden',
  72. name: 'cu_statuscode',
  73. fieldLabel: '状态码',
  74. allowBlank: true,
  75. columnWidth: 0.25
  76. },{
  77. xtype : "datefield",
  78. name : "cu_begindate",
  79. fieldLabel : "期初日期",
  80. allowBlank : true,
  81. columnWidth : 0.25
  82. },{
  83. xtype : "numberfield",
  84. hideTrigger:true,
  85. name : "cu_beginaramount",
  86. fieldLabel : "期初应收",
  87. allowBlank : true,
  88. columnWidth : 0.25
  89. },{
  90. xtype : "numberfield",
  91. hideTrigger:true,
  92. name : "cu_beginprerecamount",
  93. fieldLabel : "期初预收",
  94. allowBlank : true,
  95. columnWidth : 0.25
  96. },{
  97. xtype : "numberfield",
  98. name : "cu_taxrate",
  99. fieldLabel : "税率",
  100. allowBlank : false,
  101. columnWidth : 0.25
  102. },{
  103. xtype : "numberfield",
  104. hideTrigger:true,
  105. name : "cu_promisedays",
  106. fieldLabel : "承付天数",
  107. allowBlank : true,
  108. columnWidth : 0.25
  109. },{
  110. xtype : "numberfield",
  111. hideTrigger:true,
  112. name : "cu_credit",
  113. fieldLabel : "额度",
  114. allowBlank : true,
  115. columnWidth : 0.25
  116. },{
  117. xtype : "textfield",
  118. name : "cu_sellername",
  119. fieldLabel : "业务员",
  120. ignore:true,
  121. editable:false,
  122. readOnly:true,
  123. allowBlank : true,
  124. columnWidth : 0.25
  125. },{
  126. xtype : "textfield",
  127. name : "cu_1",
  128. fieldLabel : "纳税人识别号",
  129. ignore:true,
  130. editable:false,
  131. readOnly:true,
  132. allowBlank : true,
  133. columnWidth : 0.25
  134. },{
  135. xtype : "textfield",
  136. name : "cu_2",
  137. fieldLabel : "开户银行",
  138. ignore:true,
  139. editable:false,
  140. readOnly:true,
  141. allowBlank : true,
  142. columnWidth : 0.25
  143. },{
  144. xtype : "textfield",
  145. name : "cu_3",
  146. fieldLabel : "银行账户",
  147. ignore:true,
  148. editable:false,
  149. readOnly:true,
  150. allowBlank : true,
  151. columnWidth : 0.25
  152. },{
  153. xtype:'textfield',
  154. name : "cu_uu",
  155. fieldLabel : "客户UU",
  156. allowBlank : true,
  157. columnWidth : 0.25
  158. },{
  159. xtype:'textfield',
  160. name : "cu_leftamount",
  161. fieldLabel : "应收款余额",
  162. allowBlank : true,
  163. readOnly:true,
  164. ignore:true,
  165. columnWidth : 0.25
  166. },{
  167. xtype : "datefield",
  168. name : "createTime",
  169. fieldLabel : "创建时间",
  170. allowBlank : true,
  171. hidden:true,
  172. columnWidth : 0
  173. },{
  174. xtype : "datefield",
  175. name : "updateTime",
  176. fieldLabel : "更新时间",
  177. allowBlank : true,
  178. hidden:true,
  179. columnWidth : 0
  180. }, {
  181. height: 169,
  182. xtype : "detailGridField",
  183. storeModel:'saas.model.document.customercontact',
  184. detnoColumn: 'cc_detno',
  185. showCount: false,
  186. deleteDetailUrl:'/api/document/customer/deletecontact/',
  187. columns : [
  188. {
  189. text : "ID",
  190. dataIndex : "id",
  191. hidden : true,
  192. xtype : "numbercolumn"
  193. },
  194. {
  195. text : "关联ID",
  196. dataIndex : "cc_cuid",
  197. hidden : true,
  198. xtype : "numbercolumn"
  199. },
  200. {
  201. allowBlank:false,
  202. text : "联系人",
  203. editor : {
  204. xtype : "textfield"
  205. },
  206. dataIndex : "cc_name",
  207. xtype : "",
  208. items : null
  209. },
  210. {
  211. allowBlank:false,
  212. text : "电话",
  213. editor : {
  214. hideTrigger:true,
  215. xtype : "textfield"
  216. },
  217. dataIndex : "cc_tel",
  218. xtype : "",
  219. items : null
  220. },
  221. {
  222. allowBlank:false,
  223. text : "微信/QQ",
  224. editor : {
  225. xtype : "textfield"
  226. },
  227. dataIndex : "cc_qq",
  228. xtype : "",
  229. items : null
  230. },
  231. {
  232. text : "邮箱",
  233. editor : {
  234. xtype : "textfield"
  235. },
  236. dataIndex : "cc_email",
  237. xtype : "",
  238. items : null
  239. },
  240. {
  241. editor : {
  242. displayField : "display",
  243. editable:false,
  244. format : "",
  245. hideTrigger : false,
  246. maxLength : 100.0,
  247. minValue : null,
  248. positiveNum : false,
  249. queryMode : "local",
  250. valueField : "value",
  251. xtype : "combo",
  252. store:{
  253. fields: ['display', 'value'],
  254. data : [
  255. {"display":"是", "value":'1'},
  256. {"display":"否", "value":'0'}
  257. ]
  258. },
  259. listeners:{
  260. 'change':function(c,newVal,oldVal){
  261. if(newVal=='1'){
  262. var grid = c.ownerCt.column.ownerCt.ownerCt;
  263. var nowId = grid.selModel.lastSelected.id;
  264. var items = grid.store.data.items
  265. for (let index = 0; index < items.length; index++) {
  266. if(items[index].id!=nowId){
  267. items[index].set('cc_default',"")
  268. }
  269. }
  270. }
  271. }
  272. }
  273. },
  274. text : "是否默认联系人",
  275. width : 200.0,
  276. dataIndex : "cc_default",
  277. xtype : "",
  278. renderer: function (v, m, r) {
  279. if(v=='0'){
  280. return '';
  281. }else if(v=='1'){
  282. return '是';
  283. }
  284. return v;
  285. }
  286. }]
  287. } ,{
  288. height: 169,
  289. xtype : "detailGridField",
  290. storeModel:'saas.model.document.customeraddress',
  291. detnoColumn: 'ca_detno',
  292. showCount: false,
  293. deleteDetailUrl:'/api/document/customer/deleteaddress/',
  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. xtype : "",
  315. items : null
  316. },
  317. {
  318. allowBlank:false,
  319. text : "联系人",
  320. editor : {
  321. xtype : "textfield"
  322. },
  323. dataIndex : "ca_person",
  324. xtype : "",
  325. items : null
  326. },
  327. {
  328. allowBlank:false,
  329. text : "联系电话",
  330. editor : {
  331. xtype : "textfield",
  332. hideTrigger:true,
  333. },
  334. dataIndex : "ca_phone",
  335. xtype : "",
  336. items : null
  337. },
  338. {
  339. editor : {
  340. editable:false,
  341. displayField : "display",
  342. format : "",
  343. hideTrigger : false,
  344. maxLength : 100.0,
  345. minValue : null,
  346. positiveNum : false,
  347. queryMode : "local",
  348. valueField : "value",
  349. xtype : "combo",
  350. store:{
  351. fields: ['display', 'value'],
  352. data : [
  353. {"display":"是", "value":'1'},
  354. {"display":"否", "value":'0'}
  355. ]
  356. },
  357. listeners:{
  358. 'change':function(c,newVal,oldVal){
  359. if(newVal=='1'){
  360. var grid = c.ownerCt.column.ownerCt.ownerCt;
  361. var nowId = grid.selModel.lastSelected.id;
  362. var items = grid.store.data.items
  363. for (let index = 0; index < items.length; index++) {
  364. if(items[index].id!=nowId){
  365. items[index].set('ca_default',"")
  366. }
  367. }
  368. }
  369. }
  370. }
  371. },
  372. text : "是否默认地址",
  373. dataIndex : "ca_default",
  374. xtype : "",
  375. renderer: function (v, m, r) {
  376. if(v=='0'){
  377. return '';
  378. }else if(v=='1'){
  379. return '是';
  380. }
  381. return v;
  382. }
  383. }]
  384. }],
  385. defaultButtons:[{
  386. cls: 'x-formpanel-btn-orange',
  387. xtype: 'button',
  388. text: '新增',
  389. bind: {
  390. hidden: '{!id}'
  391. },
  392. handler: 'add'
  393. }, {
  394. xtype: 'button',
  395. text: '保存',
  396. handler: 'onSave',
  397. }, {
  398. xtype: 'button',
  399. text: '删除',
  400. handler: 'delete'
  401. }, {
  402. xtype: 'button',
  403. bind: {
  404. text: '{auditBtnText}'
  405. },
  406. handler: "auditBtnClick",
  407. }],
  408. auditTexts: {
  409. auditCode: 'CLOSE',
  410. auditText: '已关闭',
  411. unAuditCode: 'OPEN',
  412. unAuditText: '已开启',
  413. auditBtnText: '禁用',
  414. unAuditBtnText: '启用',
  415. }
  416. });