123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- define(function (require) {
- return function (context) {
- var $grid, $form;
- //列表查询
- function queryGrid1() {
- $grid.jqGrid("clearGridData"); // 清除表格数据
- var obj = $form.formGet();
- $grid.reload({
- url: api('/sys/Code/query'),
- mtype: 'POST',
- queryParams: obj
- });
- }
- return {
- onRender: function () {
- queryGrid1();
- },
- north: {
- border: false,
- split: true,
- height: 90,
- items: [{
- xtype: 'toolbar',
- title: 'ID管理',
- items: [
- {
- text: '查询', iconCls: 'fa fa-search', onClick: function () {
- queryGrid1();
- }
- },
- {
- text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
- $form.formClear();
- queryGrid1();
- }
- },
- {
- text: '新增', iconCls: 'fa fa-plus-circle', onClick: function () {
- var dlg = require('/app/sys/sysCode/dialogId.js')({
- isEdit: false,
- ok: function () {
- $grid.reload();
- }
- });
- $.yvan.showDialog(this, dlg);
- }
- },
- {
- text: '编辑', iconCls: 'fa fa-pencil-square-o', onClick: function () {
- var row = $grid.rowData();
- if (!row) {
- $.yvan.msg('请选择一行数据');
- }
- var dlg = require('/app/sys/sysCode/dialogId.js')({
- isEdit: true,
- row: row,
- ok: function () {
- $grid.reload();
- }
- });
- $.yvan.showDialog(this, dlg);
- }
- },
- {
- text: '删除', iconCls: 'fa fa-trash-o fa-lg', onClick: function () {
- var row = $grid.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- $.yvan.confirm('确定删除ID标识[' + row.idName + "] ?", {
- yes: function () {
- $.yvan.ajax({
- url: api('/sys/Code/delete'),
- data: {
- idName: row.idName
- },
- method: 'post',
- success: function (data) {
- $.yvan.msg(data.msg);
- $grid.reload();
- },
- error: function (data) {
- $.yvan.msg(data.msg);
- }
- });
- }
- });
- }
- },
- {
- text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
- App.closeMe();
- }
- }
- ]
- }, {
- xtype: 'form',
- onRender: function () {
- $form = $(this);
- },
- items: [[
- {name: 'idName', label: 'ID标识'},
- {name: 'idDesc', label: '标识说明'}
- ]]
- }]
- },
- center: {
- border: true,
- split: true,
- items: {
- xtype: 'grid',
- onRender: function () {
- $grid = $(this);
- },
- // dataProcess: function (root) {
- // for (var i = 0; i < root.data.length; i++) {
- // root.data[i].idDesc = root.data[i].idDesc + "aaa";
- // }
- // },
- toolbar: {
- xtype: 'toolbar',
- title: 'ID列表'
- },
- idField: 'idName',
- columns: [[
- {field: 'idName', title: 'ID标识'},
- {field: 'idDesc', title: '标识说明'},
- {field: 'idType', title: '编号生成规则'},
- {field: 'idExpress', title: '序号类型'}
- ]]
- }
- }
- }
- }
- });
|