FormPanel.js 13 KB

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