领用申请

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) { export function getSltRecord(query) {
return request({ 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 // 规格型号-select
export function getMaTypeOpt(data) { export function getMaTypeOpt(data) {
return request({ return request({

View File

@ -53,6 +53,26 @@
</el-form-item> </el-form-item>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24" :offset="0"> <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-form-item label="联系电话" prop="phone">
<el-input <el-input
v-model="maForm.phone" v-model="maForm.phone"
@ -63,14 +83,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="采购申请编号" prop="applyCode"> <el-form-item label="业务单号" prop="code" v-if="isEdit || isDetail">
<el-input <el-input
v-model="maForm.applyCode" v-model="maForm.code"
placeholder="请输入采购申请编号" placeholder="请输入业务单号"
clearable clearable
maxlength="150" maxlength="150"
style="width: 240px" style="width: 240px"
rows="2" disabled
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -184,22 +204,61 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSave" v-if="!isDetail"> <el-button type="primary" plain icon="el-icon-document" size="mini" @click="handleSave" v-if="!isDetail">
{{ isEdit ? '保存' : '发起申请' }} {{ isEdit ? '提交' : '发起申请' }}
</el-button> </el-button>
</el-col> </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-col :span="1.5">
<el-button type="primary" plain icon="el-icon-arrow-left" size="mini" @click="handleApplyRecord"> <el-button type="primary" plain icon="el-icon-arrow-left" size="mini" @click="handleApplyRecord">
领料记录查看 领料记录查看
</el-button> </el-button>
</el-col> </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-row>
<el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> --> <!-- <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="序号" 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="maTypeName" show-overflow-tooltip>
<el-table-column align="center" label="规格型号" prop="typeName" 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 align="center" label="计量单位" prop="unitName" />
<el-table-column label="预领数量" prop="preNum" align="center"> <el-table-column label="预领数量" prop="preNum" align="center">
<template v-slot="scope"> <template v-slot="scope">
@ -234,12 +293,58 @@
<el-table-column label="操作" align="center" v-if="!isDetail"> <el-table-column label="操作" align="center" v-if="!isDetail">
<template slot-scope="scope"> <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> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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> </div>
</template> </template>
@ -251,8 +356,10 @@ import {
getListsByConfigId, getListsByConfigId,
addLeaseTask, addLeaseTask,
editLeaseTask, editLeaseTask,
getLeaseTaskDetail getLeaseTaskDetail,
getCode
} from '@/api/business/index' } from '@/api/business/index'
import { getEquipmentThreeTypeThree, getMaTypeOpt } from '@/api/ma/base'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -303,10 +410,17 @@ export default {
maForm: { maForm: {
unitId: undefined, unitId: undefined,
projectId: undefined, projectId: undefined,
arrivalTime: '', code: '', //
applyCode: '', // supplierTime: '', //
supplierPlace: '', //
bmFileInfos: [] // bmFileInfos: [] //
}, },
pickerOptions: {
disabledDate(time) {
//
return time.getTime() < Date.now() - 86400000 // 86400000
}
},
// //
form: {}, form: {},
defaultProps: { defaultProps: {
@ -344,10 +458,17 @@ export default {
trigger: 'blur' trigger: 'blur'
} }
], ],
applyCode: [ supplierTime: [
{ {
required: true, required: true,
message: '请输入采购申请编号', message: '请选择供货时间',
trigger: 'blur'
}
],
supplierPlace: [
{
required: true,
message: '请输入供货地点',
trigger: 'blur' 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: { deviceTypeTreeProps: {
children: 'children', children: 'children',
label: 'typeName', label: 'typeName',
@ -408,6 +543,7 @@ export default {
} }
}, },
created() { created() {
// getCode()
if (this.$route.query.type == 'edit') { if (this.$route.query.type == 'edit') {
this.isEdit = true this.isEdit = true
this.isDetail = false this.isDetail = false
@ -430,6 +566,7 @@ export default {
this.projectInfoList() // this.projectInfoList() //
this.equipmentType() // this.equipmentType() //
this.getStandardConfigList() // this.getStandardConfigList() //
this.getMaTypeNameOpt() //
if (this.isEdit || this.isDetail) { if (this.isEdit || this.isDetail) {
console.log('isEdit', this.isEdit) console.log('isEdit', this.isEdit)
this.getTaskInfo() this.getTaskInfo()
@ -438,6 +575,64 @@ export default {
console.log(this.$route.query, 'this.$route.query') console.log(this.$route.query, 'this.$route.query')
}, },
methods: { 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() { async getStandardConfigList() {
try { try {
@ -464,6 +659,8 @@ export default {
} }
}, },
uniteChange(val) { uniteChange(val) {
// console.log('🚀 ~ uniteChange ~ val:', val)
this.maForm.unitName = val.name
if (val.typeKey == 'fbs') { if (val.typeKey == 'fbs') {
this.isFileFbs = true this.isFileFbs = true
this.rules['bmFileInfos'][0].required = true this.rules['bmFileInfos'][0].required = true
@ -479,6 +676,7 @@ export default {
}, 500) }, 500)
}, },
projectChange(val) { projectChange(val) {
this.maForm.projectName = val.name
setTimeout(() => { setTimeout(() => {
// projectId: this.maForm.projectId // projectId: this.maForm.projectId
getListUnite({}).then(response => { getListUnite({}).then(response => {
@ -601,10 +799,12 @@ export default {
type: 'warning' type: 'warning'
}) })
this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected) this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected)
} else if (typeData.storageNum <= 0) { }
this.$message.error('所选物资规格类型暂时无库存,无法申请!') // else if (typeData.storageNum <= 0) {
this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected) // this.$message.error('')
} else { // this.tempDeviceType = this.tempDeviceType.filter(id => id !== lastSelected)
// }
else {
// //
this.equipmentList.unshift({ this.equipmentList.unshift({
...typeData, ...typeData,
@ -662,6 +862,20 @@ export default {
}, },
// //
handleSelectionChange() {}, handleSelectionChange() {},
//
addColumns() {
//
this.equipmentList.push({
isManual: 1,
maTypeIds: [],
maTypeName: '',
typeId: '',
typeName: '',
preNum: 0,
remark: ''
})
},
/** 保存按钮操作 */ /** 保存按钮操作 */
handleSave() { handleSave() {
// console.log(this.equipmentList) // console.log(this.equipmentList)
@ -674,71 +888,81 @@ export default {
this.$message.error(`${i + 1} 行的 ${'预领数量必须大于0'} `) this.$message.error(`${i + 1} 行的 ${'预领数量必须大于0'} `)
return return
} }
if (this.equipmentList[i].preNum > this.equipmentList[i].storageNum) { // if (this.equipmentList[i].preNum > this.equipmentList[i].storageNum) {
this.$message.error(`${i + 1} 行的 ${'预领数量不可大于库存量'} `) // this.$message.error(` ${i + 1} ${''} `)
return // return
} // }
} }
await getAgreement({ //
unitId: this.maForm.unitId, const res = await getCode()
projectId: this.maForm.projectId console.log('🚀 ~ handleSave ~ res:', res)
}).then(response => { if (res.code === 200) {
this.agreementId = response.data.agreementId this.maForm.code = res.data.taskCode
this.maForm.agreementId = this.agreementId }
}) //
await this.$modal this.dialogVisible = true
.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(() => {})
} }
}) })
} else { } else {
this.$modal.msgError('请先添加类型规格') 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 this.$modal
.confirm('是否确认删除所选择的数据项?') .confirm('是否确认删除所选择的数据项?')
.then(() => { .then(() => {
this.equipmentList = this.equipmentList.filter(item => item.typeId !== row.typeId) this.equipmentList.splice(index, 1)
// //
this.deviceType = this.equipmentList.map(item => item.typeId) this.deviceType = this.equipmentList.map(item => item.typeId)
}) })
@ -784,7 +1008,7 @@ export default {
} }
}) })
this.maForm.bmFileInfos = fileList this.maForm.bmFileInfos = fileList
console.log('🚀 ~ handleChangeBusinessList ~ this.bmFileInfos:', this.bmFileInfos) // console.log('🚀 ~ handleChangeBusinessList ~ this.bmFileInfos:', this.bmFileInfos)
// //
this.$refs.maForm.validateField('bmFileInfos') this.$refs.maForm.validateField('bmFileInfos')
}, },
@ -931,6 +1155,18 @@ export default {
if (optionDom) { if (optionDom) {
optionDom.scrollIntoView({ block: 'center', behavior: 'smooth' }) 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 v-else-if="scope.row.taskStatus == '2'" type="success" size="mini" style="margin-right: 5px">
已完成 已完成
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.taskStatus == '5'" size="mini" style="margin-right: 5px">待提交</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!-- 操作 --> <!-- 操作 -->
@ -79,7 +80,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-search" @click="handleEdit(scope.row, 1)">查看</el-button> <el-button type="text" size="mini" icon="el-icon-search" @click="handleEdit(scope.row, 1)">查看</el-button>
<el-button <el-button
v-if="scope.row.taskStatus == '0'" v-if="scope.row.taskStatus == '0' || scope.row.taskStatus == '5'"
type="text" type="text"
size="mini" size="mini"
icon="el-icon-edit" icon="el-icon-edit"
@ -88,7 +89,7 @@
编辑 编辑
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.taskStatus == '0'" v-if="scope.row.taskStatus == '0' || scope.row.taskStatus == '5'"
type="text" type="text"
size="mini" size="mini"
icon="el-icon-delete" icon="el-icon-delete"
@ -141,7 +142,7 @@ export default {
{ label: '领用工程', prop: 'leaseProject' }, { label: '领用工程', prop: 'leaseProject' },
{ label: '领料物资类型', prop: 'maTypeNames' }, { label: '领料物资类型', prop: 'maTypeNames' },
{ label: '协议号', prop: 'agreementCode' }, { label: '协议号', prop: 'agreementCode' },
{ label: '采购申请单号', prop: 'applyCode' }, { label: '业务单号', prop: 'code' },
{ label: '领料人', prop: 'leasePerson' }, { label: '领料人', prop: 'leasePerson' },
{ label: '领料人电话', prop: 'phone' }, { label: '领料人电话', prop: 'phone' },
{ label: '状态', prop: 'taskStatus' } { label: '状态', prop: 'taskStatus' }