bd1c596ee4f30bfdefca8d357e9a4311190f1e9f.svn-base 4.6 KB

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