|
|
|
@ -103,8 +103,10 @@ |
|
|
|
width="80" |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" v-if="scope.row.status==='已下达'" @click="closeNotifyModel(scope.row)">关闭</a> |
|
|
|
<a type="text" size="small" v-if="scope.row.status==='已关闭'" @click="openNotify(scope.row)">开启</a> |
|
|
|
<a type="text" size="small" v-if="scope.row.status==='草稿' || scope.row.status==='编辑中'" @click="xiadaNotifyModel(scope.row)">下达</a> |
|
|
|
<a type="text" size="small" v-if="scope.row.status==='待出库'" @click="editNotifyMaterialFun(scope.row)">编辑</a> |
|
|
|
<a type="text" size="small" v-if="scope.row.status!=='已完成'" @click="closeNotifyModel(scope.row)">关闭</a> |
|
|
|
<!-- <a type="text" size="small" v-if="scope.row.status==='已关闭'" @click="openNotify(scope.row)">开启</a>--> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -122,7 +124,12 @@ |
|
|
|
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick"> |
|
|
|
<el-tab-pane label="申请单明细" name="detail"> |
|
|
|
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -10px;"> |
|
|
|
<el-button @click="createOrderDetail()" type="primary" style="margin-left: 10px;margin-top: 0px">{{'新增'}} |
|
|
|
<el-button |
|
|
|
@click="createOrderDetail()" |
|
|
|
type="primary" |
|
|
|
style="margin-left: 10px;margin-top: 0px" |
|
|
|
:disabled="(currentRow.status !== '草稿' && currentRow.status !== '编辑中')"> |
|
|
|
{{'新增'}} |
|
|
|
</el-button> |
|
|
|
</el-form> |
|
|
|
<el-table |
|
|
|
@ -137,7 +144,13 @@ |
|
|
|
width="80" |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" @click="deleteNotifySOSPlus(scope.row)">删除</a> |
|
|
|
<a |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
@click="deleteNotifySOSPlus(scope.row)" |
|
|
|
:class="{ 'disabled-link': currentRow.status !== '草稿' && currentRow.status !== '编辑中' }"> |
|
|
|
删除 |
|
|
|
</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
@ -167,26 +180,6 @@ |
|
|
|
:row-class-name="tableRowClassName" |
|
|
|
v-loading="dataListLoading" |
|
|
|
style="width: 100%; "> |
|
|
|
<!-- <el-table-column--> |
|
|
|
<!-- header-align="center"--> |
|
|
|
<!-- align="center"--> |
|
|
|
<!-- width="80"--> |
|
|
|
<!-- fixed="left"--> |
|
|
|
<!-- label="操作">--> |
|
|
|
<!-- <template slot-scope="scope">--> |
|
|
|
<!-- <a type="text" size="small" @click="printLabel(scope.row)">打印标签</a>--> |
|
|
|
<!-- </template>--> |
|
|
|
<!-- </el-table-column>--> |
|
|
|
<!-- <el-table-column |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="80" |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" v-if="currentRow.status==='已下达'" @click="deleteNotifyMaterial(scope.row)">删除</a> |
|
|
|
|
|
|
|
</template> |
|
|
|
</el-table-column>--> |
|
|
|
<el-table-column |
|
|
|
v-for="(item,index) in columnList3" :key="index" |
|
|
|
:sortable="item.columnSortable" |
|
|
|
@ -839,12 +832,12 @@ |
|
|
|
class="text-right"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<!-- <el-col :span="6"> |
|
|
|
<el-form-item :label="'已申请领料总和'"> |
|
|
|
<el-input v-model="orderDetailData.alreadyApplyTotal" disabled style="text-align: right" |
|
|
|
class="text-right"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-col>--> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label="'此次领料数量'"> |
|
|
|
<el-input-number v-model="orderDetailData.issureQty" style="line-height: 20px;padding: 0;width: 100%" |
|
|
|
@ -854,7 +847,7 @@ |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label="'要求发料时间'"> |
|
|
|
<el-date-picker |
|
|
|
style="width: 165px" |
|
|
|
style="width: 155px" |
|
|
|
v-model="orderDetailData.needDate" |
|
|
|
type="datetime" |
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
@ -891,6 +884,8 @@ |
|
|
|
, createNotify |
|
|
|
, getSOScheduledRoutingListForIssureByPaging |
|
|
|
, getPartListByPaging |
|
|
|
, xiadaNotify |
|
|
|
, editNotifyMaterial |
|
|
|
} from "@/api/orderIssure/soIssueNotify.js" |
|
|
|
import { |
|
|
|
searchShopOrderByPaging |
|
|
|
@ -2226,6 +2221,15 @@ |
|
|
|
], |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 计算属性:判断当前状态是否可编辑 |
|
|
|
isEditableStatusComputed() { |
|
|
|
if (!this.currentRow || !this.currentRow.status) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中'; |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.height = (window.innerHeight- 315) / 2 |
|
|
|
@ -2403,16 +2407,23 @@ |
|
|
|
searchTable(){ |
|
|
|
this.searchData.limit = this.pageSize |
|
|
|
this.searchData.page = this.pageIndex |
|
|
|
searchNotifyHeader(this.searchData).then(({data}) => { |
|
|
|
//区分请求成功和失败的状况 |
|
|
|
if (data && data.code == 0) { |
|
|
|
this.dataList = data.page.list |
|
|
|
this.pageIndex = data.page.currPage |
|
|
|
this.pageSize = data.page.pageSize |
|
|
|
this.totalPage = data.page.totalCount |
|
|
|
} else { |
|
|
|
// 返回 Promise,让外部可以等它完成 |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
searchNotifyHeader(this.searchData).then(({ data }) => { |
|
|
|
if (data && data.code == 0) { |
|
|
|
this.dataList = data.page.list; |
|
|
|
this.pageIndex = data.page.currPage; |
|
|
|
this.pageSize = data.page.pageSize; |
|
|
|
this.totalPage = data.page.totalCount; |
|
|
|
resolve(); // 请求成功,执行 resolve |
|
|
|
} else { |
|
|
|
this.dataList = []; |
|
|
|
reject(new Error(data ? data.msg : '请求失败')); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
reject(err); // 请求出错 |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
closeNotifyModel(row){ |
|
|
|
@ -2429,30 +2440,29 @@ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
let inData={ |
|
|
|
site:this.closeData.site, |
|
|
|
notifyNo:this.closeData.notifyNo, |
|
|
|
closeRemark:this.closeData.closeRemark, |
|
|
|
username:this.$store.state.user.name, |
|
|
|
status:'已关闭', |
|
|
|
} |
|
|
|
updateNotifyStatus(inData).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.closeModalFlag=false |
|
|
|
this.searchTable() |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
duration: 1500, |
|
|
|
onClose: () => {} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
let inData={ |
|
|
|
site:this.closeData.site, |
|
|
|
notifyNo:this.closeData.notifyNo, |
|
|
|
closeRemark:this.closeData.closeRemark, |
|
|
|
username:this.$store.state.user.name, |
|
|
|
status:'已关闭', |
|
|
|
} |
|
|
|
updateNotifyStatus(inData).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.closeModalFlag=false |
|
|
|
this.searchTable() |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
duration: 1500, |
|
|
|
onClose: () => {} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
openNotify(row){ |
|
|
|
this.$confirm('确认打开?', '提示', { |
|
|
|
@ -2506,6 +2516,14 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
deleteNotifySOSPlus(row){ |
|
|
|
// 检查当前状态是否允许编辑 |
|
|
|
if (!this.isEditableStatusComputed) { |
|
|
|
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能删除明细。', '提示', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
this.$confirm('确认删除?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
@ -2599,6 +2617,14 @@ |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// 检查当前状态是否允许编辑 |
|
|
|
if (!this.isEditableStatusComputed) { |
|
|
|
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增明细。', '提示', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// 清除所有数据,设置默认值 |
|
|
|
this.orderDetailData = { |
|
|
|
orderNo: '', |
|
|
|
@ -2634,7 +2660,7 @@ |
|
|
|
this.$message.error('请选择工序'); |
|
|
|
return false |
|
|
|
} |
|
|
|
//校验如果是BOM物料的话,领料数量不能大于工单数量 |
|
|
|
/*//校验如果是BOM物料的话,领料数量不能大于工单数量 |
|
|
|
if (this.orderDetailData.issureQty > this.orderDetailData.qtyRequired){ |
|
|
|
this.$message.error('领取数量不可大于工单/派工数量!'); |
|
|
|
return false |
|
|
|
@ -2644,7 +2670,7 @@ |
|
|
|
if ((this.orderDetailData.issureQty + this.orderDetailData.alreadyApplyTotal) > this.orderDetailData.qtyRequired){ |
|
|
|
this.$message.error('申请总和不可超出工单/派工数量!'); |
|
|
|
return false |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.orderDetailData.needDate) { |
|
|
|
@ -3150,8 +3176,111 @@ |
|
|
|
|
|
|
|
this.$message.success('选择物料成功,数据已填入表单'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
//下达申请单方法 |
|
|
|
async xiadaNotifyModel(row){ |
|
|
|
// 设置当前行为要下达的行 |
|
|
|
this.currentRow = JSON.parse(JSON.stringify(row)); |
|
|
|
|
|
|
|
// 先刷新子表数据,确保获取最新数据 |
|
|
|
await this.refreshAllSubTables(); |
|
|
|
|
|
|
|
console.log('申请单明细数据:', this.dataList2); |
|
|
|
console.log('材料明细数据:', this.dataList3); |
|
|
|
|
|
|
|
if(this.dataList2.length==0 || this.dataList3.length==0){ |
|
|
|
this.$alert('没有明细记录无法下达!!', '提示', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
xiadaNotify(row).then(({data})=>{ |
|
|
|
if (data.code === 0) { |
|
|
|
//刷新主表数据 |
|
|
|
this.searchTable().then(() => { // 等刷新完成 |
|
|
|
const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); |
|
|
|
if (foundRow) { |
|
|
|
this.currentRow = JSON.parse(JSON.stringify(foundRow)); |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.mainTable.setCurrentRow(foundRow); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.$message.success( '操作成功') |
|
|
|
}else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 刷新所有子表数据 |
|
|
|
async refreshAllSubTables() { |
|
|
|
if(!this.currentRow || !this.currentRow.notifyNo) { |
|
|
|
console.warn('当前行数据为空,无法刷新子表数据'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 并行请求所有子表数据 |
|
|
|
const [detailData, materialData] = await Promise.all([ |
|
|
|
searchNotifyOrderList(this.currentRow), |
|
|
|
searchNotifyMaterialList(this.currentRow) |
|
|
|
]); |
|
|
|
|
|
|
|
// 更新申请单明细数据 |
|
|
|
if (detailData.data && detailData.data.code == 0) { |
|
|
|
this.dataList2 = detailData.data.rows; |
|
|
|
} else { |
|
|
|
this.dataList2 = []; |
|
|
|
} |
|
|
|
|
|
|
|
// 更新材料明细数据 |
|
|
|
if (materialData.data && materialData.data.code == 0) { |
|
|
|
this.dataList3 = materialData.data.rows; |
|
|
|
} else { |
|
|
|
this.dataList3 = []; |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('刷新子表数据失败:', error); |
|
|
|
this.$message.error('刷新子表数据失败,请稍后重试'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
editNotifyMaterialFun(row){ |
|
|
|
// 设置当前行为要编辑的行 |
|
|
|
this.currentRow = JSON.parse(JSON.stringify(row)); |
|
|
|
|
|
|
|
editNotifyMaterial(row).then(({data})=>{ |
|
|
|
if (data.code === 0) { |
|
|
|
//刷新主表数据 |
|
|
|
this.searchTable().then(() => { // 等刷新完成 |
|
|
|
const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); |
|
|
|
if (foundRow) { |
|
|
|
this.currentRow = JSON.parse(JSON.stringify(foundRow)); |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.mainTable.setCurrentRow(foundRow); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.$message.success( '操作成功') |
|
|
|
}else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 判断当前状态是否可编辑 |
|
|
|
isEditableStatus() { |
|
|
|
if (!this.currentRow || !this.currentRow.status) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中'; |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
@ -3190,4 +3319,15 @@ |
|
|
|
flex-shrink: 0; |
|
|
|
min-width: 30px; |
|
|
|
} |
|
|
|
|
|
|
|
.disabled-link { |
|
|
|
cursor: not-allowed !important; |
|
|
|
color: #C0C4CC !important; |
|
|
|
pointer-events: none; |
|
|
|
} |
|
|
|
|
|
|
|
.disabled-text { |
|
|
|
color: #C0C4CC !important; |
|
|
|
cursor: not-allowed !important; |
|
|
|
} |
|
|
|
</style> |