@@ -1,8 +1,10 @@ | |||
using Learun.Util; | |||
using System; | |||
using Learun.Util; | |||
using System.Data; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
{ | |||
@@ -89,10 +91,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormDayData(string keyValue) | |||
{ | |||
var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionDay(keyValue); | |||
var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionDay(keyValue).Select(m=>m.WorkDay.ToString("yyyy-MM-dd")); | |||
var jsonData = new | |||
{ | |||
ADR_RestrictionDay = ADR_RestrictionData, | |||
ADR_RestrictionDay = string.Join(",",ADR_RestrictionData) | |||
}; | |||
return Success(jsonData); | |||
} | |||
@@ -148,8 +150,16 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
[AjaxOnly] | |||
public ActionResult SaveFormDay(string keyValue, string strEntity) | |||
{ | |||
List<ADR_RestrictionDayEntity> entity = strEntity.ToObject<List<ADR_RestrictionDayEntity>>(); | |||
aDR_RestrictionIBLL.SaveFormDay(keyValue, entity); | |||
List<string> entity = strEntity.ToObject<List<string>>(); | |||
List<ADR_RestrictionDayEntity> listday=new List<ADR_RestrictionDayEntity>(); | |||
foreach (var item in entity) | |||
{ | |||
var ADR_RestrictionDayEntity = new ADR_RestrictionDayEntity(); | |||
ADR_RestrictionDayEntity.RId = keyValue; | |||
ADR_RestrictionDayEntity.WorkDay =Convert.ToDateTime(item); | |||
listday.Add(ADR_RestrictionDayEntity); | |||
} | |||
aDR_RestrictionIBLL.SaveFormDay(keyValue, listday); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
} | |||
@@ -16,16 +16,15 @@ | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_RestrictionDay"> | |||
<div class="lr-form-item-title">上班日期<font face="宋体">*</font></div> | |||
<input id="WorkDay" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_RestrictionDay"> | |||
<input id="WorkDay" type="text" style="display: none;"/> | |||
<script src="~/Content/vue/vue.js"></script> | |||
<!-- 引入样式 --> | |||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> | |||
<!-- 引入组件库 --> | |||
<script src="https://unpkg.com/element-ui/lib/index.js"></script> | |||
<div id="app"> | |||
<el-calendar v-model="calendarValue" style="width:100%;height: auto;"> | |||
<el-calendar v-model="calendarValue" style="width: 100%; height: auto;"> | |||
<template slot="dateCell" slot-scope="{data}"> | |||
<div class="caleendarItem" v-on:click="chooseDay(data)" :class="{isSelect:isSelect(data.day)}"> | |||
{{ data.day.split('-').slice(2).join('-') }} | |||
@@ -34,24 +33,28 @@ | |||
</el-calendar> | |||
</div> | |||
<script> | |||
</script> | |||
<style> | |||
.el-calendar-table .el-calendar-day{ | |||
height:42px; | |||
padding:0px; | |||
.el-calendar-table .el-calendar-day { | |||
height: 42px; | |||
padding: 0px; | |||
} | |||
.el-calendar-table td.is-selected { | |||
background-color: unset; | |||
} | |||
.el-backtop, .el-calendar-table td.is-today { | |||
color: #333; | |||
} | |||
.caleendarItem{ | |||
width:100%; | |||
height:100%; | |||
padding:8px | |||
.caleendarItem { | |||
width: 100%; | |||
height: 100%; | |||
padding: 8px | |||
} | |||
.caleendarItem.isSelect { | |||
background: #ECF5FF; | |||
color: #5FADFF | |||
@@ -20,15 +20,8 @@ var bootstrap = function ($, learun) { | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/GetFormDayData?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
initCalendar() | |||
$('#WorkDay').val(data.ADR_RestrictionDay); | |||
initCalendar(); | |||
}); | |||
} | |||
// 初始化日历 | |||
@@ -69,8 +62,10 @@ var bootstrap = function ($, learun) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
var workdays = $('#WorkDay').val().split(','); | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
keyValue: keyValue, | |||
strEntity: JSON.stringify(workdays) | |||
}; | |||
$.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/SaveFormDay', postData, function (res) { | |||
// 保存成功后才回调 | |||