details.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div class="conViews">
  3. <div class="sm-panel sm-function-module-query" v-drag v-if="isShallow">
  4. <div class="sm-panel-header">
  5. <span> {{ type == "耕地" ? "新增耕地地块详情" : "项目详情" }} </span>
  6. <i class="el-icon-close" @click="closeInster"></i>
  7. </div>
  8. <el-tabs type="border-card" class="xz_box" v-model="activeTabs" stretch>
  9. <el-tab-pane label="基本信息" name="jbxx">
  10. <Info
  11. :data="jbxxData"
  12. :cellClass="cellClass"
  13. @Rowclicked="Rowclicked"
  14. ></Info>
  15. </el-tab-pane>
  16. <!-- <el-tab-pane label="进度跟踪" name="rdxx" v-if="type != '耕地'">
  17. </el-tab-pane> -->
  18. </el-tabs>
  19. </div>
  20. <el-dialog
  21. title="图斑信息"
  22. width="40%"
  23. :visible.sync="dialogVisible"
  24. :before-close="close"
  25. :modal-append-to-body="false"
  26. :close-on-click-modal="false"
  27. >
  28. <CustomDetails :model="formData" :config="datainfo" class="CustomDetails">
  29. <template #xmmc>
  30. <span class="usable" @click="go"> {{ formData["项目名称"] }}</span>
  31. </template>
  32. </CustomDetails>
  33. </el-dialog>
  34. </div>
  35. </template>
  36. <script>
  37. import { GetDetail } from "@/api/Idleland.js";
  38. import Info from "../../Idleland/components/info.vue";
  39. import CustomDetails from "@/components/mapView/custom-detailsInfo.vue";
  40. import { getXmList, getXm } from "@/api/stxf/tdzz.js";
  41. import { detailInfos, tbInfos, xzgdInfos } from "./config";
  42. export default {
  43. props: {
  44. interObj: {
  45. type: Object,
  46. },
  47. },
  48. components: { Info, CustomDetails },
  49. data() {
  50. return {
  51. activeTabs: "jbxx",
  52. isShallow: false,
  53. jbxxData: [],
  54. rdData: [],
  55. formData: {},
  56. datainfo: tbInfos,
  57. tempdataLayerId: null,
  58. dialogVisible: false,
  59. type: "",
  60. };
  61. },
  62. mounted() {
  63. // this.init();
  64. },
  65. methods: {
  66. //关闭详情
  67. closeInster() {
  68. this.isShallow = false;
  69. this.$emit('closeInster')
  70. },
  71. close() {
  72. this.dialogVisible = false;
  73. },
  74. handleView(val, type) {
  75. this.type = type;
  76. (this.activeTabs = "jbxx"), (this.jbxxData = []);
  77. if (type == "整治图斑") {
  78. this.dialogVisible = true;
  79. this.formData = val;
  80. } else if (type == "整治项目") {
  81. this.isShallow = true;
  82. getXm(val.id).then((res) => {
  83. if (res.code == 200) {
  84. // Object.keys(res.data).forEach((key) => {
  85. // this.jbxxData.push({ name: key, value: res.data[key] });
  86. // });
  87. this.formData = res.data;
  88. detailInfos.forEach((key) => {
  89. let unit = res.data[key.unitpro] || key.unit || "";
  90. this.jbxxData.push({
  91. name: key.name,
  92. value: (res.data[key.value] || "——") + unit,
  93. });
  94. });
  95. } else {
  96. this.$message.error(res.message);
  97. }
  98. });
  99. } else {
  100. this.isShallow = true;
  101. xzgdInfos.forEach((key) => {
  102. this.jbxxData.push({ name: key.name, value: val[key.value] });
  103. });
  104. }
  105. },
  106. go() {
  107. this.handleView({ id: this.formData.pid }, "整治项目");
  108. },
  109. cellClass({ row, column, rowIndex, columnIndex }) {
  110. if (row.name == "新增耕地") {
  111. return "usable";
  112. } else {
  113. return "";
  114. }
  115. },
  116. Rowclicked(row, column, event) {
  117. if (row.name == "新增耕地") {
  118. this.closeInster();
  119. this.close();
  120. this.$emit("goxzgd", this.formData);
  121. }
  122. },
  123. },
  124. mounted() {},
  125. watch: {},
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .sm-panel {
  130. width: 400px;
  131. max-width: 400px;
  132. /deep/ .el-icon-close:before {
  133. position: absolute;
  134. top: 10px;
  135. right: 10px;
  136. font-size: larger;
  137. font-weight: bold;
  138. &:hover {
  139. color: aqua;
  140. }
  141. }
  142. }
  143. .sm-function-module-query {
  144. max-height: 800px !important;
  145. top: 28px !important;
  146. }
  147. .CustomDetails {
  148. height: 500px;
  149. overflow-y: auto;
  150. overflow-x: hidden;
  151. }
  152. </style>