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/CraftCenter/Craftcenter.vue |  398 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 289 insertions(+), 109 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/CraftCenter/Craftcenter.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/CraftCenter/Craftcenter.vue"
index 9ba3afa..27e58a9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/CraftCenter/Craftcenter.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/CraftCenter/Craftcenter.vue"
@@ -225,7 +225,9 @@
           >
             {{ title }}
           </h4>
-          <el-icon size="25" @click="close"><CloseBold /></el-icon>
+          <el-icon size="25" @click="close">
+            <CloseBold />
+          </el-icon>
         </div>
       </template>
       <div>
@@ -255,7 +257,7 @@
                 size="small"
               />
             </div>
-            <!-- <div class="serch_box">
+            <div class="serch_box">
               <div class="serchb">
                 <el-select
                   v-model="queryForm.selectType"
@@ -276,7 +278,7 @@
                 placeholder="璇疯緭鍏ュ叧閿瘝鎼滅储"
                 style="border-left: 0.06rem solid #e2e2e2"
               />
-            </div> -->
+            </div>
             <el-button
               type="primary"
               size="small"
@@ -318,7 +320,7 @@
             border: '0.01rem solid #eee',
           }"
         >
-          <el-table-column prop="setpNum" label="搴忓彿" min-width="2%" />
+          <el-table-column prop="nodal" label="搴忓彿" min-width="2%" />
           <el-table-column
             prop="craftsStep"
             label="宸ヨ壓椤剁偣/姝ラ"
@@ -333,7 +335,7 @@
           <el-table-column prop="date" label="鐗╂枡" min-width="1%" />
           <!-- <el-table-column prop="date" label="鍥剧墖瑙嗛" min-width="2%" /> -->
           <el-table-column prop="" label="鏄惁娑夊強" min-width="2%" />
-          <el-table-column prop="nodal" label="鎺掑簭" min-width="1%" />
+          <el-table-column prop="setpNum" label="鎺掑簭" min-width="1%" />
           <el-table-column prop="date" label="鍒涘缓浜�" min-width="2%">
             <template #default="">
               {{ user }}
@@ -348,7 +350,9 @@
                 @click="Editcraft(scope.row, '缂栬緫')"
                 >缂栬緫</el-button
               >
-              <el-button type="text" size="small">鍒犻櫎</el-button>
+              <el-button type="text" size="small" @click="delProcess(scope.row)"
+                >鍒犻櫎</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -362,7 +366,7 @@
       title="宸ヨ壓淇℃伅"
       width="50%"
       :show-close="false"
-      @close="handleClose"
+      @close="resetForm(ruleFormRef)"
     >
       <template #header="{ titleId, titleClass }">
         <div class="my-craftheader">
@@ -456,10 +460,15 @@
           <el-col :span="8"
             ><el-form-item prop="tools">
               <template #label>
-                <span style="font-size: 0.88rem; color: black">宸ュ叿</span>
+                <div style="display: flex; align-items: center">
+                  <span style="display: flex; color: red; margin-right: 0.25rem"
+                    >*</span
+                  >
+                  <span style="font-size: 0.88rem; color: black">宸ュ叿</span>
+                </div>
               </template>
               <el-select
-                v-model="form.tools"
+                v-model="tools"
                 placeholder="璇烽�夋嫨"
                 multiple
                 filterable
@@ -548,9 +557,14 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-form-item prop="Unit">
+          <el-form-item prop="checkList">
             <template #label>
-              <span style="font-size: 0.88rem; color: black">閫夋嫨濂楃瓛</span>
+              <div style="display: flex; align-items: center">
+                <span style="display: flex; color: red; margin-right: 0.25rem"
+                  >*</span
+                >
+                <span style="font-size: 0.88rem; color: black">閫夋嫨濂楃瓛</span>
+              </div>
             </template>
             <div
               style="
@@ -568,8 +582,10 @@
                   "
                 >
                   <el-input
-                    placeholder="璇疯緭鍏ュ唴瀹�"
-                    style="height: 2rem"
+                    placeholder="鎼滅储"
+                    style="height: 2rem; background: #f5f5f5; border: none"
+                    :prefix-icon="Search"
+                    v-model="value"
                   ></el-input>
                   <div
                     style="height: 1.25rem; display: flex; align-items: center"
@@ -577,26 +593,35 @@
                     <span
                       style="color: rgba(28, 31, 35, 0.8); font-size: 0.75rem"
                       >鍏眥{ checkList.length }}椤�</span
