Commit 395a7a302ab1897ab6647ea994e204c9eba9a59f
1 parent
f74c9820
feat: 排班规则和班次管理删除解锁。
Showing
5 changed files
with
82 additions
and
39 deletions
src/utils/request.js
| 1 | -import axios from 'axios' | ||
| 2 | -import { ElNotification , ElMessageBox, ElMessage, ElLoading } from 'element-plus' | 1 | +import cache from '@/plugins/cache' |
| 2 | +import useUserStore from '@/store/modules/user' | ||
| 3 | import { getToken } from '@/utils/auth' | 3 | import { getToken } from '@/utils/auth' |
| 4 | import errorCode from '@/utils/errorCode' | 4 | import errorCode from '@/utils/errorCode' |
| 5 | -import { tansParams, blobValidate } from '@/utils/ruoyi' | ||
| 6 | -import cache from '@/plugins/cache' | 5 | +import { blobValidate, tansParams } from '@/utils/ruoyi' |
| 6 | +import axios from 'axios' | ||
| 7 | +import { ElLoading, ElMessage, ElMessageBox, ElNotification } from 'element-plus' | ||
| 7 | import { saveAs } from 'file-saver' | 8 | import { saveAs } from 'file-saver' |
| 8 | -import useUserStore from '@/store/modules/user' | ||
| 9 | 9 | ||
| 10 | let downloadLoadingInstance; | 10 | let downloadLoadingInstance; |
| 11 | // 是否显示重新登录 | 11 | // 是否显示重新登录 |
| @@ -117,7 +117,8 @@ service.interceptors.response.use(res => { | @@ -117,7 +117,8 @@ service.interceptors.response.use(res => { | ||
| 117 | ) | 117 | ) |
| 118 | 118 | ||
| 119 | // 通用下载方法 | 119 | // 通用下载方法 |
| 120 | -export function download(url, params, filename, config) { | 120 | +export function download(url, params, filename, config = { timeout: 1000 * 30 }) { |
| 121 | + | ||
| 121 | downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", }) | 122 | downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", }) |
| 122 | return service.post(url, params, { | 123 | return service.post(url, params, { |
| 123 | transformRequest: [(params) => { return tansParams(params) }], | 124 | transformRequest: [(params) => { return tansParams(params) }], |
src/views/main/manager/index.vue
| @@ -447,8 +447,6 @@ watch(againCreateFlag, (val1, val2) => { | @@ -447,8 +447,6 @@ watch(againCreateFlag, (val1, val2) => { | ||
| 447 | 447 | ||
| 448 | function handleAgainCreateAttendance() { | 448 | function handleAgainCreateAttendance() { |
| 449 | againCreateFlag.value = true; | 449 | againCreateFlag.value = true; |
| 450 | - | ||
| 451 | - | ||
| 452 | } | 450 | } |
| 453 | 451 | ||
| 454 | function handleUpdate() { | 452 | function handleUpdate() { |
src/views/num/num/index.vue
| @@ -183,7 +183,7 @@ function resetQuery() { | @@ -183,7 +183,7 @@ function resetQuery() { | ||
| 183 | function handleSelectionChange(selection) { | 183 | function handleSelectionChange(selection) { |
| 184 | ids.value = selection.map(item => item.id); | 184 | ids.value = selection.map(item => item.id); |
| 185 | single.value = selection.length != 1; | 185 | single.value = selection.length != 1; |
| 186 | - multiple.value = !selection.length; | 186 | + multiple.value = selection.length != 1; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | /** 新增按钮操作 */ | 189 | /** 新增按钮操作 */ |
| @@ -230,18 +230,16 @@ function submitForm() { | @@ -230,18 +230,16 @@ function submitForm() { | ||
| 230 | /** 删除按钮操作 */ | 230 | /** 删除按钮操作 */ |
| 231 | function handleDelete(row) { | 231 | function handleDelete(row) { |
| 232 | 232 | ||
| 233 | - proxy.$modal.msgSuccess("班型删除功能暂时禁用"); | ||
| 234 | - let result = false; | ||
| 235 | - if (result) { | ||
| 236 | - const _ids = row.id || ids.value; | ||
| 237 | - proxy.$modal.confirm('是否确认删除班次管理编号为"' + _ids + '"的数据项?').then(function () { | ||
| 238 | - return delNum(_ids); | ||
| 239 | - }).then(() => { | ||
| 240 | - getList(); | ||
| 241 | - proxy.$modal.msgSuccess("删除成功"); | ||
| 242 | - }).catch(() => { }); | ||
| 243 | - } | ||
| 244 | - | 233 | + // proxy.$modal.msgSuccess("班型删除功能暂时禁用"); |
| 234 | + // console.log(row); | ||
| 235 | + const _ids = row.id || ids.value; | ||
| 236 | + const deletePrompt = row.ruleDictName ? "是否确认删除班次名称为" + row.ruleDictName + "的数据项?" : "是否确认删除该班次?"; | ||
| 237 | + proxy.$modal.confirm(deletePrompt).then(function () { | ||
| 238 | + return delNum(_ids); | ||
| 239 | + }).then(() => { | ||
| 240 | + getList(); | ||
| 241 | + proxy.$modal.msgSuccess("删除成功"); | ||
| 242 | + }).catch(() => { }); | ||
| 245 | } | 243 | } |
| 246 | 244 | ||
| 247 | /** 导出按钮操作 */ | 245 | /** 导出按钮操作 */ |
src/views/report/sign/index.vue
| @@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
| 30 | <el-form-item> | 30 | <el-form-item> |
| 31 | <el-button type="primary" @click="onExportDateType('date')">按天导出</el-button> | 31 | <el-button type="primary" @click="onExportDateType('date')">按天导出</el-button> |
| 32 | <el-button type="primary" @click="onExportDateType('month')">按月导出</el-button> | 32 | <el-button type="primary" @click="onExportDateType('month')">按月导出</el-button> |
| 33 | + <el-button type="primary" @click="onExportDateBySplit">按照时间段导出</el-button> | ||
| 33 | </el-form-item> | 34 | </el-form-item> |
| 34 | 35 | ||
| 35 | <el-form-item> | 36 | <el-form-item> |
| @@ -114,16 +115,33 @@ | @@ -114,16 +115,33 @@ | ||
| 114 | <el-table-column label="原因" align="center" fixed="right" prop="remark" width="300" /> | 115 | <el-table-column label="原因" align="center" fixed="right" prop="remark" width="300" /> |
| 115 | </el-table> | 116 | </el-table> |
| 116 | </el-dialog> | 117 | </el-dialog> |
| 118 | + | ||
| 119 | + | ||
| 117 | <el-dialog title="请选择导出日期" v-model="openDateFlag" width="1080px" append-to-body> | 120 | <el-dialog title="请选择导出日期" v-model="openDateFlag" width="1080px" append-to-body> |
| 118 | <el-form> | 121 | <el-form> |
| 119 | <el-form-item label="日期"> | 122 | <el-form-item label="日期"> |
| 120 | <el-date-picker v-model="exportDate" :format="exportFormat == 'month' ? 'YYYY-MM' : 'YYYY-MM-DD'" | 123 | <el-date-picker v-model="exportDate" :format="exportFormat == 'month' ? 'YYYY-MM' : 'YYYY-MM-DD'" |
| 121 | :value-format="exportFormat == 'month' ? 'YYYY-MM' : 'YYYY-MM-DD'" :type="exportFormat" | 124 | :value-format="exportFormat == 'month' ? 'YYYY-MM' : 'YYYY-MM-DD'" :type="exportFormat" |
| 122 | - placeholder="选择重新生成月份" /> | 125 | + placeholder="选择导出日期" /> |
| 123 | </el-form-item> | 126 | </el-form-item> |
| 124 | </el-form> | 127 | </el-form> |
| 125 | <el-button type="primary" @click="onExport()">导出</el-button> | 128 | <el-button type="primary" @click="onExport()">导出</el-button> |
| 126 | </el-dialog> | 129 | </el-dialog> |
| 130 | + | ||
| 131 | + <el-dialog title="选择导出时间段" v-model="openDateSplitFlag" width="1080px" append-to-body> | ||
| 132 | + <el-form :model="exportDatePrams"> | ||
| 133 | + <el-form-item label="日期"> | ||
| 134 | + <el-date-picker v-model="exportDatePrams.startDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="date" | ||
| 135 | + placeholder="选择开始日期" /> | ||
| 136 | + </el-form-item> | ||
| 137 | + <el-form-item label="日期"> | ||
| 138 | + <el-date-picker v-model="exportDatePrams.endDate" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="date" | ||
| 139 | + placeholder="选择结束日期" /> | ||
| 140 | + </el-form-item> | ||
| 141 | + </el-form> | ||
| 142 | + <el-button type="primary" | ||
| 143 | + @click="exportByTimePeriod(exportDatePrams.startDate, exportDatePrams.endDate)">导出</el-button> | ||
| 144 | + </el-dialog> | ||
| 127 | </div> | 145 | </div> |
| 128 | </template> | 146 | </template> |
| 129 | 147 | ||
| @@ -149,7 +167,12 @@ const tableData = ref([]) // 表格数据 | @@ -149,7 +167,12 @@ const tableData = ref([]) // 表格数据 | ||
| 149 | const currentPage = ref(1) // 当前页 | 167 | const currentPage = ref(1) // 当前页 |
| 150 | const exportDate = ref() | 168 | const exportDate = ref() |
| 151 | const exportFormat = ref("date") | 169 | const exportFormat = ref("date") |
| 170 | +const exportDatePrams = ref({ | ||
| 171 | + startDate: "", | ||
| 172 | + endDate: "" | ||
| 173 | +}) | ||
| 152 | const openDateFlag = ref(false) | 174 | const openDateFlag = ref(false) |
| 175 | +const openDateSplitFlag = ref(false) | ||
| 153 | 176 | ||
| 154 | const rules = ref({ | 177 | const rules = ref({ |
| 155 | date: [ | 178 | date: [ |
| @@ -260,16 +283,40 @@ const onExport = () => { | @@ -260,16 +283,40 @@ const onExport = () => { | ||
| 260 | let namePre = exportFormat.value === 'date' ? exportDate.value : exportDate.value + '-01'; | 283 | let namePre = exportFormat.value === 'date' ? exportDate.value : exportDate.value + '-01'; |
| 261 | console.log(namePre); | 284 | console.log(namePre); |
| 262 | proxy.download('report/export', { | 285 | proxy.download('report/export', { |
| 263 | - ids: ids.value, | ||
| 264 | date: namePre, | 286 | date: namePre, |
| 265 | exportFlag: exportFormat.value === 'date' ? 1 : 2 | 287 | exportFlag: exportFormat.value === 'date' ? 1 : 2 |
| 266 | }, `${exportDate.value}签到报表.xlsx`) | 288 | }, `${exportDate.value}签到报表.xlsx`) |
| 267 | - .then(res => { | ||
| 268 | - proxy.$message({ | ||
| 269 | - message: '导出成功', | ||
| 270 | - type: 'success' | ||
| 271 | - }) | 289 | + |
| 290 | +} | ||
| 291 | + | ||
| 292 | +/** | ||
| 293 | + * 按照时间段导出 | ||
| 294 | + * @param {string} startDate | ||
| 295 | + * @param {string} endDate | ||
| 296 | + */ | ||
| 297 | +const exportByTimePeriod = (startDate, endDate) => { | ||
| 298 | + // 校验日期 | ||
| 299 | + if (!startDate || !endDate) { | ||
| 300 | + proxy.$message({ | ||
| 301 | + message: '请选择日期', | ||
| 302 | + type: 'warning' | ||
| 272 | }) | 303 | }) |
| 304 | + return | ||
| 305 | + } | ||
| 306 | + proxy.download('report/export', { | ||
| 307 | + startDate, | ||
| 308 | + endDate, | ||
| 309 | + exportFlag: 3 | ||
| 310 | + }, `${startDate}到${endDate}的签到报表.xlsx`, { | ||
| 311 | + timeout: 300000 | ||
| 312 | + }) | ||
| 313 | + | ||
| 314 | +} | ||
| 315 | + | ||
| 316 | +const onExportDateBySplit = () => { | ||
| 317 | + openDateSplitFlag.value = true | ||
| 318 | + exportDatePrams.value.startDate = '' | ||
| 319 | + exportDatePrams.value.endDate = '' | ||
| 273 | } | 320 | } |
| 274 | 321 | ||
| 275 | const onExportDateType = (val) => { | 322 | const onExportDateType = (val) => { |
src/views/scheduling/scheduling/index.vue
| @@ -390,17 +390,16 @@ function submitForm() { | @@ -390,17 +390,16 @@ function submitForm() { | ||
| 390 | /** 删除按钮操作 */ | 390 | /** 删除按钮操作 */ |
| 391 | function handleDelete(row) { | 391 | function handleDelete(row) { |
| 392 | 392 | ||
| 393 | - proxy.$modal.msgSuccess("规则删除暂时停用防止误操作"); | ||
| 394 | - let result = false; | ||
| 395 | - if (result) { | ||
| 396 | - const _ids = row.id || ids.value; | ||
| 397 | - proxy.$modal.confirm('是否确认删除排班规则编号为"' + _ids + '"的数据项?').then(function () { | ||
| 398 | - return delScheduling(_ids); | ||
| 399 | - }).then(() => { | ||
| 400 | - getList(); | ||
| 401 | - proxy.$modal.msgSuccess("删除成功"); | ||
| 402 | - }).catch(() => { }); | ||
| 403 | - } | 393 | + // proxy.$modal.msgSuccess("规则删除暂时停用防止误操作"); |
| 394 | + console.log(row); | ||
| 395 | + const deletePrompt = row.ruleName ? "是否确认删除规则名称为" + row.ruleName + "的数据项?" : "是否确认该规则?"; | ||
| 396 | + const _ids = row.id || ids.value; | ||
| 397 | + proxy.$modal.confirm(deletePrompt).then(function () { | ||
| 398 | + return delScheduling(_ids); | ||
| 399 | + }).then(() => { | ||
| 400 | + getList(); | ||
| 401 | + proxy.$modal.msgSuccess("删除成功"); | ||
| 402 | + }).catch(() => { }); | ||
| 404 | 403 | ||
| 405 | } | 404 | } |
| 406 | 405 |