在修工程查询

This commit is contained in:
bb_pan 2025-09-11 16:01:57 +08:00
parent 23461a778d
commit f05b082815
3 changed files with 245 additions and 13 deletions

View File

@ -108,4 +108,13 @@ export function getRepairRecord(query) {
method: 'get',
params: query
})
}
// 在修工程查询
export function getRepairProjectListApi(query) {
return request({
url: '/material/repair/getRepairProjectList',
method: 'get',
params: query
})
}

View File

@ -209,7 +209,7 @@
</el-dialog>
<!-- 查看弹窗 -->
<el-dialog title="查看" :visible.sync="showOutView" width="1200px" append-to-body>
<el-dialog title="查看" :visible.sync="showOutView" width="1200px" append-to-body v-loading="loading">
<el-form
:model="queryOutView"
ref="queryFormOutInfo"
@ -943,7 +943,7 @@ export default {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.time = [this.format(start), this.format(end)]
this.queryParams.time = [this.format(end), this.format(end)]
// this.resetForm('queryForm')
this.queryParams.taskStatus = ''
this.queryParams.keyWord = ''
@ -1350,6 +1350,12 @@ export default {
//
async checkPreNum(row) {
console.log(row)
if (row.preNum == row.outNum) return
if (row.preNum > row.outNum) {
row.preNum = row.outNum
this.$message.error('预出库数量不能大于待出库数量')
return
}
// let maxNum = row.pendingNum-row.pendingOutNum
let minNum = row.alNum
if (row.unitValue == 1) {
@ -1371,17 +1377,31 @@ export default {
this.$message.error('预出库数量不能大于可出库数量')
return
}
const res = await updatePreNum({
preNum: row.preNum,
parentId: row.parentId,
typeId: row.typeId,
newTypeId: row.newTypeId,
})
if (res.code == 200) {
// this.$set(row, 'outNum', row.preNum-row.alNum)
this.handleQueryOutView()
this.getList()
this.getOutNum()
let isConfirm = false
try {
//
const confirm = await this.$modal.confirm('是否确认提交?')
isConfirm = confirm == 'confirm'
if (!isConfirm) return
this.loading = true
const res = await updatePreNum({
preNum: row.preNum,
parentId: row.parentId,
typeId: row.typeId,
newTypeId: row.newTypeId,
publishTask: row.publishTask,
publishNum: row.outNum,
})
if (res.code == 200) {
// this.$set(row, 'outNum', row.preNum-row.alNum)
this.handleQueryOutView()
this.getList()
this.getOutNum()
}
} catch (error) {
console.log('🚀 ~ checkPreNum ~ error:', error)
} finally {
this.loading = false
}
},

View File

@ -0,0 +1,203 @@
<template>
<!-- 基础页面 -->
<div class="app-container">
<el-form v-show="showSearch" :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
<!-- 日期范围 -->
<el-form-item label="" prop="startTime">
<el-date-picker
v-model="queryParams.startTime"
type="date"
placeholder="开始日期"
clearable
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
style="width: 240px"
:picker-options="pickerOptions"
/>
</el-form-item>
<el-form-item label="" prop="endTime">
<el-date-picker
v-model="queryParams.endTime"
type="date"
placeholder="结束日期"
clearable
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
style="width: 240px"
:picker-options="pickerOptions"
/>
</el-form-item>
<el-form-item label="" prop="keyword">
<el-input
v-model="queryParams.keyword"
placeholder="请输入关键字"
clearable
@keyup.enter.native="handleQuery"
style="width: 240px"
/>
</el-form-item>
<!-- 表单按钮 -->
<el-form-item>
<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-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>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
</el-row>
<el-table :data="tableList" fit highlight-current-row style="width: 100%" v-loading="isLoading" :max-height="650">
<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="!column.unShowTooltip"
:key="index"
:label="column.label"
:prop="column.prop"
align="center"
></el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { getRepairProjectListApi } from '@/api/repair/repair'
export default {
data() {
return {
isLoading: false,
showSearch: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now()
}
},
queryParams: {
pageNum: 1,
pageSize: 10,
keyword: '', //
startTime: '', //
endTime: '', //
timeRange: [] //
},
total: 0, //
//
tableColumns: [
{ label: '维修时间', prop: 'repairTime' },
{ label: '维修单号', prop: 'repairCode' },
{ label: '退料单位', prop: 'backUnitName', unShowTooltip: true },
{ label: '退料工程', prop: 'backProjectName', unShowTooltip: true },
{ label: '机具类型', prop: 'maTypeName' },
{ label: '机具规格', prop: 'maTypeModel' },
{ label: '机具单位', prop: 'unitName' },
{ label: '在修数量', prop: 'repairNum' }
],
//
tableList: []
}
},
created() {
const end = new Date()
//
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.startTime = this.format(start)
this.queryParams.endTime = this.format(end)
this.getList()
},
methods: {
format(date) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
//
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
//
handleReset() {
this.$refs.queryForm.resetFields()
const end = new Date()
//
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.queryParams.startTime = this.format(start)
this.queryParams.endTime = this.format(end)
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.getList()
},
//
async getList() {
console.log('列表-查询', this.queryParams)
this.isLoading = true
try {
const params = {
...this.queryParams
}
delete params.timeRange
console.log('🚀 ~ getList ~ params:', params)
const res = await getRepairProjectListApi(params)
console.log('🚀 ~ 获取列表 ~ res:', res)
this.tableList = res.data.rows || []
this.total = res.data.total || 0
} catch (error) {
console.log('🚀 ~ 获取列表 ~ error:', error)
this.tableList = []
this.total = 0
} finally {
this.isLoading = false
}
},
//
formatTime(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`
},
//
handleExport() {
try {
let fileName = `在修工程查询_${this.formatTime(new Date())}.xLsx`
let url = '/material/repair/exportRepairProjectList'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
}
}
}
</script>
<style lang="scss" scoped></style>