勘察人员排班,基本完成,有遗留问题
This commit is contained in:
@@ -10,6 +10,15 @@ export function getScheduleList(params) {
|
||||
});
|
||||
}
|
||||
|
||||
// 添加排班
|
||||
export function addSchedule(params) {
|
||||
return service({
|
||||
method: "post",
|
||||
url: `${API_BASE_URL}`,
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改排班
|
||||
export function updateSchedule(params) {
|
||||
return service({
|
||||
|
||||
@@ -5,7 +5,7 @@ const API_BASE_URL = '/user';
|
||||
export function listSurveyorsUser(query) {
|
||||
return service({
|
||||
method: "get",
|
||||
url: `${API_BASE_URL}/`,
|
||||
url: `${API_BASE_URL}/surveyors`,
|
||||
params: query
|
||||
});
|
||||
}
|
||||
@@ -14,7 +14,7 @@ export function listSurveyorsUser(query) {
|
||||
export function listMaintenanceUser(query) {
|
||||
return service({
|
||||
method: "get",
|
||||
url: `${API_BASE_URL}/`,
|
||||
url: `${API_BASE_URL}/maintenance`,
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-col :span="10" v-if="false">
|
||||
<el-select
|
||||
v-model="queryData.roleId"
|
||||
style="max-width: 300px"
|
||||
@@ -57,6 +57,12 @@
|
||||
<el-col :span="2">
|
||||
<el-button type="success" @click="handleCurrentChange">查询</el-button>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="success" @click="handleCurrentChange">时段管理</el-button>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="success" @click="handleCurrentChange">排班管理</el-button>
|
||||
</el-col>
|
||||
|
||||
</el-form>
|
||||
</el-row>
|
||||
@@ -100,7 +106,7 @@
|
||||
|
||||
<div style="display: flex; justify-content: flex-end; margin-top: 20px">
|
||||
<el-button @click="timeItem = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleSave">确认</el-button>
|
||||
<el-button type="primary" @click="handleSaveQuantum">确认</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
@@ -110,11 +116,11 @@
|
||||
</template>
|
||||
<template #default>
|
||||
|
||||
<el-form :model="form" label-width="auto" style="max-width: 600px">
|
||||
<el-form :model="scheduleForm" label-width="auto" style="max-width: 600px">
|
||||
|
||||
<el-form-item label="日期时间">
|
||||
<el-date-picker
|
||||
v-model="isDate"
|
||||
v-model="scheduleForm.date"
|
||||
type="date"
|
||||
placeholder="排班日期"
|
||||
:disabled-date="disablePastAndSpecificDates"
|
||||
@@ -122,7 +128,7 @@
|
||||
/>
|
||||
|
||||
<el-select
|
||||
v-model="isTime"
|
||||
v-model="scheduleForm.timeQuantumId"
|
||||
filterable
|
||||
placeholder="请选择排班时间"
|
||||
style="width: 240px"
|
||||
@@ -137,17 +143,16 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排班人员">
|
||||
<el-checkbox-group v-model="isUserData" size="large">
|
||||
<el-checkbox-button v-for="item in userList" :key="item.label" :value="item.label" style="margin: 10px 0;">
|
||||
<el-checkbox-group v-model="scheduleForm.userids" size="large">
|
||||
<el-checkbox-button v-for="item in userList" :key="item.label" :value="item.label">
|
||||
{{ item.label }}
|
||||
</el-checkbox-button>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<div style="display: flex;justify-content: center;margin-top: 50px">
|
||||
<el-button @click="drawer = false">取消</el-button>
|
||||
<el-button type="success" @click="confirmClick">确认</el-button>
|
||||
<el-button type="success" @click="handleSaveSchedule">确认</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</template>
|
||||
@@ -155,7 +160,7 @@
|
||||
</el-drawer>
|
||||
</el-card>
|
||||
|
||||
<el-card class="mt10">
|
||||
<el-card class="mt10" v-if="false">
|
||||
<el-button type="success" @click="timeItem = true">
|
||||
<el-icon style="margin-right: 10px;"><CirclePlus /></el-icon>
|
||||
创建时段
|
||||
@@ -214,7 +219,8 @@
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<br/>
|
||||
</el-card>
|
||||
<el-card class="mt10" v-if="true">
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
@@ -290,12 +296,11 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import {listQuantum, addQuantum, updateQuantum, delQuantum} from "../../api/modules/schedulingTime";
|
||||
import {getScheduleList, updateSchedule, delSchedule} from "../../api/modules/scheduling";
|
||||
import {getScheduleList, addSchedule, updateSchedule, delSchedule} from "../../api/modules/scheduling";
|
||||
import {listSurveyorsUser, listMaintenanceUser} from "../../api/modules/schedulingUser";
|
||||
import {nextTick, onMounted, reactive, ref, watch } from 'vue'
|
||||
|
||||
import {options} from './options.js'
|
||||
import {Plus} from "@element-plus/icons-vue";
|
||||
import {CirclePlus, Plus} from "@element-plus/icons-vue";
|
||||
import {ElMessage, ElMessageBox, timelineItemProps} from "element-plus";
|
||||
import {
|
||||
Check,
|
||||
@@ -305,7 +310,6 @@ import {
|
||||
Search,
|
||||
Star,
|
||||
} from '@element-plus/icons-vue'
|
||||
import {approve} from "../../api/modules/postApply";
|
||||
const tableData = ref([])
|
||||
// const dataList = ref([])
|
||||
const table = ref()
|
||||
@@ -314,9 +318,12 @@ const isExpand = ref(false)
|
||||
const disabled = ref(false)
|
||||
const dialogVisible = ref(false)
|
||||
const total = ref(0)
|
||||
const formInline = ref({})
|
||||
const registerDate = ref('');
|
||||
const searchName = ref('');
|
||||
const scheduleForm = reactive({
|
||||
id: '',
|
||||
date: '2024-10-16',
|
||||
timeQuantumId: '',
|
||||
userids: [],
|
||||
});
|
||||
const setup = () => {
|
||||
const direction = 'rtl'; // 或者 'ltr', 'ttb', 'btt' 根据需要设置
|
||||
const timeForm = reactive({
|
||||
@@ -400,6 +407,26 @@ const setup = () => {
|
||||
};
|
||||
};
|
||||
|
||||
const handleSaveSchedule = () => {
|
||||
// 提交表单数据
|
||||
console.log('表单数据:', scheduleForm);
|
||||
// 这里可以添加保存逻辑,比如调用 API
|
||||
if(scheduleForm.id&&scheduleForm.id ===''){
|
||||
addSchedule(scheduleForm).then((res) => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '新增成功!'
|
||||
});
|
||||
})
|
||||
} else {
|
||||
updateSchedule(scheduleForm).then((res) => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '修改成功!'
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
const drawer = ref(false)
|
||||
const queryData = ref({
|
||||
@@ -410,75 +437,7 @@ const queryData = ref({
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const isUserData = ref([]); // 选中
|
||||
const userList = [
|
||||
{
|
||||
value: '1',
|
||||
label: '张三',
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '王五',
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '李四',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '赵高',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '秦始皇',
|
||||
},{
|
||||
value: '3',
|
||||
label: '李四',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '赵高',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '秦始皇',
|
||||
},{
|
||||
value: '3',
|
||||
label: '李四',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '赵高',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '秦始皇',
|
||||
},{
|
||||
value: '3',
|
||||
label: '李四',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '赵高',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '秦始皇',
|
||||
},{
|
||||
value: '3',
|
||||
label: '李四',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '赵高',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '秦始皇',
|
||||
},
|
||||
]; // 用户列表
|
||||
|
||||
const isTime = ref(''); // 选中时间段
|
||||
const userList = ref([]);
|
||||
|
||||
const timeList = ref([]);
|
||||
const timeOptions = ref([]);
|
||||
@@ -493,7 +452,7 @@ const postOptions = [
|
||||
},
|
||||
];
|
||||
|
||||
const isDate = ref(''); // 当前日期
|
||||
const currentDate = ref(''); // 当前日期
|
||||
|
||||
// 禁止选择之前的日期
|
||||
const disablePastAndSpecificDates = (date) => {
|
||||
@@ -535,20 +494,28 @@ updateTimeOptions();
|
||||
|
||||
watch(timeList, updateTimeOptions, { deep: true }); // 深度监听 timeList 的变更
|
||||
const initData = () => {
|
||||
|
||||
// 获取当前日期
|
||||
isDate.value = new Date();
|
||||
|
||||
listQuantum().then((res) => {
|
||||
timeList.value = res.data
|
||||
})
|
||||
if(queryData.value.roleId==='2'){
|
||||
listSurveyorsUser().then((res)=>{
|
||||
userList.value = res.data
|
||||
});
|
||||
}else if(queryData.value.roleId==='3'){
|
||||
listMaintenanceUser().then((res)=>{
|
||||
userList.value = res.data
|
||||
.map(item => ({ // 转换为 { value: id, label: startTime + "-" + endTime } 格式
|
||||
value: item.id,
|
||||
label: item.nickName
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索事件
|
||||
const handleCurrentChange = (val) => {
|
||||
console.log("调试: queryData.value.date="+queryData.value.date);
|
||||
// queryData.value.date = queryData.value.date === ''?'':queryData.value.date.substring(0,10)
|
||||
console.log("调试: queryData.value.date="+queryData.value.date);
|
||||
queryData.value.date = '2024-10-16';
|
||||
getScheduleList(queryData.value).then((res) => {
|
||||
console.log(res.data)
|
||||
// total.value = res.data.total
|
||||
|
||||
Reference in New Issue
Block a user