From 537a11b572c88e304cd73de7d7028b9a3b33588f Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 29 Jun 2022 08:25:29 +0800
Subject: [PATCH] 农资统计

---
 src/views/task/task.vue |  512 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 346 insertions(+), 166 deletions(-)

diff --git a/src/views/task/task.vue b/src/views/task/task.vue
index ab46058..9ffdc26 100644
--- a/src/views/task/task.vue
+++ b/src/views/task/task.vue
@@ -64,7 +64,7 @@
 </template>
 
 <script>
-import {getList, getDetail, add, update, remove} from "@/api/task/task";
+import {getList, getDetail, add, update, remove, updatechuli} from "@/api/task/task";
 import {mapGetters} from "vuex";
 import {getLandList} from "@/api/land/land";
 
@@ -74,6 +74,7 @@
       form: {},
       query: {},
       formchuli: {},
+      formxq: {},
       loading: true,
       page: {
         pageSize: 10,
@@ -149,16 +150,39 @@
             }]
           },
           {
+            label: "投入品",
+            prop: "stockId",
+            hide: true,
+            type: "tree",
+            dicUrl: `/api/soldr/soldr/selectSol`,
+            props: {
+              label: "spn",
+              value: "id"
+            },
+            change: function (value) {
+              console.log(value.value)
+            }
+          },
+          {
+            label: "农资量",
+            prop: "stockNum",
+            hide: true,
+            span: 6,
+            type: "number",
+            labelWidth: 110,
+            display: false,
+          },
+          {
             label: "拍照照片",
             prop: "type",
             span: 6,
             type: "switch",
             dicData: [{
-              label: '开启',
-              value: 0
-            }, {
               label: '关闭',
-              value: 1
+              value: "1"
+            }, {
+              label: '开启',
+              value: "0"
             }],
             mock: {
               type: 'dic'
@@ -167,20 +191,9 @@
             row: true,
           },
           {
-            label: "任务说明",
-            prop: "taskExplain",
-            type: "textarea",
-            span: 23,
-            rules: [{
-              required: true,
-              message: "请输入任务说明",
-              trigger: "blur"
-            }]
-          },
-          {
             label: "任务状态",
             addDisplay: false,
-            editDisplay: false,
+            type: "select",
             prop: "status",
             dicData: [
               {
@@ -196,40 +209,49 @@
                 value: 2
               }
             ],
-            span: 23,
+            span: 24
+          },
+          {
+            label: "任务说明",
+            prop: "taskExplain",
+            type: "textarea",
+            span: 24,
+            rules: [{
+              required: true,
+              message: "请输入任务说明",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "照片",
+            prop: "tp",
+            type: "upload",
+            hide: true,
+            dataType: "string",
+            span: 24,
+            limit: 5,
+            addDisplay: false,
+            editDisplay: false,
+            listType: "picture-card",
+            tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+            canvasOption: {
+              text: "",
+              ratio: 1.0,
+            },
+            propsHttp: {
+              res: "data",
+              url: "url"
+            },
+            action: "/api/blade-resource/oss/endpoint/put-files"
           },
           {
             label: "备注",
-            hide:true,
+            hide: true,
             addDisplay: false,
             editDisplay: false,
             prop: "remark",
             type: "textarea",
-            span: 23,
-          },
-          {
-            label: "图片",
-            hide:true,
-            prop: "tp",
-            addDisplay: false,
-            editDisplay: false,
-            rules: [{
-              required: true,
-              message: "请输入图片",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: "农事操作",
-            hide:true,
-            addDisplay: false,
-            editDisplay: false,
-            prop: "farm",
-            rules: [{
-              required: true,
-              message: "请输入农事操作",
-              trigger: "blur"
-            }]
+            span: 24,
           },
         ]
       },
@@ -246,132 +268,111 @@
         dialogClickModal: false,
         column: [
           {
-            label: "农资",
-            prop: "stockId1",
+            label: "任务名称",
+            prop: "taskName",
+            disabled: true,
+          },
+          {
+            label: "任务说明",
+            prop: "taskExplain",
+            type: "textarea",
             span: 23,
-            type: "select",
             disabled: true,
-            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+          },
+          {
+            label: "地块",
+            prop: "landId",
+            type: "tree",
+            disabled: true,
+            dicData: [],
             props: {
-              label: "dictValue",
-              value: "dictKey"
+              label: "landName",
+              value: "id"
+            },
+          },
+          {
+            label: "负责人",
+            prop: "taskUser",
+            disabled: true,
+            type: "tree",
+            dicUrl: `/api/blade-user/user-list`,
+            props: {
+              label: "account",
+              value: "id"
             },
             rules: [{
               required: true,
-              message: "请输入农资",
+              message: "请输入负责人",
               trigger: "blur"
             }]
           },
           {
-            label: "规格",
+            label: "截止时间",
+            prop: "time",
             disabled: true,
-            span: 6,
-            prop: "spn",
-            addDisplay: false,
-          },
-          {
-            label: "规格",
-            display: false,
-            hide: true,
-            prop: "specs1",
-            span: 5,
-            viewDisplay: false,
-            rules: [{
-              required: true,
-              message: "请输入规格",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: "规格值1",
-            display: false,
-            hide: true,
-            prop: "specsVal1",
-            searchSpan: 4,
-            span: 6,
-            type: "select",
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
-            props: {
-              label: "dictValue",
-              value: "dictKey"
-            },
-            dataType: "number",
-            search: true,
-          },
-          {
-            label: "类型",
-            display: false,
-            hide: true,
-            prop: "stockType1",
-          },
-          {
-            label: "规格值2",
-            display: false,
-            hide: true,
-            prop: "specsVal2",
-            searchSpan: 4,
-            span: 6,
-            type: "select",
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
-            props: {
-              label: "dictValue",
-              value: "dictKey"
-            },
-            dataType: "number",
-            search: true,
-          },
-          {
-            label: "当前库存",
-            disabled: true,
-            span: 6,
-            prop: "num",
-          },
-          {
-            label: "入库数量",
-            type: "number",
-            span: 11,
-            prop: "amount1",
-          },
-          {
-            label: "入库类型",
-            prop: "type1",
-            type: "select",
-            span: 12,
-            searchSpan: 4,
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase",
-            props: {
-              label: "dictValue",
-              value: "dictKey"
-            },
-            dataType: "number",
-            search: true,
-            rules: [{
-              required: true,
-              message: "请输入入库类型",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: "入库时间",
-            prop: "time1",
+            span: 7,
             type: "date",
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd",
-            span: 11,
             rules: [{
               required: true,
-              message: "请输入入库时间",
+              message: "请输入截止时间",
               trigger: "blur"
             }]
           },
           {
+            label: "投入品",
+            prop: "stockId",
+            disabled: true,
+            hide: true,
+            type: "tree",
+            span: 10,
+            dicUrl: `/api/soldr/soldr/selectSol`,
+            props: {
+              label: "spn",
+              value: "id"
+            },
+            change: function (value) {
+              console.log(value.value)
+            }
+          },
+          {
+            label: "农资量",
+            prop: "stockNum",
+            hide: true,
+            disabled: true,
+            span: 6,
+            type: "number",
+            labelWidth: 110,
+          },
+          {
+            label: "拍照照片",
+            prop: "type",
+            span: 6,
+            disabled: true,
+            type: "switch",
+            dicData: [{
+              label: '关闭',
+              value: "1"
+            }, {
+              label: '开启',
+              value: "0"
+            }],
+            mock: {
+              type: 'dic'
+            },
+            hide: true,
+            row: true,
+          },
+          {
             label: "单据、凭证照片",
-            prop: "picture1",
+            prop: "tp",
             type: "upload",
             labelWidth: 145,
             dataType: "string",
             span: 24,
             limit: 5,
+            display: false,
             listType: "picture-card",
             tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
             canvasOption: {
@@ -386,13 +387,160 @@
           },
           {
             label: "备注",
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            prop: "remark",
             type: "textarea",
-            prop: "remarks1",
             span: 23,
           },
         ]
       },
-      gradeBoxVisiblechuli:false,
+      optionxq: {
+        height: 'auto',
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "任务名称",
+            prop: "taskName",
+            disabled: true,
+          },
+          {
+            label: "任务说明",
+            prop: "taskExplain",
+            type: "textarea",
+            span: 23,
+            disabled: true,
+          },
+          {
+            label: "地块",
+            prop: "landId",
+            type: "tree",
+            disabled: true,
+            dicData: [],
+            props: {
+              label: "landName",
+              value: "id"
+            },
+          },
+          {
+            label: "负责人",
+            prop: "taskUser",
+            disabled: true,
+            type: "tree",
+            dicUrl: `/api/blade-user/user-list`,
+            props: {
+              label: "account",
+              value: "id"
+            },
+            rules: [{
+              required: true,
+              message: "请输入负责人",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "截止时间",
+            prop: "time",
+            disabled: true,
+            span: 7,
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            rules: [{
+              required: true,
+              message: "请输入截止时间",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "投入品",
+            prop: "stockId",
+            disabled: true,
+            hide: true,
+            type: "tree",
+            span: 10,
+            dicUrl: `/api/soldr/soldr/selectSol`,
+            props: {
+              label: "spn",
+              value: "stock_id1"
+            },
+            change: function (value) {
+              console.log(value.value)
+            }
+          },
+          {
+            label: "农资量",
+            prop: "stockNum",
+            hide: true,
+            disabled: true,
+            span: 6,
+            type: "number",
+            labelWidth: 110,
+          },
+          {
+            label: "拍照照片",
+            prop: "type",
+            span: 6,
+            disabled: true,
+            type: "switch",
+            dicData: [{
+              label: '关闭',
+              value: "1"
+            }, {
+              label: '开启',
+              value: "0"
+            }],
+            mock: {
+              type: 'dic'
+            },
+            hide: true,
+            row: true,
+          },
+          {
+            label: "单据、凭证照片",
+            prop: "tp",
+            type: "upload",
+            labelWidth: 145,
+            dataType: "string",
+            disabled: true,
+            span: 24,
+            limit: 5,
+            display: false,
+            listType: "picture-card",
+            tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+            canvasOption: {
+              text: "",
+              ratio: 1.0,
+            },
+            propsHttp: {
+              res: "data",
+              url: "url"
+            },
+            action: "/api/blade-resource/oss/endpoint/put-files"
+          },
+          {
+            label: "备注",
+            disabled: true,
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            prop: "remark",
+            type: "textarea",
+            span: 23,
+          },
+        ]
+      },
+      gradeBoxVisiblechuli: false,
+      gradeBoxVisiblexq: false,
       data: []
     };
   },
@@ -417,32 +565,61 @@
       return ids.join(",");
     }
   },
+  watch: {
+    "form.stockId": {
+      handler(val) {
+        console.log(val)
+        var stockIdcolumn = this.findObject(this.option.column, "stockNum");
+        if (val != "") {
+          stockIdcolumn.display = true;
+        } else {
+          stockIdcolumn.display = false;
+        }
+      },
+      immediate: true,
+    },
+  },
   methods: {
     //入库
     submitR(row, done, loading) {
-      that.gradeBoxVisible = false;
-      // var that = this;
-      // add1(row).then(
-      //   () => {
-      //     that.onLoad(this.page);
-      //     that.$refs.formR.resetFields();
-      //     that.$message({
-      //       type: "success",
-      //       message: "操作成功!"
-      //     });
-      //     that.gradeBoxVisible = false;
-      //
-      //     done();
-      //   },
-      //   error => {
-      //     window.console.log(error);
-      //     done();
-      //   }
-      // );
+      var that = this;
+      updatechuli(row).then(
+        () => {
+          that.onLoad(this.page);
+          that.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          that.gradeBoxVisiblechuli = false;
+          done();
+        },
+        error => {
+          loading();
+          window.console.log(error);
+          done();
+        }
+      );
     },
     // 处理
     chuli(row) {
-      this.formchuli = {};
+      this.formchuli = {
+        id: row.id,
+        taskName: row.taskName,
+        taskExplain: row.taskExplain,
+        landId: row.landId,
+        taskUser: row.taskUser,
+        time: row.time,
+        stockId: row.stockId,
+        tp: row.tp,
+        remark: row.remark,
+        stockNum: row.stockNum,
+        type: row.type
+
+      };
+      if (row.type === "0") {
+        var tp = this.findObject(this.optionchuli.column, "tp");
+        tp.display = true;
+      }
       this.gradeBoxVisiblechuli = true;
     },
     initData() {
@@ -457,6 +634,9 @@
       })
     },
     rowSave(row, done, loading) {
+      if(row.tp.length<=0){
+        row.tp=""
+      }
       add(row).then(() => {
         this.onLoad(this.page);
         this.$message({

--
Gitblit v1.9.3