|
@@ -1,13 +1,13 @@
|
|
<template>
|
|
<template>
|
|
<div class="body">
|
|
<div class="body">
|
|
<div class="steps" v-for="(item, index) in opsArray" :key="index" @click="boxClick(item, index)">
|
|
<div class="steps" v-for="(item, index) in opsArray" :key="index" @click="boxClick(item, index)">
|
|
- <div :class="selectStepIndex == index
|
|
|
|
- ? item.exists == true
|
|
|
|
- ? 'stepBox stepBoxHover'
|
|
|
|
|
|
+ <div :class="item.opComplete
|
|
|
|
+ ? 'stepBox stepBoxDisabled'
|
|
|
|
+ : item.exists == true
|
|
|
|
+ ? selectStepIndex == index
|
|
|
|
+ ? 'stepBox stepBoxHover'
|
|
|
|
+ : 'stepBox'
|
|
: 'stepBox stepExistsHover'
|
|
: 'stepBox stepExistsHover'
|
|
- : item.opComplete
|
|
|
|
- ? 'stepBox stepBoxDisabled'
|
|
|
|
- : 'stepBox'
|
|
|
|
">
|
|
">
|
|
<div style="display: flex; align-items: center">
|
|
<div style="display: flex; align-items: center">
|
|
<div :class="selectStepIndex == index
|
|
<div :class="selectStepIndex == index
|
|
@@ -36,57 +36,96 @@
|
|
{{ item.completeNum }}
|
|
{{ item.completeNum }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div v-if="item.exists != true && selectStepIndex == index" class="existsText">
|
|
|
|
|
|
+ <div v-if="item.exists != true" class="existsText">
|
|
注:该工位在计划上未分配此工序任务!
|
|
注:该工位在计划上未分配此工序任务!
|
|
</div>
|
|
</div>
|
|
<div class="line" v-if="index != opsArray.length - 1"></div>
|
|
<div class="line" v-if="index != opsArray.length - 1"></div>
|
|
</div>
|
|
</div>
|
|
<el-empty v-if="!opsArray" description="暂无数据" />
|
|
<el-empty v-if="!opsArray" description="暂无数据" />
|
|
|
|
+ <!-- 弹窗 -->
|
|
|
|
+ <el-dialog v-model="centerDialogVisible" width="500" align-center style="border-radius: 16px">
|
|
|
|
+ <template #header>
|
|
|
|
+ <div class="titleText" style="text-align: center">通知</div>
|
|
|
|
+ </template>
|
|
|
|
+ <span class="titleText">已选择好工序,点击确认立即开工</span>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
+ <el-button @click="centerDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="getScanData"> 确定 </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { useProcessStore } from "@/store";
|
|
import { useProcessStore } from "@/store";
|
|
import { emitter, EventsNames } from "@/utils/common";
|
|
import { emitter, EventsNames } from "@/utils/common";
|
|
|
|
+import { getScan } from "@/api/process";
|
|
const store = useProcessStore();
|
|
const store = useProcessStore();
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
opsArray?: object;
|
|
opsArray?: object;
|
|
}>();
|
|
}>();
|
|
//步骤显示index
|
|
//步骤显示index
|
|
const selectStepIndex = ref(null);
|
|
const selectStepIndex = ref(null);
|
|
|
|
+const scanStatus = inject("scanStatus");
|
|
|
|
+const centerDialogVisible = ref(false);
|
|
const emitFnc = () => {
|
|
const emitFnc = () => {
|
|
emitter.emit(EventsNames.PROCESS_STEPOBJ, {
|
|
emitter.emit(EventsNames.PROCESS_STEPOBJ, {
|
|
index: selectStepIndex.value,
|
|
index: selectStepIndex.value,
|
|
lastStatus:
|
|
lastStatus:
|
|
selectStepIndex.value == null || selectStepIndex.value == 0
|
|
selectStepIndex.value == null || selectStepIndex.value == 0
|
|
? false
|
|
? false
|
|
- : props.opsArray[selectStepIndex.value - 1].opComplete == false
|
|
|
|
|
|
+ : props.opsArray[selectStepIndex.value - 1].opComplete == false &&
|
|
|
|
+ props.opsArray[selectStepIndex.value - 1].exists == true
|
|
? true
|
|
? true
|
|
: false,
|
|
: false,
|
|
});
|
|
});
|
|
};
|
|
};
|
|
-const setStepIndex = () => {
|
|
|
|
- for (let i = 0; i < props.opsArray.length; i++) {
|
|
|
|
- if (props.opsArray[i].opComplete == false) {
|
|
|
|
- selectStepIndex.value = i;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
|
|
+emitter.on(EventsNames.PROCESS_STEPINDEX, (val: any) => {
|
|
|
|
+ selectStepIndex.value = val;
|
|
|
|
+});
|
|
|
|
+// const setStepIndex = () => {
|
|
|
|
+// for (let i = 0; i < props.opsArray.length; i++) {
|
|
|
|
+// if (props.opsArray[i].opComplete == false) {
|
|
|
|
+// selectStepIndex.value = i;
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// };
|
|
const boxClick = (item, index) => {
|
|
const boxClick = (item, index) => {
|
|
- if (item.opComplete == true) return;
|
|
|
|
|
|
+ if (item.opComplete == true || item.exists != true) return;
|
|
store.odersData.operationId = item.operationId;
|
|
store.odersData.operationId = item.operationId;
|
|
store.processInfo.operationCode = item.operationCode;
|
|
store.processInfo.operationCode = item.operationCode;
|
|
store.processInfo.operationName = item.operationName;
|
|
store.processInfo.operationName = item.operationName;
|
|
selectStepIndex.value = index;
|
|
selectStepIndex.value = index;
|
|
emitFnc();
|
|
emitFnc();
|
|
|
|
+ centerDialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+const getScanData = async () => {
|
|
|
|
+ try {
|
|
|
|
+ const { code, data, msg } = await getScan({
|
|
|
|
+ operationId: Number(store.odersData.operationId),
|
|
|
|
+ qrCode: store.odersData.qrCode,
|
|
|
|
+ workOrderCode: store.odersData.workOrderCode,
|
|
|
|
+ //stationId暂时随便传一个
|
|
|
|
+ stationId: 1,
|
|
|
|
+ });
|
|
|
|
+ if (code == "200") {
|
|
|
|
+ store.scanInfo = data;
|
|
|
|
+ router.push({ path: "/pro-steps" });
|
|
|
|
+ }
|
|
|
|
+ } catch {
|
|
|
|
+ } finally {
|
|
|
|
+ centerDialogVisible.value = false;
|
|
|
|
+ }
|
|
};
|
|
};
|
|
watch(
|
|
watch(
|
|
() => props.opsArray,
|
|
() => props.opsArray,
|
|
() => {
|
|
() => {
|
|
if (props.opsArray.length > 0) {
|
|
if (props.opsArray.length > 0) {
|
|
selectStepIndex.value = null;
|
|
selectStepIndex.value = null;
|
|
- setStepIndex();
|
|
|
|
|
|
+ // setStepIndex();
|
|
if (selectStepIndex.value !== null) {
|
|
if (selectStepIndex.value !== null) {
|
|
boxClick(props.opsArray[selectStepIndex.value], selectStepIndex.value);
|
|
boxClick(props.opsArray[selectStepIndex.value], selectStepIndex.value);
|
|
} else {
|
|
} else {
|
|
@@ -97,6 +136,12 @@ watch(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
+watch(
|
|
|
|
+ () => scanStatus.value,
|
|
|
|
+ () => {
|
|
|
|
+ selectStepIndex.value = null;
|
|
|
|
+ }
|
|
|
|
+);
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
emitter.off(EventsNames.PROCESS_STEPOBJ);
|
|
emitter.off(EventsNames.PROCESS_STEPOBJ);
|
|
});
|
|
});
|
|
@@ -131,10 +176,12 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
.stepExistsHover {
|
|
.stepExistsHover {
|
|
background-color: red;
|
|
background-color: red;
|
|
|
|
+ cursor: not-allowed;
|
|
}
|
|
}
|
|
|
|
|
|
.stepBoxDisabled {
|
|
.stepBoxDisabled {
|
|
background-color: grey;
|
|
background-color: grey;
|
|
|
|
+ cursor: not-allowed;
|
|
}
|
|
}
|
|
|
|
|
|
.stepIndexHover {
|
|
.stepIndexHover {
|