From 3c77ae9b1d9f4bfe3a25d054a7793dbcde0a7aba Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 16 May 2022 08:31:11 +0800
Subject: [PATCH] 农资管理
---
src/views/stock/stock.vue | 385 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 329 insertions(+), 56 deletions(-)
diff --git a/src/views/stock/stock.vue b/src/views/stock/stock.vue
index 55bab8e..f73adcf 100644
--- a/src/views/stock/stock.vue
+++ b/src/views/stock/stock.vue
@@ -45,6 +45,15 @@
>出库
</el-button
>
+ <el-button
+ icon="el-icon-circle-plus-outline"
+ type="text"
+ size="mini"
+ @click="start(row)"
+ :size="size"
+ >农资记录
+ </el-button
+ >
</template>
</avue-crud>
<el-dialog
@@ -60,11 +69,11 @@
>
<div>
<avue-form
- ref="form"
+ ref="formR"
:option="option1"
- v-model="form"
+ v-model="formR"
@reset-change="emptytChange"
- @submit="submit"
+ @submit="submitR"
>
</avue-form>
</div>
@@ -82,11 +91,11 @@
>
<div>
<avue-form
- ref="form"
- :option="option1"
- v-model="form"
+ ref="formC"
+ :option="option2"
+ v-model="formC"
@reset-change="emptytChange"
- @submit="submit"
+ @submit="submitC"
>
</avue-form>
</div>
@@ -96,12 +105,15 @@
<script>
import {getList, getDetail, add, update, remove} from "@/api/stock/stock";
+import {add1} from "@/api/stockrecord/stockrecord";
import {mapGetters} from "vuex";
export default {
data() {
return {
form: {},
+ formC: {},
+ formR: {},
specsValue1: '',
query: {},
loading: true,
@@ -212,6 +224,7 @@
{
label: "入库数量",
span: 6,
+ type: "number",
prop: "amount",
rules: [{
required: true,
@@ -295,13 +308,6 @@
type: "textarea",
prop: "remarks",
span: 23,
- rules: [
- {
- required: true,
- message: "请输入备注",
- trigger: "blur",
- },
- ],
},
]
},
@@ -322,6 +328,7 @@
prop: "stockId1",
span: 23,
type: "select",
+ disabled: true,
dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
props: {
label: "dictValue",
@@ -334,39 +341,19 @@
}]
},
{
- label: "数量",
- prop: "amount1",
- },
- {
- label: "时间",
- prop: "time1",
- rules: [{
- required: true,
- message: "请输入时间",
- trigger: "blur"
- }]
- },
- {
- label: "类型 (0:出库 1:入库)",
- prop: "type1",
- rules: [{
- required: true,
- message: "请输入类型 (0:出库 1:入库)",
- trigger: "blur"
- }]
- },
- {
- label: "操作人",
- prop: "operator1",
- rules: [{
- required: true,
- message: "请输入操作人",
- trigger: "blur"
- }]
+ label: "规格",
+ disabled: true,
+ span: 6,
+ prop: "spn",
+ addDisplay: false,
},
{
label: "规格",
- prop: "spn1",
+ display: false,
+ hide: true,
+ prop: "specs1",
+ span: 5,
+ viewDisplay: false,
rules: [{
required: true,
message: "请输入规格",
@@ -374,31 +361,271 @@
}]
},
{
- label: "农资类型",
+ label: "规格值1",
+ display: false,
+ hide: true,
+ prop: "specsVal1",
+ searchSpan: 4,
+ span: 6,
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
+ },
+ {
+ label: "类型",
+ display: false,
+ hide: true,
prop: "stockType1",
+ },
+ {
+ label: "规格值2",
+ display: false,
+ hide: true,
+ prop: "specsVal2",
+ searchSpan: 4,
+ span: 6,
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
+ },
+ {
+ label: "当前库存",
+ disabled: true,
+ span: 6,
+ prop: "num",
+ },
+ {
+ label: "入库数量",
+ type: "number",
+ span: 11,
+ prop: "amount1",
+ },
+ {
+ label: "入库类型",
+ prop: "type1",
+ type: "select",
+ span: 12,
+ searchSpan: 4,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
rules: [{
required: true,
- message: "请输入农资类型",
+ message: "请输入入库类型",
trigger: "blur"
}]
},
{
- label: "图片",
- prop: "picture1",
+ label: "入库时间",
+ prop: "time1",
+ type: "date",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ span: 11,
rules: [{
required: true,
- message: "请输入图片",
+ message: "请输入入库时间",
trigger: "blur"
}]
+ },
+ {
+ label: "单据、凭证照片",
+ prop: "picture1",
+ type: "upload",
+ labelWidth: 145,
+ dataType: "string",
+ span: 24,
+ limit: 5,
+ listType: "picture-card",
+ tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+ canvasOption: {
+ text: "",
+ ratio: 1.0,
+ },
+ propsHttp: {
+ res: "data",
+ url: "url"
+ },
+ action: "/api/blade-resource/oss/endpoint/put-files"
},
{
label: "备注",
+ type: "textarea",
prop: "remarks1",
+ span: 23,
+ },
+ ]
+ },
+ option2: {
+ height: 'auto',
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "农资",
+ prop: "stockId1",
+ span: 23,
+ type: "select",
+ disabled: true,
+ dicUrl: "/api/stockfactory/stockfactory/selectStockFa",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
rules: [{
required: true,
- message: "请输入备注",
+ message: "请输入农资",
trigger: "blur"
}]
+ },
+ {
+ label: "规格",
+ disabled: true,
+ span: 6,
+ prop: "spn",
+ addDisplay: false,
+ },
+ {
+ label: "规格",
+ display: false,
+ hide: true,
+ prop: "specs1",
+ span: 5,
+ viewDisplay: false,
+ rules: [{
+ required: true,
+ message: "请输入规格",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "规格值1",
+ display: false,
+ hide: true,
+ prop: "specsVal1",
+ searchSpan: 4,
+ span: 6,
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs1",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
+ },
+ {
+ label: "类型",
+ display: false,
+ hide: true,
+ prop: "stockType1",
+ },
+ {
+ label: "规格值2",
+ display: false,
+ hide: true,
+ prop: "specsVal2",
+ searchSpan: 4,
+ span: 6,
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockSpecs2",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
+ },
+ {
+ label: "当前库存",
+ disabled: true,
+ span: 6,
+ prop: "num",
+ },
+ {
+ label: "出库数量",
+ type: "number",
+ span: 11,
+ prop: "amount1",
+ },
+ {
+ label: "出库类型",
+ prop: "type1",
+ type: "select",
+ span: 12,
+ searchSpan: 4,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockPurchase1",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ search: true,
+ rules: [{
+ required: true,
+ message: "请输入出库类型",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "入库时间",
+ prop: "time1",
+ type: "date",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ span: 11,
+ rules: [{
+ required: true,
+ message: "请输入入库时间",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "单据、凭证照片",
+ prop: "picture1",
+ type: "upload",
+ labelWidth: 145,
+ dataType: "string",
+ span: 24,
+ limit: 5,
+ listType: "picture-card",
+ tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张",
+ canvasOption: {
+ text: "",
+ ratio: 1.0,
+ },
+ propsHttp: {
+ res: "data",
+ url: "url"
+ },
+ action: "/api/blade-resource/oss/endpoint/put-files"
+ },
+ {
+ label: "备注",
+ type: "textarea",
+ prop: "remarks1",
+ span: 23,
},
]
},
@@ -426,11 +653,13 @@
}
},
methods: {
- submit(row, done, loading) {
+ //入库
+ submitR(row, done, loading) {
var that = this;
- updateGrade(row).then(
+ add1(row).then(
() => {
- that.$refs.form.resetFields();
+ that.onLoad(this.page);
+ that.$refs.formR.resetFields();
that.$message({
type: "success",
message: "操作成功!"
@@ -445,19 +674,56 @@
}
);
},
+ //出库
+ submitC(row, done, loading) {
+ var that = this;
+ add1(row).then(
+ () => {
+ that.onLoad(this.page);
+ that.$refs.formC.resetFields();
+ that.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ that.gradeBoxVisible1 = false;
+
+ done();
+ },
+ error => {
+ window.console.log(error);
+ done();
+ }
+ );
+ },
// 往入库页面填充数据
modifiedGrades(row) {
- this.form = {
+ this.formR = {
id: null,
stockId1: row.stockId,
+ spn: row.spn,
+ num: row.amount,
+ type1: row.type,
+ time1: row.time,
+ specs1: row.specs,
+ specsVal1: row.specsValue1,
+ specsVal2: row.specsValue1,
+ stockType1: 1,
};
this.gradeBoxVisible = true;
},
modifiedGrades1(row) {
- this.form = {
+ this.formC = {
id: null,
- stockId: row.stockId,
+ stockId1: row.stockId,
+ spn: row.spn,
+ num: row.amount,
+ type1: row.type,
+ time1: row.time,
+ specs1: row.specs,
+ specsVal1: row.specsValue1,
+ specsVal2: row.specsValue1,
+ stockType1: 0,
};
this.gradeBoxVisible1 = true;
@@ -535,6 +801,13 @@
}
done();
},
+ //农事操作
+ start(row) {
+ this.$router.push({
+ path: `/stockrecord`,
+ query: row
+ });
+ },
searchReset() {
this.query = {};
this.onLoad(this.page);
--
Gitblit v1.9.3