保安服务企业管理项目备份
zhongrj
2023-11-14 d18545040168aef9d60312045bc1450b35657a43
新增固定岗考勤管理
2 files added
436 ■■■■■ changed files
src/api/check/postFiling.js 39 ●●●●● patch | view | raw | blame | history
src/views/check/postFiling.vue 397 ●●●●● patch | view | raw | blame | history
src/api/check/postFiling.js
New file
@@ -0,0 +1,39 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
    return request({
        url: '/api/postFiling/page',
        method: 'get',
        params: {
            ...params,
            current,
            size,
        }
    })
}
export const add = (row) => {
    return request({
        url: '/api/postFiling/save',
        method: 'post',
        data: row
    })
}
export const update = (row) => {
    return request({
        url: '/api/postFiling/update',
        method: 'post',
        data: row
    })
}
export const remove = (ids) => {
    return request({
        url: '/api/postFiling/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}
src/views/check/postFiling.vue
New file
@@ -0,0 +1,397 @@
<template>
  <basic-container :class="[
    'securityUnit',
    $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
    $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
  ]">
    <avue-crud class="tablesss" :option="option" :data="data" :page.sync="page" ref="crud" :permission="permissionList"
      :search.sync="questionBankSearch" @on-load="onLoad" :table-loading="loading" @row-save="rowSave"
      @search-change="searchChange" @search-reset="searchReset" @row-update="rowUpdate" @row-del="rowDel"
      @selection-change="selectionChange" @refresh-change="refreshChange">
      <template slot="menuLeft">
        <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.clock_delete"
          @click="handleDelete">删 除
        </el-button>
        <el-button type="warning" size="small" plain icon="el-icon-download" v-if="permission.clock_export"
          @click="handleExport">导出
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import {
  getList,
  add,
  update,
  remove
} from "@/api/check/postFiling";
import { mapGetters } from "vuex";
import { getToken } from "@/util/auth";
import Qs from "qs";
export default {
  data() {
    return {
      loading: true,
      selectionList: [],
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize
      },
      query: {},
      questionBankSearch: {},
      data: [],
      option: {
        index: true,
        tip: false,
        addBtn: true,
        viewBtn: true,
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 583,
        menuWidth: 280,
        border: true,
        align: "center",
        selection: true,
        column: [
          {
            label: "岗位名称",
            prop: "name",
            search: true,
            searchSpan: 4,
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入岗位名称",
                trigger: "click"
              }
            ],
            overHidden: true
          },
          {
            label: "经度",
            prop: "x",
            span: 12,
            rules: [
              {
                required: true,
                message: "请输入经度",
                trigger: "click"
              }
            ],
          },
          {
            label: "纬度",
            prop: "y",
            span: 12,
            rules: [
              {
                required: true,
                message: "请输入纬度",
                trigger: "click"
              }
            ],
          },
          {
            label: "上岗时间",
            prop: "dutyTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            rules: [
              {
                required: true,
                message: "请输入上岗时间",
                trigger: "blur"
              }
            ]
          },
          {
            label: "下岗时间",
            prop: "layoffTime",
            type: "datetime",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            rules: [
              {
                required: true,
                message: "请输入下岗时间",
                trigger: "blur"
              }
            ]
          }
        ],
        ...this.$store.state.control.clearOtherBut
      }
    };
  },
  created() {
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.postFiling_add, true),
        viewBtn: this.vaildData(this.permission.postFiling_view, true),
        delBtn: this.vaildData(this.permission.postFiling_delete, true),
        editBtn: this.vaildData(this.permission.postFiling_edit, true)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    sizeChange(val) {
      this.page1.currentPage = 1;
      this.page1.pageSize = val;
      this.onLoad(this.page, this.query);
    },
    currentChange(val) {
      this.page1.currentPage = val;
      // this.getData();
      this.onLoad(this.page, this.query);
    },
    rowSave(form, done, loading) {
      form['type'] = 1;
      add(form).then(res => {
        if (res.data.success) {
          this.$message({
            message: "操作成功",
            type: "success"
          });
          this.refreshChange();
          done();
        } else {
          this.$message({
            message: "操作失败",
            type: "warning"
          });
          done();
        }
      });
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
      this.$confirm(
        "确定删除当前合同信息数据?",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      )
        .then(() => {
          console.log(row);
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定批量将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids).then(res => {
            this.refreshChange();
          });
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.$refs.crudrec.toggleSelection();
        })
        .catch(res => { });
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    //保安员证信息导出
    handleExport() {
      this.$confirm("是否导出考勤打卡信息数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        //获取查询条件
        const { releaseTimeRange } = this.questionBankSearch;
        if (releaseTimeRange) {
          this.questionBankSearch["beginTime"] = releaseTimeRange[0];
          this.questionBankSearch["endTime"] = releaseTimeRange[1];
        }
        var data = {
          clockType: this.questionBankSearch.clockType,
          attendanceType: this.questionBankSearch.attendanceType,
          realName: this.questionBankSearch.realName,
          beginTime: this.questionBankSearch.beginTime,
          endTime: this.questionBankSearch.endTime
        };
        //导出
        if (this.userInfo.role_name == "保安公司管理员") {
          //如果是保安公司管理员
          data["deptId"] = this.userInfo.dept_id;
        }
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(
          `/api/attendance/export-Attendance?${this.website.tokenHeader
          }=${getToken()}&` + data
        );
      });
    },
    onLoad(page, params = {}) {
      params = this.questionBankSearch;
      if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警" || this.userInfo.role_name == "administrator") {
        params["jurisdiction"] = this.userInfo.jurisdiction;
      }
      if (this.userInfo.role_name == "保安公司管理员" || this.userInfo.role_name == "分公司管理员") {
        params["deptId"] = this.userInfo.dept_id;
      }
      const { releaseTimeRange } = this.query;
      let values = {
        ...params
      };
      if (releaseTimeRange) {
        values = {
          ...params,
          beginTime: releaseTimeRange[0],
          endTime: releaseTimeRange[1],
          ...this.query
        };
        values.releaseTimeRange = null;
      }
      this.loading = true;
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(values, this.query)
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        window.localStorage.setItem("danweidataS", JSON.stringify(this.data));
        this.$store.commit("setWindowSizeHeightAdd");
        this.loading = false;
      });
    }
  },
};
</script>
<style lang="scss">
.securityUnit {
  width: 100%;
  height: 100%;
  //   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;
// }
.lod {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba($color: #000000, $alpha: 0.5);
  padding: 100px 0 0 0;
  z-index: 1500 !important;
  display: flex;
  // align-items: center;
  justify-content: center;
  .trees {
    z-index: 501 !important;
    position: absolute;
    width: 15%;
    top: 100px;
    left: 0;
    // display: none;
  }
  .lod-in {
    width: 70%;
    height: auto;
    background-color: transparent;
    // padding: 10px 0 0 0;
  }
  .el-collapse-item {
    padding-top: 15px !important;
  }
}
.el-collapse {
  border-top: 1px solid transparent !important;
}
.rowClickSelf {
  &:hover {
    cursor: pointer;
  }
}
</style>