bcee92a4b5cfa91dd379ea45eb47c735e0a1f6e7.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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="gkxl">
  16. <a-input v-model="model.gkxl"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="zsb">
  21. <a-input v-model="model.zsb"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="ysgdjfw">
  26. <a-input-number v-model="model.ysgdjfw"placeholder="请输入壅水高度及范围" style="width: 100%" />
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :span="24">
  30. <a-form-model-item label="冲淤情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cyqk">
  31. <a-input v-model="model.cyqk"placeholder="请输入冲淤情况" ></a-input>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :span="24">
  35. <a-form-model-item label="影响情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yxqk">
  36. <a-input v-model="model.yxqk"placeholder="请输入影响情况" ></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :span="24">
  40. <a-form-model-item label="措施" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cs">
  41. <a-input v-model="model.cs"placeholder="请输入措施" ></a-input>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :span="24">
  45. <a-form-model-item label="其他" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qt">
  46. <a-input v-model="model.qt"placeholder="请输入其他" ></a-input>
  47. </a-form-model-item>
  48. </a-col>
  49. </a-row>
  50. </a-form-model>
  51. </a-spin>
  52. </j-modal>
  53. </template>
  54. <script>
  55. import { httpAction } from '@/api/manage'
  56. import { validateDuplicateValue } from '@/utils/util'
  57. export default {
  58. name: "RmAxfxjszycgbModal",
  59. components: {
  60. },
  61. props:{
  62. mainId:{
  63. type:String,
  64. required:false,
  65. default:''
  66. }
  67. },
  68. data () {
  69. return {
  70. title:"操作",
  71. width:800,
  72. visible: false,
  73. model:{
  74. },
  75. labelCol: {
  76. xs: { span: 24 },
  77. sm: { span: 5 },
  78. },
  79. wrapperCol: {
  80. xs: { span: 24 },
  81. sm: { span: 16 },
  82. },
  83. confirmLoading: false,
  84. validatorRules: {
  85. },
  86. url: {
  87. add: "/hzz.axgh.axzyxm/rmAxzyxmb/addRmAxfxjszycgb",
  88. edit: "/hzz.axgh.axzyxm/rmAxzyxmb/editRmAxfxjszycgb",
  89. }
  90. }
  91. },
  92. created () {
  93. //备份model原始值
  94. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  95. },
  96. methods: {
  97. add () {
  98. this.edit(this.modelDefault);
  99. },
  100. edit (record) {
  101. this.model = Object.assign({}, record);
  102. this.visible = true;
  103. },
  104. close () {
  105. this.$emit('close');
  106. this.visible = false;
  107. this.$refs.form.clearValidate();
  108. },
  109. handleOk () {
  110. const that = this;
  111. // 触发表单验证
  112. this.$refs.form.validate(valid => {
  113. if (valid) {
  114. that.confirmLoading = true;
  115. let httpurl = '';
  116. let method = '';
  117. if(!this.model.id){
  118. httpurl+=this.url.add;
  119. method = 'post';
  120. }else{
  121. httpurl+=this.url.edit;
  122. method = 'post';
  123. }
  124. this.model['mainId'] = this.mainId
  125. httpAction(httpurl,this.model,method).then((res)=>{
  126. if(res.success){
  127. that.$message.success(res.message);
  128. that.$emit('ok');
  129. }else{
  130. that.$message.warning(res.message);
  131. }
  132. }).finally(() => {
  133. that.confirmLoading = false;
  134. that.close();
  135. })
  136. }else{
  137. return false
  138. }
  139. })
  140. },
  141. handleCancel () {
  142. this.close()
  143. },
  144. }
  145. }
  146. </script>