From bd18669d8568284218f661bd63e2be1ca7e0ca46 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 12 Jul 2021 18:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E6=8A=A5=E5=BA=9F=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/AssScrap/Form.js | 179 ++++++------------ 1 file changed, 58 insertions(+), 121 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/AssScrap/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/AssScrap/Form.js index 714b1e5ad..d174c8384 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/AssScrap/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/AssScrap/Form.js @@ -29,126 +29,28 @@ var bootstrap = function ($, learun) { $('.lr-form-wrap').lrscroll(); - $("#detailadd").on('click', function () { - $('#detailaddbutton').trigger('click'); - }); - $("#detailaddbutton").lrlayerselect({ - treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', - treeParentId: 'atptid', - treeValueId: 'atid', - treeTextId: 'aname', - dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetList', - dataTreeId: 'ATId', - dataValueId: 'aiid', - dataTextId: 'aname', - - grid: [ - { label: '资产编号', name: 'aicodenumjy', width: 150, align: 'left' }, - { label: '资产名称', name: 'aname', width: 150, align: 'left' }, - { label: "英文名称", name: "aename", width: 100, align: "left" }, - { - label: '楼宇名称', name: 'aiistorageid', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', - key: value, - keyId: 'sid', - callback: function (_data) { - callback(_data['sname']); - } - }); - } - }, - { - label: "房间号", name: "aiistorageposition", width: 150, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', - key: value, - keyId: 'rid', - callback: function (_data) { - callback(_data['rcode']); - } - }); - } - }, - { - label: '是否在库', name: 'aiisinstorage', width: 150, align: 'left', formatter: function (val, row) { - if (val) { - return '在库'; - } else { - return '否'; - } - } - }, - { label: "资产型号", name: "amodel", width: 150, align: "left" }, - { label: "生产厂家", name: "amanufacturer", width: 150, align: "left" }, - { - label: "供应商", name: "asupplierid", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', - key: value, - keyId: 'sid', - callback: function (_data) { - callback(_data['sname']); - } - }); - } - } - ], - select: function (values, texts) { - if (values && values.length > 0) { - //绑定 - $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetDatas?keyValue=' + values, function (data) { - if (data) { - - $.each(data, function (i, item) { - - var ifnewrow = true; - $.each(tempdatra, function (key, val) { - if (tempdatra[key].AAIAId === item.AAIAId) { - ifnewrow = false; - } - }); - if (ifnewrow) { - tempdatra.push(item); - } - }) - $('#Ass_ScrapItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); - } - - }); - - + selectedRow = null; + learun.layerFormForPercent({ + id: 'formitem', + title: '新增明细', + url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/IndexTwo', + width: "90%", + height: "90%", + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); } - }, - isMultiple: true - }); - $("#detailedit").on('click', function () { - //Ass_ScrapItem - var keyValue = $('#Ass_ScrapItem').jfGridValue('AAIId'); - selectedRow = $('#Ass_ScrapItem').jfGridGet('rowdata'); - if (learun.checkrow(keyValue)) { - learun.layerForm({ - id: 'formitem', - title: '编辑明细', - url: top.$.rootUrl + '/AssetManagementSystem/Ass_ScrapItem/Form?keyValue=' + keyValue, - width: 860, - height: 600, - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } - }); - } + }); }); + $("#detaildel").on('click', function () { var keyValue = $('#Ass_ScrapItem').jfGridValue('AAIId'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res, index) { if (res) { $.each(tempdatra, function (key, val) { - if (tempdatra[key].AAIId === keyValue) { - pricecount -= tempdatra[key].AAIPrice * tempdatra[key].AAIStock; + if (tempdatra[key] && tempdatra[key].AAIId == keyValue) { + //pricecount -= tempdatra[key].AAIPrice * tempdatra[key].AAIStock; tempdatra.splice(key, 1); } }); @@ -253,19 +155,54 @@ var bootstrap = function ($, learun) { refreshGirdData = function (temprow) { var ifnewrow = true; - $.each(tempdatra, function (key, val) { - if (tempdatra[key].AAIId === temprow.AAIId) { - tempdatra[key] = temprow; - ifnewrow = false; - } - }); - if (ifnewrow) { - tempdatra.push(temprow); - } + var list = []; + $.each(temprow, + function (i, item) { + var entity = { + //AAICode: item.AICode, + AAICode: item.AICodeNumJY, + AAIName: item.AIASSName, + AAITId: item.AIASSClass, + AAIPrice: item.AIAssValue, + AAIUnit: item.AIUnits, + AAIEName: '', + AAIModel: item.AISpecificationtype, + AAIManufacturer: item.AIManufacturer, + AAIStorage: item.AIIStorageId, + AAILocation: item.AIIStoragePosition, + AAIId: learun.newGuid() + } + list.push(entity); + + }); + + $.each(list, + function (j, item2) { + $.each(tempdatra, + function (key, val) { + if (tempdatra[key].AAICode === item2.AAICode) { + tempdatra[key] = item2; + ifnewrow = false; + } + }); + if (ifnewrow) { + tempdatra.push(item2); + } + }); + //var ifnewrow = true; + //$.each(tempdatra, function (key, val) { + // if (tempdatra[key].AAIId === temprow.AAIId) { + // tempdatra[key] = temprow; + // ifnewrow = false; + // } + //}); + //if (ifnewrow) { + // tempdatra.push(temprow); + //} $('#Ass_ScrapItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); }; function sortNumber(a, b) { - return a.AAIOrder - b.AAIOrder; + return 1; //a.AAIOrder - b.AAIOrder; } // 设置表单数据 setFormData = function (processId) {