智慧农业后台管理页面
guoshilong
2022-11-08 082613d446e29e4ec1c16bfaa52345106a498b23
src/views/traceability/traceability.vue
@@ -41,6 +41,22 @@
        <el-button
          :type="type"
          :size="size"
          icon="el-icon-view"
          :disabled="row.bind != 0"
          @click="handleViewCode(row)"
          >二维码
        </el-button>
        <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)"
@@ -62,6 +78,8 @@
    <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>
@@ -71,17 +89,20 @@
import addTraceability from "./addTraceability.vue";
import recovery from "./recovery.vue";
import print from "./print.vue";
import firstView from "./firstView.vue";
export default {
  components: {
    addTraceability,
    recovery,
    print
    print,
    firstView
  },
  data() {
    return {
      addTraceabilityVisible: false,
      bindVisible: false,
      printVisible: false,
      viewVisible: false,
      form: {},
      query: {},
      loading: true,
@@ -96,7 +117,7 @@
      option: {
        tip: false,
        height: "auto",
        menuWidth: 280,
        menuWidth: 320,
        menuAlign: "center",
        align: "center",
        selection: true,
@@ -105,6 +126,9 @@
        addBtn:false,
        editBtn:false,
        delBtn:false,
        refreshBtn:false,
        columnBtn:false,
        searchShowBtn:false,
        column: [
          {
            label: "产品名称",
@@ -191,8 +215,16 @@
  created() {
    this.initData();
  },
  watch: {
      '$farmId':{
      handler (newName, oldName) {
          this.query={}
          this.onLoad(this.page)
      }
    }
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    ...mapGetters(["permission", "userInfo","$farmId"]),
    // permissionList() {
    //   return {
    //     addBtn: this.vaildData(this.permission.social_add, true),
@@ -233,6 +265,20 @@
      this.printVisible = true;
      this.$nextTick(() => {
        this.$refs.print.init(row);
      });
    },
    //查看二维码
    handleViewCode(row){
      this.viewVisible = true;
      this.$nextTick(() => {
        this.$refs.views.init(row);
      });
    },
    //预览溯源码详情信息
    handleView(row){
      this.$router.push({
        path: `/traceability/details`,
        query: row
      });
    },
    //新增
@@ -346,9 +392,12 @@
      this.onLoad(this.page, this.query);
    },
    onLoads(){
      this.onLoad(this.page, this.query);
      // this.onLoad(this.page, this.query);
      this.onLoad(this.page);
    },
    onLoad(page, params = {}) {
      params['tenantId'] = this.userInfo.tenant_id;
      params.deptId = this.$farmId
      this.loading = true;
      getList(
        page.currentPage,
@@ -366,5 +415,5 @@
};
</script>
<style>
<style >
</style>