|
@@ -1,98 +1,107 @@
|
|
|
<template>
|
|
|
- <div class="Scheduling">
|
|
|
- <el-row>
|
|
|
- <el-col :span="12"
|
|
|
- ><el-date-picker v-model="dates" type="dates" placeholder="请选择日期"
|
|
|
- /></el-col>
|
|
|
- <el-col :span="12" style="text-align: right">
|
|
|
- <el-button type="primary" @click="showHistoryDate">历史记录</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="10">
|
|
|
- <br />
|
|
|
- <el-card>
|
|
|
- <template #header>本轮已排班人员</template>
|
|
|
- <el-empty v-if="OnDuty.length === 0" description="暂无人员" />
|
|
|
- <div v-for="o in OnDuty" :key="o" class="text">
|
|
|
- {{ o.dt }} {{ o.name }}
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- <br />
|
|
|
- <el-card>
|
|
|
- <template #header> 本轮未排班人员 </template>
|
|
|
- <el-empty v-if="NotOnDuty.length === 0" description="暂无人员" />
|
|
|
- <div v-for="o in NotOnDuty" :key="o" class="text">
|
|
|
- {{ o.name }}
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4" style="position: relative">
|
|
|
- <div class="start_scheduling" @click="createScheduling_func">
|
|
|
- 开始排班
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="10">
|
|
|
- <br />
|
|
|
- <el-card>
|
|
|
- <template #header> 新生成排班 </template>
|
|
|
- <el-empty v-if="NewOnDuty.length === 0" description="暂无人员" />
|
|
|
- <div v-for="o in NewOnDuty" :key="o" class="text">
|
|
|
- {{ o.dt }} {{ o.name }}
|
|
|
+ <el-config-provider :locale="zhCn">
|
|
|
+ <div class="Scheduling">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12"
|
|
|
+ ><el-date-picker
|
|
|
+ v-model="dates"
|
|
|
+ type="dates"
|
|
|
+ placeholder="请选择日期"
|
|
|
+ /></el-col>
|
|
|
+ <el-col :span="12" style="text-align: right">
|
|
|
+ <el-button type="primary" @click="showHistoryDate"
|
|
|
+ >历史记录</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="10">
|
|
|
+ <br />
|
|
|
+ <el-card>
|
|
|
+ <template #header>本轮已排班人员</template>
|
|
|
+ <el-empty v-if="OnDuty.length === 0" description="暂无人员" />
|
|
|
+ <div v-for="o in OnDuty" :key="o" class="text">
|
|
|
+ {{ o.dt }} {{ o.name }}
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ <br />
|
|
|
+ <el-card>
|
|
|
+ <template #header> 本轮未排班人员 </template>
|
|
|
+ <el-empty v-if="NotOnDuty.length === 0" description="暂无人员" />
|
|
|
+ <div v-for="o in NotOnDuty" :key="o" class="text">
|
|
|
+ {{ o.name }}
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" style="position: relative">
|
|
|
+ <div class="start_scheduling" @click="createScheduling_func">
|
|
|
+ 开始排班
|
|
|
</div>
|
|
|
- </el-card>
|
|
|
- <br />
|
|
|
- <el-card>
|
|
|
- <template #header>
|
|
|
- <el-date-picker
|
|
|
- v-model="dates_now"
|
|
|
- type="date"
|
|
|
- placeholder="请选择日期"
|
|
|
- />
|
|
|
- <el-select
|
|
|
- v-model="selectUser"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 240px"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in NotOnDuty"
|
|
|
- :key="item.name"
|
|
|
- :label="item.naem"
|
|
|
- :value="item.name"
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <br />
|
|
|
+ <el-card>
|
|
|
+ <template #header> 新生成排班 </template>
|
|
|
+ <el-empty v-if="NewOnDuty.length === 0" description="暂无人员" />
|
|
|
+ <div v-for="o in NewOnDuty" :key="o" class="text">
|
|
|
+ {{ o.dt }} {{ o.name }}
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ <br />
|
|
|
+ <el-card>
|
|
|
+ <template #header>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dates_now"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择日期"
|
|
|
/>
|
|
|
- </el-select>
|
|
|
- <el-button type="primary" @click="createNotOnDuty">+</el-button>
|
|
|
- </template>
|
|
|
- <el-empty v-if="NotOnDuty.length === 0" description="暂无人员" />
|
|
|
+ <el-select
|
|
|
+ v-model="selectUser"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 240px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in NotOnDuty"
|
|
|
+ :key="item.name"
|
|
|
+ :label="item.naem"
|
|
|
+ :value="item.name"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-button type="primary" @click="createNotOnDuty">+</el-button>
|
|
|
+ </template>
|
|
|
+ <el-empty v-if="NotOnDuty.length === 0" description="暂无人员" />
|
|
|
|
|
|
- <div v-for="(o, i) in addUser" :key="o.name" class="text">
|
|
|
- {{ o.dt }}
|
|
|
- :
|
|
|
- {{ o.name }}
|
|
|
- <el-button type="danger" @click="() => delUser(i)">删除</el-button>
|
|
|
- </div>
|
|
|
- <el-button type="primary" @click="createOnDuty">添加排班</el-button>
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div v-for="(o, i) in addUser" :key="o.name" class="text">
|
|
|
+ {{ o.dt }}
|
|
|
+ :
|
|
|
+ {{ o.name }}
|
|
|
+ <el-button type="danger" @click="() => delUser(i)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" @click="createOnDuty">添加排班</el-button>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- <el-dialog v-model="showHistory" title="值班历史">
|
|
|
- <el-table :data="showHistoryList">
|
|
|
- <el-table-column property="dt" label="值班日期" />
|
|
|
- <el-table-column property="name" label="姓名" />
|
|
|
- </el-table>
|
|
|
- <br />
|
|
|
- <br />
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="size"
|
|
|
- v-model:current-page="page"
|
|
|
- :total="total"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- />
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
+ <el-dialog v-model="showHistory" title="值班历史">
|
|
|
+ <el-table :data="showHistoryList">
|
|
|
+ <el-table-column property="dt" label="值班日期" />
|
|
|
+ <el-table-column property="name" label="姓名" />
|
|
|
+ </el-table>
|
|
|
+ <br />
|
|
|
+ <br />
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :page-size="size"
|
|
|
+ v-model:current-page="page"
|
|
|
+ :total="total"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+ </el-config-provider>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref } from 'vue';
|
|
@@ -115,10 +124,12 @@ import {
|
|
|
ElPagination,
|
|
|
ElSelect,
|
|
|
ElOption,
|
|
|
+ ElConfigProvider
|
|
|
} from 'element-plus';
|
|
|
import { showToast } from 'vant';
|
|
|
import 'vant/lib/toast/style/index';
|
|
|
import 'element-plus/dist/index.css';
|
|
|
+import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
|
|
|
// import { onMounted, reactive } from "vue";
|
|
|
// import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
|
|
|
/**
|
|
@@ -126,7 +137,6 @@ import 'element-plus/dist/index.css';
|
|
|
* window.$originData.orginParames.parameters 固定参数值
|
|
|
* window.$originData.urlParames url参数
|
|
|
*/
|
|
|
-console.log(window.$originData);
|
|
|
const selectUser = ref('');
|
|
|
const dates = ref([]);
|
|
|
const dates_now = ref([]);
|
|
@@ -162,8 +172,11 @@ function createScheduling_func() {
|
|
|
if (history[v.createTime]) history[v.createTime].push(v);
|
|
|
else history[v.createTime] = [v];
|
|
|
}
|
|
|
- const newHistory = history[Object.keys(history)[0]] || {};
|
|
|
- console.log(newHistory);
|
|
|
+ let keys = Object.keys(history);
|
|
|
+ keys = keys.sort((a, b) => {
|
|
|
+ return new Date(b) - new Date(a);
|
|
|
+ });
|
|
|
+ const newHistory = history[keys[0]] || {};
|
|
|
NewOnDuty.value = newHistory;
|
|
|
});
|
|
|
});
|
|
@@ -178,7 +191,7 @@ function delUser(i) {
|
|
|
}
|
|
|
|
|
|
function createNotOnDuty() {
|
|
|
- console.log(selectUser.value, dates_now.value);
|
|
|
+ if (!selectUser.value) return showToast('请选择人员');
|
|
|
const endDt = new Date(dates_now.value);
|
|
|
const Y = endDt.getFullYear();
|
|
|
const M =
|