智慧农业后台管理页面
guoshilong
2022-09-27 afa8ee521affdce4f4cac9ba32ede9d22b76a13e
src/views/task/task.vue
@@ -72,6 +72,14 @@
export default {
  data() {
    const validateNum = (rule, value, callback) => {
      if (!/^[1-9]\d*$/.test(value)) {
        callback(new Error("请输入正整数"));
      } else {
        callback();
      }
    };
    return {
      form: {},
      query: {},
@@ -102,6 +110,7 @@
        refreshBtn:false,
        columnBtn:false,
        searchShowBtn:false,
        menuWidth:300,
        column: [
          {
            label: "任务名称",
@@ -164,10 +173,10 @@
            // dicUrl: `/api/soldr/soldr/selectSol`,
            props: {
              label: "spn",
              value: "stockId1"
              value: "id"
            },
            change: function (value) {
              console.log(value.value)
              // console.log(value.value)
            }
          },
          {
@@ -176,8 +185,13 @@
            hide: true,
            span: 6,
            type: "number",
            labelWidth: 110,
            // labelWidth: 110,
            display: false,
            rules:[{
              require:false,
              trigger: "blur",
              validator: validateNum
            }]
          },
          {
            label: "拍照照片",
@@ -273,6 +287,7 @@
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        emptyBtn:false,
        column: [
          {
            label: "任务名称",
@@ -340,7 +355,7 @@
              value: "id"
            },
            change: function (value) {
              console.log(value.value)
              // console.log(value.value)
            }
          },
          {
@@ -348,7 +363,7 @@
            prop: "stockNum",
            hide: true,
            disabled: true,
            span: 6,
            span: 7,
            type: "number",
            labelWidth: 110,
          },
@@ -481,7 +496,7 @@
              value: "stock_id1"
            },
            change: function (value) {
              console.log(value.value)
              // console.log(value.value)
            }
          },
          {
@@ -496,6 +511,7 @@
          {
            label: "拍照照片",
            prop: "type",
            value:"1",
            span: 6,
            disabled: true,
            type: "switch",
@@ -594,9 +610,16 @@
    }
  },
  methods: {
    //入库
    //处理
    submitR(row, done, loading) {
      var that = this;
      if(row.type == "0"){
        if(row.tp == ""){
          that.$message.warning("请上传照片")
          done()
          return
        }
      }
      updatechuli(row).then(
        () => {
          that.onLoad(this.page);
@@ -646,8 +669,10 @@
      getLandList(this.$farmId).then((res) => {
        if (res.data.code == 200) {
          var landIdcolumn = that.findObject(that.option.column, "landId");
          var landIdColumnChuli = that.findObject(that.optionchuli.column,"landId")
          that.landList = res.data.data;
          landIdcolumn.dicData = res.data.data;
          landIdColumnChuli.dicData = res.data.data
        }
      })
    },
@@ -678,6 +703,14 @@
      });
    },
    rowUpdate(row, index, done, loading) {
      if(row.stockNum<0){
        this.$message({
          type: "warning",
          message: "农资量不能为负数!"
        });
        done();
        return
      }
      update(row).then(() => {
        this.onLoad(this.page);
        this.$message({