d967939ca34e7da4a36da498aaf300116d6f3406.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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="hlmc">
  8. <j-popup
  9. v-model="model.hlmc"
  10. field="hlmc"
  11. org-fields="hlmc,hlbm"
  12. dest-fields="hlmc,hlbm"
  13. code="hllist"
  14. :multi="true"
  15. @input="popupCallback"
  16. />
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :span="12">
  20. <a-form-model-item label="河流编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hlbm">
  21. <a-input v-model="model.hlbm" placeholder="请输入河流编码"></a-input>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :span="12">
  25. <a-form-model-item label="岸别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ab">
  26. <j-dict-select-tag type="list" v-model="model.ab" dictCode="ab" placeholder="请选择岸别"/>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :span="12">
  30. <a-form-model-item label="岸线长度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="axcd">
  31. <a-input-number v-model="model.axcd" placeholder="请输入岸线长度" style="width: 100%" disabled/>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :span="12">
  35. <a-form-model-item label="岸线宽度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="axkd">
  36. <a-input-number v-model="model.axkd" placeholder="请输入岸线宽度" style="width: 100%"/>
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :span="12">
  40. <a-form-model-item label="岸线面积" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="axmj">
  41. <a-input-number v-model="model.axmj" placeholder="请输入岸线面积" style="width: 100%"/>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :span="12">
  45. <a-form-model-item label="导入矢量数据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="geopath">
  46. <j-upload v-model="model.geopath"></j-upload>
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :span="12">
  50. <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="标绘" prop="geoinfo">
  51. <a-input v-model="model.geoinfo" placeholder="请点击地图标绘" style="width: 100%" disabled/>
  52. <a-button type="primary" @click="showModal">
  53. 地图标绘
  54. </a-button>
  55. <a-modal
  56. title="地图标绘"
  57. :visible="mapVisible"
  58. :confirm-loading="confirmLoading"
  59. @ok="handleOk"
  60. @cancel="handleCancel"
  61. width="1600px"
  62. >
  63. <basic-map v-model="geoinfo" style="line-height: 20px" height='600px'
  64. layersUrl='/resManager.catalog/rescatalog/resList' toolbar :model="model"
  65. :tools="['isDraw']"></basic-map>
  66. </a-modal>
  67. </a-form-model-item>
  68. </a-col>
  69. </a-row>
  70. </a-form-model>
  71. </j-form-container>
  72. </a-spin>
  73. </template>
  74. <script>
  75. import {httpAction, getAction} from '@/api/manage'
  76. import {validateDuplicateValue} from '@/utils/util'
  77. import BasicMap from "../../../../../components/BasicMap/BasicMap";
  78. export default {
  79. name: 'RmHdzraxbylForm',
  80. components: {
  81. BasicMap
  82. },
  83. props: {
  84. //表单禁用
  85. disabled: {
  86. type: Boolean,
  87. default: false,
  88. required: false
  89. }
  90. },
  91. data() {
  92. return {
  93. mapVisible: false,
  94. mapConfirmLoading: false,
  95. geoinfo: "",
  96. model: {},
  97. labelCol: {
  98. xs: {span: 24},
  99. sm: {span: 5},
  100. },
  101. wrapperCol: {
  102. xs: {span: 24},
  103. sm: {span: 16},
  104. },
  105. confirmLoading: false,
  106. validatorRules: {},
  107. url: {
  108. add: "/hzz.axgh.hdzraxbyl/rmHdzraxbyl/add",
  109. edit: "/hzz.axgh.hdzraxbyl/rmHdzraxbyl/edit",
  110. queryById: "/hzz.axgh.hdzraxbyl/rmHdzraxbyl/queryById"
  111. }
  112. }
  113. },
  114. computed: {
  115. formDisabled() {
  116. return this.disabled
  117. },
  118. },
  119. created() {
  120. //备份model原始值
  121. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  122. },
  123. methods: {
  124. showModal() {
  125. this.mapVisible = true;
  126. },
  127. handleOk(e) {
  128. this.mapConfirmLoading = true;
  129. this.model.geoinfo = JSON.stringify(this.geoinfo);
  130. setTimeout(() => {
  131. this.mapVisible = false;
  132. this.mapConfirmLoading = false;
  133. }, 200);
  134. },
  135. handleCancel(e) {
  136. this.mapVisible = false;
  137. },
  138. add() {
  139. this.edit(this.modelDefault);
  140. },
  141. edit(record) {
  142. this.model = Object.assign({}, record);
  143. this.visible = true;
  144. },
  145. submitForm() {
  146. const that = this;
  147. // 触发表单验证
  148. this.$refs.form.validate(valid => {
  149. if (valid) {
  150. that.confirmLoading = true;
  151. let httpurl = '';
  152. let method = '';
  153. if (!this.model.id) {
  154. httpurl += this.url.add;
  155. method = 'post';
  156. } else {
  157. httpurl += this.url.edit;
  158. method = 'post';
  159. }
  160. httpAction(httpurl, this.model, method).then((res) => {
  161. if (res.success) {
  162. that.$message.success(res.message);
  163. that.$emit('ok');
  164. } else {
  165. that.$message.warning(res.message);
  166. }
  167. }).finally(() => {
  168. that.confirmLoading = false;
  169. })
  170. }
  171. })
  172. },
  173. popupCallback(value, row) {
  174. this.model = Object.assign(this.model, row);
  175. },
  176. }
  177. }
  178. </script>