From 8682d24dfc6a962f5dc8566857e8760bac838cc9 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 15 一月 2026 13:34:02 +0800
Subject: [PATCH] fix: 完成工艺路线变更
---
src/views/productionManagement/processRoute/index.vue | 4
src/views/productionManagement/processRoute/New.vue | 171 +++++++++-------
src/views/productionManagement/processRoute/processRouteItem/index.vue | 147 ++++++++++----
src/api/productionManagement/productBom.js | 9
src/views/productionManagement/processRoute/Edit.vue | 232 ++++++++++++++--------
5 files changed, 359 insertions(+), 204 deletions(-)
diff --git a/src/api/productionManagement/productBom.js b/src/api/productionManagement/productBom.js
index 03ddd2a..893755b 100644
--- a/src/api/productionManagement/productBom.js
+++ b/src/api/productionManagement/productBom.js
@@ -36,3 +36,12 @@
data: ids,
});
}
+
+// 鏍规嵁浜у搧鍨嬪彿ID鏌ヨBOM
+export function getByModel(productModelId) {
+ return request({
+ url: "/productBom/getByModel",
+ method: "get",
+ params: { productModelId },
+ });
+}
diff --git a/src/views/productionManagement/processRoute/Edit.vue b/src/views/productionManagement/processRoute/Edit.vue
index 2ede998..0c0fe0f 100644
--- a/src/views/productionManagement/processRoute/Edit.vue
+++ b/src/views/productionManagement/processRoute/Edit.vue
@@ -8,46 +8,45 @@
>
<el-form label-width="140px" :model="formState" label-position="top" ref="formRef">
<el-form-item
- label="浜у搧澶х被锛�"
- prop="productId"
- :rules="[
- {
- required: true,
- message: '璇烽�夋嫨浜у搧澶х被',
- }
- ]"
- >
- <el-tree-select
- v-model="formState.productId"
- placeholder="璇烽�夋嫨"
- clearable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
- </el-form-item>
-
- <el-form-item
- label="瑙勬牸鍨嬪彿锛�"
+ label="浜у搧鍚嶇О"
prop="productModelId"
:rules="[
{
required: true,
- message: '璇烽�夋嫨瑙勬牸鍨嬪彿',
+ message: '璇烽�夋嫨浜у搧',
+ trigger: 'change',
+ }
+ ]"
+ >
+ <el-button type="primary" @click="showProductSelectDialog = true">
+ {{ formState.productName && formState.productModelName
+ ? `${formState.productName} - ${formState.productModelName}`
+ : '閫夋嫨浜у搧' }}
+ </el-button>
+ </el-form-item>
+
+ <el-form-item
+ label="BOM"
+ prop="bomId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨BOM',
+ trigger: 'change',
}
]"
>
<el-select
- v-model="formState.productModelId"
- placeholder="璇烽�夋嫨"
+ v-model="formState.bomId"
+ placeholder="璇烽�夋嫨BOM"
clearable
+ :disabled="!formState.productModelId || bomOptions.length === 0"
+ style="width: 100%"
>
<el-option
- v-for="item in productModelsOptions"
+ v-for="item in bomOptions"
:key="item.id"
- :label="item.model"
+ :label="item.bomNo || `BOM-${item.id}`"
:value="item.id"
/>
</el-select>
@@ -57,6 +56,13 @@
<el-input v-model="formState.description" type="textarea" />
</el-form-item>
</el-form>
+
+ <!-- 浜у搧閫夋嫨寮圭獥 -->
+ <ProductSelectDialog
+ v-model="showProductSelectDialog"
+ @confirm="handleProductSelect"
+ single
+ />
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleSubmit">纭</el-button>
@@ -68,9 +74,10 @@
</template>
<script setup>
-import {ref, computed, getCurrentInstance, onMounted} from "vue";
+import {ref, computed, getCurrentInstance, onMounted, nextTick, watch} from "vue";
import {update} from "@/api/productionManagement/processRoute.js";
-import {modelList, productTreeList} from "@/api/basicData/product.js";
+import {getByModel} from "@/api/productionManagement/productBom.js";
+import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
const props = defineProps({
visible: {
@@ -87,7 +94,14 @@
const emit = defineEmits(['update:visible', 'completed']);
// 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
-const formState = ref({});
+const formState = ref({
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ bomId: undefined,
+ description: '',
+});
const isShow = computed({
get() {
@@ -98,66 +112,111 @@
},
});
+const showProductSelectDialog = ref(false);
+const bomOptions = ref([]);
+
let { proxy } = getCurrentInstance()
-const productModelsOptions = ref([])
-const productOptions = ref([])
const closeModal = () => {
isShow.value = false;
};
+// 璁剧疆琛ㄥ崟鏁版嵁
const setFormData = () => {
- formState.value = props.record
-}
-
-const getProductOptions = () => {
- productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
- });
-};
-const getModels = (value) => {
- formState.value.productModelId = undefined;
- productModelsOptions.value = [];
- if (value) {
- modelList({ id: value }).then((res) => {
- productModelsOptions.value = res;
- });
- }
-};
-
-const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣鐨刲abel
- }
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝鐩存帴杩斿洖锛堝凡缁忔槸label瀛楃涓诧級
- }
- }
- }
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-
-function convertIdToValue(data) {
- return data.map((item) => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
+ if (props.record) {
+ formState.value = {
+ ...props.record,
+ productId: props.record.productId,
+ productModelId: props.record.productModelId,
+ productName: props.record.productName || "",
+ // 娉ㄦ剰锛歳ecord涓殑瀛楁鏄痬odel锛岄渶瑕佹槧灏勫埌productModelName
+ productModelName: props.record.model || props.record.productModelName || "",
+ bomId: props.record.bomId,
+ description: props.record.description || '',
};
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
+ // 濡傛灉鏈変骇鍝佸瀷鍙稩D锛屽姞杞紹OM鍒楄〃
+ if (props.record.productModelId) {
+ loadBomList(props.record.productModelId);
}
-
- return newItem;
- });
+ }
}
+
+// 鍔犺浇BOM鍒楄〃
+const loadBomList = async (productModelId) => {
+ if (!productModelId) {
+ bomOptions.value = [];
+ return;
+ }
+ try {
+ const res = await getByModel(productModelId);
+ // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
+ let bomList = [];
+ if (Array.isArray(res)) {
+ bomList = res;
+ } else if (res && res.data) {
+ bomList = Array.isArray(res.data) ? res.data : [res.data];
+ } else if (res && typeof res === 'object') {
+ bomList = [res];
+ }
+ bomOptions.value = bomList;
+ } catch (error) {
+ console.error("鍔犺浇BOM鍒楄〃澶辫触锛�", error);
+ bomOptions.value = [];
+ }
+};
+
+// 浜у搧閫夋嫨澶勭悊
+const handleProductSelect = async (products) => {
+ if (products && products.length > 0) {
+ const product = products[0];
+ // 鍏堟煡璇OM鍒楄〃锛堝繀閫夛級
+ try {
+ const res = await getByModel(product.id);
+ // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
+ let bomList = [];
+ if (Array.isArray(res)) {
+ bomList = res;
+ } else if (res && res.data) {
+ bomList = Array.isArray(res.data) ? res.data : [res.data];
+ } else if (res && typeof res === 'object') {
+ bomList = [res];
+ }
+
+ if (bomList.length > 0) {
+ formState.value.productModelId = product.id;
+ formState.value.productName = product.productName;
+ formState.value.productModelName = product.model;
+ // 濡傛灉褰撳墠閫夋嫨鐨凚OM涓嶅湪鏂板垪琛ㄤ腑锛屽垯閲嶇疆BOM閫夋嫨
+ const currentBomExists = bomList.some(bom => bom.id === formState.value.bomId);
+ if (!currentBomExists) {
+ formState.value.bomId = undefined;
+ }
+ bomOptions.value = bomList;
+ showProductSelectDialog.value = false;
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField('productModelId');
+ } else {
+ proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
+ }
+ } catch (error) {
+ // 濡傛灉鎺ュ彛杩斿洖404鎴栧叾浠栭敊璇紝璇存槑娌℃湁BOM
+ proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
+ }
+ }
+};
const handleSubmit = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰BOM
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!formState.value.bomId) {
+ proxy.$modal.msgError("璇烽�夋嫨BOM");
+ return;
+ }
update(formState.value).then(res => {
// 鍏抽棴妯℃�佹
isShow.value = false;
@@ -176,11 +235,18 @@
});
+// 鐩戝惉寮圭獥鎵撳紑锛屽垵濮嬪寲琛ㄥ崟鏁版嵁
+watch(() => props.visible, (visible) => {
+ if (visible && props.record) {
+ nextTick(() => {
+ setFormData();
+ });
+ }
+}, { immediate: true });
+
onMounted(() => {
- getProductOptions()
- getModels(props.record.productId)
- nextTick(() => {
- setFormData()
- });
-})
+ if (props.visible && props.record) {
+ setFormData();
+ }
+});
</script>
diff --git a/src/views/productionManagement/processRoute/New.vue b/src/views/productionManagement/processRoute/New.vue
index 856a2a4..62c6873 100644
--- a/src/views/productionManagement/processRoute/New.vue
+++ b/src/views/productionManagement/processRoute/New.vue
@@ -8,46 +8,45 @@
>
<el-form label-width="140px" :model="formState" label-position="top" ref="formRef">
<el-form-item
- label="浜у搧澶х被锛�"
- prop="productId"
- :rules="[
- {
- required: true,
- message: '璇烽�夋嫨浜у搧澶х被',
- }
- ]"
- >
- <el-tree-select
- v-model="formState.productId"
- placeholder="璇烽�夋嫨"
- clearable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
- </el-form-item>
-
- <el-form-item
- label="瑙勬牸鍨嬪彿锛�"
+ label="浜у搧鍚嶇О"
prop="productModelId"
:rules="[
{
required: true,
- message: '璇烽�夋嫨瑙勬牸鍨嬪彿',
+ message: '璇烽�夋嫨浜у搧',
+ trigger: 'change',
+ }
+ ]"
+ >
+ <el-button type="primary" @click="showProductSelectDialog = true">
+ {{ formState.productName && formState.productModelName
+ ? `${formState.productName} - ${formState.productModelName}`
+ : '閫夋嫨浜у搧' }}
+ </el-button>
+ </el-form-item>
+
+ <el-form-item
+ label="BOM"
+ prop="bomId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨BOM',
+ trigger: 'change',
}
]"
>
<el-select
- v-model="formState.productModelId"
- placeholder="璇烽�夋嫨"
+ v-model="formState.bomId"
+ placeholder="璇烽�夋嫨BOM"
clearable
+ :disabled="!formState.productModelId || bomOptions.length === 0"
+ style="width: 100%"
>
<el-option
- v-for="item in productModelsOptions"
+ v-for="item in bomOptions"
:key="item.id"
- :label="item.model"
+ :label="item.bomNo || `BOM-${item.id}`"
:value="item.id"
/>
</el-select>
@@ -57,6 +56,13 @@
<el-input v-model="formState.description" type="textarea" />
</el-form-item>
</el-form>
+
+ <!-- 浜у搧閫夋嫨寮圭獥 -->
+ <ProductSelectDialog
+ v-model="showProductSelectDialog"
+ @confirm="handleProductSelect"
+ single
+ />
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleSubmit">纭</el-button>
@@ -68,9 +74,10 @@
</template>
<script setup>
-import {ref, computed, getCurrentInstance, onMounted} from "vue";
+import {ref, computed, getCurrentInstance} from "vue";
import {add} from "@/api/productionManagement/processRoute.js";
-import {modelList, productTreeList} from "@/api/basicData/product.js";
+import {getByModel} from "@/api/productionManagement/productBom.js";
+import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
const props = defineProps({
visible: {
@@ -85,6 +92,9 @@
const formState = ref({
productId: undefined,
productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ bomId: undefined,
description: '',
});
@@ -97,66 +107,73 @@
},
});
-const productModelsOptions = ref([])
-const productOptions = ref([])
+const showProductSelectDialog = ref(false);
+const bomOptions = ref([]);
let { proxy } = getCurrentInstance()
const closeModal = () => {
+ // 閲嶇疆琛ㄥ崟鏁版嵁
+ formState.value = {
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ bomId: undefined,
+ description: '',
+ };
+ bomOptions.value = [];
isShow.value = false;
};
-const getProductOptions = () => {
- productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
- });
-};
-const getModels = (value) => {
- formState.value.productId = undefined;
- formState.value.productModelId = undefined;
- productModelsOptions.value = [];
-
- if (value) {
- formState.value.productId = findNodeById(productOptions.value, value) || undefined;
- modelList({ id: value }).then((res) => {
- productModelsOptions.value = res;
- });
- }
-};
-
-const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣鐨刲abel
- }
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝鐩存帴杩斿洖锛堝凡缁忔槸label瀛楃涓诧級
+// 浜у搧閫夋嫨澶勭悊
+const handleProductSelect = async (products) => {
+ if (products && products.length > 0) {
+ const product = products[0];
+ // 鍏堟煡璇OM鍒楄〃锛堝繀閫夛級
+ try {
+ const res = await getByModel(product.id);
+ // 澶勭悊杩斿洖鐨凚OM鏁版嵁锛氬彲鑳芥槸鏁扮粍銆佸璞℃垨鍖呭惈data瀛楁
+ let bomList = [];
+ if (Array.isArray(res)) {
+ bomList = res;
+ } else if (res && res.data) {
+ bomList = Array.isArray(res.data) ? res.data : [res.data];
+ } else if (res && typeof res === 'object') {
+ bomList = [res];
}
+
+ if (bomList.length > 0) {
+ formState.value.productModelId = product.id;
+ formState.value.productName = product.productName;
+ formState.value.productModelName = product.model;
+ formState.value.bomId = undefined; // 閲嶇疆BOM閫夋嫨
+ bomOptions.value = bomList;
+ showProductSelectDialog.value = false;
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField('productModelId');
+ } else {
+ proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
+ }
+ } catch (error) {
+ // 濡傛灉鎺ュ彛杩斿洖404鎴栧叾浠栭敊璇紝璇存槑娌℃湁BOM
+ proxy.$modal.msgError("璇ヤ骇鍝佹病鏈塀OM锛岃鍏堝垱寤築OM");
}
}
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
};
-
-function convertIdToValue(data) {
- return data.map((item) => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
- };
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
- }
-
- return newItem;
- });
-}
const handleSubmit = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰BOM
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!formState.value.bomId) {
+ proxy.$modal.msgError("璇烽�夋嫨BOM");
+ return;
+ }
add(formState.value).then(res => {
// 鍏抽棴妯℃�佹
isShow.value = false;
@@ -174,8 +191,4 @@
handleSubmit,
isShow,
});
-
-onMounted(() => {
- getProductOptions()
-})
</script>
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 7d5ab5d..74d2d23 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -80,6 +80,10 @@
prop: "model",
},
{
+ label: "BOM缂栧彿",
+ prop: "bomNo",
+ },
+ {
label: "鎻忚堪",
prop: "description",
},
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index fa6fbad..bbce4ef 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -4,9 +4,9 @@
<template #right-button>
<el-button
type="primary"
- @click="isShowProductSelectDialog = true"
+ @click="isShowProcessSelectDialog = true"
>
- 閫夋嫨浜у搧
+ 閫夋嫨宸ュ簭
</el-button>
<el-button type="primary" @click="handleSubmit">纭</el-button>
<el-switch
@@ -59,18 +59,7 @@
<template #default="scope" v-else>
<template v-if="item.prop === 'processId'">
- <el-select
- v-model="scope.row[item.prop]"
- style="width: 100%;"
- @mousedown.stop
- >
- <el-option
- v-for="process in processOptions"
- :key="process.id"
- :label="process.name"
- :value="process.id"
- />
- </el-select>
+ {{ getProcessName(scope.row.processId) || '-' }}
</template>
<template v-else>
{{ scope.row[item.prop] || '-' }}
@@ -106,6 +95,7 @@
v-model="item.processId"
style="width: 100%;"
@mousedown.stop
+ :disabled="true"
>
<el-option
v-for="process in processOptions"
@@ -114,6 +104,14 @@
:value="process.id"
/>
</el-select>
+ <el-button
+ type="primary"
+ size="small"
+ style="margin-top: 8px; width: 100%;"
+ @click.stop="handleSelectProductForRow(item)"
+ >
+ 閫夋嫨浜у搧
+ </el-button>
</div>
<template #footer>
<div class="step-card-footer">
@@ -125,9 +123,38 @@
</div>
</div>
+ <!-- 宸ュ簭閫夋嫨瀵硅瘽妗� -->
+ <el-dialog
+ v-model="isShowProcessSelectDialog"
+ title="閫夋嫨宸ュ簭"
+ width="400px"
+ >
+ <el-select
+ v-model="selectedProcessId"
+ placeholder="璇烽�夋嫨宸ュ簭锛堝彲澶氶�夛級"
+ style="width: 100%"
+ multiple
+ collapse-tags
+ collapse-tags-tooltip
+ >
+ <el-option
+ v-for="process in processOptions"
+ :key="process.id"
+ :label="process.name"
+ :value="process.id"
+ />
+ </el-select>
+ <template #footer>
+ <el-button @click="isShowProcessSelectDialog = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleSelectProcess">纭畾</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- 浜у搧閫夋嫨瀵硅瘽妗� -->
<ProductSelectDialog
v-model="isShowProductSelectDialog"
- @confirm="handelSelectProducts"
+ @confirm="handleSelectProductForCurrentRow"
+ single
/>
</div>
</template>
@@ -143,6 +170,9 @@
const processOptions = ref([]);
const tableLoading = ref(false);
const isShowProductSelectDialog = ref(false);
+const isShowProcessSelectDialog = ref(false);
+const selectedProcessId = ref([]);
+const currentSelectRow = ref(null);
const routeItems = ref([]);
let tableSortable = null;
let stepsSortable = null;
@@ -164,17 +194,26 @@
const tableColumn = ref([
+{ label: "宸ュ簭鍚嶇О", prop: "processId", width: 200 },
{ label: "浜у搧鍚嶇О", prop: "productName"},
{ label: "瑙勬牸鍚嶇О", prop: "model" },
{ label: "鍗曚綅", prop: "unit" },
- { label: "宸ュ簭鍚嶇О", prop: "processId", width: 200 },
{
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 100,
+ width: 180,
operation: [
+ {
+ name: "閫夋嫨浜у搧",
+ type: "primary",
+ link: true,
+ clickFun: (row) => {
+ currentSelectRow.value = row;
+ isShowProductSelectDialog.value = true;
+ }
+ },
{
name: "鍒犻櫎",
type: "danger",
@@ -190,6 +229,13 @@
}
]);
+// 鏍规嵁宸ュ簭ID鑾峰彇宸ュ簭鍚嶇О
+const getProcessName = (processId) => {
+ if (!processId) return '';
+ const process = processOptions.value.find(p => p.id === processId);
+ return process ? process.name : '';
+};
+
const removeItem = (index) => {
routeItems.value.splice(index, 1);
nextTick(() => initSortable());
@@ -203,36 +249,53 @@
}
};
-const handelSelectProducts = (products) => {
- destroySortable();
-
- const newData = products.map(({ id, ...product }) => ({
- ...product,
- productModelId: id,
+// 閫夋嫨宸ュ簭 - 鏂板澶氭潯璁板綍
+const handleSelectProcess = () => {
+ if (!selectedProcessId.value || selectedProcessId.value.length === 0) {
+ proxy?.$modal?.msgWarning("璇烽�夋嫨宸ュ簭");
+ return;
+ }
+
+ // 涓烘瘡涓�変腑鐨勫伐搴忓垱寤轰竴鏉¤褰�
+ const newItems = selectedProcessId.value.map(processId => ({
+ processId: processId,
+ productName: "",
+ model: "",
+ unit: "",
+ productModelId: undefined,
routeId: routeId.value,
- id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
- processId: undefined
+ id: `${Date.now()}-${Math.random().toString(36).slice(2)}-${processId}`,
}));
-
- console.log('閫夋嫨浜у搧鍓嶆暟缁�:', routeItems.value);
- routeItems.value.push(...newData);
- routeItems.value = [...routeItems.value];
- console.log('閫夋嫨浜у搧鍚庢暟缁�:', routeItems.value);
-
+
+ routeItems.value.push(...newItems);
+
// 寤惰繜鍒濆鍖栵紝纭繚DOM瀹屽叏娓叉煋
nextTick(() => {
- // 寮哄埗閲嶆柊娓叉煋缁勪欢
- if (proxy?.$forceUpdate) {
- proxy.$forceUpdate();
- }
-
- const temp = [...routeItems.value];
- routeItems.value = [];
- nextTick(() => {
- routeItems.value = temp;
- initSortable();
- });
+ initSortable();
});
+
+ isShowProcessSelectDialog.value = false;
+ selectedProcessId.value = [];
+};
+
+// 涓烘寚瀹氳閫夋嫨浜у搧
+const handleSelectProductForRow = (row) => {
+ currentSelectRow.value = row;
+ isShowProductSelectDialog.value = true;
+};
+
+// 澶勭悊褰撳墠琛岀殑浜у搧閫夋嫨
+const handleSelectProductForCurrentRow = (products) => {
+ if (products && products.length > 0 && currentSelectRow.value) {
+ const product = products[0];
+ // 鏇存柊褰撳墠琛岀殑浜у搧淇℃伅
+ currentSelectRow.value.productName = product.productName;
+ currentSelectRow.value.model = product.model;
+ currentSelectRow.value.unit = product.unit || "";
+ currentSelectRow.value.productModelId = product.id;
+ isShowProductSelectDialog.value = false;
+ currentSelectRow.value = null;
+ }
};
const findProcessRouteItems = () => {
--
Gitblit v1.9.3