Administrator
2021-08-11 92d0cf73df170131eba84490d875bc954eb7a708
src/views/securityGuard/securityGuardDetail.vue
@@ -2,8 +2,7 @@
  <div class="dispatch">
    <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs>
    <span v-if="typeTABS.prop === 'tab1'">
      <avue-form ref="form" v-model="obj0" :option="option0">
      </avue-form>
      <avue-form ref="form" v-model="obj0" :option="option0"> </avue-form>
    </span>
    <span v-else-if="typeTABS.prop === 'tab2'">
      <avue-crud
@@ -32,9 +31,19 @@
</template> 
<script>
import { securityBaseInfoColumn, practitionersColumn,trackRecordColumn } from "./data";
import {getUserPractitionersInfo} from "@/api/system/user";
import {add,update,page,remove,getPerformanceInfo} from "@/api/performance/performance";
import {
  securityBaseInfoColumn,
  practitionersColumn,
  trackRecordColumn,
} from "./data";
import { getUserPractitionersInfo } from "@/api/system/user";
import {
  getPerformanceInfo,
  add,
  update,
  page,
  remove,
} from "@/api/performance/performance";
export default {
  data() {
    return {
@@ -58,9 +67,9 @@
          },
        ],
      },
      current:1,
      size:10,
      cardid: "",
      current: 1,
      size: 10,
      cardid: "",
      name: "",
      dispatcherCompany: "",
      id: "",
@@ -70,7 +79,7 @@
      option0: {
        emptyBtn: false,
        submitBtn: false,
        labelWidth:"110",
        labelWidth: "110",
        gutter: 30,
        column: securityBaseInfoColumn,
      },
@@ -91,34 +100,34 @@
      data1: [],
      data2: [],
      option1: {
        card: false,
        menu:false,
        addBtn:false,
        height:'auto',
        widtd:"auto",
        card: true,
        menu: false,
        addBtn: false,
        height: "auto",
        widtd: "auto",
        calcHeight: 54,
        border: false,
        stripe:true,
        stripe: true,
        tip: false,
        index: true,
        dialogClickModal: false,
        headerAlign: 'center',
        align: 'center',
        headerAlign: "center",
        align: "center",
        column: practitionersColumn,
      },
      option2: {
        card: true,
        menu:true,
        height:'auto',
        widtd:"auto",
        menu: true,
        height: "auto",
        widtd: "auto",
        calcHeight: 54,
        border: false,
        stripe:true,
        stripe: true,
        tip: false,
        index: true,
        dialogClickModal: false,
        headerAlign: 'center',
        align: 'center',
        headerAlign: "center",
        align: "center",
        column: trackRecordColumn,
      },
    };
@@ -138,40 +147,46 @@
      if (column.prop == "tab1") {
        this.loading1 = false;
      } else if (column.prop == "tab2") {
          //查询当前保安员的从业记录信息
          this.getPractitionersPageInfo();
          this.loading1 = false;
        //查询当前保安员的从业记录信息
        this.getPractitionersPageInfo();
        this.loading1 = false;
      } else if (column.prop == "tab3") {
          //查询当前保安员的现实表现记录
          this.getPerformancePageInfo();
          this.loading2 = false;
        //查询当前保安员的现实表现记录
        this.getPerformancePageInfo();
        this.loading2 = false;
      }
    },
    //查询当前保安员的从业记录信息
    getPractitionersPageInfo(){
        var that = this;
        //获取用户从业信息
        getUserPractitionersInfo(this.cardid).then(res1 =>{
            that.data1 = res1.data.data;
        })
    getPractitionersPageInfo() {
      var that = this;
      //获取用户从业信息
      console.log(this.id, "cid");
      getUserPractitionersInfo(this.id).then((res1) => {
        that.data1 = res1.data.data;
      });
    },
    //查询当前保安员的现实表现记录信息
    getPerformancePageInfo(){
        //获取现实表现信息
        var param = {
          cardid:this.cardid
        }
        page(this.current,this.size,param).then(res2 =>{
            const data = res2.data.data;
            this.page2.total = data.total;
            this.data2 = data.records;
            console.log(this.data2, 1);
            this.loading2 = false;
        })
    getPerformancePageInfo() {
      //获取现实表现信息
      // getPerformanceInfo(this.id).then((res) => {
      //   that.data2 = res1.data.data;
      //   console.log(that.data2, 1);
      // });
      var param = {
        securityid: this.id,
      };
      page(this.current, this.size, param).then((res2) => {
        const data = res2.data.data;
        this.page2.total = data.total;
        this.data2 = data.records;
        console.log(this.data2, 1);
        this.loading2 = false;
      });
    },
    rowSave2(form, done, loading) {
      form.cardid = this.cardid;
      add(form).then((res) => {
      form.securityid = this.id;
      add(form).then(
        (res) => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
@@ -187,7 +202,7 @@
      // }
    },
    rowUpdate2(row, index, done, loading) {
      row.cardid = this.cardid;
      row.securityid = this.id;
      update(row).then(
        () => {
          this.getPerformancePageInfo(this.page2);
@@ -223,17 +238,36 @@
  },
  mounted() {
    this.typeTABS = this.optionTABS.column[0];
    if (this.$route.query.row) {
      var row = this.$route.query.row;
    var data = JSON.parse(this.$route.query.row);
    // console.log(data);
    if (data) {
      var row = data;
      // var row = this.$route.query.row;
      for (var k in row) {
        this.obj0[k] = row[k];
      }
      this.obj0.title = "";
      this.cardid = row.cardid;
      this.cardid = row.id;
      this.name = row.name;
      this.dispatcherCompany = row.dispatcherCompany;
      this.id = row.id;
    }
    var flag = false,
      i = 0,
      ind = null;
    this.$store.state.tags.tagList.forEach((item, index) => {
      if (item.label == "保安员详情") {
        if (flag == false) {
          ind = index;
          flag = true;
        }
        i++;
      }
    });
    if (i > 1) {
      this.$store.state.tags.tagList.splice(ind, 1);
    }
  },
};
</script>