فهرست منبع

+ 人员考勤记录查询

chen.cheng 6 ماه پیش
والد
کامیت
2807e64bcf

+ 44 - 0
src/api/park/attendUsrDetail.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询用户打卡信息列表
+export function listAttendUsrDetail(query) {
+  return request({
+    url: '/park/attendUsrDetail/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户打卡信息详细
+export function getAttendUsrDetail(id) {
+  return request({
+    url: '/park/attendUsrDetail/' + id,
+    method: 'get'
+  })
+}
+
+// 新增用户打卡信息
+export function addAttendUsrDetail(data) {
+  return request({
+    url: '/park/attendUsrDetail',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改用户打卡信息
+export function updateAttendUsrDetail(data) {
+  return request({
+    url: '/park/attendUsrDetail',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除用户打卡信息
+export function delAttendUsrDetail(id) {
+  return request({
+    url: '/park/attendUsrDetail/' + id,
+    method: 'delete'
+  })
+}

+ 0 - 2
src/views/bd/fence/index.vue

@@ -167,8 +167,6 @@ export default {
       this.dialogVisible = true;
       this.drawState = false;
     });
-
-
   },
   mounted() {
     this.getFenceList({});

+ 0 - 1
src/views/bd/map/maphandle.js

@@ -5,7 +5,6 @@ export default {
     return {
       polyLayer: null,
       layerId: 'vl',
-
     };
   },
   mounted() {

+ 287 - 0
src/views/bdspace/fenceInfo/draw-fence-dialog.vue

@@ -0,0 +1,287 @@
+<template>
+  <el-dialog
+      title="围栏设置"
+      :visible.sync="centerDialogVisible"
+      width="70vw"
+      @closed="onDialogClose"
+  >
+    <div v-if="!destroyed" class="trail-dialog-content" style="width: 100%;height: 70vh;">
+      <el-form ref="form" :model="form" label-width="80px" :rules="rules">
+        <el-form-item label="围栏名称" prop="name">
+          <el-input v-model="form.name"></el-input>
+        </el-form-item>
+      </el-form>
+      <bd-map :loaded="loaded" map-id="room-map"/>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="saveEdit">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+
+import BdMap from '@/views/bd/map/index.vue';
+import maphandle from '@/views/bd/map/maphandle';
+import dayjs from 'dayjs';
+import {addFenceInfo, updateFenceInfo} from "@/api/bd/fenceInfo";
+// import {uuid} from "@/utils";
+
+export default {
+  name: 'draw-fence-dialog',
+  mixins: [maphandle],
+  components: {
+    BdMap
+  },
+  data() {
+    return {
+      centerDialogVisible: false,
+      locationMarkers: {},
+      mapIns: null,
+      fencePolyLayer: null,
+      fence: {},
+      destroyed: false,
+      playLine: null,
+      editingDrawGeom: null,
+      drawState: false,
+      drawtool: null,
+      dialogVisible: false,
+      form: {
+        name: '',
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: '请输入围栏名称',
+            trigger: 'blur',
+          },
+        ],
+      },
+    };
+  },
+  // 组件卸载前清空图层信息
+  beforeDestroy() {
+    this.markLayer && this.mapIns.removeLayersById('markerLayer');
+    this.fencePolyLayer && this.fencePolyLayer.cust.clearLayer()
+  },
+  created() {
+
+  },
+  mounted() {
+  },
+  methods: {
+    dayjs,
+    onDialogClose() {
+      this.drawtool?.disable();
+      this.destroyed = true;
+    },
+    loaded(map) {
+      this.markLayer = new BDLayers.Lib.Layer.CBVectorLayer('markerLayer', true);
+      map.addCustomLayers(this.markLayer, 99);
+      this.mapIns = map;
+      map.setPitch(0);
+      map.setCenter([118.86895, 32.01326]);
+      this.fencePolyLayer = this.createLayer(map);
+      this.addFence()
+      this.initDrawTool(map);
+    },
+    initDrawTool(mapIns) {
+      // 地图绘制工具
+      this.drawtool = new BDLayers.Lib.Tools.CBDrawTool('myTool', mapIns, 'Polygon', true);
+      // 监听图形编辑
+      this.drawtool.on('selectDraw', geom => {
+        this.editingDrawGeom = geom.target.geometry ? geom.target.geometry : geom.target.geom
+            ? geom.target.geom
+            : geom.target;
+        if (this.editingDrawGeom.isEditing && this.editingDrawGeom.isEditing()) {
+          // 点击地图 图形取消编辑状态
+          mapIns.map.once('click', () => {
+            this.editingDrawGeom.endEdit();
+            this.dialogVisible = true;
+          });
+        } else {
+          mapIns.map.once('click', () => {
+            this.editingDrawGeom = null;
+          });
+        }
+      });
+      this.drawtool.on('drawend', (geom) => {
+        this.editingDrawGeom = geom.target.geometry ? geom.target.geometry : geom.target.geom
+            ? geom.target.geom
+            : geom.target;
+        this.dialogVisible = true;
+        this.drawState = false;
+      });
+    },
+    addFence() {
+      const {
+        id,
+        defenceName,
+        poly,
+      } = this.fence;
+      const polygon = this.custDrawPoly({
+        name: defenceName,
+        coordinates: this.polygonToCoordinates(poly),
+        symbol: {
+          lineColor: 'rgba(241,0,23,0.49)',
+          lineWidth: 2,
+          polygonFill: 'rgba(241,0,23,0.49)',
+          polygonOpacity: 0.4,
+        },
+        bizAttr: {
+          id,
+          name: defenceName
+        },
+      });
+      this.fence = {
+        id,
+        name: defenceName,
+        polygon,
+      }
+    },
+    /**
+     *
+     * @param coordinates
+     *  [
+     *           [
+     *             [118.86318437, 31.52265586],
+     *             [118.86620514, 31.52541921],
+     *             [118.86520697, 31.52406319],
+     *             [118.86318437, 31.52265586],
+     *           ],
+     *         ]
+     * @param symbol
+     * @param bizAttr
+     * @param labelSymbol
+     * @returns {BDLayers.Lib.Overlays.Polygon}
+     */
+    custDrawPoly({
+                   name = '多边形',
+                   coordinates,
+                   symbol = {},
+                   bizAttr = {},
+                   labelSymbol = {},
+                 }) {
+      return this.drawPoly({
+        name,
+        coordinates,
+        symbol,
+        bizAttr,
+        labelSymbol
+      }, this.fencePolyLayer)
+    },
+    cancelEdit() {
+      this.drawtool.clear();
+      this.dialogVisible = false;
+    },
+    cancel() {
+      this.centerDialogVisible = false;
+    },
+    saveEdit() {
+      this.$refs.form.validate(async (valid) => {
+        if (valid) {
+          const resultCoor = [];
+          const coordinates = [];
+          this.editingDrawGeom._coordinates.forEach(coor => {
+            const {
+              x,
+              y,
+            } = coor;
+            resultCoor.push(`${x} ${y}`);
+            coordinates.push([x, y]);
+          });
+          resultCoor.push(resultCoor[0]);
+          this.form.poly = `POLYGON((${resultCoor.join(',')}))`;
+          if (!this.form.id) {
+            await addFenceInfo(this.formatParams(this.form))
+            this.$message({
+              type: 'success',
+              message: '围栏保存成功',
+            });
+          } else {
+            await updateFenceInfo(this.formatParams(this.form))
+            this.$message({
+              type: 'success',
+              message: '围栏编辑成功',
+            });
+            this.polyLayer.removeGeometry(this.form.polygonId);
+          }
+          this.dialogVisible = false;
+          this.drawtool.clear();
+          this.drawPoly({
+            coordinates: coordinates,
+            symbol: {
+              lineColor: 'rgba(241,0,23,0.49)',
+              lineWidth: 2,
+              polygonFill: 'rgba(241,0,23,0.49)',
+              polygonOpacity: 0.4,
+            },
+            labelSymbol: {
+              labelText: this.form.name,
+            },
+            bizAttr: this.form,
+          });
+          this.editingDrawGeom = null;
+          this.editState = false;
+          this.$refs.form.resetFields();
+        } else {
+          return false;
+        }
+      });
+    },
+    formatParams(form) {
+      return {
+        ...form,
+        defenceName: this.form.name,
+        poly: this.form.poly,
+      };
+    },
+    startDraw() {
+      this.editingDrawGeom = null;
+      this.drawState = true;
+      this.drawtool.enable();
+    },
+    editFence(fence) {
+      this.editingDrawGeom = fence.polygon.geom;
+      this.form.name = fence.polygon.options.bizAttr.name;
+      this.form.id = fence.polygon.options.bizAttr.id;
+      this.form.polygonId = fence.polygon.options.bizAttr.polygonId;
+      this.editState = true;
+      this.editingDrawGeom.startEdit();
+      // 点击地图 图形取消编辑状态
+      window.map.map.once('click', () => {
+        this.editingDrawGeom.endEdit();
+        this.dialogVisible = true;
+      });
+    },
+    show(data) {
+      this.fence = data;
+      this.destroyed = false;
+      this.centerDialogVisible = true;
+    },
+  },
+};
+</script>
+<style scoped lang="scss">
+.trail-dialog-content {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+
+  .map-ctrl {
+    display: flex;
+    height: 100%;
+    flex-direction: column;
+    justify-content: flex-start;
+    align-items: flex-start;
+    margin-left: 20px;
+
+    .el-button {
+      margin-left: 0;
+      margin-top: 10px;
+    }
+  }
+}
+</style>

+ 267 - 0
src/views/park/attendUsrDetail/index.vue

@@ -0,0 +1,267 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="用户名" prop="usrName">
+        <el-input
+            v-model="queryParams.usrName"
+            placeholder="请输入用户名"
+            clearable
+            @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="打卡状态" prop="attendStat">
+        <el-select v-model="queryParams.attendStat" placeholder="请选择打卡状态" clearable>
+          <el-option
+              v-for="dict in dict.type.attend_status"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+            type="warning"
+            plain
+            icon="el-icon-download"
+            size="mini"
+            @click="handleExport"
+            v-hasPermi="['park:attendUsrDetail:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="attendUsrDetailList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="id" />
+      <el-table-column label="用户名" align="center" prop="usrName" />
+      <el-table-column label="开始时间" align="center" prop="attendStart" width="180">
+      </el-table-column>
+      <el-table-column label="打卡状态" align="center" prop="startAttendStat">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.attend_status" :value="scope.row.startAttendStat"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="结束时间" align="center" prop="attendEnd" width="180">
+      </el-table-column>
+      <el-table-column label="打卡状态" align="center" prop="endAttendStat">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.attend_status" :value="scope.row.endAttendStat"/>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+    />
+
+    <!-- 添加或修改用户打卡信息对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="用户名" prop="usrName">
+          <el-input v-model="form.usrName" placeholder="请输入用户名" />
+        </el-form-item>
+        <el-form-item label="开始时间" prop="attendStart">
+          <el-date-picker clearable
+                          v-model="form.attendStart"
+                          type="date"
+                          value-format="yyyy-MM-dd"
+                          placeholder="请选择开始时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="结束时间" prop="attendEnd">
+          <el-date-picker clearable
+                          v-model="form.attendEnd"
+                          type="date"
+                          value-format="yyyy-MM-dd"
+                          placeholder="请选择结束时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="打卡状态" prop="attendStat">
+          <el-select v-model="form.attendStat" placeholder="请选择打卡状态">
+            <el-option
+                v-for="dict in dict.type.attend_status"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="考勤组主键" prop="attendGroupId">
+          <el-input v-model="form.attendGroupId" placeholder="请输入考勤组主键" />
+        </el-form-item>
+        <el-form-item label="租户id" prop="tenantId">
+          <el-input v-model="form.tenantId" placeholder="请输入租户id" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listAttendUsrDetail, getAttendUsrDetail, delAttendUsrDetail, addAttendUsrDetail, updateAttendUsrDetail } from "@/api/park/attendUsrDetail";
+
+export default {
+  name: "AttendUsrDetail",
+  dicts: ['attend_status'],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户打卡信息表格数据
+      attendUsrDetailList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        usrName: null,
+        attendStat: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        usrName: [
+          { required: true, message: "用户名不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询用户打卡信息列表 */
+    getList() {
+      this.loading = true;
+      listAttendUsrDetail(this.queryParams).then(response => {
+        this.attendUsrDetailList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        usrId: null,
+        usrName: null,
+        attendStart: null,
+        attendEnd: null,
+        dt: null,
+        attendStat: null,
+        attendGroupId: null,
+        updateTime: null,
+        createTime: null,
+        createBy: null,
+        updateBy: null,
+        tenantId: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加用户打卡信息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getAttendUsrDetail(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改用户打卡信息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateAttendUsrDetail(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addAttendUsrDetail(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除用户打卡信息编号为"' + ids + '"的数据项?').then(function() {
+        return delAttendUsrDetail(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('park/attendUsrDetail/export', {
+        ...this.queryParams
+      }, `attendUsrDetail_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>