From 2591e298a3fd1332ad0ca33059f6ba0b7d426f51 Mon Sep 17 00:00:00 2001
From: pengwei <2071057782@qq.com>
Date: 星期四, 20 三月 2025 10:08:00 +0800
Subject: [PATCH] 最新代码提交

---
 项目代码/client/src/views/tts/TaskManagement/Taskmanagement.vue |  280 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 192 insertions(+), 88 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/TaskManagement/Taskmanagement.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/TaskManagement/Taskmanagement.vue"
index caf0823..f3d2bb6 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/TaskManagement/Taskmanagement.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/TaskManagement/Taskmanagement.vue"
@@ -25,7 +25,7 @@
             size="small"
           />
         </div>
-        <!-- <div class="serch_box">
+        <div class="serch_box">
           <div class="serchb">
             <el-select
               v-model="queryForm.selectType"
@@ -46,7 +46,7 @@
             placeholder="璇疯緭鍏ュ叧閿瘝鎼滅储"
             style="border-left: 0.06rem solid #e2e2e2"
           />
-        </div> -->
+        </div>
         <el-button
           type="primary"
           size="small"
@@ -63,7 +63,7 @@
           <el-button
             type="primary"
             size="small"
-            @click="dialogVisible1 = true"
+            @click="addData"
             style="
               width: 5.5rem;
               height: 2rem;
@@ -71,7 +71,7 @@
               display: flex;
               align-items: center;
             "
-            ><el-icon style="margin-right: 0.2rem"><Plus /></el-icon
+            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
             >鏂板缓</el-button
           >
           <el-button
@@ -85,7 +85,7 @@
               display: flex;
               align-items: center;
             "
-            ><el-icon style="margin-right: 0.2rem"><Plus /></el-icon
+            ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon
             >鎵嬪姩鑾峰彇</el-button
           >
           <el-button
@@ -212,7 +212,9 @@
                 @click="Send(scope.row)"
                 >娲句换鍔�</el-button
               >
-              <!-- <el-button size="small" type="text" @click="delt">缂栬緫</el-button> -->
+              <el-button size="small" type="text" @click="Editdata(scope.row)"
+                >缂栬緫</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -238,12 +240,12 @@
         />
       </div>
     </div>
-    <!-- 浠诲姟淇℃伅寮瑰嚭妗� -->
+    <!-- 鏂板缓/缂栬緫浠诲姟淇℃伅寮瑰嚭妗� -->
     <el-dialog
       v-model="dialogVisible1"
       title=""
       width="60%"
-      @close="handleClose(ruleFormRef)"
+      @close="resetForm(ruleFormRef)"
       style="margin-top: 15.625rem"
     >
       <template #title>
@@ -406,7 +408,7 @@
       v-model="SenddialogVisible"
       title=""
       width="60%"
-      @close="handleClose(sendformRef)"
+      @close="resetForm(sendformRef)"
       top="2%"
     >
       <template #title>
@@ -865,7 +867,7 @@
         </div>
       </template>
     </el-dialog> -->
-
+    <!-- 妗嗘灦鎵归噺瀵煎叆寮瑰嚭妗� -->
     <el-dialog v-model="importDialogVisible">
       <UploadExcel
         @importExcelAfter="importExcelAfter"
@@ -879,7 +881,7 @@
   </div>
 </template>
 <script setup>
-import { ref, reactive, onMounted } from "vue";
+import { ref, reactive, onMounted, toRef } from "vue";
 import { useRouter } from "vue-router";
 import {
   GetPageData,
@@ -890,25 +892,26 @@
   GetTemplateList,
   Delete,
   ExportApi,
+  Update,
 } from "@/api/newapi/NjTask";
 import { GetUerType } from "@/api/user";
 import { formatTime } from "@/utils/index.js";
 import { ElMessage } from "element-plus";
 import UploadExcel from "@/components/basic/UploadExcel.vue";
-
+//浣跨敤璺敱
 const router = useRouter();
+// 鍒濆鍖栨暟鎹�
 const obj = {
   selectName: "",
   selectTime: [], // 鏃堕棿鑼冨洿
-  selectType: "",
-  selectInput: "",
+  selectType: "", //閫夋嫨鐨勭被鍨�
+  selectInput: "", //杈撳叆鐨勬暟鎹�
 };
-const queryForm = ref({
-  selectName: "",
-  selectTime: [], // 鏃堕棿鑼冨洿
-  selectType: "",
-  selectInput: "",
-});
+//鎼滅储浼犵殑鏁版嵁
+const queryForm = toRef({ ...obj });
+//椤甸潰鐨勬暟閲�
+const pageTotal = ref(0);
+//琛ㄥ崟鐨勬暟鎹�
 const tableData = ref([]);
 const UerTypeoptions = ref({
   quality: [], //璐ㄦ
@@ -916,6 +919,8 @@
   mechanical: [], //鏈烘
   trench: [], //鍦版矡
 });
