hyingbo
16 小时以前 ff1f734e5f37cdd004f6c8bf88a2917737e1ff08
src/views/eam/repair/EamReportRepairList.vue
@@ -58,7 +58,7 @@
    <!-- 操作按钮区域 -->
    <div class="table-operator" v-if="isDisplayOperation">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button @click="handleAdd" type="primary" icon="plus" v-if="isShowAuth('eam:reportRepair:add')">新增</a-button>
      <!--<a-button type="primary" icon="download" @click="handleExportXls('故障报修')">导出</a-button>-->
      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
      <!--@change="handleImportExcel">-->
@@ -66,7 +66,7 @@
      <!--</a-upload>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
          <a-menu-item key="1" @click="batchDel" v-if="isShowAuth('eam:reportRepair:abolish')">
            <a-icon type="delete"/>
            作废
          </a-menu-item>
@@ -96,22 +96,23 @@
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:isDisplayOperation?'checkbox':'radio',getCheckboxProps:getCheckboxProps}"
        @change="handleTableChange">
        @change="handleTableChange"
        :rowClassName="getRowClassName">
        <template slot="imageFiles" slot-scope="text, record" v-if="text">
          <a @click="handlePreviewImages(record)">预览</a>
        </template>
        <span slot="action" slot-scope="text, record" v-if="record.reportStatus=='WAIT_REPAIR'">
          <a @click="handleEdit(record)">编辑</a>
          <a @click="handleEdit(record)" v-if="isShowAuth('eam:reportRepair:edit')">编辑</a>
          <a-divider type="vertical"/>
          <a-divider type="vertical" v-if="isShowAuth('eam:reportRepair:edit')"/>
          <a @click="handleAssign(record)">指派</a>
          <a @click="handleAssign(record)" v-if="isShowAuth('eam:reportRepair:assign')">指派</a>
          <a-divider type="vertical"/>
          <a-divider type="vertical" v-if="isShowAuth('eam:reportRepair:assign')"/>
          <a-popconfirm title="确定作废吗?" @confirm="() => handleDelete(record.id)">
          <a-popconfirm title="确定作废吗?" @confirm="() => handleDelete(record.id)" v-if="isShowAuth('eam:reportRepair:abolish')">
            <a>作废</a>
          </a-popconfirm>
        </span>
@@ -178,7 +179,13 @@
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId_dictText',
            dataIndex: 'equipmentCode',
            width: 200
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
            width: 200
          },
          {
@@ -268,6 +275,26 @@
      this.loadData(1)
    },
    methods: {
      /**
       * 计算当前时间是否大于故障开始时间+3天
       * @param record 表格行数据
       * @returns {string} 行样式类名
       */
      getRowClassName(record) {
        if ('WAIT_REPAIR' !== record.reportStatus) return '';
        // 解析故障开始时间
        const faultStartTime = new Date(record.createTime);
        // 计算故障开始时间+3天的时间戳
        const threeDaysLater = new Date(faultStartTime.getTime() + 3 * 24 * 60 * 60 * 1000);
        // 获取当前时间
        const now = new Date();
        // 如果当前时间大于故障开始时间+3天,返回标红样式类名
        return now > threeDaysLater ? 'row-overdue' : '';
      },
      /**
       * 获取数据字典值
       * @param dictCode 数据字典对应记录编码
@@ -343,4 +370,8 @@
</script>
<style scoped>
  @import '~@assets/less/common.less';
  /* 添加标红样式 */
  ::v-deep .row-overdue {
    color: red !important;
  }
</style>