作者 lixiang

1、物料管理修改

2、库存管理修改
... ... @@ -5,11 +5,21 @@
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="物料编码">
<a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="物料长描述">
<a-input placeholder="请输入物料长描述" v-model="queryParam.materialDescription"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="品牌">
<a-input placeholder="请输入品牌" v-model="queryParam.brand"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
... ...
... ... @@ -5,18 +5,26 @@
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="物料编码">
<a-input placeholder="请输入物料编码" v-model="queryParam.meterialCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="物料长描述">
<a-input placeholder="请输入物料长描述" v-model="queryParam.meterialReview"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="品牌">
<a-input placeholder="请输入品牌" v-model="queryParam.brand"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</a-row>
... ... @@ -27,19 +35,11 @@
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button type="primary" icon="download" @click="handleExportXls('贸易管理物料表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload> -->
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
... ... @@ -63,7 +63,8 @@
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<div v-else>
{{text}}
<!-- {{text}}-->
<span :title="text">{{ text.length > 20 ? text.substring(0, 20) + '...' : text }}</span>
<a-button
:ghost="true"
type="primary"
... ... @@ -107,6 +108,7 @@
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TblTradeMeterialModal from './modules/TblTradeMeterialModal'
import { getFileAccessHttpUrl } from '@api/manage'
export default {
name: 'TblTradeMeterialList',
... ... @@ -156,12 +158,9 @@
scopedSlots: {customRender: 'fileSlot'}
},
{
title:'日期时间',
title:'型号变更说明上传时间',
align:"center",
dataIndex: 'modelChangeDate',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'合格证',
... ... @@ -170,12 +169,9 @@
scopedSlots: {customRender: 'fileSlot'}
},
{
title:'日期时间',
title:'合格证上传时间',
align:"center",
dataIndex: 'certDate',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'其他',
... ... @@ -184,12 +180,9 @@
scopedSlots: {customRender: 'fileSlot'}
},
{
title:'日期时间',
title:'其他文件上传时间',
align:"center",
dataIndex: 'otherDate',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title: '操作',
... ... @@ -221,6 +214,65 @@
},
},
methods: {
downloadFile(text) {
if (!text) {
this.$message.warning("未知的文件");
return;
}
// 将 text 按逗号分割成多个文件的 URL
const fileUrls = text.split(",");
// 遍历每个文件的 URL
fileUrls.forEach((fileUrl, index) => {
// 去除 URL 两端的空格
fileUrl = fileUrl.trim();
// 检查 URL 是否有效
if (!fileUrl) {
this.$message.warning(`第 ${index + 1} 个文件 URL 无效`);
return; // 跳过当前文件,继续下一个
}
// 生成文件访问 URL
let url = getFileAccessHttpUrl(fileUrl);
// 检查生成的 URL 是否有效
if (!url) {
this.$message.warning(`第 ${index + 1} 个文件无法生成访问链接`);
return; // 跳过当前文件,继续下一个
}
// 使用 fetch 下载文件
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`第 ${index + 1} 个文件下载失败`);
}
return response.blob(); // 将响应转换为 Blob 对象
})
.then(blob => {
// 创建 Blob URL
const blobUrl = URL.createObjectURL(blob);
// 创建 <a> 标签并触发下载
const link = document.createElement("a");
link.href = blobUrl;
link.download = fileUrl; // 替换为实际文件名
link.style.display = "none";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// 释放 Blob URL
URL.revokeObjectURL(blobUrl);
})
.catch(error => {
this.$message.error(`第 ${index + 1} 个文件下载失败`);
console.error(`下载错误:`, error);
});
});
},
initDictConfig(){
},
getSuperFieldList(){
... ...
... ... @@ -90,10 +90,18 @@
},
confirmLoading: false,
validatorRules: {
meterialCode: [
{ required: false},
{ validator: (rule, value, callback) => validateDuplicateValue('tbl_trade_meterial', 'meterial_code', value, this.model.id, callback)},
],
// meterialCode: [
// { required: false},
// { validator: (rule, value, callback) => validateDuplicateValue('tbl_trade_meterial', 'meterial_code', value, this.model.id, callback)},
// ],
meterialCode: [{ required: true, message: '请输入物料编码!' }],
meterialReview: [{ required: true, message: '请输入物料长描述!' }],
unit: [{ required: true, message: '请输入单位!' }],
brand: [{ required: true, message: '请输入品牌!' }],
// modelChange: [{ required: true, message: '请输入型号变更说明!' }],
// cert: [{ required: true, message: '请输入合格证!' }],
// other: [{ required: true, message: '请输入物料编码!' }],
},
url: {
add: "/trade/tblTradeMeterial/add",
... ...