纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

232 lines
9.7 KiB

@{
ViewBag.Title = "Form";
Layout = "~/Views/Shared/_Form.cshtml";
}
<link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
<script src="~/Content/js/CommonReport/CommonReport.js"></script>
<link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
<script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
<style>
* {
box-sizing: border-box;
}
</style>
<script>
var ID = $.request("ID");
$(function () {
$(".HideTxt").css('display', 'none');
GetAllDataBase();
if (ID != "") {
GetTXT();
}
});
function GetTXT() {
if (!!ID) {
$.ajax({
url: "/WMS/BasicSettings/GetTXT?ID=" + ID + "&" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
debugger;
$("#txtSourceName").val(data.rows[0].SourceName);
if (data.rows[0].SysDataFlag= '1') {
$("#chkSysDataFlag")[0].checked = true;
}
if (data.rows[0].WorkPointDataFlag = '1') {
$("#chkWorkPointDataFlag")[0].checked = true;
}
$("#Select_DataBase").selectpicker('val', data.rows[0].OtherDataBaseID);
$("#txtFormatSqlTxt").val(data.rows[0].FormatSqlTxt);
$("#txtLinkCols").val(data.rows[0].LinkCols);
$("#txtLink2Cols").val(data.rows[0].Link2Cols);
$("#txtParas").val(data.rows[0].Paras);
$("#txtDbParas").val(data.rows[0].DbParas);
}
});
}
};
//加载所有DB选项
function GetAllDataBase()
{
$.ajax({
url: "/SystemManage/CommonReport/GetAllDataBase?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data != false && data != null && data.length > 0) {
$("#Select_DataBase").find("option").remove();
$("#Select_DataBase").append("<option value=''></option>");
for (var i = 0; i < data.length; i++) {
$("#Select_DataBase").append("<option value='" + data[i].DbId + "'>" + data[i].DBSourceDesc + "</option>");
}
}
$('#Select_DataBase').selectpicker('refresh');
$('#Select_DataBase').selectpicker('render');
}
});
}
function submitForm() {
var Sys_LableDataSource = [];
var SysDataSourceFlag = "1";
var WorkPointDataFlag = "1";
var OtherDataBaseID = $("#Select_DataBase").val();//其他数据源
var chkSysDataFlag = $("#chkSysDataFlag")[0];
var chkWorkPointDataFlag = $("#chkWorkPointDataFlag")[0];
var SourceName = $("#txtSourceName").val();//数据源名称
var FormatSqlTxt = $("#txtFormatSqlTxt").val();//sql
if (!chkSysDataFlag.checked) { SysDataSourceFlag = "0"; }//框架数据库
if (!chkWorkPointDataFlag.checked) { WorkPointDataFlag = "0"; }//当前站点数据
var LinkCols = $("#txtLinkCols").val();//主子关系
var Link2Cols = $("#txtLink2Cols").val();//三级主子关系
var Paras = $("#txtParas").val();//传入参数
var DbParas = $("#txtDbParas").val();//跨库参数
if (SourceName == '' || SourceName==undefined) {
$.modalAlert("请输入数据源名称!");
return;
}
if (FormatSqlTxt == '' || FormatSqlTxt==undefined) {
$.modalAlert("请输入sql!");
return;
}
if (SysDataSourceFlag == '0' && WorkPointDataFlag=='0') {
$.modalAlert("请选择数据源!");
return;
}
var obj = {
ID:ID,
OtherDataBaseID: OtherDataBaseID,//其他数据源
SourceName: SourceName,//数据源名称
FormatSqlTxt: FormatSqlTxt,//sql
SysDataSourceFlag: SysDataSourceFlag,//框架数据库
WorkPointDataFlag: WorkPointDataFlag,//当前站点数据
LinkCols: LinkCols,//主子关系
Link2Cols: Link2Cols,//三级主子关系
Paras: Paras,//传入参数
DbParas: DbParas//跨库参数
}
Sys_LableDataSource.push(obj);
if (ID=='') {
$.modalConfirm("确定新建吗?", function (r) {
if (r) {
$.submitForm({
url: "/WMS/BasicSettings/CreateLableDataSource" + "?" + Math.random(),
param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
} else {
$.modalConfirm("确定修改吗?", function (r) {
if (r) {
$.submitForm({
url: "/WMS/BasicSettings/updateLableDataSource" + "?" + Math.random(),
param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
}
}
</script>
<form id="form1">
<div class="widget-body">
<div style="padding-top: 5px; ">
<div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
<div class="step-pane active" id="step-1" style="padding-left: 5px; padding-top: 20px; margin-right: 20px;">
<table class="form">
<tr>
<th class="formTitle">数据源名称: </th>
<td class="formValue" style="overflow:auto" colspan="4">
<input class="form-control" name="txtSourceName" id="txtSourceName" style="width: 95%" />
</td>
</tr>
<tr>
<th class="formTitle" style="width:85px">数据库: </th>
<td class="formValue" style="width:170px">
<label class="radio-inline">
<input type="checkbox" name="chkSysDataFlag" id="chkSysDataFlag" value="1" />框架数据库
</label>
</td>
<td class="formValue" style="width:170px">
<label class="radio-inline">
<input type="checkbox" name="chkWorkPointDataFlag" id="chkWorkPointDataFlag" value="1" /> 当前站点数据
</label>
</td>
<td colspan="1"></td>
<td class="formValue">
其他数据源
</td>
<td class="formValue" style="width:175px">
<select id="Select_DataBase" name="Select_DataBase" title="" class="selectpicker" data-width="140px"></select>
</td>
</tr>
<tr>
<th class="formTitle">数据源SQL: </th>
<td class="formValue" style="height:300px;overflow:auto" colspan="5">
<textarea class="form-control" name="txtFormatSqlTxt" id="txtFormatSqlTxt" style="width: 95%;height:100%" wrap="soft"></textarea>
</td>
</tr>
<tr>
<th class="formTitle">主子关系: </th>
<td class="formValue" style="overflow:auto" colspan="1">
<input class="form-control" name="txtLinkCols" id="txtLinkCols" style="width: 95%" />
</td>
<th class="formTitle HideTxt">三级主子关系: </th>
<td class="formValue HideTxt" style="overflow:auto" colspan="1">
<input class="form-control HideTxt" name="txtLink2Cols" id="txtLink2Cols" style="width: 95%" />
</td>
</tr>
<tr>
<th class="formTitle">传入参数(替代符): </th>
<td class="formValue" style="overflow:auto" colspan="4">
<input class="form-control" name="txtParas" id="txtParas" style="width: 95%" />
</td>
<td class="formValue" style="height:45px; ">多个参数用,分隔 </td>
</tr>
<tr>
<th class="formTitle HideTxt">跨库参数: </th>
<td class="formValue HideTxt" style="overflow:auto" colspan="4">
<input class="form-control HideTxt" name="txtDbParas" id="txtDbParas" style="width: 95%" />
</td>
<td class="formValue" style="height:45px; ">多个参数用,分隔 </td>
</tr>
</table>
</div>
</div>
</div>
</div>
</form>