|
- /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2020-11-18 10:46
- * 描 述:资产验收
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var processId = '';
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- $('#DepartmentId').lrDepartmentSelect();
- $('#User').lrDataItemSelect({ code: '' });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Form',
- width: 600,
- height: 400,
- callBack: function (id) {
- var res = false;
- // 验证数据
- res = top[id].validForm();
- // 保存数据
- if (res) {
- res = top[id].save('', function () {
- page.search();
- });
- }
- return res;
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var SendFlag = $('#gridtable').jfGridValue('Status');
- if (SendFlag) {
- learun.alert.warning("当前项目已提交不能编辑!");
- return;
- }
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Form?keyValue=' + keyValue,
- width: 600,
- height: 400,
- callBack: function (id) {
- var res = false;
- // 验证数据
- res = top[id].validForm();
- // 保存数据
- if (res) {
- res = top[id].save('', function () {
- page.search();
- });
- }
- return res;
- }
- });
- }
- });
-
- // 查看
- $('#lr_view').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '查看',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ViewForm?keyValue=' + keyValue,
- width: 600,
- height: 400,
- btn: null
- });
- }
- });
-
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var SendFlag = $('#gridtable').jfGridValue('Status');
- if (SendFlag) {
- learun.alert.warning("当前项目已提交不能不能删除!");
- return;
- }
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 打印
- $('#lr_print').on('click', function () {
- $('#gridtable').jqprintTable();
- });
- //审核
- $('#check').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var Status = $('#gridtable').jfGridValue('Status');
- if (Status != 0) {
- learun.alert.warning("当前项无需验收!");
- return;
- }
- learun.layerConfirm('是否确认审核该项?', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Check', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //去审
- $('#uncheck').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var Status = $('#gridtable').jfGridValue('Status');
- //var Status = Status.split(',');
- if (Status != 0) {
- learun.alert.warning("当前项无需验收!");
- return;
- }
- learun.layerConfirm('是否确认取消审核该项?', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/UnCheck', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 提交
- $('#lr_submit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- var SendFlag = $('#gridtable').jfGridValue('Status');
- if (SendFlag) {
- learun.alert.warning("当前项目已提交,请耐心等待审批!");
- return;
- }
- learun.layerConfirm('是否确认提交该项!', function (res) {
- if (res) {
- processId = learun.newGuid();
- learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
- refreshGirdData(res, {});
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList',
- headData: [
- { label: "设备名称", name: "Name", width: 100, align: "left" },
- { label: "品牌", name: "Manufacturer", width: 100, align: "left" },
- { label: "规格型号", name: "Model", width: 100, align: "left" },
- { label: "单位", name: "Unit", width: 100, align: "left" },
- { label: "数量", name: "Stock", width: 100, align: "left" },
- { label: "单价", name: "Price", width: 100, align: "left" },
- { label: "总价", name: "TotalPrice", width: 100, align: "left" },
- {
- label: "使用部门", name: "DepartmentId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('department', {
- key: value,
- callback: function (_data) {
- callback(_data.name);
- }
- });
- }
- },
- {
- label: "使用人", name: "UserID", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsyncReal('user', {
- key: value,
- callback: function (_data) {
- callback(_data.name);
- }
- });
- }
- },
- { label: "放置地点", name: "Place", width: 100, align: "left" },
- {
- label: "状态", name: "Status", width: 100, align: "left",
- formatter: function (cellvalue, row) {
- if (cellvalue === '0') {
- return '<span class=\"label label-warning\">审批中</span>';
- } else if (cellvalue === '1') {
- return '<span class=\"label label-success\">验收成功</span>';
- } else {
- return '<span class=\"label label-default\" >验收不合规</span>';
- }
- }
- },
- { label: "备注", name: "Remark", width: 100, align: "left" },
- ],
- mainId: 'ID',
- isPage: true
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- //refreshGirdData = function (res, postData) {
- // if (!!res)
- // {
- // if (res.code == 200)
- // {
- // // 发起流程
- // var postData = {
- // schemeCode:'ASS_zcys',// 填写流程对应模板编号
- // processId:processId,
- // level:'1',
- // };
- // learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function(data) {
- // learun.loading(false);
- // });
- // }
- // page.search();
- // }
- //};
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|