This commit is contained in:
itcast 2025-11-26 17:05:11 +08:00
parent 1ae12a2609
commit 6c5a60748d
6 changed files with 353 additions and 73 deletions

View File

@ -137,6 +137,7 @@
<th>规格型号</th>
<th>装备编码</th>
<th>数量</th>
<th>使用到期时间</th>
</tr>
</thead>
<tbody>
@ -147,6 +148,11 @@
<td>{{ item.devModel }}</td>
<td>{{ item.devCode }}</td>
<td>{{item.devNum}}</td>
<td>
{{ item.useStartTime ? item.useStartTime : '-' }}
{{ item.useEndTime ? item.useEndTime : '-' }}
</td>
</tr>
</tbody>
</table>

View File

@ -140,6 +140,8 @@
<th>规格型号</th>
<th>装备编码</th>
<th>数量</th>
<th>最大使用年限</th>
<th>剩余使用年限</th>
</tr>
</thead>
<tbody>
@ -150,6 +152,8 @@
<td>{{ item.devModel }}</td>
<td>{{ item.devCode }}</td>
<td>{{item.devNum}}</td>
<td>{{item.maxWorkingHours}}</td>
<td>{{item.remainingHours}}</td>
</tr>
</tbody>
</table>

View File

@ -124,6 +124,7 @@
<th>规格型号</th>
<th>装备编码</th>
<th>数量</th>
<th>使用到期时间</th>
</tr>
</thead>
<tbody>
@ -134,6 +135,11 @@
<td>{{ item.devModel }}</td>
<td>{{ item.devCode }}</td>
<td>{{item.devNum}}</td>
<td>
{{ item.useStartTime ? item.useStartTime : '-' }}
{{ item.useEndTime ? item.useEndTime : '-' }}
</td>
</tr>
</tbody>
</table>

View File

@ -153,7 +153,7 @@
<el-table-column align="center" prop="feature1" label="特征项1"/>
<el-table-column align="center" prop="featureValue1" label="特征值1"/>
<el-table-column align="center" label="操作" :width="220">
<el-table-column align="center" label="操作" :width="199" fixed="right">
<template slot-scope="scope">
<el-popconfirm
width="220"

