6c6edca3e712efc890d10bc2faaaee132ad4e3f2.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="hhbm">
  8. <a-input v-model="model.hhbm" placeholder="请输入河湖编码"></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="河湖类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hhlx">
  13. <a-input v-model="model.hhlx" placeholder="请输入河湖类型"></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="河湖名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hhmc">
  18. <a-input v-model="model.hhmc" placeholder="请输入河湖名称"></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="24">
  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="24">
  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="24">
  32. <a-form-model-item label="岸别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zya">
  33. <!-- <a-input v-model="model.zya" placeholder="请输入左右岸"></a-input>-->
  34. <j-dict-select-tag type="list" v-model="model.zya" dictCode="ab" placeholder="请选择岸别"/>
  35. </a-form-model-item>
  36. </a-col>
  37. </a-row>
  38. </a-form-model>
  39. </j-form-container>
  40. </a-spin>
  41. </template>
  42. <script>
  43. import {httpAction, getAction} from '@/api/manage'
  44. import {validateDuplicateValue} from '@/utils/util'
  45. export default {
  46. name: 'LskzxForm',
  47. props: {
  48. //表单禁用
  49. disabled: {
  50. type: Boolean,
  51. default: false,
  52. required: false
  53. }
  54. },
  55. data() {
  56. return {
  57. model: {},
  58. labelCol: {
  59. xs: {span: 24},
  60. sm: {span: 6},
  61. },
  62. wrapperCol: {
  63. xs: {span: 24},
  64. sm: {span: 15},
  65. },
  66. confirmLoading: false,
  67. validatorRules: {},
  68. url: {
  69. add: "/hzz.axgh.axghgnq/lskzx/add",
  70. edit: "/hzz.axgh.axghgnq/lskzx/edit",
  71. queryById: "/hzz.axgh.axghgnq/lskzx/queryById"
  72. }
  73. }
  74. },
  75. computed: {
  76. formDisabled() {
  77. return this.disabled
  78. },
  79. },
  80. created() {
  81. //备份model原始值
  82. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  83. },
  84. methods: {
  85. add() {
  86. this.edit(this.modelDefault);
  87. },
  88. edit(record) {
  89. this.model = Object.assign({}, record);
  90. this.visible = true;
  91. },
  92. submitForm() {
  93. const that = this;
  94. // 触发表单验证
  95. this.$refs.form.validate(valid => {
  96. if (valid) {
  97. that.confirmLoading = true;
  98. let httpurl = '';
  99. let method = '';
  100. if (!this.model.id) {
  101. httpurl += this.url.add;
  102. method = 'post';
  103. } else {
  104. httpurl += this.url.edit;
  105. //method = 'put';
  106. method = 'post';
  107. }
  108. httpAction(httpurl, this.model, method).then((res) => {
  109. if (res.success) {
  110. that.$message.success(res.message);
  111. that.$emit('ok');
  112. } else {
  113. that.$message.warning(res.message);
  114. }
  115. }).finally(() => {
  116. that.confirmLoading = false;
  117. })
  118. }
  119. })
  120. }
  121. }
  122. }
  123. </script>