From 425152d436e73d4ef93e2e809998b5c837f7cd96 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 13 May 2022 08:48:04 +0800
Subject: [PATCH] 农资管理

---
 src/router/page/index.js              |   11 
 src/views/stock/stock.vue             |  765 ++++++++++++++++++--------
 src/views/stock/stockInfo.vue         |  120 ++++
 src/views/stockrecord/stockrecord.vue |  283 ++++++++++
 src/views/land/land.vue               |  431 +++++++++-----
 src/api/land/land.js                  |    4 
 src/api/stockrecord/stockrecord.js    |   50 +
 src/api/stock/stock.js                |    4 
 8 files changed, 1,270 insertions(+), 398 deletions(-)

diff --git a/src/api/land/land.js b/src/api/land/land.js
index ec0caa8..fbeb54a 100644
--- a/src/api/land/land.js
+++ b/src/api/land/land.js
@@ -14,7 +14,7 @@
 
 export const getDetail = (id) => {
     return request({
-        url: '/api/land/land/detail',
+        url: '/api/land/land/details',
         method: 'get',
         params: {
             id
@@ -56,4 +56,4 @@
             userid
         }
     })
-}
\ No newline at end of file
+}
diff --git a/src/api/stock/stock.js b/src/api/stock/stock.js
index 811755e..58511c3 100644
--- a/src/api/stock/stock.js
+++ b/src/api/stock/stock.js
@@ -2,7 +2,7 @@
 
 export const getList = (current, size, params) => {
   return request({
-    url: '/api/stock/stock/list',
+    url: '/api/stock/stock/page',
     method: 'get',
     params: {
       ...params,
@@ -34,7 +34,7 @@
 
 export const add = (row) => {
   return request({
-    url: '/api/stock/stock/submit',
+    url: '/api/stock/stock/save',
     method: 'post',
     data: row
   })
diff --git a/src/api/stockrecord/stockrecord.js b/src/api/stockrecord/stockrecord.js
new file mode 100644
index 0000000..178ea21
--- /dev/null
+++ b/src/api/stockrecord/stockrecord.js
@@ -0,0 +1,50 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/stockrecord/stockrecord/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/stockrecord/stockrecord/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/stockrecord/stockrecord/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/stockrecord/stockrecord/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/stockrecord/stockrecord/submit',
+    method: 'post',
+    data: row
+  })
+}
+
diff --git a/src/router/page/index.js b/src/router/page/index.js
index 1136402..056fb1e 100644
--- a/src/router/page/index.js
+++ b/src/router/page/index.js
@@ -12,6 +12,17 @@
   }
 },
   {
+    path: '/stockInfo',
+    name: '登录页',
+    component: () =>
+      import( /* webpackChunkName: "page" */ '@/views/stock/stockInfo'),
+    meta: {
+      keepAlive: true,
+      isTab: false,
+      isAuth: false
+    }
+  },
+  {
     path: '/lock',
     name: '锁屏页',
     component: () =>
diff --git a/src/views/land/land.vue b/src/views/land/land.vue
index 984b378..64824a6 100644
--- a/src/views/land/land.vue
+++ b/src/views/land/land.vue
@@ -27,7 +27,7 @@
           icon="el-icon-delete"
           v-if="permission.rail_delete"
           @click="handleDelete"
-          >删 除
+        >删 除
         </el-button>
       </template>
       <!-- 地图插入 -->
@@ -43,10 +43,11 @@
 </template>
 
 <script>
-import { getList, add, update, remove, getRailTree } from "@/api/land/land";
+import {getList, add, update, remove,getDetail} from "@/api/land/land";
 import getMapDataInThere from "./getMapDataInThere.vue";
 
-import { mapGetters } from "vuex";
+import {mapGetters} from "vuex";
+
 export default {
   components: {
     getMapDataInThere
@@ -105,6 +106,7 @@
           {
             label: "地块面积",
             span: 6,
+            addDisplay: false,
             disabled: true,
             gutter: 20,
             tip: '绘制轮廓后自动计算',
@@ -124,7 +126,7 @@
           //   }]
           // },
           {
-            label: "单位",
+            label: "面积单位",
             prop: "landUnit",
             type: "select",
             dicUrl: "/api/blade-system/dict-biz/dictionary?code=landunit",
@@ -133,7 +135,7 @@
               value: "dictKey"
             },
             dataType: "number",
-            span: 5,
+            span: 6,
           },
           {
             label: "路线展示",
@@ -155,14 +157,14 @@
   },
   computed: {
     ...mapGetters(["userInfo", "permission", "polygons"]),
-    // permissionList() {
-    //   return {
-    //     addBtn: this.vaildData(this.permission.rail_add, true),
-    //     viewBtn: this.vaildData(this.permission.rail_view, false),
-    //     delBtn: this.vaildData(this.permission.rail_delete, false),
-    //     editBtn: this.vaildData(this.permission.rail_edit, false)
-    //   };
-    // },
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.land_add, false),
+        viewBtn: this.vaildData(this.permission.land_view, false),
+        delBtn: this.vaildData(this.permission.land_delete, false),
+        editBtn: this.vaildData(this.permission.land_edit, false)
+      };
+    },
     ids() {
       let ids = [];
       this.selectionList.forEach(ele => {
@@ -174,151 +176,58 @@
   mounted() {
   },
   methods: {
-    beforeOpen(done, type) {
-      if (type == "edit") {
-        // this.$refs.getMapData.doThat(this.polygons);
-        done();
-      } else if (type == "add") {
-        this.$store.commit("setpolygon", []); //用vuex传最终数据
-        done();
-      }
-    },
-    setMapData(val) {
-      this.LineData = val[0];
-      this.PointData = val[1];
-    },
-    //dom获取、
-    checkDom(name, fn) {
-      //  声明定时器
-      let that = this;
-      var timer = null;
-      //  检查dom是否执行完成
-      function checkDom() {
-        let dom = that.$refs[name];
-        if (dom) {
-          //  执行dom加载完成后的操作
-          //  清除定时器
-          if (!timer) {
-            clearTimeout(timer);
-          }
-          if (fn) {
-            //回调函数
-            fn(dom);
-            return;
-          } else {
-            return dom;
-          }
-        } else {
-          //  自我调用
-          timer = setTimeout(checkDom, 100);
-        }
-      }
-      //  首次执行
-      checkDom();
-    },
-    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(form, done, loading) {
+    rowSave(row, 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 += ";";
+      } 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;
       }
-      // console.log(form);
-      let data = {
-        name: form.name,
-        type: form.type,
-        companyId: form.companyId,
-        coordinate: usePolygons
-      };
-      // return;
-      add(data).then(res => {
-        if (res.data.success) {
-          this.$message({
-            message: "操作成功",
-            type: "success"
-          });
-          this.refreshChange();
-          done();
-        } else {
-          this.$message({
-            message: "操作失败",
-            type: "warning"
-          });
-          done();
-        }
+      add(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        done();
+      }, error => {
+        loading();
+        window.console.log(error);
       });
     },
-    searchChange(params, done) {
-      this.query = params;
-      this.page.currentPage = 1;
-      this.onLoad(this.page, params);
-      done();
-    },
-    searchReset() {
-      this.query = {};
-      this.onLoad(this.page);
-    },
     rowUpdate(row, index, done, loading) {
-      if (this.polygons.length == 0) {
-        //没有面的数据
-        this.$refs.getMapData.isCheck = true;
+      update(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        done();
+      }, error => {
         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();
-        }
-      );
+        console.log(error);
+      });
     },
     rowDel(row) {
-      this.$confirm("确定删除当前合同信息数据?", {
+      this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
       })
         .then(() => {
-          console.log(row);
           return remove(row.id);
         })
         .then(() => {
@@ -329,23 +238,18 @@
           });
         });
     },
-    selectionChange(list) {
-      this.selectionList = list;
-    },
     handleDelete() {
       if (this.selectionList.length === 0) {
         this.$message.warning("请选择至少一条数据");
         return;
       }
-      this.$confirm("确定批量将选择数据删除?", {
+      this.$confirm("确定将选择数据删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
       })
         .then(() => {
-          return remove(this.ids).then(res => {
-            this.refreshChange();
-          });
+          return remove(this.ids);
         })
         .then(() => {
           this.onLoad(this.page);
@@ -353,27 +257,242 @@
             type: "success",
             message: "操作成功!"
           });
-          this.$refs.crudrec.toggleSelection();
-        })
-        .catch(res => {});
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        // getDetail(this.form.id).then(res => {
+        //   this.form = res.data.data;
+        // });
+        getDetail(this.form.id).then((res) => {
+          if (res.data.code == 200) {
+            this.form = res.data.data;
+            let usePolygons = this.form.landRange
+              .split("POLYGON((")[1]
+              .split("))")[0]
+              .split(",");
+            for (let k in usePolygons) {
+              usePolygons[k] = {
+                lng: +usePolygons[k].split(" ")[0],
+                lat: +usePolygons[k].split(" ")[1],
+              };
+            }
+            this.$refs.getMapData.draw(usePolygons);
+          }
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
     },
     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 => {
+      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;
+        this.selectionClear();
       });
     }
   }
