qushaowei
2023-10-24 9d3b355061393f9dd031c1d8aaf124564d9c0d19
src/views/eam/SpecialtyMaintenanceOrderList.vue
@@ -1,7 +1,7 @@
<template>
  <a-card
    :bordered="false"
    title="专业保养工单"
    title="预防性保养工单"
  >
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
@@ -64,13 +64,14 @@
        @click="handleAdd"
        type="primary"
        icon="plus"
        v-has="'specialtyMaintenanceOrder:add'"
      >新增</a-button>
      <a-button
      <!-- <a-button
        v-if="selectedRowKeys.length > 0"
        type="primary"
        @click="batchAssign"
        style="margin-left: 8px"
      >工单派工</a-button>
      >工单派工</a-button> -->
      <!-- <a-button
        type="primary"
        icon="download"
@@ -125,6 +126,7 @@
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange"
        :rowClassName="tableRowClass"
      >
        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
        <span
@@ -135,7 +137,10 @@
            title="确定下发工单吗?"
            @confirm="() => handleOrderIssue(record)"
          >
            <a v-if="record.status == '1'">下发</a>
            <a
              v-has="'specialtyMaintenanceOrder:issue'"
              v-if="record.status == '1'"
            >下发</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '1'"
@@ -145,7 +150,10 @@
            title="确定撤回工单吗?"
            @confirm="() => handleOrderReset(record)"
          >
            <a v-if="record.status == '2'">撤回</a>
            <a
              v-has="'specialtyMaintenanceOrder:issue'"
              v-if="record.status == '2'"
            >撤回</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
@@ -155,7 +163,10 @@
            title="确定恢复工单吗?"
            @confirm="() => handleOrderRecover(record)"
          >
            <a v-if="record.status == '7'">恢复</a>
            <a
              v-has="'specialtyMaintenanceOrder:recover'"
              v-if="record.status == '7'"
            >恢复</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '7'"
@@ -165,7 +176,10 @@
            title="确定作废工单吗?"
            @confirm="() => handleOrderCancel(record)"
          >
            <a v-if="record.status == '2'">作废</a>
            <a
              v-has="'specialtyMaintenanceOrder:recover'"
              v-if="record.status == '2'"
            >作废</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
@@ -175,19 +189,25 @@
            title="确定领取工单吗?"
            @confirm="() => handleOrderGet(record)"
          >
            <a v-if="record.status == '2' && record.assignMode == '1'">领取</a>
            <a
              v-has="'specialtyMaintenanceOrder:get'"
              v-if="record.status == '2' && record.assignMode == '1'"
            >领取</a>
          </a-popconfirm>
          <a
            v-if="record.status == '2' && record.assignMode == '2'  "
            @click="handleAssignOrder(record)"
            v-has="'specialtyMaintenanceOrder:assign'"
          >派工</a>
          <a
            v-if="record.status == '2'&& record.assignMode == '3'  && record.inspectionUserName != null  "
            v-if="record.status == '2'&& record.assignMode == '3'  && record.maintenanceUserName != null  "
            @click="handleAssignOrder(record)"
            v-has="'specialtyMaintenanceOrder:assign'"
          >改派</a>
          <a
            v-if="record.status == '3'"
            @click="handleAssignOrder(record)"
            v-has="'specialtyMaintenanceOrder:assign'"
          >改派</a>
          <a-divider
            v-if="record.status == '2'"
@@ -200,6 +220,7 @@
          <a
            v-if="record.status === '3' || record.status === '4'  "
            @click="handleOrderExe(record)"
            v-has="'specialtyMaintenanceOrder:exe'"
          >执行</a>
          <a-divider
            v-if="record.status === '3' || record.status === '4' "
@@ -208,6 +229,7 @@
          <a
            v-if="record.status === '1'"
            @click="handleEdit(record)"
            v-has="'specialtyMaintenanceOrder:edit'"
          >编辑</a>
          <a-divider
            v-if="record.status === '1'"
@@ -224,7 +246,10 @@
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a v-if="record.status === '1'">删除</a>
                  <a
                    v-has="'specialtyMaintenanceOrder:delete'"
                    v-if="record.status === '1'"
                  >删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
@@ -303,16 +328,7 @@
            return parseInt(index) + 1;
          }
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'statusName'
        },
        {
          title: '维保方式',
          align: "center",
          dataIndex: 'maintenanceMode'
        },
        {
          title: '保养工单号',
          align: "center",
@@ -320,7 +336,7 @@
          scopedSlots: { customRender: 'num' }
        },
        {
          title: '对象部门',
          title: '使用部门',
          align: "center",
          dataIndex: 'departName',
        },
@@ -348,6 +364,16 @@
          title: '责任班组',
          align: "center",
          dataIndex: 'teamName',
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'statusName'
        },
        {
          title: '维保方式',
          align: "center",
          dataIndex: 'maintenanceMode'
        },
        // {
        //   title: '工时定额/每小时',
@@ -444,13 +470,13 @@
  methods: {
    batchAssign() {
      this.$refs.InspectionOrderAssignModal.visible = true
      this.$refs.InspectionOrderAssignModal.title = '工单派工'
      this.$refs.InspectionOrderAssignModal.selectionRows
      this.$refs.InspectionOrderAssignModal.handleShow()
      this.$bus.$emit('selectionRows', this.selectionRows);
    },
    // batchAssign() {
    //   this.$refs.InspectionOrderAssignModal.visible = true
    //   this.$refs.InspectionOrderAssignModal.title = '工单派工'
    //   this.$refs.InspectionOrderAssignModal.selectionRows
    //   this.$refs.InspectionOrderAssignModal.handleShow()
    //   this.$bus.$emit('selectionRows', this.selectionRows);
    // },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows;
    },
@@ -549,9 +575,44 @@
    //   //清空列表选中
    //   this.onClearSelected()
    // },
    //预警颜色
    tableRowClass(record, index) {
      if ("1" == record.status || "2" == record.status) {
        if (record.yellowWarningTime < record.currentDateTime && record.currentDateTime < record.redWarningTime) {
          return 'yellow'
        } else if (record.redWarningTime < record.currentDateTime && record.currentDateTime < record.planStartTime) {
          return 'error'
        } else if (record.planStartTime < record.currentDateTime) {
          return 'frozenRowClass'
        }
      }
    },
  }
}
</script>
<style scoped>
<style >
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
  font-weight: bold;
}
.success {
  color: green;
}
.error {
  color: red;
  font-weight: bold;
}
.yellow {
  color: yellow;
  font-weight: bold;
}
.fontweight {
  font-weight: bold;
}
.ant-table-tbody .red {
  background-color: red !important;
}
</style>