+
+//琛ㄥ崟楠岃瘉瑙勫垯
 const rules = reactive({
   bogie: [{ required: true, message: "璇疯緭鍏ヨ浆鍚戞灦", trigger: "blur" }],
   coachNum: [{ required: true, message: "璇疯緭鍏ヨ溅鍘㈠彿", trigger: "blur" }],
@@ -924,16 +929,9 @@
   trainKind: [{ required: true, message: "璇疯緭鍏ヨ溅鍨�", trigger: "blur" }],
   trainNum: [{ required: true, message: "璇疯緭鍏ヨ溅缁勫彿", trigger: "blur" }],
 });
+//鏂板缓缂栬緫琛ㄥ崟ref鍊�
 const ruleFormRef = ref();
-const options = ref([]);
-const props = { multiple: true };
-const table = ref(false);
-const selectoptions = reactive([
-  { label: "杞﹀瀷", value: "trainkind" },
-  { label: "杞︾粍", value: "trainNum" },
-  { label: "鑲¢亾", value: "track" },
-  { label: "妫�淇彮缁�", value: "processkept" },
-]);
+//娣诲姞/缂栬緫鐨勮〃鍗曟暟鎹�
 const form = ref({
   bogie: "", //杞悜鏋�
   coachNum: "", //杞﹀帰
@@ -941,39 +939,89 @@
   track: "", //鑲¢亾
   trainKind: "", //杞﹀瀷
   trainNum: "", //杞︾粍鍙�
-  createTime: formatTime(new Date()), //鍒涘缓鏃堕棿
+  createDate: formatTime(new Date()), //鍒涘缓鏃堕棿
+  creater: JSON.parse(localStorage.getItem("user")).userName, //鍒涘缓浜�
 });
+//鍒犻櫎
+const dialogVisible1 = ref(false);
+//娲句换鍔�
+const SenddialogVisible = ref(false);
+//娲句换鍔¤〃鍗時ef鍊�
+const sendformRef = ref();
+//鎵归噺瀵煎叆
+const dialogVisible = ref(false);
+//鎵归噺瀵煎叆鏁版嵁
+const gridtableData = ref([]);
+//妯℃澘鍒楄〃
+const temopitions = ref([]);
+
+const props = { multiple: true };
+const table = ref(false);
+const type = ref("鏂板缓");
+//鎼滅储閫夋嫨鐨勫瓧娈�
+const selectoptions = reactive([
+  { label: "杞﹀瀷", value: "trainkind" },
+  { label: "杞︾粍", value: "trainNum" },
+  { label: "鑲¢亾", value: "track" },
+  { label: "妫�淇彮缁�", value: "processkept" },
+]);
+//鎻愪氦鐨勬暟鎹彉閲�
 const sendform = ref({});
+//鎵归噺瀵煎叆
 const importDialogVisible = ref(false);
 //鐩戝惉鏂囦欢涓婁紶鎴愬姛鐨勫洖璋�
 const importExcelAfter = () => {
   importDialogVisible.value = false;
   initData();
 };
+
 //鏂板缓浠诲姟淇℃伅
 const AddNJinfomclick = async (formEl) => {
   if (!formEl) return;
   await formEl.validate((valid, fields) => {
     if (valid) {
-      AddNJinfom(form.value).then((res) => {
-        if (res.code == 0) {
-          ElMessage({
-            message: "鍒涘缓鎴愬姛",
-            type: "success",
-          });
-          dialogVisible1.value = false;
-        }
-      });
+      if (type.value == "鏂板缓") {
+        AddNJinfom(form.value).then((res) => {
+          if (res.code == 0) {
+            ElMessage({
+              message: "鍒涘缓鎴愬姛",
+              type: "success",
+            });
+            dialogVisible1.value = false;
+            initData();
+          }
+        });
+      } else {
+        //缂栬緫
+        Update(form.value).then((res) => {
+          if (res.code == 0) {
+            ElMessage({
+              message: "淇敼鎴愬姛",
+              type: "success",
+            });
+            dialogVisible1.value = false;
+            initData();
+          }
+        });
+      }
     } else {
       console.log("error submit!", fields);
     }
   });
 };
