吴羡
11 小时以前 a1faa94fbf85553f22da934a1abc745d89dd8667
src/views/CNAS/resourceDemand/device/component/record.vue
@@ -17,7 +17,7 @@
        </el-form-item>
      </el-form>
      <div>
        <el-button size="small" type="primary" @click="dialogVisible = true, openAdd()">新 建</el-button>
        <el-button v-if="isMenuList !== 1" size="small" type="primary" @click="dialogVisible = true, openAdd()">新 建</el-button>
        <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">导 出</el-button>
      </div>
    </div>
@@ -45,8 +45,8 @@
          </template>
        </el-table-column>
        <!--        <el-table-column label="异常情况" min-width="120" prop="abnormal" />-->
        <el-table-column label="使用开始日期" min-width="170" prop="useStartDate" />
        <el-table-column label="使用结束日期" min-width="170" prop="useEndDate" />
        <el-table-column label="使用开始日期" min-width="170" prop="useStartDate" :formatter="formatDateCell" />
        <el-table-column label="使用结束日期" min-width="170" prop="useEndDate" :formatter="formatDateCell" />
        <el-table-column label="使用人" min-width="120" prop="usePerson" />
        <el-table-column label="备注" min-width="120" prop="remark" />
        <!-- 操作按钮 -->
@@ -58,7 +58,7 @@
          </template>
        </el-table-column>
      </el-table>
      <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
      <el-pagination :current-page="search.current" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
        :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" background>
      </el-pagination>
@@ -157,6 +157,8 @@
  deleteDeviceRecord,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { formatListDate } from './dateFormat';
import { saveBlobOrShowError } from '@/utils/saveBlob'
export default {
  props: {
    clickNodeVal: {
@@ -221,6 +223,9 @@
    this.getTableList(this.clickNodeVal.value);
  },
  methods: {
    formatDateCell(row, column, cellValue) {
      return formatListDate(cellValue)
    },
    // element-plus 的 el-date-picker 没有 picker-options,改成 :disabled-date
    disabledDate(time) {
      return time.getTime() > Date.now();
@@ -270,11 +275,14 @@
      this.outLoading = true
      exportUseRecord({
        deviceId: this.clickNodeVal.value,
        sampleCode: this.search.sampleCode,
        managementNumber: this.search.managementNumber,
        exportDate: this.exportDate
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '设备使用记录.doc')
        saveBlobOrShowError(res, '设备使用记录.doc', 'application/msword')
      }).catch(() => {
        this.outLoading = false
      })
    },
    //新建
@@ -310,7 +318,6 @@
                this.dialogVisible = false
              }
            })
            this.dialogVisible = false;
          } else {
            updateDeviceRecord(this.form).then(res => {
              if (res.code == 200) {
@@ -319,7 +326,6 @@
                this.dialogVisible = false
              }
            })
            this.dialogVisible = false;
          }
        }
      });
@@ -327,20 +333,17 @@
    //查看详情
    showDetailsDialog(type, row) {
      this.operationType = type;
      console.log(row)
      this.dialogVisible = true;
      this.getUserList()
      this.form = row;
      let list = []
      if (row.useStartDate === null) {
        row.useStartDate = ''
      // 复制一份再编辑,避免直接改动表格里的数据
      const useStartDate = row.useStartDate || ''
      const useEndDate = row.useEndDate || ''
      this.form = {
        ...row,
        useStartDate,
        useEndDate,
        useDateList: useStartDate && useEndDate ? [useStartDate, useEndDate] : []
      }
      if (row.useEndDate === null) {
        row.useEndDate = ''
      }
      list.push(row.useStartDate)
      list.push(row.useEndDate)
      this.form['useDateList'] = list
    },
    handleDeleteClick(index, row) {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {