detection_details.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.attId == '' || formData.attId == null">无</text>
  22. <!-- #ifdef MP-WEIXIN -->
  23. <text v-else style="color:#00a3f4;cursor: pointer;"
  24. @click.native="down(formData.attId)">点击预览文件</text>
  25. <!-- #endif -->
  26. <!-- #ifdef H5 -->
  27. <a v-else style="color:#00a3f4;cursor: pointer;" @click="down(formData.attId)">点击预览文件</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. uni.navigateTo({
  83. url: '/pagesA/fire/fpd_detection/edit_detection/edit_detection',
  84. events: {
  85. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  86. acceptDataFromOpenedPage: function(val) {
  87. this.formData = val;
  88. }
  89. },
  90. success: function(res) {
  91. // 通过eventChannel向被打开页面传送数据
  92. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  93. }
  94. });
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. page {
  101. background-color: #F5F7F9;
  102. }
  103. .container {
  104. position: relative;
  105. // height: 220vh;
  106. background-color: rgb(245, 247, 249);
  107. overflow: auto;
  108. .buju {
  109. margin: 40rpx;
  110. }
  111. }
  112. .cont {}
  113. .weiwan {
  114. color: #d51a52;
  115. background: rgba(213, 26, 82, 0.2);
  116. padding: 5rpx 20rpx;
  117. border-radius: 2px;
  118. border: 1px solid #d51a52;
  119. }
  120. .yiwan {
  121. color: #4cb2b6;
  122. background: rgba(76, 178, 182, 0.2);
  123. padding: 5rpx 20rpx;
  124. border-radius: 2px;
  125. border: 1px solid #4cb2b6;
  126. }
  127. .miaoshu {
  128. margin-right: 20rpx;
  129. color: #274647;
  130. font-weight: 600;
  131. }
  132. </style>