From 507ef76311a254c670c07933819f9a9ad35676e9 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 01 Jun 2022 17:19:04 +0800
Subject: [PATCH] 农事操作页面修改,溯源码绑定修改,补打印页面新增
---
src/views/traceability/recovery.vue | 293 ++++++++++++++++++++++++++++++++++++
src/views/wel/farming.vue | 20 ++
src/views/farmplant/farmproductstock.vue | 17 ++
src/views/traceability/addTraceability.vue | 4
src/views/traceability/print.vue | 64 ++++++++
src/views/farm/farmingrecord.vue | 15 -
src/views/traceability/traceability.vue | 47 +++++
7 files changed, 441 insertions(+), 19 deletions(-)
diff --git a/src/views/farm/farmingrecord.vue b/src/views/farm/farmingrecord.vue
index 416a1c3..be9d152 100644
--- a/src/views/farm/farmingrecord.vue
+++ b/src/views/farm/farmingrecord.vue
@@ -47,9 +47,6 @@
import { selectStockFa } from "@/api/stockfactory/stockfactory";
import { mapGetters } from "vuex";
export default {
- props:[
- "type","activeName"
- ],
data() {
return {
visible: true,
@@ -66,7 +63,7 @@
landList: [],
option: {
tip: false,
- height: "auto",
+ height: 520,
editBtn: true,
delBtn: true,
viewBtn: true,
@@ -255,16 +252,6 @@
stockIdcolumn.display = false;
}
},
- immediate: true,
- },
- activeName:{
- handler(val) {
- console.log(val,99999999);
- if(this.activeName =="tab2"){
- this.option.height = 520;
- }
- },
- deep: true,
immediate: true,
}
},
diff --git a/src/views/farmplant/farmproductstock.vue b/src/views/farmplant/farmproductstock.vue
index e93591d..84ee7c0 100644
--- a/src/views/farmplant/farmproductstock.vue
+++ b/src/views/farmplant/farmproductstock.vue
@@ -25,6 +25,14 @@
</div> -->
<div class="cai">{{item.strainName}}</div>
<div class="area">库存量:<span>{{item.weight}}</span>公斤</div>
+ <div class="btn">
+ <el-button plain size="small"
+ ><span style="color: #5abf78">销售</span></el-button
+ >
+ <el-button plain size="small"
+ >库存损耗</el-button
+ >
+ </div>
</div>
</div>
</div>
@@ -158,7 +166,7 @@
.farm {
width: 168px;
- height: 237px;
+ height: 277px;
background-color: #f7f9fb;
border-radius: 5px;
margin-left: 30px;
@@ -195,6 +203,13 @@
color: #333333;
}
}
+
+ .btn {
+ text-align: center;
+ margin-top: 8px;
+ }
+
+
}
}
}
diff --git a/src/views/traceability/addTraceability.vue b/src/views/traceability/addTraceability.vue
index 797def5..d6a367a 100644
--- a/src/views/traceability/addTraceability.vue
+++ b/src/views/traceability/addTraceability.vue
@@ -479,7 +479,8 @@
return;
}
if (this.selectionList.length ==1) {
- that.formLabelAlign['code'] = this.selectionList[0].code;
+ that.formLabelAlign['recoveryId'] = this.selectionList[0].id;
+ that.formLabelAlign['bind'] = '0';
}
//新增
save(that.formLabelAlign).then(
@@ -610,7 +611,6 @@
},
selectionChange(list) {
this.selectionList = list;
- console.log(this.selectionList, 123456789);
},
selectionClear() {
this.selectionList = [];
diff --git a/src/views/traceability/print.vue b/src/views/traceability/print.vue
new file mode 100644
index 0000000..f5c6aa2
--- /dev/null
+++ b/src/views/traceability/print.vue
@@ -0,0 +1,64 @@
+<template>
+ <div>
+ <el-dialog
+ title="补打印"
+ :modal-append-to-body="false"
+ :append-to-body="true"
+ :close-on-click-modal="false"
+ @close="close"
+ width="40%"
+ :visible.sync="visible"
+ center
+ >
+ <div style="color:#FF9947;text-align: center;height:60px">为了保证每一个溯源码的唯一性,已经打印过的溯源码请勿重复打印。</div>
+ <div class="dialog-code">
+ <div class="sym">
+ {{code}}
+ </div>
+ </div>
+ <div style="text-align: center">
+ <el-button type="success" plain @click="exporter">导出链接</el-button>
+ <el-button type="success" plain @click="download">下载二维码</el-button>
+ <el-button type="success" @click="printer">打 印</el-button>
+ </div>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+export default {
+ data() {
+ return {
+ code: null,
+ visible: false,
+ };
+ },
+ computed: {
+ ...mapGetters(["permission", "userInfo"]),
+ },
+ mounted() {},
+ methods: {
+ //初始化
+ init(row) {
+ this.code = row.code;
+ this.visible = true;
+ },
+ },
+};
+</script>
+
+<style>
+.dialog-code{
+ height: 100px;
+ margin-left:30px;
+}
+.sym{
+ width: 150px;
+ height: 60px;
+ line-height: 60px;
+ border: 1px solid #f1f1f1;
+ text-align: center;
+ border-radius: 6px;
+}
+</style>
diff --git a/src/views/traceability/recovery.vue b/src/views/traceability/recovery.vue
new file mode 100644
index 0000000..d4c2b84
--- /dev/null
+++ b/src/views/traceability/recovery.vue
@@ -0,0 +1,293 @@
+<template>
+ <div>
+ <el-dialog
+ title="溯源码绑定"
+ :modal-append-to-body="false"
+ :append-to-body="true"
+ :close-on-click-modal="false"
+ @close="close"
+ width="60%"
+ :visible.sync="visible"
+ center
+ >
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ v-model="form"
+ ref="crud"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ ></avue-crud>
+ <div style="text-align: center">
+ <el-button type="primary" @click="submit">提 交</el-button>
+ </div>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import { getList } from "@/api/farmplant/recovery";
+import { update } from "@/api/traceability/traceability";
+import { getLandList } from "@/api/land/land";
+import { getStrainList } from "@/api/farmplant/strain";
+import { mapGetters } from "vuex";
+export default {
+ data() {
+ return {
+ id: null,
+ visible: false,
+ form: {},
+ query: {},
+ loading: true,
+ selectionList: [],
+ landList: [],
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ option: {
+ tip: false,
+ height: 400,
+ editBtn: false,
+ delBtn: false,
+ viewBtn: false,
+ addBtn: false,
+ menu: false,
+ menuAlign: "center",
+ align: "center",
+ selection: true,
+ searchShow: true,
+ searchMenuSpan: 6,
+ column: [
+ {
+ label: "采收品种",
+ prop: "strainId",
+ search: true,
+ searchSpan: 4,
+ span: 12,
+ type: "tree",
+ dicData: [],
+ props: {
+ label: "strainName",
+ value: "id",
+ },
+ labelWidth: 145,
+ rules: [
+ {
+ required: true,
+ message: "请输入采收品种",
+ trigger: "blur",
+ },
+ ],
+ disabled: true,
+ },
+ {
+ label: "采收地块",
+ span: 12,
+ labelWidth: 145,
+ prop: "landId",
+ type: "tree",
+ search: true,
+ searchSpan: 4,
+ hide: true,
+ dicData: [],
+ props: {
+ label: "landName",
+ value: "id",
+ },
+ rules: [
+ {
+ required: true,
+ message: "请选择地块",
+ trigger: "click",
+ },
+ ],
+ },
+ {
+ label: "地块",
+ prop: "landName",
+ display: false,
+ },
+ {
+ label: "采收重量/公斤",
+ prop: "weight",
+ tip: "公斤",
+ span: 12,
+ labelWidth: 145,
+ controls: false,
+ type: "number",
+ rules: [
+ {
+ required: true,
+ message: "请输入采收重量 公斤",
+ trigger: "click",
+ },
+ ],
+ },
+ {
+ label: "采收时间",
+ prop: "time",
+ span: 12,
+ labelWidth: 145,
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm",
+ valueFormat: "yyyy-MM-dd HH:mm",
+ rules: [
+ {
+ required: true,
+ message: "请选择采收时间",
+ trigger: "click",
+ },
+ ],
+ },
+ {
+ label: "操作人",
+ prop: "operator",
+ type: "tree",
+ dicData: [],
+ props: {
+ label: "realName",
+ value: "id",
+ },
+ span: 12,
+ labelWidth: 145,
+ rules: [
+ {
+ required: true,
+ message: "请输入操作人",
+ trigger: "click",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ created() {
+ this.initData();
+ },
+ computed: {
+ ...mapGetters(["permission", "userInfo"]),
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ },
+ },
+ mounted() {},
+ methods: {
+ //初始化
+ init(id) {
+ this.id = id;
+ this.visible = true;
+ },
+ //初始化数据
+ initData() {
+ var that = this;
+ //获取农地数据
+ getLandList(this.userInfo.user_id).then((res) => {
+ if (res.data.code == 200) {
+ var landIdcolumn = that.findObject(that.option.column, "landId");
+ that.landList = res.data.data;
+ landIdcolumn.dicData = res.data.data;
+ }
+ });
+ //获取农产品数据
+ getStrainList(0).then((res) => {
+ if (res.data.code == 200) {
+ var strainId = that.findObject(that.option.column, "strainId");
+ strainId.dicData = res.data.data;
+ }
+ });
+ },
+ //绑定溯源码
+ submit() {
+ var that = this;
+ var data = {
+ id: this.id
+ };
+ if (this.selectionList.length > 0 && this.selectionList.length > 1) {
+ this.$message.warning("只能绑定一个溯源");
+ return;
+ }
+ if (this.selectionList.length == 0) {
+ this.$message.warning("请选择需要绑定的一个溯源");
+ return;
+ }
+ if (this.selectionList.length == 1) {
+ data['recoveryId'] = this.selectionList[0].id;
+ data['bind'] = '0';
+ }
+ //新增
+ update(data).then(
+ () => {
+ that.$emit("refreshOnLoad");
+ that.visible = false;
+ that.close();
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ },
+ (error) => {
+ window.console.log(error);
+ }
+ );
+ },
+ 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>
diff --git a/src/views/traceability/traceability.vue b/src/views/traceability/traceability.vue
index dbdd262..d29e338 100644
--- a/src/views/traceability/traceability.vue
+++ b/src/views/traceability/traceability.vue
@@ -37,9 +37,31 @@
>删 除
</el-button>
</template>
+ <template slot-scope="{ type, size, row }" slot="menu">
+ <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="onLoads"></addTraceability>
+ <!-- 绑定溯源码 -->
+ <recovery v-if="bindVisible" ref="recovery" @refreshOnLoad="onLoads"></recovery>
+ <!-- 补打印 -->
+ <print v-if="printVisible" ref="print"></print>
</basic-container>
</template>
@@ -47,13 +69,19 @@
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";
export default {
components: {
- addTraceability
+ addTraceability,
+ recovery,
+ print
},
data() {
return {
addTraceabilityVisible: false,
+ bindVisible: false,
+ printVisible: false,
form: {},
query: {},
loading: true,
@@ -68,7 +96,7 @@
option: {
tip: false,
height: "auto",
- menuWidth: 200,
+ menuWidth: 280,
menuAlign: "center",
align: "center",
selection: true,
@@ -76,6 +104,7 @@
searchMenuSpan: 6,
addBtn:false,
editBtn:false,
+ delBtn:false,
column: [
{
label: "产品名称",
@@ -192,6 +221,20 @@
//初始化数据
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);
+ });
+ },
//新增
rowSave(row, done, loading) {
row['farmType'] = 0;
diff --git a/src/views/wel/farming.vue b/src/views/wel/farming.vue
index 6ddd0fc..12cf9a1 100644
--- a/src/views/wel/farming.vue
+++ b/src/views/wel/farming.vue
@@ -56,6 +56,7 @@
label: "landName",
value: "id",
},
+ cascader: ["strainId"],
labelWidth: 110,
rules: [
{
@@ -66,6 +67,25 @@
],
},
{
+ label: "农产品",
+ prop: "strainId",
+ type: "tree",
+ dicData: [],
+ props: {
+ label: "strainName",
+ value: "id",
+ },
+ dicUrl: `/api/farmPlant/strain-tree?landId={{key}}`,
+ labelWidth: 110,
+ rules: [
+ {
+ required: true,
+ message: "请选择农产品",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
label: "农资",
prop: "stockId",
type: "tree",
--
Gitblit v1.9.3