162 lines
6.1 KiB
Plaintext
162 lines
6.1 KiB
Plaintext
@model WX.CRM.Model.Entity.RES_ACTIVITY
|
|
@using WX.CRM.Model
|
|
@using WX.CRM.WebHelper;
|
|
@{
|
|
ViewBag.Title = "创建RES_ACTIVITY";
|
|
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
|
|
}
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
$("#btnSave").click(function () {
|
|
if ($("#CreateForm").valid() && resTypeVaild()) {
|
|
|
|
$.r_ajax({
|
|
url: "/Res/Activity/Edit",
|
|
type: "Post",
|
|
data: $("#CreateForm").serialize(),
|
|
dataType: "json",
|
|
loading: true,
|
|
success: function (data) {
|
|
if (data.type == 1) {
|
|
window.parent.frameReturnByMes(data.message);
|
|
window.parent.frameReturnByReload(true);
|
|
window.parent.frameReturnByClose()
|
|
}
|
|
else {
|
|
window.parent.frameReturnByMes(data.message);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
})
|
|
SetTypeCode();
|
|
$("#map_RESTYPEID").live("change", function () {
|
|
SetTypeCode();
|
|
});
|
|
});
|
|
function resTypeVaild() {
|
|
if ($("#map_ACTIVITYCODE").valid()) {
|
|
var restypecode = $("#map_RESTYPEID").find(":selected").attr("restypecode");
|
|
var acode = $("#map_ACTIVITYCODE").val();
|
|
if (acode.substr(0, 5) != restypecode) {
|
|
$("#map_ACTIVITYCODE").addClass("input-validation-error");
|
|
$("[data-valmsg-for='map_ACTIVITYCODE']").removeClass("field-validation-valid").addClass("field-validation-error").html("<span for='map_ACTIVITYCODE' generated='true' class=>编码=资源类型编码+2位数字</span>");
|
|
return false;
|
|
} else {
|
|
$("#map_ACTIVITYCODE").remove("input-validation-error");
|
|
$("[data-valmsg-for='map_ACTIVITYCODE']").removeClass("field-validation-error").addClass("field-validation-valid").html("");
|
|
return true;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
function SetTypeCode() {
|
|
var activityCode = $("#map_ACTIVITYCODE");
|
|
var restypecode = $("#map_RESTYPEID").find(":selected").attr("restypecode");
|
|
if ($(activityCode).val() == "")
|
|
$(activityCode).val(restypecode);
|
|
else {
|
|
var oldvalue = $(activityCode).val();
|
|
if (oldvalue.length > 5)
|
|
oldvalue = oldvalue.substr(5, oldvalue.length);
|
|
else
|
|
oldvalue = "";
|
|
$(activityCode).val(restypecode + oldvalue);
|
|
}
|
|
resTypeVaild();
|
|
}
|
|
</script>
|
|
|
|
<div class="mvctool bgb">
|
|
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
|
|
</div>
|
|
@using (Html.BeginForm("Edit", "RES_ACTIVITY", null, FormMethod.Post, new { Id = "CreateForm" }))
|
|
{
|
|
@Html.ValidationSummary(true)
|
|
|
|
<table class="fromEditTable setTextWidth300">
|
|
<tbody>
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_RESTYPEID)
|
|
</td>
|
|
<td style="width:310px">
|
|
@*@Html.DropDownListFor(m => m.map_RESTYPEID, ViewBag.typeList as List<SelectListItem>, new {style="width:305px;" })*@
|
|
<select id="map_RESTYPEID" name="map_RESTYPEID" style="width:305px;">
|
|
@foreach (var resType in ViewBag.typeList as List<WX.CRM.Model.Entity.RES_RESOURCETYPE>)
|
|
{
|
|
<option value="@resType.RESTYPEID" @(Model.RESTYPEID == resType.RESTYPEID ? "selected='selected'" : "") restypecode="@resType.RESTYPECODE">@resType.TYPENAME</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_RESTYPEID)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_ACTIVITYNAME)
|
|
</td>
|
|
<td style="width:310px">
|
|
@Html.TextBoxFor(m => m.map_ACTIVITYNAME)
|
|
@Html.HiddenFor(m => m.ACTIVITYID)
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_ACTIVITYNAME)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_ACTIVITYCODE)
|
|
</td>
|
|
<td style="width:310px">
|
|
@Html.TextBoxFor(m => m.map_ACTIVITYCODE)
|
|
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_ACTIVITYCODE)
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_ACTIVITYADDR)
|
|
</td>
|
|
<td style="width:310px">
|
|
@Html.TextBoxFor(m => m.map_ACTIVITYADDR)
|
|
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_ACTIVITYADDR)
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_RESOURCETAG)
|
|
</td>
|
|
<td style="width:310px">
|
|
@Html.TextBoxFor(m => m.map_RESOURCETAG)
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_RESOURCETAG)
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
@Html.LabelFor(m => m.map_MEMO)
|
|
</td>
|
|
<td style="width:310px">
|
|
@Html.TextAreaFor(m => m.map_MEMO)
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.map_MEMO)
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
} |