522d4c492cb6aa322838aa8b62e2a6133ccb8b0d.svn-base 2.6 KB

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