diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/Form.js
index 73e5764cc..3809ada8f 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/Form.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/Form.js
@@ -14,117 +14,210 @@ var setFormData;
var validForm;
// 保存数据
var save;
+var refreshGirdData;
+var selectedRow;
+var tempdatra = new Array();
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
$('.lr-form-wrap').lrscroll();
-
+ $("#detailadd").on('click', function () {
+ 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);
+ }
+ });
+ });
+ $("#detaildel").on('click', function () {
+ var keyValue = $('#Ass_ReceiveItem').jfGridValue('RIID');
+ if (learun.checkrow(keyValue)) {
+ learun.layerConfirm('是否确认删除该项!', function (res, index) {
+ if (res) {
+ $.each(tempdatra, function (key, val) {
+ if (val && val.RIID === keyValue) {
+ tempdatra.splice(key, 1);
+ }
+ });
+ $('#Ass_ReceiveItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber));
+ top.layer.close(index);
+ }
+ });
+ }
+ });
page.bind();
page.initData();
},
bind: function () {
- var loginInfo = top.learun.clientdata.get(['userinfo']);
- $('#ReceiveUser').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' }).lrselectSet(loginInfo.userId);
- $('#PDepartment').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }).lrselectSet(loginInfo.departmentId);
+
+ $('#RTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'));
+ $('#ReceiveUser')[0].lrvalue = learun.clientdata.get(['userinfo']).userId;
+
+ $('#ReceiveUser').val(learun.clientdata.get(['userinfo']).realName);
+ $('#PDepartment').lrselect({
+ type: 'tree',
+ // 展开最大高度
+ maxHeight: 200,
+ // 是否允许搜索
+ allowSearch: true,
+ // 访问数据接口地址
+ url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree'
+ });
+ $('#PDepartment').lrselectSet(learun.clientdata.get(['userinfo']).departmentId);
+
+
$('#Ass_ReceiveItem').jfGrid({
headData: [
{
- label: "资产名称", name: "AName", width: 100, align: "left",
- edit: {
- type: 'input',
- init: function (row, $edit) {
- },
- },
-
+ label: '资产编号', name: 'AAICode', width: 150, align: 'left'
},
{
- label: "库存数量", name: "ACNum", width: 100, align: "left",
+ label: '资产名称', name: 'AAIName', width: 150, align: 'left'
},
{
- label: "领取数量", name: "ANum", width: 100, align: "left",
- edit: {
- type: 'input',
- inputType: 'number',
+ label: '资产类别', name: 'AAITId', width: 150, align: 'left', formatterAsync: function (callback, value, row, op, $cell) {
+ learun.clientdata.getAsync('custmerData', {
+ url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
+ key: value,
+ keyId: 'atid',
+ callback: function (_data) {
+ callback(_data['aname']);
+ }
+ });
}
},
{
- label: "资产编号", name: "AID", width: 100, align: "left",
- edit: {
- type: 'input',
+ label: '单价', name: 'AAIPrice', width: 100, align: 'left'
+ },
+ {
+ label: '单位', name: 'AAIUnit', width: 80, align: 'left', formatterAsync: function (callback, value, row, op, $cell) {
+ learun.clientdata.getAsync('dataItem', {
+ key: value,
+ code: 'sldw',
+ callback: function (_data) {
+ callback(_data.text);
+ }
+ });
}
},
+ {
+ label: '英文名称', name: 'AAIEName', width: 100, align: 'left'
+ },
+ {
+ label: '资产型号', name: 'AAIModel', width: 100, align: 'left'
+ },
+ {
+ label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left'
+ }
],
+ height: 400,
mainId: 'RIID',
- isEdit: true,
+ reloadSelected: false
});
+ //$('#ReceiveUser').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' }).lrselectSet(loginInfo.userId);
+ //$('#PDepartment').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name' }).lrselectSet(loginInfo.departmentId);
- $('#Ass_ReceiveItem').on('click', function (e) {
- var et = e.target || e.srcElement;
- var $et = $(et);
- if ($et.attr('rowindex') && $et.attr('rownum') && $et.attr('colname') == 'AName') {
- var $input = $('#jfgrid_edit_Ass_ReceiveItem_AName');
- $input.removeClass('lr-layerselect').removeAttr('lrlayerselect').unbind('click')[0].dfop = null;
+ //$('#Ass_ReceiveItem').jfGrid({
+ // headData: [
+ // {
+ // label: "资产名称", name: "AName", width: 100, align: "left",
+ // edit: {
+ // type: 'input',
+ // init: function (row, $edit) {
+ // },
+ // },
- $input.lrlayerselect({
- treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree',
- treeParentId: 'atptid',
- treeValueId: 'atid',
- treeTextId: 'aname',
- dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList',
- dataTreeId: 'ATId',
- dataValueId: 'AId',
- dataTextId: 'AName',
+ // },
+ // {
+ // label: "库存数量", name: "ACNum", width: 100, align: "left",
+ // },
+ // {
+ // label: "领取数量", name: "ANum", width: 100, align: "left",
+ // edit: {
+ // type: 'input',
+ // inputType: 'number',
+ // }
+ // },
+ // {
+ // label: "资产编号", name: "AID", width: 100, align: "left",
+ // edit: {
+ // type: 'input',
+ // }
+ // },
+ // ],
+ // mainId: 'RIID',
+ // isEdit: true,
+ //});
+ //$('#Ass_ReceiveItem').on('click', function (e) {
+ // var et = e.target || e.srcElement;
+ // var $et = $(et);
+ // if ($et.attr('rowindex') && $et.attr('rownum') && $et.attr('colname') == 'AName') {
+ // var $input = $('#jfgrid_edit_Ass_ReceiveItem_AName');
+ // $input.removeClass('lr-layerselect').removeAttr('lrlayerselect').unbind('click')[0].dfop = null;
- grid: [
- { label: '资产编号', name: 'ACode', width: 200, align: 'left' },
- { label: '资产名称', name: 'AName', width: 200, align: 'left' },
- { label: "英文名称", name: "AEName", width: 200, align: "left" },
- { label: "资产型号", name: "AModel", width: 200, align: "left" },
- { label: "生产厂家", name: "AManufacturer", width: 200, 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) {
+ // $input.lrlayerselect({
+ // treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree',
+ // treeParentId: 'atptid',
+ // treeValueId: 'atid',
+ // treeTextId: 'aname',
+ // dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList',
+ // dataTreeId: 'ATId',
+ // dataValueId: 'AId',
+ // dataTextId: 'AName',
- $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) {
- data = data.Ass_AssetsInfo;
- var rowIndex = $et.attr('rowindex');
- $input.val(data.AName);
- //$('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AName'] = data.AName;
- //$('.jfgrid-data-cell[colname="AName"][rowIndex="' + rowIndex + '"]').attr('title', data.AName).html(data.AName);
- $input.trigger('propertychange');
+ // grid: [
+ // { label: '资产编号', name: 'ACode', width: 200, align: 'left' },
+ // { label: '资产名称', name: 'AName', width: 200, align: 'left' },
+ // { label: "英文名称", name: "AEName", width: 200, align: "left" },
+ // { label: "资产型号", name: "AModel", width: 200, align: "left" },
+ // { label: "生产厂家", name: "AManufacturer", width: 200, 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) {
- $('jfgrid_edit_Ass_ReceiveItem_' + 'ANum').val(0);
- $('.jfgrid-data-cell[colname="ANum"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(0);
- $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ANum'] = 0;
+ // $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) {
+ // data = data.Ass_AssetsInfo;
+ // var rowIndex = $et.attr('rowindex');
+ // $input.val(data.AName);
+ // $input.trigger('propertychange');
- $('jfgrid_edit_Ass_ReceiveItem_' + 'AID').val(data.AId);
- $('.jfgrid-data-cell[colname="AID"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(data.AId);
- $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AID'] = data.AId;
+ // $('jfgrid_edit_Ass_ReceiveItem_' + 'ANum').val(0);
+ // $('.jfgrid-data-cell[colname="ANum"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(0);
+ // $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ANum'] = 0;
- $('jfgrid_edit_Ass_ReceiveItem_' + 'ACNum').val(data.AId);
- $('.jfgrid-data-cell[colname="ACNum"][rowIndex="' + rowIndex + '"]').attr('title', data.AStock).html(data.AStock);
- $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ACNum'] = data.AStock;
+ // $('jfgrid_edit_Ass_ReceiveItem_' + 'AID').val(data.AId);
+ // $('.jfgrid-data-cell[colname="AID"][rowIndex="' + rowIndex + '"]').attr('title', data.AId).html(data.AId);
+ // $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['AID'] = data.AId;
- });
- }
- },
- isMultiple: false
- });
- }
- })
+ // $('jfgrid_edit_Ass_ReceiveItem_' + 'ACNum').val(data.AId);
+ // $('.jfgrid-data-cell[colname="ACNum"][rowIndex="' + rowIndex + '"]').attr('title', data.AStock).html(data.AStock);
+ // $('#Ass_ReceiveItem')[0].dfop.running.rowdata[rowIndex]['jfgridRowData']['ACNum'] = data.AStock;
+
+ // });
+ // }
+ // },
+ // isMultiple: false
+ // });
+ // }
+ //})
},
initData: function () {
if (!!keyValue) {
@@ -132,6 +225,7 @@ var bootstrap = function ($, learun) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);
+ tempdatra = data[id];
}
else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
@@ -167,6 +261,47 @@ var bootstrap = function ($, learun) {
}
return true;
};
+ refreshGirdData = function (temprow) {
+ var ifnewrow = true;
+ 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,
+ RIID: 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);
+ }
+ });
+
+ $('#Ass_ReceiveItem').jfGridSet('refreshdata', tempdatra.sort(sortNumber));
+ };
+ function sortNumber(a, b) {
+ return 1;//a.AAIOrder - b.AAIOrder;
+ };
// 保存数据
save = function (processId, callBack, i) {
var formData = $('body').lrGetFormData();
@@ -176,21 +311,21 @@ var bootstrap = function ($, learun) {
var postData = {
strEntity: JSON.stringify($('[data-table="Ass_Receive"]').lrGetFormData()),
};
- var itemList = $('#Ass_ReceiveItem').jfGridGet('rowdatas');
- var num = 0;
- $.each(itemList, function (i, item) {
- if (item.ANum <= 0) {
- learun.alert.warning("请填写<" + item.AName + ">的申请数量");
- num++;
- }
- if (item.ANum > item.ACNum) {
- learun.alert.warning("领取数量不能大于库存数量!");
- num++;
- }
- })
- if (num > 0) {
- return;
- }
+ //var itemList = $('#Ass_ReceiveItem').jfGridGet('rowdatas');
+ //var num = 0;
+ //$.each(itemList, function (i, item) {
+ // if (item.ANum <= 0) {
+ // learun.alert.warning("请填写<" + item.AName + ">的申请数量");
+ // num++;
+ // }
+ // if (item.ANum > item.ACNum) {
+ // learun.alert.warning("领取数量不能大于库存数量!");
+ // num++;
+ // }
+ //})
+ //if (num > 0) {
+ // return;
+ //}
postData.receItemList = JSON.stringify($('#Ass_ReceiveItem').jfGridGet('rowdatas'));
$.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/SaveForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/FormView.cshtml
index 8c65bfe64..3ff2088b8 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/FormView.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Receive/FormView.cshtml
@@ -4,16 +4,21 @@
}