xiangpei
2024-08-07 72192cc5e32e6088e8ed726d5c95b78b889ee675
导入点位优化
2个文件已修改
45 ■■■■ 已修改文件
src/api/platform/point.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/point/index.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/platform/point.js
@@ -92,3 +92,11 @@
    }
  })
}
// 根据单位id查找合同
export function timeRange(unitId) {
  return request({
    url: '/system/contract/time/' + unitId,
    method: 'get'
  })
}
src/views/system/point/index.vue
@@ -34,10 +34,17 @@
      </el-col>
      <el-col :span="1.5">
        <el-popover>
          <p>导入点位只做更新操作</p>
          <div class="bottom_">
            <el-select v-model="importUnitId" size="small" placeholder="运维单位">
            <el-select @change="getUnitContractTime" v-model="importUnitId" size="small" placeholder="运维单位">
              <el-option v-for="unit in unitList" :key="unit.id" :label="unit.value" :value="unit.id"></el-option>
            </el-select>
          </div>
          <div class="bottom_">
            <el-select @change="showTimeRange" v-model="contractId" size="small" placeholder="运维合同">
              <el-option v-for="(time, index) in timeList" :key="index" :label="time.name" :value="time.id"></el-option>
            </el-select>
            <span style="margin-left: 10px;color: #8a8989" v-show="importUnitId">该单位有{{timeList.length}}个合同</span>
          </div>
          <div class="bottom_">
            <el-date-picker
@@ -70,10 +77,10 @@
          <el-button type="primary" size="mini" plain icon="el-icon-top" slot="reference">导入点位</el-button>
        </el-popover>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-receiving" size="mini" @click="handleEditBatch"
          v-hasPermi="['point:edit']">批量修改</el-button>
      </el-col>
<!--      <el-col :span="1.5">-->
<!--        <el-button type="danger" plain icon="el-icon-receiving" size="mini" @click="handleEditBatch"-->
<!--          v-hasPermi="['point:edit']">批量修改</el-button>-->
<!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
@@ -198,7 +205,7 @@
</template>
<script>
import { listPoint, getPoint, delPoint, addPoint, batchEdit, updatePoint, exportData, importData } from "@/api/platform/point";
import { listPoint, getPoint, delPoint, addPoint, batchEdit, updatePoint, exportData, importData, timeRange } from "@/api/platform/point";
import { unitSelect } from "@/api/platform/unit";
import { getCascader } from '@/api/platform/region'
import { cascader } from '@/api/system/dept'
@@ -208,12 +215,14 @@
  dicts: ['point_tag'],
  data() {
    return {
      timeList: [],
      timezone: [],
      ywTimes: [],
      fileList: [],
      importFile: null,
      importUrl: '',
      importUnitId: null,
      contractId: null,
      download: false,
      upload: false,
      deptOptions: [],
@@ -287,6 +296,22 @@
    this.getDeptCascader();
  },
  methods: {
    getUnitContractTime(unitId) {
      this.ywTimes = []
      this.contractId = null;
      timeRange(unitId).then(res => {
        this.timeList = res.data;
      })
    },
    showTimeRange(contractId) {
      let a = this.timeList.filter(item => item.id === contractId)
      if (a.length < 1) {
        this.ywTimes = []
        return
      }
      let target = a[0]
      this.ywTimes = [target.startTime, target.endTime]
    },
    beforeUpload(file) {
      this.importFile = file
      this.fileList = [file]