chengjunhui пре 2 месеци
родитељ
комит
a6f82dd889

+ 1 - 1
renren-admin/src/main/resources/statics/css/main.css

@@ -81,7 +81,7 @@ tbody > tr > th {
   padding-top: 20px;
   padding-top: 20px;
 }
 }
 
 
-.form-control {
+.login-box-body .form-control {
   height: 48px !important;
   height: 48px !important;
   padding-left: 80px !important;
   padding-left: 80px !important;
   padding-right: 0 !important;
   padding-right: 0 !important;

+ 214 - 0
renren-admin/src/main/resources/statics/js/modules/qmgj/school.js

@@ -0,0 +1,214 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: baseURL + 'qmgj/school/list',
+        datatype: "json",
+        colModel: [
+            { label: 'id', name: 'id', index: 'id', width: 50, key: true, hidden: true },
+            // { label: '序号', name: 'index', index: 'index', width: 50 },
+            { label: '省', name: 'provincename', index: 'provincename' },
+            { label: '市', name: 'regionname', index: 'regionname' },
+            { label: '学校名称', name: 'schoolname', index: 'schoolname', width: 200 },
+            {
+                label: '操作',
+                name: 'status',
+                index: 'status',
+                width: 80,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<span style='color: #337ab7; cursor: pointer;margin-right: 10px;' onclick=\"handleEdit('" + rowObject.id + "',1)\">编辑</span><span style='color: #337ab7; cursor: pointer;' onclick=\"handleDel('" + rowObject.id + ")\">删除</span>"
+                }
+            },
+        ],
+        viewrecords: true,
+        height: 385,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: false,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            //隐藏grid底部滚动条
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x": "hidden" });
+        }
+    });
+    $.ajax({
+        type: "POST",
+        url: baseURL + "api/region/provinceList",
+        contentType: "application/json",
+        success: function (r) {
+            if (r.code == 0) {
+                vm.location2.province = r.data;
+                vm.location.province = r.data
+            } else {
+                layer.alert("读取省失败");
+            }
+        }
+    });
+});
+function handleEdit(id) {
+    vm.showList = false;
+    vm.title = "修改";
+    vm.getInfo(id)
+}
+
+function handleDel(id) {
+    layer.confirm('确定要删除选中的数据?', {
+        btn: ['确定', '取消'] //按钮
+    }, function () {
+        if (!lock) {
+            lock = true;
+            $.ajax({
+                type: "delete",
+                url: baseURL + "qmgj/school/delete",
+                contentType: "application/json",
+                data: JSON.stringify(id),
+                success: function (r) {
+                    if (r.code == 0) {
+                        layer.msg("操作成功", { icon: 1 });
+                        $("#jqGrid").trigger("reloadGrid");
+                    } else {
+                        layer.alert(r.msg);
+                    }
+                }
+            });
+        }
+    }, function () {
+    });
+}
+
+layui.use(['layer', 'form'], function () {
+    var $ = layui.jquery, layer = layui.layer, form = layui.form;
+    form.on('submit(go)', function (data) {
+        $('#btnSaveOrUpdate').button('loading').delay(1000).queue(function () {
+            var url = vm.formData.id == null ? "qmgj/school/save" : "qmgj/school/update";
+            console.log(vm.formData);
+            // if (vm.formData)
+            return
+            $.ajax({
+                type: vm.formData.id != null ? 'PUT' : "POST",
+                url: baseURL + url,
+                contentType: "application/json",
+                data: JSON.stringify(vm.formData),
+                success: function (r) {
+                    if (r.code === 0) {
+                        layer.msg("操作成功", { icon: 1 });
+                        vm.reload();
+                        $('#btnSaveOrUpdate').button('reset');
+                        $('#btnSaveOrUpdate').dequeue();
+                    } else {
+                        layer.alert(r.msg);
+                        $('#btnSaveOrUpdate').button('reset');
+                        $('#btnSaveOrUpdate').dequeue();
+                    }
+                }
+            });
+        });
+        return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
+    });
+})
+
+
+var vm = new Vue({
+    el: '#rrapp',
+    data: {
+        showList: true,
+        title: null,
+        queryParam: {
+            publishStartTime: '',
+            publishEndTime: '',
+            status: '',
+            city: '',
+            province: '',
+        },
+        location: {
+            province: [],
+            city: [],
+            area: []
+        },
+        location2: {
+            province: [],
+            city: []
+        },
+        formData: {},
+    },
+    methods: {
+        query: function () {
+            vm.reload();
+        },
+        add: function () {
+            vm.showList = false;
+            vm.title = "新增";
+            vm.formData = {
+                province: '',
+                city: '',
+                area: '',
+                status: '1'
+            };
+        },
+        saveOrUpdate: function (event) {
+        },
+        province: function (type) {
+            // var d = event.target.value;
+            let d = type == 1 ? vm.queryParam.province : vm.formData.province;
+            if (type == 1) {
+                vm.location2.city = [];
+                vm.queryParam.city = ''; 
+            } else {
+                vm.location.city = [];
+                vm.formData.city = ''; 
+            }
+            $.ajax({
+                type: "POST",
+                url: baseURL + "api/region/childList/" + d,
+                contentType: "application/json",
+                success: function (r) {
+                    if (r.code == 0) {
+                        vm.location.city = r.decList;
+                    } else {
+                        layer.alert("读取市失败");
+                    }
+                }
+            });
+        },
+        getInfo: function (id) {
+            $.get(baseURL + "qmgj/school/info/" + id, function (r) {
+                // console.log(r);
+                vm.formData = r.data || r.news || {};
+                vm.formData.province = '';
+            });
+        },
+        reload: function (event) {
+            vm.showList = true;
+            var page = $("#jqGrid").jqGrid('getGridParam', 'page');
+            $("#jqGrid").jqGrid('setGridParam', {
+                page: page,
+                postData: vm.queryParam
+            }).trigger("reloadGrid");
+        },
+        init: function () {
+            vm.queryParam.city = '';
+            vm.queryParam.staffId = '';
+            vm.queryParam.province = '';
+            vm.queryParam.title = '';
+            vm.queryParam.status = '';
+        },
+        reset: function () {
+            vm.queryParam.publishStartTime = null;
+            vm.queryParam.publishEndTime = null;
+            vm.init();
+            vm.reload(1);
+        },
+    }
+});

