优化
This commit is contained in:
@@ -61,7 +61,7 @@ export function updateMaterialInfo(data: any, id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @desc 删除物料信息 */
|
/** @desc 删除物料信息 */
|
||||||
export function deleteMaterialInfo(id: string) {
|
export function deleteMaterialInfo(id: string | Array<string>) {
|
||||||
return http.del(`${BASE_URL}/${id}`)
|
return http.del(`${BASE_URL}/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ export interface WeighManageResp {
|
|||||||
unitWeight: number
|
unitWeight: number
|
||||||
photoUrl: string
|
photoUrl: string
|
||||||
matchResult: string
|
matchResult: string
|
||||||
|
downFloatRatio: string
|
||||||
|
upFloatRatio: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WeighManageQuery {
|
export interface WeighManageQuery {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
:limit="1"
|
:limit="1"
|
||||||
:show-retry-button="false"
|
:show-retry-button="false"
|
||||||
:show-cancel-button="false"
|
:show-cancel-button="false"
|
||||||
tip="仅支持zip格式"
|
tip="仅支持zip格式,请确保图片名称和物料编码一致"
|
||||||
:file-list="uploadFile"
|
:file-list="uploadFile"
|
||||||
accept=".zip"
|
accept=".zip"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:disabled-tools="['size']"
|
:disabled-tools="['size']"
|
||||||
:disabled-column-keys="['name']"
|
:disabled-column-keys="['name']"
|
||||||
|
:selected-keys="selectedKeys"
|
||||||
|
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||||
|
@select-all="selectAll"
|
||||||
|
@select="select"
|
||||||
@refresh="search"
|
@refresh="search"
|
||||||
>
|
>
|
||||||
<!-- toolbar 部分保持不变 -->
|
<!-- toolbar 部分保持不变 -->
|
||||||
@@ -22,6 +26,10 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
<template #toolbar-right>
|
<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">
|
<a-button v-permission="['admin:materialInfo:add']" type="primary" @click="onAdd">
|
||||||
<template #icon><icon-plus /></template>
|
<template #icon><icon-plus /></template>
|
||||||
<template #default>新增</template>
|
<template #default>新增</template>
|
||||||
@@ -42,26 +50,10 @@
|
|||||||
|
|
||||||
<!-- 【修改点】照片列插槽 -->
|
<!-- 【修改点】照片列插槽 -->
|
||||||
<template #photoUrl="{ record }">
|
<template #photoUrl="{ record }">
|
||||||
<div class="photo-container">
|
<a-image
|
||||||
<!-- 1. 正常显示图片:有地址 且 未标记为错误 -->
|
width="60"
|
||||||
<img
|
|
||||||
v-if="record.photoUrl && !record.photoLoadError"
|
|
||||||
:src="record.photoUrl"
|
: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>
|
||||||
|
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
@@ -72,7 +64,7 @@
|
|||||||
status="danger"
|
status="danger"
|
||||||
:disabled="record.disabled"
|
:disabled="record.disabled"
|
||||||
:title="record.disabled ? '不可删除' : '删除'"
|
:title="record.disabled ? '不可删除' : '删除'"
|
||||||
@click="onDelete(record)"
|
@click="onDeleteOne(record)"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</a-link>
|
</a-link>
|
||||||
@@ -96,6 +88,7 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
|
|||||||
import { useDownload, useTable } from '@/hooks'
|
import { useDownload, useTable } from '@/hooks'
|
||||||
import { isMobile } from '@/utils'
|
import { isMobile } from '@/utils'
|
||||||
import has from '@/utils/has'
|
import has from '@/utils/has'
|
||||||
|
import {Message} from "@arco-design/web-vue";
|
||||||
|
|
||||||
defineOptions({ name: 'MaterialInfo' })
|
defineOptions({ name: 'MaterialInfo' })
|
||||||
|
|
||||||
@@ -113,6 +106,9 @@ const {
|
|||||||
tableData: dataList,
|
tableData: dataList,
|
||||||
loading,
|
loading,
|
||||||
pagination,
|
pagination,
|
||||||
|
selectedKeys,
|
||||||
|
select,
|
||||||
|
selectAll,
|
||||||
search,
|
search,
|
||||||
handleDelete,
|
handleDelete,
|
||||||
} = useTable((page) => listMaterialInfo({ ...queryForm, ...page }), { immediate: true })
|
} = useTable((page) => listMaterialInfo({ ...queryForm, ...page }), { immediate: true })
|
||||||
@@ -143,13 +139,24 @@ const reset = () => {
|
|||||||
search()
|
search()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDelete = (record: MaterialInfoResp) => {
|
const onDeleteOne = (record: MaterialInfoResp) => {
|
||||||
return handleDelete(() => deleteMaterialInfo(record.id), {
|
return handleDelete(() => deleteMaterialInfo(record.id), {
|
||||||
content: `是否确定删除该条数据?`,
|
content: `是否确定删除该条数据?`,
|
||||||
showModal: true,
|
showModal: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const onDelete = () => {
|
||||||
|
if (!selectedKeys.value.length) {
|
||||||
|
return Message.warning('请选择数据')
|
||||||
|
}
|
||||||
|
return handleDelete(() => deleteMaterialInfo(selectedKeys.value), {
|
||||||
|
content: `是否确定删除选中的 ${selectedKeys.value.length} 条数据?`,
|
||||||
|
showModal: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onExport = () => {
|
const onExport = () => {
|
||||||
useDownload(() => exportMaterialInfo(queryForm))
|
useDownload(() => exportMaterialInfo(queryForm))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>该物料重量范围:</label>
|
<label>该物料重量范围:</label>
|
||||||
<a-input v-model="formData.materialName" placeholder="该物料重量范围" disabled />
|
<a-input v-model="formData.weightRange" placeholder="该物料重量范围" disabled />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { Message, Modal, Notification } from '@arco-design/web-vue'
|
||||||
import { getMaterialDetail, validateWeighing, vmSend } from '@/apis/weightManage/weightManage'
|
import { getMaterialDetail, validateWeighing, vmSend } from '@/apis/weightManage/weightManage'
|
||||||
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
|
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
|
||||||
@@ -299,6 +299,7 @@ const formData = reactive({
|
|||||||
materialSpec: '', // 物料规格
|
materialSpec: '', // 物料规格
|
||||||
unitWeight: 0, // 重量
|
unitWeight: 0, // 重量
|
||||||
photoUrl: '', // 样图URL
|
photoUrl: '', // 样图URL
|
||||||
|
weightRange: '', // 物料重量范围
|
||||||
})
|
})
|
||||||
|
|
||||||
const imgData = reactive({
|
const imgData = reactive({
|
||||||
@@ -688,6 +689,7 @@ const originalHandleMaterialCodeChange = async () => {
|
|||||||
formData.materialSpec = ''
|
formData.materialSpec = ''
|
||||||
formData.unitWeight = 0
|
formData.unitWeight = 0
|
||||||
formData.photoUrl = ''
|
formData.photoUrl = ''
|
||||||
|
formData.weightRange = ''
|
||||||
compareMatchResult.value = '';
|
compareMatchResult.value = '';
|
||||||
|
|
||||||
// 如果有物料编码输入,获取物料数据
|
// 如果有物料编码输入,获取物料数据
|
||||||
@@ -747,6 +749,7 @@ const fetchMaterialData = async (code: string) => {
|
|||||||
formData.materialSpec = res.data?.materialSpec || ''
|
formData.materialSpec = res.data?.materialSpec || ''
|
||||||
formData.unitWeight = res.data?.unitWeight || 0
|
formData.unitWeight = res.data?.unitWeight || 0
|
||||||
formData.photoUrl = res.data?.photoUrl || ''
|
formData.photoUrl = res.data?.photoUrl || ''
|
||||||
|
formData.weightRange = (res.data?.downFloatRatio || '-') + '% ~ ' + (res.data?.upFloatRatio || '-') + '%'
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user