|
@@ -14,7 +14,7 @@
|
|
<el-button v-if="state.hasPermission('emergency:schedule:save')" type="primary" @click="addHandle()">新增</el-button>
|
|
<el-button v-if="state.hasPermission('emergency:schedule:save')" type="primary" @click="addHandle()">新增</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button v-if="state.hasPermission('emergency:schedule:delete')" type="danger" @click="state.deleteHandle()">删除</el-button>
|
|
|
|
|
|
+ <el-button v-if="state.hasPermission('emergency:schedule:delete')" type="danger" @click="customDeleteHandle()">删除</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button v-if="state.hasPermission('emergency:schedule:review')" type="danger" @click="reviewHandle()">审阅</el-button>
|
|
<el-button v-if="state.hasPermission('emergency:schedule:review')" type="danger" @click="reviewHandle()">审阅</el-button>
|
|
@@ -41,7 +41,7 @@
|
|
size="small"
|
|
size="small"
|
|
class="status-tag"
|
|
class="status-tag"
|
|
>
|
|
>
|
|
- {{ getScheduleStatus(data.day) === 0 ? '未确认' : '已确认' }}
|
|
|
|
|
|
+ {{ getScheduleStatus(data.day) === 0 ? '待确认' : '已确认' }}
|
|
</el-tag>
|
|
</el-tag>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -117,7 +117,6 @@ const addHandle = () => {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- // 查找已存在排班的日期
|
|
|
|
const existingDates = selectedDates.value.filter(date =>
|
|
const existingDates = selectedDates.value.filter(date =>
|
|
state.dataList?.some(item => item.scheduleDate === date)
|
|
state.dataList?.some(item => item.scheduleDate === date)
|
|
);
|
|
);
|
|
@@ -147,7 +146,6 @@ const addHandle = () => {
|
|
const refreshAfterAdd = async () => {
|
|
const refreshAfterAdd = async () => {
|
|
selectedDates.value = [];
|
|
selectedDates.value = [];
|
|
state.getDataList();
|
|
state.getDataList();
|
|
- console.log(state.dataList);
|
|
|
|
};
|
|
};
|
|
|
|
|
|
const addOrUpdateRef = ref();
|
|
const addOrUpdateRef = ref();
|
|
@@ -177,19 +175,62 @@ const handleDateToggle = (day: string, checked: boolean) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+//删除
|
|
|
|
+const customDeleteHandle = () => {
|
|
|
|
+ if (selectedDates.value.length === 0) {
|
|
|
|
+ return ElMessage.warning("请先选择要删除的日期");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const idsToDelete = selectedDates.value
|
|
|
|
+ .map(date => {
|
|
|
|
+ const match = state.dataList.find(item => item.scheduleDate === date);
|
|
|
|
+ return match?.id;
|
|
|
|
+ })
|
|
|
|
+ .filter(Boolean) as string[];
|
|
|
|
+
|
|
|
|
+ if (idsToDelete.length === 0) {
|
|
|
|
+ return ElMessage.warning("选中日期中暂无排班数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ElMessageBox.confirm(`确认要删除选中的 ${idsToDelete.length} 条排班记录吗?`, "提示", {
|
|
|
|
+ confirmButtonText: "删除",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ baseService.delete(state.deleteURL, idsToDelete);
|
|
|
|
+ ElMessage.success({
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ duration: 500,
|
|
|
|
+ onClose: () => {
|
|
|
|
+ state.getDataList();
|
|
|
|
+ selectedDates.value = [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ // 取消删除
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
// 审阅
|
|
// 审阅
|
|
const reviewHandle = (id?: string) => {
|
|
const reviewHandle = (id?: string) => {
|
|
- if (!id && state.dataListSelections && state.dataListSelections.length <= 0) {
|
|
|
|
|
|
+ if (selectedDates.value.length === 0) {
|
|
return ElMessage({
|
|
return ElMessage({
|
|
message: "请选择操作项",
|
|
message: "请选择操作项",
|
|
type: "warning",
|
|
type: "warning",
|
|
duration: 500
|
|
duration: 500
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- const reviewData = id
|
|
|
|
- ? [id]
|
|
|
|
- : (state.dataListSelections || []).map((item: IObject) => {return item.id});
|
|
|
|
|
|
+ const reviewData = selectedDates.value
|
|
|
|
+ .map(date => {
|
|
|
|
+ const item = state.dataList.find((i: any) => i.scheduleDate === date);
|
|
|
|
+ return item?.id;
|
|
|
|
+ })
|
|
|
|
+ .filter(Boolean);
|
|
|
|
|
|
|
|
+ if (reviewData.length === 0) {
|
|
|
|
+ return ElMessage.warning("选中日期中暂无排班数据");
|
|
|
|
+ }
|
|
ElMessageBox.confirm("确定进行[审阅]操作?", "提示", {
|
|
ElMessageBox.confirm("确定进行[审阅]操作?", "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
@@ -202,6 +243,8 @@ const reviewHandle = (id?: string) => {
|
|
duration: 500,
|
|
duration: 500,
|
|
onClose: () => {
|
|
onClose: () => {
|
|
state.getDataList();
|
|
state.getDataList();
|
|
|
|
+ state.dataListSelections = [];
|
|
|
|
+
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|