Tcsm
2023-08-22 5d3e0be26b31f7d6d29b3281adcb201ec494a1c6
ruoyi-ui/src/views/device/index.vue
@@ -6,7 +6,7 @@
        <el-date-picker
          v-model="dateRange"
          style="width: 240px;"
          value-format="yyyy-MM-dd HH-MM"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
@@ -126,26 +126,26 @@
    <el-table v-loading="loading" :data="equipmentList"  :row-key="getRowId" ref="multipleTable" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;">
      <el-table-column type="selection" :reserve-selection="true" width="55"  align="center" />
      <el-table-column fixed label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="120"/>
      <el-table-column label="设备名称" prop="name" sortable width="120" />
      <el-table-column label="设备名称" prop="name" sortable width="150" />
      <el-table-column label="时间" align="happenTime" sortable prop="happenTime" width="180">
      <el-table-column label="时间" align="happenTime" sortable prop="happenTime" width="140">
        <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '————'}}</template>
      </el-table-column>
      <el-table-column label="是否注销" align="center" sortable prop="status" width="180">
      <el-table-column label="是否注销" align="center" sortable prop="status" width="140">
        <template slot-scope="scope">
          {{ getSrc1(scope.row.status) }}
        </template>
      </el-table-column>
      <el-table-column label="购买人" prop="buyer" sortable width="100" />
      <el-table-column label="购买人" prop="buyer" sortable width="140" />
      <el-table-column label="事项内容" prop="content" sortable :show-overflow-tooltip="true" width="150" />
      <el-table-column label="存放地点" prop="location" sortable width="100" />
      <el-table-column label="存放地点" prop="location" sortable width="120" />
      <el-table-column label="备注" prop="remark" sortable width="100" >
        <template slot-scope="scope">{{scope.row.remark? scope.row.remark: '————'}}</template>
      </el-table-column>
      <el-table-column label="电子文件" prop="url" width="180" align="center">
      <el-table-column label="电子文件" prop="url" width="120" align="center">
        <template slot-scope="scope" >
          <div  @click="handleCheck(scope.row)">
@@ -155,15 +155,16 @@
              alt=""
              style="width: 35px; height: 35px;"
              fit="cover"
              v-if="scope.row.url !== ',' "
              v-if="!(scope.row.url === '' || scope.row.url === ',' || scope.row.url === null)"
            >
            <img
              v-else
              class="el-upload-list__item-thumbnail"
              src="../../assets/images/deviceA.png"
              alt=""
              style="width: 35px; height: 35px;"
              fit="cover"
              v-if="scope.row.url === ','"
            ></div>
        </template>
      </el-table-column>
@@ -210,11 +211,11 @@
        </el-form-item>
        <el-form-item label="发生时间" prop="happenTime">
          <el-date-picker
          <el-input
            v-model='formDat.happenTime'
            type='date'
            placeholder='选择日期'
          ></el-date-picker>
          ></el-input>
        </el-form-item>
@@ -248,7 +249,7 @@
          :http-request="requestUpload"
          :file-list="fileList"
        >
          <i slot="default" class="el-icon-plus"></i>
          <i  slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{file}">
            <img
              class="el-upload-list__item-thumbnail"
@@ -285,11 +286,12 @@
          class="upload-demo"
          multiple
          :on-remove="handleRemove"
          :on-remove="handleRemoveFile"
          :http-request="requestUpload"
          :show-file-list="true"
        >
          <el-button type="primary">上传</el-button>
          <el-button type="primary">点击上传</el-button>
          <div v-if="uploading" class="upload-status">正在上传...</div>
          <template #tip>
            <div class="el-upload__tip">
            </div>
@@ -364,6 +366,7 @@
      ],
      dsb:true,
      btn:false,
      uploading: false,
      formDat: {
        // type: undefined,
        content: undefined,
@@ -386,7 +389,8 @@
        content:undefined,
        buyer:undefined,
        location:undefined,
        createDate:undefined
        createDate:undefined,
        happenTime:undefined
      },
      // 表单参数
      form: {},
@@ -402,7 +406,7 @@
          trigger: 'blur'
        }],
        status: [{
          required: true,
          // required: true,
          message: '是否注销',
          trigger: 'change'
        }],
@@ -481,6 +485,8 @@
    getList() {
      this.loading = true;
      this.queryParams.happenStartTime = this.dateRange.length > 0 && this.dateRange[0]
      this.queryParams.happenEndTime = this.dateRange.length > 0 && this.dateRange[1]
      // console.log(this.queryParams)
      //  listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
      listEquipment(this.queryParams).then(response => {
@@ -580,6 +586,20 @@
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    handleRemove(file) {
      for(let i = 0; i < this.fileList.length; i++)
      {
        if(this.fileList[i].url==file.url)
          this.$delete(this.fileList,i);
      }
    },
    handleRemoveFile(file) {
      for(let i = 0; i < this.fileListOther.length; i++)
      {
        if(this.fileListOther[i].url==file.url)
          this.$delete(this.fileListOther,i);
      }
    },
    /** 提交按钮(数据权限) */
    submitDataScope: function() {
@@ -600,6 +620,17 @@
          });
        }
      });
      // 清空formDat对象的数据
      Object.keys(this.formDat).forEach(key => {
        this.formDat[key] = '';
      });
      for(let i = 0; i <= this.fileList.length; i++)
      {
        this.handleRemove(this.fileList[0]);
      }
      for(let i = 0; i < this.fileListOther.length; i++){
        this.handleRemoveFile(this.fileListOther[0]);
      }
    },
    requestUpload(params)
    {
@@ -607,10 +638,11 @@
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
      this.uploading = true;
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        this.uploading = false;
        this.$modal.msgSuccess("上传成功");
        if(_this.fot.includes(pth) === true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})