View File

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="auto">
<el-form-item label="厂家编号" prop="supplierCode">
<el-input
v-model="queryParams.supplierCode"
@ -41,45 +41,49 @@
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 120px;">
<el-form-item label="状态" prop="status" >
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 215px;">
<el-option label="启用" :value="1" />
<el-option label="停用" :value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-form-item style="margin-left: 10px">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['machinery:type:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<div class="action-bar">
<el-row :gutter="10" style="margin-bottom: 10px">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['machinery:type:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
</div>
<el-table v-loading="loading" :data="houseList" ref="multipleTable" row-key="supplierId">
@ -772,7 +776,7 @@
},
handleExport() {
this.download('/material/wh_house_info/export', {
this.download('/material-mall/ma_supplier_info/export', {
...this.queryParams
}, `仓库管理_${new Date().getTime()}.xlsx`)
},
@ -866,4 +870,13 @@
color: #fff;
font-size: 20px;
}
/* 新增:统一的操作栏容器样式,用于将所有按钮和工具栏放在右侧 */
.action-bar {
display: flex;
align-items: center;
justify-content: flex-end !important; /* 关键:整体内容靠右对齐 */
gap: 10px; /* 统一设置内部元素的间距 */
width: 100%;
}
</style>

View File

@ -65,7 +65,7 @@
<el-form-item label="工具编码" prop="toolCode">
<el-input
v-model="queryParams.toolCode"
placeholder="请输入规格型号"
placeholder="请输入工具编码"
clearable
@keyup.enter.native="handleQuery"
style="width: 240px"
@ -73,7 +73,7 @@
</el-form-item>
<!-- 表单按钮 -->
<el-form-item style="margin-left:1100px">
<el-form-item style="margin-left: 1100px">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
</el-form-item>
@ -154,7 +154,7 @@
<el-form-item label="施工类型" prop="greatGrandparentName">
<el-input
v-model="dialogForm.greatGrandparentName"
placeholder="请输入工具专业"
placeholder="请输入施工类型"
readonly
style="width: 240px"
/>
@ -162,19 +162,19 @@
<el-form-item label="工具类型" prop="grandparentTypeName">
<el-input
v-model="dialogForm.grandparentTypeName"
placeholder="请输入工具专业"
placeholder="请输入工具类型"
readonly
style="width: 240px"
/>
</el-form-item>
<el-form-item label="工具名称" prop="parentTypeName">
<el-input v-model="dialogForm.parentTypeName" placeholder="请输入工具专业" readonly style="width: 240px" />
<el-input v-model="dialogForm.parentTypeName" placeholder="请输入工具名称" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="规格型号" prop="typeName">
<el-input v-model="dialogForm.typeName" placeholder="请输入工具专业" readonly style="width: 240px" />
<el-input v-model="dialogForm.typeName" placeholder="请输入规格型号" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="工具编码" prop="toolCode">
<el-input v-model="dialogForm.toolCode" placeholder="请输入工具专业" readonly style="width: 240px" />
<el-input v-model="dialogForm.toolCode" placeholder="请输入工具编码" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="计量单位" prop="unitName">
<el-select v-model="dialogForm.unitName" placeholder="请选择计量单位" clearable style="width: 240px">
@ -242,7 +242,7 @@
/>
</el-form-item>
<el-form-item label="工具状态">
<el-input v-model="dialogForm.identifyCode" readonly style="width: 240px" />
<el-input v-model="dialogForm.statusName" readonly style="width: 240px" />
</el-form-item>
<div v-for="(item, index) in dialogForm.propertyVoList" :key="index">
<el-form-item label="特征项">
@ -266,15 +266,89 @@
</div>
</el-form-item>
</div>
<!-- 附件区域仅修改这里的图标显示 -->
<el-form-item label="附件" prop="fileList">
<FileUpload
v-model="dialogForm.fileList"
:value="dialogForm.fileList"
:limit="9"
:fileType="['doc', 'xls', 'pdf', 'jpg', 'jpeg', 'png']"
:isView="isView"
@input="handleImage"
/>
<div class="custom-file-upload">
<el-upload
multiple
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="dialogForm.fileList"
:limit="9"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:show-file-list="false"
:headers="headers"
ref="fileUpload"
:disabled="isView"
>
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传大小不超过5MB格式为 docxlspdfjpgjpegpng 的文件
</div>
</el-upload>
<!-- 文件列表图标统一靠左 -->
<transition-group class="upload-file-list" name="el-fade-in-linear" tag="ul">
<li
:key="file.uid"
class="file-item"
v-for="(file, index) in dialogForm.fileList"
>
<!-- 图标统一靠左 -->
<div class="file-icon-container">
<img
v-if="isPdfFile(file)"
src="@/assets/images/pdf.png"
class="file-type-icon"
alt="PDF文件"
/>
<img
v-else-if="isWordFile(file)"
src="@/assets/images/word.png"
class="file-type-icon"
alt="Word文件"
/>
<img
v-else-if="isExcelFile(file)"
src="@/assets/images/pdf.png"
class="file-type-icon"
alt="Excel文件"
/>
<img
v-else-if="isImageFile(file)"
src="@/assets/images/pdf.png"
class="file-type-icon"
alt="图片文件"
/>
<i v-else class="el-icon-file file-default-icon"></i>
</div>
<el-link
:href="file.url"
:underline="false"
target="_blank"
class="file-name-link"
>
{{ getFileName(file.name) }}
</el-link>
<div class="file-action">
<el-link
v-if="!isView"
:underline="false"
@click.stop="handleDeleteFile(index)"
type="danger"
>
删除
</el-link>
</div>
</li>
</transition-group>
</div>
</el-form-item>
</el-form>
@ -289,12 +363,11 @@
<script>
import { getListCodeApi, getToolSelectApi, updateByIdApi } from '@/api/toolsManage'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger'
import FileUpload from '@/components/FileUpload'
import { getToken } from '@/utils/auth'
export default {
name: 'CodeToolsLedger',
dicts: ['dev_unit_type'],
components: { FileUpload },
data() {
return {
isLoading: false,
@ -330,21 +403,18 @@ export default {
prop: "status",
width: 120,
render: (h, { row }) => {
// el-tag
// switch/case
const statusOptions = {
0: { text: "在库", type: "success" },
1: { text: "在用", type: "info" },
2: { text: "在修", type: "warning" },
3: { text: "已报废", type: "danger" },
};
//
const option = statusOptions[row.status] || {
text: "未知状态",
type: "",
};
return h(
"el-tag", // 1. el-tag
"el-tag",
{
props: {
type: option.type,
@ -355,7 +425,6 @@ export default {
);
},
},
{ label: '下次检验时间', prop: 'nextCheckDate' },
{ label: '生产厂家', prop: 'supplierName', width: 200 },
{ label: '出厂日期', prop: 'productionDate' },
@ -380,10 +449,20 @@ export default {
originCost: null,
identifyCode: '',
nextCheckDate: '',
statusName: '',
propertyVoList: [],
fileList: null,
fileList: [], //
},
manufacturerSelect: [],
// FileUpload
uploadFileUrl: process.env.VUE_APP_BASE_API + '/file/upload', //
headers: {
Authorization: 'Bearer ' + getToken()
},
fileSize: 5, // (MB)
fileType: ['doc', 'xls', 'pdf', 'jpg', 'jpeg', 'png'], //
showTip: true, //
number: 0, //
}
},
created() {
@ -482,34 +561,135 @@ export default {
}
},
handleDialog(row, type) {
this.dialogTitle = type ? '编码设备管理' : '编码设备详情'
this.dialogTitle = type ? '编码设备详情' : '编码设备编辑'
this.isView = type
this.dialogVisible = true
this.getManufacturerSelect()
this.$nextTick(() => {
this.$refs.dialogForm.resetFields()
this.dialogForm = { ...this.dialogForm, ...row }
if (!this.dialogForm.propertyVoList || this.dialogForm.propertyVoList.length == 0) {
this.dialogForm.propertyVoList = [
{
propertyName: '',
propertyValue: '',
},
]
//
this.dialogForm = { ...this.dialogForm, ...JSON.parse(JSON.stringify(row)) }
//
const statusMap = { 0: '在库', 1: '在用', 2: '在修', 3: '已报废' }
this.dialogForm.statusName = statusMap[this.dialogForm.status] || '未知状态'
// fileList
if (!Array.isArray(this.dialogForm.fileList)) {
this.dialogForm.fileList = this.dialogForm.fileList ?
this.dialogForm.fileList.split(',').map(url => ({
name: url.split('/').pop(),
url: url,
uid: new Date().getTime() + Math.random()
})) : []
} else {
// uid
this.dialogForm.fileList = this.dialogForm.fileList.map(file => ({
...file,
uid: file.uid || new Date().getTime() + Math.random()
}))
}
console.log('🚀 ~ this.dialogForm:', this.dialogForm)
})
},
handleImage(file) {
console.log('🚀 ~ file:', file)
console.log('🚀 ~ file.url:', this.dialogForm.fileList)
// FileUpload
handleBeforeUpload(file) {
//
if (this.fileType) {
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isTypeOk = this.fileType.indexOf(fileExt) >= 0
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`)
return false
}
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false
}
}
this.number++
return true
},
// FileUpload
handleExceed() {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`)
},
// FileUpload
handleUploadError(err) {
this.$message.error('上传文件失败,请重试')
this.number--
},
// FileUpload
handleUploadSuccess(res, file) {
if (res.code === 200) {
const newFile = {
name: res.data.url.split('/').pop(),
url: res.data.url,
uid: file.uid
}
this.dialogForm.fileList.push(newFile)
this.$message.success('文件上传成功')
} else {
this.$message.error(res.msg || '上传失败')
}
this.number--
},
//
handleDeleteFile(index) {
this.$confirm('确定要删除该文件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.dialogForm.fileList.splice(index, 1)
this.$message.success('文件删除成功')
}).catch(() => {
//
})
},
// FileUpload
getFileName(name) {
if (name.lastIndexOf('/') > -1) {
return name.slice(name.lastIndexOf('/') + 1)
} else {
return name
}
},
// PDF
isPdfFile(file) {
const fileName = this.getFileName(file.name || '')
return fileName.toLowerCase().endsWith('.pdf')
},
// Word
isWordFile(file) {
const fileName = this.getFileName(file.name || '')
return fileName.toLowerCase().endsWith('.doc') || fileName.toLowerCase().endsWith('.docx')
},
// Excel
isExcelFile(file) {
const fileName = this.getFileName(file.name || '')
return fileName.toLowerCase().endsWith('.xls') || fileName.toLowerCase().endsWith('.xlsx')
},
//
isImageFile(file) {
const fileName = this.getFileName(file.name || '')
const ext = fileName.toLowerCase().split('.').pop()
return ['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext)
},
async submit() {
console.log('🚀 ~ methods.submit:', this.dialogForm)
this.isLoading = true
try {
await updateByIdApi(this.dialogForm)
//
const submitForm = {
...this.dialogForm,
fileList: this.dialogForm.fileList.map(file => file.url).join(',')
}
await updateByIdApi(submitForm)
this.$message({
type: 'success',
message: '操作成功!',
@ -518,6 +698,7 @@ export default {
this.getList()
} catch (error) {
console.log('🚀 ~ error:', error)
this.$message.error('操作失败,请重试')
} finally {
this.isLoading = false
}
@ -527,7 +708,77 @@ export default {
</script>
<style lang="scss" scoped>
::v-deep .el-input-number.is-without-controls .el-input__inner {
text-align: left;
//
.custom-file-upload {
width: 100%;
}
//
::v-deep .el-upload__tip {
margin-bottom: 10px;
color: #606266;
}
//
.upload-file-list {
list-style: none;
padding: 0;
margin: 0;
}
//
.file-item {
display: flex;
align-items: center;
padding: 8px 12px;
border: 1px solid #e4e7ed;
border-radius: 4px;
margin-bottom: 8px;
width: 100%;
box-sizing: border-box;
}
//
.file-icon-container {
width: 24px; // 线
display: flex;
justify-content: flex-start; //
margin-right: 10px;
}
//
.file-type-icon {
width: 18px;
height: 18px;
object-fit: contain;
}
.file-default-icon {
font-size: 18px;
color: #606266;
}
//
.file-name-link {
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left; //
}
//
.file-action {
margin-left: 10px;
white-space: nowrap; //
}
//
::v-deep .file-action .el-link {
color: #f56c6c;
&:hover {
color: #ff4d4f;
}
}
</style>