|
@@ -0,0 +1,272 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
+ <el-form-item label="时间" prop="empDate">
|
|
|
|
+ <el-date-picker clearable
|
|
|
|
+ v-model="queryParams.empDate"
|
|
|
|
+ type="date"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ placeholder="请选择时间">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="员工号" prop="empId">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.empId"
|
|
|
|
+ placeholder="请输入员工号"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="员工姓名" prop="empName">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.empName"
|
|
|
|
+ placeholder="请输入员工姓名"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="班组" prop="empTeam">
|
|
|
|
+ <el-select clearable v-model="queryParams.empTeam" placeholder="请选择" style="width: 200px">
|
|
|
|
+ <el-option value="A" label="A班"></el-option>
|
|
|
|
+ <el-option value="B" label="B班"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
+ <el-button icon="Refresh" @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="Download"
|
|
|
|
+ @click="handleExport"
|
|
|
|
+ >导出</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ <el-table v-loading="loading" :data="rotaList" @selection-change="handleSelectionChange">
|
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
|
+<!-- <el-table-column label="班次ID" align="center" prop="shiftId" />-->
|
|
|
|
+ <el-table-column label="时间" align="center" prop="empDate" width="180">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ parseTime(scope.row.empDate, '{y}-{m}-{d}') }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="员工号" align="center" prop="empId" />
|
|
|
|
+ <el-table-column label="员工姓名" align="center" prop="empName" />
|
|
|
|
+ <el-table-column label="班组" align="center" prop="empTeam" />
|
|
|
|
+ <el-table-column label="机台号" align="center" prop="devices" />
|
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createdTime" width="180">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+<!-- <el-table-column label="备注" align="center" prop="remark" />-->
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-button link type="primary" icon="View" @click="handleUpdate(scope.row)">查看</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <pagination
|
|
|
|
+ v-show="total>0"
|
|
|
|
+ :total="total"
|
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
|
+ @pagination="getList"
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ <!-- 添加或修改经编车间员工排班对话框 -->
|
|
|
|
+ <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
|
+ <el-form ref="rotaRef" :model="form" :rules="rules" label-width="80px">
|
|
|
|
+ <el-form-item label="时间" prop="empDate">
|
|
|
|
+ {{ parseTime(form.empDate, '{y}-{m}-{d}') }}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="员工号" prop="empId">
|
|
|
|
+ {{form.empId}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="员工姓名" prop="empName">
|
|
|
|
+ {{form.empName}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="班组" prop="empTeam">
|
|
|
|
+ {{form.empTeam}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="机台号" prop="devices">
|
|
|
|
+ {{form.devices}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="创建时间" prop="createdTime">
|
|
|
|
+ {{form.createdTime}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="更新时间" prop="updatedTime">
|
|
|
|
+ {{form.updatedTime}}
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="cancel">确 定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script setup name="Rota">
|
|
|
|
+import { listRota, getRota, delRota, addRota, updateRota } from "@/api/wkEmp/rota";
|
|
|
|
+
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
+
|
|
|
|
+const rotaList = ref([]);
|
|
|
|
+const open = ref(false);
|
|
|
|
+const loading = ref(true);
|
|
|
|
+const showSearch = ref(true);
|
|
|
|
+const ids = ref([]);
|
|
|
|
+const single = ref(true);
|
|
|
|
+const multiple = ref(true);
|
|
|
|
+const total = ref(0);
|
|
|
|
+const title = ref("");
|
|
|
|
+
|
|
|
|
+const data = reactive({
|
|
|
|
+ form: {},
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ empDate: null,
|
|
|
|
+ empId: null,
|
|
|
|
+ empName: null,
|
|
|
|
+ empTeam: null,
|
|
|
|
+ devices: null,
|
|
|
|
+ createdBy: null,
|
|
|
|
+ createdTime: null,
|
|
|
|
+ updatedBy: null,
|
|
|
|
+ updatedTime: null,
|
|
|
|
+ remark: null
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const { queryParams, form, rules } = toRefs(data);
|
|
|
|
+
|
|
|
|
+/** 查询经编车间员工排班列表 */
|
|
|
|
+function getList() {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ listRota(queryParams.value).then(response => {
|
|
|
|
+ rotaList.value = response.rows;
|
|
|
|
+ total.value = response.total;
|
|
|
|
+ loading.value = false;
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 取消按钮
|
|
|
|
+function cancel() {
|
|
|
|
+ open.value = false;
|
|
|
|
+ reset();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 表单重置
|
|
|
|
+function reset() {
|
|
|
|
+ form.value = {
|
|
|
|
+ shiftId: null,
|
|
|
|
+ empDate: null,
|
|
|
|
+ empId: null,
|
|
|
|
+ empName: null,
|
|
|
|
+ empTeam: null,
|
|
|
|
+ devices: null,
|
|
|
|
+ createdBy: null,
|
|
|
|
+ createdTime: null,
|
|
|
|
+ updatedBy: null,
|
|
|
|
+ updatedTime: null,
|
|
|
|
+ remark: null
|
|
|
|
+ };
|
|
|
|
+ proxy.resetForm("rotaRef");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 搜索按钮操作 */
|
|
|
|
+function handleQuery() {
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
+ getList();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 重置按钮操作 */
|
|
|
|
+function resetQuery() {
|
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
|
+ handleQuery();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 多选框选中数据
|
|
|
|
+function handleSelectionChange(selection) {
|
|
|
|
+ ids.value = selection.map(item => item.shiftId);
|
|
|
|
+ single.value = selection.length != 1;
|
|
|
|
+ multiple.value = !selection.length;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 新增按钮操作 */
|
|
|
|
+function handleAdd() {
|
|
|
|
+ reset();
|
|
|
|
+ open.value = true;
|
|
|
|
+ title.value = "添加经编车间员工排班";
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 修改按钮操作 */
|
|
|
|
+function handleUpdate(row) {
|
|
|
|
+ reset();
|
|
|
|
+ const _shiftId = row.shiftId || ids.value
|
|
|
|
+ getRota(_shiftId).then(response => {
|
|
|
|
+ form.value = response.data;
|
|
|
|
+ open.value = true;
|
|
|
|
+ title.value = "查看经编车间员工排班";
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 提交按钮 */
|
|
|
|
+function submitForm() {
|
|
|
|
+ proxy.$refs["rotaRef"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (form.value.shiftId != null) {
|
|
|
|
+ updateRota(form.value).then(response => {
|
|
|
|
+ proxy.$modal.msgSuccess("修改成功");
|
|
|
|
+ open.value = false;
|
|
|
|
+ getList();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ addRota(form.value).then(response => {
|
|
|
|
+ proxy.$modal.msgSuccess("新增成功");
|
|
|
|
+ open.value = false;
|
|
|
|
+ getList();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 删除按钮操作 */
|
|
|
|
+function handleDelete(row) {
|
|
|
|
+ const _shiftIds = row.shiftId || ids.value;
|
|
|
|
+ proxy.$modal.confirm('是否确认删除经编车间员工排班编号为"' + _shiftIds + '"的数据项?').then(function() {
|
|
|
|
+ return delRota(_shiftIds);
|
|
|
|
+ }).then(() => {
|
|
|
|
+ getList();
|
|
|
|
+ proxy.$modal.msgSuccess("删除成功");
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 导出按钮操作 */
|
|
|
|
+function handleExport() {
|
|
|
|
+ proxy.download('wkEmp/rota/export', {
|
|
|
|
+ ...queryParams.value
|
|
|
|
+ }, `rota_${new Date().getTime()}.xlsx`)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+getList();
|
|
|
|
+</script>
|