parent
b6e3fc154e
commit
0a2d92c906
14 changed files with 923 additions and 674 deletions
@ -0,0 +1,118 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog |
||||||
|
title="审批记录" |
||||||
|
append-to-body |
||||||
|
:modelValue="openShow" |
||||||
|
width="50%" |
||||||
|
@close="closeDialog" |
||||||
|
> |
||||||
|
<el-timeline class="horizontal-timeline"> |
||||||
|
<el-timeline-item |
||||||
|
v-for="(activity, index) in rowData" |
||||||
|
:key="index" |
||||||
|
:timestamp="activity.time" |
||||||
|
> |
||||||
|
{{ activity.label }}:{{ activity.value }} |
||||||
|
</el-timeline-item> |
||||||
|
</el-timeline> |
||||||
|
<template #footer> |
||||||
|
<span class="dialog-footer"> |
||||||
|
<el-button @click="closeDialog">取 消</el-button> |
||||||
|
<el-button type="primary" @click="submit">确 定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
export default { |
||||||
|
props: { |
||||||
|
showDialog: { |
||||||
|
type: Boolean, |
||||||
|
default: false, |
||||||
|
}, |
||||||
|
rowData: { |
||||||
|
type: Array, |
||||||
|
default: [], |
||||||
|
}, |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
openShow: false, |
||||||
|
}; |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.openShow = this.showDialog; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
closeDialog() { |
||||||
|
this.openShow = false; |
||||||
|
this.$emit('closeDialog'); |
||||||
|
}, |
||||||
|
submit() { |
||||||
|
this.$refs.form.validate(async valid => { |
||||||
|
if (valid) { |
||||||
|
// let params = { |
||||||
|
// id: this.$route.query.id, |
||||||
|
// approvalStatus: '', |
||||||
|
// }; |
||||||
|
// updateProcess(params).then((res) => { |
||||||
|
// if (res.code == 200) { |
||||||
|
// this.$message.success('操作成功'); |
||||||
|
// this.closeDialog(); |
||||||
|
// } |
||||||
|
// }); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped> |
||||||
|
.horizontal-timeline { |
||||||
|
display: flex; |
||||||
|
justify-content: center; /* 关键:水平居中 */ |
||||||
|
align-items: center; /* 垂直居中(可选) */ |
||||||
|
flex-wrap: nowrap; |
||||||
|
overflow-x: auto; |
||||||
|
padding: 20px 0; |
||||||
|
width: 100%; /* 确保占满容器宽度 */ |
||||||
|
|
||||||
|
// 隐藏默认竖线 |
||||||
|
::v-deep(.el-timeline-item__tail) { |
||||||
|
display: none; |
||||||
|
} |
||||||
|
|
||||||
|
// 每个时间轴项 |
||||||
|
::v-deep(.el-timeline-item) { |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
align-items: center; |
||||||
|
min-width: 160px; // 可根据内容调整 |
||||||
|
padding: 0 12px; |
||||||
|
flex-shrink: 0; /* 防止被压缩 */ |
||||||
|
} |
||||||
|
|
||||||
|
::v-deep(.el-timeline-item__timestamp) { |
||||||
|
position: static; |
||||||
|
margin-top: 8px; |
||||||
|
font-size: 12px; |
||||||
|
color: #909399; |
||||||
|
white-space: nowrap; /* 防止时间戳换行 */ |
||||||
|
} |
||||||
|
|
||||||
|
::v-deep(.el-timeline-item__content) { |
||||||
|
text-align: center; |
||||||
|
padding: 8px 12px; |
||||||
|
border-radius: 4px; |
||||||
|
background-color: #f5f7fa; |
||||||
|
min-height: 40px; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
justify-content: center; |
||||||
|
} |
||||||
|
|
||||||
|
::v-deep(.el-timeline-item__node) { |
||||||
|
margin-bottom: 8px; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
@ -1,274 +1,275 @@ |
|||||||
<template> |
<template> |
||||||
<el-dialog title="新增" append-to-body :modelValue="openShow" width="70%" @close="closeDialog" fullscreen> |
<el-dialog |
||||||
<!-- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> |
title="新增" |
||||||
<el-row :gutter="24"> |
append-to-body |
||||||
|
:modelValue="openShow" |
||||||
<el-col :span="8"> |
width="70%" |
||||||
<el-form-item label="申报人" prop="userId"> |
@close="closeDialog" |
||||||
<el-select v-model="ruleForm.userId" placeholder="请选择" disabled> |
fullscreen |
||||||
<el-option label="申报人一" value="1"> |
> |
||||||
</el-option> |
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
||||||
<el-option label="申报人二" value="2"> |
<el-button type="primary" @click="addTable">插入一行</el-button> |
||||||
</el-option> |
<el-button type="danger" @click="handleDelete">删除行</el-button> |
||||||
</el-select> |
</div> |
||||||
</el-form-item> |
<el-table |
||||||
</el-col> |
:data="tableData" |
||||||
|
:height="tableHeight" |
||||||
<el-col :span="8"> |
style="width: 100%" |
||||||
<el-form-item label="申报日期" prop="declareDate"> |
@select="selectChange" |
||||||
<el-date-picker v-model="ruleForm.declareDate" type="date" placeholder="选择日期" |
border |
||||||
style="width: 100%;"> |
> |
||||||
</el-date-picker> |
<el-table-column type="selection" width="55"></el-table-column> |
||||||
</el-form-item> |
<el-table-column prop="goodsId" label="物料编号" align="center"> |
||||||
</el-col> |
<template #header> |
||||||
<el-col :span="8"> |
<span><i style="color: red">*</i>物料编号</span> |
||||||
<el-form-item label="需求日期" prop="needDate"> |
</template> |
||||||
<el-date-picker v-model="ruleForm.needDate" type="date" placeholder="选择日期" style="width: 100%;"> |
<template #default="scope"> |
||||||
</el-date-picker> |
<jhSelect |
||||||
</el-form-item> |
v-model="scope.row.goodsCode" |
||||||
</el-col> |
placeholder="请搜索选择" |
||||||
<el-col :span="8"> |
api-url="/blade-wms/stGoods/list" |
||||||
<el-form-item label="采购部门" prop="buyDept"> |
echo-api="/blade-wms/stGoods/list" |
||||||
<el-select v-model="ruleForm.buyDept" placeholder="请选择"> |
echoParamsKey="goodsCode" |
||||||
<el-option label="采购部门一" value="1"> |
echo-method="get" |
||||||
</el-option> |
api-method="get" |
||||||
<el-option label="采购部门二" value="2"> |
list-key="records" |
||||||
</el-option> |
total-key="total" |
||||||
</el-select> |
label-key="goodsCode" |
||||||
</el-form-item> |
value-key="goodsCode" |
||||||
</el-col> |
search-key="goodsCode" |
||||||
<el-col :span="8"> |
:debounce-time="100" |
||||||
<el-form-item label="需求部门" prop="needDept"> |
@change="(val, item) => changeGoods(val, item, scope.row, scope.$index)" |
||||||
<el-select v-model="ruleForm.needDept" placeholder="请选择"> |
/> |
||||||
<el-option label="需求部门一" value="1"> |
</template> |
||||||
</el-option> |
</el-table-column> |
||||||
<el-option label="需求部门二" value="2"> |
<el-table-column prop="goodsName" label="物料名称" align="center"></el-table-column> |
||||||
</el-option> |
<el-table-column prop="materialModel" label="型号/牌号" align="center"></el-table-column> |
||||||
</el-select> |
<el-table-column prop="specifications" label="物料规格" align="center"></el-table-column> |
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
|
|
||||||
</el-row> |
|
||||||
|
|
||||||
</el-form> --> |
|
||||||
<div style="margin-bottom: 12px;" v-if="moldAddMore"> |
|
||||||
<el-button type="primary" @click="addTable">插入一行</el-button> |
|
||||||
<el-button type="danger" @click="handleDelete">删除行</el-button> |
|
||||||
</div> |
|
||||||
<el-table :data="tableData" style="width: 100%" @select="selectChange" border> |
|
||||||
<el-table-column type="selection" width="55"></el-table-column> |
|
||||||
<el-table-column prop="goodsId" label="物料编号" align="center"> |
|
||||||
<template #header> |
|
||||||
<span><i style="color:red">*</i>物料编号</span> |
|
||||||
</template> |
|
||||||
<template #default="scope"> |
|
||||||
<!-- <el-select v-model="scope.row.goodsCode" placeholder="请选择" style="width: 100%" |
|
||||||
@change="(val) => changeGoods(val,scope.$index)"> |
|
||||||
<el-option v-for="item in goodsList" :key="item.id" :label="item.goodsCode" :value="item.goodsCode"></el-option> |
|
||||||
</el-select> --> |
|
||||||
<jhSelect |
|
||||||
v-model="scope.row.goodsCode" |
|
||||||
placeholder="请搜索选择" |
|
||||||
api-url="/blade-wms/stGoods/list" |
|
||||||
echo-api="/blade-wms/stGoods/list" |
|
||||||
echoParamsKey="goodsCode" |
|
||||||
echo-method="get" |
|
||||||
api-method="get" |
|
||||||
list-key="records" |
|
||||||
total-key="total" |
|
||||||
label-key="goodsCode" |
|
||||||
value-key="goodsCode" |
|
||||||
search-key="goodsCode" |
|
||||||
:debounce-time="100" |
|
||||||
@change="(val, item) => changeGoods(val, item, scope.row, scope.$index)" |
|
||||||
/> |
|
||||||
|
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column prop="goodsName" label="物料名称" align="center"></el-table-column> |
|
||||||
<el-table-column prop="materialModel" label="型号/牌号" align="center"></el-table-column> |
|
||||||
<el-table-column prop="specifications" label="物料规格" align="center"></el-table-column> |
|
||||||
|
|
||||||
<el-table-column prop="currentQuantity" label="库存数量" align="center"></el-table-column> |
|
||||||
<el-table-column prop="avlQuantity" label="可用数量" align="center"></el-table-column> |
|
||||||
<el-table-column prop="quantity" label="提请数量" align="center"> |
|
||||||
<template #header> |
|
||||||
<span><i style="color:red">*</i>提请数量</span> |
|
||||||
</template> |
|
||||||
<template #default="scope"> |
|
||||||
<el-input-number v-model="scope.row.quantity" :min="1" controls-position="right" @change="handleChange" |
|
||||||
style="width: 100%" /> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column prop="woCode" label="关联订单号" align="center"> |
|
||||||
<template #default="scope"> |
|
||||||
<el-input v-model="scope.row.woCode" style="width: 100%" placeholder="请输入" /> |
|
||||||
</template> |
|
||||||
|
|
||||||
</el-table-column> |
|
||||||
<el-table-column prop="memo" label="备注" align="center"> |
|
||||||
|
|
||||||
<template #default="scope"> |
|
||||||
<el-input v-model="scope.row.memo" style="width: 100%" placeholder="请输入" /> |
|
||||||
</template> |
|
||||||
|
|
||||||
</el-table-column> |
|
||||||
<el-table-column fixed="right" label="操作" min-width="40"> |
|
||||||
<template #default="scope"> |
|
||||||
<el-button link type="primary" size="small" @click.prevent="delTable(scope.row, scope.$index)"> |
|
||||||
删除 |
|
||||||
</el-button> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
|
|
||||||
</el-table> |
|
||||||
|
|
||||||
<template #footer> |
<el-table-column prop="currentQuantity" label="库存数量" align="center"></el-table-column> |
||||||
<span class="dialog-footer"> |
<el-table-column prop="avlQuantity" label="可用数量" align="center"></el-table-column> |
||||||
<el-button @click="closeDialog">取 消</el-button> |
<el-table-column prop="quantity" label="提请数量" align="center"> |
||||||
<el-button type="primary" @click="submit">确 定</el-button> |
<template #header> |
||||||
</span> |
<span><i style="color: red">*</i>提请数量</span> |
||||||
|
</template> |
||||||
|
<template #default="scope"> |
||||||
|
<el-input-number |
||||||
|
v-model="scope.row.quantity" |
||||||
|
:min="1" |
||||||
|
controls-position="right" |
||||||
|
@change="handleChange" |
||||||
|
style="width: 100%" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="woCode" label="关联订单号" align="center"> |
||||||
|
<template #default="scope"> |
||||||
|
<el-input v-model="scope.row.woCode" style="width: 100%" placeholder="请输入" /> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="memo" label="备注" align="center"> |
||||||
|
<template #default="scope"> |
||||||
|
<el-input v-model="scope.row.memo" style="width: 100%" placeholder="请输入" /> |
||||||
</template> |
</template> |
||||||
</el-dialog> |
</el-table-column> |
||||||
|
<el-table-column prop="approver" label="审批人" align="center"> |
||||||
|
<template #header> |
||||||
|
<span><i style="color: red">*</i>审批人</span> |
||||||
|
</template> |
||||||
|
<template #default="scope"> |
||||||
|
<el-select |
||||||
|
v-model="scope.row.approver" |
||||||
|
clearable |
||||||
|
filterable |
||||||
|
placeholder="请选择" |
||||||
|
style="width: 100%" |
||||||
|
@change="val => handleApproverChange(val, scope.row, scope.$index)" |
||||||
|
> |
||||||
|
<el-option |
||||||
|
v-for="item in approverList" |
||||||
|
:key="item.id" |
||||||
|
:label="item.name" |
||||||
|
:value="item.id" |
||||||
|
></el-option> |
||||||
|
</el-select> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column fixed="right" label="操作" min-width="40"> |
||||||
|
<template #default="scope"> |
||||||
|
<el-button |
||||||
|
link |
||||||
|
type="primary" |
||||||
|
size="small" |
||||||
|
@click.prevent="delTable(scope.row, scope.$index)" |
||||||
|
> |
||||||
|
删除 |
||||||
|
</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
|
||||||
|
<template #footer> |
||||||
|
<span class="dialog-footer"> |
||||||
|
<el-button @click="closeDialog" :loading="submitLoading">取 消</el-button> |
||||||
|
<el-button type="primary" @click="submit" :loading="submitLoading">确 定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
</template> |
</template> |
||||||
<script> |
<script> |
||||||
import {getMaterialList,addRequests} from "@/api/storeManagement/teamRequest" |
import { getMaterialList, addRequests } from '@/api/storeManagement/teamRequest'; |
||||||
|
import { getUserByRoleAlias } from '@/api/storeManagement/warehouseMaintenance'; |
||||||
export default { |
export default { |
||||||
props: { |
props: { |
||||||
showDialog: { |
showDialog: { |
||||||
type: Boolean, |
type: Boolean, |
||||||
default: false |
default: false, |
||||||
}, |
}, |
||||||
moldAddMore: { |
moldAddMore: { |
||||||
type: Boolean, |
type: Boolean, |
||||||
default: false |
default: false, |
||||||
}, |
}, |
||||||
buyCycle: { |
buyCycle: { |
||||||
type: Number, |
type: Number, |
||||||
default: 0 |
default: 0, |
||||||
} |
}, |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
openShow: false, |
||||||
|
ruleForm: { |
||||||
|
userId: '1', |
||||||
|
declareDate: '', |
||||||
|
needDate: '', |
||||||
|
buyDept: '', |
||||||
|
needDept: null, |
||||||
|
}, |
||||||
|
rules: { |
||||||
|
userId: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
declareDate: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
needDate: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
buyDept: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
needDept: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
approver: [{ required: true, message: '请选择', trigger: 'blur' }], |
||||||
|
}, |
||||||
|
tableData: [], |
||||||
|
boCode: 'BO-2025001', |
||||||
|
goodsList: [], |
||||||
|
tableHeight: 0, |
||||||
|
approverList: [], //审批人列表 |
||||||
|
submitLoading: false, |
||||||
|
}; |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.openShow = this.showDialog; |
||||||
|
this.getApproverList(); |
||||||
|
this.getMaterialList(); |
||||||
|
this.$nextTick(() => { |
||||||
|
this.calcTableHeight(); |
||||||
|
}); |
||||||
|
window.addEventListener('resize', this.calcTableHeight); |
||||||
|
}, |
||||||
|
beforeDestroy() { |
||||||
|
window.removeEventListener('resize', this.calcTableHeight); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
getApproverList() { |
||||||
|
getUserByRoleAlias({ roleAlias: 'sj_craft,rb_craft' }).then(res => { |
||||||
|
this.approverList = res.data.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleApproverChange(val, row, index) { |
||||||
|
const selectedItem = this.approverList.find(item => item.id === val); |
||||||
|
const label = selectedItem ? selectedItem.name : ''; |
||||||
|
this.tableData[index].approverName = label; |
||||||
|
}, |
||||||
|
calcTableHeight() { |
||||||
|
const headerHeight = 50; // 估算头部按钮高度 |
||||||
|
const footerHeight = 60; // 估算底部 footer 高度 |
||||||
|
const padding = 40; // 估算 padding |
||||||
|
this.tableHeight = window.innerHeight - headerHeight - footerHeight - padding - 40; |
||||||
|
}, |
||||||
|
changeGoods(val, item, row, index) { |
||||||
|
if (item != undefined) { |
||||||
|
this.tableData[index].goodsName = item.goodsName; |
||||||
|
this.tableData[index].goodsId = item.id; |
||||||
|
this.tableData[index].specifications = item.specifications; |
||||||
|
this.tableData[index].currentQuantity = item.currentQuantity; |
||||||
|
this.tableData[index].materialModel = item.materialModel; |
||||||
|
this.tableData[index].avlQuantity = item.avlQuantity; |
||||||
|
} |
||||||
|
}, |
||||||
|
getMaterialList() { |
||||||
|
getMaterialList().then(res => { |
||||||
|
this.goodsList = res.data.data.records; |
||||||
|
}); |
||||||
|
}, |
||||||
|
closeDialog(val) { |
||||||
|
this.openShow = false; |
||||||
|
this.$emit('closeDialog', val); |
||||||
|
}, |
||||||
|
// 插入一行 |
||||||
|
addTable() { |
||||||
|
let boCode = ''; |
||||||
|
const len = this.tableData; |
||||||
|
if (len.length === 0) { |
||||||
|
boCode = this.boCode; |
||||||
|
} else { |
||||||
|
const newBoCode = len[len.length - 1].boCode; |
||||||
|
const codeArr = newBoCode.split('-'); |
||||||
|
const num = Number(codeArr[1]) + 1; |
||||||
|
boCode = codeArr[0] + '-' + num; |
||||||
|
} |
||||||
|
// 新增一行 |
||||||
|
const record = { _select: false, boCode, buyCycle: this.buyCycle, planArea: '洛阳新区' }; |
||||||
|
this.tableData.push(record); |
||||||
|
}, |
||||||
|
selectChange(list, row) { |
||||||
|
row._select = !row._select; |
||||||
|
}, |
||||||
|
handleDelete() { |
||||||
|
let tmp = this.tableData.find(item => item._select === true); |
||||||
|
if (!tmp) { |
||||||
|
this.$message.error('请先选择数据'); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm('确定删除数据吗?', { |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
type: 'warning', |
||||||
|
}).then(() => { |
||||||
|
this.tableData = this.tableData.filter(row => !row._select); |
||||||
|
}); |
||||||
}, |
}, |
||||||
data() { |
// 删除一行 |
||||||
return { |
delTable(row, index) { |
||||||
openShow: false, |
this.$confirm('确定删除数据吗?', { |
||||||
ruleForm: { |
confirmButtonText: '确定', |
||||||
userId: '1', |
cancelButtonText: '取消', |
||||||
declareDate: '', |
type: 'warning', |
||||||
needDate: '', |
}).then(() => { |
||||||
buyDept: '', |
this.tableData.splice(index, 1); |
||||||
needDept: null, |
}); |
||||||
}, |
|
||||||
rules: { |
|
||||||
userId: [ |
|
||||||
{ required: true, message: '请选择', trigger: 'blur' }, |
|
||||||
], |
|
||||||
declareDate: [ |
|
||||||
{ required: true, message: '请选择', trigger: 'blur' }, |
|
||||||
], |
|
||||||
needDate: [ |
|
||||||
{ required: true, message: '请选择', trigger: 'blur' }, |
|
||||||
], |
|
||||||
buyDept: [ |
|
||||||
{ required: true, message: '请选择', trigger: 'blur' }, |
|
||||||
], |
|
||||||
needDept: [ |
|
||||||
{ required: true, message: '请选择', trigger: 'blur' }, |
|
||||||
], |
|
||||||
}, |
|
||||||
tableData: [], |
|
||||||
boCode: 'BO-2025001', |
|
||||||
goodsList:[] |
|
||||||
} |
|
||||||
}, |
}, |
||||||
mounted() { |
submit() { |
||||||
this.openShow = this.showDialog |
if (this.tableData.length == 0) { |
||||||
this.getMaterialList() |
this.$message.error('请至少添加数据'); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.submitLoading = true; |
||||||
|
addRequests(this.tableData) |
||||||
|
.then(res => { |
||||||
|
if (res.data.code == 200) { |
||||||
|
this.$message.success('新增成功'); |
||||||
|
this.closeDialog(true); |
||||||
|
this.submitLoading = false; |
||||||
|
} |
||||||
|
}) |
||||||
|
.catch(err => { |
||||||
|
this.submitLoading = false; |
||||||
|
}); |
||||||
}, |
}, |
||||||
methods: { |
}, |
||||||
changeGoods(val, item, row, index){ |
}; |
||||||
console.log(val, item, row, index); |
|
||||||
if (item != undefined) { |
|
||||||
this.tableData[index].goodsName = item.goodsName; |
|
||||||
this.tableData[index].goodsId = item.id |
|
||||||
this.tableData[index].specifications = item.specifications; |
|
||||||
this.tableData[index].currentQuantity = item.currentQuantity |
|
||||||
this.tableData[index].materialModel = item.materialModel; |
|
||||||
this.tableData[index].avlQuantity = item.avlQuantity |
|
||||||
} |
|
||||||
// let tmp = this.goodsList.find(item => item.goodsCode == val) |
|
||||||
// this.tableData[index].goodsName = tmp.goodsName |
|
||||||
// this.tableData[index].goodsId = tmp.id |
|
||||||
// this.tableData[index].materialModel = tmp.materialModel |
|
||||||
// this.tableData[index].specifications = tmp.specifications |
|
||||||
// this.tableData[index].currentQuantity = tmp.currentQuantity |
|
||||||
// this.tableData[index].avlQuantity = tmp.avlQuantity |
|
||||||
}, |
|
||||||
getMaterialList(){ |
|
||||||
getMaterialList().then(res => { |
|
||||||
this.goodsList = res.data.data.records |
|
||||||
}) |
|
||||||
}, |
|
||||||
closeDialog(val) { |
|
||||||
this.openShow = false |
|
||||||
this.$emit('closeDialog',val); |
|
||||||
}, |
|
||||||
// 插入一行 |
|
||||||
addTable() { |
|
||||||
let boCode = ''; |
|
||||||
const len = this.tableData; |
|
||||||
if (len.length === 0) { |
|
||||||
boCode = this.boCode; |
|
||||||
} else { |
|
||||||
const newBoCode = len[len.length - 1].boCode; |
|
||||||
const codeArr = newBoCode.split('-'); |
|
||||||
const num = Number(codeArr[1]) + 1; |
|
||||||
boCode = codeArr[0] + '-' + num; |
|
||||||
} |
|
||||||
// 新增一行 |
|
||||||
const record = { _select:false, boCode, buyCycle: this.buyCycle, planArea: '洛阳新区' }; |
|
||||||
this.tableData.push(record) |
|
||||||
}, |
|
||||||
selectChange(list, row) { |
|
||||||
row._select = !row._select; |
|
||||||
}, |
|
||||||
handleDelete(){ |
|
||||||
let tmp = this.tableData.find(item => item._select === true); |
|
||||||
if(!tmp){ |
|
||||||
this.$message.error('请先选择数据'); |
|
||||||
return |
|
||||||
} |
|
||||||
this.$confirm('确定删除数据吗?', { |
|
||||||
confirmButtonText: '确定', |
|
||||||
cancelButtonText: '取消', |
|
||||||
type: 'warning', |
|
||||||
}).then(() => { |
|
||||||
this.tableData = this.tableData.filter(row => !row._select); |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 删除一行 |
|
||||||
delTable(row, index) { |
|
||||||
this.$confirm('确定删除数据吗?', { |
|
||||||
confirmButtonText: '确定', |
|
||||||
cancelButtonText: '取消', |
|
||||||
type: 'warning', |
|
||||||
}).then(() => { |
|
||||||
this.tableData.splice(index, 1) |
|
||||||
}) |
|
||||||
}, |
|
||||||
submit(){ |
|
||||||
if(this.tableData.length == 0){ |
|
||||||
this.$message.error('请至少添加数据'); |
|
||||||
return |
|
||||||
} |
|
||||||
console.log('提交数据:', this.tableData); |
|
||||||
addRequests(this.tableData).then(res =>{ |
|
||||||
if(res.data.code == 200){ |
|
||||||
this.$message.success('新增成功') |
|
||||||
this.closeDialog(true) |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
</script> |
||||||
<style lang="scss" scoped></style> |
<style lang="scss" scoped></style> |
||||||
@ -1,362 +1,323 @@ |
|||||||
<template> |
<template> |
||||||
<basic-container> |
<basic-container> |
||||||
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud" |
<avue-crud |
||||||
@row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" |
:option="option" |
||||||
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
:table-loading="loading" |
||||||
@refresh-change="refreshChange" @on-load="onLoad"> |
:data="data" |
||||||
<template #menu-left> |
v-model="form" |
||||||
<el-button type="primary" @click="handleAdd">新增 |
v-model:page="page" |
||||||
</el-button> |
ref="crud" |
||||||
<el-button type="danger" @click="handleDelete">删除 |
@row-del="rowDel" |
||||||
</el-button> |
@search-change="searchChange" |
||||||
</template> |
@search-reset="searchReset" |
||||||
<template #menu="scope"> |
@selection-change="selectionChange" |
||||||
<el-button type="text" @click="handeExamine(scope.row)" v-if="scope.row.approvalStatus == 0">审批</el-button> |
@current-change="currentChange" |
||||||
</template> |
@size-change="sizeChange" |
||||||
<template #menu-right> |
@refresh-change="refreshChange" |
||||||
<!-- <el-button type="success" icon="el-icon-upload" @click="handleImport">导入 |
@on-load="onLoad" |
||||||
|
> |
||||||
|
<template #menu-left> |
||||||
|
<el-button type="primary" @click="handleAdd">新增 </el-button> |
||||||
|
<el-button type="danger" @click="handleDelete">删除 </el-button> |
||||||
|
</template> |
||||||
|
<template #menu="scope"> |
||||||
|
<el-button type="text" @click="handeExamine(scope.row)" v-if="scope.row.approvalStatus == 0" |
||||||
|
>审批</el-button |
||||||
|
> |
||||||
|
</template> |
||||||
|
<template #menu-right> |
||||||
|
<!-- <el-button type="success" icon="el-icon-upload" @click="handleImport">导入 |
||||||
</el-button> --> |
</el-button> --> |
||||||
</template> |
</template> |
||||||
|
</avue-crud> |
||||||
</avue-crud> |
<addEditDialog |
||||||
<addEditDialog v-if="isOpen" :showDialog="isOpen" @closeDialog="closeDialog" :moldAddMore="moldAddMore"> |
v-if="isOpen" |
||||||
</addEditDialog> |
:showDialog="isOpen" |
||||||
<el-dialog width="30%" v-model="approveDialog" title="审批"> |
@closeDialog="closeDialog" |
||||||
<el-form :model="auditForm" :rules="auditRules" ref="auditForm"> |
:moldAddMore="moldAddMore" |
||||||
<el-form-item label="是否审核通过" prop="approvalResult"> |
> |
||||||
<el-radio v-model="auditForm.approvalResult" label="1">是</el-radio> |
</addEditDialog> |
||||||
<el-radio v-model="auditForm.approvalResult" label="10">否</el-radio> |
<el-dialog width="30%" v-model="approveDialog" title="审批"> |
||||||
</el-form-item> |
<el-form :model="auditForm" :rules="auditRules" ref="auditForm"> |
||||||
</el-form> |
<el-form-item label="是否审核通过" prop="approvalResult"> |
||||||
<template #footer> |
<el-radio v-model="auditForm.approvalResult" label="1">是</el-radio> |
||||||
<span class="dialog-footer"> |
<el-radio v-model="auditForm.approvalResult" label="10">否</el-radio> |
||||||
<el-button @click="approveDialog = false">取 消</el-button> |
</el-form-item> |
||||||
<el-button type="primary" @click="submit">确 定</el-button> |
</el-form> |
||||||
</span> |
<template #footer> |
||||||
</template> |
<span class="dialog-footer"> |
||||||
</el-dialog> |
<el-button @click="approveDialog = false">取 消</el-button> |
||||||
</basic-container> |
<el-button type="primary" @click="submit">确 定</el-button> |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
</el-dialog> |
||||||
|
</basic-container> |
||||||
</template> |
</template> |
||||||
<script> |
<script> |
||||||
import {getList,delRequests,approve} from "@/api/storeManagement/teamRequest" |
import { getList, delRequests, approve } from '@/api/storeManagement/teamRequest'; |
||||||
import addEditDialog from './components/addEditDialog.vue' |
import addEditDialog from './components/addEditDialog.vue'; |
||||||
export default { |
export default { |
||||||
components: { addEditDialog }, |
components: { addEditDialog }, |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
selectionList: [], |
selectionList: [], |
||||||
loading:false, |
loading: false, |
||||||
option: { |
option: { |
||||||
height: 'auto', |
height: 'auto', |
||||||
calcHeight: 32, |
calcHeight: 32, |
||||||
tip: false, |
tip: false, |
||||||
// size: 'medium', |
simplePage: true, |
||||||
simplePage: true, |
searchShow: true, |
||||||
searchShow: true, |
searchMenuSpan: 6, |
||||||
searchMenuSpan: 6, |
searchIcon: true, |
||||||
searchIcon: true, |
searchIndex: 3, |
||||||
searchIndex: 3, |
tree: false, |
||||||
tree: false, |
border: true, |
||||||
border: true, |
index: true, |
||||||
index: true, |
selection: true, |
||||||
selection: true, |
viewBtn: false, |
||||||
viewBtn: false, |
delBtn: false, |
||||||
delBtn: false, |
addBtn: false, |
||||||
addBtn: false, |
editBtnText: '修改', |
||||||
editBtnText: '修改', |
addBtnIcon: ' ', |
||||||
addBtnIcon: ' ', |
viewBtnIcon: ' ', |
||||||
viewBtnIcon: ' ', |
delBtnIcon: ' ', |
||||||
delBtnIcon: ' ', |
editBtnIcon: ' ', |
||||||
editBtnIcon: ' ', |
viewBtnText: '详情', |
||||||
viewBtnText: '详情', |
labelWidth: 120, |
||||||
labelWidth: 120, |
menuWidth: 80, |
||||||
menuWidth: 80, |
dialogWidth: 1040, |
||||||
dialogWidth: 1040, |
dialogClickModal: false, |
||||||
dialogClickModal: false, |
searchEnter: true, |
||||||
searchEnter: true, |
excelBtn: false, |
||||||
excelBtn: false, |
filterBtn: true, |
||||||
filterBtn: true, |
searchShowBtn: false, |
||||||
searchShowBtn: false, |
columnSort: true, |
||||||
columnSort: true, |
excelBtn: true, |
||||||
excelBtn: true, |
columnSort: true, |
||||||
columnSort: true, |
index: false, |
||||||
index: false, |
showOverflowTooltip: true, |
||||||
showOverflowTooltip: true, |
menu: true, |
||||||
menu: true, |
searchLabelPosition: 'left', |
||||||
searchLabelPosition: 'left', |
searchLabelWidth: 'auto', |
||||||
searchLabelWidth: 'auto', |
searchGutter: 24, |
||||||
searchGutter: 24, |
searchSpan: 6, |
||||||
searchSpan: 6, |
menuAlign: 'center', |
||||||
menuAlign: 'center', |
gridBtn: false, |
||||||
gridBtn: false, |
searchMenuPosition: 'right', |
||||||
searchMenuPosition: 'right', |
align: 'center', |
||||||
align: 'center', |
editBtn: false, |
||||||
editBtn:false, |
searchLabelWidth: 'auto', |
||||||
column: [ |
column: [ |
||||||
{ |
{ |
||||||
label: '提请单号', |
label: '提请单号', |
||||||
prop: 'crCode', |
prop: 'crCode', |
||||||
sortable: true, |
sortable: true, |
||||||
filter: true, |
filter: true, |
||||||
span: 12, |
span: 12, |
||||||
width:180, |
width: 180, |
||||||
search: false, |
search: false, |
||||||
searchOrder: 19, |
searchOrder: 19, |
||||||
rules: [ |
}, |
||||||
{ |
{ |
||||||
required: true, |
label: '物料编号', |
||||||
message: '请输入提请单号', |
prop: 'goodsCode', |
||||||
trigger: 'blur', |
search: true, |
||||||
}, |
sortable: true, |
||||||
], |
filter: true, |
||||||
}, |
width: 140, |
||||||
{ |
span: 12, |
||||||
label: '物料编号', |
searchOrder: 20, |
||||||
prop: 'goodsCode', |
}, |
||||||
search: true, |
{ |
||||||
sortable: true, |
label: '物料名称', |
||||||
filter: true, |
prop: 'goodsName', |
||||||
width:180, |
search: false, |
||||||
span: 12, |
sortable: true, |
||||||
searchOrder: 20, |
filter: true, |
||||||
// dicData: [ |
span: 12, |
||||||
// { |
width: 140, |
||||||
// label: '物料一' |
}, |
||||||
// }, |
{ |
||||||
// { |
label: '规格', |
||||||
// label: '物料二' |
prop: 'specifications', |
||||||
// } |
search: false, |
||||||
// ], |
sortable: true, |
||||||
|
filter: true, |
||||||
rules: [ |
span: 12, |
||||||
{ |
width: 100, |
||||||
required: true, |
}, |
||||||
message: '请输入物料编号', |
{ |
||||||
trigger: 'blur', |
label: '提请数量', |
||||||
}, |
prop: 'quantity', |
||||||
], |
search: false, |
||||||
}, |
sortable: true, |
||||||
{ |
filter: true, |
||||||
label: '物料名称', |
span: 12, |
||||||
prop: 'goodsName', |
width: 100, |
||||||
search: false, |
}, |
||||||
sortable: true, |
{ |
||||||
filter: true, |
label: '提请人', |
||||||
span: 12, |
prop: 'crManName', |
||||||
rules: [ |
search: true, |
||||||
{ |
sortable: true, |
||||||
required: true, |
filter: true, |
||||||
message: '请输入物料名称', |
span: 12, |
||||||
trigger: 'blur', |
}, |
||||||
}, |
{ |
||||||
], |
label: '提请日期', |
||||||
}, |
prop: 'crDate', |
||||||
{ |
search: true, |
||||||
label: '规格', |
sortable: true, |
||||||
prop: 'specifications', |
filter: true, |
||||||
search: false, |
span: 12, |
||||||
sortable: true, |
searchOrder: 16, |
||||||
filter: true, |
width: 150, |
||||||
searchLabelWidth: 60, |
searchRange: true, |
||||||
span: 12, |
type: 'date', |
||||||
rules: [ |
format: 'YYYY-MM-DD', |
||||||
{ |
valueFormat: 'YYYY-MM-DD', |
||||||
required: true, |
startPlaceholder: '开始时间', |
||||||
message: '请输入规格', |
endPlaceholder: '结束时间', |
||||||
trigger: 'blur', |
}, |
||||||
}, |
{ |
||||||
], |
label: '关联订单号', |
||||||
}, |
prop: 'woCode', |
||||||
{ |
search: false, |
||||||
label: '提请数量', |
sortable: true, |
||||||
prop: 'quantity', |
filter: true, |
||||||
search: false, |
span: 12, |
||||||
sortable: true, |
searchOrder: 17, |
||||||
filter: true, |
width: 140, |
||||||
span: 12, |
}, |
||||||
rules: [ |
{ |
||||||
{ |
label: '备注', |
||||||
required: true, |
prop: 'memo', |
||||||
message: '请输入提请数量', |
search: false, |
||||||
trigger: 'blur', |
sortable: true, |
||||||
}, |
filter: true, |
||||||
], |
span: 12, |
||||||
}, |
}, |
||||||
{ |
{ |
||||||
label: '提请人', |
label: '出库状态', |
||||||
prop: 'crManName', |
prop: 'curStatus', |
||||||
// bind: 'crMan.userName', |
search: true, |
||||||
search: true, |
sortable: true, |
||||||
sortable: true, |
filter: true, |
||||||
filter: true, |
span: 12, |
||||||
span: 12, |
searchOrder: 17, |
||||||
rules: [ |
type: 'select', |
||||||
{ |
width: 100, |
||||||
required: true, |
dicData: [ |
||||||
message: '请输入提请人', |
{ label: '新建', value: 1 }, |
||||||
trigger: 'blur', |
{ label: '待出库', value: 15 }, |
||||||
}, |
{ label: '已完成', value: 20 }, |
||||||
], |
{ label: '已删除', value: 21 }, |
||||||
}, |
], |
||||||
{ |
}, |
||||||
label: '提请日期', |
], |
||||||
prop: 'crDate', |
}, |
||||||
search: true, |
form: {}, |
||||||
sortable: true, |
page: { |
||||||
filter: true, |
pageSize: 10, |
||||||
span: 12, |
currentPage: 1, |
||||||
searchOrder: 16, |
total: 0, |
||||||
width:180, |
}, |
||||||
searchRange: true, |
isOpen: false, |
||||||
type: 'date', |
moldAddMore: false, |
||||||
format:"YYYY-MM-DD", |
buyCycle: 0, |
||||||
valueFormat:"YYYY-MM-DD", |
query: {}, |
||||||
startPlaceholder: '开始时间', |
approveDialog: false, |
||||||
endPlaceholder: "结束时间", |
auditForm: {}, |
||||||
|
auditRules: { |
||||||
|
approvalResult: [{ required: true, message: '请选择是否通过审核', trigger: 'blur' }], |
||||||
}, |
}, |
||||||
{ |
}; |
||||||
label: '关联订单号', |
}, |
||||||
prop: 'woCode', |
methods: { |
||||||
search: false, |
// 新增 |
||||||
sortable: true, |
handleAdd() { |
||||||
filter: true, |
this.isOpen = true; |
||||||
span: 12, |
this.moldAddMore = true; |
||||||
searchOrder: 17, |
|
||||||
|
|
||||||
}, |
|
||||||
{ |
|
||||||
label: '备注', |
|
||||||
prop: 'memo', |
|
||||||
search: false, |
|
||||||
sortable: true, |
|
||||||
filter: true, |
|
||||||
span: 12, |
|
||||||
|
|
||||||
}, |
|
||||||
{ |
|
||||||
label: '出库状态', |
|
||||||
prop: 'curStatus', |
|
||||||
search: true, |
|
||||||
sortable: true, |
|
||||||
filter: true, |
|
||||||
span: 12, |
|
||||||
searchOrder: 17, |
|
||||||
type: 'select', |
|
||||||
dicData: [ |
|
||||||
{label: '新建',value:1}, |
|
||||||
{label: '待出库',value:15}, |
|
||||||
{label: '已完成',value:20}, |
|
||||||
{label: '已删除',value:21}, |
|
||||||
] |
|
||||||
|
|
||||||
}, |
|
||||||
] |
|
||||||
}, |
|
||||||
form: { |
|
||||||
|
|
||||||
}, |
|
||||||
page: { |
|
||||||
pageSize: 10, |
|
||||||
currentPage: 1, |
|
||||||
total: 0, |
|
||||||
}, |
|
||||||
isOpen: false, |
|
||||||
moldAddMore: false, |
|
||||||
buyCycle: 0, |
|
||||||
query:{}, |
|
||||||
approveDialog:false, |
|
||||||
auditForm:{}, |
|
||||||
auditRules:{ |
|
||||||
approvalResult:[{ required: true, message: '请选择是否通过审核', trigger: 'blur' }] |
|
||||||
}, |
|
||||||
} |
|
||||||
}, |
}, |
||||||
methods: { |
closeDialog(val) { |
||||||
// 新增 |
this.isOpen = false; |
||||||
handleAdd() { |
if (val) { |
||||||
this.isOpen = true |
this.onLoad(); |
||||||
this.moldAddMore = true |
} |
||||||
}, |
}, |
||||||
closeDialog(val) { |
handeExamine(row) { |
||||||
this.isOpen = false |
this.auditForm = {}; |
||||||
if(val){ |
this.auditForm.id = row.id; |
||||||
this.onLoad() |
this.approveDialog = true; |
||||||
} |
}, |
||||||
}, |
submit() { |
||||||
handeExamine(row){ |
this.$refs.auditForm.validate(valid => { |
||||||
this.auditForm = {} |
if (valid) { |
||||||
this.auditForm.id = row.id |
approve({ ...this.auditForm }).then(res => { |
||||||
this.approveDialog = true |
if (res.data.code == 200) { |
||||||
}, |
this.$message.success('审批成功'); |
||||||
submit(){ |
this.approveDialog = false; |
||||||
this.$refs.auditForm.validate(valid => { |
this.onLoad(); |
||||||
if(valid){ |
|
||||||
approve({...this.auditForm}).then(res =>{ |
|
||||||
if(res.data.code == 200){ |
|
||||||
this.$message.success('审批成功') |
|
||||||
this.approveDialog = false |
|
||||||
this.onLoad() |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
searchChange(params, done){ |
|
||||||
this.query = params |
|
||||||
this.page.currentPage = 1; |
|
||||||
this.onLoad() |
|
||||||
done() |
|
||||||
}, |
|
||||||
searchReset(){ |
|
||||||
this.query = {} |
|
||||||
this.onLoad() |
|
||||||
}, |
|
||||||
handleDelete() { |
|
||||||
if (this.selectionList.length === 0) { |
|
||||||
this.$message.warning('请选择至少一条数据'); |
|
||||||
return; |
|
||||||
} |
|
||||||
this.$confirm('确定将选择数据删除?', { |
|
||||||
confirmButtonText: '确定', |
|
||||||
cancelButtonText: '取消', |
|
||||||
type: 'warning', |
|
||||||
}).then(() => { |
|
||||||
delRequests({ |
|
||||||
ids:this.selectionList.map(item => item.id).join(',') |
|
||||||
}).then(res =>{ |
|
||||||
if(res.data.code == 200){ |
|
||||||
this.$message.success('删除成功') |
|
||||||
this.onLoad() |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 多选 |
|
||||||
selectionChange(list) { |
|
||||||
this.selectionList = list; |
|
||||||
}, |
|
||||||
onLoad() { |
|
||||||
this.loading = true |
|
||||||
let params = { |
|
||||||
...this.query, |
|
||||||
startCrDate:this.query.crDate && this.query.crDate.length != 0 && this.query.crDate[0], |
|
||||||
endCrDate:this.query.crDate && this.query.crDate.length != 0 && this.query.crDate[1], |
|
||||||
} |
} |
||||||
// const {crDate,...validParams} = params |
}); |
||||||
if(params.crDate) delete params.crDate |
|
||||||
getList({ |
|
||||||
current:this.page.currentPage, |
|
||||||
size:this.page.pageSize, |
|
||||||
...params |
|
||||||
}).then(res =>{ |
|
||||||
this.data = res.data.data.records |
|
||||||
this.page.total = res.data.data.total |
|
||||||
this.loading = false |
|
||||||
}) |
|
||||||
} |
} |
||||||
} |
}); |
||||||
} |
}, |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(); |
||||||
|
}, |
||||||
|
handleDelete() { |
||||||
|
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning('请选择至少一条数据'); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm('确定将选择数据删除?', { |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
type: 'warning', |
||||||
|
}).then(() => { |
||||||
|
delRequests({ |
||||||
|
ids: this.selectionList.map(item => item.id).join(','), |
||||||
|
}).then(res => { |
||||||
|
if (res.data.code == 200) { |
||||||
|
this.$message.success('删除成功'); |
||||||
|
this.onLoad(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 多选 |
||||||
|
selectionChange(list) { |
||||||
|
this.selectionList = list; |
||||||
|
}, |
||||||
|
onLoad() { |
||||||
|
this.loading = true; |
||||||
|
let params = { |
||||||
|
...this.query, |
||||||
|
startCrDate: this.query.crDate && this.query.crDate.length != 0 && this.query.crDate[0], |
||||||
|
endCrDate: this.query.crDate && this.query.crDate.length != 0 && this.query.crDate[1], |
||||||
|
}; |
||||||
|
// const {crDate,...validParams} = params |
||||||
|
if (params.crDate) delete params.crDate; |
||||||
|
getList({ |
||||||
|
current: this.page.currentPage, |
||||||
|
size: this.page.pageSize, |
||||||
|
...params, |
||||||
|
}).then(res => { |
||||||
|
this.data = res.data.data.records; |
||||||
|
this.page.total = res.data.data.total; |
||||||
|
this.loading = false; |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
</script> |
</script> |
||||||
<style lang="scss" scoped></style> |
<style lang="scss" scoped></style> |
||||||
Loading…
Reference in new issue