0d6673bf2784b1438584ac143e7750ab434e4dcc.svn-base 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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="geom" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="geom">
  8. <a-input v-model="model.geom" placeholder="请输入geom" ></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="szbm" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="szbm">
  13. <a-input v-model="model.szbm" placeholder="请输入szbm" ></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. </a-row>
  17. </a-form-model>
  18. </j-form-container>
  19. </a-spin>
  20. </template>
  21. <script>
  22. import { httpAction, getAction } from '@/api/manage'
  23. import { validateDuplicateValue } from '@/utils/util'
  24. export default {
  25. name: 'RmZbgcgeoForm',
  26. components: {
  27. },
  28. props: {
  29. //表单禁用
  30. disabled: {
  31. type: Boolean,
  32. default: false,
  33. required: false
  34. }
  35. },
  36. data () {
  37. return {
  38. model:{
  39. },
  40. labelCol: {
  41. xs: { span: 24 },
  42. sm: { span: 5 },
  43. },
  44. wrapperCol: {
  45. xs: { span: 24 },
  46. sm: { span: 16 },
  47. },
  48. confirmLoading: false,
  49. validatorRules: {
  50. },
  51. url: {
  52. add: "/hzz.shjsgc.zbgc.geo/rmZbgcgeo/add",
  53. edit: "/hzz.shjsgc.zbgc.geo/rmZbgcgeo/edit",
  54. queryById: "/hzz.shjsgc.zbgc.geo/rmZbgcgeo/queryById"
  55. }
  56. }
  57. },
  58. computed: {
  59. formDisabled(){
  60. return this.disabled
  61. },
  62. },
  63. created () {
  64. //备份model原始值
  65. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  66. },
  67. methods: {
  68. add () {
  69. this.edit(this.modelDefault);
  70. },
  71. edit (record) {
  72. this.model = Object.assign({}, record);
  73. this.visible = true;
  74. },
  75. submitForm () {
  76. const that = this;
  77. // 触发表单验证
  78. this.$refs.form.validate(valid => {
  79. if (valid) {
  80. that.confirmLoading = true;
  81. let httpurl = '';
  82. let method = '';
  83. if(!this.model.id){
  84. httpurl+=this.url.add;
  85. method = 'post';
  86. }else{
  87. httpurl+=this.url.edit;
  88. //method = 'put';
  89. method = 'post';
  90. }
  91. httpAction(httpurl,this.model,method).then((res)=>{
  92. if(res.success){
  93. that.$message.success(res.message);
  94. that.$emit('ok');
  95. }else{
  96. that.$message.warning(res.message);
  97. }
  98. }).finally(() => {
  99. that.confirmLoading = false;
  100. })
  101. }
  102. })
  103. },
  104. }
  105. }
  106. </script>