lxp
2025-03-14 38f01dc619fb9b7326abc345a216793750758c9a
src/views/CNAS/resourceDemand/device/component/record.vue
@@ -112,7 +112,7 @@
                        type="textarea"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-col :span="24">
            <el-form-item :rules="[{ required: true, message: '请输入使用日期', trigger: 'blur' }]" label="使用日期:"
                          prop="useDateList">
@@ -125,24 +125,13 @@
                  start-placeholder="开始日期"
                  end-placeholder="结束日期">
              </el-date-picker>
              <!-- <el-date-picker
                v-model="form.useDateList" :disabled="isShow" end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss"
                size="small"
                start-placeholder="开始日期"
                style="width:100%"
                type="datetimerange"
                value-format="yyyy-MM-dd HH:mm:ss">
              </el-date-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :rules="[{ required: true, message: '请输入使用人', trigger: 'change' }]" label="使用人:"
            <el-form-item :rules="[{ required: true, message: '请输入使用人', trigger: 'blur' }]"
                          label="使用人:"
                          prop="usePerson">
              <el-input v-model="form.usePerson" :disabled="isShow" size="small" style="width:100%"></el-input>
              <!-- <el-select v-model="form.usePerson" placeholder="请选择" :disabled="isShow" size="small" style="width:100%">
                <el-option v-for="item in responsiblePersonList" :key="item.name" :label="item.name" :value="item.id">
                </el-option>
              </el-select> -->
            </el-form-item>
          </el-col>
          <el-col :span="24">
@@ -162,11 +151,9 @@
<script>
import {
  deviceRecordPage,
  exportUseRecord,
  selectDeviceByCode,
  saveDeviceRecord,
  updateDeviceRecord,
  deleteDeviceRecord,
  deleteDeviceRecord, deviceRecordExport,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/system/user";
export default {
@@ -224,7 +211,6 @@
        remark: '',
      },
      dialogVisible: false,
      operationType: '',
      formParamList: [],
    }
  },
@@ -264,25 +250,20 @@
        }
      })
    },
    // 打开导出弹框选择编制人、批准人
    openHandleOut() {
      this.ratifyDialog = true
    },
    //导出
    handleDown() {
      this.outLoading = true
      exportUseRecord({
      deviceRecordExport({
        deviceId: this.clickNodeVal.value,
        exportDate: this.exportDate
      }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '设备使用记录.doc')
        this.$download.saveAs(blob, '设备使用记录.xlsx')
      })
    },
    //新建
    openAdd() {
      this.operationType = 'add'
      this.getUserList()
      selectDeviceByCode({ id: this.clickNodeVal.value }).then(res => {
        this.form.deviceName = res.data.deviceName
@@ -292,12 +273,6 @@
        })
      });
    },
    usePersonName(value) {
      const index = this.userList.findIndex(item => item.id === value)
      if (index > -1) {
        this.form.usePerson = this.userList[index].name
      }
    },
    //确认添加记录
    saveRecord() {
      this.$refs.form.validate((valid) => {
@@ -305,33 +280,22 @@
          this.form.useStartDate = this.form.useDateList[0]
          this.form.useEndDate = this.form.useDateList[1]
          this.form.deviceId = this.clickNodeVal.value
          if (this.operationType === 'add') {
            saveDeviceRecord(this.form).then(res => {
              if (res.code == 200) {
                this.$message.success('新增成功')
                this.getTableList(this.clickNodeVal.value)
                this.dialogVisible = false
              }
            })
            this.dialogVisible = false;
          } else {
            updateDeviceRecord(this.form).then(res => {
              if (res.code == 200) {
                this.$message.success('修改成功')
                this.getTableList(this.clickNodeVal.value)
                this.dialogVisible = false
              }
            })
            this.dialogVisible = false;
          }
          saveDeviceRecord(this.form).then(res => {
            if (res.code == 200) {
              this.$message.success('新增成功')
              this.getTableList(this.clickNodeVal.value)
              this.dialogVisible = false
            }
          })
          this.dialogVisible = false;
        }
      });
    },
    //查看详情
    showDetailsDialog(type, row) {
      this.operationType = type;
    showDetailsDialog(row) {
      console.log(row)
      this.dialogVisible = true;
      this.isShow = true;
      this.getUserList()
      this.form = row;
      let list = []
@@ -459,7 +423,7 @@
}
.search_label {
  width: 140px;
  width: 74px;
  font-size: 14px;
  text-align: right;
  margin-right: 10px;