-                    ><span
+                    >
+                    <!-- <span
+                      @click="handleCheckAllChange"
                       style="
                         color: rgba(28, 31, 35, 0.8);
                         font-size: 0.75rem;
                         margin-left: 0.38rem;
+                        cursor: pointer;
                       "
                       >鍏ㄩ��</span
-                    >
+                    > -->
                   </div>
                 </div>
                 <el-scrollbar height="20rem" style="padding-left: 0.88rem">
                   <el-checkbox-group
+                    :indeterminate="isIndeterminate"
+                    @change="checkChange"
                     v-model="checkList"
                     style="display: flex; flex-direction: column"
                   >
                     <el-checkbox
+                      :max="2"
                       v-for="item in sleeveData"
                       :key="item.id"
                       :label="item.articleName"
-                      :value="item"
+                      :value="{
+                        ...item,
+                        num: 1,
+                      }"
                     />
                   </el-checkbox-group>
                 </el-scrollbar>
@@ -609,10 +634,12 @@
                     >宸查�墈{ checkList.length }}椤�</span
                   >
                   <span
+                    @click="clear"
                     style="
                       color: rgb(65, 70, 76);
                       font-size: 0.88rem;
                       margin-left: 1rem;
+                      cursor: pointer;
                     "
                     >娓呯┖</span
                   >
@@ -627,8 +654,8 @@
                       justify-content: space-between;
                       margin: 0.5rem 0;
                     "
-                    v-for="(item, index) in checkList"
-                    :key="item"
+                    v-for="item in checkList"
+                    :key="item.id"
                     class="scrollbar-demo-item"
                   >
                     <span>
@@ -669,8 +696,8 @@
   </div>
 </template>
 <script setup>
-import { ref, reactive, onMounted } from "vue";
-import { formatTime } from "@/utils/index.js";
+import { ref, reactive, onMounted, toRef } from "vue";
+import { Search } from "@element-plus/icons-vue";
 import {
   GetSleeveandStep,
   GetProcess,
@@ -679,26 +706,49 @@
   ArticleInfom,
   GetTool,
   ExportApi,
+  DelProcess,
+  AddOrUpdateProcess,
 } from "@/api/newapi/Process";
 import { ElMessage } from "element-plus";
-import { exportExcel } from "@/utils/index.js";
-//宸ヨ壓鏄庣粏寮瑰嚭妗�
-const detailsDialogVisible = ref(false);
+import { formatTime } from "@/utils/index.js";
+
+// 鍒濆鍖栨暟鎹�
+const obj = {
+  selectName: "",
+  selectTime: [], // 鏃堕棿鑼冨洿
+  selectType: "", //閫夋嫨鐨勭被鍨�
+  selectInput: "", //杈撳叆鐨勬暟鎹�
+};
 //宸ヨ壓鏄庣粏鏁版嵁
 const gridData = ref([]);
+//濂楃瓛鏁版嵁
+const sleeveData = ref([]);
+//閫夋嫨鐨勫绛掓暟鎹�
+const checkList = ref([]);
 //鐢垫皵鏁伴噺
 const electric = ref(null);
 //鏈烘鏁伴噺
 const mechanical = ref(null);
 //鍦版矡
 const trench = ref(null);
+//鏂板宸ヨ壓/缂栬緫宸ヨ壓
+const type = ref("鏂板");
+//鑾峰彇鏁版嵁
+const title = ref("鐢垫皵");
+//琛ㄥ崟ref鍊�
+const ruleFormRef = ref();
+//鐢ㄦ埛鏁版嵁
+const user = ref(null);
+
+const tools = ref([]);
 //鎼滅储
-const queryForm = reactive({
-  selectName: "",
-  selectTime: [], // 鏃堕棿鑼冨洿
-  selectType: "",
-  selectInput: "",
-});
+const queryForm = toRef({ ...obj });
+const isIndeterminate = ref(true);
+//宸ヨ壓鏄庣粏寮瑰嚭妗�
+const detailsDialogVisible = ref(false);
+//鏂板宸ヨ壓寮瑰嚭妗�
+const craftdialogVisible = ref(false);
+//鎼滅储瀛楁閫夋嫨
 const selectoptions = ref([
   {
     value: "setpNum",
@@ -709,43 +759,51 @@
     label: "宸ュ叿",
   },
 ]);
