From 840e04c3878e27d0bc9784bb79e3559a8cbfbf32 Mon Sep 17 00:00:00 2001
From: chengxiangling <291105840@qq.com>
Date: 星期二, 13 五月 2025 15:41:00 +0800
Subject: [PATCH] 提交钣金计划工单修改

---
 src/views/basicData/calendar/index.vue |  270 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 186 insertions(+), 84 deletions(-)

diff --git a/src/views/basicData/calendar/index.vue b/src/views/basicData/calendar/index.vue
index 6b2d26d..8868a93 100644
--- a/src/views/basicData/calendar/index.vue
+++ b/src/views/basicData/calendar/index.vue
@@ -20,7 +20,24 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="18" style="text-align: right">
+        <el-col :span="6">
+          <el-form-item label="閫傜敤宸ュ巶" prop="plant">
+            <el-select
+              style="width: 140px"
+              clearable
+              v-model="queryParams.plant"
+              placeholder="閫傜敤宸ュ巶"
+            >
+              <el-option
+                v-for="item in aps_factory"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12" style="text-align: right">
           <el-form-item class="column-with-margin">
             <el-button type="primary" icon="Search" @click="handleQuery"
               >鏌ヨ</el-button
@@ -139,7 +156,7 @@
     </HxlhTable>
 
     <!-- 娣诲姞鎴栦慨鏀规棩鍘嗙鐞嗗璇濇 -->
-    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
+    <el-dialog :title="title" v-model="open" width="80%" append-to-body>
       <el-form
         ref="calendarRef"
         :model="form"
@@ -150,10 +167,11 @@
           <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" />
         </el-form-item>
         <el-form-item label="鏃ュ巻绫诲瀷" prop="type">
-          <el-radio-group v-model="form.type" @change="handleSwitchType">
+          <!-- <el-radio-group v-model="form.type" @change="handleSwitchType">
             <el-radio :label="'1'">鍛ㄥ伐浣�</el-radio>
             <el-radio :label="'2'">鑺傚亣鏃�</el-radio>
-          </el-radio-group>
+          </el-radio-group> -->
+          <el-tag type="primary">鍛ㄥ伐浣�</el-tag>
         </el-form-item>
         <el-form-item label="鐢熸晥鏃堕棿" prop="effectiveDate">
           <el-date-picker
@@ -228,37 +246,44 @@
             </div>
           </div>
         </div>
-        <el-form-item
+        <!-- <el-form-item
           label="閫傜敤宸ュ巶"
           prop="applicableFactory"
           class="factory_use_item"
+        > -->
+        <div class="select_factory">閫傜敤宸ュ巶/杞﹂棿/宸ュ簭</div>
+        <!-- <el-row :gutter="20" class="select_factory"> -->
+        <div
+          class="select_factory"
+          v-for="(item, index) in applicableSettingList"
+          :key="index"
         >
+          <!-- <el-col :span="7"> -->
           <el-select
+            class="select_content"
             clearable
-            v-model="form.applicableFactory"
+            v-model="item.factory"
             style="width: 160px"
             placeholder="璇疯緭鍏ラ�傜敤宸ュ巶"
             @change="changePlant($event)"
           >
             <el-option
-              v-for="plant in plantList"
-              :key="plant.id"
-              :label="plant.plantName"
-              :value="plant.plantCode"
+              v-for="plant in aps_factory"
+              :key="plant.value"
+              :label="plant.label"
+              :value="plant.value"
             >
             </el-option>
           </el-select>
-        </el-form-item>
-        <el-form-item
-          label="閫傜敤杞﹂棿"
-          prop="applicableWorkshop"
-          class="factory_use_item"
-        >
+          <!-- </el-col>
+              <el-col :span="7"> -->
           <el-select
+            class="select_content"
             clearable
-            v-model="form.applicableWorkshop"
+            v-model="item.workshop"
             style="width: 160px"
             placeholder="璇疯緭鍏ラ�傜敤杞﹂棿"
+            @change="changeWorkshop($event)"
           >
             <el-option
               v-for="shop in shopList"
@@ -268,15 +293,12 @@
             >
             </el-option>
           </el-select>
-        </el-form-item>
-        <el-form-item
-          label="閫傜敤宸ュ簭"
-          prop="applicableProcess"
-          class="factory_use_item"
-        >
+          <!-- </el-col>
+              <el-col :span="7"> -->
           <el-select
