|
- /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2023-05-05 14:52
- * 描 述:Ass_FixAssetsApply
- */
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var startTime;
- var endTime;
- var processId = '';
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 时间搜索框
- $('#datesearch').lrdate({
- dfdata: [
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: '1',
- selectfn: function (begin, end) {
- startTime = begin;
- endTime = end;
- page.search();
- }
- });
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 220, 400);
- $('#CreateUser').lrUserSelect(0);
- $('#UsePeople').lrDataItemSelect({ code: '' });
- $('#StorageIdNew').lrDataItemSelect({ code: '' });
- $('#StorageId').lrDataItemSelect({ code: '' });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/Form',
- width: 600,
- height: 400,
- callBack: function (id) {
- var res = false;
- // 验证数据
- res = top[id].validForm();
- // 保存数据
- if (res) {
- processId = learun.newGuid();
- res = top[id].save(processId, refreshGirdData);
- }
- return res;
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/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_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- //提交
- $('#lr_submit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var FlowNo = $('#gridtable').jfGridValue('FlowNo');
- if (FlowNo != 0) {
- learun.alert.warning("当前项目已提交,请耐心等待审批!");
- return;
- }
- learun.layerConfirm('是否确认提交该项!', function (res) {
- if (res) {
- processId = learun.newGuid();
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/ModifyStatus/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
- refreshGirdData(res, {});
- });
- }
- });
- }
- });
- // 查看
- $('#lr_view').on('click', function () {
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/GetPageList',
- headData: [
- {
- label: "申请人", name: "CreateUser", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('user', {
- key: value,
- callback: function (_data) {
- callback(_data.name);
- }
- });
- }
- },
- { label: "联系方式", name: "ContactWay", width: 100, align: "left" },
- {
- label: "接收人", name: "UsePeople", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: '',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "联系方式", name: "ContactWayNew", width: 100, align: "left" },
- { label: "卡片编号", name: "CardNumber", width: 200, align: "left" },
- { label: "资产名称", name: "FAName", width: 200, align: "left" },
- {
- label: "现存放地点", name: "StorageId", width: 200, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: '',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- {
- label: "存放地点新", name: "StorageIdNew", width: 200, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('dataItem', {
- key: value,
- code: '',
- callback: function (_data) {
- callback(_data.text);
- }
- });
- }
- },
- { label: "申请事由", name: "ApplyReasons", width: 240, align: "left" },
- {
- label: "附件说明", name: "Files", width: 200, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- $.ajax({
- url: '/LR_SystemModule/Annexes/GetAnnexesFileList',
- data: { folderId: value },
- type: 'GET',
- dataType: "json",
- async: false,
- cache: false,
- success: function (res) {
- var bb = '';
- $.each(res.data, function (i, item) {
- bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ','
- })
- //$.each(res.data, function(i, item) {
- // bb += '<span onclick="downLoad(\'' +
- // item.F_Id +
- // '\')" style="color:blue">' +
- // item.F_FileName.substring(0,item.F_FileName.indexOf(".")) +
- // '</span>, ';
- //})
- callback(bb);
- }
- });
- }
- },
- {
- label: "审批状态", name: "Status", width: 100, align: "center",
- formatter: function (cellvalue, row) {
- if (cellvalue == 0) {
- return '<span class=\"label label-warning\">草稿</span>';
- } if (cellvalue == 1) {
- return '<span class=\"label label-warning\">审批中</span>';
- } else if (cellvalue == 2) {
- return '<span class=\"label label-success\">审批通过</span>';
- }
- }
- }
- ],
- mainId: 'ID',
- isPage: true
- });
- },
- search: function (param) {
- param = param || {};
- param.StartTime = startTime;
- param.EndTime = endTime;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function (res, postData) {
- if (!!res) {
- if (res.code == 200) {
- // 发起流程
- var postData = {
- schemeCode: '',// 填写流程对应模板编号
- processId: processId,
- level: '1',
- };
- learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
- learun.loading(false);
- });
- }
- page.search();
- }
- };
- page.init();
- }
- function downLoad(fileId, fileTwo) {
- if (fileTwo) {
-
- top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddRecord', { fileId: fileTwo }, function () {
-
- });
- }
- top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' });
- }
|