index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div class="base-container">
  3. <fnHeader :hideSwitch="true" :hideShadow="true" showDate></fnHeader>
  4. <div class="content">
  5. <div class="content-left">
  6. <div class="btn" @click="goBack">
  7. <img src="@/assets/images/common/back-icon.png" alt="" />
  8. 返回
  9. </div>
  10. <chart-box class="left-cont" name="品种列表" color="yellow">
  11. <div class="box">
  12. <div class="add-cont" v-if="baseData.length===0">
  13. <div>暂无数据</div>
  14. <div class="tips-text">请先添加品种,再框选右侧区域,进行品种确权</div>
  15. <div class="button" @click="handleAdd">
  16. <el-icon class="icon"><Plus /></el-icon>
  17. 添加品种
  18. </div>
  19. </div>
  20. <template v-else>
  21. <div class="box-item" v-for="item in baseData" :key="item.speciesItemId">
  22. <div>{{item.speciesItemName}}</div>
  23. <span>{{item.sampleCount}}颗</span>
  24. </div>
  25. <div class="button" @click="handleAdd">
  26. <el-icon class="icon"><Plus /></el-icon>
  27. 添加品种
  28. </div>
  29. </template>
  30. </div>
  31. </chart-box>
  32. </div>
  33. <div class="content-right">
  34. <div class="map-header">
  35. <div class="title">
  36. <img src="@/assets/images/common/area-icon.png" alt="" />
  37. 品种确权
  38. </div>
  39. <div class="button" @click="handleClear">清除框选</div>
  40. </div>
  41. <div class="map">
  42. <my-map></my-map>
  43. <div class="checkbox-list">
  44. <span class="text">全部设置为</span>
  45. <el-checkbox-group class="checkbox" v-model="checkedCities" @change="handleCheckedCitiesChange">
  46. <el-checkbox v-for="city in cities" :key="city" :label="city.label" :value="city.value">
  47. {{ city.label }}
  48. </el-checkbox>
  49. </el-checkbox-group>
  50. <div class="add" @click="handleAdd">
  51. <el-icon class="icon"><Plus /></el-icon>
  52. 添加品种
  53. </div>
  54. </div>
  55. <div class="footer-btn">
  56. <div class="cancel">取消</div>
  57. <div>保存</div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- 添加品种弹窗 -->
  64. <el-dialog
  65. v-model="dialogVisible"
  66. body-class="custom-dialog"
  67. title="添加品种"
  68. width="500"
  69. align-center
  70. :before-close="handleClose"
  71. >
  72. <el-input class="input" size="large" v-model="input" placeholder="请输入品种名称" />
  73. <template #footer>
  74. <div class="dialog-footer">
  75. <div class="btn" @click="dialogVisible = false">取消</div>
  76. <div @click="dialogVisible = false">确定</div>
  77. </div>
  78. </template>
  79. </el-dialog>
  80. </template>
  81. <script setup>
  82. import { onMounted, onUnmounted, ref } from "vue";
  83. import { ElMessage } from "element-plus";
  84. import fnHeader from "@/components/fnHeader.vue";
  85. import myMap from "./map";
  86. import chartBox from "@/components/chartBox.vue";
  87. import { useRouter, useRoute } from "vue-router";
  88. import { useStore } from "vuex";
  89. import eventBus from "@/api/eventBus";
  90. const store = useStore();
  91. const router = useRouter();
  92. const route = useRoute();
  93. onMounted(() => {
  94. getList();
  95. eventBus.on('map:list',getMapList)
  96. });
  97. onUnmounted(()=>{
  98. eventBus.off('map:list',getMapList)
  99. })
  100. function getMapList(arr){
  101. console.log('arr',arr);
  102. }
  103. //清除框选
  104. const handleClear = () =>{
  105. eventBus.emit('handle:clear')
  106. }
  107. const baseData = ref([])
  108. const getList = () => {
  109. const params = {
  110. farmId:sessionStorage.getItem('farmId'),
  111. regionId:sessionStorage.getItem('regionId')
  112. }
  113. VE_API.variety.speciesItemList(params).then(res =>{
  114. baseData.value = res.data || []
  115. })
  116. };
  117. const checkedCities = ref(["0"]);
  118. const cities = [
  119. {
  120. label:"品种1",
  121. value:"0"
  122. },
  123. {
  124. label:"品种2",
  125. value:"1"
  126. }
  127. ];
  128. const handleCheckedCitiesChange = (value) => {
  129. };
  130. const goBack = () => {
  131. router.go(-1);
  132. };
  133. //添加品种弹窗
  134. const dialogVisible = ref(false);
  135. const input = ref("");
  136. const handleAdd = () => {
  137. dialogVisible.value = true;
  138. };
  139. const handleClose = () => {
  140. dialogVisible.value = false;
  141. input.value = "";
  142. };
  143. </script>
  144. <style lang="scss" scoped>
  145. .base-container {
  146. width: 100%;
  147. height: 100vh;
  148. color: #fff;
  149. position: relative;
  150. box-sizing: border-box;
  151. z-index: 1;
  152. background: #000;
  153. .content {
  154. width: 100%;
  155. height: calc(100% - 74px);
  156. display: flex;
  157. justify-content: space-between;
  158. box-sizing: border-box;
  159. padding: 20px;
  160. .content-left {
  161. width: 473px;
  162. height: 100%;
  163. box-sizing: border-box;
  164. .btn {
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. border: 1px solid rgba(255, 255, 255, 0.78);
  169. border-radius: 4px;
  170. padding: 9px;
  171. margin-bottom: 13px;
  172. width: 104px;
  173. cursor: pointer;
  174. img {
  175. width: 14px;
  176. margin-right: 5px;
  177. }
  178. }
  179. .left-cont {
  180. width: 100%;
  181. height: calc(100% - 48px - 4px);
  182. .box {
  183. width: 100%;
  184. height: calc(100% - 58px);
  185. padding: 16px 12px;
  186. box-sizing: border-box;
  187. overflow-y: auto;
  188. display: flex;
  189. flex-direction: column;
  190. align-items: center;
  191. .button {
  192. color: #ffd489;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. border-radius: 8px;
  197. border: 1px solid #ffd489;
  198. padding: 8px 16px;
  199. background: rgba(255, 212, 137, 0.1);
  200. margin-top: 24px;
  201. width: 120px;
  202. font-size: 16px;
  203. box-sizing: border-box;
  204. cursor: pointer;
  205. .icon {
  206. margin-right: 4px;
  207. }
  208. }
  209. .add-cont {
  210. display: flex;
  211. flex-direction: column;
  212. align-items: center;
  213. font-size: 16px;
  214. .tips-text {
  215. width: 220px;
  216. text-align: center;
  217. color: #9f9f9f;
  218. font-size: 15px;
  219. margin-top: 8px;
  220. }
  221. }
  222. .box-item{
  223. width: 94%;
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. border-radius: 5px;
  228. border: 1px solid #666666;
  229. padding: 12px;
  230. div{
  231. font-size: 18px;
  232. }
  233. span{
  234. color: #9f9f9f;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. .content-right {
  241. width: calc(100% - 473px - 18px);
  242. margin-left: 18px;
  243. height: 100%;
  244. background: #191919;
  245. border: 0.6px solid #444444;
  246. padding: 20px;
  247. box-sizing: border-box;
  248. border-radius: 8px;
  249. .map-header {
  250. display: flex;
  251. align-items: flex-start;
  252. justify-content: space-between;
  253. .title {
  254. font-size: 22px;
  255. display: flex;
  256. align-items: flex-end;
  257. font-family: "PangMenZhengDao";
  258. margin-bottom: 16px;
  259. img {
  260. margin-right: 8px;
  261. }
  262. }
  263. .button{
  264. color: #fff;
  265. padding: 5px 15px;
  266. border-radius: 4px;
  267. font-size: 16px;
  268. border: 1px solid #fff;
  269. cursor: pointer;
  270. }
  271. }
  272. .map {
  273. width: 100%;
  274. clip-path: inset(0px round 4px);
  275. height: calc(100% - 31px - 16px);
  276. position: relative;
  277. .checkbox-list{
  278. position: absolute;
  279. z-index: 2;
  280. right: 42px;
  281. bottom: 150px;
  282. background: rgba(0, 0, 0, 0.8);
  283. border-radius: 8px;
  284. display: flex;
  285. flex-direction: column;
  286. padding: 20px;
  287. .text{
  288. color: #9f9f9f;
  289. margin-bottom: 12px;
  290. font-size: 16px;
  291. }
  292. .checkbox{
  293. display: flex;
  294. flex-direction: column;
  295. ::v-deep{
  296. .el-checkbox__label{
  297. color: #fff;
  298. font-size: 16px;
  299. }
  300. .el-checkbox__inner{
  301. width: 18px;
  302. height: 18px;
  303. }
  304. .el-checkbox__input.is-checked .el-checkbox__inner{
  305. background: #FFD489;
  306. border-color: #FFD489;
  307. &::after{
  308. border-color: #000;
  309. border-width: 2px;
  310. height: 10px;
  311. left: 4px;
  312. width: 5px;
  313. top: 0;
  314. }
  315. }
  316. }
  317. }
  318. .add{
  319. margin-top: 12px;
  320. border: 1px solid #fff;
  321. border-radius: 4px;
  322. background: rgba(255, 255, 255, 0.2);
  323. display: flex;
  324. align-items: center;
  325. padding: 8px;
  326. cursor: pointer;
  327. .icon{
  328. margin-right: 4px;
  329. }
  330. }
  331. }
  332. .footer-btn {
  333. position: absolute;
  334. right: 42px;
  335. bottom: 28px;
  336. z-index: 2;
  337. display: flex;
  338. width: 520px;
  339. div {
  340. text-align: center;
  341. width: calc(100% - 20px - 200px);
  342. font-size: 20px;
  343. color: #1d1d1d;
  344. background: #f7be5a;
  345. border-radius: 8px;
  346. border: 2px solid #fff;
  347. padding: 13px;
  348. cursor: pointer;
  349. }
  350. .cancel {
  351. margin-right: 20px;
  352. width: 200px;
  353. background: rgba(0, 0, 0, 0.6);
  354. color: #fff;
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }
  361. .custom-dialog {
  362. .el-dialog__body {
  363. margin-top: 10px;
  364. }
  365. .input {
  366. width: 100%;
  367. }
  368. }
  369. .dialog-footer {
  370. display: flex;
  371. width: 100%;
  372. margin-top: 25px;
  373. div {
  374. flex: 1;
  375. padding: 10px;
  376. background: #ffd489;
  377. border-radius: 5px;
  378. color: #1d1d1d;
  379. text-align: center;
  380. }
  381. .btn {
  382. border: 1px solid #9f9f9f;
  383. background: #fff;
  384. margin-right: 14px;
  385. }
  386. }
  387. </style>