From bfaaa299a0aebd4ccc488cbe5a67e7d73304fb2c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 24 四月 2026 15:56:03 +0800
Subject: [PATCH] fix: 图片预览路径替换为link
---
src/views/inventoryManagement/stockManagement/Unqualified.vue | 184 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 166 insertions(+), 18 deletions(-)
diff --git a/src/views/inventoryManagement/stockManagement/Unqualified.vue b/src/views/inventoryManagement/stockManagement/Unqualified.vue
index 500c31c..aed9412 100644
--- a/src/views/inventoryManagement/stockManagement/Unqualified.vue
+++ b/src/views/inventoryManagement/stockManagement/Unqualified.vue
@@ -3,10 +3,31 @@
<div class="search_form">
<div>
<span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productName"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable/>
+ <el-tree-select
+ v-model="searchForm.parentId"
+ style="width: 240px"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable
+ check-strictly
+ :data="productOptions"
+ :render-after-expand="false"
+ @change="handleParentChange"
+ />
+ <span class="search_title ml10">瑙勬牸鍨嬪彿锛�</span>
+ <el-select
+ v-model="searchForm.productModelId"
+ style="width: 240px"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable
+ @change="handleModelChange"
+ >
+ <el-option v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id" />
+ </el-select>
<el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
</div>
<div>
@@ -20,16 +41,30 @@
:row-class-name="tableRowClassName" height="calc(100vh - 18.5em)">
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍏ュ簱鏃ユ湡" prop="createTime" show-overflow-tooltip />
<el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
<el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+ <el-table-column label="鍘氬害(mm)" prop="thickness" show-overflow-tooltip />
<el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
- <el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
- <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" show-overflow-tooltip />
+ <el-table-column label="鍚堟牸搴撳瓨鏁伴噺" prop="qualifiedQuantity" show-overflow-tooltip>
+ <template #default="scope">{{ scope.row.qualifiedQuantity ?? 0 }}</template>
+ </el-table-column>
+ <el-table-column label="涓嶅悎鏍煎簱瀛樻暟閲�" prop="unqualifiedQuantity" show-overflow-tooltip>
+ <template #default="scope">{{ scope.row.unqualifiedQuantity ?? scope.row.qualitity ?? scope.row.unLockedQuantity ?? 0 }}</template>
+ </el-table-column>
+ <el-table-column label="鍚堟牸鍐荤粨鏁伴噺" prop="qualifiedLockedQuantity" show-overflow-tooltip>
+ <template #default="scope">{{ scope.row.qualifiedLockedQuantity ?? 0 }}</template>
+ </el-table-column>
+ <el-table-column label="涓嶅悎鏍煎喕缁撴暟閲�" prop="unqualifiedLockedQuantity" show-overflow-tooltip>
+ <template #default="scope">{{ scope.row.unqualifiedLockedQuantity ?? scope.row.lockedQuantity ?? 0 }}</template>
+ </el-table-column>
+ <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" show-overflow-tooltip />
+ <el-table-column label="澶囨敞" prop="remark" show-overflow-tooltip />
<el-table-column label="鏈�杩戞洿鏂版椂闂�" prop="updateTime" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="90" align="center">
<template #default="scope">
- <el-button link type="primary" size="small" @click="showSubtractModal(scope.row)" :disabled="scope.row.qualitity === 0">棰嗙敤</el-button>
+ <el-button link type="primary" @click="showSubtractModal(scope.row)" :disabled="scope.row.unLockedQuantity === 0">棰嗙敤</el-button>
+ <el-button link type="primary" v-if="scope.row.unLockedQuantity > 0" @click="showFrozenModal(scope.row)">鍐荤粨</el-button>
+ <el-button link type="primary" v-if="scope.row.lockedQuantity > 0" @click="showThawModal(scope.row)">瑙e喕</el-button>
</template>
</el-table-column>
</el-table>
@@ -39,25 +74,44 @@
<new-stock-inventory v-if="isShowNewModal"
v-model:visible="isShowNewModal"
type="unqualified"
+ :parent-id="props.parentId"
@completed="handleQuery" />
<subtract-stock-inventory v-if="isShowSubtractModal"
v-model:visible="isShowSubtractModal"
:record="record"
+ type="unqualified"
@completed="handleQuery" />
+ <!-- 鍐荤粨/瑙e喕搴撳瓨-->
+ <frozen-and-thaw-stock-inventory v-if="isShowFrozenAndThawModal"
+ v-model:visible="isShowFrozenAndThawModal"
+ :record="record"
+ :operation-type="operationType"
+ type="unqualified"
+ @completed="handleQuery" />
</div>
</template>
<script setup>
import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance, watch } from 'vue'
import { ElMessageBox } from "element-plus";
import { getStockUninventoryListPage } from "@/api/inventoryManagement/stockUninventory.js";
+import { modelList, productTreeList } from "@/api/basicData/product.js";
const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
const SubtractStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Subtract.vue"));
+const FrozenAndThawStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/FrozenAndThaw.vue"));
+const props = defineProps({
+ parentId: {
+ type: [Number, String],
+ default: undefined,
+ },
+})
const { proxy } = getCurrentInstance()
const tableData = ref([])
+const productOptions = ref([])
+const modelOptions = ref([])
const selectedRows = ref([])
const record = ref({})
const tableLoading = ref(false)
@@ -70,9 +124,16 @@
const isShowNewModal = ref(false)
// 鏄惁鏄剧ず棰嗙敤寮规
const isShowSubtractModal = ref(false)
+// 鏄惁鏄剧ず鍐荤粨/瑙e喕寮规
+const isShowFrozenAndThawModal = ref(false)
+// 鎿嶄綔绫诲瀷
+const operationType = ref('frozen')
const data = reactive({
searchForm: {
productName: '',
+ parentId: undefined,
+ productModelId: undefined,
+ model: '',
}
})
const { searchForm } = toRefs(data)
@@ -90,7 +151,12 @@
}
const getList = () => {
tableLoading.value = true
- getStockUninventoryListPage({ ...searchForm.value, ...page }).then(res => {
+ const queryParentId = searchForm.value.parentId || props.parentId
+ getStockUninventoryListPage({
+ ...searchForm.value,
+ ...page,
+ parentId: queryParentId,
+ }).then(res => {
tableLoading.value = false
tableData.value = res.data.records
total.value = res.data.total
@@ -101,10 +167,79 @@
})
}
+const convertIdToValue = (data) => {
+ return (data || []).map((item) => {
+ const children = Array.isArray(item.children) ? item.children : []
+ return {
+ ...item,
+ value: item.id,
+ label: item.label || item.productName || '',
+ children: convertIdToValue(children),
+ }
+ })
+}
+
+const findNodeById = (nodes, id) => {
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i]
+ if (node.value === id) return node
+ if (node.children?.length) {
+ const found = findNodeById(node.children, id)
+ if (found) return found
+ }
+ }
+ return null
+}
+
+const loadProductOptions = async () => {
+ try {
+ const res = await productTreeList()
+ productOptions.value = convertIdToValue(res || [])
+ } catch (e) {
+ productOptions.value = []
+ }
+}
+
+const loadModelOptions = async (parentId) => {
+ if (!parentId) {
+ modelOptions.value = []
+ return
+ }
+ const res = await modelList({ id: parentId })
+ modelOptions.value = Array.isArray(res) ? res : []
+}
+
+const handleParentChange = async (value) => {
+ searchForm.value.productModelId = undefined
+ searchForm.value.model = ''
+ const selected = findNodeById(productOptions.value, value)
+ searchForm.value.productName = selected?.label || ''
+ await loadModelOptions(value || props.parentId)
+}
+
+const handleModelChange = (value) => {
+ const selected = modelOptions.value.find((item) => item.id === value)
+ searchForm.value.model = selected?.model || ''
+}
+
// 鐐瑰嚮棰嗙敤
const showSubtractModal = (row) => {
record.value = row
isShowSubtractModal.value = true
+}
+
+// 鐐瑰嚮鍐荤粨
+const showFrozenModal = (row) => {
+ record.value = row
+ isShowFrozenAndThawModal.value = true
+ operationType.value = 'frozen'
+}
+
+// 鐐瑰嚮瑙e喕
+const showThawModal = (row) => {
+ record.value = row
+ isShowFrozenAndThawModal.value = true
+ operationType.value = 'thaw'
}
// 琛ㄦ牸閫夋嫨鏁版嵁
@@ -117,12 +252,12 @@
// 琛ㄦ牸琛岀被鍚�
const tableRowClassName = ({ row }) => {
- const stock = Number(row?.inboundNum0 ?? 0);
- const warn = Number(row?.warnNum ?? 0);
- if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
- return '';
- }
- return stock < warn ? 'row-low-stock' : '';
+ // const stock = Number(row?.unLockedQuantity ?? 0);
+ // const warn = Number(row?.warnNum ?? 0);
+ // if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
+ // return '';
+ // }
+ // return stock < warn ? 'row-low-stock' : '';
};
// 瀵煎嚭
@@ -135,15 +270,28 @@
type: 'warning',
}
).then(() => {
- proxy.download("/stockin/exportCopy", {}, '搴撳瓨淇℃伅.xlsx')
+ proxy.download("/stockUninventory/exportStockUninventory", {}, '搴撳瓨淇℃伅.xlsx')
}).catch(() => {
proxy.$modal.msg("宸插彇娑�")
})
}
onMounted(() => {
+ loadProductOptions()
getList()
})
+
+watch(
+ () => props.parentId,
+ async () => {
+ searchForm.value.parentId = props.parentId
+ searchForm.value.productModelId = undefined
+ searchForm.value.model = ''
+ await loadModelOptions(props.parentId)
+ handleQuery()
+ },
+ { immediate: true }
+)
</script>
<style scoped lang="scss">
--
Gitblit v1.9.3