FormPanel.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. Ext.define('saas.view.document.vendor.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'document-vendor-formpanel',
  4. controller: 'document-vendor-formpanel',
  5. viewModel: 'document-vendor-formpanel',
  6. caller:'Vendor',
  7. //字段属性
  8. _title:'供应商资料',
  9. _idField: 'id',
  10. _codeField: 've_code',
  11. _statusField: 've_status',
  12. _statusCodeField: 've_statuscode',
  13. _readUrl:'/api/document/vendor/read',
  14. _saveUrl:'/api/document/vendor/save',
  15. _openUrl:'/api/document/vendor/open',
  16. _closeUrl:'/api/document/vendor/close',
  17. _deleteUrl:'/api/document/vendor/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: 've_code',
  29. fieldLabel: '供应商编号',
  30. allowBlank: false,
  31. columnWidth: 0.25
  32. },{
  33. xtype: 'textfield',
  34. name: 've_shortname',
  35. fieldLabel: '供应商简称',
  36. allowBlank: true,
  37. columnWidth: 0.25
  38. },{
  39. xtype: 'textfield',
  40. name: 've_name',
  41. fieldLabel: '供应商名称',
  42. allowBlank: false,
  43. columnWidth: 0.25
  44. },{
  45. xtype: 'hidden',
  46. name: 've_status',
  47. fieldLabel: '状态',
  48. allowBlank: true,
  49. columnWidth: 0.25
  50. },{
  51. xtype: 'hidden',
  52. name: 've_statuscode',
  53. fieldLabel: '状态码',
  54. allowBlank: true,
  55. columnWidth: 0.25
  56. },{
  57. editable:false,
  58. xtype : "remotecombo",
  59. storeUrl:'/api/document/vendorkind/getCombo',
  60. name : "ve_type",
  61. fieldLabel : "供应商类型",
  62. columnWidth : 0.25,
  63. addHandler:function(b){
  64. var document = Ext.create('saas.view.document.kind.Kind',{});
  65. var form = this.ownerCmp.ownerCt;
  66. this.dialog = form.getController().getView().add({
  67. xtype: 'document-kind-childwin',
  68. bind: {
  69. title: '新增供应商类型'
  70. },
  71. dataKind:'vendorkind',
  72. belong:document.etc['vendorkind'],
  73. _parent:form,
  74. _combo:this.ownerCmp,
  75. record:null,
  76. session: true
  77. });
  78. this.dialog.show();
  79. }
  80. },{
  81. xtype : "datefield",
  82. name : "createTime",
  83. fieldLabel : "创建时间",
  84. allowBlank : true,
  85. hidden:true,
  86. columnWidth : 0
  87. },{
  88. xtype : "datefield",
  89. name : "ve_begindate",
  90. format:'Y-m-d',
  91. fieldLabel : "期初日期",
  92. allowBlank : true,
  93. columnWidth : 0.25
  94. },{
  95. xtype : "numberfield",
  96. hideTrigger:true,
  97. name : "ve_beginapamount",
  98. fieldLabel : "期初应付",
  99. allowBlank : true,
  100. columnWidth : 0.25,
  101. decimalPrecision: 2,
  102. minValue:0,
  103. renderer : function(v) {
  104. var arr = (v + '.').split('.');
  105. var xr = (new Array(arr[1].length)).fill('0');
  106. var format = '0.' + xr.join();
  107. return Ext.util.Format.number(v, format);
  108. },
  109. },{
  110. xtype : "numberfield",
  111. hideTrigger:true,
  112. name : "ve_beginprepayamount",
  113. fieldLabel : "期初预付",
  114. allowBlank : true,
  115. columnWidth : 0.25,
  116. decimalPrecision: 2,
  117. minValue:0,
  118. renderer : function(v) {
  119. var arr = (v + '.').split('.');
  120. var xr = (new Array(arr[1].length)).fill('0');
  121. var format = '0.' + xr.join();
  122. return Ext.util.Format.number(v, format);
  123. },
  124. },{
  125. xtype : "numberfield",
  126. name : "ve_taxrate",
  127. hideTrigger:true,
  128. fieldLabel : "税率",
  129. allowBlank : false,
  130. columnWidth : 0.25,
  131. minValue:0,
  132. maxValue:100,
  133. },{
  134. xtype : "numberfield",
  135. hideTrigger:true,
  136. name : "ve_promisedays",
  137. fieldLabel : "结算天数",
  138. allowBlank : true,
  139. columnWidth : 0.25,
  140. minValue:0,
  141. maxLength: 8,
  142. enforceMaxLength: true,
  143. decimalPrecision: 0
  144. },{
  145. xtype : "textfield",
  146. name : "ve_nsrzh",
  147. fieldLabel : "纳税人识别号",
  148. allowBlank : true,
  149. columnWidth : 0.25
  150. },{
  151. xtype : "textfield",
  152. name : "ve_bankcode",
  153. fieldLabel : "开户银行",
  154. allowBlank : true,
  155. columnWidth : 0.25
  156. },{
  157. xtype : "textfield",
  158. name : "ve_bankaccount",
  159. fieldLabel : "银行账户",
  160. allowBlank : true,
  161. columnWidth : 0.25
  162. },{
  163. xtype:'textfield',
  164. name : "ve_uu",
  165. fieldLabel : "供应商UU",
  166. allowBlank : true,
  167. editable:false,
  168. readOnly:true,
  169. columnWidth : 0.25
  170. },{
  171. xtype : "datefield",
  172. name : "updateTime",
  173. fieldLabel : "更新时间",
  174. allowBlank : true,
  175. hidden:true,
  176. columnWidth : 0.25
  177. },{
  178. xtype : "numberfield",
  179. name : "ve_leftamount",
  180. fieldLabel : "应付款余额",
  181. allowBlank : true,
  182. readOnly:true,
  183. ignore:true,
  184. columnWidth : 0.25,
  185. decimalPrecision: 8,
  186. renderer : function(v) {
  187. var arr = (v + '.').split('.');
  188. var xr = (new Array(arr[1].length)).fill('0');
  189. var format = '0.' + xr.join();
  190. return Ext.util.Format.number(v, format);
  191. },
  192. },
  193. {
  194. xtype : "hidden",
  195. name : "ve_buyercode",
  196. fieldLabel : "采购员编号"
  197. },{
  198. xtype : "employeeDbfindTrigger",
  199. name : "ve_buyername",
  200. fieldLabel : "采购员",
  201. columnWidth : 0.25,
  202. defaultValue:saas.util.BaseUtil.getCurrentUser().realname
  203. },{
  204. xtype : "hidden",
  205. name : "ve_buyerid",
  206. fieldLabel : "采购员ID",
  207. defaultValue:saas.util.BaseUtil.getCurrentUser().id
  208. },{
  209. fieldLabel : "备注",
  210. xtype:'textfield',
  211. name : "ve_remark",
  212. columnWidth : 1
  213. }, {
  214. xtype : "detailGridField",
  215. storeModel:'saas.model.document.vendorcontact',
  216. detnoColumn: 'vc_detno',
  217. showCount: false,
  218. deleteDetailUrl:'/api/document/vendor/deleteContact',
  219. columns : [
  220. {
  221. text : "ID",
  222. dataIndex : "id",
  223. hidden : true,
  224. xtype : "numbercolumn"
  225. },
  226. {
  227. text : "关联ID",
  228. dataIndex : "vc_veid",
  229. hidden : true,
  230. xtype : "numbercolumn"
  231. },
  232. {
  233. allowBlank:false,
  234. text : "联系人",
  235. editor : {
  236. xtype : "textfield"
  237. },
  238. dataIndex : "vc_name",
  239. width:110
  240. },
  241. {
  242. allowBlank:false,
  243. text : "电话",
  244. editor : {
  245. hideTrigger:true,
  246. xtype : "textfield"
  247. },
  248. dataIndex : "vc_tel",
  249. width:110
  250. },
  251. {
  252. allowBlank:true,
  253. text : "微信/QQ",
  254. editor : {
  255. xtype : "textfield"
  256. },
  257. dataIndex : "vc_qq",
  258. width:110
  259. },
  260. {
  261. text : "邮箱",
  262. editor : {
  263. xtype : "textfield"
  264. },
  265. dataIndex : "vc_email",
  266. width:180
  267. },
  268. {
  269. editor : {
  270. displayField : "display",
  271. editable:true,
  272. format : "",
  273. hideTrigger : false,
  274. maxLength : 100.0,
  275. minValue : null,
  276. positiveNum : false,
  277. queryMode : "local",
  278. valueField : "value",
  279. xtype : "combo",
  280. store:{
  281. fields: ['display', 'value'],
  282. data : [
  283. {"display":"是", "value":'1'},
  284. {"display":"否", "value":'0'}
  285. ]
  286. },
  287. listeners:{
  288. 'change':function(c,newVal,oldVal){
  289. if(newVal=='1'){
  290. var grid = c.ownerCt.column.ownerCt.ownerCt;
  291. var nowId = grid.selModel.lastSelected.id;
  292. var items = grid.store.data.items
  293. for (let index = 0; index < items.length; index++) {
  294. if(items[index].id!=nowId){
  295. items[index].set('vc_default',"")
  296. }
  297. }
  298. }
  299. }
  300. }
  301. },
  302. text : "默认联系人",
  303. dataIndex : "vc_default",
  304. xtype : "",
  305. renderer: function (v, m, r) {
  306. if(v=='0'){
  307. return '';
  308. }else if(v=='1'){
  309. return '是';
  310. }
  311. return v;
  312. }
  313. }]
  314. }
  315. ],
  316. defaultButtons:[{
  317. cls: 'x-formpanel-btn-blue',
  318. xtype: 'button',
  319. text: '新增',
  320. bind: {
  321. hidden: '{!id}'
  322. },
  323. handler: 'add'
  324. }, {
  325. xtype: 'button',
  326. text: '保存',
  327. handler: 'onSave',
  328. }, {
  329. xtype: 'button',
  330. text: '删除',
  331. handler: 'delete'
  332. }, {
  333. xtype: 'button',
  334. bind: {
  335. text: '{auditBtnText}'
  336. },
  337. handler: "auditBtnClick",
  338. }],
  339. auditTexts: {
  340. auditCode: 'BANNED',
  341. auditText: '已禁用',
  342. unAuditCode: 'ENABLE',
  343. unAuditText: '已启用',
  344. auditBtnText: '禁用',
  345. unAuditBtnText: '启用',
  346. }
  347. });