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.
199 lines
7.0 KiB
199 lines
7.0 KiB
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
|
|
Inherits="System.Web.Mvc.ViewPage<QMAPP.Common.Web.Models.QueryMoreModel>" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
|
<%=Html.QPEdit()%>
|
|
<table id="dg" class="easyui-datagrid" style="width: 410px; height: 320px" data-options="onClickRow: onClickRow,singleSelect: true">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'attr1',width:400,editor:'text'">
|
|
条件(请不要超过400条记录)
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<%=Html.HiddenFor(p => p.TextField)%>
|
|
<%=Html.HiddenFor(p=>p.ValueField) %>
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
|
|
<table cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td>
|
|
<%=Html.QTButton("save", "FactoryList", QMFrameWork.WebUI.IconCls.save, "Save()", (s, f) => { return true; })%>
|
|
<%=Html.QTButton("paste", "FactoryList", QMFrameWork.WebUI.IconCls.redo, "QueryMore()", (s, f) => { return true; })%>
|
|
<%=Html.QTButton("clear", "FactoryList", QMFrameWork.WebUI.IconCls.redo, "Clear()", (s, f) => { return true; })%>
|
|
<%=Html.QTButton("create", "FactoryList", QMFrameWork.WebUI.IconCls.add, "AddRow()", (s, f) => { return true; })%>
|
|
<%=Html.QTButton("delete", "FactoryList", QMFrameWork.WebUI.IconCls.remove, "DelRow()", (s, f) => { return true; })%>
|
|
<%=Html.QTButtonBack("close", "CargoTypeList", "parent.closeAppWindow1();return false;")%>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<script type="text/javascript">
|
|
document.onkeydown = function () {
|
|
if (event.ctrlKey && event.keyCode == 86) {
|
|
QueryMore();
|
|
}
|
|
if (event.keyCode == 13) {
|
|
return false;
|
|
}
|
|
}
|
|
document.onkeypress = function () {
|
|
if (event.keyCode == 13) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$(function () {
|
|
var str = new Array();
|
|
str = parent.document.getElementById($("#ValueField").val()).value.split(",");
|
|
append(str);
|
|
});
|
|
|
|
var editIndex = undefined;
|
|
function endEditing() {
|
|
if (editIndex == undefined) { return true }
|
|
if ($('#dg').datagrid('validateRow', editIndex)) {
|
|
var ed = $('#dg').datagrid('getEditor', { index: editIndex, field: 'attr1' });
|
|
$('#dg').datagrid('endEdit', editIndex);
|
|
editIndex = undefined;
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function onClickRow(index) {
|
|
if (editIndex != index) {
|
|
if (endEditing()) {
|
|
$('#dg').datagrid('selectRow', index)
|
|
.datagrid('beginEdit', index);
|
|
editIndex = index;
|
|
} else {
|
|
$('#dg').datagrid('selectRow', editIndex);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function append(copytext) {
|
|
if (copytext.length > 0) {
|
|
for (var i = 0; i < copytext.length; i++) {
|
|
$('#dg').datagrid('appendRow', { attr1: copytext[i] });
|
|
}
|
|
}
|
|
else {
|
|
$('#dg').datagrid('appendRow', { attr1: '' });
|
|
}
|
|
|
|
}
|
|
|
|
function removeit() {
|
|
editIndex = $('#dg').datagrid('getRows').length;
|
|
if (editIndex == 0) { return }
|
|
var bb = $('#dg').datagrid('getRows')[0]['attr1'];
|
|
if (bb == "") {
|
|
$('#dg').datagrid('cancelEdit', editIndex - 1)
|
|
.datagrid('deleteRow', editIndex - 1);
|
|
}
|
|
}
|
|
|
|
|
|
function QueryMore() {
|
|
var text = window.clipboardData.getData("Text");
|
|
if (text == "") { return; }
|
|
var cc = window.clipboardData.getData("Text").split("\r\n");
|
|
removeit();
|
|
for (var i = 0; i < cc.length; i++) {
|
|
if (i == 400) {
|
|
debugger;
|
|
break;
|
|
}
|
|
$('#dg').datagrid('appendRow', { attr1: cc[i] });
|
|
}
|
|
}
|
|
|
|
function Save() {
|
|
$('#dg').datagrid('acceptChanges');
|
|
var hidcontent = '';
|
|
if ($('#dg').datagrid('getRows').length == 0) {
|
|
parent.document.getElementById($("#ValueField").val()).value = "";
|
|
parent.document.getElementById($("#TextField").val()).value = "";
|
|
parent.closeAppWindow1();
|
|
return false;
|
|
}
|
|
var first = $('#dg').datagrid('getRows')[0]['attr1'];
|
|
|
|
editIndex = $('#dg').datagrid('getRows').length;
|
|
for (var i = 0; i < editIndex; i++) {
|
|
if ($('#dg').datagrid('getRows')[i]['attr1'] != '') {
|
|
hidcontent = hidcontent + $('#dg').datagrid('getRows')[i]['attr1'] + ',';
|
|
}
|
|
}
|
|
|
|
if (hidcontent != "")
|
|
hidcontent = hidcontent.substr(0, hidcontent.length - 1);
|
|
|
|
parent.document.getElementById($("#ValueField").val()).value = hidcontent;
|
|
if (first != "")
|
|
first += "...";
|
|
parent.document.getElementById($("#TextField").val()).value = first;
|
|
parent._callBackfun(hidcontent);
|
|
parent.closeAppWindow1();
|
|
return false;
|
|
}
|
|
|
|
function Clear() {
|
|
$('#dg').datagrid("loadData", { total: 0, rows: [] });
|
|
append('');
|
|
}
|
|
|
|
|
|
function selectChanged() {
|
|
alert(1);
|
|
}
|
|
|
|
function Import() {
|
|
|
|
var fileName = window.showModalDialog("/File/UploadFile", "", "dialogHeight: 200px; dialogWidth: 300px; center: Yes; help: Yes;status: Yes;");
|
|
|
|
if (fileName == null)
|
|
return;
|
|
|
|
document.getElementById("fileName").value = fileName;
|
|
|
|
//处理等待
|
|
_showProgress();
|
|
|
|
submitByButton("ImportExcel");
|
|
}
|
|
|
|
//下载模板
|
|
function GetTemplate() {
|
|
submitByButton("GetTemplate");
|
|
}
|
|
|
|
function AddRow() {
|
|
$('#dg').datagrid('appendRow', { attr1: '' });
|
|
editIndex++;
|
|
$('#dg').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
}
|
|
|
|
function DelRow() {
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row == null) { return }
|
|
if (editIndex == undefined) { return }
|
|
$('#dg').datagrid('cancelEdit', editIndex)
|
|
.datagrid('deleteRow', editIndex);
|
|
editIndex = undefined;
|
|
}
|
|
|
|
function accept() {
|
|
if (endEditing()) {
|
|
$('#dg').datagrid('acceptChanges');
|
|
}
|
|
}
|
|
</script>
|
|
</asp:Content>
|
|
|