- 注册时间
- 2017-8-25
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 67
- 精华
- 0
- 帖子
- 0
|
dforce 发表于 2017-11-27 15:59
请提供简单的出错的页面,来分析是什么部分出现的问题。 - mini.parse();
- /* 主datagrid加载数据 */
- var grid_parent = mini.get("datagrid1");
- grid_parent.load();
-
- grid_parent.on("drawcell", function (e) {
- var record = e.record,
- column = e.column,
- field = e.field,
- value = e.value;
-
- if (e.field == "MATCHTOTALPRICE") {
- var price = record.MATCHPRICE;
- var quantity = record.APPLYNUM;
- e.cellHtml = price * quantity;
- record.MATCHTOTALPRICE= price * quantity;
- edit();
- }
-
- });
-
- grid_parent.on("update", function (e) {
- var record = e.record,
- column = e.column,
- field = e.field,
- value = e.value;
-
- if (e.field == "MATCHTOTALPRICE") {
- var price = record.MATCHPRICE;
- var quantity = record.APPLYNUM;
- e.cellHtml = price * quantity;
- record.MATCHTOTALPRICE= price * quantity;
- edit();
- }
-
- });
-
- grid_parent.sortBy("submitdate", "desc");
- /* 子表控件定义 */
- /* var detailGrid_Form= mini.get("detailGrid_Form");
- var editForm= document.getElementById("editForm1"); */
- /* 加载子表数据 */
- grid_parent.load(null, function() {
- grid_parent.showAllRowDetail();
- });
- var myrows=[];
- function createGrid() {
- var grid = new mini.DataGrid();
- var detailGrid_Form = document.createElement("div");
- grid.set({
- url: "com.cnooc.promatching.action.CnoocProtocolMatchingListAction.call?cmd=findViewProtocol&dealType=ProtocolMatching&redisKey=#{cnoocProtocolMatchingListAction.redisKey}",
- showPager:false,
- allowResize: false,
- multiSelect: false,
- allowCellEdit: true,
- allowCellSelect: true,
- allowRowSelect:true,
- columns: [
- { field: "PROTOCOLROWGUID" ,header: "协议roguid",allowSort: true, headerAlign: "center", width: 120,visible:false},
- { field: "PROITEMROWGUID" ,header: "协议行项目roguid",allowSort: true, headerAlign: "center", width: 120,visible:false},
- { field: "PROTOCOLNO" ,header: "长期协议编号",allowSort: true, headerAlign: "center", width: 120},
- { field: "BELONG_UNITNAME" ,header: "协议所属业务单元",allowSort: true, headerAlign: "center", width: 120},
- { field: "SUPPLIER" ,header: "供应商名称",allowSort: true, headerAlign: "center", width: 120},
- { field: "LINEITMENO" ,header: "协议行项目号",allowSort: true, headerAlign: "center", width: 120},
- { field: "MATERIALDESC" ,header: "描述",allowSort: true, headerAlign: "center", width: 120},
- { field: "TOTALPRICE" ,header: "总金额",allowSort: true, headerAlign: "center", width: 120},
- { field: "ORDERMONEYCREATED" ,header: "已创建订单总金额",allowSort: true, headerAlign: "center", width: 120},
- { field: "CURRENCY" ,header: "币种",allowSort: true, headerAlign: "center", width: 120},
- { field: "PRICE" ,header: "单价",allowSort: true, headerAlign: "center", width: 120},
- { field: "TOTALAMOUNT" ,header: "总数量",allowSort: true, headerAlign: "center", width: 120},
- { field: "MESAUREUNIT" ,header: "计量单位",allowSort: true, headerAlign: "center", width: 120},
- { field: "MATERIALCODE" ,header: "物料编码",allowSort: true, headerAlign: "center", width: 120},
- { field: "MATERIALGROUP" ,header: "物料小类",allowSort: true, headerAlign: "center", width: 120},
- { field: "SERVICEITEMNO" ,header: "服务行项目号",allowSort: true, headerAlign: "center", width: 120},
- { field: "SERVICEITEMDESC" ,header: "说明",allowSort: true, headerAlign: "center", width: 120}
- ]
- });
- grid.load();
-
- grid.on("drawcell", function(e) {
-
- var record = e.record, column = e.column, field = e.field, value = e.value;
-
- if (field == "ORDERMONEYCREATED") {
- var nedprice = 0.00;
- var matchprice = 0.00;
- var waitprice = 0.00;
- var totalprice = record.TOTALPRICE;
- var type = false;
- nedprice = totalprice * 0.8;
- matchprice = record.MATCHTOTALPRICE;
- waitprice = matchprice + value;
- if (waitprice > nedprice) {
- type = true;
- }
- if (type) {
- e.rowStyle = "background:yellow;";
- } else {
- e.rowStyle = "background:white;";
- }
- }
- });
- grid.on("select", function(e) {
- myrows.push(e.record);
- });
- grid.on("deselect", function(e) {
- myrows.remove(e.record);
- });
- detailGrid_Form.appendChild(grid.getEl());
- var obj = {
- detailGrid_Form : detailGrid_Form,
- grid : grid
- };
- return obj;
- }
- function refeshMinui() {
- grid_parent.load(null, function() {
- grid_parent.showAllRowDetail();
- });
- }
- function onShowRowDetail(e) {
- var grid = e.sender;
- var row = e.record;
- grid_parent.select(row, false);
- var td = grid.getRowDetailCellEl(row);
- if (td.childNodes.length != 0)
- return;
- var obj = createGrid();
- var grid2 = obj.grid;
- var detailGrid_Form = obj.detailGrid_Form;
- td.appendChild(detailGrid_Form);
- grid2.load({
- rowguid : row.ITEMROWGUID
- });
- }
- function saveform() {
- var rows = grid_parent.getSelecteds();
- if (rows) {
- //var json = mini.encode([row]);
- var items = [];
- for ( var i in rows) {
- if (rows.length > i) {
- var item = {};
- item.rowguid = rows[i].ITEMROWGUID;
- item.matchprice = grid_parent.data[i]["MATCHPRICE"];
- item.matchtotalprice = grid_parent.data[i]["MATCHTOTALPRICE"];
- items.push(item);
- }
- }
-
- temSave([ JSON.stringify(items) ]);
-
- } else {
- openAlertTipDialog("请选择至少一条协议行项目进行保存!");
- }
- }
- function submitform() {
- var rows = grid_parent.getSelecteds();
- if (rows.length > 0) {
- //var json = mini.encode([row]);
- var items = [];
- for ( var i in rows) {
- if (rows.length > i) {
- var item = {};
- item.rowguid = rows[i].ITEMROWGUID;
- item.matchprice = grid_parent.data[i]["MATCHPRICE"];
- item.matchtotalprice = grid_parent.data[i]["MATCHTOTALPRICE"];
- items.push(item);
- }
- }
- submitformbtn([ JSON.stringify(items) ]);
- } else {
- openAlertTipDialog("请选择至少一条协议行项目进行提交!");
- }
- }
- function JSExportExcel() {
- var rows = grid_parent.getSelecteds();
- var guid = [];
- if (rows) {
- $(rows).each(function() {
- var key = this.ROWGUID;
- guid.push(key);
- });
- var val = guid.join(',');
- openConfirmTipDialog("是否导出选中的协议", this, function() {
- JSExport([ val ]);
- });
- } else {
- openAlertTipDialog("请选择至少一条协议行项目进行导出!");
- }
- }
- function edit() {
- var changedData = grid_parent.getChanges();
- if (changedData.length) {
- var json = mini.encode(changedData);
- grid_parent.loading("保存中,请稍后......");
- $.ajax({
- url : "com.cnooc.promatching.action.CnoocProtocolMatchingListAction.call?cmd=SaveItems",
- data : {
- data : json
- },
- type : "post",
- success : function(text) {
- grid_parent.load(null, function() {
- grid_parent.showAllRowDetail();
- });
- },
- error : function(jqXHR, textStatus, errorThrown) {
- openAlertTipDialog(jqXHR.responseText);
- }
- });
- }
- }
复制代码 |
|