|
|
@@ -4,7 +4,20 @@
|
|
|
<el-header>
|
|
|
<div class="grid-content bg-purple-dark">
|
|
|
<el-page-header @back="goBack" title content="新建信息"></el-page-header>
|
|
|
- <el-button type="primary" class="pathology-btn2" @click="judge()">完成</el-button>
|
|
|
+ <!-- 病害 -->
|
|
|
+ <el-button
|
|
|
+ v-show="this.plantName !== undefined && this.radio == '1'"
|
|
|
+ type="primary"
|
|
|
+ class="pathology-btn2"
|
|
|
+ @click="Plantjudge()"
|
|
|
+ >完成</el-button>
|
|
|
+ <!-- 虫害 -->
|
|
|
+ <el-button
|
|
|
+ v-show="this.plantName !== undefined && this.radio == '2'"
|
|
|
+ type="primary"
|
|
|
+ class="pathology-btn2"
|
|
|
+ @click="Insectjudge()"
|
|
|
+ >完成</el-button>
|
|
|
</div>
|
|
|
</el-header>
|
|
|
|
|
|
@@ -73,16 +86,15 @@
|
|
|
</li>
|
|
|
|
|
|
<!-- 病害第二步 -->
|
|
|
- <!-- <li v-if="plantShow"> -->
|
|
|
<transition name="el-fade-in-linear">
|
|
|
- <li v-if="this.plantName != 'undefined' && this.radio == '1'">
|
|
|
+ <li v-if="this.plantName != undefined && this.radio == '1'">
|
|
|
<plant></plant>
|
|
|
</li>
|
|
|
</transition>
|
|
|
|
|
|
<!-- 虫害第二步 -->
|
|
|
<transition name="el-fade-in-linear">
|
|
|
- <li v-if="this.plantName != 'undefined' && this.radio == '2'">
|
|
|
+ <li v-if="this.plantName != undefined && this.radio == '2'">
|
|
|
<insect></insect>
|
|
|
</li>
|
|
|
</transition>
|
|
|
@@ -108,7 +120,44 @@ export default {
|
|
|
fullHeight: document.documentElement.clientHeight,
|
|
|
show3: false,
|
|
|
plantShow: false, //病害第二步
|
|
|
- insectShow: false //虫害第二步
|
|
|
+ insectShow: false, //虫害第二步
|
|
|
+ btnShow: false, //右上角按钮
|
|
|
+
|
|
|
+ //病害保存值
|
|
|
+ plantNum: {
|
|
|
+ input1: localStorage.getItem("input1"),
|
|
|
+ input2: "0",
|
|
|
+ input3: localStorage.getItem("input2"),
|
|
|
+ input4: "0",
|
|
|
+ input5: localStorage.getItem("input3"),
|
|
|
+ input6: "0",
|
|
|
+ input7: localStorage.getItem("input4"),
|
|
|
+ input8: "0",
|
|
|
+ input9: localStorage.getItem("input5"),
|
|
|
+ input10: "0",
|
|
|
+ input11: localStorage.getItem("input6"),
|
|
|
+ input12: "0"
|
|
|
+ },
|
|
|
+
|
|
|
+ //虫害保存值
|
|
|
+ insectNum: {
|
|
|
+ input1: "0",
|
|
|
+ input2: "0",
|
|
|
+ input3: "0",
|
|
|
+ input4: "0",
|
|
|
+ input5: "0",
|
|
|
+ input6: "0",
|
|
|
+ input7: "0",
|
|
|
+ input8: "0",
|
|
|
+ input9: "0",
|
|
|
+ input10: "0",
|
|
|
+ input11: "0",
|
|
|
+ input12: "0",
|
|
|
+ input13: "0",
|
|
|
+ input14: "0",
|
|
|
+ input15: "0",
|
|
|
+ input16: "0"
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -134,6 +183,9 @@ export default {
|
|
|
localStorage.getItem("regionID") !== null
|
|
|
) {
|
|
|
localStorage.setItem("radioData", val);
|
|
|
+ console.log(val);
|
|
|
+ localStorage.removeItem("plantName"); //清除作物名称
|
|
|
+ _this.plantName = undefined;
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "warning",
|
|
|
@@ -163,10 +215,22 @@ export default {
|
|
|
mounted() {
|
|
|
this.get_boderHeight();
|
|
|
|
|
|
- //判读单选框是否有选择
|
|
|
- // if (localStorage.getItem('radioData') == null) {
|
|
|
- // localStorage.setItem('radioData', '1')
|
|
|
- // }
|
|
|
+ //判断病级在本地的值是否为空
|
|
|
+ if (
|
|
|
+ localStorage.getItem("input1") == null &&
|
|
|
+ localStorage.getItem("input2") == null &&
|
|
|
+ localStorage.getItem("input3") == null &&
|
|
|
+ localStorage.getItem("input4") == null &&
|
|
|
+ localStorage.getItem("input5") == null &&
|
|
|
+ localStorage.getItem("input6") == null
|
|
|
+ ) {
|
|
|
+ this.plantNum.input1 = "病级1";
|
|
|
+ this.plantNum.input3 = "病级2";
|
|
|
+ this.plantNum.input5 = "病级3";
|
|
|
+ this.plantNum.input7 = "病级4";
|
|
|
+ this.plantNum.input9 = "病级5";
|
|
|
+ this.plantNum.input11 = "病级6";
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
@@ -221,6 +285,27 @@ export default {
|
|
|
localStorage.removeItem("radioData");
|
|
|
localStorage.removeItem("screenIndex"); //作物选择ID
|
|
|
|
|
|
+ //第二步病害
|
|
|
+ localStorage.removeItem("iptList"); //病虫害值
|
|
|
+ localStorage.removeItem("area"); //作物数量
|
|
|
+ localStorage.removeItem("add"); //上传图片
|
|
|
+ localStorage.removeItem("classify_palnt"); //病害名称
|
|
|
+ localStorage.removeItem("unit"); //统计方法
|
|
|
+ localStorage.removeItem("plantNumber"); //作物数量
|
|
|
+ localStorage.removeItem("pestName"); //作物选择返回的病虫害名称
|
|
|
+
|
|
|
+ //第二步虫害
|
|
|
+ localStorage.removeItem("newdata");
|
|
|
+ localStorage.removeItem("type");
|
|
|
+ localStorage.removeItem("textNumber");
|
|
|
+ localStorage.removeItem("tyNumber");
|
|
|
+ localStorage.removeItem("iptList");
|
|
|
+ localStorage.removeItem("textBNumber");
|
|
|
+ localStorage.removeItem("area");
|
|
|
+ localStorage.removeItem("tyNumber");
|
|
|
+ localStorage.removeItem("add"); //上传图片
|
|
|
+ localStorage.removeItem("pestName"); //作物选择返回的病虫害名称
|
|
|
+
|
|
|
_this.$router.push("/home");
|
|
|
},
|
|
|
|
|
|
@@ -291,6 +376,261 @@ export default {
|
|
|
e.target.classList.add("activeA");
|
|
|
}
|
|
|
localStorage.setItem("danxun", "1"); //病害
|
|
|
+ },
|
|
|
+
|
|
|
+ //病害信息保存
|
|
|
+ Plantjudge() {
|
|
|
+ if (
|
|
|
+ localStorage.getItem("classify_palnt") &&
|
|
|
+ localStorage.getItem("maternity") &&
|
|
|
+ localStorage.getItem("area") &&
|
|
|
+ localStorage.getItem("unit") &&
|
|
|
+ localStorage.getItem("plantNumber") &&
|
|
|
+ localStorage.getItem("add")
|
|
|
+ ) {
|
|
|
+ this.baocun();
|
|
|
+ // this.bingji()
|
|
|
+ } else {
|
|
|
+ this.$message.error("必填项没有完成不能保存!!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保存病级值
|
|
|
+ bingji() {
|
|
|
+ let _this = this;
|
|
|
+ let list = localStorage.iptList; //原有值
|
|
|
+ if (list) {
|
|
|
+ var b1 = JSON.parse(list);
|
|
|
+ b1.push(_this.plantNum.input1 + ":" + _this.plantNum.input2);
|
|
|
+ b1.push(_this.plantNum.input3 + ":" + _this.plantNum.input4);
|
|
|
+ b1.push(_this.plantNum.input5 + ":" + _this.input6);
|
|
|
+ b1.push(_this.plantNum.input7 + ":" + _this.plantNum.input8);
|
|
|
+ b1.push(_this.plantNum.input9 + ":" + _this.plantNum.input10);
|
|
|
+ b1.push(_this.plantNum.input11 + ":" + _this.plantNum.input12);
|
|
|
+ var b2 = JSON.stringify(b1);
|
|
|
+ } else {
|
|
|
+ let adlist = [];
|
|
|
+ adlist.push(_this.plantNum.input1 + ":" + _this.plantNum.input2);
|
|
|
+ adlist.push(_this.plantNum.input3 + ":" + _this.plantNum.input4);
|
|
|
+ adlist.push(_this.plantNum.input5 + ":" + _this.plantNum.input6);
|
|
|
+ adlist.push(_this.plantNum.input7 + ":" + _this.plantNum.input8);
|
|
|
+ adlist.push(_this.plantNum.input9 + ":" + _this.plantNum.input10);
|
|
|
+ adlist.push(_this.plantNum.input11 + ":" + _this.plantNum.input12);
|
|
|
+
|
|
|
+ var b2 = JSON.stringify(adlist);
|
|
|
+ }
|
|
|
+ localStorage.setItem("iptList", b2);
|
|
|
+ },
|
|
|
+ //保存成功后删除存在本地的数据
|
|
|
+ delData() {
|
|
|
+ //第二步页面的数据
|
|
|
+ localStorage.removeItem("iptList"); //病虫害值
|
|
|
+ localStorage.removeItem("area"); //作物数量
|
|
|
+ localStorage.removeItem("add"); //上传图片
|
|
|
+ localStorage.removeItem("classify_palnt"); //病害名称
|
|
|
+ localStorage.removeItem("unit"); //统计方法
|
|
|
+ localStorage.removeItem("plantNumber"); //作物数量
|
|
|
+ localStorage.removeItem("maternity"); //生育期
|
|
|
+
|
|
|
+ //第一步页面数据
|
|
|
+ localStorage.removeItem("regionID"); //地区ID
|
|
|
+ localStorage.removeItem("regionName"); //地区名称
|
|
|
+ localStorage.removeItem("regionData"); //地区
|
|
|
+ localStorage.removeItem("monthID"); //月份ID
|
|
|
+ localStorage.removeItem("month"); //月份
|
|
|
+ localStorage.removeItem("screebIndex");
|
|
|
+ localStorage.removeItem("plantType");
|
|
|
+ localStorage.removeItem("plantName");
|
|
|
+ localStorage.removeItem("pestName");
|
|
|
+ localStorage.removeItem("radioData");
|
|
|
+ localStorage.removeItem("screenIndex");
|
|
|
+ },
|
|
|
+ //点击完成按钮给后端发送作物种类等数据
|
|
|
+ baocun() {
|
|
|
+ let _this = this;
|
|
|
+ _this.bingji(); //调用保存病级值
|
|
|
+ // 将用户修改的病级存在本地
|
|
|
+ localStorage.setItem("input1", _this.plantNum.input1);
|
|
|
+ localStorage.setItem("input2", _this.plantNum.input3);
|
|
|
+ localStorage.setItem("input3", _this.plantNum.input5);
|
|
|
+ localStorage.setItem("input4", _this.plantNum.input7);
|
|
|
+ localStorage.setItem("input5", _this.plantNum.input9);
|
|
|
+ localStorage.setItem("input6", _this.plantNum.input11);
|
|
|
+
|
|
|
+ // let postData = _this.$qs.stringify({
|
|
|
+ // harm_id: localStorage.getItem("classify_palnt"), //病虫害ID
|
|
|
+ // growth_stages: localStorage.getItem("maternity"), //生育期
|
|
|
+ // addr_photo: localStorage.getItem("add"), //病虫害照片路径
|
|
|
+ // area: localStorage.getItem("plantNumber"), //统计面积
|
|
|
+ // pestname: localStorage.getItem("iptList"), //病害值
|
|
|
+ // cens_method: localStorage.getItem("area") + localStorage.getItem("unit") //统计方法
|
|
|
+ // });
|
|
|
+
|
|
|
+ // _this
|
|
|
+ // .$axios({
|
|
|
+ // method: "POST",
|
|
|
+ // url: "https://www.yfznscd.com/cate",
|
|
|
+ // data: postData,
|
|
|
+ // headers: {
|
|
|
+ // "Content-Type": "application/x-www-form-urlencoded"
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .then(res => {
|
|
|
+ // if (res.data.code == null) {
|
|
|
+ // this.$notify.error({
|
|
|
+ // title: "失败",
|
|
|
+ // message: "数据保存失败",
|
|
|
+ // duration: 1000
|
|
|
+ // });
|
|
|
+ // } else if (res.data.code == 200) {
|
|
|
+ // _this.$router.push("home");
|
|
|
+ // this.$notify({
|
|
|
+ // title: "成功",
|
|
|
+ // message: "数据保存成功了",
|
|
|
+ // type: "success",
|
|
|
+ // duration: 1000
|
|
|
+ // });
|
|
|
+ // //删除存在本地的值
|
|
|
+ // this.delData();
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catch(error => {
|
|
|
+ // alert("请求失败");
|
|
|
+ // console.log(error);
|
|
|
+ // });
|
|
|
+ },
|
|
|
+
|
|
|
+ //虫害信息保存
|
|
|
+ Insectjudge() {
|
|
|
+ if (
|
|
|
+ localStorage.getItem("classify_palnt") &&
|
|
|
+ localStorage.getItem("maternity") &&
|
|
|
+ localStorage.getItem("area") &&
|
|
|
+ localStorage.getItem("unit") &&
|
|
|
+ localStorage.getItem("plantNumber") &&
|
|
|
+ localStorage.getItem("add")
|
|
|
+ ) {
|
|
|
+ this.binghai();
|
|
|
+ } else {
|
|
|
+ this.$message.error("必填项没有完成不能保存!!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 给后端传递病虫害值和虫害级别
|
|
|
+ binghai() {
|
|
|
+ let _this = this;
|
|
|
+ _this.chongji(); //调用虫害函数
|
|
|
+ let postData = _this.$qs.stringify({
|
|
|
+ harm_id: localStorage.getItem("classify_palnt"), //病虫害ID
|
|
|
+ // growth_stages: data, //生育期
|
|
|
+ growth_stages: localStorage.getItem("maternity"), //生育期
|
|
|
+ addr_photo: localStorage.getItem("add"), //病虫害照片路径
|
|
|
+ area: localStorage.getItem("plantNumber"), //统计面积
|
|
|
+ pestname: localStorage.getItem("iptList"), //病害值
|
|
|
+ cens_method: localStorage.getItem("area") + localStorage.getItem("unit") //统计方法
|
|
|
+ });
|
|
|
+
|
|
|
+ _this
|
|
|
+ .$axios({
|
|
|
+ method: "POST",
|
|
|
+ url: "https://www.yfznscd.com/cate",
|
|
|
+ data: postData,
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code == null) {
|
|
|
+ this.$notify.error({
|
|
|
+ title: "失败",
|
|
|
+ message: "数据保存失败",
|
|
|
+ duration: 1000
|
|
|
+ });
|
|
|
+ } else if (res.data.code == 200) {
|
|
|
+ _this.$router.push("home");
|
|
|
+ this.$notify({
|
|
|
+ title: "成功",
|
|
|
+ message: "数据保存成功了",
|
|
|
+ type: "success",
|
|
|
+ duration: 1000
|
|
|
+ });
|
|
|
+ //删除存在本地的值
|
|
|
+ this.delDataA();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ alert("保存失败");
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //保存虫级值
|
|
|
+ chongji() {
|
|
|
+ let _this = this;
|
|
|
+ //存input框中输入的值
|
|
|
+ let list = localStorage.iptList; //原有值
|
|
|
+ if (list) {
|
|
|
+ var b1 = JSON.parse(list);
|
|
|
+ b1.push("卵" + ":" + _this.insectNum.input1);
|
|
|
+ b1.push("蛹" + ":" + _this.insectNum.input2);
|
|
|
+ b1.push("幼虫" + ":" + _this.insectNum.input3);
|
|
|
+ b1.push("落虫" + ":" + _this.insectNum.input4);
|
|
|
+ b1.push("齡雄虫1" + ":" + _this.insectNum.input5);
|
|
|
+ b1.push("齡雄虫2" + ":" + _this.insectNum.input6);
|
|
|
+ b1.push("齡雄虫3" + ":" + _this.insectNum.input7);
|
|
|
+ b1.push("齡雄虫4" + ":" + _this.insectNum.input8);
|
|
|
+ b1.push("齡雄虫5" + ":" + _this.insectNum.input9);
|
|
|
+ b1.push("齡雄虫6" + ":" + _this.insectNum.input10);
|
|
|
+ b1.push("齡雌虫1" + ":" + _this.insectNum.input11);
|
|
|
+ b1.push("齡雌虫2" + ":" + _this.insectNum.input12);
|
|
|
+ b1.push("齡雌虫3" + ":" + _this.insectNum.input13);
|
|
|
+ b1.push("齡雌虫4" + ":" + _this.insectNum.input14);
|
|
|
+ b1.push("齡雌虫5" + ":" + _this.insectNum.input15);
|
|
|
+ b1.push("齡雌虫6" + ":" + _this.insectNum.input16);
|
|
|
+
|
|
|
+ var b2 = JSON.stringify(b1);
|
|
|
+ } else {
|
|
|
+ let adlist = [];
|
|
|
+ adlist.push("卵" + ":" + _this.insectNum.input1);
|
|
|
+ adlist.push("蛹" + ":" + _this.insectNum.input2);
|
|
|
+ adlist.push("幼虫" + ":" + _this.insectNum.input3);
|
|
|
+ adlist.push("落虫" + ":" + _this.insectNum.input4);
|
|
|
+ adlist.push("齡雄虫1" + ":" + _this.insectNum.input5);
|
|
|
+ adlist.push("齡雄虫2" + ":" + _this.insectNum.input6);
|
|
|
+ adlist.push("齡雄虫3" + ":" + _this.insectNum.input7);
|
|
|
+ adlist.push("齡雄虫4" + ":" + _this.insectNum.input8);
|
|
|
+ adlist.push("齡雄虫5" + ":" + _this.insectNum.input9);
|
|
|
+ adlist.push("齡雄虫6" + ":" + _this.insectNum.input10);
|
|
|
+ adlist.push("齡雌虫1" + ":" + _this.insectNum.input11);
|
|
|
+ adlist.push("齡雌虫2" + ":" + _this.insectNum.input12);
|
|
|
+ adlist.push("齡雌虫3" + ":" + _this.insectNum.input13);
|
|
|
+ adlist.push("齡雌虫4" + ":" + _this.insectNum.input14);
|
|
|
+ adlist.push("齡雌虫5" + ":" + _this.insectNum.input15);
|
|
|
+ adlist.push("齡雌虫6" + ":" + _this.insectNum.input16);
|
|
|
+ var b2 = JSON.stringify(adlist);
|
|
|
+ }
|
|
|
+ localStorage.setItem("iptList", b2);
|
|
|
+ },
|
|
|
+ //保存完成后删除本地数据
|
|
|
+ delDataA() {
|
|
|
+ //第二步页面的数据
|
|
|
+ localStorage.removeItem("iptList"); //病虫害值
|
|
|
+ localStorage.removeItem("area"); //作物数量
|
|
|
+ localStorage.removeItem("add"); //上传图片
|
|
|
+ localStorage.removeItem("classify_palnt"); //病害名称
|
|
|
+ localStorage.removeItem("unit"); //统计方法
|
|
|
+ localStorage.removeItem("plantNumber"); //作物数量
|
|
|
+ localStorage.removeItem("maternity"); //生育期
|
|
|
+
|
|
|
+ //第一步页面数据
|
|
|
+ localStorage.removeItem("regionID"); //地区ID
|
|
|
+ localStorage.removeItem("regionName"); //地区名称
|
|
|
+ localStorage.removeItem("regionData"); //地区
|
|
|
+ localStorage.removeItem("monthID"); //月份ID
|
|
|
+ localStorage.removeItem("month"); //月份
|
|
|
+ localStorage.removeItem("screebIndex");
|
|
|
+ localStorage.removeItem("plantType");
|
|
|
+ localStorage.removeItem("plantName");
|
|
|
+ localStorage.removeItem("pestName");
|
|
|
+ localStorage.removeItem("radioData");
|
|
|
+ localStorage.removeItem("screenIndex");
|
|
|
}
|
|
|
}
|
|
|
};
|