瀏覽代碼

审核单位设置

sugangqiang 2 年之前
父節點
當前提交
650209d764

+ 86 - 0
app/admin/controller/EnterpriseVerifyMgr.php

@@ -0,0 +1,86 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+use app\common\api\EnterpriseVerifyMgrApi;
+
+/**
+ * Description of EnterpriseVerifyMgr
+ *
+ * @author sgq
+ */
+class EnterpriseVerifyMgr extends AdminController {
+
+    /**
+     * @auth {{/enterprisetypeProperties}}
+     * @return type
+     */
+    public function index() {
+        return view();
+    }
+
+    public function list() {
+        return json(EnterpriseVerifyMgrApi::getList($this->request->param()));
+    }
+
+    /**
+     * @auth {{/enterprisetypeProperties/add}}
+     * @return type
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            $params = $this->request->param();
+            if (!$params["enterpriseTag"]) {
+                return json(["msg" => "请选择单位标签"]);
+            }
+            if (!$params["companyId"]) {
+                return json(["msg" => "请选择审核单位"]);
+            }
+            if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"]))
+                return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
+            if (EnterpriseVerifyMgrApi::edit($params))
+                return json(["code" => 200, "msg" => "添加单位标签审核配置成功"]);
+            return json(["msg" => "添加单位标签审核配置失败"]);
+        }
+        return view();
+    }
+
+    /**
+     * @auth {{/enterprisetypeProperties/update}}
+     * @return type
+     */
+    public function edit() {
+        $params = $this->request->param();
+        if ($this->request->isPost()) {
+            if (!$params["id"])
+                return json(["msg" => "没有正文,无法编辑"]);
+            if (!$params["enterpriseTag"]) {
+                return json(["msg" => "请选择单位标签"]);
+            }
+            if (!$params["companyId"]) {
+                return json(["msg" => "请选择审核单位"]);
+            }
+            if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"], $params["id"]))
+                return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
+            if (EnterpriseVerifyMgrApi::edit($params))
+                return json(["code" => 200, "msg" => "编辑单位标签审核配置成功"]);
+            return json(["msg" => "编辑单位标签审核配置失败"]);
+        }
+        return view("", ["info" => EnterpriseVerifyMgrApi::getOne($params["id"])]);
+    }
+
+    /**
+     * @auth {{/enterprisetypeProperties/delete}}
+     * @return type
+     */
+    public function delete() {
+        if ($this->request->isPost()) {
+            $id = $this->request->param("id");
+            if (EnterpriseVerifyMgrApi::delete($id))
+                return json(["code" => 200, "msg" => "删除单位标签审核配置成功"]);
+            return json(["msg" => "删除单位标签审核配置失败"]);
+        }
+    }
+
+}

+ 51 - 0
app/admin/view/enterprise_verify_mgr/add.html

@@ -0,0 +1,51 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="enterpriseTypeInfoForm">
+            <div class="form-horizontal">
+                <div class="row">
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">单位标签</label>
+                            <div class="col-sm-9 spacing">
+                                <select class="form-control" id="enterpriseTag" name="enterpriseTag">
+                                </select>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <div class="col-sm-9 spacing">
+                                <input class="form-control" id="description" name="description">
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="companyId" name="companyId" data-placeholder="请选择审核单位">
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row btn-group-m-t">
+                    <div class="col-sm-12" style="text-align: center;">
+                        <button type="button" class="btn btn-sm btn-info " onclick="EnterprisetypePropertiesInfoDlg.addSubmit()" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger " onclick="EnterprisetypePropertiesInfoDlg.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/enterprisetypeProperties/enterprisetypeProperties_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 51 - 0
app/admin/view/enterprise_verify_mgr/edit.html

