FormPanel.js 10 KB

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