123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- define(function (require) {
- return function () {
- var $grid1, $grid2, $form;
- // 输入搜索文本后点击回车按钮查询列表
- function enterQueryGrid1(e) {
- if (e.keyCode === 13) {
- var tmp = $(this).val();
- $form.formSet({queryProperties: tmp});
- queryGrid1();
- }
- }
- // 查询列表
- function queryGrid1() {
- var queryUrl = '/sys/sysImport/query';// 自行替换此参数
- $grid1.jqGrid("clearGridData");
- var queryForm = $form.formGet();
- $grid1.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryForm
- }, true);
- }
- function queryGrid2(rowid) {
- var row = $grid1.rowData(rowid);
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- var queryUrl = '/sys/sysImportItem/query';// 自行替换此参数
- var queryData = {importId: row.importId/*, ownerId: $form.formGet().ownerId*/};// 多个参数自行添加
- $grid2.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryData
- });
- }
- // 更新启用停用状态
- function updateStatus(aurl, acurstatus, atostatus, row) {
- var aname = $.fn.fmatter.tbNameSrc(row.tbName);
- var obj = {};
- obj.name = aname;// 自行替换此参数
- obj.status = acurstatus;
- obj.tostatus = atostatus;
- obj.isTree = 0;// 树为1,非树为0
- obj = setStatusMsg(obj); //返回rtnStatus
- var msg = obj.msg;
- // var status = obj.rtnStatus;
- /*|-----------------------自行替换start-----------------------*/
- var apiUrl = aurl;// 自行替换此参数
- var apiData = {
- importId: row.importId,// 自行替换此参数
- status: atostatus
- };
- /*-----------------------自行替换end-----------------------|*/
- $.yvan.confirm(msg, {
- yes: function (index) {
- $.yvan.ajax({
- method: 'post',
- url: api(apiUrl),
- data: apiData,
- success: function (data) {
- $.yvan.msg(data.msg);
- $grid1.reload();
- }
- });
- }
- });
- }
- // 删除//status整体状态:-2删除、-1停用、0草稿、1发布
- function shanChu() {
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- if (0 != row.status) {
- $.yvan.msg('只有草稿状态的数据才能删除');
- return;
- }
- var acurstatus = row.status;
- var atostatus = -2;
- var aurl = '/sys/sysImport/updateShanChu';
- updateStatus(aurl, acurstatus, atostatus, row);
- }
- // 发布
- function faBu() {
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- if (0 == row.status) {
- } else {
- $.yvan.msg('只有草稿状态的数据才能发布');
- return;
- }
- if (parseInt(row.dataNum) == 0) {
- $.yvan.msg('不能发布未导入Excel详情数据的记录');
- return;
- }
- var acurstatus = row.status;
- var atostatus = 1;
- var aurl = '/excel/pms/pmsPgh/faBu';
- updateStatus(aurl, acurstatus, atostatus, row);
- }
- // 导出
- function exportExcel() {
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- if (0 == row.status) {
- } else {
- $.yvan.msg('只有草稿状态的数据才能导出');
- return;
- }
- if (parseInt(row.dataNum) == 0) {
- $.yvan.msg('不能导出未导入Excel详情数据的记录');
- return;
- }
- var apiUrl = '/excel/pms/pmsPgh/exportData';// 自行替换此参数
- var apiData = {
- importId: row.importId,// 自行替换此参数
- // status: atostatus
- };
- $.yvan.download({
- method: 'get',
- url: api('/excel/pms/pmsPgh/exportData?importId=' + row.importId),
- // url: api('/excel/pms/pmsPgh/exportData'),
- data: apiData,
- fileName: '派工号导出-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
- });
- }
- // 搜索按钮
- var queryToolbarTitle = 'Excel导入管理';// 自行替换此参数
- var queryToolbar = {
- xtype: 'toolbar', title: queryToolbarTitle, items: [
- {
- text: '查询', iconCls: 'fa fa-search', onClick: function () {
- queryGrid1();
- }
- }, {
- text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
- $form.formClear();
- queryGrid1();
- }
- }, {
- text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
- App.closeMe(this);
- }
- }
- ]
- };
- // 搜索条件
- var queryFormPrompt = '表名';// 自行替换此参数
- var queryForm = {
- onRender: function () {
- $form = $(this);
- },
- xtype: 'form',
- items: [[
- {
- xtype: 'textbox',
- label: '检索条件',
- name: 'queryProperties',
- prompt: queryFormPrompt,
- labelWidth: 'auto',
- events: {keydown: enterQueryGrid1},
- },
- {
- xtype: 'yvselect', label: '整体状态', name: 'status', labelWidth: 'auto', width: 180,
- data: $.yvan.sysDict('allStatus').combowithAll(), value: '',
- onChange: function () {
- queryGrid1();
- }
- },
- ]]
- };
- // 列表1增删改查按钮
- var gridToolbarTitle1 = 'Excel导入列表';// 自行替换此参数
- var gridToolbar1 = {
- xtype: 'toolbar',
- title: gridToolbarTitle1,
- items: [
- {
- text: '临时数据删除', iconCls: 'fa fa-trash-o fa-lg', onClick: function () {
- shanChu();
- }
- }
- ]
- };
- // 列表2增删改查按钮
- var gridToolbarTitle2 = 'Excel详情列表';// 自行替换此参数
- var gridToolbar2 = {
- xtype: 'toolbar',
- title: gridToolbarTitle2
- };
- return {
- north: {
- height: 90,
- split: true,
- border: false,
- items: [
- queryToolbar,
- queryForm
- ]
- },
- west: {
- width: "40%",
- split: true,
- items: {
- onRender: function () {
- $grid1 = $(this);
- queryGrid1();
- },
- xtype: 'grid',
- toolbar: gridToolbar1,
- idField: 'importId',
- columns: [[
- {title: 'id', field: 'importId', hidden: true},
- {title: '表名', field: 'tbName'},
- {title: '用户ID', field: 'userId', hidden: true},
- {title: '业务ID', field: 'busiId', hidden: true},
- {title: '业务类型', field: 'busiType', hidden: true},
- {title: '系统ID', field: 'sysId', hidden: true},
- {title: '数据量', field: 'dataNum'},
- {
- title: '发布时间', field: 'pubTime', formatter: function (value, row, index) {
- if (row.rowData.status == 1) {
- return $.fn.fmatter.ts(row.rowData.pubTime);
- } else {
- return "";
- }
- }, hidden: true
- },
- {title: '整体状态', field: 'status', hidden: true},
- {title: '整体状态', field: 'allStatusView', formatter: $.fn.fmatter.allStatusView},
- {title: '新增人', field: 'userCreate', hidden: true},
- {title: '新增时间', field: 'timeCreate', formatter: 'ts', hidden: true},
- {title: '更新人', field: 'userUpdate', hidden: true},
- {title: '更新时间', field: 'timeUpdate', formatter: 'ts', hidden: true},
- {title: '备注', field: 'desp'}
- ]],
- onSelectRow: function (rowid) {
- queryGrid2(rowid);
- }
- }
- },
- center: {
- border: false,
- items: {
- onRender: function () {
- $grid2 = $(this);
- },
- xtype: 'grid',
- toolbar: gridToolbar2,
- idField: 'id',
- autoSizeColumns: false,
- columns: [[
- {title: '派工ID', field: 'id', hidden: true},
- {title: '派工ID', field: 'importId', hidden: true},
- {title: '文本1', field: 'txt1'},
- {title: '文本2', field: 'txt2'},
- {title: '文本3', field: 'txt3'},
- {title: '文本4', field: 'txt4'},
- {title: '文本5', field: 'txt5'},
- {title: '文本6', field: 'txt6'},
- {title: '文本7', field: 'txt7'},
- {title: '文本8', field: 'txt8'},
- {title: '文本9', field: 'txt9'},
- {title: '数字1', field: 'num1'},
- {title: '数字2', field: 'num2'},
- {title: '数字3', field: 'num3'},
- {title: '数字4', field: 'num4'},
- {title: '数字5', field: 'num5'},
- {title: '数字6', field: 'num6'},
- {title: '数字7', field: 'num7'},
- {title: '数字8', field: 'num8'},
- {title: '数字9', field: 'num9'},
- {
- title: '日期1', field: 'time1', formatter: function (value, row, index) {
- if ('-2209017943000' == value) {
- return "";
- } else {
- return $.fn.fmatter.tsymd(value);
- }
- }
- },
- {
- title: '日期2', field: 'time2', formatter: function (value, row, index) {
- if ('-2209017943000' == value) {
- return "";
- } else {
- return $.fn.fmatter.tsymd(value);
- }
- }
- }, {
- title: '日期3', field: 'time3', formatter: function (value, row, index) {
- if ('-2209017943000' == value) {
- return "";
- } else {
- return $.fn.fmatter.tsymd(value);
- }
- }
- }, {
- title: '日期4', field: 'time4', formatter: function (value, row, index) {
- if ('-2209017943000' == value) {
- return "";
- } else {
- return $.fn.fmatter.tsymd(value);
- }
- }
- }, {
- title: '日期5', field: 'time5', formatter: function (value, row, index) {
- if ('-2209017943000' == value) {
- return "";
- } else {
- return $.fn.fmatter.tsymd(value);
- }
- }
- },
- {title: '状态', field: 'status', hidden: true},
- {title: '状态', field: 'excelStatusView', formatter: $.fn.fmatter.excelStatusView},
- {title: '错误描述', field: 'desp', width: 180},
- ]]
- }
- }
- };
- };
- });
|