工具台账
This commit is contained in:
parent
59487663c9
commit
ef8141e8df
|
|
@ -0,0 +1,19 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 工具台账-列表
|
||||
export const getToolLedgerListApi = (data = {}) => {
|
||||
return request({
|
||||
url: '/material-mall/toolLedger/list',
|
||||
method: 'GET',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 类型下拉
|
||||
export const getToolSelectApi = (data = {}) => {
|
||||
return request({
|
||||
url: '/material-mall/tool/getSelect',
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ export default {
|
|||
handleUpdate(row) {
|
||||
console.log('🚀 ~ row:', row)
|
||||
this.reset()
|
||||
this.form = row
|
||||
this.form = { ...row }
|
||||
this.open = true
|
||||
this.title = '修改'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,461 @@
|
|||
<template>
|
||||
<!-- 基础页面 -->
|
||||
<div class="app-container">
|
||||
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
|
||||
<el-form-item label="工具专业" prop="fourthParentId">
|
||||
<el-select
|
||||
v-model="queryParams.fourthParentId"
|
||||
placeholder="请选择工具专业"
|
||||
clearable
|
||||
filterable
|
||||
@change="(val) => changeType(val, '2')"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in fourthParentList" :key="item.id" :label="item.label" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="施工类型" prop="greatGrandparentId">
|
||||
<el-select
|
||||
v-model="queryParams.greatGrandparentId"
|
||||
placeholder="请选择施工类型"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!queryParams.fourthParentId"
|
||||
@change="(val) => changeType(val, '3')"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in greatGrandparentList" :key="item.id" :label="item.label" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具类型" prop="grandparentTypeId">
|
||||
<el-select
|
||||
v-model="queryParams.grandparentTypeId"
|
||||
placeholder="请选择工具类型"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!queryParams.greatGrandparentId"
|
||||
@change="(val) => changeType(val, '4')"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in grandparentTypeList" :key="item.id" :label="item.label" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工具名称" prop="parentTypeId">
|
||||
<el-select
|
||||
v-model="queryParams.parentTypeId"
|
||||
placeholder="请选择工具名称"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!queryParams.grandparentTypeId"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option v-for="item in parentTypeList" :key="item.id" :label="item.label" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="typeName">
|
||||
<el-input
|
||||
v-model="queryParams.typeName"
|
||||
placeholder="请输入规格型号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 表单按钮 -->
|
||||
<el-form-item style="display: flex; justify-content: flex-end">
|
||||
<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>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- <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>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="tableList"
|
||||
highlight-current-row
|
||||
border
|
||||
stripe
|
||||
:max-height="650"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="(column, index) in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- render插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<component :is="column.render ? { render: (h) => column.render(h, { row }) } : 'span'">
|
||||
{{ !column.render ? row[column.prop] : '' }}
|
||||
</component>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 弹框 -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="70%">
|
||||
<el-form ref="dialogForm" :model="dialogForm" label-width="" size="small" inline @submit.native.prevent>
|
||||
<el-form-item label="关键字" prop="keyWord">
|
||||
<el-input v-model="dialogForm.keyWord" placeholder="请输入关键字" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleDialogQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleDialogReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
:data="dialogList"
|
||||
fit
|
||||
highlight-current-row
|
||||
v-loading="isLoading"
|
||||
:max-height="500"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="55"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="(index) => (dialogForm.pageNum - 1) * dialogForm.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="(column, index) in dialogColumns"
|
||||
:width="column.width"
|
||||
:show-overflow-tooltip="!column.unShowTooltip"
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- render插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<component :is="column.render ? { render: (h) => column.render(h, { row }) } : 'span'">
|
||||
{{ !column.render ? row[column.prop] : '' }}
|
||||
</component>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" align="center" width="100">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" plain icon="el-icon-zoom-in" @click="">查看</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-show="dlgTotal > 0"
|
||||
:total="dlgTotal"
|
||||
:page.sync="dialogForm.pageNum"
|
||||
:limit.sync="dialogForm.pageSize"
|
||||
@pagination="getDialogList"
|
||||
/>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToolLedgerListApi, getToolSelectApi } from '@/api/toolsManage'
|
||||
import { formatTime } from '@/utils/bonus'
|
||||
|
||||
export default {
|
||||
name: 'ToolsLedger',
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
showSearch: true,
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() > Date.now()
|
||||
},
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
parentId: '0',
|
||||
level: '1',
|
||||
fourthParentId: null, // 工具专业
|
||||
greatGrandparentId: null, // 施工类型
|
||||
grandparentTypeId: null, // 工具类型
|
||||
parentTypeId: null, // 工具名称
|
||||
typeName: null, // 规格型号
|
||||
},
|
||||
fourthParentList: [],
|
||||
greatGrandparentList: [],
|
||||
grandparentTypeList: [],
|
||||
parentTypeList: [],
|
||||
total: 0, // 总条数
|
||||
// 表头
|
||||
tableColumns: [
|
||||
{ label: '工具专业', prop: 'fourthParentName' },
|
||||
{ label: '施工类型', prop: 'greatGrandparentName' },
|
||||
{ label: '工具类型', prop: 'grandparentTypeName' },
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{
|
||||
label: '在库数量',
|
||||
prop: 'stockQuantity',
|
||||
render: (h, { row }) => {
|
||||
return row.manageType == 1 && row.stockQuantity > 0
|
||||
? h(
|
||||
'span',
|
||||
{
|
||||
style: { color: '#409EFF', cursor: 'pointer' },
|
||||
on: { click: () => this.handleDialog(row, 'out') },
|
||||
},
|
||||
row.stockQuantity,
|
||||
)
|
||||
: h('span', {}, row.stockQuantity)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '自用数量',
|
||||
prop: 'selfUseQuantity',
|
||||
render: (h, { row }) => {
|
||||
return row.selfUseQuantity > 0
|
||||
? h(
|
||||
'span',
|
||||
{
|
||||
style: { color: '#409EFF', cursor: 'pointer' },
|
||||
on: { click: () => this.handleDialog(row, '1') },
|
||||
},
|
||||
row.selfUseQuantity,
|
||||
)
|
||||
: h('span', {}, row.selfUseQuantity)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '共享数量',
|
||||
prop: 'shareQuantity',
|
||||
render: (h, { row }) => {
|
||||
return row.shareQuantity > 0
|
||||
? h(
|
||||
'span',
|
||||
{
|
||||
style: { color: '#409EFF', cursor: 'pointer' },
|
||||
on: { click: () => this.handleDialog(row, '1') },
|
||||
},
|
||||
row.shareQuantity,
|
||||
)
|
||||
: h('span', {}, row.shareQuantity)
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '在修数量',
|
||||
prop: 'repairingQuantity',
|
||||
render: (h, { row }) => {
|
||||
return row.manageType == 1 && row.repairingQuantity > 0
|
||||
? h(
|
||||
'span',
|
||||
{
|
||||
style: { color: '#409EFF', cursor: 'pointer' },
|
||||
on: { click: () => this.handleDialog(row, '1') },
|
||||
},
|
||||
row.repairingQuantity,
|
||||
)
|
||||
: h('span', {}, row.repairingQuantity)
|
||||
},
|
||||
},
|
||||
{ label: '工具总数', prop: 'count' },
|
||||
{
|
||||
label: '管理模式',
|
||||
prop: 'manageType',
|
||||
render: (h, { row }) => {
|
||||
return row.manageType == '0' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
|
||||
},
|
||||
},
|
||||
],
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
isOut: false, // 是否出库
|
||||
dialogTitle: '详情',
|
||||
dialogVisible: false,
|
||||
dialogForm: {
|
||||
keyWord: '',
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
dlgTotal: 0, // 弹框总条数
|
||||
dialogColumns: [
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{ label: '设备编码', prop: 'maCode' },
|
||||
{ label: '数量', prop: 'num' },
|
||||
{ label: '所在工程', prop: 'proName' },
|
||||
],
|
||||
dialogList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getSelectList()
|
||||
},
|
||||
methods: {
|
||||
// 查询
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.parentId = '0'
|
||||
this.queryParams.level = '1'
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
console.log('列表-查询', this.queryParams)
|
||||
this.isLoading = true
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getToolLedgerListApi(params)
|
||||
this.tableList = res.rows || []
|
||||
this.total = res.total || 0
|
||||
} catch (error) {
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 下拉
|
||||
async getSelectList() {
|
||||
try {
|
||||
const params = { ...this.queryParams }
|
||||
const res = await getToolSelectApi(params)
|
||||
if (this.queryParams.level == '1') {
|
||||
this.fourthParentList = res.data || []
|
||||
} else if (this.queryParams.level == '2') {
|
||||
this.greatGrandparentList = res.data || []
|
||||
} else if (this.queryParams.level == '3') {
|
||||
this.grandparentTypeList = res.data || []
|
||||
} else if (this.queryParams.level == '4') {
|
||||
this.parentTypeList = res.data || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
changeType(val, level) {
|
||||
console.log('🚀 ~ val, type:', val, level)
|
||||
if (level == '2') {
|
||||
this.queryParams.parentId = val
|
||||
this.queryParams.greatGrandparentId = null
|
||||
this.queryParams.grandparentTypeId = null
|
||||
this.queryParams.parentTypeId = null
|
||||
this.greatGrandparentList = []
|
||||
this.grandparentTypeList = []
|
||||
this.parentTypeList = []
|
||||
} else if (level == '3') {
|
||||
this.queryParams.parentId = this.queryParams.greatGrandparentId
|
||||
this.queryParams.grandparentTypeId = null
|
||||
this.queryParams.parentTypeId = null
|
||||
this.grandparentTypeList = []
|
||||
this.parentTypeList = []
|
||||
} else if (level == '4') {
|
||||
this.queryParams.parentId = this.queryParams.grandparentTypeId
|
||||
this.queryParams.parentTypeId = null
|
||||
this.parentTypeList = []
|
||||
}
|
||||
this.queryParams.level = level
|
||||
if (!val) return
|
||||
this.getSelectList()
|
||||
},
|
||||
handleDialog(row, type) {
|
||||
this.dialogTitle = type == 'out' ? '出库详情' : '入库详情'
|
||||
this.isOut = type == 'out' ? true : false
|
||||
this.dialogVisible = true
|
||||
this.dialogList = []
|
||||
setTimeout(() => {
|
||||
this.$refs.dialogForm.resetFields()
|
||||
this.dialogForm.typeId = row.typeId
|
||||
this.dialogForm.startTime = this.queryParams.timeRange ? this.queryParams.timeRange[0] : ''
|
||||
this.dialogForm.endTime = this.queryParams.timeRange ? this.queryParams.timeRange[1] : ''
|
||||
this.getDialogList()
|
||||
}, 100)
|
||||
},
|
||||
// 弹框查询
|
||||
handleDialogQuery() {
|
||||
this.dialogForm.pageNum = 1
|
||||
this.getDialogList()
|
||||
},
|
||||
// 重置
|
||||
handleDialogReset() {
|
||||
this.dialogForm.keyWord = ''
|
||||
this.dialogForm.pageNum = 1
|
||||
this.dialogForm.pageSize = 10
|
||||
this.getDialogList()
|
||||
},
|
||||
// 获取弹框列表
|
||||
async getDialogList() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const params = { ...this.dialogForm }
|
||||
const res = await getInventoryLogDetailsApi(params)
|
||||
this.dialogList = res.data.rows || []
|
||||
this.dlgTotal = res.data.total || 0
|
||||
} catch (error) {
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
// 导出数据
|
||||
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)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Loading…
Reference in New Issue