|  | @@ -0,0 +1,151 @@
 | 
	
		
			
				|  |  | +$(function () {
 | 
	
		
			
				|  |  | +    $("#jqGrid").jqGrid({
 | 
	
		
			
				|  |  | +        url: '../supplier/list',
 | 
	
		
			
				|  |  | +        datatype: "json",
 | 
	
		
			
				|  |  | +        colModel: [
 | 
	
		
			
				|  |  | +			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
 | 
	
		
			
				|  |  | +			{label: '一级商户编号', name: 'levelMerchSn', index: 'level_merch_sn', width: 80},
 | 
	
		
			
				|  |  | +			{label: '一级商户标识', name: 'levelMerchFlag', index: 'level_merch_flag', width: 80},
 | 
	
		
			
				|  |  | +			{label: '二级供货商名称', name: 'childSupplierSn', index: 'child_supplier_sn', width: 80},
 | 
	
		
			
				|  |  | +			{label: '二级供货商标识', name: 'childSupplierFlag', index: 'child_supplier_flag', width: 80},
 | 
	
		
			
				|  |  | +			{label: '排序', name: 'sortOrder', index: 'sort_order', width: 80},
 | 
	
		
			
				|  |  | +			{label: '是否禁用:0:否;1:是', name: 'isShow', index: 'is_show', width: 80}],
 | 
	
		
			
				|  |  | +		viewrecords: true,
 | 
	
		
			
				|  |  | +        height: 385,
 | 
	
		
			
				|  |  | +        rowNum: 10,
 | 
	
		
			
				|  |  | +        rowList: [10, 30, 50],
 | 
	
		
			
				|  |  | +        rownumbers: true,
 | 
	
		
			
				|  |  | +        rownumWidth: 25,
 | 
	
		
			
				|  |  | +        autowidth: true,
 | 
	
		
			
				|  |  | +        multiselect: true,
 | 
	
		
			
				|  |  | +        pager: "#jqGridPager",
 | 
	
		
			
				|  |  | +        jsonReader: {
 | 
	
		
			
				|  |  | +            root: "page.list",
 | 
	
		
			
				|  |  | +            page: "page.currPage",
 | 
	
		
			
				|  |  | +            total: "page.totalPage",
 | 
	
		
			
				|  |  | +            records: "page.totalCount"
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        prmNames: {
 | 
	
		
			
				|  |  | +            page: "page",
 | 
	
		
			
				|  |  | +            rows: "limit",
 | 
	
		
			
				|  |  | +            order: "order"
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gridComplete: function () {
 | 
	
		
			
				|  |  | +            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +let vm = new Vue({
 | 
	
		
			
				|  |  | +	el: '#rrapp',
 | 
	
		
			
				|  |  | +	data: {
 | 
	
		
			
				|  |  | +        showList: true,
 | 
	
		
			
				|  |  | +        title: null,
 | 
	
		
			
				|  |  | +		supplier: {childSupplierSn: '', childSupplierFlag: '', isShow: 0},
 | 
	
		
			
				|  |  | +		ruleValidate: {
 | 
	
		
			
				|  |  | +            childSupplierSn: [
 | 
	
		
			
				|  |  | +				{required: true, message: '二级供货商名称不能为空', trigger: 'blur'}
 | 
	
		
			
				|  |  | +			],
 | 
	
		
			
				|  |  | +            childSupplierFlag: [
 | 
	
		
			
				|  |  | +                {required: true, message: '二级供货商标识不能为空', trigger: 'blur'}
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            isShow: [
 | 
	
		
			
				|  |  | +                {required: true, message: '是否禁用不能为空', trigger: 'blur'}
 | 
	
		
			
				|  |  | +            ]
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		q: {
 | 
	
		
			
				|  |  | +		    name: ''
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	methods: {
 | 
	
		
			
				|  |  | +		query: function () {
 | 
	
		
			
				|  |  | +			vm.reload();
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		add: function () {
 | 
	
		
			
				|  |  | +			vm.showList = false;
 | 
	
		
			
				|  |  | +			vm.title = "新增";
 | 
	
		
			
				|  |  | +			vm.supplier = {};
 | 
	
		
			
				|  |  | +            vm.getInfo(0)
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		update: function (event) {
 | 
	
		
			
				|  |  | +            let id = getSelectedRow();
 | 
	
		
			
				|  |  | +			if (id == null) {
 | 
	
		
			
				|  |  | +				return;
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			vm.showList = false;
 | 
	
		
			
				|  |  | +            vm.title = "修改";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            vm.getInfo(id)
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		saveOrUpdate: function (event) {
 | 
	
		
			
				|  |  | +            let url = vm.supplier.id == null ? "../supplier/save" : "../supplier/update";
 | 
	
		
			
				|  |  | +			$.ajax({
 | 
	
		
			
				|  |  | +				type: "POST",
 | 
	
		
			
				|  |  | +			    url: url,
 | 
	
		
			
				|  |  | +			    contentType: "application/json",
 | 
	
		
			
				|  |  | +			    data: JSON.stringify(vm.supplier),
 | 
	
		
			
				|  |  | +                success: function (r) {
 | 
	
		
			
				|  |  | +                    if (r.code === 0) {
 | 
	
		
			
				|  |  | +                        alert('操作成功', function (index) {
 | 
	
		
			
				|  |  | +                            vm.reload();
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        alert(r.msg);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +			});
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		del: function (event) {
 | 
	
		
			
				|  |  | +            let ids = getSelectedRows();
 | 
	
		
			
				|  |  | +			if (ids == null){
 | 
	
		
			
				|  |  | +				return;
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			confirm('确定要删除选中的记录?', function () {
 | 
	
		
			
				|  |  | +				$.ajax({
 | 
	
		
			
				|  |  | +					type: "POST",
 | 
	
		
			
				|  |  | +				    url: "../supplier/delete",
 | 
	
		
			
				|  |  | +				    contentType: "application/json",
 | 
	
		
			
				|  |  | +				    data: JSON.stringify(ids),
 | 
	
		
			
				|  |  | +				    success: function (r) {
 | 
	
		
			
				|  |  | +						if (r.code == 0) {
 | 
	
		
			
				|  |  | +							alert('操作成功', function (index) {
 | 
	
		
			
				|  |  | +								$("#jqGrid").trigger("reloadGrid");
 | 
	
		
			
				|  |  | +							});
 | 
	
		
			
				|  |  | +						} else {
 | 
	
		
			
				|  |  | +							alert(r.msg);
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				});
 | 
	
		
			
				|  |  | +			});
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		getInfo: function(id){
 | 
	
		
			
				|  |  | +			$.get("../supplier/info/"+id, function (r) {
 | 
	
		
			
				|  |  | +                vm.supplier = r.supplier;
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +        reloadSearch: function() {
 | 
	
		
			
				|  |  | +            vm.q = {
 | 
	
		
			
				|  |  | +                name: ''
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            vm.reload();
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +		reload: function (event) {
 | 
	
		
			
				|  |  | +			vm.showList = true;
 | 
	
		
			
				|  |  | +            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
 | 
	
		
			
				|  |  | +			$("#jqGrid").jqGrid('setGridParam', {
 | 
	
		
			
				|  |  | +                postData: {'name': vm.q.name},
 | 
	
		
			
				|  |  | +                page: page
 | 
	
		
			
				|  |  | +            }).trigger("reloadGrid");
 | 
	
		
			
				|  |  | +            vm.handleReset('formValidate');
 | 
	
		
			
				|  |  | +		},
 | 
	
		
			
				|  |  | +        handleSubmit: function (name) {
 | 
	
		
			
				|  |  | +            handleSubmitValidate(this, name, function () {
 | 
	
		
			
				|  |  | +                vm.saveOrUpdate()
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        handleReset: function (name) {
 | 
	
		
			
				|  |  | +            handleResetForm(this, name);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +});
 |