-//鍒犻櫎
-const dialogVisible1 = ref(false);
-//娲句换鍔�
-const SenddialogVisible = ref(false);
-const sendformRef = ref();
+//鏂板缓浠诲姟淇℃伅
+const addData = () => {
+  type.value = "鏂板缓";
+  dialogVisible1.value = true;
+};
+//缂栬緫浠诲姟淇℃伅
+const Editdata = (row) => {
+  let obj = Object.assign({}, row);
+  type.value = "缂栬緫";
+  dialogVisible1.value = true;
+  form.value = obj;
+};
+
 //鎻愪氦
 const sublit = async (formEl) => {
   let data = {
@@ -1000,6 +1048,7 @@
           type: "success",
         });
         SenddialogVisible.value = false;
+        initData();
       });
     } else {
       console.log("error submit!", fields);
@@ -1032,6 +1081,7 @@
           message: res.message,
           type: "success",
         });
+        initData();
         SenddialogVisible.value = false;
       });
     } else {
@@ -1039,16 +1089,16 @@
     }
   });
 };
-//鎵归噺瀵煎叆
-const dialogVisible = ref(false);
+
+//鏁版嵁瀵煎嚭鐨勬柟娉�
 const printExcel = () => {
   // 鏌ヨ鏉′欢
-  const startTime = formatTime(queryForm.selectTime[0]);
-  const endTime = formatTime(queryForm.selectTime[1]);
+  const startTime = formatTime(queryForm.value.selectTime[0]);
+  const endTime = formatTime(queryForm.value.selectTime[1]);
   const filter = [
     {
-      name: queryForm.selectType,
-      value: queryForm.selectInput,
+      name: queryForm.value.selectType,
+      value: queryForm.value.selectInput,
       displayType: "String",
     },
 
@@ -1060,49 +1110,40 @@
     filter,
   });
 };
-//鎵归噺瀵煎叆鏁版嵁
-const gridtableData = ref([]);
+// quality: [], //璐ㄦ
+// electric: [], //鐢垫皵
+// mechanical: [], //鏈烘
+// trench: [], //鍦版矡
 //娲句换鍔℃柟娉�
 const Send = (val) => {
   SenddialogVisible.value = true;
   sendform.value = { ...val };
   getTemplateList();
   GetUerType().then((res) => {
-    UerTypeoptions.value.quality = res.data.filter(
-      (item) => item.roleId != 1 && item.roleId == 2
-    );
+    UerTypeoptions.value.quality = res.data.filter((item) => {
+      return item.user_Id != 1 && item.roleName.substring(2, 4) == "璐ㄦ";
+    });
     UerTypeoptions.value.electric = res.data.filter(
-      (item) => item.roleId != 1 && item.roleId == 3
+      (item) =>
+        item.user_Id != 1 &&
+        item.roleName.substring(2, 4) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鐢垫皵"
     );
     UerTypeoptions.value.mechanical = res.data.filter(
-      (item) => item.roleId != 1 && item.roleId == 4
+      (item) =>
+        item.user_Id != 1 &&
+        item.roleName.substring(2, 4) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鏈烘"
     );
     UerTypeoptions.value.trench = res.data.filter(
-      (item) => item.roleId != 1 && item.roleId == 5
+      (item) =>
+        item.user_Id != 1 &&
+        item.roleName.substring(2, 4) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鍦版矡"
     );
   });
+  console.log(UerTypeoptions.value);
 };
-//鍒犻櫎鏂规硶
-const delt = () => {
-  dialogVisible1.value = true;
-};
-//鎵归噺鍒犻櫎
-const ids = ref([]);
-const SelectionChange = (val) => {
-  ids.value = [];
-  ids.value = val.map((item) => item.id);
-};
-const deleteAll = () => {
-  if (ids.value.length == 0) {
-    ElMessage({ message: "璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁", type: "error" });
-    return;
-  }
-  Delete(ids.value).then((res) => {
-    ElMessage({ message: "鍒犻櫎鎴愬姛", type: "success" });
-    initData();
-  });
-};
-const temopitions = ref([]);
 //鑾峰彇鎵�鏈夋ā鏉�
 const getTemplateList = () => {
   GetTemplateList({
@@ -1132,13 +1173,31 @@
     sendform.value = { ...sendform.value, ...res.data[0] };
   });
 };
