Commit 837cf76e92720c42bd7aa6dea17526a653e0fbe3

Authored by guzijian
1 parent d3981895

feat: 新增规则修改确认

src/api/scheduling/scheduling.js
... ... @@ -51,3 +51,11 @@ export function delScheduling(id) {
51 51 method: 'delete'
52 52 })
53 53 }
  54 +
  55 +
  56 +export function checkRule(ruleId) {
  57 + return request({
  58 + url: `/attendance/check/scheduleRule/${ruleId}`,
  59 + method: 'get'
  60 + })
  61 +}
... ...
src/utils/request.js
... ... @@ -4,7 +4,7 @@ import { getToken } from '@/utils/auth'
4 4 import errorCode from '@/utils/errorCode'
5 5 import { blobValidate, tansParams } from '@/utils/ruoyi'
6 6 import axios from 'axios'
7   -import { ElLoading, ElMessage, ElMessageBox, ElNotification } from 'element-plus'
  7 +import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'
8 8 import { saveAs } from 'file-saver'
9 9  
10 10 let downloadLoadingInstance;
... ... @@ -95,8 +95,8 @@ service.interceptors.response.use(res => {
95 95 ElMessage({ message: msg, type: 'warning' })
96 96 return Promise.reject(new Error(msg))
97 97 } else if (code !== 200) {
98   - ElNotification.error({ title: msg })
99   - return Promise.reject('error')
  98 + // ElNotification.error({ title: msg })
  99 + return Promise.reject(new Error(msg))
100 100 } else {
101 101 return Promise.resolve(res.data)
102 102 }
... ...
src/views/scheduling/scheduling/index.vue
... ... @@ -203,7 +203,8 @@
203 203 </template>
204 204  
205 205 <script setup name="Scheduling">
206   -import { addScheduling, delScheduling, getScheduling, listScheduling, updateScheduling } from "@/api/scheduling/scheduling";
  206 +import { addScheduling, checkRule, delScheduling, getScheduling, listScheduling, updateScheduling } from "@/api/scheduling/scheduling";
  207 +
207 208  
208 209 const { proxy } = getCurrentInstance();
209 210 const { sublevel, today_or_tomorrow, work_hour_type, work_hour_plan } = proxy.useDict('sublevel', 'today_or_tomorrow', 'work_hour_type', 'work_hour_plan');
... ... @@ -399,11 +400,26 @@ function submitForm() {
399 400 if (!validIds([form.value.id])) {
400 401 return;
401 402 }
402   - updateScheduling(form.value).then(response => {
403   - proxy.$modal.msgSuccess("修改成功");
404   - open.value = false;
405   - getList();
406   - });
  403 +
  404 + checkRule(form.value.id).then(response => {
  405 + console.log("checkRule", response);
  406 + proxy.$modal.msgSuccess(response.data);
  407 + updateScheduling(form.value).then(response => {
  408 + proxy.$modal.msgSuccess("检查通过");
  409 + open.value = false;
  410 + getList();
  411 + });
  412 +
  413 + }).catch((err) => {
  414 + // 提示确认是否修改
  415 + proxy.$modal.confirm(err.message + "确认要修改吗?").then(function () {
  416 + updateScheduling(form.value).then(res => {
  417 + proxy.$modal.msgSuccess("修改成功");
  418 + open.value = false;
  419 + getList();
  420 + })
  421 + })
  422 + })
407 423 } else {
408 424 addScheduling(form.value).then(response => {
409 425 proxy.$modal.msgSuccess("新增成功");
... ...