074bf6a554e321b421458ce694ea530001d75b66.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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="hhmc">
  13. <a-input v-model="model.hhmc" 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="hhlx">
  18. <a-input v-model="model.hhlx" 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: 'WykzxForm',
  47. components: {},
  48. props: {
  49. //表单禁用
  50. disabled: {
  51. type: Boolean,
  52. default: false,
  53. required: false
  54. }
  55. },
  56. data() {
  57. return {
  58. model: {},
  59. labelCol: {
  60. xs: {span: 24},
  61. sm: {span: 6},
  62. },
  63. wrapperCol: {
  64. xs: {span: 24},
  65. sm: {span: 15},
  66. },
  67. confirmLoading: false,
  68. validatorRules: {},
  69. url: {
  70. add: "/hzz.axgh.axghgnq/wykzx/list_wy/add",
  71. edit: "/hzz.axgh.axghgnq/wykzx/list_wy/edit",
  72. queryById: "/hzz.axgh.axghgnq/wykzx/list_wy/queryById"
  73. }
  74. }
  75. },
  76. computed: {
  77. formDisabled() {
  78. return this.disabled
  79. },
  80. },
  81. created() {
  82. //备份model原始值
  83. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  84. },
  85. methods: {
  86. add() {
  87. this.edit(this.modelDefault);
  88. },
  89. edit(record) {
  90. this.model = Object.assign({}, record);
  91. this.visible = true;
  92. },
  93. submitForm() {
  94. const that = this;
  95. // 触发表单验证
  96. this.$refs.form.validate(valid => {
  97. if (valid) {
  98. that.confirmLoading = true;
  99. let httpurl = '';
  100. let method = '';
  101. if (!this.model.id) {
  102. httpurl += this.url.add;
  103. method = 'post';
  104. } else {
  105. httpurl += this.url.edit;
  106. //method = 'put';
  107. method = 'post';
  108. }
  109. httpAction(httpurl, this.model, method).then((res) => {
  110. if (res.success) {
  111. that.$message.success(res.message);
  112. that.$emit('ok');
  113. } else {
  114. that.$message.warning(res.message);
  115. }
  116. }).finally(() => {
  117. that.confirmLoading = false;
  118. })
  119. }
  120. })
  121. }
  122. }
  123. }
  124. </script>