guoshilong
2022-11-23 998b75f0d4aaed03001ec4246cd4f3b4b0743b7e
src/views/taskinfo/taskinfo.vue
@@ -1,6 +1,6 @@
<template>
  <basic-container>
    <avue-crud :option="option"
    <avue-crud v-show="!detailVisible" :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
@@ -29,13 +29,29 @@
                   @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{ type, size, row }" slot="menu">
      <template slot-scope="{ type, size, row, index }" slot="menu">
        <el-button
          icon="el-icon-view"
          type="text"
          size="mini"
          @click="goTaskinfoDetail(row)"
        >查看</el-button>
          v-if="permission.taskinfo_view"
        >查 看</el-button>
        <el-button
          icon="el-icon-edit"
          type="text"
          size="mini"
          @click="$refs.crud.rowEdit(row,index)"
          v-if="permission.taskinfo_edit"
        >编 辑</el-button>
        <el-button
          icon="el-icon-delete"
          type="text"
          size="mini"
          @click="$refs.crud.rowDel(row,index)"
          v-if="permission.taskinfo_delete"
        >删 除</el-button>
      </template>
      <template slot="routeRangeForm">
        <open-layers-map ref="OpenLayersMap" @toData="toData" :routeRange="form.routeRange"></open-layers-map>
@@ -43,18 +59,20 @@
    </avue-crud>
    <taskinfo-detail v-if="detailVisible" ref="detailVisible" :detailInfo="detailInfo" @isDetail="isDetail"></taskinfo-detail>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/taskinfo/taskinfo";
  import {getList, add, update, remove} from "@/api/taskinfo/taskinfo";
  import option from "@/const/taskinfo/taskinfo";
  import {mapGetters} from "vuex";
  import OpenLayersMap from "@/components/OpenLayersMap";
  import TaskinfoDetail from "@/views/taskinfo/taskinfoDetail";
  export default {
    components: { OpenLayersMap },
    components: {TaskinfoDetail, OpenLayersMap },
    data() {
      return {
        form: {},
@@ -67,16 +85,19 @@
        },
        selectionList: [],
        option: option,
        data: []
        data: [],
        detailVisible:false,
        detailInfo:{},
      };
    },
    created() {
      const date = new Date()
      const year = date.getFullYear()
      const month = date.getMonth() + 1
      const strDate = date.getDate()
      this.query.startTime = `${year}-${month}-${strDate} 00:00:00`
      this.query.endTime = `${year}-${month}-${strDate} 23:59:59`
      // 默认时间查询
      // const date = new Date()
      // const year = date.getFullYear()
      // const month = date.getMonth() + 1
      // const strDate = date.getDate()
      // this.query.startTime = `${year}-${month}-${strDate} 00:00:00`
      // this.query.endTime = `${year}-${month}-${strDate} 23:59:59`
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -172,6 +193,8 @@
          this.form.endTime = `${year}-${month}-${strDate} 23:59:59`
          this.form.source = 'SYSTEMNEW'
          this.form.state = '0'
        } else if (["edit"].includes(type)) {
          this.form.routeRange = '\'' + this.form.routeRange + '\''
        }
        done();
      },
@@ -215,11 +238,17 @@
        this.form.routeRange = toData
      },
      goTaskinfoDetail(row){
        this.$router.push({ path: "/taskinfo/taskinfoDetail", query: row });
        // this.$router.push({ path: "/taskinfo/taskinfoDetail", query: row });
        this.rowClick(row)
      },
      //点击当前行事件
      rowClick(val){
        this.$router.push({ path: "/taskinfo/taskinfoDetail", query: val });
        // this.$router.push({ path: "/taskinfo/taskinfoDetail", query: val });
        this.detailInfo = val
        this.isDetail();
      },
      isDetail(){
        this.detailVisible = !this.detailVisible
      }
    }
  };