fdb5f1f87b04363ae017d69a39ff10ae5a34df84.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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="xclx">
  8. <a-input v-model="model.xclx" 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="mc">
  13. <a-input v-model="model.mc" placeholder="请输入名称" ></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="无人机操作员" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="wrjczy">
  18. <a-input v-model="model.wrjczy" placeholder="请输入无人机操作员" ></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="24">
  22. <a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kssj">
  23. <j-date placeholder="请选择开始时间" v-model="model.kssj" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="24">
  27. <a-form-model-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jssj">
  28. <j-date placeholder="请选择结束时间" v-model="model.jssj" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="24">
  32. <a-form-model-item label="巡查时长(h)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xcsc">
  33. <a-input v-model="model.xcsc" placeholder="请输入巡查时长(h)" ></a-input>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :span="24">
  37. <a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tp">
  38. <j-image-upload isMultiple v-model="model.tp" ></j-image-upload>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="24">
  42. <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bz">
  43. <a-textarea v-model="model.bz" rows="4" placeholder="请输入备注" />
  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: 'RmWrjtxxxForm',
  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. },
  81. url: {
  82. add: "/hzz.sjcjrw.wrjtx/rmWrjtxxx/add",
  83. edit: "/hzz.sjcjrw.wrjtx/rmWrjtxxx/edit",
  84. queryById: "/hzz.sjcjrw.wrjtx/rmWrjtxxx/queryById"
  85. }
  86. }
  87. },
  88. computed: {
  89. formDisabled(){
  90. return this.disabled
  91. },
  92. },
  93. created () {
  94. //备份model原始值
  95. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  96. },
  97. methods: {
  98. add () {
  99. this.edit(this.modelDefault);
  100. },
  101. edit (record) {
  102. this.model = Object.assign({}, record);
  103. this.visible = true;
  104. },
  105. submitForm () {
  106. const that = this;
  107. // 触发表单验证
  108. this.$refs.form.validate(valid => {
  109. if (valid) {
  110. that.confirmLoading = true;
  111. let httpurl = '';
  112. let method = '';
  113. if(!this.model.id){
  114. httpurl+=this.url.add;
  115. method = 'post';
  116. }else{
  117. httpurl+=this.url.edit;
  118. method = 'post';
  119. }
  120. httpAction(httpurl,this.model,method).then((res)=>{
  121. if(res.success){
  122. that.$message.success(res.message);
  123. that.$emit('ok');
  124. }else{
  125. that.$message.warning(res.message);
  126. }
  127. }).finally(() => {
  128. that.confirmLoading = false;
  129. })
  130. }
  131. })
  132. },
  133. }
  134. }
  135. </script>