|
|
@@ -764,8 +764,14 @@
|
|
|
// 仅仅查看
|
|
|
openView(productionInfo, workOrderInfo) {
|
|
|
this.type = 'detail';
|
|
|
+ if (productionInfo && productionInfo.recordId == null) {
|
|
|
+ productionInfo.recordId = productionInfo.id;
|
|
|
+ }
|
|
|
this.open(productionInfo, workOrderInfo);
|
|
|
},
|
|
|
+ getRecordId() {
|
|
|
+ return this.productionInfo?.recordId || this.addForm.id || null;
|
|
|
+ },
|
|
|
open(productionInfo, workOrderInfo) {
|
|
|
console.log(
|
|
|
'productionInfo, workOrderInfo',
|
|
|
@@ -777,7 +783,7 @@
|
|
|
this.workOrderInfo = workOrderInfo;
|
|
|
|
|
|
// 存在缓存记录
|
|
|
- if (this.productionInfo.recordId != null) {
|
|
|
+ if (this.getRecordId() != null) {
|
|
|
// 查询详情
|
|
|
this.getCacheInfo();
|
|
|
} else {
|
|
|
@@ -822,7 +828,9 @@
|
|
|
console.log('this.productionInfo', this.productionInfo);
|
|
|
console.log('this.addForm', this.addForm);
|
|
|
this.$nextTick(() => {
|
|
|
- this.getListByWorkOrderId();
|
|
|
+ if (this.getRecordId() == null) {
|
|
|
+ this.getListByWorkOrderId();
|
|
|
+ }
|
|
|
this.getRuleInfo();
|
|
|
});
|
|
|
},
|
|
|
@@ -830,7 +838,7 @@
|
|
|
async getCacheInfo() {
|
|
|
this.loading = true;
|
|
|
try {
|
|
|
- const data = await getById(this.productionInfo.recordId);
|
|
|
+ const data = await getById(this.getRecordId());
|
|
|
console.log('dat 缓存', data);
|
|
|
data.details = data.details.map((i) => {
|
|
|
i.toolNames = i.tools.map((j) => j.toolName).join(',');
|
|
|
@@ -879,22 +887,21 @@
|
|
|
},
|
|
|
// 物料信息查询
|
|
|
async getListByWorkOrderId(type = '') {
|
|
|
+ const recordId = this.getRecordId();
|
|
|
+ const produceTaskId =
|
|
|
+ this.addForm.produceTaskId || this.productionInfo.produceTaskId;
|
|
|
console.log(
|
|
|
'type 物料信息',
|
|
|
type,
|
|
|
- this.productionInfo.produceTaskId,
|
|
|
+ produceTaskId,
|
|
|
this.addForm.reportWorkType
|
|
|
);
|
|
|
- if (
|
|
|
- !this.productionInfo.produceTaskId ||
|
|
|
- this.addForm.reportWorkType != 2
|
|
|
- )
|
|
|
- return;
|
|
|
+ if (!produceTaskId || this.addForm.reportWorkType != 2) return;
|
|
|
// 查询物料信息
|
|
|
const materialObject = await queryListByWorkOrderId({
|
|
|
workOrderId: this.addForm.workOrderId,
|
|
|
- recordId: this.productionInfo.recordId,
|
|
|
- produceTaskId: this.productionInfo.produceTaskId,
|
|
|
+ recordId,
|
|
|
+ produceTaskId,
|
|
|
ruleId: this.addForm.ruleId
|
|
|
});
|
|
|
|
|
|
@@ -1004,7 +1011,7 @@
|
|
|
const data = await getRecordRulesDetail(this.productionInfo.ruleId);
|
|
|
this.ruleInfo = data;
|
|
|
console.log('this.ruleInfo', this.ruleInfo);
|
|
|
- if (this.productionInfo.recordId == null) {
|
|
|
+ if (this.getRecordId() == null) {
|
|
|
// 赋值表单信息
|
|
|
this.addForm.recordRulesClassify = this.ruleInfo.classify + '';
|
|
|
this.addForm.recordTemplateStyle =
|