|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-03-29 11:22
- * 描 述:登记在册资产
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 初始化左侧树形数据
- $('#dataTree').lrtree({
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetTree',
- nodeClick: function (item) {
- page.search({ ATId: item.value });
- }
- });
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- $('#ATId').lrDataSourceSelect({ code: 'Ass_AssetsType', value: 'atid', text: 'aname' });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Form',
- width: 860,
- height: 600,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('警告!编辑资产信息将导致资产出入记录被清空请确认!', function (res) {
- if (res) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Form?keyValue=' + keyValue,
- width: 860,
- height: 600,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
-
- }
- });
- //资产明细
- $('#lr_detail').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '资产明细',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/Index?AId=' + keyValue,
- width: 1000,
- height: 700,
- btn: null,
- end: function () {
- refreshGirdData();
- }
- });
- }
- });
-
- //整理资产数据
- $("#lr_arrangement").on('click', function () {
-
- learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/ArrangementAss',
- {}, function (res) {
- refreshGirdData();
- });
-
- })
-
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
-
-
- //打印清单
- $('#lr_inventory').on('click',
- function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- console.log(keyValue);
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'formAss_AssetsOutApply',
- title: '清单',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Inventory?keyValue=' + keyValue,
- width: 1000,
- height: 700,
- callBack: function (id) {
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetPageList',
- headData: [
- { label: "资产编号", name: "ACode", width: 200, align: "left" },
- { label: "资产名称", name: "AName", width: 200, align: "left" },
- {
- label: "资产分类", name: "ATId", width: 100, 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: "AAssType", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'AssType',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "英文名称", name: "AEName", width: 150, align: "left" },
- { label: "单价", name: "APrice", width: 100, align: "left" },
- { label: "库存", name: "AStock", width: 100, align: "left" },
- {
- label: "数量单位", name: "AUnit", 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: "HasDetail", width: 100, align: "left",
- formatter: function (cellvalue) {
- return (cellvalue === true || cellvalue === "true") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- },
- { label: "资产型号", name: "AModel", width: 150, align: "left" },
- { label: "生产厂家", name: "AManufacturer", width: 150, align: "left" },
- {
- label: "资产来源", name: "ASource", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: 'zcly',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- 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']);
- }
- });
- }
- },
- { label: "资产排序", name: "AOrder", width: 100, align: "left" },
- { label: "资产规格", name: "ASpecification", width: 100, align: "left" },
- { label: "用途", name: "AUse", width: 100, align: "left" },
- ],
- mainId: 'AId',
- isPage: true,
- isMultiselect: true,
- sidx: 'AOrder'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|