|
@@ -0,0 +1,164 @@
|
|
|
+$(function () {
|
|
|
+ $("#jqGrid").jqGrid({
|
|
|
+ url: '../syscusnationcode/list',
|
|
|
+ datatype: "json",
|
|
|
+ colModel: [
|
|
|
+ {label: 'sn', name: 'sn', index: 'sn', key: true, hidden: true},
|
|
|
+ {label: '代码', name: 'code', index: 'code', width: 80},
|
|
|
+ {label: '名称(简称)', name: 'name', index: 'name', width: 80},
|
|
|
+ {label: '英文名(简称)', name: 'ename', index: 'ename', width: 80},
|
|
|
+ {label: '优普税率类型', name: 'discountsTaxType', index: 'discounts_tax_type', width: 80},
|
|
|
+ {
|
|
|
+ label: '是否有效',
|
|
|
+ name: 'isValid',
|
|
|
+ align: 'center',
|
|
|
+ index: 'is_valid',
|
|
|
+ width: '50px',
|
|
|
+ formatter: function (value) {
|
|
|
+ if(value == 0){
|
|
|
+ value = 1;
|
|
|
+ }else if(value == 1){
|
|
|
+ value = 0;
|
|
|
+ }
|
|
|
+ return transIsNot(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {label: '备注', name: 'remark', index: 'remark', 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,
|
|
|
+ sysCusNationCode: {code:'',name:'',ename:'',discountsTaxType:'',isValid:'',remark:''},
|
|
|
+ ruleValidate: {
|
|
|
+ code: [
|
|
|
+ {required: true, message: '代码不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ {required: true, message: '名称(简称)不能为空', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ ename: [
|
|
|
+ {required: true, message: '英文名(简称)不能为空', trigger: 'blur'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ q: {
|
|
|
+ name: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ query: function () {
|
|
|
+ vm.reload();
|
|
|
+ },
|
|
|
+ add: function () {
|
|
|
+ vm.showList = false;
|
|
|
+ vm.title = "新增";
|
|
|
+ vm.sysCusNationCode = {};
|
|
|
+ },
|
|
|
+ update: function (event) {
|
|
|
+ let sn = getSelectedRow();
|
|
|
+ if (sn == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vm.showList = false;
|
|
|
+ vm.title = "修改";
|
|
|
+
|
|
|
+ vm.getInfo(sn)
|
|
|
+ },
|
|
|
+ saveOrUpdate: function (event) {
|
|
|
+ let url = vm.sysCusNationCode.sn == null ? "../syscusnationcode/save" : "../syscusnationcode/update";
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: url,
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(vm.sysCusNationCode),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code === 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ vm.reload();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ del: function (event) {
|
|
|
+ let sns = getSelectedRows();
|
|
|
+ if (sns == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ confirm('确定要删除选中的记录?', function () {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "../syscusnationcode/delete",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(sns),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code == 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getInfo: function(sn){
|
|
|
+ $.get("../syscusnationcode/info/"+sn, function (r) {
|
|
|
+ vm.sysCusNationCode = r.sysCusNationCode;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|