From 0f638a8b15524e89869bcbfae32d28bdad4358ee Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 02 Aug 2022 15:37:31 +0800
Subject: [PATCH] 新增农产品库存根据农场进行查找
---
src/views/farmplant/process.vue | 121 ++++++++++++++++++++++++++++++++++++++-
src/views/farmplant/farmproductstock.vue | 37 ++++++++++++
2 files changed, 153 insertions(+), 5 deletions(-)
diff --git a/src/views/farmplant/farmproductstock.vue b/src/views/farmplant/farmproductstock.vue
index f1a832e..0b83744 100644
--- a/src/views/farmplant/farmproductstock.vue
+++ b/src/views/farmplant/farmproductstock.vue
@@ -17,6 +17,18 @@
</el-form>
</div>-->
<div class="table">
+ <div class="search">
+ <div style="float: left">
+ <avue-select
+ v-model="searchType"
+ placeholder="请选择农场"
+ size="small"
+ @change="typeChange"
+ :dic="dic"
+ >
+ </avue-select>
+ </div>
+ </div>
<div class="content">
<div class="farm" v-for="(item, index) in data" :key="index">
<div class="farm-img">
@@ -319,6 +331,10 @@
import {
addck
} from "@/api/retrieval/retrieval"
+import {
+ getFarmList
+} from "@/api/farm/farm"
+
import { mapGetters } from "vuex"
import { regionData } from 'element-china-area-data'
@@ -331,6 +347,8 @@
user: "",
region: "",
},
+ searchType:"",
+ dic:[],
//销售字段
form: {
name: "",
@@ -958,6 +976,7 @@
onLoad (page, params = {}) {
params['tenantId'] = this.userInfo.tenant_id
params['deptId'] = this.userInfo.dept_id
+ this.getFarmListDic();
getList(
page.currentPage,
page.pageSize,
@@ -970,6 +989,24 @@
this.selectionClear()
})
},
+ getFarmListDic(){
+ getFarmList().then((res)=>{
+ var data = res.data.data
+ this.dic = [];
+ data.forEach((e)=>{
+ this.dic.push({
+ label:e.farmName,
+ value:e.id
+ })
+ })
+ })
+ },
+ typeChange(id){
+ var params = {
+ farmId:id
+ }
+ this.onLoad(this.page,params)
+ }
},
};
</script>
diff --git a/src/views/farmplant/process.vue b/src/views/farmplant/process.vue
index 57d439d..1bce293 100644
--- a/src/views/farmplant/process.vue
+++ b/src/views/farmplant/process.vue
@@ -43,7 +43,7 @@
</el-button>
</div>
<div class="btn">
- <!-- <el-button style="width: 65px;" plain size="small" @click="openWidow(3,item)">
+ <!-- <el-button style="width: 65px;" plain size="small" @click="openWindow(3,item)">
<span style="color: #5abf78">出库</span>
</el-button>
<el-button style="width: 65px;" plain size="small" @click="openWindow(2,item)">
@@ -65,7 +65,7 @@
:total="page.total"
></el-pagination>
</div>
-
+ <!-- 销售 -->
<el-dialog
title="加工产品销售"
:modal-append-to-body="false"
@@ -151,7 +151,6 @@
</template>
</avue-form>
</el-dialog>
-
<!-- 加工产品 -->
<el-dialog
title="加工产品"
@@ -189,6 +188,58 @@
<div style="text-align: center">
<el-button style="width: 80px" plain @click="cleanKCData">取消</el-button>
<el-button style="width: 80px" type="success" plain @click="submitJGloss">确认</el-button>
+ </div>
+ </template>
+ </avue-form>
+ </el-dialog>
+ <!--出库-->
+ <el-dialog
+ title="出库产品"
+ :modal-append-to-body="false"
+ :append-to-body="true"
+ :close-on-click-modal="false"
+ :before-close="cleanCKData"
+ @close="close"
+ width="30%"
+ :visible.sync="visibleCK"
+ center
+ >
+ <avue-form ref="form" v-model="formCK" :option="optionCK">
+ <template slot-scope="{disabled,size}" slot="name">
+ <div>
+ <el-tag type="success">{{ formCK.name }}</el-tag>
+ </div>
+ </template>
+ <template slot-scope="{disabled,size}" slot="saleDestination">
+ <div>
+ <el-cascader
+ style="width: 100%;"
+ placeholder="请选择出库去向"
+ size="large"
+ :options="optionck"
+ @change="handleChangeck"
+ v-model="saleDestination"
+ ></el-cascader>
+ </div>
+ </template>
+ <template slot-scope="{disabled,size}" slot="saleNum">
+ <div style="margin-bottom: -20px">
+ <el-input type="number" placeholder="请输入出库数量" v-model="formCK.saleNum">
+ <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
+ </el-input>
+ <div style="text-align: right;color: #ffb218">可出库量:{{ formCK.weight }}公斤</div>
+ </div>
+ </template>
+ <template slot-scope="{disabled,size}" slot="salePrice">
+ <!-- <div style="margin-bottom: -20px">
+ <el-input type="number" placeholder="请输入销售价格" v-model="formCK.salePrice"><i slot="suffix"
+ style="font-style:normal;margin-right: 5px;">元/公斤</i>
+ </el-input>
+ </div>-->
+ </template>
+ <template slot="menuForm">
+ <div style="text-align: center">
+ <el-button style="width: 120px" type="success" plain @click="submitCK">出库</el-button>
</div>
</template>
</avue-form>
@@ -239,6 +290,22 @@
processName:"",
weight:"",
},
+ //出库字段
+ formCK: {
+ name: "",
+ proid: "",
+ landId: "",
+ strainId: "",
+ saleTime: "",
+ saleNum: "",
+ saleDestination: "",
+ city: "",
+ county: "",
+ createUser: "",
+ remarks: "",
+
+
+ },
//损耗字段
formKC: {
name: "",
@@ -263,10 +330,13 @@
remarks: "",
reason: "0",
saleTime: "",
+
+ processName:""
},
visible: false,
visibleKC: false,
visibleJG: false,
+ visibleCK: false,
value: true,
page: {
pageSize: 16,
@@ -450,7 +520,7 @@
column: [
{
label: "加工品种",
- prop: "strainName",
+ prop: "processName",
span: 24,
disabled: true,
rules: [
@@ -719,6 +789,29 @@
}
})
},
+ //出库表单提交
+ submitCK () {
+ var that = this
+ this.$refs.form.validate((vaild, done) => {
+ if (vaild) {
+ addck(this.formCK).then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ //提交完成,关闭窗口清空数据
+ that.cleanCKData()
+ done()
+ }, error => {
+ window.console.log(error)
+ //提交失败,关闭窗口清空数据
+ that.cleanCKData()
+ done()
+ })
+ }
+ })
+ },
handleChange (value) {
if (value != null) {
this.form.saleDestination = value[0]
@@ -766,10 +859,23 @@
this.formJG.createUser = this.userInfo.user_id
this.formJG.proid = data.id
this.formJG.landId = data.landId
- this.formJG.weight = data.weight
+ this.formJG.weight = data.productInventoryNum
this.formJG.strainId = data.strainId
this.formJG.strainName = data.strainName
+
+ this.formKC.processName = data.processName
this.visibleJG = true
+ }else if (index == 3) { //出库
+ this.formCK.name = this.userInfo.nick_name
+ this.formCK.createUser = this.userInfo.user_id
+ this.formCK.weight = data.productInventoryNum
+ this.formCK.proid = data.id
+ this.formCK.landId = data.landId
+ this.formCK.strainId = data.strainId
+ this.formCK.strainName = data.strainName
+
+ this.formKC.processName = data.processName
+ this.visibleCK = true
}
},
//销售
@@ -791,6 +897,11 @@
that.$refs.form.resetFields()
that.visibleJG = false
},
+ cleanKCData () {
+ var that = this
+ that.$refs.form.resetFields()
+ that.visibleKC = false
+ },
handleSizeChange (val) {
this.page.pageSize = val
this.onLoad(this.page)
--
Gitblit v1.9.3