redact.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="redact-box" :style="'height:' + fullHeight + 'px'">
  3. <!-- 页头 -->
  4. <el-header>
  5. <el-page-header title @back="goBack" content="编辑"></el-page-header>
  6. <!-- 编辑保存图标 -->
  7. <el-button type="text">
  8. <img src="../../assets/imageOne/24.png" alt class="redact-img" />
  9. </el-button>
  10. </el-header>
  11. <!-- 调查详情主内容 -->
  12. <el-main :style="'height:' + fullHeight + 'px'">
  13. <div class>
  14. <ul class="redact-ul">
  15. <!-- 调查时间 -->
  16. <li class="redact-ul-li">
  17. <img src="../../assets/imageOne/39.png" alt class="redact-ul-li-img" />
  18. <div class="redact-ul-li-box">
  19. <div class="redact-ul-li-text">调查时间</div>
  20. <div v-if="errorShow" class="redact-ul-li-time">{{redata[1].time}}</div>
  21. </div>
  22. </li>
  23. <!-- 采集地址 -->
  24. <li class="redact-ul-li">
  25. <img src="../../assets/imageOne/10.png" alt class="redact-ul-li-img image-one" />
  26. <div class="redact-ul-li-box">
  27. <div class="redact-ul-li-text text-one">采集地址</div>
  28. <div
  29. v-if="errorShow"
  30. class="redact-ul-li-time time-one"
  31. >{{redata[1].user_pro + redata[1].user_city + redata[1].user_area + redata[1].user_country }}</div>
  32. </div>
  33. </li>
  34. <!-- GPS定位 -->
  35. <li class="redact-ul-li">
  36. <img src="../../assets/imageOne/10.png" alt class="redact-ul-li-img image-one" />
  37. <div class="redact-ul-li-box">
  38. <div class="redact-ul-li-text text-two">GPS定位</div>
  39. <div v-if="errorShow" class="redact-ul-li-time time-two">
  40. 经度:
  41. <span class>{{redata[1].lng}}</span>
  42. 纬度:
  43. <span class>{{redata[1].lat}}</span>
  44. </div>
  45. </div>
  46. </li>
  47. <!-- 采集人 -->
  48. <li class="redact-ul-li" @click="collect()">
  49. <img src="../../assets/imageOne/14.png" alt class="redact-ul-li-img" />
  50. <div class="redact-ul-li-box">
  51. <div class="redact-ul-li-text text-three">采集人</div>
  52. <div v-if="errorShow" class="redact-ul-li-time time-three">{{redata[1].name}}</div>
  53. </div>
  54. </li>
  55. <!-- 统计分类 -->
  56. <li class="redact-ul-li">
  57. <img src="../../assets/imageOne/35.png" alt class="redact-ul-li-img fangkuai" />
  58. <div class="redact-ul-li-box">
  59. <div class="redact-ul-li-text text-four">统计分类</div>
  60. <!-- <div v-if="errorShow" class="redact-ul-li-time time-four">{{redata[1].statistical}}</div> -->
  61. <div class="radiobutton">
  62. <el-radio v-model="radio1" label="植物病害" @change="zhiwu()">植物病害</el-radio>
  63. <el-radio v-model="radio1" label="昆虫病害" @change="zhiwu()">昆虫病害</el-radio>
  64. </div>
  65. </div>
  66. </li>
  67. <!-- 作物种类 -->
  68. <li class="redact-ul-li">
  69. <img src="../../assets/imageOne/16.png" alt class="redact-ul-li-img img-one" />
  70. <div v-if="errorShow" class="redact-ul-li-box">
  71. <div class="redact-ul-li-text text-five" v-if="isShow">作物种类</div>
  72. <div class="redact-ul-li-text text-five" v-else>昆虫种类</div>
  73. <div class="redact-ul-li-time time-five" v-if="isShow">{{redata[1].plant}}</div>
  74. <div class="redact-ul-li-time time-five" v-else>{{redata[1].insect}}</div>
  75. </div>
  76. </li>
  77. <!-- 统计方法 -->
  78. <li class="redact-ul-li">
  79. <img src="../../assets/imageOne/35.png" alt class="redact-ul-li-img fangkuai" />
  80. <div class="redact-ul-li-box">
  81. <div class="redact-ul-li-text text-six">统计方法</div>
  82. <!-- <div
  83. v-if="errorShow"
  84. class="redact-ul-li-time time-six"
  85. >按{{redata[1].statistical_method}}统计</div> -->
  86. <div class="radiobutton">
  87. <el-radio v-model="radio2" label="面积大小" @change="mianji()">面积大小</el-radio>
  88. <el-radio v-model="radio2" label="作物数量" @change="zuowu()">作物数量</el-radio>
  89. </div>
  90. </div>
  91. </li>
  92. <!-- 统计面积 -->
  93. <li class="redact-ul-li" @click="proportion()">
  94. <img src="../../assets/imageOne/36.png" alt class="redact-ul-li-img fangkuai" />
  95. <div class="redact-ul-li-box">
  96. <div class="redact-ul-li-text text-seven">统计面积</div>
  97. <div v-if="errorShow">
  98. <div class="redact-ul-li-time time-seven" v-if="manShow">{{redata[1].area}}</div>
  99. <div class="redact-ul-li-time time-seven" v-else>{{redata[1].crop}}</div>
  100. </div>
  101. </div>
  102. </li>
  103. <!-- 病害名称 -->
  104. <li class="redact-ul-li">
  105. <img src="../../assets/imageOne/17.png" alt class="redact-ul-li-img" />
  106. <div v-if="errorShow" class="redact-ul-li-box">
  107. <div class="redact-ul-li-text text-eight" v-if="isShow">病害名称</div>
  108. <div class="redact-ul-li-text text-eight" v-else>昆虫名称</div>
  109. <div class="redact-ul-li-time time-eight" v-if="isShow">{{redata[1].plant_name}}</div>
  110. <div class="redact-ul-li-time time-eight" v-else>{{redata[1].insect_name}}</div>
  111. </div>
  112. </li>
  113. <!-- 病害级别 -->
  114. <li class="redact-ul-li li-one" v-if="errorShow">
  115. <img src="../../assets/imageOne/34.png" alt class="redact-ul-li-img fangkuai" />
  116. <el-collapse v-model="activeName" accordion>
  117. <el-collapse-item title="病虫害值" name="4">
  118. <div class="insect-li-txt" v-for="item in this.redata[0]" :key="item">{{item}}</div>
  119. </el-collapse-item>
  120. </el-collapse>
  121. </li>
  122. </ul>
  123. </div>
  124. </el-main>
  125. <!-- 采集人编辑弹框 -->
  126. <el-dialog title="采集人" :visible.sync="dialogFormVisible" :before-close="handleCloseA">
  127. <el-form :model="form">
  128. <el-form-item label :label-width="formLabelWidth">
  129. <el-input v-model.trim="form.newmeg" autocomplete="off"></el-input>
  130. </el-form-item>
  131. </el-form>
  132. <div slot="footer" class="dialog-footer">
  133. <el-button @click="dialogFormVisible = false,cancel()">取 消</el-button>
  134. <el-button type="primary" @click="dialogFormVisible = false,collectAdd()">确 定</el-button>
  135. </div>
  136. </el-dialog>
  137. <!-- 统计面积编辑弹框 -->
  138. <el-dialog title="统计面积" :visible.sync="dialogFormVisible1" :before-close="handleCloseA">
  139. <el-form :model="form">
  140. <el-form-item label :label-width="formLabelWidth">
  141. <!-- <el-input v-model.trim="form.area" autocomplete="off"></el-input> -->
  142. <div style="margin-top: 15px;">
  143. <el-input placeholder="请输入内容" v-model.trim="form.area" class="input-with-select">
  144. <el-select v-model="select" slot="append" placeholder="请选择">
  145. <el-option label="平方米" value="平方米"></el-option>
  146. <el-option label="亩" value="亩"></el-option>
  147. <el-option label="株数" value="株数"></el-option>
  148. <el-option label="叶数" value="叶数"></el-option>
  149. </el-select>
  150. </el-input>
  151. </div>
  152. </el-form-item>
  153. </el-form>
  154. <div slot="footer" class="dialog-footer">
  155. <el-button @click="dialogFormVisible1 = false,cancel()">取 消</el-button>
  156. <el-button type="primary" @click="dialogFormVisible1 = false,proportionAdd()">确 定</el-button>
  157. </div>
  158. </el-dialog>
  159. </div>
  160. </template>
  161. <script>
  162. export default {
  163. name: "redact",
  164. data() {
  165. return {
  166. fullHeight: document.documentElement.clientHeight,
  167. radio1: '', //统计分类单选
  168. radio2: '', //统计方法单选
  169. redata: [], //数据
  170. manShow: false, //判断是面积还是株数
  171. activeName: "1", //手风琴效果
  172. errorShow: false, //页面数据
  173. dialogFormVisible: false, //采集人
  174. dialogFormVisible1: false, //统计面积
  175. select: "", //统计面积
  176. form: {
  177. newmeg: "", //采集人
  178. area: "", //统计面积
  179. delivery: false,
  180. type: [],
  181. resource: "",
  182. desc: "",
  183. userList: ""
  184. },
  185. formLabelWidth: "120px"
  186. };
  187. },
  188. created() {
  189. let _this = this;
  190. let postData = _this.$qs.parse({
  191. id: localStorage.examineID
  192. });
  193. _this
  194. .$axios({
  195. method: "post",
  196. url: "bigservers/seeuser",
  197. data: postData,
  198. headers: {
  199. "Content-Type": "application/json"
  200. }
  201. })
  202. .then(res => {
  203. _this.redata = res.data;
  204. //判断是作物还是昆虫
  205. if (res.data[1].statistical === "植物病害") {
  206. _this.isShow = true;
  207. } else {
  208. _this.isShow = false;
  209. }
  210. //判断area是否为null
  211. if (res.data[1].crop !== null) {
  212. _this.manShow = false;
  213. } else {
  214. _this.manShow = true;
  215. }
  216. _this.errorShow = true;
  217. localStorage.setItem('redactAxios', res.data)
  218. })
  219. .catch(error => {
  220. alert("失败");
  221. });
  222. console.log(_this.radio1)
  223. },
  224. watch: {
  225. fullHeight(val) {
  226. //监控浏览器高度变化
  227. if (!this.timer) {
  228. this.fullHeight = val;
  229. this.timer = true;
  230. let that = this;
  231. setTimeout(function() {
  232. //防止过度调用监测事件,导致卡顿
  233. that.timer = false;
  234. }, 400);
  235. }
  236. }
  237. },
  238. mounted() {
  239. this.get_boderHeight();
  240. },
  241. methods: {
  242. //动态获取浏览器高度
  243. get_boderHeight() {
  244. const that = this;
  245. window.onresize = () => {
  246. return (() => {
  247. window.fullHeight = document.documentElement.clientHeight;
  248. that.fullHeight = window.fullHeight;
  249. })();
  250. };
  251. },
  252. goBack() {
  253. let _this = this;
  254. _this.$router.push("/examine");
  255. },
  256. //弹出框右上角关闭按钮回调
  257. handleCloseA() {
  258. let _this = this;
  259. _this.dialogFormVisible = false;
  260. _this.dialogFormVisible1 = false;
  261. _this.cancel();
  262. },
  263. //取消按钮
  264. cancel() {
  265. let _this = this;
  266. _this.form.newmeg = "";
  267. _this.form.area = "";
  268. _this.select = "";
  269. },
  270. //采集人弹框显示
  271. collect() {
  272. let _this = this;
  273. _this.dialogFormVisible = true;
  274. },
  275. //采集人确定事件
  276. collectAdd() {
  277. let data = this.form.newmeg;
  278. console.log(data);
  279. },
  280. //统计面积弹框显示
  281. proportion() {
  282. let _this = this;
  283. _this.dialogFormVisible1 = true;
  284. },
  285. //统计面积确定事件
  286. proportionAdd() {
  287. let data = this.form.area + this.select;
  288. console.log(data);
  289. },
  290. //统计分类面积
  291. mianji () {
  292. console.log('面积大小')
  293. },
  294. //统计分类作物
  295. zuowu () {
  296. console.log('作物种类')
  297. },
  298. // 统计分类植物病害和昆虫病害
  299. zhiwu () {
  300. let _this = this
  301. if (_this.radio1 === '植物病害') {
  302. _this.isShow = false
  303. } else {
  304. _this.isShow = true
  305. }
  306. },
  307. }
  308. };
  309. </script>
  310. <style lang="scss">
  311. @import "../../assets/style/bus.scss";
  312. @import "../../assets/style/scss/redact.scss";
  313. </style>