智慧农业后台管理页面
guoshilong
2022-08-18 7bd5587ceee390bb7fdc5953bd8b803e8eb41021
src/views/task/task.vue
@@ -68,6 +68,7 @@
import {getList, getDetail, add, update, remove, updatechuli} from "@/api/task/task";
import {mapGetters} from "vuex";
import {getLandList} from "@/api/land/land";
import {selectStockFa} from "@/api/stockfactory/stockfactory";
export default {
  data() {
@@ -159,7 +160,8 @@
            prop: "stockId",
            hide: true,
            type: "tree",
            dicUrl: `/api/soldr/soldr/selectSol`,
            dicData:[],
            // dicUrl: `/api/soldr/soldr/selectSol`,
            props: {
              label: "spn",
              value: "id"
@@ -553,7 +555,7 @@
    this.initData();
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    ...mapGetters(["permission", "userInfo","$farmId"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.task_add, false),
@@ -583,6 +585,14 @@
      },
      immediate: true,
    },
    '$farmId':{
      handler (newName, oldName) {
          this.getLandList()
          this.getSoldrList()
          this.query={}
          this.onLoad(this.page)
      }
    }
  },
  methods: {
    //入库
@@ -628,15 +638,30 @@
      this.gradeBoxVisiblechuli = true;
    },
    initData() {
      this.getLandList()
      this.getSoldrList()
    },
    getLandList(){
      var that = this;
      //获取农地数据
      getLandList(this.userInfo.dept_id).then((res) => {
      getLandList(this.$farmId).then((res) => {
        if (res.data.code == 200) {
          var landIdcolumn = that.findObject(that.option.column, "landId");
          that.landList = res.data.data;
          landIdcolumn.dicData = res.data.data;
        }
      })
    },
    getSoldrList(){
      var that = this;
      //获取农资
      selectStockFa(this.$farmId).then((res) => {
        if (res.data.code == 200) {
          console.log(res,1111111111111)
          var stockIdcolumn = that.findObject(that.option.column, "stockId");
          stockIdcolumn.dicData = res.data.data;
        }
      });
    },
    rowSave(row, done, loading) {
      if(row.tp.length<=0){
@@ -745,6 +770,7 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      params["farmId"] = this.$farmId
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        const data = res.data.data;
        this.page.total = data.total;