From 4a5c5478b673b1aa56381b980604b41520301eba Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Thu, 04 Aug 2022 09:17:58 +0800
Subject: [PATCH] 农产品库存整合显示,加入地块选择
---
src/views/farmplant/farmproductstock.vue | 149 ++++++++++++++++++++++++++++++++++++
src/api/land/land.js | 10 ++
src/api/farmplant/farmproductstock.js | 24 ++++++
3 files changed, 181 insertions(+), 2 deletions(-)
diff --git a/src/api/farmplant/farmproductstock.js b/src/api/farmplant/farmproductstock.js
index 6073f90..a39e763 100644
--- a/src/api/farmplant/farmproductstock.js
+++ b/src/api/farmplant/farmproductstock.js
@@ -11,6 +11,19 @@
}
})
}
+
+export const getStrainCount = (current, size, params) => {
+ return request({
+ url: '/api/farmProductStock/strainCount',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
export const remove = (ids) => {
return request({
url: '/api/farmProductStock/remove',
@@ -45,4 +58,15 @@
id
}
})
+}
+
+export const getByLandId = (strainId,landId) => {
+ return request({
+ url: '/api/farmProductStock/getByLandId',
+ method: 'get',
+ params: {
+ strainId,
+ landId,
+ }
+ })
}
\ No newline at end of file
diff --git a/src/api/land/land.js b/src/api/land/land.js
index 25f0b57..f92a836 100644
--- a/src/api/land/land.js
+++ b/src/api/land/land.js
@@ -95,4 +95,14 @@
}
})
}
+
+ export const selectByStrainId = (strainId)=>{
+ return request({
+ url: '/api/land/land/selcetByStrainId',
+ method: 'get',
+ params: {
+ strainId
+ }
+ })
+ }
\ No newline at end of file
diff --git a/src/views/farmplant/farmproductstock.vue b/src/views/farmplant/farmproductstock.vue
index 0b83744..412e391 100644
--- a/src/views/farmplant/farmproductstock.vue
+++ b/src/views/farmplant/farmproductstock.vue
@@ -318,7 +318,13 @@
update,
remove,
save,
+ getStrainCount,
+ getByLandId
} from "@/api/farmplant/farmproductstock"
+
+import {
+ selectByStrainId
+} from "@/api/land/land"
import {
add, addKC
@@ -337,6 +343,7 @@
import { mapGetters } from "vuex"
import { regionData } from 'element-china-area-data'
+import { click } from 'ol/events/condition'
export default {
data () {
@@ -401,6 +408,7 @@
reason: "0",
saleTime: "",
},
+ JG:{landId:""},
visible: false,
visibleCK: false,
visibleKC: false,
@@ -429,6 +437,32 @@
trigger: "blur",
},
],
+ },
+ {
+ label:"地块",
+ prop:"id",
+ span:24,
+ type: "select",
+ props: {
+ label: "landName",
+ value: "id"
+ },
+ dicData:[],
+ rules: [{
+ required: true,
+ message: "请输入",
+ trigger: "blur"
+ }],
+ change: (val) => {
+ if(val.value != ""){
+ this.form.landId = val.value
+ getByLandId(this.form.strainId,this.form.landId).then((res)=>{
+ var data = res.data.data
+ this.form.weight = data.weight
+ this.form.proid = data.id
+ })
+ }
+ }
},
{
label: "销售时间",
@@ -515,6 +549,32 @@
],
},
{
+ label:"地块",
+ prop:"id",
+ span:24,
+ type: "select",
+ props: {
+ label: "landName",
+ value: "id"
+ },
+ dicData:[],
+ rules: [{
+ required: true,
+ message: "请输入",
+ trigger: "blur"
+ }],
+ change: (val) => {
+ if(val.value != ""){
+ this.formKC.landId = val.value
+ getByLandId(this.formKC.strainId,this.formKC.landId).then((res)=>{
+ var data = res.data.data
+ this.formKC.weight = data.weight
+ this.formKC.proid = data.id
+ })
+ }
+ }
+ },
+ {
label: "损耗时间",
prop: "lossTime",
type: "date",
@@ -598,6 +658,34 @@
trigger: "blur",
},
],
+ },
+ {
+ label:"地块",
+ prop:"id",
+ span:24,
+ type: "select",
+ props: {
+ label: "landName",
+ value: "id"
+ },
+ dicData:[],
+ rules: [{
+ required: true,
+ message: "请输入",
+ trigger: "blur"
+ }],
+ change: (val) => {
+ if(val.value != ""){
+ this.JG.landId = ""
+ this.formJG.landId = val.value
+ getByLandId(this.formJG.strainId,this.formJG.landId).then((res)=>{
+ var data = res.data.data
+ this.formJG.weight = data.weight
+ this.formJG.proid = data.id
+ this.JG.landId = this.formJG.landId
+ })
+ }
+ }
},
{
label: "加工时间",
@@ -697,6 +785,32 @@
],
},
{
+ label:"地块",
+ prop:"id",
+ span:24,
+ type: "select",
+ props: {
+ label: "landName",
+ value: "id"
+ },
+ dicData:[],
+ rules: [{
+ required: true,
+ message: "请输入",
+ trigger: "blur"
+ }],
+ change: (val) => {
+ if(val.value != ""){
+ this.formCK.landId = val.value
+ getByLandId(this.formCK.strainId,this.formCK.landId).then((res)=>{
+ var data = res.data.data
+ this.formCK.weight = data.weight
+ this.formCK.proid = data.id
+ })
+ }
+ }
+ },
+ {
label: "出库时间",
prop: "saleTime",
type: "date",
@@ -793,6 +907,7 @@
var that = this
this.$refs.form.validate((vaild, done) => {
if (vaild) {
+ this.form.id = ""
add(this.form).then(() => {
this.onLoad(this.page)
this.$message({
@@ -816,6 +931,8 @@
var that = this
this.$refs.form.validate((vaild, done) => {
if (vaild) {
+ this.formJG.id = ""
+ Object.assign(this.formJG,this.JG)
addjg(this.formJG).then(() => {
this.onLoad(this.page)
this.$message({
@@ -839,6 +956,7 @@
var that = this
this.$refs.form.validate((vaild, done) => {
if (vaild) {
+ this.formKC.id = ""
addKC(this.formKC).then(() => {
this.onLoad(this.page)
this.$message({
@@ -862,6 +980,7 @@
var that = this
this.$refs.form.validate((vaild, done) => {
if (vaild) {
+ this.formCK.id = ""
addck(this.formCK).then(() => {
this.onLoad(this.page)
this.$message({
@@ -906,6 +1025,7 @@
},
openWindow (index, data) {
if (index == 0) {
+ this.selectLand(data.strainId,0)
this.form.name = this.userInfo.nick_name
this.form.createUser = this.userInfo.user_id
this.form.weight = data.weight
@@ -915,6 +1035,7 @@
this.form.strainName = data.strainName
this.visible = true
} else if (index == 1) {
+ this.selectLand(data.strainId,1)
this.formKC.name = this.userInfo.nick_name
this.formKC.createUser = this.userInfo.user_id
this.formKC.weight = data.weight
@@ -924,6 +1045,7 @@
this.formKC.strainName = data.strainName
this.visibleKC = true
} else if (index == 2) {
+ this.selectLand(data.strainId,2)
this.formJG.name = this.userInfo.nick_name
this.formJG.createUser = this.userInfo.user_id
this.formJG.proid = data.id
@@ -933,6 +1055,7 @@
this.formJG.strainName = data.strainName
this.visibleJG = true
} else if (index == 3) {
+ this.selectLand(data.strainId,3)
this.formCK.name = this.userInfo.nick_name
this.formCK.createUser = this.userInfo.user_id
this.formCK.weight = data.weight
@@ -973,11 +1096,33 @@
this.page.currentPage = val
this.onLoad(this.page)
},
+ selectLand(strainId,index){
+ selectByStrainId(strainId).then((res)=>{
+ var data = res.data.data
+ if(index == 0){//销售
+ const column = this.findObject(this.option.column, "id")
+ column.dicData = []
+ column.dicData = data
+ }else if(index == 1){//库存
+ const column = this.findObject(this.optionKC.column, "id")
+ column.dicData = []
+ column.dicData = data
+ }else if(index == 2){//加工
+ const column = this.findObject(this.optionJG.column, "id")
+ column.dicData = []
+ column.dicData = data
+ }else if(index == 3){//出库
+ const column = this.findObject(this.optionCK.column, "id")
+ column.dicData = []
+ column.dicData = data
+ }
+ })
+ },
onLoad (page, params = {}) {
params['tenantId'] = this.userInfo.tenant_id
params['deptId'] = this.userInfo.dept_id
this.getFarmListDic();
- getList(
+ getStrainCount(
page.currentPage,
page.pageSize,
Object.assign(params, this.query)
@@ -1006,7 +1151,7 @@
farmId:id
}
this.onLoad(this.page,params)
- }
+ },
},
};
</script>
--
Gitblit v1.9.3