工具台账

This commit is contained in:
bb_pan 2025-11-20 17:53:14 +08:00
parent adc575011b
commit db071d2c2d
2 changed files with 49 additions and 15 deletions

View File

@ -143,3 +143,20 @@ export const updateByIdApi = (data = {}) => {
data: data, data: data,
}) })
} }
// 工具详情-弹框
export const getToolByTypeIdApi = (data = {}) => {
return request({
url: '/material-mall/toolLedger/getToolByTypeId',
method: 'GET',
params: data,
})
}
export const getToolByProApi = (data = {}) => {
return request({
url: '/material-mall/toolLedger/getToolByPro',
method: 'GET',
params: data,
})
}

View File

@ -191,7 +191,7 @@
</template> </template>
<script> <script>
import { getToolLedgerListApi, getToolSelectApi } from '@/api/toolsManage' import { getToolLedgerListApi, getToolSelectApi, getToolByTypeIdApi, getToolByProApi } from '@/api/toolsManage'
import { formatTime } from '@/utils/bonus' import { formatTime } from '@/utils/bonus'
export default { export default {
@ -253,7 +253,7 @@ export default {
'span', 'span',
{ {
style: { color: '#409EFF', cursor: 'pointer' }, style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, '1') }, on: { click: () => this.handleDialog(row, '3') },
}, },
row.inNum, row.inNum,
) )
@ -285,7 +285,7 @@ export default {
'span', 'span',
{ {
style: { color: '#409EFF', cursor: 'pointer' }, style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, '0') }, on: { click: () => this.handleDialog(row, '2') },
}, },
row.repairNum, row.repairNum,
) )
@ -315,8 +315,20 @@ export default {
dialogColumns: [ dialogColumns: [
{ label: '工具名称', prop: 'parentTypeName' }, { label: '工具名称', prop: 'parentTypeName' },
{ label: '规格型号', prop: 'typeName' }, { label: '规格型号', prop: 'typeName' },
{ label: '设备编码', prop: 'maCode' }, {
{ label: '数量', prop: 'num' }, label: '设备编码',
prop: 'toolCode',
render: (h, { row }) => {
return row.toolCode ? h('span', {}, row.toolCode) : h('span', {}, '-')
},
},
{
label: '数量',
prop: 'totalNum',
render: (h, { row }) => {
return row.totalNum ? h('span', {}, row.totalNum) : h('span', {}, '1')
},
},
{ label: '所在工程', prop: 'proName' }, { label: '所在工程', prop: 'proName' },
], ],
dialogList: [], dialogList: [],
@ -401,13 +413,12 @@ export default {
this.getSelectList() this.getSelectList()
}, },
handleDialog(row, type) { handleDialog(row, type) {
console.log('🚀 ~ type:', type == 0)
this.dialogTitle = '工具详情' this.dialogTitle = '工具详情'
if (type == 0) { if (type == 0 || type == 2) {
this.dialogColumns = this.dialogColumns.filter(item => item.prop != 'proName') this.dialogColumns = this.dialogColumns.filter((item) => item.prop != 'proName')
console.log('🚀 ~ this.dialogColumns:', this.dialogColumns) console.log('🚀 ~ this.dialogColumns:', this.dialogColumns)
} else { } else {
if (!this.dialogColumns.some(item => item.prop == 'proName')) { if (!this.dialogColumns.some((item) => item.prop == 'proName')) {
this.dialogColumns.push({ label: '所在工程', prop: 'proName' }) this.dialogColumns.push({ label: '所在工程', prop: 'proName' })
} }
} }
@ -416,8 +427,7 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.dialogForm.resetFields() this.$refs.dialogForm.resetFields()
this.dialogForm.typeId = row.typeId this.dialogForm.typeId = row.typeId
this.dialogForm.startTime = this.queryParams.timeRange ? this.queryParams.timeRange[0] : '' this.dialogForm.type = type
this.dialogForm.endTime = this.queryParams.timeRange ? this.queryParams.timeRange[1] : ''
this.getDialogList() this.getDialogList()
}, 100) }, 100)
}, },
@ -438,9 +448,16 @@ export default {
try { try {
this.isLoading = true this.isLoading = true
const params = { ...this.dialogForm } const params = { ...this.dialogForm }
const res = await getInventoryLogDetailsApi(params) let res = null
this.dialogList = res.data.rows || [] if (this.dialogForm.type == '0' || this.dialogForm.type == '2') {
this.dlgTotal = res.data.total || 0 params.status = this.dialogForm.type
res = await getToolByTypeIdApi(params)
} else {
params.status = this.dialogForm.type == '3' ? '0' : '1'
res = await getToolByProApi(params)
}
this.dialogList = res.rows || []
this.dlgTotal = res.total || 0
} catch (error) { } catch (error) {
} finally { } finally {
this.isLoading = false this.isLoading = false