editPlan.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="edit-plan">
  3. <custom-header name="查看详情"></custom-header>
  4. <div class="edit-plan-content" v-if="contentData && Object.keys(contentData).length > 0">
  5. <record-item :record-item-data="contentData.farmWorkLib" title-mode="default" class="recipe-item" />
  6. <prescription-table
  7. v-if="contentData?.prescription"
  8. :prescription-list="[contentData?.prescription]"
  9. :usage-mode="contentData?.prescription?.usageMode"
  10. :attention="contentData?.attention"
  11. ></prescription-table>
  12. </div>
  13. <div class="custom-bottom-fixed-btns">
  14. <div class="bottom-btn secondary-btn" @click="deletePrescription">删除方案</div>
  15. <div class="bottom-btn primary-btn" @click="editPrice">编辑方案</div>
  16. </div>
  17. </div>
  18. </template>
  19. <script setup>
  20. import customHeader from "@/components/customHeader.vue";
  21. import recordItem from "@/components/recordItem.vue";
  22. import prescriptionTable from "@/views/old_mini/agri_work/components/prescriptionTable.vue";
  23. import { ref, onMounted } from "vue";
  24. import { ElMessageBox } from "element-plus";
  25. import { useRouter, useRoute } from "vue-router";
  26. const router = useRouter();
  27. const route = useRoute();
  28. onMounted(() => {
  29. // const data = JSON.parse(route.query.data);
  30. // console.log('data', data);
  31. // contentData.value = data;
  32. const arrangeId = route.query.arrangeId;
  33. if (arrangeId) {
  34. getArrangeDetail(arrangeId);
  35. }
  36. });
  37. const getArrangeDetail = (arrangeId) => {
  38. VE_API.container_farm_work_arrange.getComposite({ arrangeId }).then(({ data }) => {
  39. contentData.value = data;
  40. });
  41. };
  42. const deletePrescription = () => {
  43. ElMessageBox.confirm("确认要删除该处方吗?", "提示", {
  44. confirmButtonText: "确认",
  45. cancelButtonText: "取消",
  46. type: "warning",
  47. })
  48. .then(() => {
  49. console.log("删除成功");
  50. })
  51. .catch(() => {
  52. console.log("取消删除");
  53. });
  54. };
  55. const editPrice = () => {
  56. router.push({
  57. path: "/modify_plan",
  58. query: { arrangeId: contentData.value.arrange.id, isEdit: true },
  59. });
  60. };
  61. const contentData = ref({});
  62. </script>
  63. <style scoped lang="scss">
  64. .edit-plan {
  65. width: 100%;
  66. height: 100vh;
  67. background: #f2f3f5;
  68. .edit-plan-content {
  69. padding: 12px;
  70. height: calc(100% - 40px - 82px);
  71. overflow: auto;
  72. .record-item {
  73. margin: 0;
  74. }
  75. .farm-table {
  76. margin-top: 10px;
  77. }
  78. }
  79. }
  80. </style>