This commit is contained in:
itcast 2025-12-12 17:36:56 +08:00
parent 844d783715
commit e274cc8e7f
7 changed files with 190 additions and 64 deletions

View File

@ -57,18 +57,24 @@
<el-input v-model="form.originalValue" placeholder="资产原值(万元)" readonly />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="资产净值(万元)" prop="value">
<el-input v-model="form.value" placeholder="资产净值(万元)" readonly />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="生产厂家" prop="manufacturer">
<el-input v-model="form.manufacturer" placeholder="生产厂家" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="出厂日期" prop="productionDate">
<el-input v-model="form.productionDate" placeholder="出厂日期" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="下次维保日期" prop="nextMaintenanceDate">
<el-input v-model="form.nextMaintenanceDate" placeholder="下次维保日期" readonly />
@ -84,11 +90,7 @@
<el-input clearable maxlength="20" placeholder="最大使用年限" v-model="form.maxServiceLifeYears" readonly />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计数单位" prop="unit">
<el-input v-model="form.unit" placeholder="计数单位" readonly />
</el-form-item>
</el-col>
<!-- <el-col :span="6">
<el-form-item label="管理模式" prop="manageType">
<el-input v-model="form.manageTypeName" placeholder="管理方式" readonly />
@ -101,6 +103,11 @@
<el-input v-model="form.count" placeholder="装备数量" readonly />
</el-form-item>
</el-col> -->
<el-col :span="6">
<el-form-item label="计数单位" prop="unit">
<el-input v-model="form.unit" placeholder="计数单位" readonly />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="采购日期" prop="purchaseDate">
<el-input v-model="form.purchaseDate" placeholder="采购日期" readonly />

View File

