FormPanel.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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.25
  32. },{
  33. xtype: 'textfield',
  34. name: 'cu_code',
  35. fieldLabel: '客户编号',
  36. allowBlank: true,
  37. columnWidth: 0.25
  38. },{
  39. xtype: 'textfield',
  40. name: 'cu_status',
  41. fieldLabel: '状态',
  42. allowBlank: true,
  43. columnWidth: 0.25
  44. },{
  45. xtype: 'hidden',
  46. name: 'cu_statuscode',
  47. fieldLabel: '状态码',
  48. allowBlank: true,
  49. columnWidth: 0.25
  50. },{
  51. editable:false,
  52. xtype : "remotecombo",
  53. storeUrl:'/api/document/customerkind/getCombo',
  54. name : "cu_type",
  55. fieldLabel : "客户类型",
  56. allowBlank : false,
  57. columnWidth : 0.25,
  58. hiddenBtn:false,//true 则会关闭新增按钮功能
  59. addHandler:function(b){
  60. var document = Ext.create('saas.view.document.kind.Kind',{});
  61. var form = this.ownerCmp.ownerCt;
  62. this.dialog = form.getController().getView().add({
  63. xtype: 'document-kind-childwin',
  64. bind: {
  65. title: '新增客户类型'
  66. },
  67. dataKind:'customerkind',
  68. belong:document.etc['customerkind'],
  69. _parent:form,
  70. _combo:this.ownerCmp,
  71. record:null,
  72. session: true
  73. });
  74. this.dialog.show();
  75. }
  76. },{
  77. xtype : "datefield",
  78. name : "createTime",
  79. fieldLabel : "创建时间",
  80. allowBlank : true,
  81. columnWidth : 0.25
  82. },{
  83. xtype : "datefield",
  84. name : "cu_begindate",
  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. },{
  96. xtype : "numberfield",
  97. hideTrigger:true,
  98. name : "cu_beginprerecamount",
  99. fieldLabel : "期初预收",
  100. allowBlank : true,
  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. name : "cu_taxrate",
  112. fieldLabel : "税率",
  113. allowBlank : false,
  114. columnWidth : 0.25
  115. },{
  116. // xtype : "numberfield",
  117. // name : "cu_ta",
  118. // fieldLabel : "应收款余额",
  119. // allowBlank : true,
  120. // readOnly:true,
  121. // editable:false,
  122. // columnWidth : 0.25
  123. },{
  124. xtype:'textfield',
  125. name : "cu_uu",
  126. fieldLabel : "客户UU",
  127. allowBlank : true,
  128. columnWidth : 0.25
  129. },{
  130. xtype : "datefield",
  131. name : "updateTime",
  132. fieldLabel : "更新时间",
  133. allowBlank : true,
  134. columnWidth : 0.25
  135. }, {
  136. height: 169,
  137. xtype : "detailGridField",
  138. storeModel:'saas.model.document.customercontact',
  139. detnoColumn: 'cc_detno',
  140. showCount: false,
  141. deleteDetailUrl:'/api/document/customer/deletecontact/',
  142. columns : [
  143. {
  144. text : "ID",
  145. dataIndex : "id",
  146. hidden : true,
  147. xtype : "numbercolumn"
  148. },
  149. {
  150. text : "关联ID",
  151. dataIndex : "cc_cuid",
  152. hidden : true,
  153. xtype : "numbercolumn"
  154. },
  155. {
  156. text : "联系人",
  157. editor : {
  158. xtype : "textfield"
  159. },
  160. dataIndex : "cc_name",
  161. xtype : "",
  162. items : null
  163. },
  164. {
  165. text : "电话",
  166. editor : {
  167. hideTrigger:true,
  168. xtype : "numberfield"
  169. },
  170. dataIndex : "cc_tel",
  171. xtype : "",
  172. items : null
  173. },
  174. {
  175. text : "微信/QQ",
  176. editor : {
  177. xtype : "textfield"
  178. },
  179. dataIndex : "cc_qq",
  180. xtype : "",
  181. items : null
  182. },
  183. {
  184. text : "邮箱",
  185. editor : {
  186. xtype : "textfield"
  187. },
  188. dataIndex : "cc_email",
  189. xtype : "",
  190. items : null
  191. },
  192. {
  193. editor : {
  194. displayField : "display",
  195. editable:false,
  196. format : "",
  197. hideTrigger : false,
  198. maxLength : 100.0,
  199. minValue : null,
  200. positiveNum : false,
  201. queryMode : "local",
  202. valueField : "value",
  203. xtype : "combo",
  204. store:{
  205. fields: ['display', 'value'],
  206. data : [
  207. {"display":"是", "value":'1'},
  208. {"display":"否", "value":'0'}
  209. ]
  210. },
  211. listeners:{
  212. 'change':function(c,newVal,oldVal){
  213. if(newVal=='1'){
  214. var grid = c.ownerCt.column.ownerCt.ownerCt;
  215. var nowId = grid.selModel.lastSelected.id;
  216. var items = grid.store.data.items
  217. for (let index = 0; index < items.length; index++) {
  218. if(items[index].id!=nowId){
  219. items[index].set('cc_default',"")
  220. }
  221. }
  222. }
  223. }
  224. }
  225. },
  226. text : "是否默认联系人",
  227. width : 200.0,
  228. dataIndex : "cc_default",
  229. xtype : "",
  230. renderer: function (v, m, r) {
  231. if(v=='0'){
  232. return '';
  233. }else if(v=='1'){
  234. return '是';
  235. }
  236. return v;
  237. }
  238. }]
  239. } ,{
  240. height: 169,
  241. xtype : "detailGridField",
  242. storeModel:'saas.model.document.customeraddress',
  243. detnoColumn: 'ca_detno',
  244. showCount: false,
  245. deleteDetailUrl:'/api/document/customer/deleteaddress/',
  246. columns : [
  247. {
  248. text : "ID",
  249. dataIndex : "id",
  250. hidden : true,
  251. xtype : "numbercolumn"
  252. },
  253. {
  254. text : "关联ID",
  255. dataIndex : "ca_cuid",
  256. hidden : true,
  257. xtype : "numbercolumn"
  258. },
  259. {
  260. text : "送货地址",
  261. editor : {
  262. xtype : "textfield"
  263. },
  264. dataIndex : "ca_address",
  265. xtype : "",
  266. items : null
  267. },
  268. {
  269. text : "联系人",
  270. editor : {
  271. xtype : "textfield"
  272. },
  273. dataIndex : "ca_person",
  274. xtype : "",
  275. items : null
  276. },
  277. {
  278. text : "联系电话",
  279. editor : {
  280. xtype : "numberfield",
  281. hideTrigger:true,
  282. },
  283. dataIndex : "ca_phone",
  284. xtype : "",
  285. items : null
  286. },
  287. {
  288. editor : {
  289. editable:false,
  290. displayField : "display",
  291. format : "",
  292. hideTrigger : false,
  293. maxLength : 100.0,
  294. minValue : null,
  295. positiveNum : false,
  296. queryMode : "local",
  297. valueField : "value",
  298. xtype : "combo",
  299. store:{
  300. fields: ['display', 'value'],
  301. data : [
  302. {"display":"是", "value":'1'},
  303. {"display":"否", "value":'0'}
  304. ]
  305. },
  306. listeners:{
  307. 'change':function(c,newVal,oldVal){
  308. if(newVal=='1'){
  309. var grid = c.ownerCt.column.ownerCt.ownerCt;
  310. var nowId = grid.selModel.lastSelected.id;
  311. var items = grid.store.data.items
  312. for (let index = 0; index < items.length; index++) {
  313. if(items[index].id!=nowId){
  314. items[index].set('ca_default',"")
  315. }
  316. }
  317. }
  318. }
  319. }
  320. },
  321. text : "是否默认地址",
  322. dataIndex : "ca_default",
  323. xtype : "",
  324. renderer: function (v, m, r) {
  325. if(v=='0'){
  326. return '';
  327. }else if(v=='1'){
  328. return '是';
  329. }
  330. return v;
  331. }
  332. }]
  333. }],
  334. auditTexts: {
  335. auditCode: 'CLOSE',
  336. auditText: '已关闭',
  337. unAuditCode: 'OPEN',
  338. unAuditText: '已开启',
  339. auditBtnText: '关闭',
  340. unAuditBtnText: '启用',
  341. },
  342. });