index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <div class="base-container">
  3. <div class="back-icon" @click="goBack">
  4. <img src="@/assets/images/common/back-icon.png" />
  5. 返回
  6. </div>
  7. <div class="custom-content">
  8. <div class="custom-l">
  9. <div class="box-title">
  10. <img src="@/assets/images/common/chart-yellow.png" alt="" />
  11. 果树列表
  12. </div>
  13. <div class="select-wrap">
  14. <el-select class="select-item" @change="handleAreaChange" v-model="areaVal" placeholder="分区" style="width: 146px">
  15. <el-option label="全部分区" :value="0"></el-option>
  16. <el-option v-for="(item, index) in areaOptions" :key="index" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-select class="select-item" filterable @change="handleTypeChange" v-model="typeVal" placeholder="全部品类" style="width: 146px">
  19. <el-option label="全部品类" :value="0"></el-option>
  20. <el-option
  21. v-for="(species, index) in speciesList"
  22. :key="index"
  23. :label="species.name"
  24. :value="species.name"
  25. />
  26. </el-select>
  27. <el-select class="select-item" v-model="ageVal" placeholder="树龄" style="width: 146px">
  28. <el-option
  29. v-for="item in ageOptions"
  30. :key="item.value"
  31. :label="item.label"
  32. :value="item.value"
  33. />
  34. </el-select>
  35. </div>
  36. <div class="tree-list">
  37. <div
  38. class="list-item"
  39. v-for="(item, index) in allTrees"
  40. :key="index"
  41. >
  42. <div class="tree-icon">
  43. <img class="tree-img" src="@/assets/images/foster-home/tree-item.png" alt="" />
  44. <div class="tree-type-name-tag">{{ item.pz }}</div>
  45. </div>
  46. <div class="item-center">
  47. <div class="center-t">
  48. {{ item.fosterCode }}
  49. <!-- <span class="type-tag">综合:94分</span>
  50. <span class="type-tag">生态:92分</span> -->
  51. </div>
  52. <div class="center-item p-t-2 age-line">
  53. <div class="age-wrap">
  54. <div class="has-age">
  55. <div class="age">栽种时间:<span class="unit">{{item.plantDate || '--'}}</span></div>
  56. </div>
  57. <div class="sort-line"></div>
  58. </div>
  59. 树龄:<span class="unit">{{ (item.age && item.age+'年') || '--' }}</span>
  60. </div>
  61. <div class="center-item">栽种区域:<span>{{ (item.area && item.area + '区') || '--' }}</span></div>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="pagination-wrap">
  66. <el-pagination
  67. background
  68. v-model:current-page="currentPage"
  69. v-model:page-size="pageSize"
  70. :page-sizes="[10, 20, 50, 100]"
  71. layout="total, sizes, prev, pager, next"
  72. :total="totalVal"
  73. @size-change="handleSizeChange"
  74. @current-change="getSamplePage"
  75. />
  76. </div>
  77. </div>
  78. <div class="custom-r">
  79. <div class="second-title">
  80. <img src="@/assets/images/common/chart-yellow.png" alt="" />
  81. 批量编辑果树
  82. </div>
  83. <div class="custom-detail">
  84. <div class="setting-item">
  85. <span class="edit-label">树龄:</span>
  86. <el-input-number
  87. @change="settingSinglePrice"
  88. class="number-input"
  89. :controls="false"
  90. placeholder="请输入树龄"
  91. v-model="settingAge"
  92. :min="0"
  93. />
  94. <span class="unit">年</span>
  95. </div>
  96. <div class="setting-item">
  97. <span class="edit-label">品种:</span>
  98. <el-select
  99. class="blue-select"
  100. v-model="settingPz"
  101. filterable
  102. style="width: 190px"
  103. placeholder="请选择品种"
  104. >
  105. <el-option
  106. v-for="(species, index) in speciesList"
  107. :key="index"
  108. :label="species.name"
  109. :value="species.name"
  110. />
  111. </el-select>
  112. </div>
  113. <div class="setting-item date-picker">
  114. <span class="edit-label">栽种时间:</span>
  115. <!-- <el-input-number @change="settingSinglePrice" class="number-input" :controls="false" v-model="item.total" :min="0" /> -->
  116. <el-date-picker
  117. v-model="plantDate"
  118. type="date"
  119. format="YYYY-MM-DD"
  120. style="width: 190px"
  121. value-format="YYYY-MM-DD"
  122. placeholder="请选择时间"
  123. />
  124. </div>
  125. </div>
  126. <!-- 渐变主色按钮 -->
  127. <div class="btn-group">
  128. <div class="btn cancel-btn">取消</div>
  129. <div class="btn edit-btn" @click="settingForm">确认</div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <!-- 新增客户、编辑客户 -->
  135. <edit-client-popup ref="editClientRef"></edit-client-popup>
  136. </template>
  137. <script setup>
  138. import { ref, computed, onMounted } from "vue";
  139. import { useRouter } from "vue-router";
  140. import editClientPopup from "@/components/editClientPopup.vue";
  141. import { useStore } from "vuex";
  142. import { ElMessage } from "element-plus";
  143. let store = useStore();
  144. const areaVal = ref(0);
  145. const areaOptions = ref([]);
  146. const typeVal = ref(0);
  147. const ageVal = ref(0);
  148. const ageOptions = ref([
  149. { label: "全部树龄", value: 0 },
  150. { label: "0-10年", value: 1 },
  151. { label: "10-20年", value: 2 },
  152. ]);
  153. const currentPage = ref(1);
  154. const pageSize = ref(20); // 每页显示20条数据
  155. const totalVal = ref(0);
  156. const allTrees = ref([]);
  157. const router = useRouter();
  158. function goBack() {
  159. router.go(-1);
  160. }
  161. onMounted(() => {
  162. getSamplePage()
  163. VE_API.manage_interface.speciesList({ farmId: 80865 }).then(({ data }) => {
  164. speciesList.value = data;
  165. });
  166. // 获取区域列表
  167. getBlueRegionList();
  168. })
  169. function getBlueRegionList() {
  170. VE_API.manage_interface.fetchRegionList({ farmId: 766 }).then(({ data }) => {
  171. areaOptions.value = data;
  172. });
  173. }
  174. function handleAreaChange() {
  175. currentPage.value = 1; // 重置页码
  176. getSamplePage();
  177. }
  178. function handleTypeChange() {
  179. currentPage.value = 1; // 重置页码
  180. getSamplePage();
  181. }
  182. function getSamplePage() {
  183. VE_API.manage_interface.fetchSamplePage({farmId: 80865, pz: typeVal.value ? typeVal.value : null, page: currentPage.value, limit: pageSize.value}).then(({data, count}) => {
  184. allTrees.value = data
  185. totalVal.value = count;
  186. })
  187. }
  188. function handleSizeChange(newSize) {
  189. pageSize.value = newSize;
  190. currentPage.value = 1; // 重置页码
  191. getSamplePage();
  192. }
  193. const editClientRef = ref(null);
  194. // 批量编辑
  195. const settingAge = ref(null);
  196. const settingPz = ref(null);
  197. const plantDate = ref(null);
  198. const speciesList = ref([]);
  199. function settingSinglePrice() {
  200. console.log("sss");
  201. }
  202. function settingForm() {
  203. const sampleIds = allTrees.value.map(item => item.sampleId);
  204. const params = {
  205. sampleIds,
  206. farmId: Number(sessionStorage.getItem("currentFarmId")),
  207. age: settingAge.value,
  208. pz: settingPz.value,
  209. plantDate: plantDate.value,
  210. };
  211. VE_API.manage_interface.batchOpenOrCloseSample(params).then(({code}) => {
  212. if (code === 0) {
  213. ElMessage.success("批量设置成功");
  214. getSamplePage();
  215. settingAge.value = null;
  216. settingPz.value = null;
  217. plantDate.value = null;
  218. }
  219. });
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .base-container {
  224. width: 100%;
  225. height: 100%;
  226. color: rgba(0, 0, 0, 0.9);
  227. position: relative;
  228. box-sizing: border-box;
  229. z-index: 1;
  230. .back-icon {
  231. position: absolute;
  232. z-index: 2;
  233. // left: 405px;
  234. right: 503px;
  235. top: 30px;
  236. cursor: pointer;
  237. margin-right: 20px;
  238. height: 40px;
  239. display: flex;
  240. align-items: center;
  241. box-sizing: border-box;
  242. padding: 0 28px;
  243. border: 1px solid rgba(255, 255, 255, 0.78);
  244. background: #2199F8;
  245. border-radius: 4px;
  246. color: #fff;
  247. img {
  248. width: 17px;
  249. margin-right: 10px;
  250. }
  251. }
  252. .custom-content {
  253. width: 100%;
  254. height: calc(100% - 36px);
  255. display: flex;
  256. justify-content: space-between;
  257. box-sizing: border-box;
  258. padding: 16px 20px 0 20px;
  259. .select-wrap {
  260. display: flex;
  261. align-items: center;
  262. .select-item + .select-item {
  263. margin-left: 5px;
  264. }
  265. }
  266. .type-tag {
  267. color: #ffd489;
  268. background: rgba(255, 212, 137, 0.06);
  269. padding: 2px 4px;
  270. font-size: 10px;
  271. margin-left: 4px;
  272. border-radius: 4px;
  273. }
  274. .custom-l {
  275. flex: 1;
  276. width: calc(100% - 473px);
  277. height: 100%;
  278. box-sizing: border-box;
  279. border: 1px solid rgba(0, 0, 0, 0.2);
  280. border-radius: 8px;
  281. padding: 14px 10px 22px 10px;
  282. position: relative;
  283. .box-title {
  284. font-size: 22px;
  285. display: flex;
  286. align-items: center;
  287. font-family: "PangMenZhengDao";
  288. margin-bottom: 16px;
  289. color: #2199F8;
  290. img {
  291. margin-right: 8px;
  292. }
  293. }
  294. .tree-list {
  295. display: flex;
  296. flex-wrap: wrap;
  297. padding-top: 8px;
  298. max-height: calc(100% - 32px - 32px - 52px);
  299. overflow: auto;
  300. }
  301. .pagination-wrap {
  302. position: absolute;
  303. bottom: 12px;
  304. left: 50%;
  305. transform: translateX(-50%);
  306. }
  307. }
  308. .list-item {
  309. background: rgba(120, 120, 120, 0.05);
  310. padding: 8px 10px;
  311. border-radius: 5px;
  312. width: max-content;
  313. display: flex;
  314. justify-content: space-between;
  315. align-items: center;
  316. margin-right: 8px;
  317. margin-top: 12px;
  318. border: 2px solid transparent;
  319. cursor: pointer;
  320. width: calc(25% - 8px);
  321. box-sizing: border-box;
  322. color: #FFFFFF;
  323. &.selected {
  324. background: rgba(33, 153, 248, 0.1);
  325. border-color: #2199F8;
  326. }
  327. &.disabled {
  328. opacity: 0.5;
  329. cursor: not-allowed;
  330. border-color: #ccc !important;
  331. }
  332. &.right-tree-list {
  333. margin-top: 0px;
  334. }
  335. .item-info {
  336. display: flex;
  337. justify-content: space-between;
  338. align-items: center;
  339. }
  340. .tree-icon {
  341. position: relative;
  342. .tree-type-name-tag {
  343. position: absolute;
  344. left: 0;
  345. bottom: 0;
  346. background: rgba(0, 0, 0, 0.6);
  347. border-radius: 0 0 5px 5px;
  348. font-size: 10px;
  349. width: 100%;
  350. text-align: center;
  351. height: 18px;
  352. line-height: 18px;
  353. backdrop-filter: blur(4px);
  354. }
  355. .tree-img {
  356. width: 63px;
  357. height: 63px;
  358. border-radius: 5px;
  359. object-fit: cover;
  360. }
  361. }
  362. .item-center {
  363. flex: 1;
  364. padding-left: 12px;
  365. color: #000000;
  366. .center-t {
  367. font-size: 14px;
  368. }
  369. .center-item {
  370. color: #6c6c6c;
  371. font-size: 12px;
  372. padding-top: 2px;
  373. span {
  374. color: #000000;
  375. }
  376. ::v-deep {
  377. .el-progress-bar__outer {
  378. width: 100px;
  379. background: rgba(242, 243, 245, 0.23);
  380. }
  381. }
  382. }
  383. .age-line {
  384. display: flex;
  385. align-items: center;
  386. padding-top: 4px;
  387. .age-wrap {
  388. display: flex;
  389. align-items: center;
  390. .sort-line {
  391. margin: 0 10px;
  392. height: 10px;
  393. width: 1px;
  394. background: #6C6C6C;
  395. }
  396. }
  397. }
  398. .progress-wrap {
  399. display: flex;
  400. align-items: center;
  401. .progress-text {
  402. font-size: 12px;
  403. color: #999999;
  404. .over {
  405. color: #FFD489;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. .right-tree-list + .right-tree-list {
  412. margin-top: 12px;
  413. }
  414. .p-t-2 {
  415. padding-top: 2px;
  416. }
  417. .custom-r {
  418. width: 473px;
  419. height: 100%;
  420. box-sizing: border-box;
  421. margin-left: 18px;
  422. border: 1px solid rgba(0, 0, 0, 0.2);
  423. border-radius: 8px;
  424. .second-title {
  425. border-radius: 8px 8px 0 0;
  426. color: #2199F8;
  427. font-size: 22px;
  428. padding: 14px 12px;
  429. font-family: "PangMenZhengDao";
  430. }
  431. .user-name {
  432. font-size: 16px;
  433. color: rgba(0, 0, 0, 0.9);
  434. padding-bottom: 12px;
  435. font-weight: 500;
  436. }
  437. .custom-detail {
  438. padding: 0 10px;
  439. height: calc(100% - 60px - 60px);
  440. box-sizing: border-box;
  441. overflow: auto;
  442. position: relative;
  443. .number-input {
  444. // margin: 0 12px;
  445. ::v-deep {
  446. &.el-input-number,
  447. &.el-input {
  448. width: 190px;
  449. background: rgba(33, 153, 248, 0.08);
  450. border: 1px solid #2199f8;
  451. border-radius: 5px;
  452. }
  453. .el-input__wrapper {
  454. background: transparent;
  455. box-shadow: none;
  456. }
  457. .el-input-number.is-without-controls .el-input__wrapper {
  458. padding: 0 8px;
  459. }
  460. .el-input__inner,
  461. .el-input__inner::placeholder {
  462. color: #2199f8;
  463. text-align: center;
  464. }
  465. }
  466. }
  467. .blue-select {
  468. ::v-deep {
  469. .el-select__wrapper {
  470. background: rgba(33, 153, 248, 0.08);
  471. box-shadow: 0 0 0 1px #2199f8 inset;
  472. font-size: 13px;
  473. .el-select__input {
  474. color: #2199f8;
  475. }
  476. .el-select__placeholder {
  477. color: #2199f8;
  478. text-align: center;
  479. }
  480. .el-select__caret {
  481. color: #2199f8;
  482. }
  483. }
  484. }
  485. }
  486. .date-picker {
  487. ::v-deep {
  488. .el-date-editor {
  489. .el-input__wrapper {
  490. background: rgba(33, 153, 248, 0.08);
  491. box-shadow: 0 0 0 1px #2199f8 inset;
  492. }
  493. .el-input__inner,
  494. .el-input__inner::placeholder {
  495. color: #2199f8;
  496. }
  497. .el-input__prefix {
  498. color: #2199f8;
  499. }
  500. }
  501. }
  502. }
  503. .setting-item {
  504. padding-bottom: 16px;
  505. .edit-label {
  506. display: inline-block;
  507. width: 80px;
  508. }
  509. .unit {
  510. padding-left: 4px;
  511. }
  512. }
  513. }
  514. .total {
  515. padding-top: 12px;
  516. }
  517. .main-unit {
  518. color: #F3C11D;
  519. }
  520. .box-line {
  521. width: 100%;
  522. height: 1px;
  523. background: rgba(0, 0, 0, 0.2);
  524. }
  525. .selected-tree {
  526. // display: flex;
  527. margin: 12px 0;
  528. background: rgba(255, 255, 255, 0.04);
  529. padding: 0px 10px 12px 10px;
  530. border-radius: 8px;
  531. // max-height: calc(100% - 64px - 60px);
  532. // overflow: auto;
  533. box-sizing: border-box;
  534. .list-item {
  535. width: 100%;
  536. box-sizing: border-box;
  537. margin-right: 0;
  538. }
  539. }
  540. .selected-tips {
  541. background: rgba(33, 153, 248, 0.1);
  542. border: 1px solid #2199F8;
  543. width: 100%;
  544. text-align: center;
  545. border-radius: 8px;
  546. height: 50px;
  547. line-height: 50px;
  548. color: #2199F8;
  549. box-sizing: border-box;
  550. }
  551. .bottom-btn {
  552. height: 60px;
  553. }
  554. .btn-group {
  555. display: flex;
  556. align-items: center;
  557. justify-content: end;
  558. height: 60px;
  559. border-top: 0.5px solid rgba(0, 0, 0, 0.2);
  560. width: 100%;
  561. padding: 10px 12px;
  562. box-sizing: border-box;
  563. border-radius: 0 0 8px 8px;
  564. .btn {
  565. cursor: pointer;
  566. padding: 8px 44px;
  567. font-size: 16px;
  568. border-radius: 4px;
  569. border: 1px solid #2199F8;
  570. }
  571. .cancel-btn {
  572. color: #2199F8;
  573. }
  574. .edit-btn {
  575. background: #2199F8;
  576. color: #fff;
  577. }
  578. .btn + .btn {
  579. margin-left: 12px;
  580. }
  581. }
  582. }
  583. }
  584. }
  585. </style>