Browse Source

Merge branch 'live' into edit

戴艳蓉 3 years ago
parent
commit
9a260f90b8

+ 5 - 2
src/apis/service/stock/check/detail.js

@@ -3,7 +3,7 @@ import http from "@/apis/axios";
 const api = "admin/";
 export default {
   // 添加
-  add: (data, params) => http(api + "add", data, "post", params),
+  add: (data, params) => http(api + "checkcreate", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "checkedell", data, "post", params),
   // 分页查询
@@ -14,5 +14,8 @@ export default {
   update: (data, params) => http(api + "checkedit", data, "post", params),
   // 修改状态
   status: (data, params) => http(api + "checkestatus", data, "post", params),
+  // 盘点结果商品列表
+  checkgood: (data, params) => http(api + "checkgood", data, "post", params),
+  // 导入盘点结果
+  checkimport: (data, params) => http(api + "checkimport", data, "post", params),
 };
-   

+ 1 - 1
src/components/search-stock-good-modal/columns.js

@@ -1,7 +1,7 @@
 export default [
   { type: "selection", fixed: "left", _noset_: true },
   {
-    prop: "good_code",
+    prop: "type_code",
     label: "商品编码",
     width: "150",
   },

+ 1 - 0
src/components/search-stock/main.vue

@@ -19,6 +19,7 @@
       :key="item.id + index"
       :label="item.name"
       :value="item.wsm_code"
+      :disabled="item.status === '0'"
     >
     </el-option>
   </el-select>

+ 1 - 0
src/components/upload-excel/main.vue

@@ -39,6 +39,7 @@
 import XLSX from "xlsx";
 
 export default {
+  name:"uploadExcel",
   props: {
     beforeUpload: Function, // eslint-disable-line
     onSuccess: Function, // eslint-disable-line

+ 1 - 1
src/config/env.production.js

@@ -3,7 +3,7 @@ module.exports = {
   title: '采销平台订单系统',
   baseUrl: 'http://wx.wxhr.sit.futurelab.tv',
   api: {
-    baseApi: 'http://inv.sitw.wanyuhengtong.com/',
+    // baseApi: 'http://inv.sitw.wanyuhengtong.com/',
     // tableApi: 'http://inv.sit.wanyuhengtong.com/',
 
     userApi: 'http://inv.test241.wanyuhengtong.com/',

+ 7 - 3
src/views/stock/allot/addEdit.vue

@@ -13,9 +13,9 @@
     element-loading-spinner="el-icon-loading"
     element-loading-background="rgba(0, 0, 0, 0.8)"
   >
-    <el-row :gutter="10" style="margin-top:-20px">
+    <el-row :gutter="10" style="margin-top: -20px">
       <el-col :span="24">
-        <add-form :id="id" @closeModel="closeModel" />
+        <add-form v-if="showModelThis" :id="id" @closeModel="closeModel"    @refresh="refresh" />
       </el-col>
     </el-row>
   </el-dialog>
@@ -56,7 +56,11 @@ export default {
       console.log("closeModel!!");
       this.showModelThis = false;
     },
-    closeModell() {},
+    refresh(e) {
+      console.log(e);
+      this.showModelThis = e;
+      this.$emit("refresh", true);
+    },
   },
 };
 </script>

+ 59 - 0
src/views/stock/allot/columns.js

@@ -0,0 +1,59 @@
+
+export default [
+  // 表格 - 列参数
+
+  {
+    prop: "allot_code",
+    label: "调拨编号",
+    width: "170"
+  },
+
+  {
+    prop: "wsm_out_name",
+    label: "出库仓库名称",
+    width: "172"
+  },
+
+  {
+    prop: "wsm_out",
+    label: "出库仓库编号",
+    width: "172"
+  },
+  {
+    prop: "wsm_in_name",
+    label: "入库仓库名称",
+    width: "172"
+
+  },
+  {
+    prop: "wsm_in",
+    label: "入库仓库编号",
+    width: "172"
+
+  },
+  {
+    prop: "apply_name",
+    label: "申请人",
+    width: "80"
+  },
+  {
+    prop: "status",
+    label: "调拨状态",
+    _slot_: "status",
+    width: "120px",
+  },
+  {
+    prop: "addtime",
+    label: "申请时间",
+    width: "145px",
+  },
+  {
+    prop: "",
+    label: "操作",
+    _noset_: true,
+    fixed: "right",
+    _slot_: "operation",
+    width: "50"
+  },
+
+]

+ 216 - 81
src/views/stock/allot/components/addForm.vue

@@ -17,6 +17,7 @@
               <search-supplier
                 :value="ruleForm.supplier_code"
                 :placeholder="'请选择公司'"
+                :names="supplier_name"
                 @searchChange="selectSupplier"
               />
             </el-form-item>
@@ -39,6 +40,7 @@
               <search-supplier
                 :value="ruleForm.supplier_in_code"
                 :placeholder="'请选择公司'"
+                :names="supplier_in_name"
                 @searchChange="selectSupplierIn"
               />
             </el-form-item>
@@ -79,31 +81,46 @@
                 :data="ruleForm.product_go"
                 border
                 :size="'mini'"
+                row-key="key"
                 max-height="400px"
               >
-                <el-table-column
-                  show-overflow-tooltip
-                  :prop="item.prop"
-                  :label="item.label"
-                  :width="item.width"
-                  :min-width="item.minWidth"
-                  v-for="(item, index) in columns"
-                  :key="item.prop + index"
-                >
-                  <template slot-scope="scope">
-                    <el-form-item
-                      :prop="'list.' + scope.$index + '.' + scope.row.id"
-                      :size="'mini'"
-                    >
-                      <el-input
+                <template v-for="(item, index) in columns">
+                  <el-table-column
+                    v-if="item.prop !== 'allot_num'"
+                    show-overflow-tooltip
+                    :prop="item.prop"
+                    :label="item.label"
+                    :width="item.width"
+                    :min-width="item.minWidth"
+                    :key="item.prop + index"
+                  >
+                  </el-table-column>
+                  <el-table-column
+                    :prop="item.prop"
+                    :label="item.label"
+                    :width="item.width"
+                    :min-width="item.minWidth"
+                    :key="item.prop + index"
+                    v-else
+                  >
+                    <template slot-scope="scope">
+                      <el-form-item
+                        :prop="'list.' + scope.$index + '.' + scope.row.id"
                         :size="'mini'"
-                        v-model="scope.row[item.prop]"
-                        v-if="scope.row.edit && item.prop === 'allot_num'"
-                      ></el-input>
-                      <span v-else>{{ scope.row[item.prop] }}</span>
-                    </el-form-item>
-                  </template>
-                </el-table-column>
+                      >
+                        <el-input
+                          :size="'mini'"
+                          v-model="scope.row[item.prop]"
+                          v-if="scope.row.edit"
+                        ></el-input>
+                        <span v-else class="spscope">{{
+                          scope.row[item.prop]
+                        }}</span>
+                      </el-form-item>
+                    </template>
+                  </el-table-column>
+                </template>
+
                 <el-table-column fixed="right" label="操作" width="80">
                   <template slot-scope="scope">
                     <el-tooltip
@@ -172,9 +189,11 @@ export default {
   data() {
     return {
       showGoodsModel: false,
-      id: "",
+      // id: "",
       supplier_code: "",
       stock_in_code: "",
+      supplier_name: "",
+      supplier_in_name: "",
       isDisabled: true,
       isDisabledIn: true,
       loading: false,
@@ -229,46 +248,106 @@ export default {
             trigger: "change",
           },
         ],
+        type_code: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        good_name: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        usable_stock: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        allot_num: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        unit: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        color: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+
+        material: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
+        brand: [
+          {
+            required: false,
+            message: "",
+            trigger: "blur",
+          },
+        ],
       },
       columns: [
         {
-          prop: "good_code",
+          prop: "type_code",
           label: "商品编码",
           width: "150",
         },
         {
           prop: "good_name",
           label: "商品名称",
-          minWidth: "170",
+          minWidth: "180",
         },
         {
           prop: "usable_stock",
           label: "可用库存数",
-          width: "110",
+          width: "100",
         },
         {
           prop: "allot_num",
           label: "调拨数量",
-          width: "130",
+          width: "140",
         },
 
-        {
-          prop: "unit",
-          label: "单位",
-          width: "45",
-        },
-        {
-          prop: "color",
-          label: "商品颜色",
-        },
-        {
-          prop: "material",
-          label: "商品材质",
-        },
-        {
-          prop: "brand",
-          label: "品牌",
-        },
+        // {
+        //   prop: "unit",
+        //   label: "单位",
+        //   width: "45",
+        // },
+        // {
+        //   prop: "color",
+        //   label: "商品颜色",
+        //   width: "70",
+        // },
+        // {
+        //   prop: "material",
+        //   label: "商品材质",
+        //   width: "70",
+        // },
+        // {
+        //   prop: "brand",
+        //   label: "品牌",
+        //   width: "70",
+        // },
       ],
       tableData: [],
     };
@@ -288,22 +367,10 @@ export default {
   },
   mounted() {
     console.log("asd");
-    this.id = this.$route.query.id;
-    // this.getValue();
+    // this.id = this.$route.query.id;
     this.initForm();
   },
   methods: {
-    async getValue() {
-      const res = await asyncRequest.detail({ id: this.id });
-      if (res && res.code === 0 && res.data) {
-        // this.ruleForm = res.data;
-        // this.ruleForm.role_id = this.ruleForm.role;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-    },
     // 删除行操作
     deleteRow(index, rows) {
       //   console.log(index, rows);
@@ -317,6 +384,13 @@ export default {
         this.$message.warning("请选择出库仓库!");
         return;
       }
+
+      let index = this.ruleForm.product_go.findIndex((v) => v.edit);
+      if (index !== -1) {
+        this.$message.warning("当前已有商品正在编辑!");
+        return;
+      }
+
       this.showGoodsModel = true;
     },
 
@@ -328,13 +402,9 @@ export default {
         this.rulesThis = this.rules;
         await this.resetForm();
       } else {
-        if (this.isDetail) {
-          this.rulesThis = {};
-        } else {
-          this.rulesThis = this.rules;
-        }
+        this.rulesThis = this.rules;
         await this.resetForm();
-        // await this.initData()
+        await this.initData();
       }
       this.loading = false;
     },
@@ -342,8 +412,24 @@ export default {
     async initData() {
       const res = await asyncRequest.detail({ id: this.id });
       if (res && res.code === 0 && res.data) {
-        this.ruleForm = res.data;
-        this.ruleForm.role_id = this.ruleForm.role;
+        const { item, wsm_in, wsm_out, wsm_in_name, wsm_out_name } = res.data;
+        this.supplier_code = wsm_out;
+        this.stock_in_code = wsm_in;
+        this.supplier_name = wsm_out_name;
+        this.supplier_in_name = wsm_in_name;
+        this.ruleForm = {
+          supplier_code: [], //出库供应商code
+          stock_code: [wsm_out], //出库仓库code
+          supplier_in_code: [], //入库供应商code
+          stock_in_code: [wsm_in], //入库仓库code
+          product_go: item, //出库商品
+        };
+        this.ruleForm.product_go.map((v) => {
+          v.usable_stock = v.usable_num;
+          v.type_code = v.good_type_code;
+          v.edit=f
+          return v;
+        });
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -374,10 +460,43 @@ export default {
             this.$message.warning("出入库仓库不能相同!");
             return;
           }
+          let index = -1,
+            isok = true,
+            ishas = true,
+            good = [];
+          this.ruleForm.product_go.forEach((v, i) => {
+            let goodModel = {
+              good_code: v.type_code,
+              allot_num: v.allot_num,
+            };
+
+            if (v.edit && index === -1) {
+              index = i;
+            }
+            let stock = parseInt(v.usable_stock),
+              num = parseInt(v.allot_num);
+            if (stock === 0) {
+              ishas = false;
+            }
+            if (num > stock) {
+              isok = false;
+            }
+            good.push(goodModel);
+          });
+          if (index !== -1) {
+            this.$message.warning("当前已有商品正在编辑!");
+            return;
+          }
+          if (!ishas) {
+            this.$message.warning("部分商品已无可用库存数,无法进行调拨操作!");
+            return;
+          }
+          if (!isok) {
+            this.$message.warning("部分商品调拨数量已大于可用库存数!");
+            return;
+          }
+
           this.loading = true;
-          //   const { username, name, mobile, email, role_id, status } = JSON.parse(
-          //     JSON.stringify(this.ruleForm)
-          //   );
 
           const { stock_code, stock_in_code } = JSON.parse(
             JSON.stringify(this.ruleForm)
@@ -388,14 +507,8 @@ export default {
             id: this.id,
             wsm_out: stock_code.toString(), //出库仓库
             wsm_in: stock_in_code.toString(), //入库仓库
-            good: [
-              {
-                good_code: "GD-GY199803100001",
-                allot_num: 100,
-              },
-            ],
+            good: good,
           };
-          // console.log(model);
           let res = {};
           if (this.id === "add") {
             delete model["id"];
@@ -404,15 +517,19 @@ export default {
             res = await asyncRequest.update(model);
           }
           this.loading = false;
+          console.log("----------------!!!!!!!!!!!!!!!!!!!!----------------");
           if (res && res.code === 0) {
             const title = this.id === "add" ? "添加成功" : "修改成功";
             this.$notify.success({
               title,
               message: "",
             });
-            this.showModelThis = false;
-            // 刷新
-            this.$emit("refresh");
+
+            if (this.id === "add") {
+              this.showModelThis = false;
+              // 刷新
+              this.$emit("refresh");
+            }
           } else if (res && res.code >= 100 && res.code <= 104) {
             await this.logout();
           } else {
@@ -446,7 +563,7 @@ export default {
     editRow(rowIndex) {
       let index = this.ruleForm.product_go.findIndex((v) => v.edit);
       if (index !== -1) {
-        this.$message.warning("请保存其他行!");
+        this.$message.warning("请完成其他行的编辑!");
         return;
       } else {
         this.ruleForm.product_go[rowIndex].edit = true;
@@ -459,7 +576,7 @@ export default {
         addList = JSON.parse(JSON.stringify(e)),
         newList = [].concat(...oldList);
       addList.forEach((v1, index) => {
-        let oldindex = oldList.findIndex((v2) => v1.good_code === v2.good_code);
+        let oldindex = oldList.findIndex((v2) => v1.type_code === v2.type_code);
         if (oldindex === -1) {
           addList[index].allot_num = addList[index].usable_stock;
           addList[index].edit = false;
@@ -529,7 +646,8 @@ export default {
 
 
 <style lang="scss" scoped>
-.allot {
+.allot,
+.allotDetail {
   .label-title-model {
     line-height: 30px;
     width: 100%;
@@ -542,6 +660,23 @@ export default {
   .product_go {
     .el-form-item--mini.el-form-item {
       margin: 0 !important;
+      .spscope {
+        word-break: break-all !important;
+        line-height: 23px !important;
+        padding: 0 !important;
+        margin: 0 !important;
+        list-style: none !important;
+        font-style: normal !important;
+        text-decoration: none !important;
+        border: none !important;
+        display: inline-block !important;
+        font-weight: 500 !important;
+        font-family: "Microsoft Yahei", sans-serif !important;
+        -webkit-tap-highlight-color: transparent !important;
+        -webkit-font-smoothing: antialiased !important;
+        color: #606266 !important;
+        font-size: 12px !important;
+      }
     }
   }
 }

+ 0 - 46
src/views/stock/allot/components/newApply.vue

@@ -1,46 +0,0 @@
-<template>
-  <div class="newApply pagePadding">
-    <div
-      v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
-    >
-      详情
-      <add-form :id="id" @closeModel="closeModel" />
-    </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
-  </div>
-</template>
-   <script>
-import mixinPage from "@/mixins/elPaginationHandle";
-import resToken from "@/mixins/resToken";
-import AddForm from "./addForm"; //新建表单
-
-import { mapGetters } from "vuex";
-
-export default {
-  name: "allotFlow",
-  mixins: [mixinPage, resToken],
-  components: {
-    AddForm,
-  },
-  computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
-    powers() {
-      let tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "allotFlow"
-        ) || {};
-      if (tran && tran.action && tran.action.length > 0) {
-        return tran.action;
-      } else {
-        return [];
-      }
-    },
-  },
-  data() {
-    return {};
-  },
-};
-</script>
-   

+ 33 - 18
src/views/stock/allot/addDetail.vue → src/views/stock/allot/detail.vue

@@ -1,16 +1,31 @@
 <template>
-  <div class="newApply pagePadding">
+  <div class="allotDetail pagePadding">
     <div
+      style="width: 100%"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
+      <add-form
+        v-if="$route.query.id"
+        :id="$route.query.id"
+        @closeModel="closeModel"
+      />
       <!-- 详情 -->
-      <NewApply :myType="type"></NewApply>
-      <!-- 发货 -->
-      <GoStock :myType="type"></GoStock>
-      <!-- 入库验货详情 -->
-      <InStockCheck :myType="type"></InStockCheck>
-      <!-- 入库验货审核 -->
-      <CheckStock :myType="type"></CheckStock>
+
+      <!-- <GoStock
+        style="width: 100%"
+        v-if="$route.query.id"
+        :myType="type"
+      ></GoStock>
+      <InStockCheck
+        style="width: 100%"
+        v-if="$route.query.id"
+        :myType="type"
+      ></InStockCheck>
+      <CheckStock
+        style="width: 100%"
+        v-if="$route.query.id"
+        :myType="type"
+      ></CheckStock> -->
       <add-edit
         :id="modelId"
         :sitem="sitem"
@@ -29,26 +44,26 @@
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
-import NewApply from "./components/newApply.vue"; //新建申请页面
-import GoStock from "./components/goStock-audit.vue"; //出库方发货
-import InStockCheck from "./components/inStock-check.vue"; //入库方验货
-import CheckStock from "./components/checkStock.vue"; //验货审核
+import addForm from "./components/addForm"; //新建申请页面
+// import GoStock from "./components/goStock-audit.vue"; //出库方发货
+// import InStockCheck from "./components/inStock-check.vue"; //入库方验货
+// import CheckStock from "./components/checkStock.vue"; //验货审核
 
 export default {
-  name: "allotFlow",
+  name: "allotDetail",
   mixins: [mixinPage, resToken],
   components: {
-    NewApply,
-    GoStock,
-    InStockCheck,
-    CheckStock,
+    addForm,
+    // GoStock,
+    // InStockCheck,
+    // CheckStock,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
       let tran =
         this.$store.getters.btnList.find(
-          (item) => item.menu_route == "allotFlow"
+          (item) => item.menu_route == "allotDetail"
         ) || {};
       if (tran && tran.action && tran.action.length > 0) {
         return tran.action;

+ 8 - 6
src/views/stock/allot/index.vue

@@ -133,7 +133,7 @@
           >
             <i
               class="el-icon-view tb-icon"
-              @click="routeGoto('allotFlow',{id:scope.row.id})"
+              @click="routeGoto('allotDetail', { id: scope.row.id })"
             ></i>
           </el-tooltip>
         </template>
@@ -156,7 +156,7 @@ import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
 import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/stock/allot";
-import columns from "./utils/columns"; //表格列参数
+import columns from "./columns"; //表格列参数
 import addEdit from "./addEdit";
 import { mapGetters } from "vuex";
 export default {
@@ -183,8 +183,12 @@ export default {
     return {
       // 状态
       statusOptions: [
-        { id: "0", label: "禁用" },
-        { id: "1", label: "启用" },
+        { id: "0", label: "待发起流程" },
+        { id: "1", label: "待入库方同意入库" },
+        { id: "2", label: "待出库方发货" },
+        { id: "3", label: "待入库方验货提交" },
+        { id: "4", label: "待验货审核" },
+        { id: "5", label: "调拨已完成" },
       ],
       statusList: statusList,
       loading: true,
@@ -292,8 +296,6 @@ export default {
       }
       this.loading = false;
     },
-
-   
   },
 };
 </script>

+ 0 - 64
src/views/stock/allot/utils/columns.js

@@ -1,64 +0,0 @@
-    
-      export default [
-  // 表格 - 列参数
-       
-        {
-          prop: "allot_code",
-          label: "调拨编号",
-          width:"180"
-        },
-        
-        {
-          prop: "wsm_in",
-          label: "入库仓库名称",
-          width:"180"
-
-        },
-        {
-          prop: "wsm_out",
-          label: "出库仓库名称",
-          width:"180"
-
-        },
-        {
-          prop: "apply_name",
-          label: "申请人",
-          width:"80"
-        },
-        {
-          prop:"post_name",
-          label:"物流名称",
-        },
-        {
-          prop:"post_code",
-          label:"物流单号",
-        },
-        {
-          prop: "post_fee",
-          label: "物流总费用",
-        },
-        {
-          prop: "status",
-          label: "当前状态",
-          // sortable: true,
-          width:"50"
-        },
-        {
-          prop: "addtime",
-          label: "申请时间",
-        },
-        {
-          prop:"remark",
-          label:"备注",
-        },
-        {
-          prop: "",
-          label: "操作",
-          _noset_: true,
-          fixed:"right",
-          _slot_: "operation",
-          width:"50"
-        },
-      
-]
-    

+ 8 - 2
src/views/stock/check/addModel.vue

@@ -15,7 +15,7 @@
     append-to-body
   >
     <el-card style="margin-top: -20px">
-      <add-edit v-if="showModelThis" :id="id" />
+      <add-edit v-if="showModelThis" :id="id" @closeModel="closeModel" @refresh="refresh"/>
     </el-card>
   </el-dialog>
 </template>
@@ -45,8 +45,14 @@ export default {
     },
   },
   methods: {
-    closeModel() {
+     closeModel() {
       console.log("closeModel!!");
+      this.showModelThis = false;
+    },
+    refresh(e) {
+      console.log(e);
+      this.showModelThis = e;
+      this.$emit("refresh", true);
     },
   },
 };

+ 64 - 3
src/views/stock/check/components/addEdit.vue

@@ -80,10 +80,18 @@
           </el-button>
           <el-button
             type="primary"
+            plain
             @click="statusConfirm('1', '发起审核流程')"
             v-if="status === '0' && powers.some((item) => item == '012')"
             >发起审核流程
           </el-button>
+
+          <el-button
+            type="primary"
+            @click="statusConfirm('-2', '导出盘点商品')"
+            v-if="status === '1' && powers.some((item) => item == '014')"
+            >导出盘点商品
+          </el-button>
           <el-button
             @click="statusConfirm('0', '取消审核流程')"
             plain
@@ -113,6 +121,8 @@
    <script>
 import asyncRequest from "@/apis/service/stock/check/detail";
 import resToken from "@/mixins/resToken";
+import { getToken } from "@/utils/auth";
+import urlConfig from "@/apis/url-config";
 import columns from "./columns";
 export default {
   name: "addEdit",
@@ -133,10 +143,11 @@ export default {
   },
   data() {
     return {
-      status: "0",
+      status: "",
       companyCode: "",
       companyName: "",
       loading: false,
+      fileUrl: urlConfig.baseURL,
       showGoodsModel: false,
       typeList: [
         {
@@ -207,6 +218,8 @@ export default {
         .then(async () => {
           if (status === "-1") {
             await this.deleteById(message);
+          } else if (status === "-2") {
+            await this.exportGood(message);
           } else {
             await this.setStatus(status, message);
           }
@@ -215,6 +228,54 @@ export default {
           console.log("取消");
         });
     },
+
+    async exportGood(message) {
+      if (!this.loading) {
+        // console.log(urlConfig);
+        this.loading = true;
+        axios({ 
+          method: "post",
+          url: this.fileUrl + "admin/checkexport",
+          responseType: "blob",
+          data: { id: this.id, token: getToken() },
+          headers: {
+            Accept:`aplication/zip`,
+          },
+        })
+          .then((res) => {
+            if (res && res.status == 200 && res.data) {
+              let blob = new Blob([res.data], {
+                type: `aplication/zip`,
+              });
+              let url = window.URL.createObjectURL(blob);
+              let aLink = document.createElement("a");
+              aLink.style.display = "none";
+              aLink.href = url;
+              aLink.setAttribute(
+                "download",
+                `${message}.zip`
+              );
+              document.body.appendChild(aLink);
+              aLink.click();
+              document.body.removeChild(aLink); //下载完成移除元素
+              window.URL.revokeObjectURL(url); //释放掉blob对象
+
+              this.$message.success(message + `信息导出成功!`);
+              setTimeout(() => {
+                this.loading = false;
+              }, 500);
+            } else {
+              this.$message.error(res.data.message);
+              setTimeout(() => {
+                this.loading = false;
+              }, 500);
+            }
+          })
+          .catch((error) => {
+            this.loading = false;
+          });
+      }
+    },
     async deleteById(message) {
       const res = await asyncRequest.delete({ id: this.id });
       if (res && res.code === 0) {
@@ -276,7 +337,7 @@ export default {
     async initForm() {
       this.loading = true;
       if (this.id === "add") {
-        this.status = "0";
+        this.status = "";
         this.rulesThis = this.rules;
         await this.resetForm();
       } else {
@@ -289,7 +350,7 @@ export default {
     async initData() {
       const res = await asyncRequest.detail({ id: this.id });
       if (res && res.code === 0 && res.data) {
-        const { status, type, wsm_code,code,name } = res.data;
+        const { status, type, wsm_code, code, name } = res.data;
         this.status = status;
         this.companyCode = code;
         this.companyName = name;

+ 263 - 0
src/views/stock/check/components/resultUplod.vue

@@ -0,0 +1,263 @@
+<template>
+  <div>
+    <ex-table
+      v-loading="false"
+      :table="table"
+      :data="tableData"
+      :columns="columns"
+      :page="pageInfo"
+      :size="size"
+      @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange"
+      @screen-reset="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+      @screen-submit="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+    >
+      <template #table-header="{}">
+        <div style="width: 100%">
+          <el-row style="padding: 0 0 0 80px">
+            <el-col :span="24">
+              <el-col :span="3" style="width: 66px; float: right">
+                <el-button
+                  @click="importshowModel = true"
+                  :size="searchSize"
+                  type="success"
+                  style="float: right; margin-left: 5px"
+                >
+                  添加
+                </el-button>
+              </el-col>
+            </el-col>
+          </el-row>
+        </div>
+      </template>
+      <template #status="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          :type="scope.row.status == '0' ? 'warning' : ''"
+          v-text="
+            (statusOptions.find((item) => item.id == scope.row.status) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+      <template #type="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          :type="scope.row.type == '1' ? 'success' : ''"
+          v-text="
+            (typeOptions.find((item) => item.id == scope.row.type) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+      <template #operation="{ scope }">
+        <el-tooltip
+          v-if="powers.some((item) => item == '007')"
+          effect="dark"
+          content="详情"
+          placement="top"
+        >
+          <i
+            class="el-icon-view tb-icon"
+            @click="routeGoto('checkDetail', { id: scope.row.id })"
+          ></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
+    <result-uplod-model
+      :show-model="importshowModel"
+      :id="id"
+      @refresh="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+      @cancel="importshowModel = false"
+    />
+  </div>
+</template>
+   <script>
+import asyncRequest from "@/apis/service/stock/check/detail";
+import resToken from "@/mixins/resToken";
+import resultUplodModel from "./resultUplodModel";
+import { mapGetters } from "vuex";
+export default {
+  name: "addEdit",
+  props: ["id"],
+  mixins: [resToken],
+  components: {
+    resultUplodModel,
+  },
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "checkDetail"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+
+  watch: {
+    id: function (val) {
+      if (val) {
+        this.initForm();
+      }
+    },
+  },
+  data() {
+    return {
+      importshowModel: false,
+      sitem: null,
+      // 节点状态
+      statusOptions: [
+        { id: "0", label: "待发起流程" },
+        { id: "1", label: "待上传盘点结果" },
+        { id: "2", label: "待审核盘点结果" },
+        { id: "3", label: "待系统更新" },
+        { id: "4", label: "盘点已结束" },
+      ],
+      // 盘点类型
+      typeOptions: [
+        { id: "1", label: "全盘" },
+        { id: "2", label: "抽盘" },
+      ],
+      loading: true,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        check_code: "", // 盘点仓库
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "check_code",
+          label: "盘点编号",
+          width: "155px",
+        },
+
+        {
+          prop: "wsm_code",
+          label: "仓库编码",
+          width: "170px",
+        },
+        {
+          prop: "name",
+          label: "仓库名称",
+        },
+
+        {
+          prop: "code",
+          label: "公司编码",
+          width: "140px",
+        },
+        {
+          prop: "caname",
+          label: "公司名称",
+        },
+        {
+          prop: "status",
+          label: "盘点状态",
+          _slot_: "status",
+          width: "120px",
+        },
+
+        {
+          prop: "type",
+          label: "盘点类型",
+          _slot_: "type",
+          width: "70px",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          width: "140px",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          width: "50px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+
+  methods: {
+    restSearch() {
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.parmValue = {
+        id: "", // 	盘点编号
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      this.searchList();
+    },
+    async searchList() {
+      this.loading = true;
+      this.parmValue.id = this.id;
+      const res = await asyncRequest.checkgood(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.check {
+}
+</style>
+   

+ 283 - 0
src/views/stock/check/components/resultUplodModel.vue

@@ -0,0 +1,283 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    title="导入数据"
+    :center="true"
+    align="left"
+    top="5vh"
+    width="1040px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="closeModel"
+  >
+    <el-card style="margin: -20px">
+      <el-row :gutter="10" style="height: 550px">
+        <el-col :span="24">
+          <upload-excel
+            :on-success="handleSuccess"
+            :before-upload="beforeUpload"
+          />
+          <el-table
+            :data="tableData"
+            size="mini"
+            border
+            max-height="400px"
+            highlight-current-row
+            style="width: 100%; margin-top: 20px"
+          >
+            <el-table-column
+              show-overflow-tooltip
+              v-for="(item, index) in columns"
+              :key="item.prop + index"
+              :prop="item.prop"
+              :label="item.label"
+              min-width="96px"
+            />
+          </el-table>
+        </el-col>
+        <el-col :span="24" style="text-align: right; margin: 15px 0 0 0">
+          <el-button v-if="!isDetail" type="primary" @click="submitForm"
+            >保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{
+            isDetail ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import urlConfig from "@/apis/url-config";
+import { getToken } from "@/utils/auth";
+import resToken from "@/mixins/resToken";
+import asyncRequest from "@/apis/service/stock/check/detail";
+export default {
+  name: "resultUplodModel",
+  props: ["showModel",'id'],
+  mixins: [resToken],
+  data() {
+    return {
+      imgAPI: urlConfig.baseURL,
+      loading: false,
+      length: 0,
+      showModelThis: this.showModel,
+      isfile: false,
+      head: [
+        "商品编码",
+        "商品属性编码",
+        "商品名称",
+        "商品描述",
+        "品牌",
+        "单位",
+        "供应商编码",
+        "供应商名称",
+        "一级分类",
+        "二级分类",
+        "三级分类",
+        "新建时间",
+        "仓库编码",
+        "仓库名称",
+        "可用库存",
+        "盘点库存",
+      ],
+      tableData: [],
+      ruleForm: {
+        execl: "",
+      },
+      rules: {
+        execl: [
+          {
+            required: true,
+            message: "请选择文件",
+            trigger: "change",
+          },
+        ],
+      },
+      columns: [],
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    async initForm() {
+      this.loading = true;
+      console.log(this.id);
+      this.isfile = false;
+      this.tableData = [];
+      this.columns = [];
+      this.head.forEach((v, i) => {
+        let model = {
+          prop: "value" + i,
+          label: v,
+        };
+        this.columns.push(model);
+      });
+      this.loading = false;
+    },
+
+    beforeUpload(file) {
+      const isLt1M = file.size / 1024 / 1024 < 1;
+      if (isLt1M) {
+        return true;
+      }
+      this.$message({
+        message: "请不要上传大于1MB的文件.",
+        type: "warning",
+      });
+      return false;
+    },
+    handleSuccess({ results, header }) {
+      this.length = 0;
+      if (this.head.length !== header.length) {
+        this.$message.error("表头与导入模板不匹配!");
+        return;
+      }
+      let isok = true;
+      this.head.forEach((v, i) => {
+        if (v !== header[i]) {
+          isok = false;
+        }
+      });
+      if (!isok) {
+        this.$message.error("表头与导入模板不匹配!");
+        return;
+      }
+      this.length = header.length;
+      this.tableHeader = header;
+      let list = results;
+      this.tableData = [];
+
+      list.forEach((v1) => {
+        let b = Object.values(v1);
+        let model = {};
+        for (let i = 0; i < b.length; i++) {
+          model["value" + i] = b[i];
+        }
+        this.tableData.push(model);
+      });
+    },
+    async submitForm() {
+ 
+          if (!this.loading) {
+            this.loading = true;
+            let model = {
+              id: this.id,
+              data: this.tableData,
+            };
+            const res = await asyncRequest.checkimport(model);
+            if (res && res.code === 0) {
+              this.$notify.success({
+                title: "盘点数据提交成功!",
+                message: "",
+              });
+            } else if (res && res.code >= 100 && res.code <= 104) {
+              await this.logout();
+            } else {
+              this.$message.warning(res.message);
+            }
+          }
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.checkDetail {
+  .excelUploadBox {
+    position: relative;
+    width: 100%;
+    height: 120px;
+    line-height: 120px;
+    box-sizing: border-box;
+    &:hover {
+      cursor: pointer;
+    }
+    .el-icon-receiving {
+      width: 100%;
+      text-align: center;
+      height: 50px;
+      display: block;
+      font-size: 32px;
+      line-height: 90px;
+      color: #d3d4d6;
+    }
+    .boxM {
+      width: 100%;
+      display: block;
+      text-align: center;
+      line-height: 65px;
+      height: 60px;
+      color: #909399;
+    }
+  }
+  .excelUpload {
+    top: 0;
+    left: 0;
+    position: absolute;
+    z-index: 2;
+    width: 100%;
+    height: 120px;
+    line-height: 120px;
+    box-sizing: border-box;
+    // opacity: 0!important;
+    //     .excel-upload-input {
+    //   top: 0 !important;
+    //   left: 0 !important;
+
+    //   position: absolute !important;
+    //   z-index: 2 !important;
+    //   width: 100% !important;
+    //   height: 120px !important;
+    //   line-height: 120px !important;
+    //   box-sizing: border-box !important;
+    // }
+  }
+
+  .excelUploadRes {
+    width: 100%;
+    height: 120px;
+    line-height: 120px;
+    box-sizing: border-box;
+    i {
+      width: 55px;
+      height: 120px;
+      line-height: 120px;
+      text-align: center;
+      font-size: 20px;
+      &.fl {
+        padding-left: 16px;
+      }
+      &.fr {
+        padding-right: 16px;
+        &:hover {
+          cursor: pointer;
+        }
+      }
+    }
+    span {
+      width: 386px;
+      line-height: 16px;
+      margin: 52px 0 0 0;
+      font-size: 16px;
+    }
+  }
+}
+</style>

+ 21 - 9
src/views/stock/check/detail.vue

@@ -1,19 +1,28 @@
 <template>
   <div class="checkDetail pagePadding">
     <div
+      style="width: 100%"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <add-edit :id="$route.query.id" />
-
+      <add-edit
+        style="width: 100%"
+        v-if="$route.query.id"
+        :id="$route.query.id"
+      />
+      <result-uplod
+        style="width: 100%"
+        v-if="$route.query.id"
+        :id="$route.query.id"
+      />
       <exam-form
+        v-if="$route.query.id"
+        style="width: 100%"
         :statusList="statusList"
         :disabled="false"
         :isMust="true"
         @searchChange="examForm"
       />
-      <button @click="addGood">
-        添加商品
-      </button>
+      <button @click="addGood">添加商品</button>
       <search-stock-good-modal :code="code" :showModel="showModel1" />
     </div>
     <div v-else>
@@ -27,6 +36,7 @@ import resToken from "@/mixins/resToken";
 // import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/stock/check/detail";
 import addEdit from "./components/addEdit";
+import resultUplod from "./components/resultUplod";
 import { mapGetters } from "vuex";
 
 export default {
@@ -34,6 +44,7 @@ export default {
   mixins: [mixinPage, resToken],
   components: {
     addEdit,
+    resultUplod,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -51,8 +62,8 @@ export default {
   },
   data() {
     return {
-      code:"WSM9f0r211019102112",
-      showModel1:false,
+      code: "WSM9f0r211019102112",
+      showModel1: false,
       sitem: null,
       // 状态
       statusOptions: [
@@ -152,8 +163,8 @@ export default {
     examForm(e) {
       console.log(e);
     },
-    addGood(){
-      this.showModel1=true
+    addGood() {
+      this.showModel1 = true;
       // console.log();
     },
     restSearch() {
@@ -259,6 +270,7 @@ export default {
 </script>
    <style lang="scss" scoped>
 .checkDetail {
+  width: 100%;
 }
 </style>