detection_details.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class=" uni-container" v-if="formData.id">
  3. <view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
  4. <!-- 自定义表单校验 1-->
  5. <u--form ref="customForm" :model="formData" labelPosition="top" labelWidth="150" labelAlign="left">
  6. <u-form-item label="检测项目" prop="detinspect" :required="true">
  7. <u-input v-model="formData.detinspect" disabled placeholder="请输入检测项目" />
  8. </u-form-item>
  9. <u-form-item label="预计检测时间" prop="detdate">
  10. <uni-datetime-picker v-model="formData.detdate" type="datetime"
  11. closeOnClickOverlay disabled></uni-datetime-picker>
  12. </u-form-item>
  13. <u-form-item label="检测维保结果" prop="detresult" >
  14. <u-input v-model="formData.detresult" disabled placeholder="请输入检测维保结果" />
  15. </u-form-item>
  16. <u-form-item label="所属单位" prop="orgId" :required="true">
  17. <u-input v-model="formData.orgId" disabled placeholder="" />
  18. </u-form-item>
  19. <u-form-item label="附件">
  20. <view class="buju">
  21. <text v-if="formData.att == '' || formData.att == null">无</text>
  22. <!-- #ifdef MP-WEIXIN -->
  23. <text v-else style="color:#00a3f4;cursor: pointer;"
  24. @click.native="down(formData.att)">点击预览文件</text>
  25. <!-- #endif -->
  26. <!-- #ifdef H5 -->
  27. <a v-else style="color:#00a3f4;cursor: pointer;" @click="down(formData.att)">点击预览文件</a>
  28. <!-- #endif -->
  29. </view>
  30. </u-form-item>
  31. </u--form>
  32. </view>
  33. <uni-row class="heigthButton">
  34. <u-button @click="gotoEditDetection(formData)" shape="circle" size="large" color="#4cb2b6" style="width: 60%;"
  35. text="修改信息"></u-button>
  36. </uni-row>
  37. </view>
  38. </template>
  39. <script>
  40. var that = null;
  41. import {
  42. downSee
  43. } from '@/utils/common'
  44. export default {
  45. data() {
  46. return {
  47. formData: {
  48. orgName: ''
  49. },
  50. formData: {
  51. orgName: ''
  52. },
  53. screenHeight: this.$screenHeight,
  54. wheight: '',
  55. };
  56. },
  57. mounted() {
  58. uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
  59. this.wheight = data.height
  60. }).exec()
  61. },
  62. onLoad: function(option) {
  63. that = this
  64. var data = option.id;
  65. // 接收来自上个页面传递的参数
  66. const eventChannel = this.getOpenerEventChannel();
  67. eventChannel.on('acceptDataFromOpenerPage', function(val) {
  68. that.formData = val;
  69. console.log('val+++++++++++++++++++', that.formData);
  70. });
  71. this.formData.orgName = option.orgName
  72. console.log("option: ", that.formData);
  73. },
  74. methods: {
  75. // 下载附件
  76. down(attId) {
  77. console.log(attId, 'sdf');
  78. downSee(attId)
  79. },
  80. // 传递当前页面数据到 ‘修改信息’
  81. gotoEditDetection(val) {
  82. // console.log('val',val);
  83. uni.navigateTo({
  84. url: '/pagesA/fire/fpd_detection/edit_detection/edit_detection?id=' + val.id,
  85. events: {
  86. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  87. acceptDataFromOpenedPage: function(val) {
  88. this.formData = val;
  89. }
  90. },
  91. success: function(res) {
  92. // 通过eventChannel向被打开页面传送数据
  93. res.eventChannel.emit('acceptDataFromOpenedPage', val);
  94. }
  95. });
  96. }
  97. }
  98. };
  99. </script>
  100. <style lang="scss" scoped>
  101. page {
  102. background-color: #F5F7F9;
  103. }
  104. .container {
  105. position: relative;
  106. // height: 220vh;
  107. background-color: rgb(245, 247, 249);
  108. overflow: auto;
  109. .buju {
  110. margin: 40rpx;
  111. }
  112. }
  113. .cont {}
  114. .weiwan {
  115. color: #d51a52;
  116. background: rgba(213, 26, 82, 0.2);
  117. padding: 5rpx 20rpx;
  118. border-radius: 2px;
  119. border: 1px solid #d51a52;
  120. }
  121. .yiwan {
  122. color: #4cb2b6;
  123. background: rgba(76, 178, 182, 0.2);
  124. padding: 5rpx 20rpx;
  125. border-radius: 2px;
  126. border: 1px solid #4cb2b6;
  127. }
  128. .miaoshu {
  129. margin-right: 20rpx;
  130. color: #274647;
  131. font-weight: 600;
  132. }
  133. </style>