+ 86 - 0
renren-admin/src/main/resources/templates/modules/qmgj/school.html

@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>学校管理</title>
+    <#include "/header.html">
+        <style>
+            
+        </style>
+</head>
+
+<body>
+    <div id="rrapp" v-cloak>
+        <div v-show="showList">
+            <div class="grid-btn">
+                <div>
+                    <div style="padding-left: 0;" class="form-group col-sm-12 div-Gay">
+                        <select class="form-control" v-model="queryParam.province" @change="province(1)">
+                            <option value="" disabled hidden>--省--</option>
+                            <!--<option value="" disabled>湖北省</option>-->
+                            <option v-for="item in location2.province" :value="item.code">{{item.codename}}</option>
+                        </select>
+                        <select class="form-control" v-model="queryParam.city" >
+                            <option value="" disabled hidden>--市--</option>
+                            <option v-for="item in location2.city" :value="item.id">{{item.name}}</option>
+                        </select>
+                        <input type="text" class="form-control" v-model="queryParam.schoolName" placeholder="学校名称">
+                        <a class="btn btn-query" @click="query"><i class="fa fa-search"></i>&nbsp;查询</a>
+                        <a class="btn btn-success" @click="reset"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
+                    </div>
+                </div>
+            </div>
+            <br>
+            <div class="wg-div-btn">
+                <#if shiro.hasPermission("qyh:store:save")>
+                    <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
+                </#if>
+            </div>
+
+            <div style="height: 25px;"></div>
+            <table id="jqGrid"></table>
+            <div id="jqGridPager"></div>
+        </div>
+
+        <div v-show="!showList" class="panel panel-default">
+            <div class="panel-heading">{{title}}</div>
+            <form class="form-horizontal" style="width: 100%;">
+                <div class="form-group">
+                    <div class="col-sm-1 control-label"><span style="color: red">*</span>所属区域</div>
+                    <div class="col-sm-3" style="width: 16.65%;">
+                        <!--                    @change="province"-->
+                        <select class="form-control" v-model="formData.province" @change="province(2)">
+                            <option value="" disabled hidden>--省--</option>
+                            <!--<option value="" disabled hidden>湖北省</option>-->
+                            <option v-for="item in location.province" :value="item.code">{{item.codename}}</option>
+                        </select>
+                    </div>
+                    <div class="col-sm-3" style="width: 16.65%;">
+                        <select class="form-control" v-model="formData.region">
+                            <option value="" disabled hidden>--市--</option>
+                            <option v-for="item in location.city" :value="item.id">{{item.name}}</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="form-group">
+                    <div class="col-sm-1 control-label"><span style="color: red">*</span>学校名称</div>
+                    <div class="col-sm-4">
+                        <input type="text" class="form-control" v-model="formData.schoolname" placeholder="学校名称" />
+                    </div>
+                </div>
+                <div class="form-group">
+                    <div class="col-sm-12">
+                        <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..."
+                            @click="saveOrUpdate" value="确定" />
+                        &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回" />
+                    </div>
+
+                </div>
+            </form>
+        </div>
+    </div>
+
+    <script src="${request.contextPath}/statics/js/modules/qmgj/school.js?_${.now?long}"></script>
+</body>
+
+</html>