3a0f2d2ed15e9f613ad2007b9afa7c3059c0cccc.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. switchFullscreen
  8. @ok="handleOk"
  9. @cancel="handleCancel"
  10. cancelText="关闭">
  11. <a-spin :spinning="confirmLoading">
  12. <a-form-model ref="form" :model="model" :rules="validatorRules">
  13. <a-row>
  14. <a-col :span="24">
  15. <a-form-model-item label="行政区划" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xzqh">
  16. <a-input v-model="model.xzqh"placeholder="请输入行政区划" ></a-input>
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :span="24">
  20. <a-form-model-item label="下一级河长名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xyjhzmc">
  21. <a-input v-model="model.xyjhzmc"placeholder="请输入下一级河长名称" ></a-input>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :span="24">
  25. <a-form-model-item label="下一级河长(姓名/职务)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xyjhzxmzw">
  26. <a-input v-model="model.xyjhzxmzw"placeholder="请输入下一级河长(姓名/职务)" ></a-input>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :span="24">
  30. <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bz">
  31. <a-input v-model="model.bz"placeholder="请输入备注" ></a-input>
  32. </a-form-model-item>
  33. </a-col>
  34. </a-row>
  35. </a-form-model>
  36. </a-spin>
  37. </j-modal>
  38. </template>
  39. <script>
  40. import { httpAction } from '@/api/manage'
  41. import { validateDuplicateValue } from '@/utils/util'
  42. export default {
  43. name: "RmMbfjbModal",
  44. components: {
  45. },
  46. props:{
  47. mainId:{
  48. type:String,
  49. required:false,
  50. default:''
  51. }
  52. },
  53. data () {
  54. return {
  55. title:"操作",
  56. width:800,
  57. visible: false,
  58. model:{
  59. },
  60. labelCol: {
  61. xs: { span: 24 },
  62. sm: { span: 5 },
  63. },
  64. wrapperCol: {
  65. xs: { span: 24 },
  66. sm: { span: 16 },
  67. },
  68. confirmLoading: false,
  69. validatorRules: {
  70. },
  71. url: {
  72. add: "/hzz.yhyc/rmJbxx/addRmMbfjb",
  73. edit: "/hzz.yhyc/rmJbxx/editRmMbfjb",
  74. }
  75. }
  76. },
  77. created () {
  78. //备份model原始值
  79. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  80. },
  81. methods: {
  82. add () {
  83. this.edit(this.modelDefault);
  84. },
  85. edit (record) {
  86. this.model = Object.assign({}, record);
  87. this.visible = true;
  88. },
  89. close () {
  90. this.$emit('close');
  91. this.visible = false;
  92. this.$refs.form.clearValidate();
  93. },
  94. handleOk () {
  95. const that = this;
  96. // 触发表单验证
  97. this.$refs.form.validate(valid => {
  98. if (valid) {
  99. that.confirmLoading = true;
  100. let httpurl = '';
  101. let method = '';
  102. if(!this.model.id){
  103. httpurl+=this.url.add;
  104. method = 'post';
  105. }else{
  106. httpurl+=this.url.edit;
  107. //method = 'put';
  108. method = 'post';
  109. }
  110. this.model['mainId'] = this.mainId
  111. httpAction(httpurl,this.model,method).then((res)=>{
  112. if(res.success){
  113. that.$message.success(res.message);
  114. that.$emit('ok');
  115. }else{
  116. that.$message.warning(res.message);
  117. }
  118. }).finally(() => {
  119. that.confirmLoading = false;
  120. that.close();
  121. })
  122. }else{
  123. return false
  124. }
  125. })
  126. },
  127. handleCancel () {
  128. this.close()
  129. },
  130. }
  131. }
  132. </script>