-//閫夋嫨鐨勫绛掓暟鎹�
-const checkList = ref([]);
-//鑾峰彇鏁版嵁
-const title = ref("鐢垫皵");
-const showdetails = (val) => {
-  detailsDialogVisible.value = true;
-  title.value = val;
-  initData(title.value);
-  // GetProcess(val).then((res) => {
-  //   gridData.value = res.data;
-  // });
-};
-//鏂板宸ヨ壓/缂栬緫宸ヨ壓
-const craftdialogVisible = ref(false);
-const type = ref("鏂板");
+//鏄惁娑夊強
+const isoptions = reactive([
+  { label: "鏄�", value: "鏄�" },
+  { label: "鍚�", value: "鍚�" },
+]);
+
+//琛ㄥ崟瑙勫垯
+const rules = reactive({
+  craftstype: [
+    { required: true, message: "璇烽�夋嫨宸ヨ壓绫诲瀷", trigger: "change" },
+  ],
+  nodal: [{ required: true, message: "璇烽�夋嫨鑺傜偣", trigger: "change" }],
+  craftsStep: [{ required: true, message: "璇疯緭鍏ュ伐鑹烘楠�", trigger: "blur" }],
+  craftContent: [
+    { required: true, message: "璇疯緭鍏ュ伐鑹哄唴瀹�", trigger: "blur" },
+  ],
+  sleeveNum: [{ required: true, message: "璇疯緭鍏ュ绛掓暟閲�", trigger: "blur" }],
+});
+
+//鏂板宸ヨ壓/缂栬緫宸ヨ壓琛ㄥ崟鏁版嵁
 const form = ref({
-  craftType: "", //宸ヨ壓绫诲瀷锛堢粍锛�
-  nodal: "", //鑺傜偣
+  craftstype: "", //宸ヨ壓绫诲瀷锛堢粍锛�
+  nodal: 0, //鑺傜偣
   craftsStep: "", //宸ヨ壓姝ラ
   craftContent: "", //宸ヨ壓鍐呭
   sleeveNum: "", //濂楃瓛鏁伴噺
   tools: "", //宸ュ叿
   isinvolved: "", //鏄惁娑夊強
-  sort: "", //鎺掑簭
-  craftID: 1,
   setpNum: "",
-  torqueOne: null,
+  torqueOne: 0,
   torqueOneQuantity: 0,
-  torqueSum: 0,
-  torqueTwo: null,
-  torqueTwoQuantity: 0,
   articleOne: "",
+  articleOneid: "",
+  articleTowid: "",
   articleTwo: "",
+  torqueSum: 0,
+  torqueTwo: 0,
+  torqueTwoQuantity: 0,
+  creater: localStorage.getItem("user")
+    ? JSON.parse(localStorage.getItem("user")).userName
+    : "",
+  createDate: formatTime(new Date()),
 });
 const props = { multiple: true };
-//濂楃瓛鏁版嵁
-const sleeveData = ref([]);
+const userName = ref("");
 
 //鏂板宸ヨ壓
 const addcraft = (row) => {
@@ -793,45 +851,105 @@
     GJoptions.value = res.rows;
   });
 };
+
 //缂栬緫宸ヨ壓
 const Editcraft = (row) => {
+  let data = Object.assign({}, row);
   type.value = "缂栬緫";
   detailsDialogVisible.value = false;
   craftdialogVisible.value = true;
-  form.value = row;
-  console.log(row, form);
+  form.value = data;
+  tools.value = row.tools ? row.tools.split(",") : "";
+  ArticleInfom({
+    page: 1,
+    rows: 100,
+    total: 0,
+    tableName: "",
+    sort: "",
+    order: "",
+    wheres: "",
+    export: true,
+    value: "",
+    filter: [
+      {
+        name: "",
+        value: "",
+        displayType: "",
+      },
+    ],
+  }).then((res) => {
+    sleeveData.value = res.rows;
+  });
+  GetTool({
+    page: 1,
+    rows: 100,
+    total: 0,
+    tableName: "",
+    sort: "",
+    order: "",
+    wheres: "",
+    export: true,
+    value: "",
+    filter: [
+      {
+        name: "",
+        value: "",
+        displayType: "",
+      },
+    ],
+  }).then((res) => {
+    GJoptions.value = res.rows;
+  });
 };
-//瑙勫垯
-const ruleFormRef = ref();
-const rules = reactive({
-  craftType: [{ required: true, message: "璇烽�夋嫨宸ヨ壓绫诲瀷", trigger: "change" }],
-  nodal: [{ required: true, message: "璇烽�夋嫨鑺傜偣", trigger: "change" }],
-  craftsStep: [{ required: true, message: "璇疯緭鍏ュ伐鑹烘楠�", trigger: "blur" }],
-  craftContent: [
-    { required: true, message: "璇疯緭鍏ュ伐鑹哄唴瀹�", trigger: "blur" },
-  ],
-  sleeveNum: [{ required: true, message: "璇疯緭鍏ュ绛掓暟閲�", trigger: "blur" }],
-});
 
