|
|
@@ -53,6 +53,18 @@
|
|
|
|
|
|
<taskDialog ref="taskDialogRef" @reload="getData" />
|
|
|
|
|
|
+ <!-- 派单 -->
|
|
|
+ <programRulesDialog
|
|
|
+ ref="programRulesDialogRef"
|
|
|
+ @reload="getData"
|
|
|
+ ></programRulesDialog>
|
|
|
+
|
|
|
+ <!-- 报工 -->
|
|
|
+ <workOrderReport
|
|
|
+ ref="workOrderReportRef"
|
|
|
+ @refresh="getData"
|
|
|
+ ></workOrderReport>
|
|
|
+
|
|
|
<PlanRulesDialog
|
|
|
ref="planRulesDialogRef"
|
|
|
@reload="getData"
|
|
|
@@ -70,13 +82,17 @@
|
|
|
import PlanRulesDialog from './PlanRulesDialog.vue';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import tableColumnsMixin from '@/mixins/tableColumnsMixin';
|
|
|
+ import programRulesDialog from '@/views/batchRecord/components/programRulesDialog.vue';
|
|
|
+ import workOrderReport from '@/views/batchRecord/components/workOrderReport.vue';
|
|
|
|
|
|
export default {
|
|
|
mixins: [dictMixins, tableColumnsMixin],
|
|
|
components: {
|
|
|
releaseRulesDialog,
|
|
|
taskDialog,
|
|
|
- PlanRulesDialog
|
|
|
+ PlanRulesDialog,
|
|
|
+ programRulesDialog,
|
|
|
+ workOrderReport
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -91,7 +107,9 @@
|
|
|
butLoad: false,
|
|
|
// 记录规则
|
|
|
showReleaseRulesDialog: false,
|
|
|
- loading: true
|
|
|
+ loading: true,
|
|
|
+ programRulesDialogVisible: false,
|
|
|
+ programRulesInfo: {}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -146,7 +164,7 @@
|
|
|
minWidth: 150,
|
|
|
formatter: (row) => {
|
|
|
// 毫秒转小时
|
|
|
- return row.duration
|
|
|
+ return row.duration && row.executeStatus == 2
|
|
|
? (row.duration / 1000 / 60 / 60).toFixed(2) + ' 时'
|
|
|
: '';
|
|
|
}
|
|
|
@@ -240,9 +258,42 @@
|
|
|
// 计划规则 巡点检 设备保养
|
|
|
this.$refs.planRulesDialogRef.open(item);
|
|
|
} else if (item.itemType == 2) {
|
|
|
- if((!item.plans || item.plans.length == 0) && item.executeMethod == 1) {
|
|
|
- this.$message.error('未生成记录计划');
|
|
|
- return;
|
|
|
+ // 事件驱动
|
|
|
+ if(item.executeMethod == 1) {
|
|
|
+ // 是否有计划
|
|
|
+ if(!item.plans || item.plans.length == 0) {
|
|
|
+ this.$message.error('未生成记录计划');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 有计划无工单 派单
|
|
|
+ if(item.plans && item.plans.length > 0 && (!item.records || item.records.length == 0)) {
|
|
|
+ this.$refs.programRulesDialogRef.open('dispatch', item.plans[0], item.plans);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 有计划有工单未报工执行中 报工
|
|
|
+ if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && (item.executeStatus == 1 || item.executeStatus == 0)) {
|
|
|
+ item.plans.forEach(plan => {
|
|
|
+ // 找到records数组中planid与当前plan.id匹配的记录
|
|
|
+ plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
|
|
|
+ });
|
|
|
+ console.log('匹配后的plans数组:', item);
|
|
|
+ this.$refs.workOrderReportRef.open('add', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 有计划有工单已报工 详情
|
|
|
+ if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && item.executeStatus == 2) {
|
|
|
+ item.plans.forEach(plan => {
|
|
|
+ // 找到records数组中planid与当前plan.id匹配的记录
|
|
|
+ plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
|
|
|
+ });
|
|
|
+ console.log('详情匹配后的plans数组:', item);
|
|
|
+ if(item.plans[0]?.matchedRecords.length == 0) {
|
|
|
+ this.$message.error('未生成工单');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs.workOrderReportRef.open('detail', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
this.$refs.releaseRulesDialogRef.open(
|
|
|
item,
|