FormPanel.js 10 KB

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