123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- * Created by TT on 2017/8/3.
- */
- ;
- spa_define(function () {
- return $.use(["spa", "pagedatagrid", "util"], function (spa, pdgf, util) {
- return {
- main: function () {
- var root = spa.findInMain(".sys_professornew_index");
- var pdg = pdgf.build(root);
- pdg.code.shell("showDay", function (env) {
- if (env.cd && env.cd[this.k]) {
- var day = env.cd[this.k];
- return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日";
- }
- return "";
- });
- pdg.code.shell("bool", function (env) {
- var v = env.cd[this.k];
- return v === 1 ? "是" : (v === 0 ? "否" : "");
- });
- pdg.code.listen($.dict.doTransfer);
- pdg.code.listen(function () {
- root.find(".hand-fans").each(function () {
- var $e = $(this);
- var collectionid = $e.attr("id");
- util.get("/ajax/content/countProfessor", {id: collectionid, type: 1}, function (data) {
- $e.text(data);
- }, {});
- $e.removeClass("hand-fans");
- });
- });
- root.find(".opt-query").on("click", function () {
- pdg.load();
- });
- pdg.load();
- root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
- var $this = $(this);
- $this.toggleClass("checked");
- if ($this.hasClass("checked")) {
- root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
- } else {
- root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
- }
- });
- root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
- var $this = $(this);
- $this.toggleClass("checked");
- });
- root.find(".opt-new").on("click", function () {
- spa.showModal("sys_professornew_new", function () {
- pdg.load()
- });
- });
- root.find(".opt-edit").on("click", function () {
- var $org = root.find("td.opt-check>i.checked");
- if ($org.length) {
- if ($org.length > 1) {
- util.alert("只能选择一个用户");
- } else {
- util.get("../ajax/sys/professor/luserId/" + $org.attr("professorId"), null, function (data) {
- if (data) {
- spa.showModal("sys_professornew_edit", {
- data: data, name: $org.attr("na"), hand: function () {
- pdg.reload()
- }
- })
- } else {
- util.alert("用户不存在了", function () {
- pdg.load();
- });
- }
- }, {});
- }
- } else {
- util.alert("请选择一个用户");
- }
- });
- root.find(".opt-details").on("click", function () {
- var $professor = root.find("td.opt-check>i.checked");
- if ($professor.length) {
- if ($professor.length > 1) {
- util.alert("只能选择一个用户");
- } else {
- util.get("../ajax/sys/professor/detail/" + $professor.attr("professorId"), null, function (data) {
- if (data) {
-
- spa.showModal("sys_professornew_details", {
- data: data, hand: function () {
- pdg.reload()
- }
- });
-
-
-
- } else {
- util.alert("用户不存在了", function () {
- pdg.load();
- });
- }
- }, {});
- }
- } else {
- util.alert("请选择一个用户");
- }
- });
- root.find(".opt-data").on("click", function () {
- var $professor = root.find("td.opt-check>i.checked");
- if ($professor.length) {
- if ($professor.length > 1) {
- util.alert("只能选择一个用户");
- } else {
- util.get("../ajax/sys/professor/id/" + $professor.attr("professorid"), null, function (data) {
- if (data) {
- spa.showModal("sys_professornew_data", {
- data: data, hand: function () {
- pdg.load()
- }
- })
- } else {
- util.alert("用户不存在了", function () {
- pdg.load();
- });
- }
- }, {});
- }
- } else {
- util.alert("请选择一个用户");
- }
- });
- root.find(".opt-view").on("click", function () {
- var $professor = root.find("td.opt-check>i.checked");
- if ($professor.length) {
- if ($professor.length > 1) {
- util.alert("只能选择一个用户");
- } else {
- window.open('http://www.ekexiu.com/userInforShow.html?professorId=' + $professor.attr("professorid"));
- }
- } else {
- util.alert("请选择一个用户");
- }
- });
- }, mainDestory: function () {
- }
- };
- });
- });
|