2f3031007d029db06cff5bcc29cc7fb75213154c.svn-base 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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="24">
  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="false"
  15. @input="popupCallback"
  16. />
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :span="24">
  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="24">
  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="24">
  30. <a-form-model-item label="道路名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dlmc">
  31. <a-input v-model="model.dlmc" placeholder="请输入道路名称"></a-input>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :span="24">
  35. <a-form-model-item label="道路级别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dljb">
  36. <a-input v-model="model.dljb" placeholder="请输入道路级别"></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :span="24">
  40. <a-form-model-item label="道路长度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dlcd">
  41. <a-input v-model="model.dlcd" placeholder="请输入道路长度" style="width: 100%"/>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :span="24">
  45. <a-form-model-item label="道路宽度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dlkd">
  46. <a-input v-model="model.dlkd" placeholder="请输入道路宽度" style="width: 100%"/>
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :span="24">
  50. <a-form-model-item label="导入矢量数据" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="geopath">
  51. <j-upload v-model="model.geopath" biz-path="hzz"></j-upload>
  52. </a-form-model-item>
  53. </a-col>
  54. </a-row>
  55. </a-form-model>
  56. </j-form-container>
  57. </a-spin>
  58. </template>
  59. <script>
  60. import {httpAction, getAction} from '@/api/manage'
  61. import {validateDuplicateValue} from '@/utils/util'
  62. export default {
  63. name: 'RmYhdlForm',
  64. components: {},
  65. props: {
  66. //表单禁用
  67. disabled: {
  68. type: Boolean,
  69. default: false,
  70. required: false
  71. }
  72. },
  73. data() {
  74. return {
  75. model: {},
  76. labelCol: {
  77. xs: {span: 24},
  78. sm: {span: 5},
  79. },
  80. wrapperCol: {
  81. xs: {span: 24},
  82. sm: {span: 16},
  83. },
  84. confirmLoading: false,
  85. validatorRules: {},
  86. url: {
  87. add: "/hzz.axgh.yhdl/rmYhdl/add",
  88. edit: "/hzz.axgh.yhdl/rmYhdl/edit",
  89. queryById: "/hzz.axgh.yhdl/rmYhdl/queryById"
  90. }
  91. }
  92. },
  93. computed: {
  94. formDisabled() {
  95. return this.disabled
  96. },
  97. },
  98. created() {
  99. //备份model原始值
  100. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  101. },
  102. methods: {
  103. add() {
  104. this.edit(this.modelDefault);
  105. },
  106. edit(record) {
  107. this.model = Object.assign({}, record);
  108. this.visible = true;
  109. },
  110. submitForm() {
  111. const that = this;
  112. // 触发表单验证
  113. this.$refs.form.validate(valid => {
  114. if (valid) {
  115. that.confirmLoading = true;
  116. let httpurl = '';
  117. let method = '';
  118. if (!this.model.id) {
  119. httpurl += this.url.add;
  120. method = 'post';
  121. } else {
  122. httpurl += this.url.edit;
  123. // method = 'put';
  124. method = 'post';
  125. }
  126. httpAction(httpurl, this.model, method).then((res) => {
  127. if (res.success) {
  128. that.$message.success(res.message);
  129. that.$emit('ok');
  130. } else {
  131. that.$message.warning(res.message);
  132. }
  133. }).finally(() => {
  134. that.confirmLoading = false;
  135. })
  136. }
  137. })
  138. },
  139. popupCallback(value, row) {
  140. this.model = Object.assign(this.model, row);
  141. },
  142. }
  143. }
  144. </script>