/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2023-03-06 12:18
* 描 述:心里预约功能
*/
var selectedRow;
var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var logbegin = '';
var logend = '';
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,
// 默认
selectfn: function (begin, end) {
logbegin = begin;
logend = end;
page.search();
}
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 查看
$('#lr_view').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'formview',
title: '查看',
url: top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/FormView?keyValue=' + keyValue,
width: 670,
height: 550,
btn: null,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 新增
$('#lr_add').on('click', function () {
selectedRow = null;
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/Form',
width: 700,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
selectedRow = $('#gridtable').jfGridGet('rowdata');
if (learun.checkrow(keyValue)) {
var State = $('#gridtable').jfGridValue('State')
if (State != 0) {
learun.alert.warning("当前项已提交不可编辑");
return false;
}
learun.layerForm({
id: 'form',
title: '编辑',
url: top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/Form?keyValue=' + keyValue,
width: 700,
height: 400,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
var State = $('#gridtable').jfGridValue('State')
if (State != 0) {
learun.alert.warning("当前项已提交不可删除");
return false;
}
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/DeleteForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
// 提交
$('#lr_submit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
var State = $('#gridtable').jfGridValue('State')
if (State != 0) {
learun.alert.warning("当前项已提交不可二次提交");
return false;
}
learun.layerConfirm('是否确认提交该项!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/SubmitForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
},
initGird: function () {
$('#gridtable').lrAuthorizeJfGrid({
url: top.$.rootUrl + '/EducationalAdministration/PsychologyInfo/GetPageList',
headData: [
{ label: '学生学号', name: 'StuNo', width: 120, align: "left" },
{ label: '咨询内容', name: 'Concent', width: 300, align: "left" },
//{
// label: '附件', name: 'Url', width: 300, 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(".")) + ','
// //})
// //bb
// $.each(res.data, function (i, item) {
// bb += '' +
// item.F_FileName.substring(0, item.F_FileName.indexOf(".")) +
// ', ';
// })
// callback(bb);
// }
// });
// }
//},
{
label: '提交日期', name: 'CreateTime', width: 130, align: "left",
formatter: function (cellvalue) {
return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
}
},
{
label: '回复教师', name: 'F_RealName', width: 100, align: "left",
},
{ label: '回复内容', name: 'ReplyContent', width: 300, align: "left" },
{
label: '回复时间', name: 'ReplyTime', width: 130, align: "left",
formatter: function (cellvalue) {
return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
}
},
//{
// label: '回复附件', name: 'Urls', 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(".")) +
// ', ';
// })
// callback(bb);
// }
// });
// }
//},
{
label: '状态', name: 'State', width: 80, align: "left",
formatter: function (cellvalue, row) {
if (cellvalue == 0) {
return "草稿";
} else if (cellvalue == 7) {
return "已回复";
} else {
return "待回复";
}
}
},
],
mainId: 'Id',
isPage: true,
sidx: 'State asc,CreateTime desc',
});
page.search();
},
search: function (param) {
param = param || {};
param.StartTime = logbegin;
param.EndTime = logend;
param.StuNo = learun.clientdata.get(['userinfo']).account;
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
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' });
}