Browse Source

分支排序添加

dengrui 3 tháng trước cách đây
mục cha
commit
f24e5d0e6f

+ 15 - 0
src/api/process/index.ts

@@ -125,3 +125,18 @@ export function syncMedias(params: object) {
     data: params,
   });
 }
+
+export function getLineSortList(ID: any) {
+  return request({
+    url: `/api/v1/op/routeOperation/lineSortList/${ID}`,
+    method: "get",
+  });
+}
+
+export function setLineSortList(params: any) {
+  return request({
+    url: `/api/v1/op/routeOperation/lineTagSortSetting`,
+    method: "post",
+    data: params,
+  });
+}

+ 16 - 5
src/views/base/craftManagement/route/bindProcess.vue

@@ -132,7 +132,9 @@
       <div class="detailInfo">
         <el-scrollbar>
           <div class="opBox">
-            <el-text class="mx-1" type="warning">切换之前记得先保存</el-text>
+            <el-text class="mx-1" type="warning"
+              >切换和排序之前记得先保存</el-text
+            >
             <el-button type="primary" @click="changeEditStatus">{{
               !editStatus ? "切换为工序信息编辑模式" : "切换为工序路线编辑模式"
             }}</el-button>
@@ -141,7 +143,13 @@
             <!-- <el-button type="success" @click="changeStyle">
               按钮风格切换
             </el-button> -->
-            <el-button type="success" @click="startGroup"> 进行分组 </el-button>
+            <div style="display: flex">
+              <el-button type="success" @click="startGroup">
+                进行分组
+              </el-button>
+
+              <el-button @click="toSort"> 分支排序 </el-button>
+            </div>
           </div>
 
           <!-- 工艺路线编辑模式 -->
@@ -234,6 +242,7 @@
       </div>
     </div>
     <GroupProcess ref="GroupProcessRef" @success="groupFinish"></GroupProcess>
+    <GroupSort ref="GroupSortRef" />
   </div>
 </template>
 
@@ -267,13 +276,17 @@ import { useScreenshot } from "./screenshot.ts";
 import { useLayout } from "@/hooks/useLayout";
 import { useSnakeLayoutHook } from "@/hooks/vueflowHooks";
 import GroupProcess from "./components/groupProcess.vue";
+import GroupSort from "./components/groupSort.vue";
 
 defineOptions({
   name: "bindProcess/:id/:prodtCode",
 });
 
 const styleStatus = ref(false);
-
+const GroupSortRef = ref(null);
+const toSort = () => {
+  GroupSortRef.value.drawer = true;
+};
 const changeStyle = () => {
   styleStatus.value = !styleStatus.value;
 };
@@ -354,7 +367,6 @@ const edgeClick = (event) => {
 // 工序分组功能模块
 const GroupProcessRef = ref(null);
 const startGroup = () => {
-  console.log("startGroup", flowData.nodes);
   GroupProcessRef.value &&
     GroupProcessRef.value.startGroup(
       flowData.nodes,
@@ -362,7 +374,6 @@ const startGroup = () => {
     );
 };
 const groupFinish = () => {
-  console.log("groupFinish");
   loadProcessesFlow();
 };
 

+ 2 - 1
src/views/base/craftManagement/route/components/CustomNode/index.vue

@@ -42,6 +42,7 @@ watch(
   },
   { deep: true }
 );
+console.log(props.data);
 </script>
 
 <template>
@@ -62,7 +63,7 @@ watch(
         margin: 10px;
       "
     >
-      {{ data.label }}
+      {{ data.lineTag ? data.label + "(" + data.lineTag + ")" : data.label }}
     </div>
 
     <Handle

+ 81 - 0
src/views/base/craftManagement/route/components/groupSort.vue

@@ -0,0 +1,81 @@
+<script setup>
+import { getLineSortList, setLineSortList } from "@/api/process";
+const route = useRoute();
+const editState = ref(false);
+const drawer = ref(false);
+const lineArray = ref([]);
+const getLineArray = async () => {
+  const { data } = await getLineSortList(route.params.id);
+  //设置form
+  form.value = data;
+};
+const reset = () => {
+  drawer.value = false;
+  editState.value = false;
+};
+const confirmClick = async () => {
+  await setLineSortList([...form.value]);
+  ElMessage.success("操作成功!");
+  reset();
+};
+// 新增分组相关
+const input3 = ref("");
+const formRef = ref(null);
+const form = ref([]);
+const rules = {
+  productManager: [
+    { required: true, message: "产品管理员不能为空", trigger: "blur" },
+  ],
+};
+defineExpose({
+  drawer,
+});
+watch(
+  () => drawer.value,
+  (val) => {
+    if (val == true) {
+      getLineArray();
+    }
+  }
+);
+</script>
+
+<template>
+  <el-drawer v-model="drawer">
+    <template #header>
+      <h4>分支排序</h4>
+      <el-button @click="editState = !editState">{{
+        editState ? "取消编辑" : "编辑"
+      }}</el-button>
+    </template>
+    <template #default>
+      <el-form ref="formRef" :model="form" label-width="auto" :rules="rules">
+        <template v-for="(item, index) in form" :key="index">
+          <el-form-item :label="index + 1 + '.分支标识:' + item.lineTag">
+          </el-form-item>
+          <el-form-item :label="'排序值:'">
+            <div class="formLine">
+              <template v-if="editState">
+                <el-input v-model="form[index].lineTageSort" />
+              </template>
+              <template v-else> {{ item.lineTageSort }} </template>
+            </div>
+          </el-form-item>
+        </template>
+      </el-form>
+    </template>
+    <template #footer>
+      <div style="flex: auto">
+        <el-button @click="drawer = false">关闭</el-button>
+        <el-button type="primary" @click="confirmClick">保存</el-button>
+      </div>
+    </template>
+  </el-drawer>
+</template>
+
+<style scoped lang="scss">
+.formLine {
+  display: flex;
+  align-items: center;
+}
+</style>