+//鎵归噺鍒犻櫎
+const ids = ref([]); //鎵归噺鍒犻櫎鐨刬d
+const SelectionChange = (val) => {
+  //鑾峰彇鎵归噺鍒犻櫎鐨刬d
+  ids.value = [];
+  ids.value = val.map((item) => item.id);
+};
+//鍒犻櫎閫変腑鐨勬暟鎹�
+const deleteAll = () => {
+  if (ids.value.length == 0) {
+    ElMessage({ message: "璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁", type: "error" });
+    return;
+  }
+  Delete(ids.value).then((res) => {
+    ElMessage({ message: "鍒犻櫎鎴愬姛", type: "success" });
+    initData();
+  });
+};
 
 //鍒嗛〉璇锋眰鍙傛暟
 const pageQuery = ref({
   page: 1, //褰撳墠椤甸潰
   rows: 10, //姣忛〉鏄剧ず鏉℃暟
-  order: "createTime", //鎺掑簭鏂瑰紡
-  sort: "desc", //鎺掑簭瀛楁
+  order: "desc", //鎺掑簭鏂瑰紡
+  sort: "", //鎺掑簭瀛楁
   wheres: "", //鏉′欢鏌ヨ
 });
 
@@ -1153,7 +1212,8 @@
   pageQuery.value.page = val;
   initData();
 };
-const pageTotal = ref(0);
+
+//椤甸潰鍒濆鍖栨柟娉�
 const initData = () => {
   // 鏌ヨ鏉′欢
   const startTime = formatTime(queryForm.value.selectTime[0]);
@@ -1162,7 +1222,7 @@
     {
       name: queryForm.value.selectType,
       value: queryForm.value.selectInput,
-      displayType: "String",
+      displayType: "like",
     },
     { name: "createtime", value: startTime, displayType: "ThanOrEqual" },
     { name: "createtime", value: endTime, displayType: "LessOrEqual" },
@@ -1181,37 +1241,76 @@
   pageQuery.value.page = 1;
   initData();
 };
+//閲嶇疆琛ㄥ崟
+const resetForm = (formEl) => {
+  if (!formEl) return;
+  formEl.resetFields();
+  form.value = {
+    bogie: "", //杞悜鏋�
+    coachNum: "", //杞﹀帰
+    processDept: "", //妫�淇彮缁�
+    track: "", //鑲¢亾
+    trainKind: "", //杞﹀瀷
+    trainNum: "", //杞︾粍鍙�
+    creater: "",
+    createDate: formatTime(new Date()), //鍒涘缓鏃堕棿
+  };
+};
+//閲嶇疆鏂规硶
 const resetQuery = () => {
   queryForm.value = Object.assign({}, obj);
   pageQuery.value.page = 1;
   initData();
 };
-//閲嶇疆琛ㄥ崟
-const handleClose = (formEl) => {
-  if (!formEl) return;
-  formEl.resetFields();
-};
+
 onMounted(() => {
   initData();
+  GetUerType().then((res) => {
+    UerTypeoptions.value.quality = res.data.filter(
+      (item) => item.roleId != 1 && item.roleName.substring(2, 2) == "璐ㄦ"
+    );
+    UerTypeoptions.value.electric = res.data.filter(
+      (item) =>
+        item.roleId != 1 &&
+        item.roleName.substring(2, 2) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鐢垫皵"
+    );
+    UerTypeoptions.value.mechanical = res.data.filter(
+      (item) =>
+        item.roleId != 1 &&
+        item.roleName.substring(2, 2) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鏈烘"
+    );
+    UerTypeoptions.value.trench = res.data.filter(
+      (item) =>
+        item.roleId != 1 &&
+        item.roleName.substring(2, 2) != "璐ㄦ" &&
+        item.roleName.substring(0, 2) == "鍦版矡"
+    );
+  });
 });
 </script>
 <style lang="scss" scoped>
 .Taskmanagement {
   display: flex;
   background-color: #fff;
+
   .content {
     width: 100%;
     display: flex;
     flex-direction: column;
+
     .serch {
       display: flex;
       margin-top: 1.31rem;
       align-items: center;
+
       .time_box {
         display: flex;
         align-items: center;
         text-align: center;
         margin-left: 0.98rem;
+
         .time {
           box-sizing: border-box;
           width: 6.88rem;
@@ -1225,12 +1324,14 @@
           justify-content: center;
         }
       }
+
       .serch_box {
         display: flex;
         align-items: center;
         text-align: center;
         margin-left: 0.98rem;
         border-radius: 0.38rem;
+
         .serchb {
           box-sizing: border-box;
           width: 6.88rem;
@@ -1242,6 +1343,7 @@
           align-items: center;
           justify-content: center;
         }
+
         input {
           box-sizing: border-box;
           outline: none;
@@ -1254,6 +1356,7 @@
         }
       }
     }
+
     .btns {
       display: flex;
       justify-content: space-between;
@@ -1270,6 +1373,7 @@
 .confirmButtonClass {
   margin-right: 10px;
 }
+
 .el-message-box .el-message-box__btns {
   flex-direction: row-reverse !important;
   justify-content: normal !important;

--
Gitblit v1.9.3