e047b6f06f61045b9266de7ff205df4cf21703f6.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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="事项名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sxmc">
  8. <a-input v-model="model.sxmc" placeholder="请输入事项名称" ></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="采集时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cjsj">
  13. <j-date placeholder="请选择采集时间" v-model="model.cjsj" style="width: 100%" />
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="采集描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cjms">
  18. <a-textarea v-model="model.cjms" rows="4" placeholder="请输入采集描述" />
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="24">
  22. <a-form-model-item label="涉及河道" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sjhd">
  23. <a-input v-model="model.sjhd" placeholder="请输入涉及河道" ></a-input>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="24">
  27. <a-form-model-item label="河道岸别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hdab">
  28. <j-dict-select-tag type="list" v-model="model.hdab" dictCode="ab" placeholder="请选择河道岸别" />
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="24">
  32. <a-form-model-item label="坐标采集类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zbcj">
  33. <j-dict-select-tag type="list" v-model="model.zbcj" dictCode="cjlx" placeholder="请选择坐标采集类型" />
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :span="24">
  37. <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bz">
  38. <a-textarea v-model="model.bz" rows="4" placeholder="请输入备注" />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="24">
  42. <a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tp">
  43. <j-image-upload isMultiple v-model="model.tp" ></j-image-upload>
  44. </a-form-model-item>
  45. </a-col>
  46. </a-row>
  47. </a-form-model>
  48. </j-form-container>
  49. </a-spin>
  50. </template>
  51. <script>
  52. import { httpAction, getAction } from '@/api/manage'
  53. import { validateDuplicateValue } from '@/utils/util'
  54. export default {
  55. name: 'RmQtcjForm',
  56. components: {
  57. },
  58. props: {
  59. //表单禁用
  60. disabled: {
  61. type: Boolean,
  62. default: false,
  63. required: false
  64. }
  65. },
  66. data () {
  67. return {
  68. model:{
  69. },
  70. labelCol: {
  71. xs: { span: 24 },
  72. sm: { span: 5 },
  73. },
  74. wrapperCol: {
  75. xs: { span: 24 },
  76. sm: { span: 16 },
  77. },
  78. confirmLoading: false,
  79. validatorRules: {
  80. sxmc: [
  81. { required: true, message: '请输入事项名称!'},
  82. ],
  83. },
  84. url: {
  85. add: "/hzz.sjcjrw.rmqtcj/rmQtcj/add",
  86. edit: "/hzz.sjcjrw.rmqtcj/rmQtcj/edit",
  87. queryById: "/hzz.sjcjrw.rmqtcj/rmQtcj/queryById"
  88. }
  89. }
  90. },
  91. computed: {
  92. formDisabled(){
  93. return this.disabled
  94. },
  95. },
  96. created () {
  97. //备份model原始值
  98. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  99. },
  100. methods: {
  101. add () {
  102. this.edit(this.modelDefault);
  103. },
  104. edit (record) {
  105. this.model = Object.assign({}, record);
  106. this.visible = true;
  107. },
  108. submitForm () {
  109. const that = this;
  110. // 触发表单验证
  111. this.$refs.form.validate(valid => {
  112. if (valid) {
  113. that.confirmLoading = true;
  114. let httpurl = '';
  115. let method = '';
  116. if(!this.model.id){
  117. httpurl+=this.url.add;
  118. method = 'post';
  119. }else{
  120. httpurl+=this.url.edit;
  121. method = 'post';
  122. }
  123. httpAction(httpurl,this.model,method).then((res)=>{
  124. if(res.success){
  125. that.$message.success(res.message);
  126. that.$emit('ok');
  127. }else{
  128. that.$message.warning(res.message);
  129. }
  130. }).finally(() => {
  131. that.confirmLoading = false;
  132. })
  133. }
  134. })
  135. },
  136. }
  137. }
  138. </script>