From e4418b60a9e80a1438919e618d2e5e2048d404bc Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 17 Oct 2022 11:23:11 +0800
Subject: [PATCH] 农场图片显示优化;加工产品管理去除导入功能;修复加工、销售、出库、损耗记录表的查询功能
---
src/views/task/task.vue | 93 ++++++++++++++++++++++++++++++++++++++++------
1 files changed, 81 insertions(+), 12 deletions(-)
diff --git a/src/views/task/task.vue b/src/views/task/task.vue
index 9bdf61e..160b827 100644
--- a/src/views/task/task.vue
+++ b/src/views/task/task.vue
@@ -68,9 +68,18 @@
import {getList, getDetail, add, update, remove, updatechuli} from "@/api/task/task";
import {mapGetters} from "vuex";
import {getLandList} from "@/api/land/land";
+import {selectStockFa} from "@/api/stockfactory/stockfactory";
export default {
data() {
+ const validateNum = (rule, value, callback) => {
+ if (!/^[1-9]\d*$/.test(value)) {
+ callback(new Error("请输入正整数"));
+ } else {
+ callback();
+ }
+ };
+
return {
form: {},
query: {},
@@ -101,10 +110,12 @@
refreshBtn:false,
columnBtn:false,
searchShowBtn:false,
+ menuWidth:300,
column: [
{
label: "任务名称",
prop: "taskName",
+ maxlength:200,
rules: [{
required: true,
message: "请输入任务名称",
@@ -159,13 +170,14 @@
prop: "stockId",
hide: true,
type: "tree",
- dicUrl: `/api/soldr/soldr/selectSol`,
+ dicData:[],
+ // dicUrl: `/api/soldr/soldr/selectSol`,
props: {
label: "spn",
value: "id"
},
change: function (value) {
- console.log(value.value)
+ // console.log(value.value)
}
},
{
@@ -174,8 +186,13 @@
hide: true,
span: 6,
type: "number",
- labelWidth: 110,
+ // labelWidth: 110,
display: false,
+ rules:[{
+ require:false,
+ trigger: "blur",
+ validator: validateNum
+ }]
},
{
label: "拍照照片",
@@ -196,6 +213,7 @@
row: true,
},
{
+ editDisplay: false,
label: "任务状态",
addDisplay: false,
type: "select",
@@ -257,6 +275,7 @@
prop: "remark",
type: "textarea",
span: 24,
+ maxlength:200,
},
]
},
@@ -271,6 +290,7 @@
viewBtn: true,
selection: true,
dialogClickModal: false,
+ emptyBtn:false,
column: [
{
label: "任务名称",
@@ -338,7 +358,7 @@
value: "id"
},
change: function (value) {
- console.log(value.value)
+ // console.log(value.value)
}
},
{
@@ -346,7 +366,7 @@
prop: "stockNum",
hide: true,
disabled: true,
- span: 6,
+ span: 7,
type: "number",
labelWidth: 110,
},
@@ -397,6 +417,7 @@
editDisplay: false,
prop: "remark",
type: "textarea",
+ maxlength:200,
span: 23,
},
]
@@ -416,12 +437,14 @@
{
label: "任务名称",
prop: "taskName",
+ maxlength:200,
disabled: true,
},
{
label: "任务说明",
prop: "taskExplain",
type: "textarea",
+ maxlength:200,
span: 23,
disabled: true,
},
@@ -479,7 +502,7 @@
value: "stock_id1"
},
change: function (value) {
- console.log(value.value)
+ // console.log(value.value)
}
},
{
@@ -494,6 +517,7 @@
{
label: "拍照照片",
prop: "type",
+ value:"1",
span: 6,
disabled: true,
type: "switch",
@@ -540,6 +564,7 @@
editDisplay: false,
prop: "remark",
type: "textarea",
+ maxlength:200,
span: 23,
},
]
@@ -553,7 +578,7 @@
this.initData();
},
computed: {
- ...mapGetters(["permission", "userInfo"]),
+ ...mapGetters(["permission", "userInfo","$farmId"]),
permissionList() {
return {
addBtn: this.vaildData(this.permission.task_add, false),
@@ -573,7 +598,6 @@
watch: {
"form.stockId": {
handler(val) {
- console.log(val)
var stockIdcolumn = this.findObject(this.option.column, "stockNum");
if (val != "") {
stockIdcolumn.display = true;
@@ -583,11 +607,26 @@
},
immediate: true,
},
+ '$farmId':{
+ handler (newName, oldName) {
+ this.getLandList()
+ this.getSoldrList()
+ this.query={}
+ this.onLoad(this.page)
+ }
+ }
},
methods: {
- //入库
+ //处理
submitR(row, done, loading) {
var that = this;
+ if(row.type == "0"){
+ if(row.tp == ""){
+ that.$message.warning("请上传照片")
+ done()
+ return
+ }
+ }
updatechuli(row).then(
() => {
that.onLoad(this.page);
@@ -621,22 +660,40 @@
type: row.type
};
- if (row.type === "0") {
- var tp = this.findObject(this.optionchuli.column, "tp");
+ var tp = this.findObject(this.optionchuli.column, "tp");
+ if (row.type == "0") {
tp.display = true;
+ }else {
+ tp.display = false
}
this.gradeBoxVisiblechuli = true;
},
initData() {
+ this.getLandList()
+ this.getSoldrList()
+ },
+ getLandList(){
var that = this;
//获取农地数据
- getLandList(this.userInfo.dept_id).then((res) => {
+ getLandList(this.$farmId).then((res) => {
if (res.data.code == 200) {
var landIdcolumn = that.findObject(that.option.column, "landId");
+ var landIdColumnChuli = that.findObject(that.optionchuli.column,"landId")
that.landList = res.data.data;
landIdcolumn.dicData = res.data.data;
+ landIdColumnChuli.dicData = res.data.data
}
})
+ },
+ getSoldrList(){
+ var that = this;
+ //获取农资
+ selectStockFa(this.$farmId).then((res) => {
+ if (res.data.code == 200) {
+ var stockIdcolumn = that.findObject(that.option.column, "stockId");
+ stockIdcolumn.dicData = res.data.data;
+ }
+ });
},
rowSave(row, done, loading) {
if(row.tp.length<=0){
@@ -655,6 +712,14 @@
});
},
rowUpdate(row, index, done, loading) {
+ if(row.stockNum<0){
+ this.$message({
+ type: "warning",
+ message: "农资量不能为负数!"
+ });
+ done();
+ return
+ }
update(row).then(() => {
this.onLoad(this.page);
this.$message({
@@ -707,6 +772,9 @@
});
},
beforeOpen(done, type) {
+ if(["add"].includes(type)){
+ this.option.disabled=false
+ }
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
@@ -745,6 +813,7 @@
},
onLoad(page, params = {}) {
this.loading = true;
+ params["farmId"] = this.$farmId
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = res.data.data;
this.page.total = data.total;
--
Gitblit v1.9.3