8f42eb0408f158845a701bd18364c34ed6dfdec2.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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="jd">
  16. <a-input v-model="model.jd"placeholder="请输入经度" style="width: 100%" />
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :span="24">
  20. <a-form-model-item label="纬度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="wd">
  21. <a-input v-model="model.wd"placeholder="请输入纬度" style="width: 100%" />
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :span="24">
  25. <a-form-model-item label="照片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zp">
  26. <j-image-upload isMultiple v-model="model.zp"></j-image-upload>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :span="24">
  30. <a-form-model-item label="采集描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cjms">
  31. <a-input v-model="model.cjms"placeholder="请输入采集描述" ></a-input>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :span="24">
  35. <a-form-model-item label="采集id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cjid">
  36. <a-input v-model="model.cjid"placeholder="请输入采集id" ></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. </a-row>
  40. </a-form-model>
  41. </a-spin>
  42. </j-modal>
  43. </template>
  44. <script>
  45. import { httpAction } from '@/api/manage'
  46. import { validateDuplicateValue } from '@/utils/util'
  47. export default {
  48. name: "RmCjxxmxModal",
  49. components: {
  50. },
  51. props:{
  52. mainId:{
  53. type:String,
  54. required:false,
  55. default:''
  56. }
  57. },
  58. data () {
  59. return {
  60. title:"操作",
  61. width:800,
  62. visible: false,
  63. model:{
  64. },
  65. labelCol: {
  66. xs: { span: 24 },
  67. sm: { span: 5 },
  68. },
  69. wrapperCol: {
  70. xs: { span: 24 },
  71. sm: { span: 16 },
  72. },
  73. confirmLoading: false,
  74. validatorRules: {
  75. },
  76. url: {
  77. add: "/hzz.xxcj/rmXxcj/addRmCjxxmx",
  78. edit: "/hzz.xxcj/rmXxcj/editRmCjxxmx",
  79. }
  80. }
  81. },
  82. created () {
  83. //备份model原始值
  84. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  85. },
  86. methods: {
  87. add () {
  88. this.edit(this.modelDefault);
  89. },
  90. edit (record) {
  91. this.model = Object.assign({}, record);
  92. this.visible = true;
  93. },
  94. close () {
  95. this.$emit('close');
  96. this.visible = false;
  97. this.$refs.form.clearValidate();
  98. },
  99. handleOk () {
  100. const that = this;
  101. // 触发表单验证
  102. this.$refs.form.validate(valid => {
  103. if (valid) {
  104. that.confirmLoading = true;
  105. let httpurl = '';
  106. let method = '';
  107. if(!this.model.id){
  108. httpurl+=this.url.add;
  109. method = 'post';
  110. }else{
  111. httpurl+=this.url.edit;
  112. //method = 'put';
  113. method = 'post';
  114. }
  115. this.model['cjid'] = this.mainId
  116. httpAction(httpurl,this.model,method).then((res)=>{
  117. if(res.success){
  118. that.$message.success(res.message);
  119. that.$emit('ok');
  120. }else{
  121. that.$message.warning(res.message);
  122. }
  123. }).finally(() => {
  124. that.confirmLoading = false;
  125. that.close();
  126. })
  127. }else{
  128. return false
  129. }
  130. })
  131. },
  132. handleCancel () {
  133. this.close()
  134. },
  135. }
  136. }
  137. </script>