| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- /**
- * Created by zhouy on 2018/10/18.
- */
- Ext.define('saas.view.document.kind.Kind', {
- extend: 'Ext.panel.Panel',
- xtype: 'document-kind',
- autoScroll: true,
- layout:'fit',
- controller:'document-kind',
- viewModel: {
- type: 'document-kind'
- },
- //工具类
- FormUtil: Ext.create('saas.util.FormUtil'),
- BaseUtil: Ext.create('saas.util.BaseUtil'),
- defaultType:'',
- requires: [
- 'Ext.button.Segmented'
- ],
- tbar: [{
- xtype: 'segmentedbutton',
- reference: 'dataKind',
- value: 'customerkind',
- name : 'segmentedbutton',
- bind:'{segmented}',
- items: [{
- name:'customerkind',
- text: '客户',
- value: 'customerkind',
- typeText:'客户类型'
- }, {
- name:'vendorkind',
- text: '供应商',
- value: 'vendorkind',
- typeText:'供应商类型'
- }, {
- name:'productkind',
- text: '物料',
- value: 'productkind',
- typeText:'物料类型'
- }, {
- name:'inoutkind',
- text: '收支',
- value: 'inoutkind',
- typeText:'收支类别'
- }],
- listeners: {
- toggle: 'onKindToggle'
- }
- },'->',
- {
- xtype:'button',
- text:'新增',
- listeners: {
- click: 'onAdd'
- }
- },{
- xtype:'button',
- text:'刷新',
- listeners: {
- click: 'onRefresh'
- }
- }],
- items:[{
- xtype:'grid',
- reference: 'document-kind-Grid',
- margin: '10 0 0 0',
- flex: 1,
- frame:true,
- bind:{
- selection: '{selectedCompany}'
- },
- listeners:{
- render:'loadDefualt'
- }
- }],
- etc:{
- customerkind:{
- columns: [{
- text: '客户类型',
- dataIndex: 'ck_name',
- flex: 1
- }],
- keyField:'id',
- reqUrl:'/api/document/customerkind/save',
- delUrl:'/api/document/customerkind/delete'
- },
- vendorkind:{
- columns: [{
- text: '供应商类型',
- dataIndex: 'vk_name',
- flex: 1
- }],
- keyField:'id',
- reqUrl:'/api/document/vendorkind/save',
- delUrl:'/api/document/vendorkind/delete'
- },
- productkind:{
- columns: [{
- text: '物料类型',
- dataIndex: 'pt_name',
- flex: 1
- }],
- keyField:'id',
- reqUrl:'/api/document/producttype/save',
- delUrl:'/api/document/producttype/delete'
- },
- productbrand:{
- columns: [{
- text: '物料品牌',
- dataIndex: 'pb_name',
- flex: 1
- }],
- keyField:'id',
- reqUrl:'/api/document/productbrand/save',
- delUrl:'/api/document/productbrand/delete'
- },
- productunit:{
- columns: [{
- text: '计量单位',
- dataIndex: 'pu_name',
- flex: 1
- }],
- keyField:'id',
- reqUrl:'/api/document/productunit/save',
- delUrl:'/api/document/productunit/delete'
- },
- bankinformation:{
- columns: [{
- text: '账户编号',
- dataIndex: 'bk_bankcode',
- flex: 1
- },{
- text: '账户名称',
- dataIndex: 'bk_bankname',
- flex: 1
- },{
- xtype:'datecolumn',
- text: '建账日期',
- format:'Y-m-d H:i:s',
- dataIndex: 'bk_date',
- flex: 1
- },{
- text: '账户类别',
- dataIndex: 'bk_type',
- flex: 1
- },{
- text: '账户期初金额',
- dataIndex: 'bk_beginamount',
- flex: 1
- },{
- text: '账户期末余额',
- dataIndex: 'bk_thisamount',
- flex: 1
- }],
- keyField:'id',
- reqUrl: '/api/document/bankinformation/save',
- delUrl: '/api/document/bankinformation/delete'
- },
- inoutkind:{
- columns: [{
- text: '收支名称',
- dataIndex: 'ft_name',
- flex: 1
- },{
- text: '收支类别',
- dataIndex: 'ft_kind',
- flex: 1
- }],
- keyField:'id',
- reqUrl: '/api/document/fundinouttype/save',
- delUrl: '/api/document/fundinouttype/delete'
- },
- address:{
- columns: [{
- text: '地址名称',
- dataIndex: 'ad_address',
- flex: 1
- }],
- keyField:'id',
- reqUrl: '/api/document/address/save',
- delUrl: '/api/document/address/delete'
- },
- maxnumbers:{
- columns: [{
- text : "单据名称",
- width : 200.0,
- dataIndex : "mn_caller",
- xtype : "",
- },
- {
- text : "单据前缀",
- dataIndex : "mn_leadcode",
- width : 120.0,
- xtype : "",
- },
- {
- text : "单据规则",
- dataIndex : "mn_rule",
- width : 220.0,
- xtype : "",
- },{
- text : "流水长度",
- dataIndex : "mn_number",
- width : 120.0,
- xtype : "",
- }],
- keyField:'id',
- reqUrl:'/api/commons/number/save'
- },
- warehouse:{
- columns: [{
- text: '仓库编号',
- dataIndex: 'wh_code',
- width: 200
- },{
- text: '仓库名称',
- dataIndex: 'wh_description',
- width: 200
- },{
- text: '仓库类型',
- dataIndex: 'wh_type',
- width: 200
- },{
- text: '仓库状态码',
- dataIndex: 'wh_status',
- hidden:true,
- },{
- text: '仓库状态',
- dataIndex: 'wh_statuscode',
- width:90,
- xtype: 'actioncolumn',
- align : 'center',
- items: [{
- iconCls:'',
- getClass: function(v, meta, rec) {
- if(rec.get('wh_statuscode')=='OPEN'){
- return 'x-grid-checkcolumn-checked-btn';
- }else{
- return 'x-grid-checkcolumn-btn';
- }
- },
- handler: function(view, rowIndex, colIndex) {
- var rec = view.getStore().getAt(rowIndex);
- var type=rec.get('wh_statuscode')=='OPEN'?true:false;
- // 禁用/启用
- var form = this.ownerCt.ownerCt.ownerCt;
- var grid = this.ownerCt.ownerCt;
- form.BaseUtil.request({
- url: (!type?form._openUrl:form._closeUrl)+'/'+rec.get('id'),
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- showToast('操作成功');
- grid.store.load();
- }
- })
- .catch(function(res) {
- console.error(res);
- showToast('操作失败: ' + res.message);
- });
- }
- }]
- }],
- keyField:'id',
- reqUrl: '/api/document/warehouse/save',
- delUrl: '/api/document/warehouse/delete'
- }
- },
- refresh:function(){
- var me = this;
- var grid = me.items.items[0];
- var button = grid.ownerCt.dockedItems.items[0].down('[name='+grid.ownerCt.ownerCt.viewConfig+']');
-
- if(button){
- button.click();
- me.ownerCt.setTitle(button.typeText + '查询');
- }
- }
- })
|