0726a481f3bbb8673312e627943e929329e839a1.svn-base 5.1 KB

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