FormPanel.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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: false,
  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:'hidden',
  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. xtype : "textfield",
  210. name : "ve_address",
  211. fieldLabel : "地址",
  212. allowBlank : true,
  213. columnWidth : 1
  214. },{
  215. fieldLabel : "备注",
  216. xtype:'textfield',
  217. name : "ve_remark",
  218. columnWidth : 1
  219. }, {
  220. xtype : "detailGridField",
  221. storeModel:'saas.model.document.vendorcontact',
  222. detnoColumn: 'vc_detno',
  223. showCount: false,
  224. deleteDetailUrl:'/api/document/vendor/deleteContact',
  225. columns : [
  226. {
  227. text : "ID",
  228. dataIndex : "id",
  229. hidden : true,
  230. xtype : "numbercolumn"
  231. },
  232. {
  233. text : "关联ID",
  234. dataIndex : "vc_veid",
  235. hidden : true,
  236. xtype : "numbercolumn"
  237. },
  238. {
  239. allowBlank:false,
  240. text : "联系人",
  241. editor : {
  242. xtype : "textfield"
  243. },
  244. dataIndex : "vc_name",
  245. width:110
  246. },
  247. {
  248. allowBlank:false,
  249. text : "电话",
  250. editor : {
  251. hideTrigger:true,
  252. xtype : "textfield"
  253. },
  254. dataIndex : "vc_tel",
  255. width:110
  256. },
  257. {
  258. allowBlank:true,
  259. text : "微信/QQ",
  260. editor : {
  261. xtype : "textfield"
  262. },
  263. dataIndex : "vc_qq",
  264. width:110
  265. },
  266. {
  267. text : "邮箱",
  268. editor : {
  269. xtype : "textfield"
  270. },
  271. dataIndex : "vc_email",
  272. width:180
  273. },
  274. {
  275. editor : {
  276. displayField : "display",
  277. editable:true,
  278. format : "",
  279. hideTrigger : false,
  280. maxLength : 100.0,
  281. minValue : null,
  282. positiveNum : false,
  283. queryMode : "local",
  284. valueField : "value",
  285. xtype : "combo",
  286. store:{
  287. fields: ['display', 'value'],
  288. data : [
  289. {"display":"是", "value":'1'},
  290. {"display":"否", "value":'0'}
  291. ]
  292. },
  293. listeners:{
  294. 'change':function(c,newVal,oldVal){
  295. if(newVal=='1'){
  296. var grid = c.ownerCt.column.ownerCt.ownerCt;
  297. var nowId = grid.selModel.lastSelected.id;
  298. var items = grid.store.data.items
  299. for (let index = 0; index < items.length; index++) {
  300. if(items[index].id!=nowId){
  301. items[index].set('vc_default',"")
  302. }
  303. }
  304. }
  305. }
  306. }
  307. },
  308. text : "默认联系人",
  309. dataIndex : "vc_default",
  310. xtype : "",
  311. renderer: function (v, m, r) {
  312. if(v=='0'){
  313. return '';
  314. }else if(v=='1'){
  315. return '是';
  316. }
  317. return v;
  318. }
  319. }]
  320. }
  321. ],
  322. defaultButtons:[{
  323. cls: 'x-formpanel-btn-blue',
  324. xtype: 'button',
  325. text: '新增',
  326. bind: {
  327. hidden: '{!id}'
  328. },
  329. handler: 'add'
  330. }, {
  331. xtype: 'button',
  332. text: '保存',
  333. handler: 'onSave',
  334. }, {
  335. xtype: 'button',
  336. text: '删除',
  337. handler: 'delete'
  338. }, {
  339. xtype: 'button',
  340. bind: {
  341. text: '{auditBtnText}'
  342. },
  343. handler: "auditBtnClick",
  344. }],
  345. auditTexts: {
  346. auditCode: 'BANNED',
  347. auditText: '已禁用',
  348. unAuditCode: 'ENABLE',
  349. unAuditText: '已启用',
  350. auditBtnText: '禁用',
  351. unAuditBtnText: '启用',
  352. }
  353. });