You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
652 lines
19 KiB
652 lines
19 KiB
<template> |
|
<div> |
|
<!-- 表格数据 --> |
|
<avue-crud |
|
:height="460" |
|
:option="option" |
|
:table-loading="loading" |
|
:data="data" |
|
v-model="form" |
|
v-model:page="page" |
|
ref="crud" |
|
@row-del="rowDel" |
|
@search-change="searchChange" |
|
@search-reset="searchReset" |
|
@selection-change="selectionChange" |
|
@current-change="currentChange" |
|
@size-change="sizeChange" |
|
@refresh-change="refreshChange" |
|
@on-load="onLoad" |
|
> |
|
<template #usageAmount="{row}"> |
|
{{row.goodsDemand - row.surplus}} |
|
</template> |
|
<template #menu-left="row"> |
|
<el-button type="primary" @click="handleAdd">需求申报</el-button> |
|
<el-button type="primary" @click="handleApprove">批量审核</el-button> |
|
</template> |
|
<template #menu-right> |
|
<el-button type="warning" @click="pendingReviewFn()" >待审核</el-button> |
|
</template> |
|
<template #menu="{ row }"> |
|
<el-button type="text" @click="handleView(row)">详情</el-button> |
|
<el-button type="text" @click="closeRow(row)" v-show="row.status != 10006 && (row.status == 10000 || row.status == 10005)">关闭</el-button> |
|
<el-button type="text" v-show="row.status == 10006 || row.status == 10000 || row.status == 10005" @click="deleteRow(row)">删除</el-button> |
|
<el-button type="text" v-show="row.status == 10000" @click="approveRow(row)">审核</el-button> |
|
</template> |
|
</avue-crud> |
|
<coating-add-dialog :show-dialog="showDialog" @closeDialog="closeDialog"></coating-add-dialog> |
|
<material-detail :material-dialog="materialDialog" @closeDialog="closeDialog" :id="id"></material-detail> |
|
<!-- <add-quantity :add-quantity="addQuantity" @closeDialog="closeDialog"></add-quantity> |
|
<add-dialog :add-dialog="addDialog" @closeDialog="closeDialog"></add-dialog> --> |
|
|
|
<el-dialog append-to-body width="550px" title="审核" v-model="approveDialog"> |
|
<el-form ref="approveForm" :model="approveForm" :rules="approveRules"> |
|
<el-form-item label="审核结果" prop="approvalStatus"> |
|
<el-radio-group v-model="approveForm.approvalStatus" @input="changeType"> |
|
<el-radio :label="10001">审批通过</el-radio> |
|
<el-radio :label="10005">审批不通过</el-radio> |
|
</el-radio-group> |
|
</el-form-item> |
|
<el-form-item label="审核意见" prop="approvalMemo"> |
|
<el-input type="textarea" v-model="approveForm.approvalMemo"></el-input> |
|
</el-form-item> |
|
</el-form> |
|
<template #footer> |
|
<span class="dialog-footer"> |
|
<el-button @click="approveDialog = false">取 消</el-button> |
|
<el-button type="primary" @click="submitApprove">确 定</el-button> |
|
</span> |
|
</template> |
|
</el-dialog> |
|
</div> |
|
</template> |
|
|
|
<script> |
|
import { |
|
getList, |
|
confirmBatch, |
|
closeBatchs, |
|
removeByIds, |
|
getOrderMoldPlanCaDeatils |
|
} from '@/api/productionManagement/coatingMaterial'; |
|
import coatingAddDialog from '../coatingAddDialog.vue'; |
|
import coatingColumnData from '../../js/coatingColumnData'; |
|
import materialDetail from '../materialDetail.vue'; |
|
export default { |
|
components: { |
|
coatingAddDialog, |
|
materialDetail, |
|
}, |
|
data() { |
|
return { |
|
id:null, |
|
searchForm: {}, |
|
tabPosition: 'materialRequirements', |
|
loading: false, |
|
data: [], |
|
form: {}, |
|
addDialog: false, |
|
showDialog: false, |
|
materialDialog: false, |
|
approveForm: {}, |
|
addQuantity: false, |
|
option: { |
|
columnSort: true, |
|
tip: false, |
|
height: 'auto', |
|
calcHeight: 32, |
|
simplePage: false, |
|
searchShow: true, |
|
searchMenuSpan: 6, |
|
searchIcon: true, |
|
searchIndex: 3, |
|
tree: false, |
|
border: true, |
|
index: false, |
|
selection: true, |
|
viewBtn: false, |
|
delBtn: false, |
|
editBtn: false, |
|
addBtnIcon: ' ', |
|
viewBtnIcon: ' ', |
|
delBtnIcon: ' ', |
|
editBtnIcon: ' ', |
|
addBtn: false, |
|
labelWidth: 120, |
|
searchLabelWidth: 120, |
|
menu: true, |
|
menuWidth: 200, |
|
dialogWidth: 600, |
|
dialogClickModal: false, |
|
searchEnter: true, |
|
excelBtn: true, |
|
gridBtn: false, |
|
searchShowBtn: false, |
|
showOverflowTooltip: true, |
|
searchLabelPosition: 'left', |
|
filterBtn: true, |
|
searchLabelPosition: 'left', |
|
searchGutter: 24, |
|
searchSpan: 6, |
|
menuAlign: 'left', |
|
gridBtn: false, |
|
searchMenuPosition: 'right', |
|
align: 'center', |
|
column: [ |
|
{ |
|
label: '需求单号', |
|
prop: 'demandCode', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: true, |
|
headerAlign: 'center', |
|
align: 'center', |
|
searchLabelWidth: 80, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入需求单号', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '作业中心', |
|
prop: 'wcId', |
|
span: 24, |
|
type: 'select', |
|
width: 150, |
|
overflow: true, |
|
search: true, |
|
headerAlign: 'center', |
|
align: 'center', |
|
searchLabelWidth: 80, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入作业中心', |
|
trigger: 'blur', |
|
}, |
|
], |
|
dicUrl: '/blade-desk/bsWorkCenter/getList', |
|
props: { |
|
label: 'wcName', |
|
value: 'id', |
|
}, |
|
}, |
|
{ |
|
label: '物料编号', |
|
prop: 'plateGoodsCode', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入物料编号', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '物料名称', |
|
prop: 'goodsName', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入物料名称', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
// { |
|
// label: '金钾(克)', |
|
// prop: 'goldPotassium', |
|
// span: 24, |
|
// width: 150, |
|
// overflow: true, |
|
// search: false, |
|
// headerAlign: 'center', |
|
// align: 'center', |
|
// rules: [ |
|
// { |
|
// required: true, |
|
// message: '请输入金钾(克)', |
|
// trigger: 'blur', |
|
// }, |
|
// ], |
|
// }, |
|
// { |
|
// label: '银钾(克)', |
|
// prop: 'silverPotassium', |
|
// span: 24, |
|
// width: 150, |
|
// overflow: true, |
|
// search: false, |
|
// headerAlign: 'center', |
|
// align: 'center', |
|
// rules: [ |
|
// { |
|
// required: true, |
|
// message: '请输入银钾(克)', |
|
// trigger: 'blur', |
|
// }, |
|
// ], |
|
// }, |
|
{ |
|
label: '物料需求量(克)', |
|
prop: 'goodsDemand', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入银钾(克)', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '银钾系数', |
|
prop: 'coefficient', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入银钾系数', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '使用量(克)', |
|
prop: 'usageAmount', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入使用量(克)', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '剩余量(克)', |
|
prop: 'surplus', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入剩余量(克)', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '状态', |
|
prop: 'status', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: true, |
|
type: 'select', |
|
headerAlign: 'center', |
|
align: 'center', |
|
searchLabelWidth: 50, |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入状态', |
|
trigger: 'blur', |
|
}, |
|
], |
|
dicData: [ |
|
// { label: '待审核', value: '1' }, |
|
// { label: '审核不通过', value: '2' }, |
|
// { label: '已关闭', value: '3' }, |
|
// { label: '审核通过', value: '4' }, |
|
// { label: '已过期', value: '5' }, |
|
{ label: '待审核', value: 10000 }, |
|
{ label: '审核通过', value: 10001 }, |
|
{ label: "使用中", value:10002}, |
|
{ label: '审核不通过', value: 10005 }, |
|
{ label: '已完成',value:10004}, |
|
{ label: '已超期', value: 10003 }, |
|
{ label: '已关闭', value: 10006 }, |
|
] |
|
}, |
|
{ |
|
label: '关联订单数', |
|
prop: 'detailOrderNum', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入关联订单数', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '创建人', |
|
prop: 'createUserName', |
|
span: 24, |
|
width: 150, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入创建人', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
{ |
|
label: '创建时间', |
|
prop: 'createTime', |
|
span: 24, |
|
width: 200, |
|
overflow: true, |
|
search: false, |
|
headerAlign: 'center', |
|
align: 'center', |
|
rules: [ |
|
{ |
|
required: true, |
|
message: '请输入创建时间', |
|
trigger: 'blur', |
|
}, |
|
], |
|
}, |
|
], |
|
}, |
|
approveRules: { |
|
approvalStatus: [{ required: true, message: '请选择审核结果', trigger: 'blur' }], |
|
approvalMemo: [{ required: true, message: '请输入审核意见', trigger: 'blur' }], |
|
}, |
|
approveDialog: false, |
|
page: { |
|
pageSize: 10, |
|
currentPage: 1, |
|
total: 0, |
|
}, |
|
selectionList: [], |
|
confirmBatchId: null, |
|
query:{} |
|
}; |
|
}, |
|
mounted() { |
|
// this.option.column = coatingColumnData[this.tabPosition]; |
|
}, |
|
methods: { |
|
// 待审核搜索 |
|
pendingReviewFn() { |
|
this.query.status = 10000 |
|
this.onLoad() |
|
// this.onLoad(this.page, { status: 10000 }); |
|
}, |
|
searchReset() { |
|
this.query = {}; |
|
this.onLoad(this.page); |
|
}, |
|
searchChange(params, done) { |
|
this.query = params; |
|
this.page.currentPage = 1; |
|
this.onLoad(this.page, params); |
|
done(); |
|
}, |
|
// 多选 |
|
selectionChange(list) { |
|
this.selectionList = list; |
|
}, |
|
// 点击详情 |
|
handleView(row) { |
|
if (this.tabPosition == 'materialRequirements') { |
|
this.id=row.id |
|
this.materialDialog = true; |
|
} |
|
}, |
|
deleteRow(row) { |
|
this.$confirm('确定删除此条数据?', { |
|
confirmButtonText: '确定', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(() => { |
|
const ids = row.id; |
|
removeByIds({ ids:ids }).then(res => { |
|
if (res.data.code === 200) { |
|
this.$message.success('删除成功'); |
|
this.$refs.crud.toggleSelection(); |
|
this.onLoad(this.page); |
|
} |
|
}); |
|
}); |
|
}, |
|
closeRow(row) { |
|
this.$confirm('确定关闭此条数据?', { |
|
confirmButtonText: '确定', |
|
cancelButtonText: '取消', |
|
type: 'warning', |
|
}).then(() => { |
|
const ids = row.id; |
|
closeBatchs({ ids }).then(res => { |
|
if (res.data.code === 200) { |
|
this.$message.success('关闭成功'); |
|
this.$refs.crud.toggleSelection(); |
|
this.onLoad(this.page); |
|
} |
|
}); |
|
}); |
|
}, |
|
// 新增按钮点击 |
|
handleAdd() { |
|
this.showDialog = true; |
|
}, |
|
// 关闭弹窗 |
|
closeDialog(val) { |
|
this.showDialog = false; |
|
this.materialDialog = false; |
|
this.addQuantity = false; |
|
this.addDialog = false; |
|
if(val){ |
|
this.onLoad() |
|
} |
|
}, |
|
addQuantityClick() { |
|
if (this.selectionList.length == 0) { |
|
this.$message.error('请至少选择一条数据!'); |
|
} else { |
|
this.addQuantity = true; |
|
} |
|
}, |
|
approveRow(val) { |
|
this.selectionList = [] |
|
this.selectionList.push(val); |
|
this.approveDialog = true; |
|
}, |
|
handleApprove() { |
|
if (this.selectionList.length != 0) { |
|
let tmp = this.selectionList.find(item => item.status != 10000) |
|
if(tmp){ |
|
this.$message.error("请选择状态为【待审核】的数据") |
|
return |
|
} |
|
this.approveDialog = true; |
|
} else { |
|
this.$message.error('请至少选择一条数据!'); |
|
} |
|
}, |
|
submitApprove() { |
|
this.$refs.approveForm.validate(valid => { |
|
if (valid) { |
|
const ids = this.selectionList.map(item => item.id).join(','); |
|
confirmBatch({ |
|
ids:ids, |
|
...this.approveForm |
|
}).then(res =>{ |
|
if(res.data.code == 200){ |
|
this.$message.success('审核成功'); |
|
this.approveDialog = false; |
|
this.selectionList = [] |
|
this.onLoad() |
|
} |
|
}) |
|
// confirmBatch({ ...{ ids }, ...this.approveForm }).then(res => { |
|
// if (res.code === 200) { |
|
// this.$message.success('审核成功'); |
|
// } |
|
// }); |
|
// this.approveDialog = false; |
|
// this.$refs.crud.toggleSelection(); |
|
// this.onLoad(this.page); |
|
} |
|
}); |
|
}, |
|
selectionClear() { |
|
this.selectionList = []; |
|
this.$refs.crud.toggleSelection(); |
|
}, |
|
async onLoad(page, params = {}) { |
|
this.loading = true; |
|
try { |
|
const res = await getList({ |
|
current:this.page.currentPage, |
|
size:this.page.pageSize, |
|
...this.query |
|
}); |
|
// if (res.code) { |
|
this.data = res.data.data.records; |
|
this.page.total = res.data.data.total; |
|
this.selectionClear(); |
|
this.loading = false; |
|
// } |
|
} catch (err) { |
|
console.log(err); |
|
} |
|
// this.data = [ |
|
// { |
|
// id: 1, |
|
// requiredCode: '001', |
|
// workCenter: 1, |
|
// goodsCode: 'wl_001', |
|
// goodsName: '物料名称22', |
|
// goldPotassium: 20, |
|
// silverPotassium: 30, |
|
// coefficient: 2, |
|
// usageAmount: 20, |
|
// goodsDemandResidue: 20, |
|
// status: 1, |
|
// ordersNumber: 15, |
|
// createMan: '张三', |
|
// createTime: '2025-10-20 11:20:32', |
|
// }, |
|
// { |
|
// id: 2, |
|
// requiredCode: '002', |
|
// workCenter: 1, |
|
// goodsCode: 'wl_001', |
|
// goodsName: '物料名称', |
|
// goldPotassium: 20, |
|
// silverPotassium: 30, |
|
// coefficient: 2, |
|
// usageAmount: 20, |
|
// goodsDemandResidue: 20, |
|
// status: 2, |
|
// ordersNumber: 15, |
|
// createMan: '张三', |
|
// createTime: '2025-10-20 11:20:32', |
|
// }, |
|
// { |
|
// id: 3, |
|
// requiredCode: '002', |
|
// workCenter: 1, |
|
// goodsCode: 'wl_001', |
|
// goodsName: '物料名称', |
|
// goldPotassium: 20, |
|
// silverPotassium: 30, |
|
// coefficient: 2, |
|
// usageAmount: 20, |
|
// goodsDemandResidue: 20, |
|
// status: 3, |
|
// ordersNumber: 15, |
|
// createMan: '张三', |
|
// createTime: '2025-10-20 11:20:32', |
|
// }, |
|
// { |
|
// id: 4, |
|
// requiredCode: '002', |
|
// workCenter: 1, |
|
// goodsCode: 'wl_001', |
|
// goodsName: '物料名称', |
|
// goldPotassium: 20, |
|
// silverPotassium: 30, |
|
// coefficient: 2, |
|
// usageAmount: 20, |
|
// goodsDemandResidue: 20, |
|
// status: 4, |
|
// ordersNumber: 15, |
|
// createMan: '张三', |
|
// createTime: '2025-10-20 11:20:32', |
|
// }, |
|
// { |
|
// id: 5, |
|
// requiredCode: '002', |
|
// workCenter: 1, |
|
// goodsCode: 'wl_001', |
|
// goodsName: '物料名称', |
|
// goldPotassium: 20, |
|
// silverPotassium: 30, |
|
// coefficient: 2, |
|
// usageAmount: 20, |
|
// goodsDemandResidue: 20, |
|
// status: 5, |
|
// ordersNumber: 15, |
|
// createMan: '张三', |
|
// createTime: '2025-10-20 11:20:32', |
|
// }, |
|
// ]; |
|
|
|
}, |
|
}, |
|
}; |
|
</script> |
|
|
|
<style></style>
|
|
|