|
@@ -6,10 +6,10 @@
|
|
|
<div class="header">
|
|
|
<div class="title">绑定工序</div>
|
|
|
<el-space>
|
|
|
- <el-button :icon="Back" size="small">返回</el-button>
|
|
|
- <el-button type="primary" :icon="Download" size="small">下载</el-button>
|
|
|
+ <el-button :icon="Back" size="small" @click="back">返回</el-button>
|
|
|
+ <!-- <el-button type="primary" :icon="Download" size="small">下载</el-button>-->
|
|
|
<el-button
|
|
|
- type="primary"
|
|
|
+ :type="isChanged ? 'danger' : 'primary'"
|
|
|
:icon="Document"
|
|
|
size="small"
|
|
|
@click="saveFlow"
|
|
@@ -55,7 +55,9 @@
|
|
|
v-model="list2"
|
|
|
:animation="150"
|
|
|
group="people"
|
|
|
+ @update="onUpdate"
|
|
|
style="min-width: 400px"
|
|
|
+ @add="onClone"
|
|
|
>
|
|
|
<div
|
|
|
v-for="(item, index) in list2"
|
|
@@ -65,10 +67,7 @@
|
|
|
>
|
|
|
<div class="indexLabel">工序 {{ index + 1 }}</div>
|
|
|
<div :class="getFlowNameClass(index)">
|
|
|
- {{ item?.operationVO?.operationName }} 当前id:{{
|
|
|
- item?.operationId
|
|
|
- }}
|
|
|
- 下id:{{ item?.nextOperationId }}
|
|
|
+ {{ item?.operationVO?.operationName }}
|
|
|
</div>
|
|
|
<div>
|
|
|
<Delete class="flowDelete" @click.stop="clickDelete(index)" />
|
|
@@ -78,12 +77,11 @@
|
|
|
</VueDraggable>
|
|
|
</div>
|
|
|
<div class="detailInfo">
|
|
|
- <div v-show="selectIndex > -1">
|
|
|
+ <div v-if="selectIndex > -1 && !isChanged">
|
|
|
<avue-form
|
|
|
ref="formRef"
|
|
|
:option="formOption"
|
|
|
v-model="currentProcess"
|
|
|
- @submit="handleSubmit"
|
|
|
style="padding: 10px; background-color: white"
|
|
|
/>
|
|
|
<div class="editProcces">
|
|
@@ -92,6 +90,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-else class="tipContent">{{ tipContent }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -111,9 +110,12 @@ import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
|
|
|
import {
|
|
|
processesByRouteId,
|
|
|
saveProcessInRoute,
|
|
|
+ updateProcess,
|
|
|
} from "@/api/craft/route/index";
|
|
|
import { v4 as uuidv4 } from "uuid";
|
|
|
import { formOption } from "./bindConfig";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
@@ -121,12 +123,12 @@ const route = useRoute();
|
|
|
const { dicts } = useDictionaryStoreHook();
|
|
|
|
|
|
// 顶部====================
|
|
|
-const back = () => {};
|
|
|
+const back = () => {
|
|
|
+ router.back();
|
|
|
+};
|
|
|
|
|
|
const download = () => {};
|
|
|
|
|
|
-const save = () => {};
|
|
|
-
|
|
|
// 左侧工序树====================
|
|
|
const activeNames = ref([0]);
|
|
|
const handleChange = (val) => {};
|
|
@@ -155,6 +157,7 @@ const clone = (origin) => {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
+// 保存中间的工序列表
|
|
|
const saveFlow = async () => {
|
|
|
for (let i = 0; i < list2.value.length; i++) {
|
|
|
list2.value[i].operationSort = i;
|
|
@@ -184,15 +187,32 @@ const loadTreeData = () => {
|
|
|
// 中间列表====================
|
|
|
const list2 = ref([]);
|
|
|
const selectIndex = ref(-1);
|
|
|
-
|
|
|
+const isChanged = ref(true); //如果中间列表发生了改变则不显示右侧信息
|
|
|
+// 点击中间列表事件,需要设置index和值
|
|
|
const clickFlowItem = (item, index) => {
|
|
|
+ if (isChanged.value) {
|
|
|
+ ElMessage.warning("请先保存工序列表");
|
|
|
+ return;
|
|
|
+ }
|
|
|
selectIndex.value = index;
|
|
|
- console.log("clickFlowItem", item);
|
|
|
+ currentProcess.value = item.operationVO;
|
|
|
};
|
|
|
|
|
|
const clickDelete = (index) => {
|
|
|
list2.value.splice(index, 1);
|
|
|
+ onUpdate();
|
|
|
+};
|
|
|
+
|
|
|
+const onClone = () => {
|
|
|
+ isChanged.value = true;
|
|
|
+ tipContent.value = "请先保存工序列表,再选择工序进行编辑";
|
|
|
+};
|
|
|
+
|
|
|
+const onUpdate = () => {
|
|
|
+ // 中间发生了改变调用
|
|
|
selectIndex.value = -1;
|
|
|
+ isChanged.value = true;
|
|
|
+ tipContent.value = "请先保存工序列表,再选择工序进行编辑";
|
|
|
};
|
|
|
|
|
|
const getFlowNameClass = (index) => {
|
|
@@ -201,19 +221,23 @@ const getFlowNameClass = (index) => {
|
|
|
|
|
|
const loadProcessesFlow = async () => {
|
|
|
const res = await processesByRouteId(route.params.id);
|
|
|
- console.log("processesByRouteId", res);
|
|
|
+
|
|
|
list2.value = res.data ?? [];
|
|
|
- if (selectIndex.value >= 0) {
|
|
|
- }
|
|
|
+ isChanged.value = false;
|
|
|
+ tipContent.value = "请选择需要编辑的工序";
|
|
|
};
|
|
|
|
|
|
// 右侧具体信息====================
|
|
|
const formRef = ref(null);
|
|
|
const currentProcess = ref({});
|
|
|
+const tipContent = ref("");
|
|
|
const handleSubmit = () => {};
|
|
|
|
|
|
const editProComponent = async () => {
|
|
|
- saveFlow();
|
|
|
+ // saveFlow();
|
|
|
+ let res = await updateProcess(currentProcess.value);
|
|
|
+ ElMessage.success("保存成功");
|
|
|
+ router.push(`/base/craftManagement/processCom/${currentProcess.value.id}`);
|
|
|
};
|
|
|
|
|
|
// 全局=======
|
|
@@ -362,6 +386,12 @@ const getNameByDictType = (dictValue) => {
|
|
|
text-align: left;
|
|
|
margin-left: 19px;
|
|
|
}
|
|
|
+.tipContent {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 20px;
|
|
|
+ color: #e6a23c;
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style>
|