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
@@ -20,6 +19,9 @@
        :option="option2"
        :data="data2"
        :page.sync="page2"
        @row-save="rowSave2"
        @row-update="rowUpdate2"
        @row-del="rowDel2"
        :table-loading="loading2"
        @refresh-change="refreshChange2"
      >
@@ -29,8 +31,19 @@
</template> 
<script>
import { securityBaseInfoColumn, practitionersColumn,trackRecordColumn } from "./data";
import {getUserPractitionersInfo} from "@/api/system/user";
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 {
@@ -54,7 +67,9 @@
          },
        ],
      },
      cardid: "",
      current: 1,
      size: 10,
      cardid: "",
      name: "",
      dispatcherCompany: "",
      id: "",
@@ -64,7 +79,7 @@
      option0: {
        emptyBtn: false,
        submitBtn: false,
        labelWidth:"110",
        labelWidth: "110",
        gutter: 30,
        column: securityBaseInfoColumn,
      },
@@ -85,35 +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: false,
        menu:false,
        addBtn:false,
        height:'auto',
        widtd:"auto",
        card: true,
        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,
      },
    };
@@ -133,46 +147,126 @@
      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.getPractitionersPageInfo();
          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() {
      //获取现实表现信息
      // 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.securityid = this.id;
      add(form).then(
        (res) => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
      // }
    },
    rowUpdate2(row, index, done, loading) {
      row.securityid = this.id;
      update(row).then(
        () => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel2(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.getPerformancePageInfo(this.page2);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    currentChange1(val) {
      this.page1.currentPage = val;
      this.onLoad1(this.page1, this.query1);
    },
    //
    onLoad1(page, params = {}) {
      this.loading1 = true;
      params["dispatcherUnitId"] = this.id;
      console.log(params, "get");
    }
  },
  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);
    }
  },
};
@@ -185,12 +279,12 @@
  //   border: 1px solid #000;
  box-sizing: border-box;
}
.el-card__body {
  padding-bottom: 5px !important;
}
.avue-crud__tip,
.el-tag,
.el-tag--light {
  padding: 0 !important;
}
// .el-card__body {
//   padding-bottom: 5px !important;
// }
// .avue-crud__tip,
// .el-tag,
// .el-tag--light {
//   padding: 0 !important;
// }
</style>