+            class="select_content"
             clearable
-            v-model="form.applicableProcess"
+            v-model="item.process"
             style="width: 160px"
             placeholder="璇疯緭鍏ラ�傜敤宸ュ簭"
           >
@@ -288,7 +310,32 @@
             >
             </el-option>
           </el-select>
+          <!-- </el-col>
+              <el-col :span="3"> -->
+          <el-button
+            class="select_content"
+            type="primary"
+            :icon="Plus"
+            @click="handleAddFactory(item)"
+            circle
+            size="small"
+          />
+          <!-- </el-col> -->
+        </div>
+        <!-- </el-row> -->
+        <!-- </el-form-item> -->
+        <!-- <el-form-item
+          label="閫傜敤杞﹂棿"
+          prop="applicableWorkshop"
+          class="factory_use_item"
+        >
         </el-form-item>
+        <el-form-item
+          label="閫傜敤宸ュ簭"
+          prop="applicableProcess"
+          class="factory_use_item"
+        >
+        </el-form-item> -->
       </el-form>
       <template #footer>
         <div class="dialog-footer">
@@ -301,6 +348,7 @@
 </template>
 
 <script setup name="Calendar">
+import { Plus } from "@element-plus/icons-vue";
 import HxlhTable from "@/components/HxlhTable";
 import {
   listCalendar,
@@ -310,10 +358,11 @@
   updateCalendar,
 } from "@/api/basicData/calendar";
 import axios from "axios";
-import { listAll_plant } from "@/api/basicData/plant";
+import { listAll_plant, listByWorkShop } from "@/api/basicData/plant";
 import { listAll_shop, listAps_shop } from "@/api/basicData/shop";
 import { selectProcessNameList } from "@/api/basicData/processRoute.js";
 const { proxy } = getCurrentInstance();
+const { aps_factory } = proxy.useDict("aps_factory");
 const tableRef = ref();
 const calendarList = ref([]);
 const open = ref(false);
@@ -327,11 +376,19 @@
 const data = reactive({
   form: {
     type: "1",
+    applicable: [
+      {
+        factory: "",
+        workshop: "",
+        process: "",
+      },
+    ],
   },
   queryParams: {
     pageNum: 1,
     pageSize: 10,
     description: null,
+    plant: null,
     type: null,
     effectiveDate: null,
     expiringDate: null,
@@ -348,13 +405,13 @@
         trigger: "blur",
       },
     ],
-    type: [
-      {
-        required: true,
-        message: "璇烽�夋嫨鏃ュ巻绫诲瀷",
-        trigger: "blur",
-      },
-    ],
+    // type: [
+    //   {
+    //     required: true,
+    //     message: "璇烽�夋嫨鏃ュ巻绫诲瀷",
+    //     trigger: "blur",
+    //   },
+    // ],
     effectiveDate: [
       {
         required: true,
@@ -391,6 +448,9 @@
   },
 ]);
 const typeRadioNumber = ref(1);
