领用申请

This commit is contained in:
bb_pan 2025-02-28 18:23:58 +08:00
parent fdafabe322
commit 129accd83a
4 changed files with 329 additions and 76 deletions

View File

@ -123,6 +123,14 @@ export function getEquipmentThreeTypes(query) {
})
}
// 业务单号
export function getCode() {
return request({
url: '/material/leaseTask/getCode',
method: 'get',
})
}
// 结算记录查询-列表
export function getSltRecord(query) {
return request({

View File

@ -186,6 +186,14 @@ export function getEquipmentThreeType(query) {
})
}
// 物资名称-tree-3
export function getEquipmentThreeTypeThree() {
return request({
url: '/material/leaseTask/equipmentThreeType',
method: 'get',
})
}
// 规格型号-select
export function getMaTypeOpt(data) {
return request({

View File

@ -53,6 +53,26 @@
</el-form-item>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="供货时间" prop="supplierTime">
<el-date-picker
v-model="maForm.supplierTime"
type="date"
placeholder="请选择供货时间"
clearable
style="width: 240px"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
/>
</el-form-item>
<el-form-item label="供货地点" prop="supplierPlace">
<el-input
v-model="maForm.supplierPlace"
placeholder="请输入供货地点"
clearable
maxlength="200"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="maForm.phone"
@ -63,14 +83,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采购申请编号" prop="applyCode">
<el-form-item label="业务单号" prop="code" v-if="isEdit || isDetail">
<el-input
v-model="maForm.applyCode"
placeholder="请输入采购申请编号"
v-model="maForm.code"
placeholder="请输入业务单号"
clearable
maxlength="150"
style="width: 240px"
rows="2"
disabled
/>
</el-form-item>
</el-col>
@ -184,22 +204,61 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSave" v-if="!isDetail">
{{ isEdit ? '保存' : '发起申请' }}
<el-button type="primary" plain icon="el-icon-document" size="mini" @click="handleSave" v-if="!isDetail">
{{ isEdit ? '提交' : '发起申请' }}
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="addColumns">新增条目</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-arrow-left" size="mini" @click="handleApplyRecord">
领料记录查看
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">
导出工具器清单
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column align="center" label="序号" type="index" width="55" />
<el-table-column align="center" label="类型名称" prop="maTypeName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="规格型号" prop="typeName" show-overflow-tooltip />
<el-table-column align="center" label="类型名称" prop="maTypeName" show-overflow-tooltip>
<template v-slot="scope">
<el-cascader
v-if="scope.row.isManual == 1"
v-model="scope.row.maTypeIds"
placeholder="请选择类型名称"
:options="maTypeList"
:props="{ label: 'typeName', value: 'typeId' }"
filterable
clearable
:disabled="isDetail"
@change="getTypeList(scope.row, $event)"
></el-cascader>
<span v-else>{{ scope.row.maTypeName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="规格型号" prop="typeName" show-overflow-tooltip>
<template v-slot="scope">
<el-select
v-if="scope.row.isManual == 1"
v-model="scope.row.typeId"
clearable
filterable
placeholder="请选择规格型号"
:disabled="isDetail"
@change="changeTypeName(scope.row, $event)"
>
<el-option v-for="item in typeList" :key="item.typeId" :label="item.name" :value="item.typeId"></el-option>
</el-select>
<span v-else>{{ scope.row.typeName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="计量单位" prop="unitName" />
<el-table-column label="预领数量" prop="preNum" align="center">
<template v-slot="scope">
@ -234,12 +293,58 @@
<el-table-column label="操作" align="center" v-if="!isDetail">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" style="color: red" @click="handleDelete(scope.row)">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
style="color: red"
@click="handleDelete(scope.$index, scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹框 -->
<el-dialog title="领用申请" :visible.sync="dialogVisible" width="60%">
<el-form ref="dialogForm" :model="maForm" label-width="120px" inline>
<el-form-item label="领用单位:" prop="unitName">
<span>{{ maForm.unitName }}</span>
</el-form-item>
<el-form-item label="领用工程:" prop="projectName">
<span>{{ maForm.projectName }}</span>
</el-form-item>
<el-form-item label="领料人:" prop="leasePerson">
<span>{{ maForm.leasePerson }}</span>
</el-form-item>
<el-form-item label="联系电话:" prop="phone">
<span>{{ maForm.phone }}</span>
</el-form-item>
<el-form-item label="供货时间:" prop="supplierTime">
<span>{{ maForm.supplierTime }}</span>
</el-form-item>
<el-form-item label="供货地点:" prop="supplierPlace">
<span>{{ maForm.supplierPlace }}</span>
</el-form-item>
<el-form-item label="业务单号:" prop="code">
<span>{{ maForm.code }}</span>
</el-form-item>
</el-form>
<!-- 列表 -->
<el-table :data="equipmentList">
<el-table-column
v-for="item in dialogColumns"
:key="item.prop"
:label="item.label"
:prop="item.prop"
></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm(0)">提交申请</el-button>
<el-button @click="handleConfirm(1)"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -251,8 +356,10 @@ import {
getListsByConfigId,
addLeaseTask,
editLeaseTask,
getLeaseTaskDetail
getLeaseTaskDetail,
getCode
} from '@/api/business/index'
import { getEquipmentThreeTypeThree, getMaTypeOpt } from '@/api/ma/base'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -303,10 +410,17 @@ export default {
maForm: {
unitId: undefined,
projectId: undefined,
arrivalTime: '',
applyCode: '', //
code: '', //
supplierTime: '', //
supplierPlace: '', //
bmFileInfos: [] //
},
pickerOptions: {
disabledDate(time) {
//
return time.getTime() < Date.now() - 86400000 // 86400000
}
},
//
form: {},
defaultProps: {
@ -344,10 +458,17 @@ export default {
trigger: 'blur'
}
],
applyCode: [
supplierTime: [
{
required: true,
message: '请输入采购申请编号',
message: '请选择供货时间',
trigger: 'blur'
}
],
supplierPlace: [
{
required: true,
message: '请输入供货地点',
trigger: 'blur'
}
],
@ -359,6 +480,20 @@ export default {
}
]
},
maTypeList: [], //
//
typeList: [],
dialogVisible: false, //
//
dialogForm: {},
//
dialogColumns: [
{ label: '类型名称', prop: 'maTypeName' },
{ label: '规格型号', prop: 'typeName' },
{ label: '计量单位', prop: 'unitName' },
{ label: '预领数量', prop: 'preNum' },
{ label: '备注', prop: 'remark' }
],
deviceTypeTreeProps: {
children: 'children',
label: 'typeName',
@ -408,6 +543,7 @@ export default {
}
},
created() {
// getCode()
if (this.$route.query.type == 'edit') {
this.isEdit = true
this.isDetail = false
@ -430,6 +566,7 @@ export default {
this.projectInfoList() //
this.equipmentType() //
this.getStandardConfigList() //
this.getMaTypeNameOpt() //
if (this.isEdit || this.isDetail) {
console.log('isEdit', this.isEdit)
this.getTaskInfo()
@ -438,6 +575,64 @@ export default {
console.log(this.$route.query, 'this.$route.query')
},
methods: {
// -tree
async getMaTypeNameOpt() {
try {
const res = await getEquipmentThreeTypeThree()
console.log('🚀 ~ getEquipmentThreeTypeThree ~ res:', res)
const filterData = (data, level = 1) => {
return data.map(item => {
if (level < 3 && item.children && item.children.length) {
item.children = filterData(item.children, level + 1)
} else {
delete item.children
}
return item
})
}
this.maTypeList = filterData(res.data)
console.log('🚀 ~ this.maTypeList:', this.maTypeList)
} catch (error) {
console.log('🚀 ~ error:', error)
}
},
//
async getTypeList(row, typeIds) {
// console.log('🚀 ~ getTypeList ~ row:', row)
// console.log('🚀 ~ getTypeList ~ typeId:', typeIds[typeIds.length - 1])
//
const filterData = data => {
data.forEach(item => {
if (item.typeId === typeIds[typeIds.length - 1]) {
row.maTypeName = item.typeName
} else {
if (item.children && item.children.length) {
filterData(item.children)
}
}
})
}
filterData(this.maTypeList)
console.log('🚀 ~ getTypeList ~ maType:', row)
row.typeId = ''
row.unitName = ''
try {
const res = await getMaTypeOpt({ typeId: typeIds[typeIds.length - 1] })
// console.log('🚀 ~ getMaTypeOpt ~ res:', res)
this.typeList = res.data
} catch (error) {
console.log('🚀 ~ error:', error)
}
},
//
changeTypeName(row, val) {
// console.log('🚀 ~ changeTypeName ~ row:', row)
// console.log('🚀 ~ changeTypeName ~ val:', val)
const type = this.typeList.find(item => item.typeId === val)
// console.log('🚀 ~ changeTypeName ~ type:', type)
row.unitName = type.unitName
row.typeName = type.name
},
//
async getStandardConfigList() {
try {
@ -464,6 +659,8 @@ export default {
}
},
uniteChange(val) {
// console.log('🚀 ~ uniteChange ~ val:', val)
this.maForm.unitName = val.name
if (val.typeKey == 'fbs') {
this.isFileFbs = true
this.rules['bmFileInfos'][0].required = true
@ -479,6 +676,7 @@ export default {
}, 500)
},
projectChange(val) {
this.maForm.projectName = val.name
setTimeout(() => {
// projectId: this.maForm.projectId
getListUnite({}).then(response => {
@ -601,10 +799,12 @@ export default {
type: 'warning'
})
this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected)
} else if (typeData.storageNum <= 0) {
this.$message.error('所选物资规格类型暂时无库存,无法申请!')
this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected)
} else {
}
// else if (typeData.storageNum <= 0) {
// this.$message.error('')
// this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected)
// }
else {
//
this.equipmentList.unshift({
...typeData,
@ -662,6 +862,20 @@ export default {
},
//
handleSelectionChange() {},
//
addColumns() {
//
this.equipmentList.push({
isManual: 1,
maTypeIds: [],
maTypeName: '',
typeId: '',
typeName: '',
preNum: 0,
remark: ''
})
},
/** 保存按钮操作 */
handleSave() {
// console.log(this.equipmentList)
@ -674,71 +888,81 @@ export default {
this.$message.error(`${i + 1} 行的 ${'预领数量必须大于0'} `)
return
}
if (this.equipmentList[i].preNum > this.equipmentList[i].storageNum) {
this.$message.error(`${i + 1} 行的 ${'预领数量不可大于库存量'} `)
return
}
// if (this.equipmentList[i].preNum > this.equipmentList[i].storageNum) {
// this.$message.error(` ${i + 1} ${''} `)
// return
// }
}
await getAgreement({
unitId: this.maForm.unitId,
projectId: this.maForm.projectId
}).then(response => {
this.agreementId = response.data.agreementId
this.maForm.agreementId = this.agreementId
})
await this.$modal
.confirm('是否确认保存当前页面')
.then(async () => {
if (this.isEdit) {
try {
const res = await editLeaseTask({
leaseApplyDetailsList: this.equipmentList,
leaseApplyInfo: this.maForm
})
if (res.code === 200) {
this.$modal.msgSuccess('编辑成功')
//
this.$tab.closePage()
}
this.loading = false
} catch (error) {
console.log('🚀 ~ error:', error)
this.loading = false
}
} else if (!this.isEdit) {
console.log('新增')
console.log(this.equipmentList)
this.loading = true
try {
const res = await addLeaseTask({
leaseApplyDetailsList: this.equipmentList,
leaseApplyInfo: this.maForm
})
if (res.code === 200) {
this.$modal.msgSuccess('新增成功')
this.$refs['maForm'].resetFields()
this.equipmentList = []
}
this.loading = false
} catch (error) {
console.log('🚀 ~ error:', error)
this.loading = false
}
}
})
.catch(() => {})
//
const res = await getCode()
console.log('🚀 ~ handleSave ~ res:', res)
if (res.code === 200) {
this.maForm.code = res.data.taskCode
}
//
this.dialogVisible = true
}
})
} else {
this.$modal.msgError('请先添加类型规格')
}
},
//
async handleConfirm(type) {
await getAgreement({
unitId: this.maForm.unitId,
projectId: this.maForm.projectId
}).then(response => {
this.agreementId = response.data.agreementId
this.maForm.agreementId = this.agreementId
})
await this.$modal
.confirm(type == 0 ? '是否确认提交' : '是否确认保存')
.then(async () => {
const params = {
leaseApplyDetailsList: this.equipmentList,
leaseApplyInfo: this.maForm,
statusFlag: type
}
if (this.isEdit) {
try {
const res = await editLeaseTask(params)
if (res.code === 200) {
this.$modal.msgSuccess('操作成功')
//
this.$tab.closePage()
}
this.loading = false
} catch (error) {
console.log('🚀 ~ error:', error)
this.loading = false
}
} else if (!this.isEdit) {
console.log('新增')
console.log(this.equipmentList)
try {
const res = await addLeaseTask(params)
if (res.code === 200) {
this.$modal.msgSuccess('操作成功')
this.$refs['maForm'].resetFields()
this.equipmentList = []
//
this.dialogVisible = false
}
} catch (error) {
console.log('🚀 ~ error:', error)
}
}
})
.catch(() => {})
},
/** 删除按钮操作 */
handleDelete(row) {
handleDelete(index, row) {
console.log('🚀 ~ handleDelete ~ row:', row)
this.$modal
.confirm('是否确认删除所选择的数据项?')
.then(() => {
this.equipmentList = this.equipmentList.filter(item => item.typeId !== row.typeId)
this.equipmentList.splice(index, 1)
//
this.deviceType = this.equipmentList.map(item => item.typeId)
})
@ -784,7 +1008,7 @@ export default {
}
})
this.maForm.bmFileInfos = fileList
console.log('🚀 ~ handleChangeBusinessList ~ this.bmFileInfos:', this.bmFileInfos)
// console.log('🚀 ~ handleChangeBusinessList ~ this.bmFileInfos:', this.bmFileInfos)
//
this.$refs.maForm.validateField('bmFileInfos')
},
@ -931,6 +1155,18 @@ export default {
if (optionDom) {
optionDom.scrollIntoView({ block: 'center', behavior: 'smooth' })
}
},
//
handleExport() {
try {
let fileName = `工器具清单_${new Date().getTime()}.xLsx`
let url = '/material/leaseTask/export'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
}
},
//

View File

@ -72,6 +72,7 @@
<el-tag v-else-if="scope.row.taskStatus == '2'" type="success" size="mini" style="margin-right: 5px">
已完成
</el-tag>
<el-tag v-else-if="scope.row.taskStatus == '5'" size="mini" style="margin-right: 5px">待提交</el-tag>
</template>
</el-table-column>
<!-- 操作 -->
@ -79,7 +80,7 @@
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-search" @click="handleEdit(scope.row, 1)">查看</el-button>
<el-button
v-if="scope.row.taskStatus == '0'"
v-if="scope.row.taskStatus == '0' || scope.row.taskStatus == '5'"
type="text"
size="mini"
icon="el-icon-edit"
@ -88,7 +89,7 @@
编辑
</el-button>
<el-button
v-if="scope.row.taskStatus == '0'"
v-if="scope.row.taskStatus == '0' || scope.row.taskStatus == '5'"
type="text"
size="mini"
icon="el-icon-delete"
@ -141,7 +142,7 @@ export default {
{ label: '领用工程', prop: 'leaseProject' },
{ label: '领料物资类型', prop: 'maTypeNames' },
{ label: '协议号', prop: 'agreementCode' },
{ label: '采购申请单号', prop: 'applyCode' },
{ label: '业务单号', prop: 'code' },
{ label: '领料人', prop: 'leasePerson' },
{ label: '领料人电话', prop: 'phone' },
{ label: '状态', prop: 'taskStatus' }