123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- //物资信息查询页面
- define(function (require) {
- return function () {
- var $grid1, $grid2, $form;
- // 弹框的方式
- var widgets = {
- // 搜索分类检索
- selectCatalogWidget: {
- url: '/app/mat/widget/selectCatalog.js',
- bind: {
- matcId: 'matcId',
- matcName: 'matcName'
- },
- queryParams: {matcBusi: MATC_BUSI_检验, status: 1}
- }
- };
- // 输入搜索文本后点击回车按钮查询列表
- function enterQueryGrid1(e) {
- if (e.keyCode === 13) {
- var tmp = $(this).val();
- $form.formSet({queryProperties: tmp});
- queryGrid1();
- }
- }
- //获取物资信息
- function queryGrid1() {
- var queryUrl = '/mat/matInfo/queryMatView';// 自行替换此参数
- $grid1.jqGrid("clearGridData");
- var queryForm = $form.formGet();
- $grid1.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryForm
- }, true);
- if ($grid2 != undefined && $grid2 != null) {
- $grid2.jqGrid("clearGridData");
- }
- }
- //获取批次信息
- function queryGrid2() {
- if ($grid2 == undefined || $grid2 == null)
- return;
- var row = $grid1.rowData();
- if (!row) {
- $.yvan.msg('请先选择一行数据');
- return;
- }
- var queryForm = $form.formGet();
- queryForm.matId = row.matId;
- var queryUrl = '/mat/matBatch/queryMatBatchView';// 自行替换此参数
- $grid2.reload({
- mtype: 'POST',
- url: api(queryUrl),
- queryParams: queryForm
- });
- }
- //获取仓库信息
- function getRoomList() {
- var _datas = [];
- var qd = {};
- if (App.currentRoomId > 0) {
- qd = {roomId: App.currentRoomId};
- _datas = [];
- } else {
- qd = {roomType: ROOM_TYPE_CK};
- }
- $.yvan.ajax({
- url: api('/wms/whRoom/queryAll'),
- data: qd,
- method: 'post',
- async: false,
- success: function (data) {
- if (data.data) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].roomId,
- "text": data.data[i].roomName
- })
- }
- }
- }
- });
- return _datas;
- }
- // 搜索按钮
- var queryToolbarTitle = '物资查询';// 自行替换此参数
- 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: 'hidden', name: 'matcId'},
- {
- xtype: 'textbox',
- label: '检索条件',
- name: 'queryProperties',
- prompt: queryFormPrompt,
- labelWidth: 'auto',
- events: {keydown: enterQueryGrid1},
- },
- {
- xtype: 'yvselect', label: '仓库', name: 'roomId', labelWidth: 'auto', width: 220,
- data: getRoomList(),
- onChange: function () {
- queryGrid1();
- }
- },
- {
- xtype: 'searchbox',
- label: '检验分类',
- name: 'matcName',
- labelWidth: 'auto',
- widget: widgets.selectCatalogWidget,
- onChange: function (value) {
- if (!isNotNullOrEmpty(value)) {
- $form.formSet({
- matcId: ''
- })
- }
- queryGrid1();
- }
- },
- {
- xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180,
- data: $.yvan.sysDict('matType').combowithAll(), value: '',
- onChange: function () {
- queryGrid1();
- }
- },
- {
- xtype: 'yvselect', label: '购买状态', name: 'isBuy', data: [
- {id: '1', text: '购买过'},
- {id: '0', text: '未购买'}
- ],
- labelWidth: 'auto', width: 180,
- onChange: function (value) {
- queryGrid1();
- }
- },
- {
- xtype: 'yvselect', label: '库存状态', name: 'hasStock', data: [
- {id: '1', text: '有库存'},
- {id: '0', text: '无库存'}
- ],
- labelWidth: 'auto', width: 180,
- onChange: function (value) {
- queryGrid1();
- }
- },
- ]
- ]
- };
- // 列表1增删改查按钮
- var gridToolbarTitle1 = '物资列表';// 自行替换此参数
- var gridToolbar1 = {
- xtype: 'toolbar',
- title: gridToolbarTitle1,
- items: [
- // {
- // text: '历史价格', iconCls: 'fa fa-sticky-note-o', onClick: function () {
- // var row = $grid1.rowData();
- // if (!row) {
- // $.yvan.msg('请先选择一行数据');
- // return;
- // }
- // $.yvan.showDialog(this,
- // require('/app/mat/info/dialogPrice.js')({
- // confirm: function () {
- // $grid1.reload();
- // },
- // isEdit: true,
- // matId: row.matId
- // })
- // );
- // }
- // },
- // {
- // text: '预览', iconCls: 'fa fa-sticky-note-o', onClick: function () {
- // var row = $grid1.rowData();
- // if (!row) {
- // $.yvan.msg('请先选择一行数据');
- // return;
- // }
- // var dlg = require('/app/mat/info/viewDialogInfo.js')({// 自行替换此参数
- // isEdit: true,
- // matId: row.matId,
- // });
- // $.yvan.showDialog(this, dlg);
- // }
- // }
- ]
- };
- return {
- north: {
- height: 90,
- split: true,
- border: false,
- items: [
- queryToolbar,
- queryForm
- ]
- },
- center: {
- height: '60%',
- split: true,
- items: {
- onRender: function () {
- $grid1 = $(this);
- queryGrid1();
- },
- xtype: 'grid',
- toolbar: gridToolbar1,
- autoSizeColumns: true,
- columns:
- [[
- {title: '物资ID', field: 'matId', hidden: true},
- {title: '物资编码', field: 'matBar', width: 250},
- {title: '图号/型号', field: 'matCode', width: 200},
- {title: '物资名称', field: 'matName', width: 250},
- {title: '物资编码属性', field: 'matAttrCode'},
- {title: '物资分类', field: 'matType', formatter: $.fn.fmatter.matType, width: 80},
- {title: '检验分类', field: 'matcName', width: 150},
- {title: '计量单位', field: 'unitName'},
- {
- title: '计划价',
- field: 'planPrice',
- formatter: $.fn.fmatter.formatCurrency,
- width: 80,
- align: 'right',
- },
- {title: '首次购买日期', field: 'firstBuyDate', formatter: $.fn.fmatter.tsymd, align: 'center'},
- {title: '批次数', field: 'batchNum', align: 'right'},
- {title: '库存数', field: 'matAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
- ]],
- onSelectRow: function (rowid) {
- queryGrid2();
- }
- }
- },
- south: {
- height: '40%',
- border: false,
- items: {
- xtype: 'tabs',
- items: [
- {
- title: '批次列表',
- lazy: true,
- items: {
- onRender: function () {
- $grid2 = $(this);
- },
- xtype: 'grid',
- autoSizeColumns: true,
- idField: 'batchId',
- pagination: true,
- columns: [
- [
- {title: '批次ID', field: 'batchId', hidden: true},
- {title: '批次条码', field: 'batchBar', hidden: true},
- {title: '批次号', field: 'batchCode', width: 200},
- {title: '检验分类', field: 'matcName', width: 200},
- {title: '供应商', field: 'corpName'},
- {title: '购买单位', field: 'corpUnit'},
- {
- title: '购买数量',
- field: 'corpAmount',
- align: 'right',
- formatter: $.fn.fmatter.formatNumberBigDecimal
- },
- {
- title: '库存数量',
- field: 'matAmount',
- align: 'right',
- formatter: $.fn.fmatter.formatNumberBigDecimal
- },
- {title: '生产日期', field: 'dateMade', width: 140, formatter: $.fn.fmatter.tsymd, align: 'center',},
- {title: '保证贮存期', field: 'saveMinDate', formatter: $.fn.fmatter.tsymd, align: "center"},
- {title: '最大贮存期', field: 'saveMaxDate', formatter: $.fn.fmatter.tsymd, align: "center"},
- {title: '入库日期', field: 'dateArrival', width: 140, formatter: $.fn.fmatter.tsymd, align: 'center',},
- {title: '检验员', field: 'name'},
- ]
- ]
- }
- },
- ]
- }
- }
- };
- };
- });
|