|
@@ -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 {
|