254 lines
12 KiB
Plaintext
254 lines
12 KiB
Plaintext
@using BaseOUDAL
|
|
@model List<Dictionary>
|
|
@{
|
|
ViewBag.Title = "财务汇总 | 维护财务编码";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
var nv = YieldChain.Helpers.UrlHelper.ParseQueryString(PS.Config.ErpElement.YongYouKeMuCode) ?? new System.Collections.Specialized.NameValueCollection();
|
|
}
|
|
|
|
@section CSS{
|
|
<style>
|
|
.table-kemucode tr > td:first-child {
|
|
width: 120px;
|
|
max-width: 120px;
|
|
}
|
|
|
|
.table-kemucode tr > td:last-child {
|
|
text-align: left !important;
|
|
}
|
|
|
|
.tdkey {
|
|
position: relative;
|
|
width: 150px;
|
|
}
|
|
</style>
|
|
}
|
|
@section JS{
|
|
<script>
|
|
var DicId = 0, selectName = "";
|
|
$(function () {
|
|
let $tabs = $('#myTab a');
|
|
$tabs.one(function () {
|
|
loadHtml(DicId);
|
|
});
|
|
$tabs.on('click', function (event) {
|
|
event.preventDefault();
|
|
DicId = $(this).data("id");
|
|
selectName = $(this).text().trim();
|
|
if (selectName !== '用友科目编码') {
|
|
loadHtml(DicId);
|
|
}
|
|
$(this).tab('show');
|
|
});
|
|
$tabs.get(0).click();
|
|
});
|
|
function loadHtml(id) {
|
|
if ($('#tab' + id).data('loadHtml') === '1') return;
|
|
|
|
main.post("/System/getDictionaryItems", { dictId: id }).done(function (data) {
|
|
$('#tab' + id).data('loadHtml', '1');
|
|
items = data.obj;
|
|
var str = "<ol><span style='min-width:180px;display: inline-block;'>名称</span><span style='width:180px;display: inline-block;'>简称</span>";
|
|
$.each(items, function (i) {
|
|
str += "<li><span id='nameSpan" + this.Id + "' style='width:180px;display: inline-block;'>" + this.Name
|
|
+ "</span><span id='shortNameSpan" + this.Id + "' style='width:180px;display: inline-block;'>" + (this.ShortName == undefined ? "" : this.ShortName)
|
|
+ "</span><input type='text' id='nameText" + this.Id + "' style='display:none' value='"
|
|
+ this.Name + "'/><input type='text' id='shortNameText" + this.Id + "' style='display:none' value='"
|
|
+ (this.ShortName == undefined ? "" : this.ShortName) + "'/><input class='btn btn-sm btn-outline-danger' type='button' id='" + this.Id + "' onclick='edititem(this);' value='修改'/>" +
|
|
"<a href='#' onclick='UpItem(" + this.Id + ")'><span class='glyphicon glyphicon-arrow-up'></span></a> " +
|
|
"<a href='#' onclick='DownItem(" + this.Id + ")'><span class='glyphicon glyphicon-arrow-down'></span></a> " +
|
|
"<a href='#' onclick='DeleteItem(" + this.Id + ")'><span class='glyphicon glyphicon-remove'></span></a>" +
|
|
"</li>";
|
|
});
|
|
str += "<li><input type='text' id='newItemName" + id + "' class='mr-4' /><input type='text' id='newItemShortName" + id + "' class='mr-4' /><input type='button' class='btn btn-sm btn-outline-danger ml-3' onclick='addnewitem();' value='添加'/></li><ol>";
|
|
$("#tab" + id).children("div:last").html(str);
|
|
});
|
|
}
|
|
|
|
function reloadDic(){
|
|
showDic(DicId);
|
|
}
|
|
|
|
function showDic(id) {
|
|
main.post("/System/getDictionaryItems", { dictId: id }).done(function (data) {
|
|
items = data.obj;
|
|
var str = "<ol><span style='min-width:180px;display: inline-block;'>名称</span><span style='width:180px;display: inline-block;'>简称</span>";
|
|
$.each(items, function (i) {
|
|
str += "<li><span id='nameSpan" + this.Id + "' style='width:180px;display: inline-block;'>" + this.Name
|
|
+ "</span><span id='shortNameSpan" + this.Id + "' style='width:180px;display: inline-block;'>" + (this.ShortName == undefined ? "" : this.ShortName)
|
|
+ "</span><input type='text' id='nameText" + this.Id + "' style='display:none' value='"
|
|
+ this.Name + "'/><input type='text' id='shortNameText" + this.Id + "' style='display:none' value='"
|
|
+ (this.ShortName == undefined ? "" : this.ShortName) + "'/><input class='btn btn-sm btn-outline-danger' type='button' id='" + this.Id + "' onclick='edititem(this);' value='修改'/>" +
|
|
"<a href='#' onclick='UpItem(" + this.Id + ")'><span class='glyphicon glyphicon-arrow-up'></span></a> " +
|
|
"<a href='#' onclick='DownItem(" + this.Id + ")'><span class='glyphicon glyphicon-arrow-down'></span></a> " +
|
|
"<a href='#' onclick='DeleteItem(" + this.Id + ")'><span class='glyphicon glyphicon-remove'></span></a>" +
|
|
"</li>";
|
|
});
|
|
str += "<li><input type='text' id='newItemName" + id + "' class='mr-4' /><input type='text' id='newItemShortName" + id + "' class='mr-4' /><input type='button' class='btn btn-sm btn-outline-danger ml-3' onclick='addnewitem();' value='添加'/></li><ol>";
|
|
$("#tab" + id).children("div:last").html(str);
|
|
});
|
|
}
|
|
|
|
function addnewitem() {
|
|
var name = $("#newItemName" + DicId).val();
|
|
var shortName = $("#newItemShortName" + DicId).val();
|
|
$.post("/System/addDictionaryItem", { dictId: DicId, name: name, shortName: shortName }, function (data, textStatus) {
|
|
this;
|
|
if (data.success == false) {
|
|
main.alert(data.msg);
|
|
return;
|
|
}
|
|
showDic(DicId);
|
|
});
|
|
}
|
|
function edititem(obj) {
|
|
if (obj.value == "修改") {
|
|
$("#nameText" + obj.id).show();
|
|
$("#shortNameText" + obj.id).show();
|
|
$("#customerNatureText1" + obj.id).show();
|
|
$("#customerNatureText2" + obj.id).show();
|
|
$("#nameSpan" + obj.id).hide();
|
|
$("#shortNameSpan" + obj.id).hide();
|
|
$("#customerNatureSpan1" + obj.id).hide();
|
|
$("#customerNatureSpan2" + obj.id).hide();
|
|
obj.value = "提交";
|
|
} else {
|
|
var shortName = $("#shortNameText" + obj.id).val();
|
|
if (selectName == "行业") {
|
|
if ($("#customerNatureText1" + obj.id).val() == '' || $("#customerNatureText2" + obj.id).val() == '') {
|
|
main.alert("客户性质不可为空");
|
|
return;
|
|
}
|
|
shortName = $("#customerNatureText1" + obj.id).val() + "," + $("#customerNatureText2" + obj.id).val();
|
|
}
|
|
$.post("/System/editDictionaryItem", { itemId: obj.id, name: $("#nameText" + obj.id).val(), shortName: shortName }, function (data, textStatus) {
|
|
this;
|
|
if (data.success == false) {
|
|
main.alert(data.msg);
|
|
return;
|
|
}
|
|
$("#nameText" + obj.id).hide();
|
|
$("#shortNameText" + obj.id).hide();
|
|
$("#customerNatureText1" + obj.id).hide();
|
|
$("#customerNatureText2" + obj.id).hide();
|
|
$("#nameSpan" + obj.id).show();
|
|
$("#shortNameSpan" + obj.id).show();
|
|
$("#customerNatureSpan1" + obj.id).show();
|
|
$("#customerNatureSpan2" + obj.id).show();
|
|
obj.value = "修改";
|
|
$("#nameSpan" + obj.id).html($("#nameText" + obj.id).val());
|
|
$("#shortNameSpan" + obj.id).html($("#shortNameText" + obj.id).val());
|
|
$("#customerNatureSpan1" + obj.id).html($("#customerNatureText1" + obj.id).val());
|
|
$("#customerNatureSpan2" + obj.id).html($("#customerNatureText2" + obj.id).val());
|
|
});
|
|
}
|
|
}
|
|
function DeleteItem(id) {
|
|
if (confirm('删除后不可恢复,确定要删除吗?')) {
|
|
$.post("/System/DeleteDictionaryItem", { itemId: id }, function (data, textStatus) {
|
|
this;
|
|
if (data.success == false) {
|
|
main.alert(data.msg);
|
|
return;
|
|
}
|
|
showDic(DicId);
|
|
});
|
|
}
|
|
}
|
|
function UpItem(id) {
|
|
$.post("/System/UpDictionaryItem", { itemId: id }, function (data, textStatus) {
|
|
this;
|
|
if (data.success == false) {
|
|
main.alert(data.msg);
|
|
return;
|
|
}
|
|
showDic(DicId);
|
|
});
|
|
}
|
|
function DownItem(id) {
|
|
$.post("/System/DownDictionaryItem", { itemId: id }, function (data, textStatus) {
|
|
this;
|
|
if (data.success == false) {
|
|
main.alert(data.msg);
|
|
return;
|
|
}
|
|
showDic(DicId);
|
|
});
|
|
}
|
|
function BatchImport() {
|
|
var scrurl = "/trade/YonYouClientCodeUpload";
|
|
main.open("销售员导入", scrurl, { area: ['550px', '300px'] });
|
|
}
|
|
function ExportAll() {
|
|
var srcurl = "/trade/ExportYonYouClientCode";
|
|
main.formOpenNewPage(srcurl);
|
|
}
|
|
|
|
function ButYongYouKeMuCode() {
|
|
var kemuForm = $('#kemuForm').serialize()
|
|
main.post("/trade/SaveYongYouKeMuCode", kemuForm).done(function (data) {
|
|
window.showmiddlemessage("保存成功");
|
|
});
|
|
}
|
|
</script>
|
|
}
|
|
|
|
<ul id="myTab" class="nav nav-tabs nav-main">
|
|
@foreach (var item in Model)
|
|
{
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#tab@(item.Id)" name="tabTitle" data-toggle="tab" data-id="@(item.Id)">@item.Name</a>
|
|
</li>
|
|
}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#tab_0" name="tabTitle" data-toggle="tab">用友科目编码</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="tab-content yc-panel my-0 p-0">
|
|
@foreach (var item in Model)
|
|
{
|
|
<div class="tab-pane" id="tab@(item.Id)">
|
|
@if (item.Name == "用友客商编码")
|
|
{
|
|
<div class="searchbtn mx-2" tag="用友客商编码">
|
|
@MyControls.Btn("批量导入", "BatchImport()")
|
|
@MyControls.Btn("全部导出", "ExportAll()")
|
|
</div>
|
|
}
|
|
<div class=""></div>
|
|
</div>
|
|
}
|
|
<div class="tab-pane p-4" id="tab_0">
|
|
<form id="kemuForm">
|
|
<table class="table table-center table-kemucode">
|
|
|
|
|
|
@if (PS.Config.Is中粮)
|
|
{
|
|
foreach (var key in nv.AllKeys)
|
|
{
|
|
<tr>
|
|
<td rowspan="2" style="white-space:normal;width:50%">@key</td>
|
|
<td rowspan="2"> <input name="@key" type="text" value="@(nv[key])" /></td>
|
|
</tr>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
foreach (var key in nv.AllKeys)
|
|
{
|
|
<tr>
|
|
<td>@key</td>
|
|
<td><input name="@key" type="text" value="@(nv[key])" /></td>
|
|
</tr>
|
|
}
|
|
}
|
|
</table>
|
|
|
|
</form>
|
|
<div class="mt-3" style="padding-left:200px;">
|
|
@MyControls.Btn("保存", "ButYongYouKeMuCode()")
|
|
</div>
|
|
</div>
|
|
</div> |