@ -804,6 +804,7 @@ export default {
{ key: 17, label: `出厂日期`, prop: 'productionDate', visible: true },
{ key: 18, label: `采购日期`, prop: 'purchaseDate', visible: true },
{ key: 19, label: `资产原值(万元)`, prop: 'originalValue', visible: true },
{ key: 19, label: `资产净值(万元)`, prop: 'value', visible: true },
{ key: 20, label: `最大使用年限(年)`, prop: 'maxServiceLifeYears', visible: true },
{ key: 21, label: `下次维保日期`, prop: 'nextMaintenanceDate', visible: true },
{ key: 22, label: `装备外观`, prop: 'appearanceImages', visible: true },

View File

@ -262,9 +262,42 @@ export default {
)
},
//
// PDF
onHandleDownload() {
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`)
this.downloadPDF('material-mall/decChange/exportDetails', { id: this.recordId }, '出库记录单.pdf');
},
// PDF
async downloadPDF(url, params, fileName) {
try {
// responseTypeblob
const response = await this.$axios({
method: 'post',
url: url,
data: params, // POST
responseType: 'blob', // blob
headers: {
'Content-Type': 'application/json;charset=UTF-8' //
}
});
//
const blob = new Blob([response.data], { type: 'application/pdf' });
const downloadUrl = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = downloadUrl;
link.download = fileName; //
document.body.appendChild(link);
link.click(); //
//
document.body.removeChild(link);
window.URL.revokeObjectURL(downloadUrl);
this.$message.success('PDF导出成功');
} catch (error) {
this.$message.error('PDF导出失败' + (error.message || '未知错误'));
}
},
//

View File

@ -34,7 +34,17 @@
:label="item.proName"
:value="item.proCode"
v-for="item in useProjectList"
/>
style="width: 200px"
>
<el-tooltip
effect="dark"
:content="item.proName"
placement="right"
>
<span class="option-text">{{ item.proName }}</span>
</el-tooltip>
</el-option>
</el-select>
</el-form-item>

View File

@ -85,6 +85,17 @@
<el-col :span="1.5">
<div style="font-size: 20px; font-weight: 800">编码工具台账列表</div>
</el-col>
<el-button
icon="el-icon-download"
style="margin-left: 1250px"
type="primary"
size="mini"
@click="handleExport"
>
导出数据
</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
</el-row>
@ -565,6 +576,17 @@ export default {
if (!val) return
this.getSelectList()
},
/**
* 导出数据
*/
handleExport() {
this.download('/material-mall/toolLedger/export', {
...this.queryParams
}, `编码工具台账_${new Date().getTime()}.xlsx`)
},
//
async getManufacturerSelect() {
try {

View File

@ -7,17 +7,13 @@
<el-cascader
v-model="typeIdList"
:options="options"
:props="{ value: 'typeId', label: 'typeName' }"
:props="{ value: 'typeId', label: 'typeName', checkStrictly: false }"
clearable
@change="handleChange"
style="width: 240px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-plus" :disabled="typeIdList.length == 0" @click="handleAdd"
>点击填充</el-button
>
</el-form-item>
<!-- 移除原来的点击填充按钮 -->
</el-form>
</el-card>
@ -38,9 +34,11 @@
:prop="column.prop"
align="center"
>
<!-- 插槽 -->
<template v-slot="{ row }" v-if="column.prop == 'applyNum'">
<!-- 合并插槽逻辑 v-if + v-else-if 区分不同列的输入框 -->
<template v-slot="{ row }">
<!-- 申请数量输入框 -->
<el-input-number
v-if="column.prop == 'applyNum'"
v-model="row.applyNum"
:min="1"
:max="9999"
@ -48,12 +46,24 @@
:controls="false"
style="width: 120px"
/>
<!-- 单价输入框 -->
<el-input-number
v-else-if="column.prop == 'originCost'"
v-model="row.originCost"
:min="0"
:max="999999.99"
:precision="2"
:controls="false"
style="width: 120px"
/>
<!-- 其他列默认显示文本 -->
<span v-else>{{ row[column.prop] }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="{ row, $index }">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(index)" style="color: red"
>删除</el-button
>删除</el-button
>
</template>
</el-table-column>
@ -84,6 +94,7 @@ export default {
{ label: '工具名称', prop: 'parentTypeName' },
{ label: '规格型号', prop: 'typeName' },
{ label: '计量单位', prop: 'unitName' },
{ label: '单价', prop: 'originCost', width: 150 },
{ label: '申请数量', prop: 'applyNum', width: 150 },
],
dialogList: [],
@ -114,7 +125,7 @@ export default {
handleTree(tree) {
for (const node of tree) {
if (node.level === '5') {
// children
// children
delete node.children
} else if (node.children && node.children.length > 0) {
//
@ -123,12 +134,56 @@ export default {
}
},
handleChange(val) {
console.log('🚀 ~ val:', val)
this.dialogForm.typeId = val ? val[val.length - 1] : ''
console.log('🚀 ~ 选中的节点ID路径:', val)
// 1.
if (!val || val.length === 0) {
this.dialogForm.typeId = ''
this.activeLabels = []
this.lastNode = null
return
}
// 2.
this.dialogForm.typeId = val[val.length - 1]
this.activeLabels = this.getLabelsFromValuePath(val, this.options)
this.lastNode = this.findNodeById(this.options, val[val.length - 1])
console.log('🚀 ~ this.lastNode:', this.lastNode)
console.log('选中的 labels:', this.activeLabels)
this.lastNode = this.findNodeById(this.options, this.dialogForm.typeId)
// 3. level=5
if (this.lastNode?.level === '5') {
this.autoAddToTable()
}
},
// handleAdd
autoAddToTable() {
const typeId = this.dialogForm.typeId
//
if (this.dialogList.some((item) => item.typeId === typeId)) {
this.$message({
type: 'warning',
message: '该工具已添加,请勿重复选择!',
})
return
}
//
const originCost = this.lastNode?.originCost || 0
this.dialogList.unshift({
applyId: this.dialogForm.applyId,
typeId,
fourthParentName: this.activeLabels[0] || '',
greatGrandparentName: this.activeLabels[1] || '',
grandparentTypeName: this.activeLabels[2] || '',
parentTypeName: this.activeLabels[3] || '',
typeName: this.activeLabels[4] || '',
unitName: this.lastNode.unitName || '',
originCost,
applyNum: 1,
})
this.$message({
type: 'success',
message: '工具已添加到列表!',
duration: 1500, //
})
},
getLabelsFromValuePath(valuePath, options) {
let labels = []
@ -155,29 +210,6 @@ export default {
}
return null //
},
handleAdd() {
console.log('🚀 ~ handleAdd:', this.dialogForm.typeId)
const typeId = this.typeIdList[this.typeIdList.length - 1]
if (this.dialogList.some((item) => item.typeId === typeId)) {
this.$message({
type: 'warning',
message: '该工具已添加!',
})
return
}
this.dialogList.unshift({
applyId: this.dialogForm.applyId,
typeId,
fourthParentName: this.activeLabels[0],
greatGrandparentName: this.activeLabels[1],
grandparentTypeName: this.activeLabels[2],
parentTypeName: this.activeLabels[3],
typeName: this.activeLabels[4],
unitName: this.lastNode.unitName,
applyNum: 1,
})
console.log('🚀 ~ this.dialogList:', this.dialogList)
},
handleDelete(index) {
this.dialogList.splice(index, 1)
this.$message({

View File

@ -77,6 +77,15 @@
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button> -->
<div style="font-size: 20; font-weight: 800">工具台账列表</div>
</el-col>
<el-button
icon="el-icon-download"
style="margin-left: 1250px"
type="primary"
size="mini"
@click="handleExport"
>
导出数据
</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
</el-row>
@ -464,21 +473,33 @@ export default {
}
},
//
// handleExport() {
// //
// this.$message({
// type: 'warning',
// message: '',
// })
// try {
// let fileName = `_${formatTime(new Date())}.xLsx`
// let url = '/material/backstage/costPush/exportPushCheck'
// const params = { ...this.queryParams }
// // this.download(url, params, fileName)
// } catch (error) {
// console.log('', error)
// }
// },
/**
* 导出数据
*/
handleExport() {
//
this.$message({
type: 'warning',
message: '导出功能开发中,敬请期待!',
})
try {
let fileName = `导出_${formatTime(new Date())}.xLsx`
let url = '/material/backstage/costPush/exportPushCheck'
const params = { ...this.queryParams }
// this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
this.download('/material-mall/toolLedger/exportAll', {
...this.queryParams
}, `工具台账_${new Date().getTime()}.xlsx`)
},
},
}
</script>