e1accc015d9b8ca7d71975cffe2d22c6c1d1a6ed.svn-base 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5. <a-row>
  6. <a-col :span="12">
  7. <a-form-model-item label="河湖编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hhbm">
  8. <a-input v-model="model.hhbm" placeholder="请输入河湖编码" @blur="locateByGeom"></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="12">
  12. <a-form-model-item label="河湖名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hhmc">
  13. <a-input v-model="model.hhmc" placeholder="请输入河湖名称"></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="12">
  17. <a-form-model-item label="河湖类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hhlx">
  18. <a-input v-model="model.hhlx" placeholder="请输入河湖类型"></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="12">
  22. <a-form-model-item label="县区编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xqbm">
  23. <a-input v-model="model.xqbm" placeholder="请输入县区编码"></a-input>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="12">
  27. <a-form-model-item label="县区名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xqmc">
  28. <a-input v-model="model.xqmc" placeholder="请输入县区名称"></a-input>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="12">
  32. <a-form-model-item label="岸别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zya">
  33. <j-dict-select-tag type="list" v-model="model.zya" dictCode="ab" placeholder="请选择岸别"/>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :span="12">
  37. <a-form-model-item label="功能区类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gnqlx">
  38. <a-input v-model="model.gnqlx" placeholder="请输入功能区类型"></a-input>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="24">
  42. <basic-map height='530px' layersUrl='/resManager.catalog/rescatalog/resList' :legend-img="legendImg"
  43. :model="{...model,layerName:'岸线保护区,岸线保留区,岸线控制利用区,岸线开发利用区'}"></basic-map>
  44. </a-col>
  45. </a-row>
  46. </a-form-model>
  47. </j-form-container>
  48. </a-spin>
  49. </template>
  50. <script>
  51. import {httpAction, getAction} from '@/api/manage'
  52. import {validateDuplicateValue} from '@/utils/util'
  53. import BasicMap from "../../../../../components/BasicMap/BasicMap";
  54. export default {
  55. name: 'RmAxghgnqgeoForm',
  56. components: {
  57. BasicMap
  58. },
  59. props: {
  60. //表单禁用
  61. disabled: {
  62. type: Boolean,
  63. default: false,
  64. required: false
  65. }
  66. },
  67. data() {
  68. return {
  69. model: {},
  70. labelCol: {
  71. xs: {span: 24},
  72. sm: {span: 5},
  73. },
  74. wrapperCol: {
  75. xs: {span: 24},
  76. sm: {span: 16},
  77. },
  78. confirmLoading: false,
  79. validatorRules: {},
  80. url: {
  81. add: "/hzz.axgh.axghgnq/rmAxghgnqgeo/add",
  82. edit: "/hzz.axgh.axghgnq/rmAxghgnqgeo/edit",
  83. queryById: "/hzz.axgh.axghgnq/rmAxghgnqgeo/queryById"
  84. },
  85. legendImg:require('@/assets/angnq_legend.png')
  86. }
  87. },
  88. computed: {
  89. formDisabled() {
  90. return this.disabled
  91. },
  92. },
  93. created() {
  94. //备份model原始值
  95. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  96. },
  97. methods: {
  98. add() {
  99. this.edit(this.modelDefault);
  100. },
  101. edit(record) {
  102. this.model = Object.assign({}, record);
  103. this.visible = true;
  104. },
  105. submitForm() {
  106. const that = this;
  107. // 触发表单验证
  108. this.$refs.form.validate(valid => {
  109. if (valid) {
  110. that.confirmLoading = true;
  111. let httpurl = '';
  112. let method = '';
  113. if (!this.model.id) {
  114. httpurl += this.url.add;
  115. method = 'post';
  116. } else {
  117. httpurl += this.url.edit;
  118. //method = 'put';
  119. method = 'post';
  120. }
  121. httpAction(httpurl, this.model, method).then((res) => {
  122. if (res.success) {
  123. that.$message.success(res.message);
  124. that.$emit('ok');
  125. } else {
  126. that.$message.warning(res.message);
  127. }
  128. }).finally(() => {
  129. that.confirmLoading = false;
  130. })
  131. }
  132. })
  133. },
  134. locateByGeom() {
  135. let id = this.model.id;
  136. let url = "/hzz.axgh.axghgnq/rmAxghgnqgeo/getGeojsonById"
  137. getAction(url, {
  138. id: id
  139. }).then(res => {
  140. if (res.success) {
  141. this.$refs.locMap.locateByGeometry(res.result);
  142. }
  143. })
  144. }
  145. },
  146. mounted() {
  147. /* let that = this;
  148. this.$nextTick(function () {
  149. that.locateByGeom();
  150. })*/
  151. }
  152. }
  153. </script>