+  // 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 00befd9..55bab8e 100644
--- a/src/views/stock/stock.vue
+++ b/src/views/stock/stock.vue
@@ -26,264 +26,553 @@
                    v-if="permission.stock_delete"
                    @click="handleDelete">删 除
         </el-button>
+
+      </template>
+      <template slot-scope="{ type, size, row }" slot="menu">
+        <el-button
+          icon="el-icon-circle-plus-outline"
+          @click="modifiedGrades(row)"
+          :size="size"
+          :type="type"
+        >入库
+        </el-button
+        >
+        <el-button
+          icon="el-icon-edit-outline"
+          @click="modifiedGrades1(row)"
+          :size="size"
+          :type="type"
+        >出库
+        </el-button
+        >
       </template>
     </avue-crud>
+    <el-dialog
+      title="农资入库"
+      :visible.sync="gradeBoxVisible"
+      width="width"
+      :modal="true"
+      :modal-append-to-body="true"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :before-close="dialogBeforeClose"
+    >
+      <div>
+        <avue-form
+          ref="form"
+          :option="option1"
+          v-model="form"
+          @reset-change="emptytChange"
+          @submit="submit"
+        >
+        </avue-form>
+      </div>
+    </el-dialog>
+    <el-dialog
+      title="农资出库"
+      :visible.sync="gradeBoxVisible1"
+      width="width"
+      :modal="true"
+      :modal-append-to-body="true"
+      :append-to-body="true"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :before-close="dialogBeforeClose"
+    >
+      <div>
+        <avue-form
+          ref="form"
+          :option="option1"
+          v-model="form"
+          @reset-change="emptytChange"
+          @submit="submit"
+        >
+        </avue-form>
+      </div>
+    </el-dialog>
   </basic-container>
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/stock/stock";
-  import {mapGetters} from "vuex";
+import {getList, getDetail, add, update, remove} from "@/api/stock/stock";
+import {mapGetters} from "vuex";
 
