123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
-
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width" />
- <title>Farms</title>
- <link href="~/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
- <link href="~/easyui/themes/icon.css" rel="stylesheet" />
- <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
- <script src="~/Content/js/jquery.min.js"></script>
- <script src="~/Content/js/bootstrap.min.js"></script>
- <script src="~/easyui/jquery.easyui.min.js"></script>
- <script src="~/easyui/jquery.easyui.mobile.js"></script>
- <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
- <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
- <script src="~/Content/js/plugins/layer/layer.min.js"></script>
- <script src="~/js/Utils.js"></script>
- <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
- <style>
- .td_1 {
- padding-bottom: 5px;
- padding-left: 5px;
- }
- </style>
- </head>
- <body>
- <section class="hidden">
- <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
- <input id="hid_IsLock" name="IsLock" type="hidden" value="0" />
- <input id="hid_MarketType" name="hid_MarketType" type="hidden" value="0" />
- </section>
- @*<section class="text-center title">
- <h2>市场信息</h2>
- </section>*@
- <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
- <div class="row tbToolBar" id="tbToolBar">
- <div class="toolbar">
- <label>
- <input type="checkbox" id="DataToggle"> 显示已删除记录
- </label>
- </div>
- <div class="toolbar" id="CurdTool" style="float:left">
-
- <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
- <span class="shuxian"></span>
- <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
- <span class="shuxian"></span>
- <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
- @*<input class="btn btn-primary" id="btn_back" type="button" value="返回" onclick="btn_Back()"/>*@
- </div>
- <div class="col-sm-3" id="ResetTool">
- <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
- </div>
- <div class="toolbar-search">
- <span>【请选择查询条件】</span>
- <input class="easyui-searchbox" data-options="prompt:'请输入查询条件...',menu:'#search',searcher:LoadTable" style="width: 300px;height:25px;" />
- <div id="search">
- <div data-options="name:'ShortNames'">单位简称</div>
-
- </div>
- </div>
- </div>
- <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
- data-options="singleSelect: true,
- method: 'post',
- multiSort: false,
- toolbar: '#tbToolBar',
- fitColumns: true,
- rownumbers: true,
- remoteSort: false,
- loadFilter: pagerFilter,
-
- pagination: true,
- pageSize: 15,
- pageList: [15, 25, 50, 100]
- ">
- <thead>
- <tr>
- @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
- <th data-options="field:'FarmID',width:50">编号</th>
- <th data-options="field:'ShortNames',width:80,">简称</th>
- <th data-options="field:'LinkMan',width:50,">联系人</th>
- <th data-options="field:'Telephone',width:50,">电话</th>
- </tr>
- </thead>
- </table>
- </section>
- <section>
- <div id="winModal" class="easyui-window winModal" title="单位信息维护" style="width: 600px; height: 450px;padding:5px;"
- iconCls="icon-save" data-options="modal:true,closed:true">
- <div class="easyui-layout" data-options="fit:true" style="height:400px">
- <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
- <table cellpadding="10" cellspacing="0" style="margin-left:10px">
- <tr>
- <td class="td_1">地区</td>
- <td class="td_1">
- <input class="easyui-combotree" id="RegionID" data-options="url:'/BaseInfo/GetTreeRegion',method:'post',loadFilter: function (rows) {
- return convert(rows);
- }" style="width:200px;height:20px" />
- </td>
- <td class="td_1">单位系列</td>
- <td class="td_1">
- <select id="SeriesType" class="easyui-combobox" name="SeriesType" style="width:200px;height:20px">
- @Html.Raw(ViewBag.SelSeriesType)
- </select>
- </td>
- </tr>
- <tr>
- <td class="td_1">单位编号</td>
- <td class="td_1"><input class="easyui-textbox" type="text" id="FarmID" name="FarmID" data-options="required:true" style="width:200px;height:20px" /></td>
- <td class="td_1">简称</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="ShortNames" name="ShortNames" data-options="required:true" style="width:200px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">地址</td>
- <td class="td_1"><input class="easyui-textbox" type="text" id="Address" name="Address" style="width:200px;height:20px" /></td>
- <td class="td_1">单位全称</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="Names" name="Names" data-options="required:true" style="width:200px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">联系人</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="LinkMan" name="LinkMan" style="width:200px;height:20px" />
- </td>
- <td class="td_1">电话</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="Telephone" name="Telephone" style="width:200px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">邮编</td>
- <td class="td_1"><input class="easyui-textbox" type="text" id="ZIP" name="ZIP" style="width:200px;height:20px;" data-options="validType:{length:[0,10]},invalidMessage:'不能超过10个字符!'" /></td>
- <td class="td_1">网址</td>
- <td class="td_1">
- <input class="easyui-textbox" type="text" id="FarmURL" name="FarmURL" style="width:200px;height:20px" />
- </td>
- </tr>
- <tr>
- <td class="td_1">是否能进行商品检测</td>
- <td class="td_1" colspan="3" align="left"><input type="checkbox" id="IsSystem" name="IsSystem" style="width:20px;height:20px;" checked/></td>
-
- </tr>
- <tr>
- <td class="td_1">备注</td>
- <td class="td_1" colspan="3">
- <textarea id="Remark" rows="4" style="width:467px"></textarea>
- </td>
-
- </tr>
-
-
- </table>
- </div>
- <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
- <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
- <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
- </div>
- </div>
- </div>
- </section>
- <script>
- //切换显示不同状态数据
- $("#DataToggle").on("click",
- function () {
- if ($('#hid_IsLock').val() === "0") {
- $('#hid_IsLock').val("1");
- $("#CurdTool").hide();
- $("#ResetTool").show();
- } else {
- $('#hid_IsLock').val("0");
- $("#ResetTool").hide();
- $("#CurdTool").show();
- }
- window.LoadTable();
- });
- //添加
- function btn_Add() {
- $("#hid_Type").val("Add");
- $("#FarmID").textbox("setValue", "");
- $("#ShortNames").textbox("setValue", "");
- $("#Address").textbox("setValue", "");
- $("#Names").textbox("setValue", "");
- $("#Telephone").textbox("setValue", "");
- $("#FarmURL").textbox("setValue", "");
- $("#LinkMan").textbox("setValue", "");
- $("#ZIP").textbox("setValue", "");
- $("#IsSystem").attr('checked','checked');
- $("#Remark").val("");
-
- $('#winModal').window('open');
- }
- //修改
- function btn_Edit() {
- $("#hid_Type").val("Edit");
- var row = $('#dgTable').datagrid('getSelected');
- if (row) {
- $("#FarmID").textbox("setValue", row.FarmID);
- $("#ShortNames").textbox("setValue", row.ShortNames);
- $("#Address").textbox("setValue", row.Address);
- $("#Names").textbox("setValue", row.Names);
- $("#Telephone").textbox("setValue", row.Telephone);
- $("#FarmURL").textbox("setValue", row.FarmURL);
- $("#LinkMan").textbox("setValue", row.LinkMan);
- $("#ZIP").textbox("setValue", row.ZIP);
- $("#Remark").val(row.Remark);
- $("#IsSystem").attr('checked', row.IsSystem == "1" ? true : false);
- $("#RegionID").combotree('setValue', row.RegionID);
- $("#SeriesType").combobox('setValue', row.SeriesType);
- $('#winModal').window('open');
- } else {
- layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
- }
- }
- function DelOrRetore(type) {
- var FarmID = $('#dgTable').datagrid('getSelections')[0].FarmID;
- if (!FarmID) {
- layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
- return;
- }
- if (type == 'Del' || type === "ReDel" ) {
- $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
- if (r) {
- $.ajax({
- url: "@Url.Action("FarmsListOper", "BaseInfo")",
- type: "post",
- data: {
- Type: type,
- FarmID: FarmID
- },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = JSON.parse(data);
- if (msg != null && msg.Success == true) {
- LoadTable();
- layer.alert("操作成功!", { title: '提示信息' });
- } else {
- layer.alert(msg.ErrorInfo, { title: '提示信息' });
- }
- }
- });
- }
- })
- }
- }
- //提交
- function Save(type) {
- if ($("#ZIP").textbox("getValue").length > 10) {
- $.messager.alert('错误提示', '邮编长度不能超过10!', 'error');
- return;
- }
- if ($("#FarmID").textbox("getValue").length <= 0) {
- $.messager.alert('错误提示', '单位编号不能为空!', 'error');
- return;
- }
- if ($("#Names").textbox("getValue").length <= 0) {
- $.messager.alert('错误提示', '单位全称不能为空!', 'error');
- return;
- }
- type = type || $("#hid_Type").val();
- var FarmID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].FarmID : "";
- $.ajax({
- url: "@Url.Action("FarmsListOper", "BaseInfo")",
- type: "post",
- data: {
- Type: type,
- FarmID: $("#FarmID").textbox("getValue"),
- ShortNames: $("#ShortNames").textbox("getValue"),
- LinkMan: $("#LinkMan").textbox("getValue"),
- Address: $("#Address").textbox("getValue"),
- Telephone: $("#Telephone").textbox("getValue"),
- ZIP: $("#ZIP").textbox("getValue"),
- FarmURL: $("#FarmURL").textbox("getValue"),
- Remark: $("#Remark").val(),
- Names: $("#Names").textbox("getValue"),
- IsSystem: $('#IsSystem').is(':checked') ? "1" : "0",
- RegionID: $("#RegionID").combotree('getValue'),
- SeriesType: $("#SeriesType").combobox('getValue')
- },
- success: function (data) {
- if (CheckAajxData(data) == false) {
- return;
- }
- var msg = JSON.parse(data);
- if (msg != null && msg.Success == true) {
- LoadTable();
- $('#winModal').window('close');
- layer.alert("操作成功!", { title: '提示信息' });
- } else {
- layer.alert(msg.ErrorInfo, { title: '提示信息' });
- }
- }
- });
- }
- //modal赋值
- function SetModalVal() {
- var rows = $('#dgTable').datagrid('getSelections');
- if (rows.length === 1) {
- var row = rows[0];
- //console.log(row);
- $("#FarmID").val(row.FarmID),
- $("#ShortNames").val(row.ShortNames),
- $("#LinkMan").val(row.LinkMan),
- $("#Telephone").val(row.Telephone),
- $("#modal").modal("show");
- } else {
- layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
- }
- }
- //加载表格数据
- function LoadTable(value, item) {
- $('#dgTable').datagrid({
- url: '@Url.Action("GetFarmsList", "BaseInfo")',
- queryParams:{
- IsLock: $('#hid_IsLock').val(),
- ShortNames: value
- },
- onDblClickRow: function () {
- if ($('#hid_IsLock').val() === "0") {
- btn_Edit();
- }
-
- }
- });
- }
- $(function () {
- //加载表格数据
- var value = $(".textbox.searchbox .textbox-value").val(), item = $(".textbox.searchbox .textbox-value").attr("name");
- window.LoadTable(value, item);
- //加载日历控件
- //laydate({
- // elem: '#PractiseTime',
- // format: "YYYY-MM-DD",
- // min: "1980-01-01",
- // event: "focus"
- //});
- });
- function convert(rows) {
- function exists(rows, parentId) {
- for (var i = 0; i < rows.length; i++) {
- if (rows[i].id == parentId) return true;
- }
- return false;
- }
- var nodes = [];
- // get the top level nodes
- for (var i = 0; i < rows.length; i++) {
- var row = rows[i];
- if (!exists(rows, row.parentId)) {
- nodes.push({
- id: row.id,
- text: row.name
- });
- }
- }
- var toDo = [];
- for (var i = 0; i < nodes.length; i++) {
- toDo.push(nodes[i]);
- }
- while (toDo.length) {
- var node = toDo.shift(); // the parent node
- // get the children nodes
- for (var i = 0; i < rows.length; i++) {
- var row = rows[i];
- if (row.parentId == node.id) {
- var child = { id: row.id, text: row.name };
- if (node.children) {
- node.children.push(child);
- } else {
- node.children = [child];
- }
- toDo.push(child);
- }
- }
- }
- return nodes;
- }
- </script>
- </body>
- </html>
|