123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- define(function (require) {
- return function (context) {
- var $dlg, $grid;
- // 查询列表
- function queryGrid1() {
- var queryUrl = '/sys/sysDictTpDet/query';// 自行替换此参数
- $grid.jqGrid("clearGridData");
- $grid.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: {"dictTp": context.dictTp, "treeUp": context.treeUp}
- });
- }
- //编辑工具栏
- var gridToolbarTitle = '字典列表';// 自行替换此参数
- var gridToolbar = {
- xtype: 'toolbar', title: gridToolbarTitle, items: [
- {
- text: '上移', iconCls: 'fa fa-arrow-up', onClick: function () {
- $grid.moveUp();
- }
- },
- {
- text: '下移', iconCls: 'fa fa-arrow-down', onClick: function () {
- $grid.moveDown();
- }
- },
- {
- text: '保存排序', iconCls: 'fa fa-check-square', onClick: function () {
- moveGrid();
- }
- }
- ]
- }
- //保存排序
- function moveGrid() {
- var gridData = $grid.jqGrid("getRowData");
- var list = [];
- for (var i = 0; i < gridData.length; i++) {
- list.push(gridData[i].dictId);
- }
- var treeCode = "";
- if (context.treeLev > 1) {
- treeCode = context.treeCode.substr(0, 3);
- }
- saveSort("sysDict", list, context.dictTp, treeCode);
- }
- function saveSort(name, ids, dicttp, codeup) {
- var data = {
- "ids": "",
- "name": name,
- "sysId": dicttp,
- "codeUp": codeup,
- };
- for (var i = 0; i < ids.length; i++) {
- data.ids += ids[i] + ","
- }
- data.ids = data.ids.substr(0, data.ids.length - 1);
- if (data.ids == "") {
- return;
- }
- $.yvan.ajax({
- url: api('/core/app/updateCoreSortCode'),
- method: 'post',
- data: data,
- beforeSend: function () {
- $.yvan.progress();
- },
- success: function () {
- $.yvan.msg('操作成功');
- $dlg.window('close');
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- },
- complete: function () {
- $.yvan.closep();
- }
- });
- }
- return {
- xtype: 'dialog',
- dialogId: 'dialogWfStepSort',
- title: '维护字典排序',
- width: 500,
- height: 650,
- onOpen: function () {
- $dlg = $(this);
- },
- center: {
- border: false,
- items: {
- onRender: function () {
- $grid = $(this);
- queryGrid1();
- },
- xtype: 'grid',
- pagination: false,
- idField: "sysDictSort",
- toolbar: {
- xtype: 'div',
- items: [
- gridToolbar
- ]
- },
- columns: [[
- {title: '字典ID', field: 'dictId', hidden: true},
- {title: '字典名称', field: 'dictName'},
- {title: '字典值', field: 'dictCode'},
- {title: '启用状态', field: 'status', align: 'center', formatter: $.fn.fmatter.statusView}, //增加字典,显示正常
- ]]
- }
- }
- };
- };
- });
|