@@ -0,0 +1,51 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="enterpriseTypeInfoForm">
+            <div class="form-horizontal">
+                <div class="row">
+                    <div class="col-sm-6">
+                        <input type="hidden" name="id" id="id" value="{$info.id}">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">单位标签</label>
+                            <div class="col-sm-9 spacing">
+                                <select class="form-control" id="enterpriseTag" name="enterpriseTag" selectVal="{$info.enterpriseTag}">
+                                </select>
+                            </div>
+                        </div>                        
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <div class="col-sm-9 spacing">
+                                <input class="form-control" id="description" name="description" value="{$info.description}">
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="companyId" name="companyId" selectVal="{$info.companyId}" data-placeholder="请选择审核单位">
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row btn-group-m-t">
+                    <div class="col-sm-12" style="text-align: center">
+                        <button type="button" class="btn btn-sm btn-info" onclick="EnterprisetypePropertiesInfoDlg.editSubmit()" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger" onclick="EnterprisetypePropertiesInfoDlg.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/system/enterprisetypeProperties/enterprisetypeProperties_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 43 - 0
app/admin/view/enterprise_verify_mgr/index.html

@@ -0,0 +1,43 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>单位标签审核配置管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="hidden-xs" id="EnterprisetypePropertiesTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/enterprise_verify_mgr/add','/enterprisetypeProperties/add')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="EnterprisetypeProperties.openAddEnterprisetypeProperties()">
+                                <i class="fa fa-plus"></i>&nbsp;添加
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/enterprise_verify_mgr/edit','/enterprisetypeProperties/update')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="EnterprisetypeProperties.openEnterprisetypePropertiesDetail()">
+                                <i class="fa fa-edit"></i>&nbsp;修改
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/enterprise_verify_mgr/delete','/enterprisetypeProperties/delete')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="EnterprisetypeProperties.delete()">
+                                <i class="fa fa-remove"></i>&nbsp;删除
+                            </button>
+                            {/if}
+                        </div>
+                        <table id="EnterprisetypePropertiesTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                                <tr>
+                                    <th data-field="selectItem" data-checkbox="true"></th>
+                                </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="/static/modular/system/enterprisetypeProperties/enterprisetypeProperties.js"></script>
+{/block}

+ 68 - 0
app/common/api/EnterpriseVerifyMgrApi.php

@@ -0,0 +1,68 @@
+<?php
+
+namespace app\common\api;
+
+use app\common\model\EnterpriseVerifyMgr;
+
+class EnterpriseVerifyMgrApi {
+
+    public static function getOne($id) {
+        return EnterpriseVerifyMgr::findOrEmpty($id);
+    }
+
+    public static function getList($params) {
+        $order = $params["order"] ?: "desc";
+        $offset = $params["offset"] ?: 0;
+        $limit = $params["limit"] ?: 10;
+        $where[] = ["m.delete", "=", 0];
+        $count = EnterpriseVerifyMgr::alias("m")->leftJoin("sys_company c", "c.id=m.companyId")->where($where)->count();
+        $list = EnterpriseVerifyMgr::alias("m")->leftJoin("sys_company c", "c.id=m.companyId")->where($where)->limit($offset, $limit)->order("m.updateTime desc,m.createTime desc")->field("m.*,c.name as companyName")->select()->toArray();
+        $enterpriseTags = DictApi::selectByParentCode("enterprise_tag");
+        foreach ($list as $key => $item) {
+            $list[$key]["enterpriseTagName"] = $enterpriseTags[$item["enterpriseTag"]];
+        }
+        return ["total" => $count, "rows" => $list];
+    }
+
+    public static function getAll() {
+        $where[] = ["delete", "=", 0];
+        $list = EnterpriseVerifyMgr::where($where)->order("sn asc")->select()->toArray();
+        return $list;
+    }
+
+    public static function edit($params) {
+        $data["enterpriseTag"] = $params["enterpriseTag"];
+        $data["companyId"] = $params["companyId"];
+        $data["description"] = $params["description"];
+        if ($params["id"]) {
+            $data["id"] = $params["id"];
+            $data["updateTime"] = date("Y-m-d H:i:s");
+            $data["updateUser"] = session("user")["uid"];
+            return EnterpriseVerifyMgr::update($data);
+        } else {
+            $data["id"] = getStringId();
+            $data["createTime"] = date("Y-m-d H:i:s");
+            $data["createUser"] = session("user")["uid"];
+            return EnterpriseVerifyMgr::insert($data);
+        }
+    }
+
+    public static function delete($id) {
+        $data["id"] = $id;
+        $data["delete"] = 1;
+        $data["updateUser"] = session("user")["uid"];
+        $data["updateTime"] = date("Y-m-d H:i:s");
+        return EnterpriseVerifyMgr::update($data);
+    }
+
+    public static function chkExist($tag, $id = 0) {
+        $where = [];
+        if ($id) {
+            $where[] = ["id", "<>", $id];
+        }
+        $where[] = ["delete", "=", 0];
+        $where[] = ["enterpriseTag", "=", $tag];
+        return EnterpriseVerifyMgr::where($where)->find();
+    }
+
+}

