guoshilong
2022-09-23 3909a52d26dca085a6ead5d0fbaca0ce512e27f7
src/views/taskinfo/taskinfo.vue
@@ -12,6 +12,7 @@
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @row-dblclick="rowClick"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
@@ -28,16 +29,32 @@
                   @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          icon="el-icon-view"
          type="text"
          size="mini"
          @click="goTaskinfoDetail(row)"
        >查看</el-button>
      </template>
      <template slot="routeRangeForm">
        <open-layers-map ref="OpenLayersMap" @toData="toData" :routeRange="form.routeRange"></open-layers-map>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/taskinfo/taskinfo";
  import option from "@/const/taskinfo/taskinfo";
  import {mapGetters} from "vuex";
  import OpenLayersMap from "@/components/OpenLayersMap";
  export default {
    components: { OpenLayersMap },
    data() {
      return {
        form: {},
@@ -146,17 +163,15 @@
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        } else {
        if (["add"].includes(type)) {
          const date = new Date()
          const year = date.getFullYear()
          const month = date.getMonth() + 1
          const strDate = date.getDate()
          this.form.startTime = `${year}-${month}-${strDate} 00:00:00`
          this.form.endTime = `${year}-${month}-${strDate} 23:59:59`
          this.form.source = 'SYSTEMNEW'
          this.form.state = '0'
        }
        done();
      },
@@ -165,7 +180,6 @@
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        params
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
@@ -196,6 +210,16 @@
          this.loading = false;
          this.selectionClear();
        });
      },
      toData(toData) {
        this.form.routeRange = toData
      },
      goTaskinfoDetail(row){
        this.$router.push({ path: "/taskinfo/taskinfoDetail", query: row });
      },
      //点击当前行事件
      rowClick(val){
        this.$router.push({ path: "/taskinfo/taskinfoDetail", query: val });
      }
    }
  };