浏览代码

系统设置修改

hzj18279462576@163.com 1 年之前
父节点
当前提交
31fb1c565d
共有 4 个文件被更改,包括 372 次插入46 次删除
  1. 2 2
      src/router/index.js
  2. 2 2
      src/store/modules/user.js
  3. 355 29
      src/views/waiting/waiting.vue
  4. 13 13
      vite.config.js

+ 2 - 2
src/router/index.js

@@ -5,8 +5,8 @@ import {
 } from "vue-router";
 } from "vue-router";
 import Layout from "@/layout/index.vue";
 import Layout from "@/layout/index.vue";
 const router = createRouter({
 const router = createRouter({
-  history: createWebHashHistory("/carstop/dist6"), // 线上地址
-  // history: createWebHashHistory("/testingServertomcat/dist6"), // 测试环境发布地址
+  // history: createWebHashHistory("/carstop/dist6"), // 线上地址
+  history: createWebHashHistory("/testingServertomcat/dist6"), // 测试环境发布地址
   routes: [
   routes: [
     {
     {
       path: "/login",
       path: "/login",

+ 2 - 2
src/store/modules/user.js

@@ -8,8 +8,8 @@ const state = {
   activeIndex: 0,
   activeIndex: 0,
   username: "",
   username: "",
   password: "",
   password: "",
-  api: "/carstop/carbook", // 线上
-  // api: "/testingServertomcat/carbook", // 测试
+  // api: "/carstop/carbook", // 线上
+  api: "/testingServertomcat/carbook", // 测试
   newsNum: "",
   newsNum: "",
 };
 };
 
 

+ 355 - 29
src/views/waiting/waiting.vue

@@ -7,18 +7,103 @@
     <div class="middle">
     <div class="middle">
       <div class="filter">
       <div class="filter">
         <div class="condition">
         <div class="condition">
-          <h3>开始时间段设置</h3>
-          <div>
-            <el-time-picker
-              v-model="ruleForm.yy_duration"
-              is-range
-              format="HH:mm"
-              value-format="HH:mm"
-              range-separator="-"
-              start-placeholder="开始时间"
-              end-placeholder="结束时间"
-              @change="timeUpdata"
-            />
+          <div style="display: flex; align-items: center">
+            <h3>开始时间段设置</h3>
+            <!-- <el-button
+              color="rgba(61, 81, 232, 1)"
+              @click="editSystem"
+              v-if="timeShow"
+              type="primary"
+              >修改</el-button
+            >
+            <el-button
+              color="rgba(61, 81, 232, 1)"
+              @click="saveSystem"
+              v-if="!timeShow"
+              type="primary"
+              >保存</el-button
+            >
+            <el-button @click="cancelSystem" v-if="!timeShow" plain
+              >取消</el-button
+            > -->
+          </div>
+          <div
+            style="display: flex; align-items: center; margin-bottom: 8px"
+            v-for="(i, ind) in timeList.list"
+          >
+            <div class="addTime">
+              <span>周期配置&nbsp;&nbsp;</span>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期一')"
+                v-model="i.day1"
+              >
+                <el-checkbox :label="1">星期一</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期二')"
+                v-model="i.day2"
+              >
+                <el-checkbox :label="1">星期二</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期三')"
+                v-model="i.day3"
+              >
+                <el-checkbox :label="1">星期三</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期四')"
+                v-model="i.day4"
+              >
+                <el-checkbox :label="1">星期四</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期五')"
+                v-model="i.day5"
+              >
+                <el-checkbox :label="1">星期五</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期六')"
+                v-model="i.day6"
+              >
+                <el-checkbox :label="1">星期六</el-checkbox>
+              </el-checkbox-group>
+              <el-checkbox-group
+                @change="saveTime($event, i.id, '星期日')"
+                v-model="i.day7"
+              >
+                <el-checkbox :label="1">星期日</el-checkbox>
+              </el-checkbox-group>
+
+              <div style="margin: 0 18px">
+                <el-time-picker
+                  class="timePicker"
+                  v-model="i.timePicker"
+                  :clearable="false"
+                  is-range
+                  format="HH:mm"
+                  value-format="HH:mm"
+                  range-separator="-"
+                  start-placeholder="开始时间"
+                  end-placeholder="结束时间"
+                  @change="saveTime($event, i.id)"
+                />
+              </div>
+            </div>
+            <div>
+              <span
+                @click="addTime(ind)"
+                style="cursor: pointer; color: rgb(30, 125, 251)"
+                >添加</span
+              >
+              <span
+                v-if="timeList.list.length > 1"
+                @click="delTime(ind, i.id)"
+                style="cursor: pointer; color: #f56c6c"
+                >删除</span
+              >
+            </div>
           </div>
           </div>
         </div>
         </div>
         <div class="condition">
         <div class="condition">
@@ -26,11 +111,11 @@
           <div>
           <div>
             <span>发车前</span>
             <span>发车前</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.yy_end"
               v-model="ruleForm.yy_end"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <!-- <el-time-picker
             <!-- <el-time-picker
               v-model="ruleForm.hh_end"
               v-model="ruleForm.hh_end"
@@ -46,23 +131,35 @@
           <div>
           <div>
             <span>发车前</span>
             <span>发车前</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.startTime"
               v-model="ruleForm.startTime"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <span>&nbsp;&nbsp;分钟 ,</span>
             <span>&nbsp;&nbsp;分钟 ,</span>
             <span>发车后</span>
             <span>发车后</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.endTime"
               v-model="ruleForm.endTime"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <span>&nbsp;&nbsp;分钟可扫码核销 </span>
             <span>&nbsp;&nbsp;分钟可扫码核销 </span>
           </div>
           </div>
+          <div style="margin-top: 15px">
+            <span>扫码间隔</span>
+            <el-input
+              :clearable="false"
+              v-model="ruleForm.scanInterval"
+              class="w-50 m-2"
+              style="width: 100px"
+              @change="timeVerify"
+            />
+            <span>&nbsp;&nbsp;分钟 ,</span>
+            <span>在此时间内多次扫码均提示已预约</span>
+          </div>
         </div>
         </div>
         <!-- <div class="condition">
         <!-- <div class="condition">
           <h3>候补截止预约时间设置</h3>
           <h3>候补截止预约时间设置</h3>
@@ -82,11 +179,11 @@
           <div>
           <div>
             <span>爽约</span>
             <span>爽约</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.black_count"
               v-model="ruleForm.black_count"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <span>&nbsp;&nbsp;次,锁定账号</span>
             <span>&nbsp;&nbsp;次,锁定账号</span>
           </div>
           </div>
@@ -96,11 +193,11 @@
           <div>
           <div>
             <span>发车前提前</span>
             <span>发车前提前</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.notice_time"
               v-model="ruleForm.notice_time"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <span>&nbsp;&nbsp;分钟,发送通知</span>
             <span>&nbsp;&nbsp;分钟,发送通知</span>
           </div>
           </div>
@@ -110,11 +207,11 @@
           <div>
           <div>
             <span>发车前</span>
             <span>发车前</span>
             <el-input
             <el-input
-              clearable
+              :clearable="false"
               v-model="ruleForm.bb_before"
               v-model="ruleForm.bb_before"
               class="w-50 m-2"
               class="w-50 m-2"
               style="width: 100px"
               style="width: 100px"
-              @blur="timeUpdata"
+              @change="timeVerify"
             />
             />
             <span>&nbsp;&nbsp;分钟,可以预约车辆</span>
             <span>&nbsp;&nbsp;分钟,可以预约车辆</span>
           </div>
           </div>
@@ -145,16 +242,36 @@ const api = ref("");
 const router = useRouter();
 const router = useRouter();
 // 表格数据
 // 表格数据
 const ruleForm = reactive({
 const ruleForm = reactive({
-  yy_duration: [], // 开始时间段设置
+  yy_duration: "",
   hh_end: "", //截止预约时间设置
   hh_end: "", //截止预约时间设置
   yy_end: "", //候补截止预约时间设置
   yy_end: "", //候补截止预约时间设置
   black_count: "", //黑名单设置次数
   black_count: "", //黑名单设置次数
   notice_time: "", //发车前提前
   notice_time: "", //发车前提前
   startTime: "", // 扫码前时间
   startTime: "", // 扫码前时间
   endTime: "", // 扫码后时间
   endTime: "", // 扫码后时间
+  scanInterval: "", // 扫码间隔
   bb_before: "", // 报备人预约车辆时间设置
   bb_before: "", // 报备人预约车辆时间设置
   id: "",
   id: "",
 });
 });
+// 开始时间段配置
+const timeList = reactive({
+  list: [
+    {
+      day1: [],
+      day2: [],
+      day3: [],
+      day4: [],
+      day5: [],
+      day6: [],
+      day7: [],
+      timePicker: [],
+      id: "",
+    },
+  ],
+});
+
+const timeShow = ref(true);
+
 // 获取系统设置数据
 // 获取系统设置数据
 const getlist = async (message) => {
 const getlist = async (message) => {
   let res = await axios({
   let res = await axios({
@@ -166,8 +283,8 @@ const getlist = async (message) => {
   });
   });
   console.log(res);
   console.log(res);
   if (res.data.code == 200) {
   if (res.data.code == 200) {
-    console.log(res.data.data.yy_duration.split("~"));
-    ruleForm.yy_duration = res.data.data.yy_duration.split("~");
+    ruleForm.yy_duration = res.data.data.yy_duration;
+    ruleForm.scanInterval = res.data.data.scanInterval;
     ruleForm.yy_end = res.data.data.yy_end; //
     ruleForm.yy_end = res.data.data.yy_end; //
     ruleForm.hh_end = res.data.data.hh_end; //
     ruleForm.hh_end = res.data.data.hh_end; //
     ruleForm.black_count = res.data.data.black_count;
     ruleForm.black_count = res.data.data.black_count;
@@ -200,14 +317,70 @@ const getlist = async (message) => {
     }
     }
   }
   }
 };
 };
+const getTimeList = async () => {
+  let res = await axios({
+    method: "post",
+    url: api.value + "/carBook/weekConfigqueryList.action",
+    headers: {
+      token: sessionStorage.getItem("token"),
+    },
+  });
+  console.log(res, "开始时间段配置");
+  if (res.data.code == 200) {
+    let resData = res.data.data;
+    let arr = [];
+    resData.forEach((i) => {
+      arr.push({
+        day1: i.day1 ? [i.day1] : [],
+        day2: i.day2 ? [i.day2] : [],
+        day3: i.day3 ? [i.day3] : [],
+        day4: i.day4 ? [i.day4] : [],
+        day5: i.day5 ? [i.day5] : [],
+        day6: i.day6 ? [i.day6] : [],
+        day7: i.day7 ? [i.day7] : [],
+        timePicker: [i.startTime, i.endTime],
+        id: i.id,
+      });
+    });
+    timeList.list = arr;
+    console.log(arr, "开始时间段配置");
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+    if (res.data.message == "token错误") {
+      router.push({
+        path: `/login`,
+      });
+    }
+  }
+};
 
 
 // 页面数据一修改就调用函数
 // 页面数据一修改就调用函数
+const timeVerify=(val)=>{
+  const regex = /^[0-9]+$/;
+  if(regex.test(val)){
+    timeUpdata()
+  }else{
+    getlist()
+    ElMessage({
+      type: "warning",
+      showClose: true,
+      message: "请输入正确数值",
+      center: true,
+    });
+  }
+}
 const timeUpdata = async () => {
 const timeUpdata = async () => {
   if (ruleForm.black_count <= 0) {
   if (ruleForm.black_count <= 0) {
     ruleForm.black_count = 1;
     ruleForm.black_count = 1;
   }
   }
   let data = {
   let data = {
-    yy_duration: ruleForm.yy_duration.join("~"),
+    yy_duration: ruleForm.yy_duration,
+    scanInterval: ruleForm.scanInterval,
     yy_end: ruleForm.yy_end,
     yy_end: ruleForm.yy_end,
     hh_end: ruleForm.hh_end,
     hh_end: ruleForm.hh_end,
     black_count: ruleForm.black_count,
     black_count: ruleForm.black_count,
@@ -217,7 +390,6 @@ const timeUpdata = async () => {
     bb_before: ruleForm.bb_before,
     bb_before: ruleForm.bb_before,
     id: ruleForm.id,
     id: ruleForm.id,
   };
   };
-  // let res = await admin.adminAdd(data);
   let res = await axios({
   let res = await axios({
     method: "post",
     method: "post",
     url: api.value + "/carBook/cnupdate.action",
     url: api.value + "/carBook/cnupdate.action",
@@ -248,9 +420,148 @@ const timeUpdata = async () => {
   }
   }
 };
 };
 
 
+const addTime = lodash.debounce(async (ind) => {
+  console.log("添加", ind);
+  // timeList.list.splice(ind + 1, 0, {
+  //   day1: [],
+  //   day2: [],
+  //   day3: [],
+  //   day4: [],
+  //   day5: [],
+  //   day6: [],
+  //   day7: [],
+  //   timePicker: [],
+  //   id: "",
+  // });
+  let arr = {
+    day1: 0,
+    day2: 0,
+    day3: 0,
+    day4: 0,
+    day5: 0,
+    day6: 0,
+    day7: 0,
+    timePicker: null,
+  };
+  let res = await axios({
+    method: "post",
+    url: api.value + "/carBook/weekConfiginsert.action",
+    headers: {
+      token: sessionStorage.getItem("token"),
+    },
+    data: arr,
+  });
+  if (res.data.code == 200) {
+    getTimeList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+}, 500);
+const delTime = async (ind, id) => {
+  // timeList.list.splice(ind, 1);
+  let data = new FormData();
+  data.append("id", id);
+  let res = await axios({
+    method: "post",
+    url: api.value + "/carBook/weekConfigdel.action",
+    headers: {
+      token: sessionStorage.getItem("token"),
+    },
+    data: data,
+  });
+  if (res.data.code == 200) {
+    getTimeList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
+const saveTime = async (event, id, txt) => {
+  // console.log(event,'id:'+id,txt);
+  console.log(timeList.list);
+  let arr = timeList.list.map((i) => {
+    console.log(i);
+    return {
+      day1: i.day1.length ? 1 : 0,
+      day2: i.day2.length ? 1 : 0,
+      day3: i.day3.length ? 1 : 0,
+      day4: i.day4.length ? 1 : 0,
+      day5: i.day5.length ? 1 : 0,
+      day6: i.day6.length ? 1 : 0,
+      day7: i.day7.length ? 1 : 0,
+      startTime: i.timePicker[0],
+      endTime: i.timePicker[1],
+      id: i.id,
+    };
+  });
+  // console.log(arr);
+  let augment = arr.filter((i) => {
+    return i.id == id;
+  });
+  // console.log(augment);
+  let res = await axios({
+    method: "post",
+    url: api.value + "/carBook/weekConfigupdate.action",
+    headers: {
+      "Content-Type": "application/json;charset=utf-8",
+      token: sessionStorage.getItem("token"),
+    },
+    data: augment[0],
+  });
+  if (res.data.code == 200) {
+    getTimeList();
+    ElMessage({
+      type: "success",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  } else {
+    getTimeList();
+    ElMessage({
+      type: "error",
+      showClose: true,
+      message: res.data.message,
+      center: true,
+    });
+  }
+};
+
+const editSystem = () => {
+  timeShow.value = false;
+};
+const saveSystem = () => {
+  timeShow.value = true;
+};
+const cancelSystem = () => {
+  timeShow.value = true;
+};
+
 onBeforeMount(() => {
 onBeforeMount(() => {
   api.value = store.state.user.api;
   api.value = store.state.user.api;
   getlist();
   getlist();
+  getTimeList();
 });
 });
 onUnmounted(() => {});
 onUnmounted(() => {});
 </script>
 </script>
@@ -296,11 +607,26 @@ onUnmounted(() => {});
         display: flex;
         display: flex;
         flex-direction: column;
         flex-direction: column;
         margin: 10px 30px 10px 0;
         margin: 10px 30px 10px 0;
+        h3 {
+          margin: 12px 12px 12px 0;
+        }
         span {
         span {
           margin: 0 10px 0 0;
           margin: 0 10px 0 0;
           font-size: 18px;
           font-size: 18px;
           color: #000;
           color: #000;
         }
         }
+        .addTime {
+          display: flex;
+          align-items: center;
+          .el-checkbox-group {
+            .el-checkbox {
+              margin: 0 15px 0 0;
+            }
+          }
+          :deep(.timePicker) {
+            width: 200px;
+          }
+        }
       }
       }
     }
     }
     .gongneng {
     .gongneng {

+ 13 - 13
vite.config.js

@@ -23,23 +23,23 @@ export default defineConfig({
     // 是否开启 https
     // 是否开启 https
     // https: false,
     // https: false,
     // 线上地址
     // 线上地址
-    proxy: {
-      "/carstop/carbook": {
-        target: "https://chtech.ncjti.edu.cn/carstop/carbook",
-        changeOrigin: true,
-        rewrite: (path) => path.replace(/^\/carstop\/carbook/, ""),
-      },
-    },
-
-    // 测试地址
     // proxy: {
     // proxy: {
-    //   "/testingServertomcat/carbook": {
-    //     target: "https://chtech.ncjti.edu.cn/testingServertomcat/carbook", // 测试环境
-    //     // target: "https://jtishfw.ncjti.edu.cn/jxch-smartmp/carbook", // 测试环境
+    //   "/carstop/carbook": {
+    //     target: "https://chtech.ncjti.edu.cn/carstop/carbook",
     //     changeOrigin: true,
     //     changeOrigin: true,
-    //     rewrite: (path) => path.replace(/^\/testingServertomcat\/carbook/, ""),
+    //     rewrite: (path) => path.replace(/^\/carstop\/carbook/, ""),
     //   },
     //   },
     // },
     // },
+
+    // 测试地址
+    proxy: {
+      "/testingServertomcat/carbook": {
+        target: "https://chtech.ncjti.edu.cn/testingServertomcat/carbook", // 测试环境
+        // target: "https://jtishfw.ncjti.edu.cn/jxch-smartmp/carbook", // 测试环境
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/testingServertomcat\/carbook/, ""),
+      },
+    },
   },
   },
   publicDir: "public",
   publicDir: "public",
   base: "./",
   base: "./",