secondstep.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <template>
  2. <div class="secondstep-box" :style="'height:' + fullHeight + 'px'">
  3. <!-- 页头 -->
  4. <el-header>
  5. <el-page-header title @back="goBack" content="病害"></el-page-header>
  6. <el-button type="primary" class="secondstep-btn1" @click="judge()">完成</el-button>
  7. </el-header>
  8. <!-- 页面主内容 -->
  9. <el-main :style="'height:' + fullHeight + 'px'">
  10. <!-- 主内容列表 -->
  11. <ul class="secondstep-ul">
  12. <!-- 病虫害数据添加 -->
  13. <li class="secondstep-li">
  14. <img src="../../assets/plantImg/addr.png" alt class="secondstep-li-imgone dandu" />
  15. <div class="secondstep-li-div">
  16. <div class="secondstep-li-divone danoneA">病害名称添加</div>
  17. <div class="secondstep-li-input">
  18. <el-input
  19. type="text"
  20. :rows="10"
  21. placeholder="输入要添加的病害名称"
  22. v-model.trim="inputPlant"
  23. maxlength="20"
  24. @blur="animateWidthB()"
  25. clearable
  26. ></el-input>
  27. </div>
  28. </div>
  29. </li>
  30. <!-- 生育期 -->
  31. <!-- 病害名称 -->
  32. <li class="secondstep-li">
  33. <img src="../../assets/imageOne/plant.png" alt class="secondstep-li-imgone dandu" />
  34. <div class="secondstep-li-div">
  35. <div class="secondstep-li-divone danoneA">病害名称</div>
  36. <el-cascader
  37. :options="optionsB"
  38. v-model="valueA"
  39. placeholder="请选择病害种类"
  40. @change="resultB($event)"
  41. class="content"
  42. ></el-cascader>
  43. </div>
  44. </li>
  45. <!-- 生育期 -->
  46. <li class="secondstep-li">
  47. <img src="../../assets/imageOne/raise.png" alt class="secondstep-li-imgone dandu" />
  48. <div class="secondstep-li-div">
  49. <div class="secondstep-li-divone danoneA">生育期</div>
  50. <div class="secondstep-li-input">
  51. <el-input
  52. v-bind:disabled="disabledInput"
  53. maxlength="20"
  54. type="text"
  55. :rows="10"
  56. placeholder="请输入生育期"
  57. v-model.trim="inputB"
  58. @blur="animateWidthC()"
  59. clearable
  60. ></el-input>
  61. </div>
  62. </div>
  63. </li>
  64. <!-- 生育期 -->
  65. <!-- 统计方法 -->
  66. <li class="secondstep-li">
  67. <img src="../../assets/imageOne/danwei.png" alt class="secondstep-li-imgone dandu1" />
  68. <div class="secondstep-li-div danxuan">
  69. <div class="secondstep-li-divone danxuan2">统计方法</div>
  70. <!-- 测试 -->
  71. <el-cascader v-model="value" :options="options" @change="handleChange"></el-cascader>
  72. <!-- 测试 -->
  73. </div>
  74. </li>
  75. <!-- 作物数量 -->
  76. <li class="secondstep-li">
  77. <img src="../../assets/imageOne/number.png" alt class="secondstep-li-imgone dandu1" />
  78. <div class="secondstep-li-div">
  79. <div>
  80. <div class="secondstep-li-divone shuliang">作物数量</div>
  81. </div>
  82. <!-- 测试 -->
  83. <div class="secondstep-li-input">
  84. <el-input
  85. type="number"
  86. :rows="10"
  87. placeholder="只能输入数字"
  88. v-model.trim="inputA"
  89. @blur="animateWidthA()"
  90. @focus="animateWidth()"
  91. clearable
  92. ></el-input>
  93. </div>
  94. <!-- 测试 -->
  95. </div>
  96. </li>
  97. <!-- 上传图片 -->
  98. <li class="secondstep-li ceshi">
  99. <img src="../../assets/imageOne/image.png" alt class="secondstep-li-imgone dandu" />
  100. <div class="secondstep-li-div">
  101. <div class="secondstep-li-divone danone">上传图片</div>
  102. <!-- 删除 -->
  103. <el-button @click="delBtn()" type="primary" v-if="btnShow">删除</el-button>
  104. </div>
  105. <div class="shangchuan_box">
  106. <el-upload
  107. ref="upload"
  108. action="/account_photo"
  109. list-type="picture-card"
  110. :on-preview="handlePictureCardPreview"
  111. :http-request="handleHttpRequest"
  112. :on-remove="handleRemove"
  113. :limit="imgLimit"
  114. >
  115. <i class="el-icon-plus"></i>
  116. </el-upload>
  117. <el-dialog :visible.sync="dialogVisible">
  118. <img width="100%" :src="dialogImageUrl" alt />
  119. </el-dialog>
  120. </div>
  121. </li>
  122. <!-- 病级 -->
  123. <li class="secondstep-li bgji">
  124. <img src="../../assets/imageOne/plant.png" alt class="secondstep-li-img" />
  125. <div class="secondstep-li-div">
  126. <div class="secondstep-li-text bingji">病级</div>
  127. <div class="secondstep-div-box">
  128. <div class="secondstep-text-box">
  129. (1)
  130. <input type="text" class="secondstep-input" v-model.number="input1" />
  131. 值:
  132. <input
  133. type="number"
  134. class="secondstep-input"
  135. v-model.number="input2"
  136. />
  137. </div>
  138. <div class="secondstep-text-box">
  139. (2)
  140. <input type="text" class="secondstep-input" v-model.number="input3" />
  141. 值:
  142. <input
  143. type="number"
  144. class="secondstep-input"
  145. v-model.number="input4"
  146. />
  147. </div>
  148. <div class="secondstep-text-box">
  149. (3)
  150. <input type="text" class="secondstep-input" v-model.number="input5" />
  151. 值:
  152. <input
  153. type="number"
  154. class="secondstep-input"
  155. v-model.number="input6"
  156. />
  157. </div>
  158. <div class="secondstep-text-box">
  159. (4)
  160. <input type="type" class="secondstep-input" v-model.number="input7" />
  161. 值:
  162. <input
  163. type="number"
  164. class="secondstep-input"
  165. v-model.number="input8"
  166. />
  167. </div>
  168. <div class="secondstep-text-box">
  169. (5)
  170. <input type="text" class="secondstep-input" v-model.number="input9" />
  171. 值:
  172. <input
  173. type="number"
  174. class="secondstep-input"
  175. v-model.number="input10"
  176. />
  177. </div>
  178. <div class="secondstep-text-box">
  179. (6)
  180. <input type="text" class="secondstep-input" v-model.number="input11" />
  181. 值:
  182. <input
  183. type="number"
  184. placeholder="0"
  185. class="secondstep-input"
  186. v-model.number="input12"
  187. />
  188. </div>
  189. </div>
  190. </div>
  191. </li>
  192. </ul>
  193. </el-main>
  194. <!-- 添加病害名称提示框 -->
  195. <el-dialog
  196. title="病害名称添加"
  197. :visible.sync="dialogVisibleA"
  198. width="7rem"
  199. :before-close="handleClose"
  200. >
  201. <span>如是否添加{{this.inputPlant}}</span>
  202. <span slot="footer" class="dialog-footer">
  203. <el-button @click="dialogVisibleA = false, delPlant()">取 消</el-button>
  204. <el-button type="primary" @click="dialogVisibleA = false, addPlant($event)">确 定</el-button>
  205. </span>
  206. </el-dialog>
  207. </div>
  208. </template>
  209. <script>
  210. export default {
  211. name: "secondstep",
  212. data() {
  213. return {
  214. valueA: "", //病害名称数据
  215. disabledInput: true, //生育期input框是否禁用
  216. inputPlant: "", //添加病虫害名称
  217. dialogVisibleA: false, //添加病害名称弹框
  218. // radioVal1: localStorage.type,
  219. // radioVal2: localStorage.tyNumber,
  220. bingType: "", //作物名称-新建
  221. // zuoNumberA: localStorage.textBNumber, //面积大小
  222. // iptlistA: JSON.parse(localStorage.getItem("iptList")), //病虫害值input框值
  223. fullHeight: document.documentElement.clientHeight,
  224. // isShow: false,
  225. area: [], //作物数量单位和数字
  226. crop: [], //作物数量单位和数字
  227. //统计方法
  228. value: [],
  229. options: [
  230. {
  231. value: "面积大小",
  232. label: "面积大小",
  233. children: [
  234. {
  235. value: "平方米",
  236. label: "平方米"
  237. },
  238. {
  239. value: "亩",
  240. label: "亩"
  241. }
  242. ]
  243. },
  244. {
  245. value: "作物数量",
  246. label: "作物数量",
  247. children: [
  248. {
  249. value: "株数",
  250. label: "株数"
  251. },
  252. {
  253. value: "叶数",
  254. label: "叶数"
  255. }
  256. ]
  257. }
  258. ],
  259. inputA: "", //数字
  260. inputB: "", //病害名称
  261. //病级
  262. input1: localStorage.getItem("input1"),
  263. input2: "0",
  264. input3: localStorage.getItem("input2"),
  265. input4: "0",
  266. input5: localStorage.getItem("input3"),
  267. input6: "0",
  268. input7: localStorage.getItem("input4"),
  269. input8: "0",
  270. input9: localStorage.getItem("input5"),
  271. input10: "0",
  272. input11: localStorage.getItem("input6"),
  273. input12: "0",
  274. // input1: '病级1',
  275. // input2: "0",
  276. // input3: '病级2',
  277. // input4: "0",
  278. // input5: '病级3',
  279. // input6: "0",
  280. // input7: '病级4',
  281. // input8: "0",
  282. // input9: '病级5',
  283. // input10: "0",
  284. // input11: '病级6',
  285. // input12: "0",
  286. dialogImageUrl: "",
  287. dialogVisible: false,
  288. add: [],
  289. btnShow: false, //删除按钮显示隐藏
  290. imgLimit: 3, //限制上传图片张数
  291. optionsB: [],
  292. selectedOptionsB: ""
  293. };
  294. },
  295. watch: {
  296. fullHeight(val) {
  297. //监控浏览器高度变化
  298. if (!this.timer) {
  299. this.fullHeight = val;
  300. this.timer = true;
  301. let that = this;
  302. setTimeout(function() {
  303. //防止过度调用监测事件,导致卡顿
  304. that.timer = false;
  305. }, 400);
  306. }
  307. }
  308. },
  309. mounted() {
  310. this.get_boderHeight();
  311. this.confirm();
  312. //作物种类数据
  313. // this.optionsB = JSON.parse(localStorage.getItem("pestName"));
  314. //判断病级在本地的值是否为空
  315. if (
  316. localStorage.getItem("input1") === null &&
  317. localStorage.getItem("input2") === null &&
  318. localStorage.getItem("input3") === null &&
  319. localStorage.getItem("input4") === null &&
  320. localStorage.getItem("input5") === null &&
  321. localStorage.getItem("input6") === null
  322. ) {
  323. this.input1 = "病级1";
  324. this.input3 = "病级2";
  325. this.input5 = "病级3";
  326. this.input7 = "病级4";
  327. this.input9 = "病级5";
  328. this.input11 = "病级6";
  329. }
  330. },
  331. created() {
  332. let _this = this;
  333. },
  334. computed: {},
  335. methods: {
  336. //动态获取浏览器高度
  337. get_boderHeight() {
  338. const that = this;
  339. window.onresize = () => {
  340. return (() => {
  341. window.fullHeight = document.documentElement.clientHeight;
  342. that.fullHeight = window.fullHeight;
  343. })();
  344. };
  345. },
  346. //返回
  347. goBack() {
  348. let _this = this;
  349. localStorage.removeItem("iptList"); //病虫害值
  350. localStorage.removeItem("area"); //作物数量
  351. localStorage.removeItem("add"); //上传图片
  352. localStorage.removeItem("classify_palnt"); //病害名称
  353. localStorage.removeItem("unit"); //统计方法
  354. localStorage.removeItem("plantNumber"); //作物数量
  355. localStorage.removeItem("pestName"); //作物选择返回的病虫害名称
  356. _this.$router.push("/newmessage");
  357. },
  358. // 判断必填项是否都以填完
  359. judge() {
  360. if (
  361. localStorage.getItem("classify_palnt") &&
  362. this.inputB &&
  363. localStorage.getItem("area") &&
  364. localStorage.getItem("unit") &&
  365. localStorage.getItem("plantNumber") &&
  366. localStorage.getItem("add")
  367. ) {
  368. this.baocun();
  369. } else {
  370. this.$message.error("必填项没有完成不能保存!!");
  371. }
  372. },
  373. //保存病级值
  374. bingji() {
  375. let _this = this;
  376. let list = localStorage.iptList; //原有值
  377. if (list) {
  378. var b1 = JSON.parse(list);
  379. b1.push(_this.input1 + ":" + _this.input2);
  380. b1.push(_this.input3 + ":" + _this.input4);
  381. b1.push(_this.input5 + ":" + _this.input6);
  382. b1.push(_this.input7 + ":" + _this.input8);
  383. b1.push(_this.input9 + ":" + _this.input10);
  384. b1.push(_this.input11 + ":" + _this.input12);
  385. var b2 = JSON.stringify(b1);
  386. } else {
  387. let adlist = [];
  388. adlist.push(_this.input1 + ":" + _this.input2);
  389. adlist.push(_this.input3 + ":" + _this.input4);
  390. adlist.push(_this.input5 + ":" + _this.input6);
  391. adlist.push(_this.input7 + ":" + _this.input8);
  392. adlist.push(_this.input9 + ":" + _this.input10);
  393. adlist.push(_this.input11 + ":" + _this.input12);
  394. var b2 = JSON.stringify(adlist);
  395. }
  396. localStorage.setItem("iptList", b2);
  397. },
  398. //点击完成按钮给后端发送作物种类,作物数量,病级分类,病虫害值等数据
  399. baocun() {
  400. let _this = this;
  401. _this.bingji(); //调用保存病级值
  402. // 将用户修改的病级存在本地
  403. localStorage.setItem("input1", _this.input1);
  404. localStorage.setItem("input2", _this.input3);
  405. localStorage.setItem("input3", _this.input5);
  406. localStorage.setItem("input4", _this.input7);
  407. localStorage.setItem("input5", _this.input9);
  408. localStorage.setItem("input6", _this.input11);
  409. let postData = _this.$qs.stringify({
  410. harm_id: localStorage.getItem("classify_palnt"), //病虫害ID
  411. growth_stages: _this.inputB, //生育期
  412. addr_photo: localStorage.getItem("add"), //病虫害照片路径
  413. area: localStorage.getItem("plantNumber"), //统计面积
  414. pestname: localStorage.getItem("iptList"), //病害值
  415. cens_method: localStorage.getItem("area") + localStorage.getItem("unit") //统计方法
  416. });
  417. _this
  418. .$axios({
  419. method: "POST",
  420. url: "bigservers/cate",
  421. data: postData,
  422. headers: {
  423. "Content-Type": "application/x-www-form-urlencoded"
  424. }
  425. })
  426. .then(res => {
  427. if (res.data.code == null) {
  428. this.$notify.error({
  429. title: "失败",
  430. message: "数据保存失败",
  431. duration: 1000
  432. });
  433. } else if (res.data.code == 200) {
  434. _this.$router.push("home");
  435. this.$notify({
  436. title: "成功",
  437. message: "数据保存成功了",
  438. type: "success",
  439. duration: 1000
  440. });
  441. //删除存在本地的值
  442. this.delData();
  443. }
  444. })
  445. .catch(error => {
  446. alert("请求失败");
  447. console.log(error);
  448. });
  449. },
  450. //统计方法的值
  451. handleChange(value) {
  452. localStorage.setItem("area", value[0]); //作物数量还是面积
  453. localStorage.setItem("unit", value[1]); //单位
  454. },
  455. //监听数字input-失去焦点
  456. animateWidthA() {
  457. if (this.inputA === "") {
  458. this.$notify({
  459. title: "警告",
  460. message: "这是必填项,不能为空",
  461. type: "warning",
  462. duration: 1000
  463. });
  464. } else {
  465. localStorage.setItem("plantNumber", this.inputA); // 存数量
  466. }
  467. },
  468. //监听数字input-获取焦点
  469. animateWidth() {
  470. if (
  471. localStorage.getItem("area") === null &&
  472. localStorage.getItem("unit") === null
  473. ) {
  474. this.$notify({
  475. title: "警告",
  476. message: "请先选择统计方法之后,再填写数量",
  477. type: "warning",
  478. duration: 1000
  479. });
  480. }
  481. },
  482. //监听病害名称添加input-失去焦点-病害名称
  483. animateWidthB() {
  484. let _this = this;
  485. //判断是否为空
  486. if (_this.inputPlant !== "") {
  487. _this.dialogVisibleA = true;
  488. }
  489. },
  490. handleClose(done) {
  491. let _this = this;
  492. _this.dialogVisibleA = false;
  493. },
  494. //添加病虫害名称弹框确定事件
  495. addPlant() {
  496. let _this = this;
  497. let postData = _this.$qs.stringify({
  498. ret: "add_harm",
  499. harm: localStorage.getItem("plantName"), //分类id
  500. pest_sort: localStorage.getItem("radioData"), //病虫害区分
  501. pest_name: _this.inputPlant, //病虫害名称
  502. month_id: localStorage.getItem("monthID") //月份ID
  503. });
  504. _this
  505. .$axios({
  506. url: "bigservers/city",
  507. method: "post",
  508. data: postData,
  509. headers: {
  510. "Content-Type": "application/x-www-form-urlencoded"
  511. }
  512. })
  513. .then(res => {
  514. if (res.data.code == 200) {
  515. this.$message({
  516. type: "success",
  517. message: "病害名称新建成功!",
  518. duration: 1500
  519. });
  520. this.confirm();
  521. } else if (res.data.code == 201) {
  522. this.$message({
  523. showClose: true,
  524. message: "该病害名称已经存在了!",
  525. type: "warning"
  526. });
  527. } else if (res.data.code == null) {
  528. this.$message({
  529. type: "warning",
  530. message: "该病害名称新建失败!",
  531. duration: 1500
  532. });
  533. }
  534. _this.inputPlant = "";
  535. })
  536. .catch(err => {
  537. console.log(err);
  538. });
  539. },
  540. //添加病虫害名称弹框取消事件
  541. delPlant() {
  542. let _this = this;
  543. _this.inputPlant = "";
  544. },
  545. //生育期input获取焦点事件
  546. animateWidthC() {
  547. let _this = this;
  548. //判断是否选择病害名称
  549. if (
  550. localStorage.getItem("classify_palnt") !== null &&
  551. _this.inputB === ""
  552. ) {
  553. this.$notify({
  554. title: "警告",
  555. message: "此项为必填项,请填写完后再填写下一项",
  556. type: "warning",
  557. duration: 1000
  558. });
  559. }
  560. },
  561. //保存成功后删除存在本地的数据
  562. delData() {
  563. //第二步页面的数据
  564. localStorage.removeItem("iptList"); //病虫害值
  565. localStorage.removeItem("area"); //作物数量
  566. localStorage.removeItem("add"); //上传图片
  567. localStorage.removeItem("classify_palnt"); //病害名称
  568. localStorage.removeItem("unit"); //统计方法
  569. localStorage.removeItem("plantNumber"); //作物数量
  570. //第一步页面数据
  571. localStorage.removeItem("regionID"); //地区ID
  572. localStorage.removeItem("regionName"); //地区名称
  573. localStorage.removeItem("regionData"); //地区
  574. localStorage.removeItem("monthID"); //月份ID
  575. localStorage.removeItem("month"); //月份
  576. localStorage.removeItem("screebIndex");
  577. localStorage.removeItem("plantType");
  578. localStorage.removeItem("plantName");
  579. localStorage.removeItem("pestName");
  580. localStorage.removeItem("radioData");
  581. localStorage.removeItem("screenIndex");
  582. },
  583. //点击进入上传图片页面
  584. handleRemove(file, fileList) {},
  585. handlePictureCardPreview(file) {
  586. this.dialogImageUrl = file.url;
  587. this.dialogVisible = true;
  588. },
  589. handleHttpRequest(file) {
  590. let _this = this;
  591. // console.log(file.file);
  592. // console.log(file);
  593. let form = new FormData();
  594. form.append("file", file.file);
  595. _this
  596. .$axios({
  597. method: "post",
  598. url: "bigservers/account_photo",
  599. anync: true,
  600. data: form,
  601. headers: {
  602. "Content-Type": "multipart/form-data"
  603. }
  604. })
  605. .then(res => {
  606. // _this.add = res.data.src
  607. _this.add.push(res.data.src);
  608. _this.btnShow = true;
  609. localStorage.setItem("add", _this.add);
  610. // console.log(_this.add);
  611. })
  612. .catch(error => {
  613. // console.log("222");
  614. console.log(err);
  615. });
  616. },
  617. //删除上传的图片
  618. delBtn() {
  619. let _this = this;
  620. let postData = _this.$qs.stringify({
  621. pic_list: localStorage.getItem("add")
  622. });
  623. _this
  624. .$axios({
  625. method: "post",
  626. url: "bigservers/del_account_photo",
  627. data: postData,
  628. headers: {
  629. "Content-Type": "application/x-www-form-urlencoded"
  630. }
  631. })
  632. .then(res => {
  633. localStorage.removeItem("add");
  634. this.$notify({
  635. title: "成功",
  636. message: "图片删除成功",
  637. type: "success"
  638. });
  639. this.$refs.upload.clearFiles();
  640. localStorage.removeItem("add");
  641. // const timer = setInterval(() => {
  642. // location.reload();
  643. // }, 1000);
  644. })
  645. .catch(error => {
  646. console.log(error);
  647. this.$notify.error({
  648. title: "失败",
  649. message: "图片删除失败"
  650. });
  651. });
  652. },
  653. //下拉框选中病害名称
  654. resultB(e) {
  655. localStorage.setItem("classify_palnt", e);
  656. this.disabledInput = false; //生育期
  657. },
  658. //请求病虫害名
  659. confirm() {
  660. let _this = this;
  661. //判断当前数据是新建还是默认编辑
  662. if (localStorage.getItem("defaultID") !== null) {
  663. if (localStorage.getItem("yfenID") !== null) {
  664. //默认编辑
  665. var postData = _this.$qs.stringify({
  666. ret: "details",
  667. harm_name: localStorage.getItem("plantName"), //作物名称
  668. pest_sort: localStorage.getItem("defaultType"), //作物类型
  669. month_id: localStorage.getItem("yfenID") //月份ID
  670. });
  671. } else if (localStorage.getItem("yuefenID") !== null) {
  672. //默认编辑
  673. var postData = _this.$qs.stringify({
  674. ret: "details",
  675. harm_name: localStorage.getItem("plantName"), //作物名称
  676. pest_sort: localStorage.getItem("defaultType"), //作物类型
  677. month_id: localStorage.getItem("yuefenID") //月份ID
  678. });
  679. } else {
  680. var postData = _this.$qs.stringify({
  681. ret: "details",
  682. harm_name: _this.redata.pest_name, //作物名称
  683. pest_sort: _this.redata.crop_sort, //作物类型
  684. month_id: _this.redata.month //月份ID
  685. });
  686. }
  687. } else {
  688. //新建
  689. var postData = _this.$qs.stringify({
  690. ret: "details",
  691. harm_name: localStorage.getItem("plantName"), //作物名称
  692. pest_sort: localStorage.getItem("radioData"), //作物类型
  693. month_id: localStorage.getItem("monthID") //月份ID
  694. });
  695. }
  696. _this
  697. .$axios({
  698. url: "bigservers/city",
  699. method: "post",
  700. data: postData,
  701. headers: {
  702. "Content-Type": "application/x-www-form-urlencoded"
  703. }
  704. })
  705. .then(res => {
  706. this.optionsB = res.data;
  707. // this.optionsB = JSON.parse(localStorage.getItem("pestName"));
  708. })
  709. .catch(err => {});
  710. }
  711. }
  712. };
  713. </script>
  714. <style lang="scss">
  715. @import "../../assets/style/bus.scss";
  716. @import "../../assets/style/scss/secondstep.scss";
  717. </style>