123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621 |
- @using MES.Production.Service;
- @using Central.Control.Domain;
- @using Ant.Service.Common;
- @using CommonToolHelper;
- @{
- ViewBag.Title = "Detail";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- @model MES.Production.Entity.DistributorUser
- <style>
- body {
- background-color: white;
- }
- .changeicon {
- float: right;
- margin-right: 22px;
- position: absolute;
- right: -7px;
- top: 0px;
- border: none;
- background-color: #18a689;
- color: #FFFFFF;
- line-height: 33px;
- height: 33px;
- }
- </style>
- <link href="~/Content/uploadone/CSS/webuploader.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/uploadstyle.css" rel="stylesheet" />
- <link href="~/Content/uploadone/CSS/font-awesome.css" rel="stylesheet" />
- @*<script src="~/Content/js/jquery/jquery-1.8.2.min.js"></script>*@
- <script src="~/Content/uploadone/Script/webuploader.js"></script>
- @using (Ajax.BeginForm("Save", null, new AjaxOptions()
- {
- HttpMethod = "Post",
- OnBegin = "SubAjax.Loading",
- OnComplete = "SubAjax.Complate",
- OnFailure = "SubAjax.Failure",
- OnSuccess = "SubAjax.Success"
- },
- new { @class = "form-horizontal dig-from", @role = "form" }))
- {
- <div class="wrapper-content">
- @Html.Hidden("hidfilename", Model.distributorInfo.LICENSEURL)
- @Html.Hidden("hidfileid", Model.distributorInfo.LICENSEVALUE)
- <div class="panel-body">
- <div class="tab-content">
- <div id="tab-1" class="tab-pane active">
- <div class="form-group">
- <label class="col-lg-3 control-label">所属经销商:</label>
- <div class="col-lg-8">
- <select id="PARENTID" name="PARENTID" onchange="" class="form-control select2" style="width: 100%;">
- @*<option value="" @(Model.distributorInfo.PARENTID == "" ? "selected" : "")>一级经销商</option>*@
- @{
- foreach (var item in ViewBag.moduleparent)
- {
- <option value="@item.ID" @(Model.distributorInfo.PARENTID == @item.ID ? "selected" : "")>@CommonHtmlHelper.RtfTextToHtml(item.NAME)</option>
- }
- }
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">经销商编号:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.distributorInfo.DealerNumber, new { @class = "form-control", @id = "DealerNumber", @placeholder = "请输入经销商编号", @datatype = "*", @nullmsg = "请输入经销商编号!", @errormsg = "请输入经销商编号!" })
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">经销商名称:</label>
- <div class="col-lg-8">
- @Html.HiddenFor(p => p.distributorInfo.ID)
- @Html.TextBoxFor(p => p.distributorInfo.NAME, new { @class = "form-control", @id = "modulename", @placeholder = "请输入经销商名称", @datatype = "*", @nullmsg = "请输入经销商名称!", @errormsg = "请输入经销商名称!" })
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">所在省市区:</label>
- <div class="col-lg-8">
- @Html.Hidden("hjzd", Model.distributorInfo.ProvinceCity)
- <select name="hkprov" id="hkprov" onchange="SelectCity('hkprov', 'hkcity')" class="input-sm form-control input-s-sm inline" style="width:145px;">
- <option value="">--请选择--</option>
- </select>
- <select name="hkcity" id="hkcity" onchange="SelectCountry('hkcity', 'hkcountry')" class="input-sm form-control input-s-sm inline" style="width:146px;">
- <option value="">--请选择--</option>
- </select>
- <select name="hkcountry" id="hkcountry" class="input-sm form-control input-s-sm inline" style="width:146px;">
- <option value="">--请选择--</option>
- </select>
- </div>
- </div>
- @*<div class="form-group">
- <label class="col-lg-3 control-label">上传营业执照:</label>
- <div class="col-lg-8">
- <div id="fileNameList">
- </div>
- <div class="cp_img_jia" id="fileNamePicker"></div>
- @*<%--<input type="button" id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;" value="开始上传"> --%>
- <%-- <button id="ctlUpBtn" class="btn btn-default" style="margin-top: 25px;">开始上传</button>--%>
- </div>
- </div>*@
- <div class="form-group">
- <label class="col-lg-3 control-label">地址:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.distributorInfo.Address, new { @class = "form-control", @id = "moduleaddress", @placeholder = "请输入经销商地址,用于创建电子围栏" })
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">电子围栏范围:</label>
- <div class="col-lg-8">
- @Html.HiddenFor(p => p.distributorInfo.FenceID)
- <select name="example_length" aria-controls="example" class="form-control input-sm">
- <option value="100" @(Model.distributorInfo.FenceRadius == 100 ? "selected" : "")>100米</option>
- <option value="200" @(Model.distributorInfo.FenceRadius == 200 ? "selected" : "")>200米</option>
- <option value="500" @(Model.distributorInfo.FenceRadius == 500 ? "selected" : "")>500米</option>
- <option value="1000" @(Model.distributorInfo.FenceRadius == 1000 || Model.distributorInfo.FenceRadius.IsNull() ? "selected" : "")>1000米</option>
- <option value="2000" @(Model.distributorInfo.FenceRadius == 2000 ? "selected" : "")>2000米</option>
- <option value="3000" @(Model.distributorInfo.FenceRadius == 3000 ? "selected" : "")>3000米</option>
- </select>
- @*@Html.TextBoxFor(p => p.distributorInfo.FenceRadius, new { @class = "form-control", @id = "modulepath", @placeholder = "请输入电子围栏范围", @datatype = "n", @nullmsg = "请输入电子围栏范围", @errormsg = "只能输入数字" })*@
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">经纬度:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.distributorInfo.Theodolite, new { @class = "form-control", @id = "moduletheodolite", @placeholder = "请输入经销商经纬度,用于创建电子围栏", @datatype = "*", @nullmsg = "请输入经销商经纬度用逗号隔开", @errormsg = "请输入经销商经纬度!" })
- </div>
- </div>
- @*<div class="form-group">
- <label class="col-lg-3 control-label">所属人员:</label>
- <div class="col-lg-8">
- @{
- var fromuser = ViewData["userid"] as string;
- }
- <span id="readuser" class="form-control" style="padding:8px 5px; font-size:14px;overflow:hidden;">
- @if (!string.IsNullOrEmpty(fromuser))
- {
- @Html.Raw(fromuser.Split('|')[1]);
- }
- </span>
- @Html.Hidden("hidsendUserid", (!string.IsNullOrEmpty(fromuser) ? fromuser.Split('|')[0] : ""))
- <button class="changeicon" id="changesendUser" type="button">
- 选择
- </button>
- </div>
- </div>*@
- <div class="clearfix f-hafl">
- <div class="col-hafl">
- <div class="form-group">
- <label class="col-lg-3 control-label">手机号:</label>
- <div class="col-lg-8">
- @Html.HiddenFor(p => p.userInfo.ID)
- @Html.TextBoxFor(p => p.userInfo.PHONE, new
- {
- @class = "form-control"
- })
- </div>
- </div>
- </div>
- <div class="col-hafl">
- <div class="form-group">
- <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">联系人:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.userInfo.NAME, new { @class = "form-control"
- })
- </div>
- </div>
- </div>
- </div>
- @*<div class="form-group">
- <label class="col-lg-3 control-label">销售产品:</label>
- <div class="col-lg-8">
- @Html.TextBoxFor(p => p.distributorInfo.SaleCar, new { @class = "form-control", @id = "moduletheodolite", @placeholder = "请输入经销商销售产品", @datatype = "*", @nullmsg = "请输入经销商销售产品", @errormsg = "请输入经销商销售产品!" })
- </div>
- </div>*@
- @{
- var fromuser = ViewData["usertype"].ToString();
- if (fromuser == "2")
- {
- <div class="form-group">
- <label class="col-lg-3 control-label">轮拖轮式收条线</label>
- <div class="col-lg-8">
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line1"].ToBool(), new { @value = "601" })
- 轮 拖
- </label>
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line2"].ToBool(), new { @value = "615" })
- 轮式收
- @*<input type="radio" name="sexcode" value="2" @(Model.SEXCODE != null && Model.SEXCODE == 2 ? "checked" : "")>女*@
- </label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">履带插秧条线</label>
- <div class="col-lg-8">
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line3"].ToBool(), new { @value = "612" })
- 履带收
- </label>
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line4"].ToBool(), new { @value = "611" })
- 插秧机
- </label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-lg-3 control-label">玉米收花生机线</label>
- <div class="col-lg-8">
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line5"].ToBool(), new { @value = "622" })
- 玉米收
- </label>
- <label class="radio-inline">
- @Html.CheckBox("ckb_per", ViewData["line6"].ToBool(), new { @value = "628" })
- 花生机
- </label>
- </div>
- </div>
- }
- }
- <div class="hr-line-dashed">
- <div class="form-group m20">
- <div class="col-sm-2 col-sm-offset-2">
- <button class="btn btn-primary btn-save" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
- <button class="btn btn-warning" id="btn-dig-close" type="button"><i class="im-undo2"></i> 取消返回</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- }
- @section scripts{
- <script type="text/javascript">
- var applicationPath = "http://" + window.location.host;
- $(function () {
- var filename = document.getElementById("hidfilename").value;
- if (filename != null && filename != "") {
- //alert(filename);
- var headstr = "<div id=\"WU_FILE_0\" class=\"cpup_img upload-state-done\"><img src=\"";
- var footstr = "\"><div class=\"upcp_img_jian\"></div><p class=\"progress hide\"><span style=\"width: 100%;\"></span></p></div>";
- document.getElementById("fileNameList").innerHTML = headstr + filename + footstr;
- }
- var $ = jQuery, fileId,
- $list = $('#fileNameList'),
- // 优化retina, 在retina下这个值是2
- ratio = window.devicePixelRatio || 1,
- // 缩略图大小
- thumbnailWidth = 90 * ratio,
- thumbnailHeight = 90 * ratio,
- // Web Uploader实例
- uploader;
- uploader = WebUploader.create({
- // 选完文件后,是否自动上传。
- auto: true,
- disableGlobalDnd: true,
- // swf文件路径
- swf: applicationPath + '/Script/Uploader.swf',
- // 文件接收服务端。
- //server: applicationPath + '/Home/UpLoadProcess',
- server: applicationPath + '/Sys/Home/UpLoadProcess',
- // 选择文件的按钮。可选。
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#fileNamePicker',
- //只允许选择图片
- accept: {
- title: 'Images',
- extensions: 'gif,jpg,jpeg,bmp,png',
- mimeTypes: 'image/*'
- }
- });
- // 当有文件添加进来的时候
- uploader.on('fileQueued', function (file) {
- var $li = $(
- '<div id="' + file.id + '" class="cpup_img">' +
- '<img id="jjgimg">' +
- '<div class="upcp_img_jian"></div></div>'
- ),
- $img = $li.find('img');
- $list.children().remove();//先清空元素内容
- if (fileId != file.id && fileId != null) {
- //alert(fileId);
- uploader.removeFile(uploader.getFile(fileId, true));
- }
- fileId = file.id;
- // $list为容器jQuery实例
- $list.append($li);
- // 创建缩略图
- // 如果为非图片文件,可以不用调用此方法。
- // thumbnailWidth x thumbnailHeight 为 100 x 100
- uploader.makeThumb(file, function (error, src) {
- if (error) {
- $img.replaceWith('<span>不能预览</span>');
- return;
- }
- //alert(src);
- //alert(file);
- $img.attr('src', src);
- }, thumbnailWidth, thumbnailHeight);
- });
- //上传压缩宽度
- uploader.option('compress', {
- width: 700
- });
- // 文件上传过程中创建进度条实时显示。
- uploader.on('uploadProgress', function (file, percentage) {
- var $li = $('#' + file.id),
- $percent = $li.find('.progress span');
- // 避免重复创建
- if (!$percent.length) {
- $percent = $('<p class="progress"><span></span></p>')
- .appendTo($li)
- .find('span');
- }
- $percent.css('width', percentage * 100 + '%');
- });
- // 文件上传成功,给item添加成功class, 用样式标记上传成功。
- uploader.on('uploadSuccess', function (file, response) {
- //alert(file.name);//原来文件名
- //alert(response.id);//文件路径
- var imgurl = response.filePath; //上传图片的路径
- var fileid = response.fileid; //上传图片的路径
- console.log(response.id);
- console.log(imgurl);
- $('#' + file.id).addClass('upload-state-done');
- //alert(document.getElementById("fileNameList").innerHTML.replace('class="progress"', 'class="progress hide"'));
- $("#hidfilename").val(imgurl);
- $("#jjgimg").attr('src', imgurl);//季健国加为了解决保存一串字符串
- $("#hidfileid").val(fileid);
- });
- // 文件上传失败,显示上传出错。
- uploader.on('uploadError', function (file) {
- var $li = $('#' + file.id),
- $error = $li.find('div.error');
- // 避免重复创建
- if (!$error.length) {
- $error = $('<div class="error"></div>').appendTo($li);
- }
- $error.text('上传失败');
- });
- // 完成上传完了,成功或者失败,先删除进度条。
- uploader.on('uploadComplete', function (file) {
- $('#' + file.id).find('.progress').remove();
- });
- //所有文件上传完毕
- uploader.on("uploadFinished", function () {
- //提交表单
- });
- //开始上传
- $("#ctlUpBtn").click(function () {
- uploader.upload();
- });
- //显示删除按钮
- $(".cpup_img").on("mouseover", function () {
- $(this).children(".upcp_img_jian").css('display', 'block');
- });
- //隐藏删除按钮
- $(".cpup_img").on("mouseout", function () {
- $(this).children(".upcp_img_jian").css('display', 'none');
- });
- //执行删除方法
- $list.on("click", ".upcp_img_jian", function () {
- var Id = $(this).parent().attr("id");
- try {
- uploader.removeFile(uploader.getFile(Id, true));
- }
- catch (ex) { }
- $(this).parent().remove();
- });
- $('.form-horizontal').initValidform();
- $('.select2').select2();
- //分配部门
- $('#changeDpt').click(function () {
- var vals = $('#hiddpt').val();
- top.dialog({
- url: '/Sys/Department/GetSelectDpt',
- title: '选择景点',
- width: 450,
- height: 500,
- data: vals, // 给 iframe 的数据
- onclose: function () {
- if (this.returnValue != 'no') {
- $('#hiddpt').val(this.returnValue.split('|')[0]);
- $('#dpt').html(this.returnValue.split('|')[1]);
- //清理岗位
- $('#hidpost').val('');
- $('#post').html('');
- }
- },
- oniframeload: function () {
- }
- }).showModal();
- return false;
- });
- $('#changesendUser').click(function () {
- var vals = $('#hidsendUserid').val();
- dig.addModel('选择用户', '/Sys/User/SelectUser?userid=' + vals, 800, 500, function () {
- if (this.returnValue != 'no' && this.returnValue != 'undefined' && this.returnValue != '') {
- var vl = "";
- if ($('#hidsendUserid').val() == "") {
- vl = this.returnValue.split('|')[0]
- }
- else {
- vl = $('#hidsendUserid').val() + "," + this.returnValue.split('|')[0]
- }
- //alert(vl);
- $('#hidsendUserid').val(vl);
- var vals = "";
- if ($('#readuser').html().replace(/^\s\s*/, '').replace(/\s\s*$/, '').length == 0) {
- vals = this.returnValue.split('|')[1];
- }
- else {
- vals = $('#readuser').html().replace(/^\s\s*/, '').replace(/\s\s*$/, '') + "," + this.returnValue.split('|')[1];
- }
- $('#readuser').html(vals);
- }
- });
- });
- $("#moduletheodolite").change(function () {
- var latlnt = $('#moduletheodolite').val();
- $.ajax({
- url: '/Sys/Distributors/getLatLntAdderss?latlntstr=' + latlnt,
- data: null,
- type: 'post',
- dataType: 'json',
- async: false,
- cache: false,
- success: function (res) {
- if (res.Status == 'y') {
- //alert(res.Data);
- $('#moduleaddress').val(res.Data);
- }
- else {
- dig.alertError('提示', res.Data);
- }
- }
- });
- });
- //分配岗位
- $('#changePost').click(function () {
- var dptid = $('#DPTID').val() + ',' + $('#hiddpt').val();
- if ($('#DPTID').val() == '' && $('#hiddpt').val() == '') {
- dig.alertError('提示', '请选择部门后再选择岗位');
- return;
- }
- var vals = $('#hidpost').val();
- top.dialog({
- url: '/Sys/Post/PostUser?dptid=' + dptid,
- title: '分配岗位',
- width: 500,
- height: 500,
- data: vals, // 给 iframe 的数据
- onclose: function () {
- if (this.returnValue != 'no') {
- var vl = this.returnValue.split('|')[0]
- $('#hidpost').val(vl);
- var vals = $('#readuser').val() + this.returnValue.split('|')[1]
- $('#post').html(vals);
- }
- },
- oniframeload: function () {
- }
- }).showModal();
- return false;
- });
- });
- $.ajax({
- url: '/Sys/CodeArea/prov',
- data: null,
- type: 'post',
- dataType: 'json',
- async: false,
- cache: false,
- success: function (res) {
- if (res.Status == 'y') {
- var option = '<option value="">--请选择--</option>';
- var data = eval(res.Data);
- for (var i = 0; i < data.length; i++) {
- var jsonH = data[i];
- option += '<option value="' + jsonH.Code + '">' + jsonH.Name + '</option>';
- }
- $('#hkprov').html(option);
- }
- }
- });
- //所在省市区
- var hjzd = $('#hjzd').val();
- if (hjzd != '') {
- var hkprov = hjzd.split(',')[0];
- var hkcity = hjzd.split(',')[1];
- var hkcountry = hjzd.split(',')[2];
- $('#hkprov').find('option[value="' + hkprov + '"]').attr('selected', 'selected');
- if (hkprov != '') {
- SelectCity('hkprov', 'hkcity');
- $('#hkcity').find('option[value="' + hkcity + '"]').attr('selected', 'selected');
- if (hkcity != '') {
- SelectCountry('hkcity', 'hkcountry');
- $('#hkcountry').find('option[value="' + hkcountry + '"]').attr('selected', 'selected');
- }
- }
- }
- //加载城市
- function SelectCity(t, n) {
- var prov = $('#' + t).val();
- var city = $('#' + n);
- var option = '<option value="">--请选择--</option>';
- if (prov == '') {
- city.html(option);
- } else {
- $.ajax({
- url: '/Sys/CodeArea/City/' + prov,
- data: null,
- type: 'post',
- dataType: 'json',
- async: false,
- cache: false,
- success: function (res) {
- if (res.Status == 'y') {
- var data = eval(res.Data);
- for (var i = 0; i < data.length; i++) {
- var jsonH = data[i];
- option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
- }
- }
- city.html(option);
- }
- });
- }
- }
- //加载县级市
- function SelectCountry(t, n) {
- var city = $('#' + t).val();
- var country = $('#' + n);
- var option = '<option value="">--请选择--</option>';
- if (city == '') {
- country.html(option);
- } else {
- $.ajax({
- url: '/Sys/CodeArea/Country/' + city,
- data: null,
- type: 'post',
- dataType: 'json',
- async: false,
- cache: false,
- success: function (res) {
- if (res.Status == 'y') {
- var data = eval(res.Data);
- for (var i = 0; i < data.length; i++) {
- var jsonH = data[i];
- option += '<option value="' + jsonH.AreaCode + '">' + jsonH.AreaName + '</option>';
- }
- }
- country.html(option);
- }
- });
- }
- }
- </script>
- }
|