فهرست منبع

Merge branch 'qingban' of http://139.155.176.112:8091/project-all/mes-admin-temp into qingban

lupeng 4 ماه پیش
والد
کامیت
be410b6247

+ 2 - 2
src/views/base/craftManagement/process/index.vue

@@ -316,7 +316,7 @@ option.value = Object.assign(option.value, {
         },
       ],
     },
-    {
+    /*{
       label: "后置时间(分)",
       prop: "forceTime",
       type: "number",
@@ -328,7 +328,7 @@ option.value = Object.assign(option.value, {
           trigger: "blur",
         },
       ],
-    },
+    },*/
     /*{
       label: "标准机时",
       prop: "timeingNum",

+ 2 - 2
src/views/base/craftManagement/route/bindConfig.ts

@@ -128,7 +128,7 @@ export const formOption = {
       //   },
       // ],
     },*/
-    {
+    /*{
       label: "后置时间",
       prop: "forceTime",
       span: 24,
@@ -142,7 +142,7 @@ export const formOption = {
         },
       ],
       // slot:true, // 自定义列
-    },
+    },*/
     /*{
       label: "是否外协",
       prop: "outsourcing",

+ 69 - 90
src/views/base/craftManagement/route/bindProcess.vue

@@ -65,14 +65,15 @@
             v-model:nodes="nodes"
             v-model:edges="edges"
             :apply-default="!editStatus && usableStatus"
+            @connect="onConnectMethod"
             @dragover="onDragOver"
             @dragleave="onDragLeave"
             @node-click="nodeClick($event)"
             @edge-click="edgeClick($event)"
             @nodes-change="(data) => nodesChange(data)"
             @edges-change="(data) => edgesChange(data)"
-            @node-drag-start="nodeDragStart"
             @node-drag-stop="nodeDragStop"
+            @node-drag-start="nodeDragStart"
           >
             <MiniMap style="background-color: grey" />
             <template #edge-custom="props">
@@ -122,70 +123,36 @@
       <div class="detailInfo">
         <el-scrollbar>
           <div class="opBox">
-            <!-- <el-button type="success" @click="changeStyle">
-              按钮风格切换
-            </el-button> -->
             <el-button type="primary" @click="changeEditStatus">{{
               !editStatus ? "切换为工序信息编辑模式" : "切换为工序路线编辑模式"
             }}</el-button>
 
             <el-button @click="getPng">导出流程图 </el-button>
+            <el-button type="success" @click="changeStyle">
+              按钮风格切换
+            </el-button>
           </div>
 
           <!-- 工艺路线编辑模式 -->
           <div v-if="!editStatus && usableStatus">
-            <div class="btns">
+            <div :class="styleStatus ? 'btnsChange' : 'btns'">
               <div>
-                <el-button
-                  type="primary"
-                  @click="saveFlow"
-                  :class="styleStatus == true ? 'showStyle' : ''"
-                >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >保</span
-                  >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''">
-                    &nbsp;
-                  </span>
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >存</span
-                  >
-                </el-button>
-              </div>
-              <div>
-                <el-button
-                  type="danger"
-                  v-if="false"
-                  :class="styleStatus == true ? 'showStyle' : ''"
-                  @click="cancer"
-                >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >回</span
-                  >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''">
-                    &nbsp;
-                  </span>
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >退</span
-                  >
+                <el-button type="primary" @click="saveFlow">
+                  <span>保</span>
+                  <span> &nbsp; </span>
+                  <span>存</span>
                 </el-button>
               </div>
+
               <div>
                 <el-button
                   type="info"
                   v-if="selectNode || selectLine"
-                  :class="styleStatus == true ? 'showStyle' : ''"
                   @click="deleteFlow"
                 >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >删</span
-                  >
-                  <span :class="styleStatus == true ? 'fontStyle' : ''">
-                    &nbsp;
-                  </span>
-                  <span :class="styleStatus == true ? 'fontStyle' : ''"
-                    >除</span
-                  ></el-button
+                  <span>删</span>
+                  <span> &nbsp; </span>
+                  <span>除</span></el-button
                 >
               </div>
             </div>
@@ -283,48 +250,53 @@ import { formOption } from "./bindConfig";
 import { ElMessage } from "element-plus";
 import { useScreenshot } from "./screenshot.ts";
 import { useLayout } from "@/hooks/useLayout";
-import { initialEdges, initialNodes } from "./initial-elements";
 import { useSnakeLayoutHook } from "@/hooks/vueflowHooks";
 defineOptions({
   name: "bindProcess/:id/:prodtCode",
 });
 const styleStatus = ref(false);
+
 const changeStyle = () => {
   styleStatus.value = !styleStatus.value;
 };
-const addHistory = () => {
-  historyList.value.push(JSON.parse(JSON.stringify(flowData)));
+const addHistory = (type) => {
+  historyList.value.unshift(JSON.parse(JSON.stringify(flowData)));
 };
 const resetHistory = () => {
   historyList.value = [];
-  historyList.value.push(JSON.parse(JSON.stringify(flowData)));
 };
 const nodesChange = (data) => {
-  if (data.length > 0) {
-    if (data[0].type == "add" || data.type == "remove") {
-      addHistory();
-    }
+  if (
+    data.length > 0 &&
+    data[0].type &&
+    (data[0].type === "add" || data[0].type === "remove")
+  ) {
+    addHistory();
   }
 };
 const edgesChange = (data) => {
-  if (data.length > 0) {
-    if (data[0].type == "add" || data[0].type == "remove") {
-      addHistory();
-    }
+  if (
+    data.length > 0 &&
+    data[0].type &&
+    (data[0].type === "add" || data[0].type === "remove")
+  ) {
+    addHistory();
   }
 };
-const nodeDragStart = () => {};
+
+let dragStartFlowData = null;
+const nodeDragStart = () => {
+  dragStartFlowData = JSON.parse(JSON.stringify(flowData));
+};
 const nodeDragStop = () => {
-  setTimeout(() => {
-    addHistory();
-  }, 0);
+  historyList.value.unshift(JSON.parse(JSON.stringify(dragStartFlowData)));
 };
 
 const goBack = () => {
-  if (historyList.value.length > 1) {
-    flowData.nodes = historyList.value[historyList.value.length - 2].nodes;
-    flowData.edges = historyList.value[historyList.value.length - 2].edges;
-    historyList.value.pop();
+  let firstHistory = historyList.value.shift();
+  if (firstHistory) {
+    flowData.nodes = firstHistory.nodes;
+    flowData.edges = firstHistory.edges;
   } else {
     ElMessage.warning("已是初始线路");
   }
@@ -333,16 +305,16 @@ const historyList = ref([]);
 const { capture } = useScreenshot();
 const { layout } = useLayout();
 const instance = useVueFlow();
-const {
-  onConnect,
-  addEdges,
-  vueFlowRef,
-  onEdgeUpdateEnd,
-  applyEdgeChanges,
-  fitView,
-} = instance;
+const { addEdges, vueFlowRef, onEdgeUpdateEnd, applyEdgeChanges, fitView } =
+  instance;
 const { onDragOver, onDrop, onDragLeave, isDragOver, onDragStart } =
   useDragAndDrop();
+// onConnect(addEdges);
+const onConnectMethod = (edge) => {
+  edge.type = "custom";
+  addEdges(edge);
+};
+
 const flowData = reactive({ edges: [], nodes: [] });
 const flowDataCopy = ref({ edges: [], nodes: [] });
 const currentProcess = ref({});
@@ -414,7 +386,7 @@ const handleKeydown = () => {
     selectLine.value = null;
   }
 };
-onConnect(addEdges);
+
 const getPng = () => {
   if (!vueFlowRef.value) {
     console.warn("VueFlow element not found");
@@ -516,6 +488,7 @@ const cancelFlow = () => {
   resetHistory();
 };
 const deleteFlow = () => {
+  addHistory();
   if (selectNode.value != null) {
     flowData.nodes.forEach((item, index) => {
       if (item.id == selectNode.value.id) {
@@ -533,7 +506,6 @@ const deleteFlow = () => {
   selectNode.value = null;
   selectLine.value = null;
   ElMessage.success("删除成功");
-  addHistory();
 };
 
 const saveInfo = async () => {
@@ -608,9 +580,8 @@ const loadProcessesFlow = async () => {
       if (res.data.usable == 1) {
         usableStatus.value = false;
       }
-      setTimeout(() => {
-        resetHistory();
-      }, 0);
+
+      resetHistory();
     } else {
       cancelStatus.value = false;
     }
@@ -650,14 +621,14 @@ const getNameByDictType = (dictValue) => {
   return str;
 };
 
-watch(
-  () => flowData.edges,
-  () => {
-    flowData.edges.forEach((item) => {
-      item.type = "custom";
-    });
-  }
-);
+// watch(
+//   () => flowData.edges,
+//   () => {
+//     flowData.edges.forEach((item) => {
+//       item.type = "custom";
+//     });
+//   }
+// );
 
 watch(
   () => list1SearchGroupDictKey.value,
@@ -669,16 +640,16 @@ watch(
 const { nodes } = toRefs(flowData); //ref(initialNodes);
 const { edges } = toRefs(flowData); //ref(initialEdges);
 async function layoutGraph(direction) {
+  addHistory();
   nodes.value = layout(nodes.value, edges.value, direction);
   nextTick(() => {
     fitView();
-    addHistory();
   });
 }
 // 转换为蛇形布局
 const convertToSnakeLayout = () => {
-  nodes.value = useSnakeLayoutHook(nodes.value, edges.value);
   addHistory();
+  nodes.value = useSnakeLayoutHook(nodes.value, edges.value);
 };
 </script>
 
@@ -704,6 +675,14 @@ const convertToSnakeLayout = () => {
     width: 80px;
   }
 }
+.btnsChange {
+  margin: 10px 0;
+  div {
+    display: flex;
+    justify-content: center;
+    margin-bottom: 10px;
+  }
+}
 .header {
   height: 50px;
   display: flex;

+ 14 - 4
src/views/base/craftManagement/route/components/configs.ts

@@ -381,31 +381,37 @@ export const getTableConfig = (id: string) => {
 interface comType {
   compentName: string;
   compentType: string;
+  index: number;
 }
 export const comTypes: comType[] = [
   {
     compentName: "记录项",
     compentType: "jiluxiang",
+    index: 12,
   },
   {
     compentName: "物料采集",
     compentType: "wuliaocaiji",
+    index: 0,
   },
-  {
-    compentName: "辅料采集",
-    compentType: "fuliaoCJ",
-  },
+  // {
+  //   compentName: "辅料采集",
+  //   compentType: "fuliaoCJ",
+  // },
   {
     compentName: "ESOP",
     compentType: "ESOP",
+    index: 24,
   },
   {
     compentName: "点检",
     compentType: "dianjian",
+    index: 9,
   },
   {
     compentName: "设备记录",
     compentType: "shebeijilu",
+    index: 3,
   },
   // {
   //   compentName: "紧固",
@@ -422,14 +428,17 @@ export const comTypes: comType[] = [
   {
     compentName: "多媒体采集",
     compentType: "duomeiticaiji",
+    index: 21,
   },
   {
     compentName: "工序表单",
     compentType: "operationExcel",
+    index: 15,
   },
   {
     compentName: "设备数据",
     compentType: "ceshishuju",
+    index: 6,
   },
   // {
   //   compentName: "数据采集",
@@ -438,5 +447,6 @@ export const comTypes: comType[] = [
   {
     compentName: "工序文件",
     compentType: "gongxuwenjian",
+    index: 18,
   },
 ];

+ 25 - 0
src/views/base/craftManagement/route/components/processComponent.vue

@@ -44,6 +44,7 @@
       <VueDraggable
         v-model="selectProComs"
         :animation="150"
+        :draggable="false"
         ghostClass="ghost"
         @update="onUpdate"
         style="display: flex"
@@ -68,6 +69,15 @@
       </div>
       <div v-else-if="tipTitle !== '编辑工序表单'">
         <div class="tipTitle">{{ tipTitle }}</div>
+        <el-tabs
+          v-if="currentCom.compentType === 'wuliaocaiji'"
+          v-model="materialType"
+          type="card"
+          @tab-change="materialTypeChange"
+        >
+          <el-tab-pane label="主料" name="1" />
+          <el-tab-pane label="辅料" name="2" />
+        </el-tabs>
         <el-button
           type="primary"
           @click="creatNewData"
@@ -129,6 +139,10 @@ const back = () => {
 };
 
 const save = async () => {
+  selectProComs.value = selectProComs.value.sort((a, b) => {
+    return a.index - b.index;
+  });
+
   for (let i = 0; i < selectProComs.value.length; i++) {
     selectProComs.value[i].operationId = route.fullPath.split("/")[4];
     selectProComs.value[i].sortNum = i;
@@ -230,6 +244,17 @@ const getTipContent = (itemValue) => {
 
   return "请先选择组件";
 };
+
+// 无聊采集组件 主料和辅料
+const materialType = ref("1");
+const materialTypeChange = (val) => {
+  materialType.value = val;
+  if (val === "1") {
+    tableType.value = "wuliaocaiji";
+  } else {
+    tableType.value = "fuliaoCJ";
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 2 - 2
src/views/pro/baseoperation/index.vue

@@ -234,11 +234,11 @@ option.value = Object.assign(option.value, {
       prop: "mergeNum",
       search: false,
     },
-    {
+    /*{
       label: "前置时间",
       prop: "forceTime",
       search: false,
-    },
+    },*/
     {
       label: "外协时间",
       prop: "outTime",