+const showdetails = (val) => {
+  detailsDialogVisible.value = true;
+  title.value = val;
+  initData(title.value);
+  // GetProcess(val).then((res) => {
+  //   gridData.value = res.data;
+  // });
+};
 //淇濆瓨
 const addprocess = async (formEl) => {
+  userName.value = JSON.parse(localStorage.getItem("user")).userName;
   let string = "";
-  form.value.tools.forEach((item) => {
-    string += item.toolName + ",";
-  });
-
+  if (tools.value.length == 0) {
+    ElMessage({
+      message: "璇烽�夋嫨宸ュ叿",
+      type: "warning",
+    });
+    return;
+  }
+  string = tools.value
+    .map((item) => {
+      return item.toolName;
+    })
+    .join(",");
+  if (checkList.value.length == 0) {
+    ElMessage({
+      message: "璇烽�夋嫨濂楃瓛",
+      type: "warning",
+    });
+    return;
+  }
+  form.value.articleOneid = checkList.value[0].id;
   form.value.articleOne = checkList.value[0].num;
+  form.value.articleTowid = checkList.value[1].id;
   form.value.articleTwo = checkList.value[1].num;
+  form.value.creater = userName.value;
   form.value.tools = string;
-  form.value.craftType = title.value;
+  form.value.craftstype = title.value;
+  form.value.torqueOneQuantity = tools.value.length;
+  form.value.id = form.value.craftID ? form.value.craftID : "";
   console.log(form.value);
 
   if (!formEl) return;
   await formEl.validate((valid, fields) => {
     if (valid) {
-      AddProcess(form.value).then((res) => {
+      AddOrUpdateProcess(form.value).then((res) => {
         ElMessage({
-          message: res.message,
+          message: form.value.craftID ? "淇敼鎴愬姛" : "鍒涘缓鎴愬姛",
           type: "success",
         });
         craftdialogVisible.value = false;
@@ -875,39 +993,34 @@
     GJoptions.value = [];
   }
 };
-//鏄惁娑夊強
-const isoptions = reactive([
-  { label: "鏄�", value: "鏄�" },
-  { label: "鍚�", value: "鍚�" },
-]);
-const user = ref(null);
+
 //鍒嗛〉璇锋眰鍙傛暟
 const pageQuery = ref({
   page: 1, //褰撳墠椤甸潰
   rows: 10, //姣忛〉鏄剧ず鏉℃暟
   order: "desc", //鎺掑簭鏂瑰紡
-  sort: "craftID", //鎺掑簭瀛楁
+  sort: "", //鎺掑簭瀛楁
   wheres: "", //鏉′欢鏌ヨ
 });
-
+//椤甸潰鍒濆鍖栨暟鎹�
 const initData = (val) => {
   // 鏌ヨ鏉′欢
-  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: "gruop",
+      name: "CraftType",
       value: val,
-      displayType: "Contains",
+      displayType: "String",
     },
     {
-      name: queryForm.selectType,
-      value: queryForm.selectInput,
-      displayType: "Equal",
+      name: queryForm.value.selectType,
+      value: queryForm.value.selectInput,
+      displayType: "like",
     },
     {
       name: "pustatus",
-      value: queryForm.selectName,
+      value: queryForm.value.selectName,
       displayType: "Contains",
     },
     { name: "createTime", value: startTime, displayType: "ThanOrEqual" },
@@ -920,10 +1033,51 @@
     gridData.value = res.rows;
   });
 };
+//鏁版嵁妫�绱簨浠�
+const handleQuery = () => {
+  pageQuery.value.page = 1;
+  initData(title.value);
+};
+// 閲嶇疆鏂规硶
+const resetQuery = () => {
+  queryForm.value = Object.assign({}, obj);
+  pageQuery.value.page = 1;
+  initData(title.value);
+};
+//閲嶇疆琛ㄥ崟
+const resetForm = (formEl) => {
+  if (!formEl) return;
+  formEl.resetFields();
+  form.value = Object.assign(
+    {},
+    {
+      craftstype: "", //宸ヨ壓绫诲瀷锛堢粍锛�
+      nodal: 0, //鑺傜偣
+      craftsStep: "", //宸ヨ壓姝ラ
+      craftContent: "", //宸ヨ壓鍐呭
+      sleeveNum: "", //濂楃瓛鏁伴噺
+      tools: "", //宸ュ叿
+      isinvolved: "", //鏄惁娑夊強
+      setpNum: "",
+      torqueOne: 0,
+      torqueOneQuantity: 0,
+      articleOne: "",
+      articleOneid: "",
+      articleTowid: "",
+      articleTwo: "",
+      torqueSum: 0,
+      torqueTwo: 0,
+      torqueTwoQuantity: 0,
+      creater: "",
+      createDate: formatTime(new Date()),
+    }
+  );
+};
+//瀵煎嚭鏂规硶
 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: "gruop",
@@ -931,13 +1085,13 @@
       displayType: "String",
     },
     {
-      name: queryForm.selectType,
-      value: queryForm.selectInput,
+      name: queryForm.value.selectType,
+      value: queryForm.value.selectInput,
       displayType: "String",
     },
     {
       name: "pustatus",
-      value: queryForm.selectName,
+      value: queryForm.value.selectName,
       displayType: "String",
     },
     { name: "createTime", value: startTime, displayType: "ThanOrEqual" },
@@ -948,23 +1102,33 @@
     filter,
   });
 };
