From 335f9ce8a5efb5be1c8d7c422d2beee6fd77cd97 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 08 Jul 2022 10:13:42 +0800
Subject: [PATCH] 多农场修改

---
 src/views/traceability/traceability.vue |   84 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 77 insertions(+), 7 deletions(-)

diff --git a/src/views/traceability/traceability.vue b/src/views/traceability/traceability.vue
index fd65aea..3933658 100644
--- a/src/views/traceability/traceability.vue
+++ b/src/views/traceability/traceability.vue
@@ -37,9 +37,41 @@
           >删 除
         </el-button>
       </template>
+      <template slot-scope="{ type, size, row }" slot="menu">
+        <el-button
+          :type="type"
+          :size="size"
+          icon="el-icon-view"
+          :disabled="row.bind != 0"
+          @click="handleView(row)"
+          >预览
+        </el-button>
+        <el-button
+          :type="type"
+          :size="size"
+          :disabled="row.bind != 1"
+          icon="el-icon-paperclip"
+          @click="handlebind(row)"
+          >绑定溯源码
+        </el-button>
+        <el-button
+          icon="el-icon-printer"
+          :size="size"
+          :type="type"
+          :disabled="row.bind != 0"
+          @click.stop="handlePrint(row)"
+          >补打印
+        </el-button>
+      </template>
     </avue-crud>
     <!-- 种养品 -->
-    <addTraceability v-if="addTraceabilityVisible" ref="addTraceability" @refreshOnLoad="onLoad"></addTraceability>
+    <addTraceability v-if="addTraceabilityVisible" ref="addTraceability" @refreshOnLoad="onLoads"></addTraceability>
+    <!-- 绑定溯源码 -->
+    <recovery v-if="bindVisible" ref="recovery"  @refreshOnLoad="onLoads"></recovery>
+    <!-- 补打印 -->
+    <print v-if="printVisible" ref="print"></print>
+    <!-- 预览 -->
+    <firstView v-if="viewVisible" ref="views"></firstView>
   </basic-container>
 </template>
 
@@ -47,13 +79,22 @@
 import { getDetail, getList, update, remove, save } from "@/api/traceability/traceability";
 import { mapGetters } from "vuex";
 import addTraceability from "./addTraceability.vue";
+import recovery from "./recovery.vue";
+import print from "./print.vue";
+import firstView from "./firstView.vue";
 export default {
   components: {
-    addTraceability
+    addTraceability,
+    recovery,
+    print,
+    firstView
   },
   data() {
     return {
       addTraceabilityVisible: false,
+      bindVisible: false,
+      printVisible: false,
+      viewVisible: false,
       form: {},
       query: {},
       loading: true,
@@ -68,24 +109,25 @@
       option: {
         tip: false,
         height: "auto",
-        menuWidth: 200,
+        menuWidth: 280,
         menuAlign: "center",
         align: "center",
         selection: true,
         searchShow: true,
         searchMenuSpan: 6,
         addBtn:false,
+        editBtn:false,
+        delBtn:false,
         column: [
           {
-            label: "溯源码图片",
-            prop: "url",
+            label: "产品名称",
+            prop: "productName",
             span: 12,
             labelWidth: 145,
-            
             rules: [
               {
                 required: true,
-                message: "请输入溯源码图片",
+                message: "请输入产品名称",
                 trigger: "blur",
               },
             ],
@@ -191,6 +233,29 @@
     },
     //初始化数据
     initData(){
+    },
+    //绑定
+    handlebind(row){
+      this.bindVisible = true;
+      this.$nextTick(() => {
+        this.$refs.recovery.init(row.id);
+      });
+    },
+    //打印
+    handlePrint(row){
+      this.printVisible = true;
+      this.$nextTick(() => {
+        this.$refs.print.init(row);
+      });
+    },
+    //预览溯源码
+    handleView(row){
+      this.viewVisible = true;
+      this.$nextTick(() => {
+        console.log(this.$refs,123456);
+        console.log(this.$refs.views,789);
+        this.$refs.views.init(row);
+      });
     },
     //新增
     rowSave(row, done, loading) {
@@ -302,7 +367,12 @@
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
+    onLoads(){
+      this.onLoad(this.page, this.query);
+    },
     onLoad(page, params = {}) {
+      params['tenantId'] = this.userInfo.tenant_id;
+      params['deptId'] = this.userInfo.dept_id;
       this.loading = true;
       getList(
         page.currentPage,

--
Gitblit v1.9.3