|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-03-06 17:19
- * 描 述:通讯录
- */
- var selectedRow;
- var refreshGirdData;
- var uid;
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- page.initData();
- },
- bind: function () {
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
- page.search({ keyword: keyword });
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- selectedRow = null;
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/EducationalAdministration/AddressBook/Form',
- width: 700,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- selectedRow = $('#gridtable').jfGridGet('rowdata');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/EducationalAdministration/AddressBook/Form?keyValue=' + keyValue,
- width: 700,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('AId');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/AddressBook/DeleteForm', { keyValue: keyValue}, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- },
- initData: function () {
- learun.httpAsyncGet(top.$.rootUrl + '/UserCenter/GetUserInfo', function (res) {
- if (res.code == 200) {
- var baseinfo = res.data.baseinfo;
- uid = baseinfo.userId;
- }
- });
- },
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/AddressBook/GetPageList',
- headData: [
- { label: '姓名', name: 'AName', width: 200, align: "left" },
- {
- label: "性别", name: "AGender", width: 200, align: "left",
- formatter: function (cellvalue) {
- return cellvalue == true ? "男" : "女";
- }
- },
- { label: '单位名称', name: 'ACompany', width: 200, align: "left" },
- { label: '单位电话', name: 'ACTell', width: 200, align: "left" },
- { label: '手机', name: 'AMobile', width: 200, align: "left" },
- { label: '电子邮件', name: 'AEmail', width: 200, align: "left" },
- {
- label: "是否共享", name: "AIsShare", width: 200, align: "center",
- formatter: function (cellvalue) {
- return cellvalue == "1" ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
- }
- }
- ],
- mainId:'AId',
- isPage: true,
- onSelectRow: function (rowdata) {
- if (rowdata.ASaverId != uid) {
- $("#lr_edit").hide();
- $("#lr_delete").hide();
- } else {
- $("#lr_edit").show();
- $("#lr_delete").show();
- }
- }
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|