瀏覽代碼

工艺工序绑定关系。

jiaxiaoqiang 1 年之前
父節點
當前提交
bcf727678c

+ 9 - 0
src/api/craft/route/index.ts

@@ -16,3 +16,12 @@ export function processesByRouteId(id: string) {
     method: "get",
   });
 }
+
+// 新增-更新工艺路线《---》工序关系表
+export function saveProcessInRoute(data: object) {
+  return request({
+    url: `/api/v1/op/routeOperation/saveOrUpdate`,
+    method: "post",
+    data: data,
+  });
+}

+ 9 - 10
src/layout/index.vue

@@ -340,15 +340,14 @@ function toggleSidebar() {
     --el-menu-item-height: $navbar-height;
   }
 }
-:deep(.el-input-number){
-
-}
-:deep(.el-collapse-item__content){
-  padding: 18px 0 15px 10px;
-  margin-bottom: 10px;
-  background-color: var(--el-bg-color-overlay);
-  border: 1px solid var(--el-border-color-light);
-  border-radius: 4px;
-  box-shadow: var(--el-box-shadow-light);
+:deep(.el-input-number) {
 }
+// :deep(.el-collapse-item__content) {
+//   padding: 18px 0 15px 10px;
+//   margin-bottom: 10px;
+//   background-color: var(--el-bg-color-overlay);
+//   border: 1px solid var(--el-border-color-light);
+//   border-radius: 4px;
+//   box-shadow: var(--el-box-shadow-light);
+// }
 </style>

+ 168 - 0
src/views/base/craftManagement/route/bindConfig.ts

@@ -0,0 +1,168 @@
+import { useDictionaryStoreHook } from "@/store";
+const { dicts } = useDictionaryStoreHook();
+
+const switchOp = [
+  {
+    label: "否",
+    value: 0,
+  },
+  {
+    label: "是",
+    value: 1,
+  },
+];
+
+export const formOption = {
+  submitBtn: false,
+  emptyBtn: false,
+  column: [
+    {
+      label: "工序类型",
+      prop: "operationType",
+      type: "select",
+      search: true,
+      dicData: dicts.process_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+      span: 24,
+      rules: [
+        {
+          required: true,
+          message: "请选择工序类型",
+          trigger: "change",
+        },
+      ],
+    },
+    {
+      label: "技能要求",
+      prop: "skillAsk",
+      span: 24,
+      type: "select",
+      search: true,
+      filterable: true,
+      dicData: dicts.skill_requirements,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+      rules: [
+        {
+          required: true,
+          message: "请选择技能要求",
+          trigger: "change",
+        },
+      ],
+    },
+    {
+      label: "工位类型",
+      prop: "stanType",
+      search: true,
+      type: "select",
+      dicData: dicts.station_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+      span: 24,
+      row: true,
+      rules: [
+        {
+          required: true,
+          message: "请选择工位类型",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "标准工时",
+      prop: "standardWorktime",
+      span: 24,
+      value: 0,
+      append: "分钟",
+      rules: [
+        {
+          required: true,
+          message: "标准工时不能为空",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "标准机时",
+      prop: "timeingNum",
+      span: 24,
+      value: 0,
+      append: "分钟",
+      // rules: [
+      //   {
+      //     required: true,
+      //     message: "标准机时不能为空",
+      //     trigger: "blur",
+      //   },
+      // ],
+    },
+    {
+      label: "前置时间",
+      prop: "forceTime",
+      span: 24,
+      value: 0,
+      append: "分钟",
+      rules: [
+        {
+          required: true,
+          message: "前置时间不能为空",
+          trigger: "blur",
+        },
+      ],
+      // slot:true, // 自定义列
+    },
+    {
+      label: "是否外协",
+      prop: "externalCooperation",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
+      label: "是否首检",
+      prop: "firstCheck",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
+      label: "是否巡检",
+      prop: "inspection",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
+      label: "是否自检",
+      prop: "selfCheck",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
+      label: "是否可跳过",
+      prop: "skipped",
+      span: 24,
+      type: "switch",
+      dicData: switchOp,
+      value: 0,
+    },
+    {
+      label: "工序描述",
+      prop: "operationDesc",
+      span: 24,
+      type: "textarea",
+    },
+  ],
+};

+ 54 - 11
src/views/base/craftManagement/route/bindProcess.vue

@@ -77,7 +77,22 @@
           </div>
         </VueDraggable>
       </div>
-      <div class="detailInfo">3</div>
+      <div class="detailInfo">
+        <div v-show="selectIndex > -1">
+          <avue-form
+            ref="formRef"
+            :option="formOption"
+            v-model="currentProcess"
+            @submit="handleSubmit"
+            style="padding: 10px; background-color: white"
+          />
+          <div class="editProcces">
+            <el-button type="primary" :icon="Grid" @click="editProComponent"
+              >编辑工序组件</el-button
+            >
+          </div>
+        </div>
+      </div>
     </div>
   </div>
 </template>
@@ -88,12 +103,17 @@ import {
   Document,
   Delete,
   Bottom,
+  Grid,
 } from "@element-plus/icons-vue";
 import { VueDraggable } from "vue-draggable-plus";
 import { processTreeList } from "@/api/craft/process/index";
 import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
-import { processesByRouteId } from "@/api/craft/route/index";
+import {
+  processesByRouteId,
+  saveProcessInRoute,
+} from "@/api/craft/route/index";
 import { v4 as uuidv4 } from "uuid";
+import { formOption } from "./bindConfig";
 const router = useRouter();
 const route = useRoute();
 
@@ -113,6 +133,7 @@ const handleChange = (val) => {};
 
 const list1 = ref([]);
 
+// 由于工序和(工序-工艺)模型字段不同,需要自定义克隆
 const clone = (origin) => {
   const data = JSON.parse(JSON.stringify(origin));
   return {
@@ -120,7 +141,7 @@ const clone = (origin) => {
     creator: "",
     deleted: 0,
     deptId: "",
-    id: "",
+    id: null,
     uuid: uuidv4(),
     nextOperationId: "", //下一工序id
     operationId: "", //	当前工序id
@@ -134,16 +155,24 @@ const clone = (origin) => {
   };
 };
 
-const saveFlow = () => {
+const saveFlow = async () => {
   for (let i = 0; i < list2.value.length; i++) {
     list2.value[i].operationSort = i;
     list2.value[i].operationId = list2.value[i]?.operationVO?.id;
+    list2.value[i].operation = list2.value[i]?.operationVO; //后端入参和返回不一样,在这里处理一下。
     if (i === list2.value.length - 1) {
-      list2.value[i].nextOperationId = "";
+      list2.value[i].nextOperationId = null;
     } else {
       list2.value[i].nextOperationId = list2.value[i + 1]?.operationVO?.id;
     }
   }
+  let p = {
+    processRouteId: route.params.id,
+    routeOpList: list2.value,
+  };
+  let res = await saveProcessInRoute(p);
+  // Elmessage.success("保存成功");
+  loadProcessesFlow();
 };
 
 const loadTreeData = () => {
@@ -163,20 +192,29 @@ const clickFlowItem = (item, index) => {
 
 const clickDelete = (index) => {
   list2.value.splice(index, 1);
+  selectIndex.value = -1;
 };
 
 const getFlowNameClass = (index) => {
   return index === selectIndex.value ? "nameLabelSelect" : "nameLabelCommon";
 };
 
-const loadProcessesFlow = () => {
-  processesByRouteId(route.params.id).then((res) => {
-    console.log("processesByRouteId", res);
-    list2.value = res.data ?? [];
-  });
+const loadProcessesFlow = async () => {
+  const res = await processesByRouteId(route.params.id);
+  console.log("processesByRouteId", res);
+  list2.value = res.data ?? [];
+  if (selectIndex.value >= 0) {
+  }
 };
 
 // 右侧具体信息====================
+const formRef = ref(null);
+const currentProcess = ref({});
+const handleSubmit = () => {};
+
+const editProComponent = async () => {
+  saveFlow();
+};
 
 // 全局=======
 
@@ -300,9 +338,14 @@ const getNameByDictType = (dictValue) => {
 }
 
 .detailInfo {
-  width: 300px;
+  width: 320px;
   height: 100%;
   border-left: 1px solid rgba(0, 0, 0, 0.1);
+  .editProcces {
+    display: flex;
+    justify-content: center;
+    margin-top: 15px;
+  }
 }
 
 .title {