|
@@ -0,0 +1,163 @@
|
|
|
+/**
|
|
|
+ * 认定条件管理管理初始化
|
|
|
+ */
|
|
|
+var IntegralMgr = {
|
|
|
+ id: "IntegralMgrTable", //表格id
|
|
|
+ seItem: null, //选中的条目
|
|
|
+ table: null,
|
|
|
+ layerIndex: -1
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 初始化表格的列
|
|
|
+ */
|
|
|
+IntegralMgr.initColumn = function () {
|
|
|
+ return [
|
|
|
+ {field: 'selectItem', radio: true},
|
|
|
+ {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ if (value == 1) {
|
|
|
+ return "晋江市现代产业体系人才";
|
|
|
+ }
|
|
|
+ if (value == 2) {
|
|
|
+ return "集成电路优秀人才";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {title: '项目名称', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
|
|
|
+ {title: '项目类别', field: 'projectType', visible: true, align: 'center', valign: 'middle',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ switch (value) {
|
|
|
+ case 1:
|
|
|
+ return "基础分";
|
|
|
+ case 2:
|
|
|
+ return "贡献分"
|
|
|
+ case 3:
|
|
|
+ return "资历分";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {title: '是否启用', field: 'active', visible: true, align: 'center', valign: 'middle',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ if (value == 1) {
|
|
|
+ return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">启用</button>";
|
|
|
+ }
|
|
|
+ if (value == 2) {
|
|
|
+ return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">停用</button>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 检查是否选中
|
|
|
+ */
|
|
|
+IntegralMgr.check = function () {
|
|
|
+ var selected = $('#' + this.id).bootstrapTable('getSelections');
|
|
|
+ if (selected.length == 0) {
|
|
|
+ Feng.info("请先选中表格中的某一记录!");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ IntegralMgr.seItem = selected[0];
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 点击添加积分项目
|
|
|
+ */
|
|
|
+IntegralMgr.openAddIntegralProject = function () {
|
|
|
+ var index = layer.open({
|
|
|
+ type: 2,
|
|
|
+ title: '添加积分项目',
|
|
|
+ area: ['1126px', '420px'], //宽高
|
|
|
+ fix: false, //不固定
|
|
|
+ maxmin: true,
|
|
|
+ content: Feng.ctxPath + '/admin/integral_mgr/add'
|
|
|
+ });
|
|
|
+ this.layerIndex = index;
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 打开编辑积分项目
|
|
|
+ */
|
|
|
+IntegralMgr.openEditIntegralProject = function () {
|
|
|
+ if (this.check()) {
|
|
|
+ var index = layer.open({
|
|
|
+ type: 2,
|
|
|
+ title: '编辑积分项目',
|
|
|
+ area: ['1126px', '420px'], //宽高
|
|
|
+ fix: false, //不固定
|
|
|
+ maxmin: true,
|
|
|
+ content: Feng.ctxPath + '/admin/integral_mgr/edit/id/' + IntegralMgr.seItem.id
|
|
|
+ });
|
|
|
+ this.layerIndex = index;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除积分项目
|
|
|
+ */
|
|
|
+IntegralMgr.delete = function () {
|
|
|
+ if (this.check()) {
|
|
|
+ var operation = function () {
|
|
|
+ var ajax = new $ax(Feng.ctxPath + "/admin/integral_mgr/delete/id/", function (data) {
|
|
|
+ Feng.success("删除成功!");
|
|
|
+ IntegralMgr.table.refresh();
|
|
|
+ }, function (data) {
|
|
|
+ Feng.error("删除失败!" + data.responseJSON.message + "!");
|
|
|
+ });
|
|
|
+ ajax.set("id", IntegralMgr.seItem.id);
|
|
|
+ ajax.start();
|
|
|
+ }
|
|
|
+ Feng.confirm("是否刪除该积分项目(同时会删除其下包含的所有积分标准项)?", operation);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 查询表单提交参数对象
|
|
|
+ * @returns {{}}
|
|
|
+ */
|
|
|
+IntegralMgr.formParams = function () {
|
|
|
+ var queryData = {};
|
|
|
+ queryData['type'] = $("#type").val();
|
|
|
+ queryData['name'] = $("#name").val();
|
|
|
+ queryData['projectType'] = $("#projectType").val();
|
|
|
+ queryData['active'] = $("#active").val();
|
|
|
+ return queryData;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 查询认定条件管理列表
|
|
|
+ */
|
|
|
+IntegralMgr.search = function () {
|
|
|
+ IntegralMgr.table.refresh({query: IntegralMgr.formParams()});
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 重置
|
|
|
+ */
|
|
|
+IntegralMgr.reset = function () {
|
|
|
+ $("#type").val("");
|
|
|
+ $("#name").val("");
|
|
|
+ $("#projectType").val("");
|
|
|
+ $("#active").val("");
|
|
|
+}
|
|
|
+
|
|
|
+//回调
|
|
|
+IntegralMgr.callBack = function (data) {
|
|
|
+ Feng.info(data.msg);
|
|
|
+ if (data.code == 200) {
|
|
|
+ $("#importModal").modal("hide");
|
|
|
+ IntegralMgr.table.refresh();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+$(function () {
|
|
|
+ var defaultColunms = IntegralMgr.initColumn();
|
|
|
+ var table = new BSTable(IntegralMgr.id, "/admin/integral_mgr/list", defaultColunms);
|
|
|
+ table.setPaginationType("server");
|
|
|
+ IntegralMgr.table = table.init();
|
|
|
+});
|