|
@@ -0,0 +1,155 @@
|
|
|
|
+$(function () {
|
|
|
|
+ $("#jqGrid").jqGrid({
|
|
|
|
+ url: '../goodsbatch/list',
|
|
|
|
+ datatype: "json",
|
|
|
|
+ colModel: [
|
|
|
|
+ {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
|
|
|
|
+ {label: '批次编号', name: 'batchSn', index: 'batch_sn', width: 280},
|
|
|
|
+ {label: 'sku', name: 'sku', index: 'sku', width: 280},
|
|
|
|
+ {label: '批次到期日期', name: 'batchExpireDate', index: 'batch_expire_date', align: 'center',width: 280,formatter: function (value) {
|
|
|
|
+ return transDate(value,'yyyy-MM-dd hh:mm:ss');
|
|
|
|
+ }}
|
|
|
|
+ // {label: '', name: 'createrSn', index: 'creater_sn', width: 80},
|
|
|
|
+ // {label: '', name: 'createTime', index: 'create_time', width: 80},
|
|
|
|
+ // {label: '', name: 'moderSn', index: 'moder_sn', width: 80},
|
|
|
|
+ // {label: '', name: 'modTime', index: 'mod_time', width: 80},
|
|
|
|
+ // {label: '', name: 'tstm', index: 'tstm', width: 80}
|
|
|
|
+ ],
|
|
|
|
+ viewrecords: true,
|
|
|
|
+ height: 550,
|
|
|
|
+ rowNum: 10,
|
|
|
|
+ rowList: [10, 30, 50],
|
|
|
|
+ rownumbers: true,
|
|
|
|
+ rownumWidth: 25,
|
|
|
|
+ autowidth: true,
|
|
|
|
+ shrinkToFit: false,
|
|
|
|
+ autoScroll: true, //开启水平滚动条
|
|
|
|
+ width: 1500,
|
|
|
|
+ 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": "scroll"});
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+let vm = new Vue({
|
|
|
|
+ el: '#rrapp',
|
|
|
|
+ data: {
|
|
|
|
+ showList: true,
|
|
|
|
+ title: null,
|
|
|
|
+ goodsBatch: {},
|
|
|
|
+ ruleValidate: {
|
|
|
|
+ name: [
|
|
|
|
+ {required: true, message: '名称不能为空', trigger: 'blur'}
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ q: {
|
|
|
|
+ name: ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ query: function () {
|
|
|
|
+ vm.reload();
|
|
|
|
+ },
|
|
|
|
+ add: function () {
|
|
|
|
+ vm.showList = false;
|
|
|
|
+ vm.title = "新增";
|
|
|
|
+ vm.goodsBatch = {};
|
|
|
|
+ },
|
|
|
|
+ update: function (event) {
|
|
|
|
+ let id = getSelectedRow();
|
|
|
|
+ if (id == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ vm.showList = false;
|
|
|
|
+ vm.title = "修改";
|
|
|
|
+
|
|
|
|
+ vm.getInfo(id)
|
|
|
|
+ },
|
|
|
|
+ saveOrUpdate: function (event) {
|
|
|
|
+ let url = vm.goodsBatch.id == null ? "../goodsbatch/save" : "../goodsbatch/update";
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ url: url,
|
|
|
|
+ contentType: "application/json",
|
|
|
|
+ data: JSON.stringify(vm.goodsBatch),
|
|
|
|
+ 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: "../goodsbatch/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("../goodsbatch/info/"+id, function (r) {
|
|
|
|
+ vm.goodsBatch = r.goodsBatch;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ reloadSearch: function() {
|
|
|
|
+ vm.q = {
|
|
|
|
+ name: ''
|
|
|
|
+ }
|
|
|
|
+ vm.reload();
|
|
|
|
+ },
|
|
|
|
+ reload: function (event) {
|
|
|
|
+ vm.showList = true;
|
|
|
|
+ let page = $("#jqGrid").jqGrid('getGridParam', 'page');
|
|
|
|
+ $("#jqGrid").jqGrid('setGridParam', {
|
|
|
|
+ postData: {
|
|
|
|
+ 'batchSn': vm.q.batchSn,
|
|
|
|
+ 'sku': vm.q.sku
|
|
|
|
+ },
|
|
|
|
+ page: page
|
|
|
|
+ }).trigger("reloadGrid");
|
|
|
|
+ vm.handleReset('formValidate');
|
|
|
|
+ },
|
|
|
|
+ handleSubmit: function (name) {
|
|
|
|
+ handleSubmitValidate(this, name, function () {
|
|
|
|
+ vm.saveOrUpdate()
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handleReset: function (name) {
|
|
|
|
+ handleResetForm(this, name);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+});
|