From 5a8bc481870caa1bb54f0ab48849db932102db71 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 26 Aug 2021 19:07:40 +0800
Subject: [PATCH] 保安员修改

---
 src/views/securityGuard/securityGuardDetail.vue |   86 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/src/views/securityGuard/securityGuardDetail.vue b/src/views/securityGuard/securityGuardDetail.vue
index a5857bb..997a155 100644
--- a/src/views/securityGuard/securityGuardDetail.vue
+++ b/src/views/securityGuard/securityGuardDetail.vue
@@ -10,6 +10,9 @@
         :data="data1"
         :page.sync="page1"
         :table-loading="loading1"
+        @row-save="rowSave1"
+        @row-update="rowUpdate1"
+        @row-del="rowDel1"
         @refresh-change="refreshChange1"
       >
       </avue-crud>
@@ -87,7 +90,14 @@
   practitionersColumn,
   trackRecordColumn,
 } from "./data";
-import { getUserPractitionersInfo } from "@/api/system/user";
+import {
+  addExperience,
+  updateExperience,
+  getExperienceDetail,
+  experienceRemove,
+  getExperienceList
+} from "@/api/experience/experience";
+
 import {
   getPerformanceInfo,
   add,
@@ -158,12 +168,12 @@
         total: 0,
       },
       query1: {},
+      query2: {},
       data1: [],
       data2: [],
       option1: {
         card: true,
-        menu: false,
-        addBtn: false,
+        menu: true,
         height: "auto",
         widtd: "auto",
         calcHeight: 54,
@@ -246,20 +256,21 @@
     },
     //查询当前保安员的从业记录信息
     getPractitionersPageInfo() {
-      var that = this;
+      var param = {
+        securityid: this.id,
+      };
       //获取用户从业信息
       console.log(this.id, "cid");
-      getUserPractitionersInfo(this.id).then((res1) => {
-        that.data1 = res1.data.data;
+      getExperienceList(this.current, this.size,param).then((res1) => {
+        const data = res1.data.data;
+        this.page1.total = data.total;
+        this.data1 = data.records;
+        this.loading1 = false;
       });
     },
     //查询当前保安员的现实表现记录信息
     getPerformancePageInfo() {
       //获取现实表现信息
-      // getPerformanceInfo(this.id).then((res) => {
-      //   that.data2 = res1.data.data;
-      //   console.log(that.data2, 1);
-      // });
       var param = {
         securityid: this.id,
       };
@@ -271,11 +282,32 @@
         this.loading2 = false;
       });
     },
+    
+
     rowSave2(form, done, loading) {
       form.securityid = this.id;
       add(form).then(
         (res) => {
           this.getPerformancePageInfo(this.page2);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+      // }
+    },
+    //从业记录新增
+    rowSave1(form, done, loading) {
+      form.securityid = this.id;
+      addExperience(form).then(
+        (res) => {
+          this.getPractitionersPageInfo(this.page1);
           this.$message({
             type: "success",
             message: "操作成功!",
@@ -306,6 +338,23 @@
         }
       );
     },
+    rowUpdate1(row, index, done, loading) {
+      row.securityid = this.id;
+      updateExperience(row).then(
+        () => {
+          this.getPractitionersPageInfo(this.page1);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
     rowDel2(row) {
       this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
@@ -323,6 +372,23 @@
           });
         });
     },
+    rowDel1(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return experienceRemove(row.id);
+        })
+        .then(() => {
+          this.getPractitionersPageInfo(this.page1);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
   },
   mounted() {
     this.typeTABS = this.optionTABS.column[0];

--
Gitblit v1.9.3