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

View File

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

View File

@ -262,9 +262,42 @@ export default {
) )
}, },
// // PDF
onHandleDownload() { 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" :label="item.proName"
:value="item.proCode" :value="item.proCode"
v-for="item in useProjectList" 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-select>
</el-form-item> </el-form-item>

View File

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

View File

@ -7,17 +7,13 @@
<el-cascader <el-cascader
v-model="typeIdList" v-model="typeIdList"
:options="options" :options="options"
:props="{ value: 'typeId', label: 'typeName' }" :props="{ value: 'typeId', label: 'typeName', checkStrictly: false }"
clearable clearable
@change="handleChange" @change="handleChange"
style="width: 240px" style="width: 240px"
/> />
</el-form-item> </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-form>
</el-card> </el-card>
@ -38,9 +34,11 @@
:prop="column.prop" :prop="column.prop"
align="center" align="center"
> >
<!-- 插槽 --> <!-- 合并插槽逻辑 v-if + v-else-if 区分不同列的输入框 -->
<template v-slot="{ row }" v-if="column.prop == 'applyNum'"> <template v-slot="{ row }">
<!-- 申请数量输入框 -->
<el-input-number <el-input-number
v-if="column.prop == 'applyNum'"
v-model="row.applyNum" v-model="row.applyNum"
:min="1" :min="1"
:max="9999" :max="9999"
@ -48,12 +46,24 @@
:controls="false" :controls="false"
style="width: 120px" 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> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="{ row, $index }"> <template slot-scope="{ row, $index }">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(index)" style="color: red" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(index)" style="color: red"
>删除</el-button >删除</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
@ -84,6 +94,7 @@ export default {
{ label: '工具名称', prop: 'parentTypeName' }, { label: '工具名称', prop: 'parentTypeName' },
{ label: '规格型号', prop: 'typeName' }, { label: '规格型号', prop: 'typeName' },
{ label: '计量单位', prop: 'unitName' }, { label: '计量单位', prop: 'unitName' },
{ label: '单价', prop: 'originCost', width: 150 },
{ label: '申请数量', prop: 'applyNum', width: 150 }, { label: '申请数量', prop: 'applyNum', width: 150 },
], ],
dialogList: [], dialogList: [],
@ -114,7 +125,7 @@ export default {
handleTree(tree) { handleTree(tree) {
for (const node of tree) { for (const node of tree) {
if (node.level === '5') { if (node.level === '5') {
// children // children
delete node.children delete node.children
} else if (node.children && node.children.length > 0) { } else if (node.children && node.children.length > 0) {
// //
@ -123,12 +134,56 @@ export default {
} }
}, },
handleChange(val) { handleChange(val) {
console.log('🚀 ~ val:', val) console.log('🚀 ~ 选中的节点ID路径:', val)
this.dialogForm.typeId = val ? val[val.length - 1] : '' // 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.activeLabels = this.getLabelsFromValuePath(val, this.options)
this.lastNode = this.findNodeById(this.options, val[val.length - 1]) this.lastNode = this.findNodeById(this.options, this.dialogForm.typeId)
console.log('🚀 ~ this.lastNode:', this.lastNode)
console.log('选中的 labels:', this.activeLabels) // 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) { getLabelsFromValuePath(valuePath, options) {
let labels = [] let labels = []
@ -155,29 +210,6 @@ export default {
} }
return null // 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) { handleDelete(index) {
this.dialogList.splice(index, 1) this.dialogList.splice(index, 1)
this.$message({ this.$message({

View File

@ -77,6 +77,15 @@
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button> --> <!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button> -->
<div style="font-size: 20; font-weight: 800">工具台账列表</div> <div style="font-size: 20; font-weight: 800">工具台账列表</div>
</el-col> </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" /> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
</el-row> </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() { handleExport() {
// this.download('/material-mall/toolLedger/exportAll', {
this.$message({ ...this.queryParams
type: 'warning', }, `工具台账_${new Date().getTime()}.xlsx`)
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)
}
}, },
}, },
} }
</script> </script>