+const applicableSettingList = ref([
+  { factory: "", workshop: "", process: "" },
+]);
 const weekDaysSettingList = ref([
   {
     day: "Monday",
@@ -585,6 +645,13 @@
     createTime: null,
     updateBy: null,
     updateTime: null,
+    applicable: [
+      {
+        factory: "",
+        workshop: "",
+        process: "",
+      },
+    ],
   };
   proxy.resetForm("calendarRef");
 }
@@ -612,16 +679,35 @@
 async function handleAdd() {
   reset();
   open.value = true;
+  form.value = {
+    applicable: [
+      {
+        factory: "",
+        workshop: "",
+        process: "",
+      },
+    ],
+  };
   title.value = "娣诲姞鏃ュ巻绠$悊";
 }
 /** 閫夋嫨宸ュ巶鍚庝簨浠� 鍔犺浇杞﹂棿 鍜� 宸ュ簭 **/
 function changePlant(plant) {
+  console.log(plant);
   listAps_shop({ plantCode: plant }).then((response) => {
     shopList.value = response.rows;
   });
-  selectProcessNameList({ orgCode: plant }).then((response) => {
-    processList.value = response.rows;
+  // selectProcessNameList({ orgCode: plant }).then((response) => {
+  //   processList.value = response.rows;
+  // });
+}
+function changeWorkshop(workShop) {
+  listByWorkShop({ workShop: "姘旀煖" }).then((res) => {
+    console.log(res, "workShop");
+    processList.value = res.rows;
   });
+}
+function handleAddFactory(row) {
+  applicableSettingList.value.push(row);
 }
 /** 淇敼鎸夐挳鎿嶄綔 */
 function handleUpdate(row) {
@@ -648,57 +734,60 @@
   proxy.$refs["calendarRef"].validate((valid) => {
     if (valid) {
       if (form.value.id != null) {
-        if (form.value.type === "1") {
-          updateCalendar({
-            ...form.value,
-            content: {
-              weekdays: weekDaysSettingList.value,
-            },
-            applicableWorkshop: form.value.applicableWorkshop,
-            applicableProcess: form.value.applicableProcess,
-          }).then((response) => {
-            proxy.$modal.msgSuccess("淇敼鎴愬姛");
-            open.value = false;
-            getList();
-          });
-        } else if (form.value.type === "2") {
-          updateCalendar({
-            ...form.value,
-            content: {
-              holidays: holidays.value,
-            },
-            applicableWorkshop: form.value.applicableWorkshop,
-            applicableProcess: form.value.applicableProcess,
-          }).then((response) => {
-            proxy.$modal.msgSuccess("淇敼鎴愬姛");
-            open.value = false;
-            getList();
-          });
-        }
+        // if (form.value.type === "1") {
+        //   updateCalendar({
+        //     ...form.value,
+        //     content: {
+        //       weekdays: weekDaysSettingList.value,
+        //     },
+        //     applicableWorkshop: form.value.applicableWorkshop,
+        //     applicableProcess: form.value.applicableProcess,
+        //   }).then((response) => {
+        //     proxy.$modal.msgSuccess("淇敼鎴愬姛");
+        //     open.value = false;
+        //     getList();
+        //   });
+        // } else if (form.value.type === "2") {
+        updateCalendar({
+          ...form.value,
+          content: {
+            holidays: holidays.value,
+          },
+          applicableWorkshop: form.value.applicableWorkshop,
+          applicableProcess: form.value.applicableProcess,
+        }).then((response) => {
+          proxy.$modal.msgSuccess("淇敼鎴愬姛");
+          open.value = false;
+          getList();
+        });
+        // }
       } else {
-        if (form.value.type === "1") {
-          addCalendar({
-            ...form.value,
-            content: {
-              weekdays: weekDaysSettingList.value,
-            },
-          }).then((response) => {
-            proxy.$modal.msgSuccess("鏂板鎴愬姛");
-            open.value = false;
-            getList();
-          });
-        } else if (form.value.type === "2") {
-          addCalendar({
-            ...form.value,
-            content: {
-              holidays: holidays.value,
-            },
-          }).then((response) => {
-            proxy.$modal.msgSuccess("鏂板鎴愬姛");
-            open.value = false;
-            getList();
-          });
-        }
+        // if (form.value.type === "1") {
+        //   addCalendar({
+        //     ...form.value,
+        //     content: {
+        //       weekdays: weekDaysSettingList.value,
+        //     },
+        //   }).then((response) => {
+        //     proxy.$modal.msgSuccess("鏂板鎴愬姛");
+        //     open.value = false;
+        //     getList();
+        //   });
+        // } else if (form.value.type === "2") {
+        addCalendar({
+          ...form.value,
+          content: {
+            weekdays: weekDaysSettingList.value,
+          },
+          holidays: holidays.value,
+          applicable: applicableSettingList.value,
+          //},
+        }).then((response) => {
+          proxy.$modal.msgSuccess("鏂板鎴愬姛");
+          open.value = false;
+          getList();
+        });
+        // }
       }
     }
   });
@@ -806,6 +895,19 @@
 .factory_use_item {
   margin-top: 10px;
 }
+.select_factory {
+  margin-left: 34px;
+  font-weight: 800;
+  font-size: 14px;
+  color: #606266;
+}
+.select_content {
+  margin-right: 10px;
+  margin-top: 20px;
+  // &:nth-child(1) {
+  //   margin-left:34px;
+  // }
+}
 .mart5 {
   margin-top: 5px;
 }

--
Gitblit v1.9.3