From 3c77ae9b1d9f4bfe3a25d054a7793dbcde0a7aba Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 16 May 2022 08:31:11 +0800
Subject: [PATCH] 农资管理

---
 src/views/stock/stock.vue             |  385 ++++++++++++++++++++---
 src/router/views/index.js             |  262 +++++++++-------
 src/views/stockrecord/stockrecord.vue |  108 ++----
 src/views/land/land.vue               |  190 +----------
 src/api/stockrecord/stockrecord.js    |    6 
 5 files changed, 537 insertions(+), 414 deletions(-)

diff --git a/src/api/stockrecord/stockrecord.js b/src/api/stockrecord/stockrecord.js
index 178ea21..97dc693 100644
--- a/src/api/stockrecord/stockrecord.js
+++ b/src/api/stockrecord/stockrecord.js
@@ -2,7 +2,7 @@
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/stockrecord/stockrecord/list',
+    url: '/api/stockrecord/stockrecord/page',
     method: 'get',
     params: {
       ...params,
@@ -32,9 +32,9 @@
   })
 }
 
-export const add = (row) => {
+export const add1= (row) => {
   return request({
-    url: '/api/stockrecord/stockrecord/submit',
+    url: '/api/stockrecord/stockrecord/save',
     method: 'post',
     data: row
   })
diff --git a/src/router/views/index.js b/src/router/views/index.js
index b985cfc..fe8d039 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -1,67 +1,96 @@
 import Layout from '@/page/index/'
 
 export default [{
-        path: '/wel',
-        component: Layout,
-        redirect: '/wel/index',
-        children: [{
-            path: 'index',
-            name: '首页',
-            meta: {
-                i18n: 'dashboard'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/wel/index')
-        }, {
-            path: 'dashboard',
-            name: '控制台',
-            meta: {
-                i18n: 'dashboard',
-                menu: false,
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
-        }]
-    }, {
-        path: '/test',
-        component: Layout,
-        redirect: '/test/index',
-        children: [{
-            path: 'index',
-            name: '测试页',
-            meta: {
-                i18n: 'test'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/util/test')
-        }]
-    }, {
-        path: '/dict-horizontal',
-        component: Layout,
-        redirect: '/dict-horizontal/index',
-        children: [{
-            path: 'index',
-            name: '字典管理',
-            meta: {
-                i18n: 'dict'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
-        }]
-    }, {
-        path: '/dict-vertical',
-        component: Layout,
-        redirect: '/dict-vertical/index',
-        children: [{
-            path: 'index',
-            name: '字典管理',
-            meta: {
-                i18n: 'dict'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
-        }]
+  path: '/wel',
+  component: Layout,
+  redirect: '/wel/index',
+  children: [{
+    path: 'index',
+    name: '首页',
+    meta: {
+      i18n: 'dashboard'
     },
+    component: () =>
+      import ( /* webpackChunkName: "views" */ '@/views/wel/index')
+  }, {
+    path: 'dashboard',
+    name: '控制台',
+    meta: {
+      i18n: 'dashboard',
+      menu: false,
+    },
+    component: () =>
+      import ( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
+  }]
+}, {
+  path: '/test',
+  component: Layout,
+  redirect: '/test/index',
+  children: [{
+    path: 'index',
+    name: '测试页',
+    meta: {
+      i18n: 'test'
+    },
+    component: () =>
+      import ( /* webpackChunkName: "views" */ '@/views/util/test')
+  }]
+},
+  {
+    path: '/framing',
+    redirect: '/farmplant/farmplant',
+    component: Layout,
+    children: [{
+      path: 'index',
+      name: '农事操作',
+      meta: {
+        i18n: 'index',
+      },
+      component: () =>
+        import( /* webpackChunkName: "views" */ '@/views/farm/farmPaper')
+    }]
+  },
+  {
+    path: '/stockrecord',
+    redirect: '/stockrecord/stockrecord',
+    component: Layout,
+    children: [{
+      path: 'stockrecord',
+      name: '农事操作',
+      meta: {
+        i18n: 'index',
+      },
+      component: () =>
+        import( /* webpackChunkName: "views" */ '@/views/stockrecord/stockrecord')
+    }]
+  },
+  {
+    path: '/dict-horizontal',
+    component: Layout,
+    redirect: '/dict-horizontal/index',
+    children: [{
+      path: 'index',
+      name: '字典管理',
+      meta: {
+        i18n: 'dict'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
+    }]
+  }, {
+    path: '/dict-vertical',
+    component: Layout,
+    redirect: '/dict-vertical/index',
+    children: [{
+      path: 'index',
+      name: '字典管理',
+      meta: {
+        i18n: 'dict'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
+    }]
+  },
   {
     path: '/land',
     component: Layout,
@@ -75,61 +104,62 @@
       component: () =>
         import( /* webpackChunkName: "views" */ '@/views/land/land')
     }]
-  },{
-        path: '/info',
-        component: Layout,
-        redirect: '/info/index',
-        children: [{
-            path: 'index',
-            name: '个人信息',
-            meta: {
-                i18n: 'info'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/system/userinfo')
-        }]
+  },
+  {
+    path: '/info',
+    component: Layout,
+    redirect: '/info/index',
+    children: [{
+      path: 'index',
+      name: '个人信息',
+      meta: {
+        i18n: 'info'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/system/userinfo')
+    }]
+  }, {
+    path: '/work/process/leave',
+    component: Layout,
+    redirect: '/work/process/leave/form',
+    children: [{
+      path: 'form/:processDefinitionId',
+      name: '请假流程',
+      meta: {
+        i18n: 'work'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
     }, {
-        path: '/work/process/leave',
-        component: Layout,
-        redirect: '/work/process/leave/form',
-        children: [{
-            path: 'form/:processDefinitionId',
-            name: '请假流程',
-            meta: {
-                i18n: 'work'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
-        }, {
-            path: 'handle/:taskId/:processInstanceId/:businessId',
-            name: '处理请假流程',
-            meta: {
-                i18n: 'work'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
-        }, {
-            path: 'detail/:processInstanceId/:businessId',
-            name: '请假流程详情',
-            meta: {
-                i18n: 'work'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
-        }]
-    },
-    {
-        path: '/farm',
-        component: Layout,
-        redirect: '/farm/index',
-        children: [{
-            path: 'index',
-            name: '农场信息管理',
-            meta: {
-                i18n: 'farm'
-            },
-            component: () =>
-                import ( /* webpackChunkName: "views" */ '@/views/farm/farm')
-        }]
-    },
+      path: 'handle/:taskId/:processInstanceId/:businessId',
+      name: '处理请假流程',
+      meta: {
+        i18n: 'work'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
+    }, {
+      path: 'detail/:processInstanceId/:businessId',
+      name: '请假流程详情',
+      meta: {
+        i18n: 'work'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
+    }]
+  },
+  {
+    path: '/farm',
+    component: Layout,
+    redirect: '/farm/index',
+    children: [{
+      path: 'index',
+      name: '农场信息管理',
+      meta: {
+        i18n: 'farm'
+      },
+      component: () =>
+        import ( /* webpackChunkName: "views" */ '@/views/farm/farm')
+    }]
+  },
 ]
diff --git a/src/views/land/land.vue b/src/views/land/land.vue
index 64824a6..957ecee 100644
--- a/src/views/land/land.vue
+++ b/src/views/land/land.vue
@@ -38,6 +38,17 @@
           @setMapData="setMapData"
         ></getMapDataInThere>
       </template>
+      <template slot-scope="{ type, size, row }" slot="menu">
+        <el-button
+          icon="el-icon-circle-plus-outline"
+          type="text"
+          size="mini"
+          @click="start(row)"
+          :size="size"
+        >农事记录
+        </el-button
+        >
+      </template>
     </avue-crud>
   </basic-container>
 </template>
@@ -284,6 +295,13 @@
       }
       done();
     },
+    //农事操作
+    start(row) {
+      this.$router.push({
+        path: `/framing`,
+        query: row
+      });
+    },
     searchReset() {
       this.query = {};
       this.onLoad(this.page);
@@ -321,178 +339,6 @@
       });
     }
   }
-  // methods: {
-  //   sizeChange(val) {
-  //     this.page1.currentPage = 1;
-  //     this.page1.pageSize = val;
-  //     this.onLoad(this.page, this.query);
-  //   },
-  //   currentChange(val) {
-  //     this.page1.currentPage = val;
-  //     // this.getData();
-  //     this.onLoad(this.page, this.query);
-  //   },
-  //   rowSave(row, done, loading) {
-  //     if (this.polygons.length == 0) {
-  //       //没有面的数据
-  //       this.$refs.getMapData.isCheck = true;
-  //       loading();
-  //     } else {
-  //       //如果有值,空间坐标转换
-  //       let pol = this.polygons;
-  //       let polLength = this.polygons.length - 1;
-  //       let usePolygons = "";
-  //       for (let k in pol) {
-  //         usePolygons += pol[k].lng + "," + pol[k].lat;
-  //         if (k != polLength) {
-  //           usePolygons += ";";
-  //         }
-  //       }
-  //       //设置坐标点
-  //       row.userId=this.userInfo.user_id;
-  //       row.landRange = usePolygons;
-  //     }
-  //     // return;
-  //     add(row).then(res => {
-  //       if (res.data.success) {
-  //         this.$message({
-  //           message: "操作成功",
-  //           type: "success"
-  //         });
-  //         this.refreshChange();
-  //         done();
-  //       } else {
-  //         this.$message({
-  //           message: "操作失败",
-  //           type: "warning"
-  //         });
-  //         done();
-  //       }
-  //     });
-  //   },
-  //   searchChange(params, done) {
-  //     this.query = params;
-  //     this.page.currentPage = 1;
-  //     this.onLoad(this.page, params);
-  //     done();
-  //   },
-  //   beforeOpen(done, type) {
-  //     if (["edit", "view"].includes(type)) {
-  //       getDetail(this.form.id).then(res => {
-  //         this.form = res.data.data;
-  //       });
-  //     }
-  //     if (type == "add") {
-  //       this.$store.commit("setpolygon", []); //用vuex传最终数据
-  //       done();
-  //     }
-  //     done();
-  //   },
-  //   setMapData(val) {
-  //     this.LineData = val[0];
-  //     this.PointData = val[1];
-  //   },
-  //   searchReset() {
-  //     this.query = {};
-  //     this.onLoad(this.page);
-  //   },
-  //   rowUpdate(row, index, done, loading) {
-  //     if (this.polygons.length == 0) {
-  //       //没有面的数据
-  //       this.$refs.getMapData.isCheck = true;
-  //       loading();
-  //       return;
-  //     }
-  //     let pol = this.polygons;
-  //     // console.log(pol);
-  //     let polLength = this.polygons.length - 1;
-  //     let usePolygons = "";
-  //     for (let k in pol) {
-  //       usePolygons += pol[k].lng + "," + pol[k].lat;
-  //       if (k != polLength) {
-  //         usePolygons += ";";
-  //       }
-  //     }
-  //     row.coordinate = usePolygons;
-  //     update(row).then(
-  //       () => {
-  //         this.onLoad(this.page);
-  //         this.$message({
-  //           type: "success",
-  //           message: "操作成功!"
-  //         });
-  //         done();
-  //       },
-  //       error => {
-  //         window.console.log(error);
-  //         loading();
-  //       }
-  //     );
-  //   },
-  //   rowDel(row) {
-  //     this.$confirm("确定删除当前合同信息数据?", {
-  //       confirmButtonText: "确定",
-  //       cancelButtonText: "取消",
-  //       type: "warning"
-  //     })
-  //       .then(() => {
-  //         console.log(row);
-  //         return remove(row.id);
-  //       })
-  //       .then(() => {
-  //         this.onLoad(this.page);
-  //         this.$message({
-  //           type: "success",
-  //           message: "操作成功!"
-  //         });
-  //       });
-  //   },
-  //   selectionChange(list) {
-  //     this.selectionList = list;
-  //   },
-  //   handleDelete() {
-  //     if (this.selectionList.length === 0) {
-  //       this.$message.warning("请选择至少一条数据");
-  //       return;
-  //     }
-  //     this.$confirm("确定批量将选择数据删除?", {
-  //       confirmButtonText: "确定",
-  //       cancelButtonText: "取消",
-  //       type: "warning"
-  //     })
-  //       .then(() => {
-  //         return remove(this.ids).then(res => {
-  //           this.refreshChange();
-  //         });
-  //       })
-  //       .then(() => {
-  //         this.onLoad(this.page);
-  //         this.$message({
-  //           type: "success",
-  //           message: "操作成功!"
-  //         });
-  //         this.$refs.crudrec.toggleSelection();
-  //       })
-  //       .catch(res => {
-  //       });
-  //   },
-  //   refreshChange() {
-  //     this.onLoad(this.page, this.query);
-  //   },
-  //   onLoad(page, params = {}) {
-  //     this.loading = true;
-  //     getList(
-  //       page.currentPage,
-  //       page.pageSize,
-  //       Object.assign(params, this.query)
-  //     ).then(res => {
-  //       const data = res.data.data;
-  //       this.page.total = data.total;
-  //       this.data = data.records;
-  //       this.loading = false;
-  //     });
-  //   }
-  // }
 };
 </script>
 
diff --git a/src/views/stock/stock.vue b/src/views/stock/stock.vue
index 55bab8e..f73adcf 100644
--- a/src/views/stock/stock.vue
+++ b/src/views/stock/stock.vue
@@ -45,6 +45,15 @@
         >出库
         </el-button
         >
+          <el-button
+            icon="el-icon-circle-plus-outline"
+            type="text"
+            size="mini"
+            @click="start(row)"
+            :size="size"
+          >农资记录
+          </el-button
+          >
       </template>
     </avue-crud>
     <el-dialog
@@ -60,11 +69,11 @@
     >
       <div>
         <avue-form
-          ref="form"
+          ref="formR"
           :option="option1"
-          v-model="form"
+          v-model="formR"
           @reset-change="emptytChange"
-          @submit="submit"
+          @submit="submitR"
         >
         </avue-form>
       </div>
@@ -82,11 +91,11 @@
     >
       <div>
         <avue-form
-          ref="form"
-          :option="option1"
-          v-model="form"
+          ref="formC"
+          :option="option2"
+          v-model="formC"
           @reset-change="emptytChange"
-          @submit="submit"
+          @submit="submitC"
         >
         </avue-form>
       </div>
@@ -96,12 +105,15 @@
 
 <script>
 import {getList, getDetail, add, update, remove} from "@/api/stock/stock";
+import {add1} from "@/api/stockrecord/stockrecord";
 import {mapGetters} from "vuex";
 
 export default {
   data() {
     return {
       form: {},
+      formC: {},
+      formR: {},
       specsValue1: '',
       query: {},
       loading: true,
@@ -212,6 +224,7 @@
           {
             label: "入库数量",
             span: 6,
+            type: "number",
             prop: "amount",
             rules: [{
               required: true,
@@ -295,13 +308,6 @@
             type: "textarea",
             prop: "remarks",
             span: 23,
-            rules: [
-              {
-                required: true,
-                message: "请输入备注",
-                trigger: "blur",
-              },
-            ],
           },
         ]
       },
@@ -322,6 +328,7 @@
             prop: "stockId1",
             span: 23,
             type: "select",
+            disabled: true,
             dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
             props: {
               label: "dictValue",
@@ -334,39 +341,19 @@
             }]
           },
           {
-            label: "数量",
-            prop: "amount1",
-          },
-          {
-            label: "时间",
-            prop: "time1",
-            rules: [{
-              required: true,
-              message: "请输入时间",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: "类型 (0:出库 1:入库)",
-            prop: "type1",
-            rules: [{
-              required: true,
-              message: "请输入类型 (0:出库 1:入库)",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: "操作人",
-            prop: "operator1",
-            rules: [{
-              required: true,
-              message: "请输入操作人",
-              trigger: "blur"
-            }]
+            label: "规格",
+            disabled: true,
+            span: 6,
+            prop: "spn",
+            addDisplay: false,
           },
           {
             label: "规格",
-            prop: "spn1",
+            display: false,
+            hide: true,
+            prop: "specs1",
+            span: 5,
+            viewDisplay: false,
             rules: [{
               required: true,
               message: "请输入规格",
@@ -374,31 +361,271 @@
             }]
           },
           {
-            label: "农资类型",
+            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: "请输入农资类型",
+              message: "请输入入库类型",
               trigger: "blur"
             }]
           },
           {
-            label: "图片",
-            prop: "picture1",
+            label: "入库时间",
+            prop: "time1",
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            span: 11,
             rules: [{
               required: true,
-              message: "请输入图片",
+              message: "请输入入库时间",
               trigger: "blur"
             }]
+          },
+          {
+            label: "单据、凭证照片",
+            prop: "picture1",
+            type: "upload",
+            labelWidth: 145,
+            dataType: "string",
+            span: 24,
+            limit: 5,
+            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: "备注",
+            type: "textarea",
             prop: "remarks1",
+            span: 23,
+          },
+        ]
+      },
+      option2: {
+        height: 'auto',
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "农资",
+            prop: "stockId1",
+            span: 23,
+            type: "select",
+            disabled: true,
+            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
             rules: [{
               required: true,
-              message: "请输入备注",
+              message: "请输入农资",
               trigger: "blur"
             }]
+          },
+          {
+            label: "规格",
+            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=stockPurchase1",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            dataType: "number",
+            search: true,
+            rules: [{
+              required: true,
+              message: "请输入出库类型",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "入库时间",
+            prop: "time1",
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            span: 11,
+            rules: [{
+              required: true,
+              message: "请输入入库时间",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "单据、凭证照片",
+            prop: "picture1",
+            type: "upload",
+            labelWidth: 145,
+            dataType: "string",
+            span: 24,
+            limit: 5,
+            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: "备注",
+            type: "textarea",
+            prop: "remarks1",
+            span: 23,
           },
         ]
       },
@@ -426,11 +653,13 @@
     }
   },
   methods: {
-    submit(row, done, loading) {
+    //入库
+    submitR(row, done, loading) {
       var that = this;
-      updateGrade(row).then(
+      add1(row).then(
         () => {
-          that.$refs.form.resetFields();
+          that.onLoad(this.page);
+          that.$refs.formR.resetFields();
           that.$message({
             type: "success",
             message: "操作成功!"
@@ -445,19 +674,56 @@
         }
       );
     },
+    //出库
+    submitC(row, done, loading) {
+      var that = this;
+      add1(row).then(
+        () => {
+          that.onLoad(this.page);
+          that.$refs.formC.resetFields();
+          that.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          that.gradeBoxVisible1 = false;
+
+          done();
+        },
+        error => {
+          window.console.log(error);
+          done();
+        }
+      );
+    },
     // 往入库页面填充数据
     modifiedGrades(row) {
-      this.form = {
+      this.formR = {
         id: null,
         stockId1: row.stockId,
+        spn: row.spn,
+        num: row.amount,
+        type1: row.type,
+        time1: row.time,
+        specs1: row.specs,
+        specsVal1: row.specsValue1,
+        specsVal2: row.specsValue1,
+        stockType1: 1,
 
       };
       this.gradeBoxVisible = true;
     },
     modifiedGrades1(row) {
-      this.form = {
+      this.formC = {
         id: null,
-        stockId: row.stockId,
+        stockId1: row.stockId,
+        spn: row.spn,
+        num: row.amount,
+        type1: row.type,
+        time1: row.time,
+        specs1: row.specs,
+        specsVal1: row.specsValue1,
+        specsVal2: row.specsValue1,
+        stockType1: 0,
 
       };
       this.gradeBoxVisible1 = true;
@@ -535,6 +801,13 @@
       }
       done();
     },
+    //农事操作
+    start(row) {
+      this.$router.push({
+        path: `/stockrecord`,
+        query: row
+      });
+    },
     searchReset() {
       this.query = {};
       this.onLoad(this.page);
diff --git a/src/views/stockrecord/stockrecord.vue b/src/views/stockrecord/stockrecord.vue
index 1d6e80f..5a46fbd 100644
--- a/src/views/stockrecord/stockrecord.vue
+++ b/src/views/stockrecord/stockrecord.vue
@@ -32,7 +32,7 @@
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/stockrecord/stockrecord";
+  import {getList, getDetail, add1, update, remove} from "@/api/stockrecord/stockrecord";
   import {mapGetters} from "vuex";
 
   export default {
@@ -56,12 +56,13 @@
           border: true,
           index: true,
           viewBtn: true,
+          align: "center",
           selection: true,
           dialogClickModal: false,
           column: [
             {
               label: "农资",
-              prop: "stockId",
+              prop: "stockId1",
               span: 23,
               type: "select",
               dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
@@ -76,71 +77,43 @@
               }]
             },
             {
-              label: "数量",
-              prop: "amount",
-            },
-            {
-              label: "时间",
-              prop: "time",
+              label: "分类",
+              prop: "stype",
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockType",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              dataType: "number",
+              search: true,
               rules: [{
                 required: true,
-                message: "请输入时间",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "类型 (0:出库 1:入库)",
-              prop: "type",
-              rules: [{
-                required: true,
-                message: "请输入类型 (0:出库 1:入库)",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "操作人",
-              prop: "operator",
-              rules: [{
-                required: true,
-                message: "请输入操作人",
+                message: "请输入类型",
                 trigger: "blur"
               }]
             },
             {
               label: "规格",
               prop: "spn",
-              rules: [{
-                required: true,
-                message: "请输入规格",
-                trigger: "blur"
-              }]
             },
             {
-              label: "农资类型",
-              prop: "stockType",
-              rules: [{
-                required: true,
-                message: "请输入农资类型",
-                trigger: "blur"
-              }]
+              label: "类型",
+              prop: "type1",
+              span: 12,
+              searchSpan: 4,
             },
             {
-              label: "图片",
-              prop: "picture",
-              rules: [{
-                required: true,
-                message: "请输入图片",
-                trigger: "blur"
-              }]
+              label: "数量",
+              prop: "count",
             },
             {
-              label: "备注",
-              prop: "remarks",
-              rules: [{
-                required: true,
-                message: "请输入备注",
-                trigger: "blur"
-              }]
+              label: "时间",
+              prop: "time1",
+            },
+            {
+              label: "操作人",
+              prop: "czr",
             },
           ]
         },
@@ -153,7 +126,7 @@
         return {
           addBtn: this.vaildData(this.permission.stockrecord_add, false),
           viewBtn: this.vaildData(this.permission.stockrecord_view, false),
-          delBtn: this.vaildData(this.permission.stockrecord_delete, false),
+          delBtn: this.vaildData(this.permission.stockrecord_delete, true),
           editBtn: this.vaildData(this.permission.stockrecord_edit, false)
         };
       },
@@ -166,19 +139,19 @@
       }
     },
     methods: {
-      rowSave(row, done, loading) {
-        add(row).then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          done();
-        }, error => {
-          loading();
-          window.console.log(error);
-        });
-      },
+      // rowSave(row, done, loading) {
+      //   add(row).then(() => {
+      //     this.onLoad(this.page);
+      //     this.$message({
+      //       type: "success",
+      //       message: "操作成功!"
+      //     });
+      //     done();
+      //   }, error => {
+      //     loading();
+      //     window.console.log(error);
+      //   });
+      // },
       rowUpdate(row, index, done, loading) {
         update(row).then(() => {
           this.onLoad(this.page);
@@ -267,6 +240,7 @@
       },
       onLoad(page, params = {}) {
         this.loading = true;
+
         getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
           const data = res.data.data;
           this.page.total = data.total;

--
Gitblit v1.9.3