-  export default {
-    data() {
-      return {
-        form: {},
-        query: {},
-        loading: true,
-        page: {
-          pageSize: 10,
-          currentPage: 1,
-          total: 0
-        },
-        selectionList: [],
-        option: {
-          height:'auto',
-          calcHeight: 30,
-          tip: false,
-          searchShow: true,
-          searchMenuSpan: 6,
-          border: true,
-          index: true,
-          viewBtn: true,
-          selection: true,
-          dialogClickModal: false,
-          column: [
-            {
-              label: "农资ID",
-              prop: "stockId",
-              rules: [{
-                required: true,
-                message: "请输入农资ID",
-                trigger: "blur"
-              }]
+export default {
+  data() {
+    return {
+      form: {},
+      specsValue1: '',
+      query: {},
+      loading: true,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      selectionList: [],
+      option: {
+        height: 'auto',
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 3,
+        border: true,
+        index: true,
+        align: "center",
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "农资",
+            prop: "stockId",
+            span: 23,
+            type: "select",
+            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "规格",
-              prop: "specs",
-              rules: [{
-                required: true,
-                message: "请输入规格",
-                trigger: "blur"
-              }]
+            rules: [{
+              required: true,
+              message: "请输入农资",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "农资类型",
+            prop: "stype",
+            addDisplay: false,
+            searchLabelWidth: 80,
+            searchSpan: 4,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockType",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "规格值(0:克 1:斤 2:公斤 3:吨 4:毫升 5:升 )",
-              prop: "specsValue1",
-              rules: [{
-                required: true,
-                message: "请输入规格值(0:克 1:斤 2:公斤 3:吨 4:毫升 5:升 )",
-                trigger: "blur"
-              }]
+            dataType: "number",
+            search: true,
+          },
+          {
+            label: "厂家名称",
+            prop: "factoryName",
+            addDisplay: false,
+          },
+          {
+            label: "规格",
+            prop: "spn",
+            addDisplay: false,
+          },
+          {
+            label: "规格",
+            hide: true,
+            prop: "specs",
+            span: 5,
+            viewDisplay: false,
+            rules: [{
+              required: true,
+              message: "请输入规格",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "规格值1",
+            hide: true,
+            prop: "specsValue1",
+            searchSpan: 4,
+            span: 6,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "规格值2( 0:袋 1:包 2:瓶 3:盒 4:箱 5:桶 6:支)",
-              prop: "specsValue2",
-              rules: [{
-                required: true,
-                message: "请输入规格值2( 0:袋 1:包 2:瓶 3:盒 4:箱 5:桶 6:支)",
-                trigger: "blur"
-              }]
+            dataType: "number",
+            search: true,
+            viewDisplay: false,
+          },
+          {
+            label: "规格值2",
+            hide: true,
+            prop: "specsValue2",
+            searchSpan: 4,
+            span: 6,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "入库数量",
-              prop: "amount",
-              rules: [{
-                required: true,
-                message: "请输入入库数量",
-                trigger: "blur"
-              }]
+            dataType: "number",
+            search: true,
+            viewDisplay: false,
+          },
+          {
+            label: "入库数量",
+            span: 6,
+            prop: "amount",
+            rules: [{
+              required: true,
+              message: "请输入入库数量",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "是否库存",
+            prop: "state",
+            type: "select",
+            searchSpan: 4,
+            searchLabelWidth: 95,
+            search: true,
+            addDisplay: false,
+            dicData: [
+              {
+                label: "有库存",
+                value: "0"
+              },
+              {
+                label: "无库存",
+                value: "1"
+              }
+            ],
+          },
+          {
+            label: "入库类型",
+            prop: "type",
+            type: "select",
+            span: 12,
+            searchSpan: 4,
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "类型 (0:采购入库 1:调拨入库)",
-              prop: "type",
-              rules: [{
-                required: true,
-                message: "请输入类型 (0:采购入库 1:调拨入库)",
-                trigger: "blur"
-              }]
+            dataType: "number",
+            search: true,
+            rules: [{
+              required: true,
+              message: "请输入入库类型",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "入库时间",
+            prop: "time",
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            span: 11,
+            rules: [{
+              required: true,
+              message: "请输入入库时间",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "单据、凭证照片",
+            prop: "picture",
+            type: "upload",
+            labelWidth: 145,
+            dataType: "string",
+            span: 24,
+            limit: 5,
+            listType: "picture-card",
+            tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+            canvasOption: {
+              text: "",
+              ratio: 1.0,
             },
-            {
-              label: "入库时间",
-              prop: "time",
-              rules: [{
-                required: true,
-                message: "请输入入库时间",
-                trigger: "blur"
-              }]
+            propsHttp: {
+              res: "data",
+              url: "url"
             },
-            {
-              label: "图片",
-              prop: "picture",
-              rules: [{
-                required: true,
-                message: "请输入图片",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "备注",
-              prop: "remarks",
-              rules: [{
+            action: "/api/blade-resource/oss/endpoint/put-files"
+          },
+          {
+            label: "备注",
+            type: "textarea",
+            prop: "remarks",
+            span: 23,
+            rules: [
+              {
                 required: true,
                 message: "请输入备注",
-                trigger: "blur"
-              }]
+                trigger: "blur",
+              },
+            ],
+          },
+        ]
+      },
+      option1: {
+        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",
+            dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
             },
-            {
-              label: "状态 (0:有库存 1:没有库存)",
-              prop: "state",
-              rules: [{
-                required: true,
-                message: "请输入状态 (0:有库存 1:没有库存)",
-                trigger: "blur"
-              }]
-            },
-          ]
-        },
-        data: []
+            rules: [{
+              required: true,
+              message: "请输入农资",
+              trigger: "blur"
+            }]
+          },
+          {
+            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: "规格",
+            prop: "spn1",
+            rules: [{
+              required: true,
+              message: "请输入规格",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "农资类型",
+            prop: "stockType1",
+            rules: [{
+              required: true,
+              message: "请输入农资类型",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "图片",
+            prop: "picture1",
+            rules: [{
+              required: true,
+              message: "请输入图片",
+              trigger: "blur"
+            }]
+          },
+          {
+            label: "备注",
+            prop: "remarks1",
+            rules: [{
+              required: true,
+              message: "请输入备注",
+              trigger: "blur"
+            }]
+          },
+        ]
+      },
+      gradeBoxVisible: false,
+      gradeBoxVisible1: false,
+      data: []
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.stock_add, false),
+        viewBtn: this.vaildData(this.permission.stock_view, false),
+        delBtn: this.vaildData(this.permission.stock_delete, false),
+        editBtn: this.vaildData(this.permission.stock_edit, false)
       };
     },
-    computed: {
-      ...mapGetters(["permission"]),
-      permissionList() {
-        return {
-          addBtn: this.vaildData(this.permission.stock_add, false),
-          viewBtn: this.vaildData(this.permission.stock_view, false),
-          delBtn: this.vaildData(this.permission.stock_delete, false),
-          editBtn: this.vaildData(this.permission.stock_edit, false)
-        };
-      },
-      ids() {
-        let ids = [];
-        this.selectionList.forEach(ele => {
-          ids.push(ele.id);
-        });
-        return ids.join(",");
-      }
-    },
-    methods: {
-      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);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          done();
-        }, error => {
-          loading();
-          console.log(error);
-        });
-      },
-      rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return remove(row.id);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-          });
-      },
-      handleDelete() {
-        if (this.selectionList.length === 0) {
-          this.$message.warning("请选择至少一条数据");
-          return;
-        }
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
-          .then(() => {
-            return remove(this.ids);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-            this.$refs.crud.toggleSelection();
-          });
-      },
-      beforeOpen(done, type) {
-        if (["edit", "view"].includes(type)) {
-          getDetail(this.form.id).then(res => {
-            this.form = res.data.data;
-          });
-        }
-        done();
-      },
-      searchReset() {
-        this.query = {};
-        this.onLoad(this.page);
-      },
-      searchChange(params, done) {
-        this.query = params;
-        this.page.currentPage = 1;
-        this.onLoad(this.page, params);
-        done();
-      },
-      selectionChange(list) {
-        this.selectionList = list;
-      },
-      selectionClear() {
-        this.selectionList = [];
-        this.$refs.crud.toggleSelection();
-      },
-      currentChange(currentPage){
-        this.page.currentPage = currentPage;
-      },
-      sizeChange(pageSize){
-        this.page.pageSize = pageSize;
-      },
-      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;
-          this.selectionClear();
-        });
-      }
+    ids() {
+      let ids = [];
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
     }
-  };
+  },
+  methods: {
+    submit(row, done, loading) {
+      var that = this;
+      updateGrade(row).then(
+        () => {
+          that.$refs.form.resetFields();
+          that.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          that.gradeBoxVisible = false;
+
+          done();
+        },
+        error => {
+          window.console.log(error);
+          done();
+        }
+      );
+    },
+    // 往入库页面填充数据
+    modifiedGrades(row) {
+      this.form = {
+        id: null,
+        stockId1: row.stockId,
+
+      };
+      this.gradeBoxVisible = true;
+    },
+    modifiedGrades1(row) {
+      this.form = {
+        id: null,
+        stockId: row.stockId,
+
+      };
+      this.gradeBoxVisible1 = true;
+    },
+    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);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        done();
+      }, error => {
+        loading();
+        console.log(error);
+      });
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(this.ids);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then(res => {
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    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;
+        this.selectionClear();
+      });
+    }
+  }
+};
 </script>
 
 <style>
diff --git a/src/views/stock/stockInfo.vue b/src/views/stock/stockInfo.vue
new file mode 100644
index 0000000..0ddf096
--- /dev/null
+++ b/src/views/stock/stockInfo.vue
@@ -0,0 +1,120 @@
+<template>
+  <basic-container>
+    <el-form ref="form" :model="form" label-width="80px">
+      <el-row type="flex" class="row-bg" justify="end">
+        <el-form-item>
+          <el-button @click="handleCancel">关闭</el-button>
+        </el-form-item>
+      </el-row>
+      <el-card shadow="hover">
+        <div slot="header">
+          <span>审批信息</span>
+        </div>
+        <el-form-item label="发起人">
+          <el-input :disabled="true" v-model="form.flow.assigneeName" />
+        </el-form-item>
+        <el-form-item label="任务名称">
+          <el-input :disabled="true" v-model="form.taskname"/>
+        </el-form-item>
+        <el-form-item label="优先级别">
+          <el-input :disabled="true" v-model="form.jb"/>
+        </el-form-item>
+        <el-form-item label="工时">
+          <el-input :disabled="true" v-model="form.timecount"/>
+        </el-form-item>
+        <el-row>
+<!--          <el-col :span="12">-->
+<!--            <el-form-item label="开始时间">-->
+<!--              <el-input :disabled="true" v-model="form.startTime" />-->
+<!--            </el-form-item>-->
+<!--          </el-col>-->
+          <el-col :span="12">
+            <el-form-item label="结束时间">
+              <el-input :disabled="true" v-model="form.endTime" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="任务描述">
+          <el-input :disabled="true" type="textarea" v-model="form.reason" />
+        </el-form-item>
+      </el-card>
+      <el-card shadow="hover">
+        <div slot="header">
+          <span>流程信息</span>
+        </div>
+        <el-row type="flex" class="row-bg">
+          <el-timeline>
+            <el-timeline-item :key="flow.id" :timestamp="flow.createTime" v-for="flow in flowList" placement="top">
+              <el-card shadow="hover">
+                <p>{{flow.assigneeName}} 在 [{{flow.createTime}}] 开始处理 [{{flow.historyActivityName}}] 环节</p>
+                <p v-if="flow.historyActivityDurationTime!==''">任务历时 [{{flow.historyActivityDurationTime}}]</p>
+                <p v-if="flow.comment!==''">批复意见: [{{flow.comment}}]</p>
+                <p v-if="flow.endTime!==''">结束时间: [{{flow.endTime}}]</p>
+              </el-card>
+            </el-timeline-item>
+          </el-timeline>
+        </el-row>
+      </el-card>
+      <el-card shadow="hover">
+        <div slot="header">
+          <span>流程跟踪</span>
+        </div>
+        <el-row type="flex" class="row-bg">
+          <img :src="src" alt="design">
+        </el-row>
+      </el-card>
+    </el-form>
+  </basic-container>
+</template>
+
+<script>
+  import {historyFlowList, leaveDetail} from "@/api/work/process";
+
+  export default {
+    data() {
+      return {
+        businessId: '',
+        processInstanceId: '',
+        src: '',
+        flowList: [],
+        form: {
+          flow:{
+            assigneeName:'',
+          },
+          startTime: '',
+          endTime: '',
+          reason: '',
+          timecount:'',
+          taskname:'',
+          jb:'',
+        }
+      }
+    },
+    created() {
+      this.init();
+    },
+    methods: {
+      init() {
+        this.processInstanceId = this.$route.params.processInstanceId;
+        this.businessId = this.$route.params.businessId;
+        this.src = `/api/blade-flow/process/diagram-view?processInstanceId=${this.$route.params.processInstanceId}&t=${new Date().getTime()}`;
+        historyFlowList(this.processInstanceId).then(res => {
+          const data = res.data;
+          if (data.success) {
+            this.flowList = data.data;
+          }
+        })
+        leaveDetail(this.businessId).then(res => {
+          const data = res.data;
+          if (data.success) {
+            this.form = data.data;
+          }
+        })
+      },
+      handleCancel() {
+        this.$router.$avueRouter.closeTag();
+        this.$router.push({path: `/work/start`});
+      }
+    }
+  }
+</script>
diff --git a/src/views/stockrecord/stockrecord.vue b/src/views/stockrecord/stockrecord.vue
new file mode 100644
index 0000000..1d6e80f
--- /dev/null
+++ b/src/views/stockrecord/stockrecord.vue
@@ -0,0 +1,283 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button type="danger"
+                   size="small"
+                   icon="el-icon-delete"
+                   plain
+                   v-if="permission.stockrecord_delete"
+                   @click="handleDelete">删 除
+        </el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/stockrecord/stockrecord";
+  import {mapGetters} from "vuex";
+
+  export default {
+    data() {
+      return {
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          height:'auto',
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "农资",
+              prop: "stockId",
+              span: 23,
+              type: "select",
+              dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
+              rules: [{
+                required: true,
+                message: "请输入农资",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "数量",
+              prop: "amount",
+            },
+            {
+              label: "时间",
+              prop: "time",
+              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: "请输入操作人",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "规格",
+              prop: "spn",
+              rules: [{
+                required: true,
+                message: "请输入规格",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "农资类型",
+              prop: "stockType",
+              rules: [{
+                required: true,
+                message: "请输入农资类型",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "图片",
+              prop: "picture",
+              rules: [{
+                required: true,
+                message: "请输入图片",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "备注",
+              prop: "remarks",
+              rules: [{
+                required: true,
+                message: "请输入备注",
+                trigger: "blur"
+              }]
+            },
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        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),
+          editBtn: this.vaildData(this.permission.stockrecord_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      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);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      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;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

--
Gitblit v1.9.3