-
-//鏁版嵁妫�绱簨浠�
-const handleQuery = () => {
-  pageQuery.value.page = 1;
-  initData(title.value);
+//娓呯┖
+const clear = () => {
+  checkList.value = [];
 };
-const resetQuery = () => {
-  queryForm.value = { selectTime: [] };
-  pageQuery.value.page = 1;
-  initData(title.value);
+const checkChange = (e) => {
+  console.log(e, checkList.value);
 };
-
-// const handleChange = () => {
-//   console.log(checkList.value);
-// };
-const handleClose = () => {
+const handleChange = () => {
   console.log(checkList.value);
+};
+const handleCheckAllChange = (val) => {
+  console.log(val);
+  checkList.value = val ? sleeveData.value : [];
+  isIndeterminate.value = false;
+  console.log(checkList.value);
+};
+// 鍒犻櫎宸ヨ壓
+const delProcess = (val) => {
+  console.log(val);
+
+  DelProcess([val.craftID]).then((res) => {
+    ElMessage({
+      message: "鍒犻櫎鎴愬姛",
+      type: "success",
+    });
+    initData(title.value);
+  });
 };
 
 onMounted(() => {
@@ -985,12 +1149,14 @@
   display: flex;
   justify-content: center;
   background-color: rgba(0, 0, 0, 0.3);
+
   .content {
     display: flex;
     justify-content: space-between;
 
     margin-top: 5.88rem;
     width: 75rem;
+
     .content-list {
       display: flex;
       flex-direction: column;
@@ -998,14 +1164,17 @@
       width: 22.69rem;
       height: 11.44rem;
       background-color: #fff;
+
       .list_top {
         display: flex;
         padding: 1.38rem 1.38rem;
         box-sizing: border-box;
+
         .list_top_left {
           margin-right: 0.94rem;
         }
       }
+
       .list_bottom {
         height: 3.06rem;
         display: flex;
@@ -1017,6 +1186,7 @@
       }
     }
   }
+
   .my-header {
     height: 3.94rem;
     display: flex;
@@ -1026,9 +1196,11 @@
     padding-left: 2.06rem;
     border-bottom: 0.06rem solid rgba(233, 233, 233, 1);
   }
+
   .serch {
     display: flex;
     align-items: center;
+
     .time_box {
       display: flex;
       align-items: center;
@@ -1047,12 +1219,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;
@@ -1064,6 +1238,7 @@
         align-items: center;
         justify-content: center;
       }
+
       input {
         box-sizing: border-box;
         outline: none;
@@ -1076,6 +1251,7 @@
       }
     }
   }
+
   .my-craftheader {
     height: 3.94rem;
     display: flex;
@@ -1085,11 +1261,13 @@
     border-bottom: 0.06rem solid rgba(233, 233, 233, 1);
   }
 }
+
 .avatar-uploader .avatar {
   width: 7rem;
   height: 7rem;
   display: block;
 }
+
 :deep(.avatar-uploader .el-upload) {
   width: 7rem;
   height: 7rem;
@@ -1100,10 +1278,12 @@
   overflow: hidden;
   transition: var(--el-transition-duration-fast);
 }
+
 :deep(.el-upload-list__item) {
   width: 7rem;
   height: 7rem;
 }
+
 .avatar-uploader .el-upload:hover {
   border-color: var(--el-color-primary);
 }

--
Gitblit v1.9.3