Răsfoiți Sursa

津补贴企业增加删除

sugangqiang 1 an în urmă
părinte
comite
f3f1b11bd0

+ 2 - 0
app/admin/controller/TalentAllowance.php

@@ -74,6 +74,7 @@ class TalentAllowance extends AdminController {
         $process = $param["process"];
         $where = [];
         $where[] = ["type", "=", $this->user["type"]];
+        $where[] = ["delete", "=", 0];
         $order = "newSubmitTime desc";
         $where = $this->setTalentAllowanceInfo($where, $param, $process);
         switch ($process) {
@@ -973,6 +974,7 @@ class TalentAllowance extends AdminController {
         $obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
         $obj["type"] = $this->user["type"];
         $where = [];
+        $where[] = ["ta.delete", "=", 0];
         $where[] = ["ta.type", "=", $this->user["type"]];
         $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
         switch ($obj["process"]) {

+ 1 - 0
app/common/api/TalentAllowanceApi.php

@@ -23,6 +23,7 @@ class TalentAllowanceApi {
         $offset = trim($params["offset"]) ?: 0;
         $limit = trim($params["limit"]) ?: 10;
         $where = [];
+        $where[] = ["delete", "=", 0];
         $where[] = ["enterpriseId", "=", $user["uid"]];
         if ($_where = self::setTalentAllowanceInfo($params)) {
             $where = array_merge($where, $_where);

+ 1 - 0
app/enterprise/controller/Talent.php

@@ -1677,6 +1677,7 @@ class Talent extends EnterpriseController {
         if ($type == 1) {  //津补贴
             $where = [];
             $where[] = ["year", "=", $year];
+            $where[] = ["delete", "=", 0];
             $where[] = ["enterpriseId", "=", $this->user["uid"]];
             $talentAllowances = \app\common\model\TalentAllowance::where($where)->select()->toArray();
             $ids = array_unique(array_column($talentAllowances, "talentId"));

+ 25 - 21
app/enterprise/controller/TalentAllowance.php

@@ -184,6 +184,7 @@ class TalentAllowance extends EnterpriseController {
             $where = [];
             $where[] = ["year", "=", $param["year"]];
             $where[] = ["idCard", "=", $param["idCard"]];
+            $where[] = ["delete", "=", 0];
             $where[] = ["checkState", "not in", [MainState::NOTPASS, MainState::PASS]];
             $exists = TaModel::where($where)->find();
             if ($exists) {
@@ -307,35 +308,37 @@ class TalentAllowance extends EnterpriseController {
      */
     public function delete() {
         $id = $this->request["id"];
-        $response = new \stdClass();
-        $response->code = 500;
         $info = TalentAllowanceApi::getInfoById($id);
         if ($info["checkState"] != 1) {
-            $response->msg = "删除失败!此数据已提交审核,无法删除!";
-            return $response;
+            return new Response(Response::ERROR, "删除失败!此数据已提交审核,无法删除!");
         }
         Db::startTrans();
         try {
-            //删除核查项目表
-            Db::table("un_talent_allowance_project")->where("mainId", $id)->delete();
-            //删除合同情况表
-            Db::table("un_talent_allowancecontract_detail")->where("mainId", $id)->delete();
-            //删除人才层次变更表
-            Db::table("un_talent_allowance_arrange")->where("mainId", $id)->delete();
-            //删除日志
-            $where[] = ["mainId", "=", $id];
-            $where[] = ["type", "=", ProjectState::JBT];
-            Db::table("new_talent_checklog")->where($where)->delete();
-            //删除主表
-            Db::table("un_talent_allowance_info")->delete($id);
+            /* 硬删
+              //删除核查项目表
+              Db::table("un_talent_allowance_project")->where("mainId", $id)->delete();
+              //删除合同情况表
+              Db::table("un_talent_allowancecontract_detail")->where("mainId", $id)->delete();
+              //删除人才层次变更表
+              Db::table("un_talent_allowance_arrange")->where("mainId", $id)->delete();
+              //删除日志
+              $where[] = ["mainId", "=", $id];
+              $where[] = ["type", "=", ProjectState::JBT];
+              Db::table("new_talent_checklog")->where($where)->delete();
+              //删除主表
+              Db::table("un_talent_allowance_info")->delete($id);
+             * 
+             */
+            $data["id"] = $id;
+            $data["delete"] = 1;
+            $data["deleteUser"] = $this->user["uid"];
+            $data["deleteTime"] = date("Y-m-d H:i:s");
+            Db::table("un_talent_allowance_info")->update($data);
             Db::commit();
-            $response->code = 200;
-            $response->msg = "删除成功";
-            return $response;
+            return new Response(Response::SUCCESS, "删除成功");
         } catch (think\db\exception\DbException $e) {
             Db::rollback();
-            $response->msg = $e->getMessage();
-            return $response;
+            return new Response(Response::ERROR, $e->getMessage());
         }
     }
 
@@ -956,6 +959,7 @@ class TalentAllowance extends EnterpriseController {
         $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
         $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
         $where = [];
+        $where[] = ["ta.delete", "=", 0];
         $where[] = ["ta.enterpriseId", "=", $this->user["uid"]];
         if (\StrUtil::isNotEmpAndNull($obj["year"])) {
             $where[] = ["ta.year", "like", "%" . $obj["year"] . "%"];

+ 3 - 0
app/enterprise/view/talent_allowance/indexIC.html

@@ -115,6 +115,9 @@
                             <button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.export()">
                                 <i class="fa fa-file-excel-o"></i>&nbsp;导出
                             </button>
+                            <button type="button" class="btn btn-sm btn-danger" onclick="TalentAllowanceInfo.delete()">
+                                <i class="fa fa-remove"></i>&nbsp;删除
+                            </button>
                             <!--<button type="button" class="btn btn-sm btn-primary " onclick="TalentAllowanceInfo.openTalentAllowanceInfoSupple()">
                                 <i class="fa fa-upload"></i>&nbsp;补件(公示期)
                             </button>-->

+ 1 - 0
app/job/TalentAllowance.php

@@ -66,6 +66,7 @@ class TalentAllowance {
 
                     $where = [];
                     $where[] = ["year", "=", $year];
+                    $where[] = ["delete", "=", 0];
                     $where[] = ["idCard", "=", $ti["card_number"]];
                     $where[] = ["checkState", "not in", [MainState::NOTPASS, MainState::PASS]];
                     $exists = TaModel::where($where)->find();

+ 1 - 1
public/static/modular/gate/talentAllowance/ic/talentAllowanceInfoIC.js

@@ -237,7 +237,7 @@ TalentAllowanceInfo.openTalentAllowanceInfoSelect = function () {
 TalentAllowanceInfo.delete = function () {
     if (this.check()) {
         var operation = function () {
-            var ajax = new $ax(Feng.ctxPath + "/enterpirse/talentAllowance/delete", function (data) {
+            var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/delete", function (data) {
                 if (data.code == 200) {
                     Feng.success(data.msg);
                     TalentAllowanceInfo.table.refresh();