This commit is contained in:
zc
2026-03-20 16:33:39 +08:00
parent 69f97a740d
commit 0dee240c6e
5 changed files with 38 additions and 26 deletions

View File

@@ -61,7 +61,7 @@ export function updateMaterialInfo(data: any, id: string) {
}
/** @desc 删除物料信息 */
export function deleteMaterialInfo(id: string) {
export function deleteMaterialInfo(id: string | Array<string>) {
return http.del(`${BASE_URL}/${id}`)
}

View File

@@ -10,6 +10,8 @@ export interface WeighManageResp {
unitWeight: number
photoUrl: string
matchResult: string
downFloatRatio: string
upFloatRatio: string
}
export interface WeighManageQuery {

View File

@@ -20,7 +20,7 @@
:limit="1"
:show-retry-button="false"
:show-cancel-button="false"
tip="仅支持zip格式"
tip="仅支持zip格式,请确保图片名称和物料编码一致"
:file-list="uploadFile"
accept=".zip"
/>

View File

@@ -10,6 +10,10 @@
:pagination="pagination"
:disabled-tools="['size']"
:disabled-column-keys="['name']"
:selected-keys="selectedKeys"
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
@select-all="selectAll"
@select="select"
@refresh="search"
>
<!-- toolbar 部分保持不变 -->
@@ -22,6 +26,10 @@
</a-button>
</template>
<template #toolbar-right>
<a-button v-permission="['admin:materialInfo:delete']" type="outline" status="danger" @click="onDelete">
<template #icon><icon-delete /></template>
<template #default>删除</template>
</a-button>
<a-button v-permission="['admin:materialInfo:add']" type="primary" @click="onAdd">
<template #icon><icon-plus /></template>
<template #default>新增</template>
@@ -42,26 +50,10 @@
<!-- 修改点照片列插槽 -->
<template #photoUrl="{ record }">
<div class="photo-container">
<!-- 1. 正常显示图片有地址 未标记为错误 -->
<img
v-if="record.photoUrl && !record.photoLoadError"
<a-image
width="60"
:src="record.photoUrl"
alt="物料照片"
class="material-photo"
@load="handleImgLoad(record)"
@error="handleImgError(record, $event)"
/>
<!-- 2. 无地址 -->
<span v-else-if="!record.photoUrl" class="no-photo">暂无照片</span>
<!-- 3. 地址存在但加载失败 -->
<span v-else class="photo-error">
<icon-exclamation-circle-fill class="error-icon" />
照片异常
</span>
</div>
</template>
<template #action="{ record }">
@@ -72,7 +64,7 @@
status="danger"
:disabled="record.disabled"
:title="record.disabled ? '不可删除' : '删除'"
@click="onDelete(record)"
@click="onDeleteOne(record)"
>
删除
</a-link>
@@ -96,6 +88,7 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useDownload, useTable } from '@/hooks'
import { isMobile } from '@/utils'
import has from '@/utils/has'
import {Message} from "@arco-design/web-vue";
defineOptions({ name: 'MaterialInfo' })
@@ -113,6 +106,9 @@ const {
tableData: dataList,
loading,
pagination,
selectedKeys,
select,
selectAll,
search,
handleDelete,
} = useTable((page) => listMaterialInfo({ ...queryForm, ...page }), { immediate: true })
@@ -143,13 +139,24 @@ const reset = () => {
search()
}
const onDelete = (record: MaterialInfoResp) => {
const onDeleteOne = (record: MaterialInfoResp) => {
return handleDelete(() => deleteMaterialInfo(record.id), {
content: `是否确定删除该条数据?`,
showModal: true,
})
}
// 删除
const onDelete = () => {
if (!selectedKeys.value.length) {
return Message.warning('请选择数据')
}
return handleDelete(() => deleteMaterialInfo(selectedKeys.value), {
content: `是否确定删除选中的 ${selectedKeys.value.length} 条数据?`,
showModal: true
})
}
const onExport = () => {
useDownload(() => exportMaterialInfo(queryForm))
}

View File

@@ -147,7 +147,7 @@
<div class="form-row">
<div class="form-item">
<label>该物料重量范围:</label>
<a-input v-model="formData.materialName" placeholder="该物料重量范围" disabled />
<a-input v-model="formData.weightRange" placeholder="该物料重量范围" disabled />
</div>
</div>
@@ -275,7 +275,7 @@
</template>
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, onUnmounted, reactive, ref } from 'vue'
import { nextTick, onBeforeUnmount, onMounted, onUnmounted, reactive, ref, watch, computed } from 'vue'
import { Message, Modal, Notification } from '@arco-design/web-vue'
import { getMaterialDetail, validateWeighing, vmSend } from '@/apis/weightManage/weightManage'
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
@@ -299,6 +299,7 @@ const formData = reactive({
materialSpec: '', // 物料规格
unitWeight: 0, // 重量
photoUrl: '', // 样图URL
weightRange: '', // 物料重量范围
})
const imgData = reactive({
@@ -688,6 +689,7 @@ const originalHandleMaterialCodeChange = async () => {
formData.materialSpec = ''
formData.unitWeight = 0
formData.photoUrl = ''
formData.weightRange = ''
compareMatchResult.value = '';
// 如果有物料编码输入,获取物料数据
@@ -747,6 +749,7 @@ const fetchMaterialData = async (code: string) => {
formData.materialSpec = res.data?.materialSpec || ''
formData.unitWeight = res.data?.unitWeight || 0
formData.photoUrl = res.data?.photoUrl || ''
formData.weightRange = (res.data?.downFloatRatio || '-') + '% ~ ' + (res.data?.upFloatRatio || '-') + '%'
return true
}
})