+ 16 - 0
app/common/model/EnterpriseVerifyMgr.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * Description of EnterpriseVerifyMgr
+ *
+ * @author sgq
+ */
+class EnterpriseVerifyMgr extends Model {
+
+    protected $table = "new_enterprise_verify_mgr";
+
+}

+ 24 - 21
public/static/modular/system/enterprisetypeProperties/enterprisetypeProperties.js

@@ -2,8 +2,8 @@
  * 企业标签审核配置管理初始化
  */
 var EnterprisetypeProperties = {
-    id: "EnterprisetypePropertiesTable",	//表格id
-    seItem: null,		//选中的条目
+    id: "EnterprisetypePropertiesTable", //表格id
+    seItem: null, //选中的条目
     table: null,
     layerIndex: -1
 };
@@ -13,10 +13,10 @@ var EnterprisetypeProperties = {
  */
 EnterprisetypeProperties.initColumn = function () {
     return [
-            {field: 'selectItem', radio: true},
-            {title: '企业标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle'},
-            {title: '审核单位', field: 'companyNames', visible: true, align: 'center', valign: 'middle'},
-            {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
+        {field: 'selectItem', radio: true},
+        {title: '单位标签', field: 'enterpriseTagName', visible: true, align: 'center', valign: 'middle'},
+        {title: '审核单位', field: 'companyName', visible: true, align: 'center', valign: 'middle'},
+        {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
     ];
 };
 
@@ -25,10 +25,10 @@ EnterprisetypeProperties.initColumn = function () {
  */
 EnterprisetypeProperties.check = function () {
     var selected = $('#' + this.id).bootstrapTable('getSelections');
-    if(selected.length == 0){
+    if (selected.length == 0) {
         Feng.info("请先选中表格中的某一记录!");
         return false;
-    }else{
+    } else {
         EnterprisetypeProperties.seItem = selected[0];
         return true;
     }
@@ -40,11 +40,11 @@ EnterprisetypeProperties.check = function () {
 EnterprisetypeProperties.openAddEnterprisetypeProperties = function () {
     var index = layer.open({
         type: 2,
-        title: '添加企业标签审核配置',
+        title: '添加单位标签审核配置',
         area: ['800px', '420px'], //宽高
         fix: false, //不固定
         maxmin: true,
-        content: Feng.ctxPath + '/enterprisetypeProperties/enterprisetypeProperties_add'
+        content: Feng.ctxPath + '/admin/enterprise_verify_mgr/add'
     });
     this.layerIndex = index;
 };
@@ -56,11 +56,11 @@ EnterprisetypeProperties.openEnterprisetypePropertiesDetail = function () {
     if (this.check()) {
         var index = layer.open({
             type: 2,
-            title: '企业标签审核配置详情',
+            title: '单位标签审核配置详情',
             area: ['800px', '420px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: Feng.ctxPath + '/enterprisetypeProperties/enterprisetypeProperties_update/' + EnterprisetypeProperties.seItem.id
+            content: Feng.ctxPath + '/admin/enterprise_verify_mgr/edit/id/' + EnterprisetypeProperties.seItem.id
         });
         this.layerIndex = index;
     }
@@ -71,14 +71,17 @@ EnterprisetypeProperties.openEnterprisetypePropertiesDetail = function () {
  */
 EnterprisetypeProperties.delete = function () {
     if (this.check()) {
-        var ajax = new $ax(Feng.ctxPath + "/enterprisetypeProperties/delete", function (data) {
-            Feng.success("删除成功!");
-            EnterprisetypeProperties.table.refresh();
-        }, function (data) {
-            Feng.error("删除失败!" + data.responseJSON.message + "!");
-        });
-        ajax.set("enterprisetypePropertiesId",EnterprisetypeProperties.seItem.id);
-        ajax.start();
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/admin/enterprise_verify_mgr/delete", function (data) {
+                Feng.success("删除成功!");
+                EnterprisetypeProperties.table.refresh();
+            }, function (data) {
+                Feng.error("删除失败!" + data.responseJSON.message + "!");
+            });
+            ajax.set("id", EnterprisetypeProperties.seItem.id);
+            ajax.start();
+        };
+        Feng.confirm("删除后无法恢复,确认删除吗?", operation);
     }
 };
 
@@ -92,7 +95,7 @@ EnterprisetypeProperties.search = function () {
 
 $(function () {
     var defaultColunms = EnterprisetypeProperties.initColumn();
-    var table = new BSTable(EnterprisetypeProperties.id, "/enterprisetypeProperties/list", defaultColunms);
+    var table = new BSTable(EnterprisetypeProperties.id, "/admin/enterprise_verify_mgr/list", defaultColunms);
     table.setPaginationType("server");
     EnterprisetypeProperties.table = table.init();
 });

+ 41 - 44
public/static/modular/system/enterprisetypeProperties/enterprisetypeProperties_info.js

@@ -2,16 +2,16 @@
  * 初始化企业标签审核配置详情对话框
  */
 var EnterprisetypePropertiesInfoDlg = {
-    enterprisetypePropertiesInfoData : {},
+    enterprisetypePropertiesInfoData: {},
     validateFields: {
-        talentType: {
+        enterpriseTag: {
             validators: {
                 notEmpty: {
-                    message: '企业标签不能为空'
+                    message: '单位标签不能为空'
                 }
             }
         },
-        companyIds:{
+        companyId: {
             validators: {
                 notEmpty: {
                     message: '审核单位不能为空'
@@ -24,7 +24,7 @@ var EnterprisetypePropertiesInfoDlg = {
 /**
  * 清除数据
  */
-EnterprisetypePropertiesInfoDlg.clearData = function() {
+EnterprisetypePropertiesInfoDlg.clearData = function () {
     this.enterprisetypePropertiesInfoData = {};
 }
 
@@ -34,7 +34,7 @@ EnterprisetypePropertiesInfoDlg.clearData = function() {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-EnterprisetypePropertiesInfoDlg.set = function(key, val) {
+EnterprisetypePropertiesInfoDlg.set = function (key, val) {
     this.enterprisetypePropertiesInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
     return this;
 }
@@ -45,57 +45,58 @@ EnterprisetypePropertiesInfoDlg.set = function(key, val) {
  * @param key 数据的名称
  * @param val 数据的具体值
  */
-EnterprisetypePropertiesInfoDlg.get = function(key) {
+EnterprisetypePropertiesInfoDlg.get = function (key) {
     return $("#" + key).val();
 }
 
 /**
  * 关闭此对话框
  */
-EnterprisetypePropertiesInfoDlg.close = function() {
+EnterprisetypePropertiesInfoDlg.close = function () {
     parent.layer.close(window.parent.EnterprisetypeProperties.layerIndex);
 }
 
 /**
  * 收集数据
  */
-EnterprisetypePropertiesInfoDlg.collectData = function() {
+EnterprisetypePropertiesInfoDlg.collectData = function () {
     this
-    .set('id')
-    .set('talentType')
-    .set('description');
-    var companys = $("#companyIds").val();
-    var ids = "";
-    for(var key in companys){
-        if(companys[key]!=null && companys[key]!=''){
-            ids = ids + companys[key]+",";
-        }
-    }
-    this.enterprisetypePropertiesInfoData['companyIds'] = ids;
+            .set('id')
+            .set('enterpriseTag')
+            .set('description');
+    var companys = $("#companyId").val();
+    /*var ids = "";
+     for (var key in companys) {
+     if (companys[key] != null && companys[key] != '') {
+     ids = ids + companys[key] + ",";
+     }
+     }*/
+    this.enterprisetypePropertiesInfoData['companyId'] = companys;
 }
 
 /**
  * 提交添加
  */
-EnterprisetypePropertiesInfoDlg.addSubmit = function() {
+EnterprisetypePropertiesInfoDlg.addSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
-    if(this.enterprisetypePropertiesInfoData.companyIds==null||this.enterprisetypePropertiesInfoData.companyIds==''){
-        Feng.error("审核单位不能为空");return ;
+    if (this.enterprisetypePropertiesInfoData.companyId == null || this.enterprisetypePropertiesInfoData.companyId == '') {
+        Feng.error("审核单位不能为空");
+        return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/enterprisetypeProperties/add", function(data){
-        if(data.code=="200"){
+    var ajax = new $ax(Feng.ctxPath + "/admin/enterprise_verify_mgr/add", function (data) {
+        if (data.code == "200") {
             Feng.success(data.msg);
             window.parent.EnterprisetypeProperties.table.refresh();
             EnterprisetypePropertiesInfoDlg.close();
-        }else{
+        } else {
             Feng.error(data.msg);
         }
-    },function(data){
+    }, function (data) {
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.enterprisetypePropertiesInfoData);
@@ -105,25 +106,26 @@ EnterprisetypePropertiesInfoDlg.addSubmit = function() {
 /**
  * 提交修改
  */
-EnterprisetypePropertiesInfoDlg.editSubmit = function() {
+EnterprisetypePropertiesInfoDlg.editSubmit = function () {
     this.clearData();
     this.collectData();
     if (!this.validate()) {
         return;
     }
-    if(this.enterprisetypePropertiesInfoData.companyIds==null||this.enterprisetypePropertiesInfoData.companyIds==''){
-        Feng.error("审核单位不能为空");return ;
+    if (this.enterprisetypePropertiesInfoData.companyId == null || this.enterprisetypePropertiesInfoData.companyId == '') {
+        Feng.error("审核单位不能为空");
+        return;
     }
     //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/enterprisetypeProperties/update", function(data){
-        if(data.code=="200"){
+    var ajax = new $ax(Feng.ctxPath + "/admin/enterprise_verify_mgr/edit", function (data) {
+        if (data.code == "200") {
             Feng.success(data.msg);
             window.parent.EnterprisetypeProperties.table.refresh();
             EnterprisetypePropertiesInfoDlg.close();
-        }else{
+        } else {
             Feng.error(data.msg);
         }
-    },function(data){
+    }, function (data) {
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });
     ajax.set(this.enterprisetypePropertiesInfoData);
@@ -139,30 +141,25 @@ EnterprisetypePropertiesInfoDlg.validate = function () {
     return $("#enterpriseTypeInfoForm").data('bootstrapValidator').isValid();
 }
 
-$(function() {
+$(function () {
     Feng.initValidator("enterpriseTypeInfoForm", EnterprisetypePropertiesInfoDlg.validateFields);
     //下拉框数据动态加载
     Feng.addAjaxSelect({
-        "id": "talentType",
+        "id": "enterpriseTag",
         "displayCode": "code",
         "displayName": "name",
         "type": "GET",
-        "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_enterprise_talentType"
+        "url": "/admin/dict/findChildDictByCode?code=enterprise_tag"
     });
     Feng.addAjaxSelect({
-        "id": "companyIds",
+        "id": "companyId",
         "displayCode": "id",
         "displayName": "name",
         "type": "GET",
-        "url": Feng.ctxPath + "/company/selectAll"
-    });
-    $('#companyIds').chosen({
-        // search_contains:false,
-        // enable_split_word_search: true
+        "url": Feng.ctxPath + "/common/api/getCompanyKvs"
     });
     //下拉框数据回显
     $("select").each(function () {
         $(this).val($(this).attr("selectVal"));
     });
-    $("#companyIds").val($("#companyIds").attr("selectVal")).trigger("chosen:updated");
 });