diff --git a/src/api/orderIssure/soIssueNotify.js b/src/api/orderIssure/soIssueNotify.js
index 7a4ad46..5f2b7bb 100644
--- a/src/api/orderIssure/soIssueNotify.js
+++ b/src/api/orderIssure/soIssueNotify.js
@@ -17,6 +17,7 @@ export const deleteNotifySOS= data => createAPI(`/orderIssure/issureNotify/delet
export const deleteNotify= data => createAPI(`/orderIssure/issureNotify/deleteNotify`,'post',data)
export const xiadaNotify= data => createAPI(`/orderIssure/issureNotify/xiadaNotify`,'post',data)
+export const editNotifyMaterial= data => createAPI(`/orderIssure/issureNotify/editNotifyMaterial`,'post',data)
export const searchNotifyHeader= data => createAPI(`/orderIssure/issureNotify/searchNotifyHeader`,'post',data)
diff --git a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue
index b230187..bad215f 100644
--- a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue
+++ b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue
@@ -103,8 +103,10 @@
width="80"
label="操作">
- 关闭
- 开启
+ 下达
+ 编辑
+ 关闭
+
@@ -122,7 +124,12 @@
- {{'新增'}}
+
+ {{'新增'}}
- 删除
+
+ 删除
+
-
-
-
-
-
-
-
-
-
-
-
-
+
{
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 === '编辑中';
+ },
+ },
}
@@ -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;
+}