siteInspectionInfo.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <van-nav-bar
  3. fixed
  4. title="场所检查情况"
  5. left-text=""
  6. left-arrow
  7. @click-left="onClickLeft"
  8. :style="{ 'background-color': selectColor }"
  9. />
  10. <van-loading size="16px" v-show="isLoading">加载中...</van-loading>
  11. <div class="main" v-show="!isLoading">
  12. <div class="banner">
  13. <img src="../../../../public/loginbg/banner.jpg" alt="" />
  14. </div>
  15. <div class="info">
  16. <p class="miniTitle">详细信息</p>
  17. <van-cell-group>
  18. <van-field
  19. v-model="info.siteName.name"
  20. readonly
  21. label="场所名称:"
  22. input-align="right"
  23. />
  24. </van-cell-group>
  25. <van-cell-group>
  26. <van-field
  27. v-model="info.place"
  28. center
  29. readonly
  30. label="地点:"
  31. input-align="right"
  32. />
  33. </van-cell-group>
  34. <van-cell-group>
  35. <van-field
  36. v-model="info.placeDel"
  37. center
  38. readonly
  39. clearable
  40. label="详细地址:"
  41. input-align="right"
  42. />
  43. <template #right-icon>
  44. <van-icon name="location" />
  45. </template>
  46. </van-cell-group>
  47. <van-cell-group>
  48. <van-field
  49. v-model="info.supervisionTime"
  50. center
  51. readonly
  52. label="督查时间:"
  53. input-align="right"
  54. />
  55. </van-cell-group>
  56. <van-cell-group>
  57. <van-field
  58. name="uploader"
  59. readonly
  60. label="附件:"
  61. input-align="right"
  62. >
  63. <template #input>
  64. <span v-show="fileList.length == 0">无</span>
  65. <van-uploader
  66. v-show="fileList.length != 0"
  67. v-model="fileList"
  68. :max-count="fileList.length"
  69. capture="camera"
  70. accept=""
  71. @click-preview="downHandle"
  72. >
  73. </van-uploader>
  74. </template>
  75. </van-field>
  76. </van-cell-group>
  77. <van-cell-group>
  78. <van-field
  79. v-model="info.supervisionContent"
  80. center
  81. readonly
  82. label="督查内容:"
  83. input-align="right"
  84. />
  85. </van-cell-group>
  86. </div>
  87. <van-button
  88. v-if="info.assessment == 0"
  89. type="primary"
  90. class="btn-sub"
  91. @click="update"
  92. >审核</van-button
  93. >
  94. </div>
  95. </template>
  96. <script>
  97. import { ref, onMounted } from "vue";
  98. import siteInspectionService from "@/api/siteInspection/siteInspectionService";
  99. import UserManage from "@/api/user/UserManage";
  100. import { useRoute } from "vue-router";
  101. import $base from "@/utils/config";
  102. export default {
  103. setup() {
  104. // 导航栏颜色
  105. const selectColor = ref(window.localStorage.getItem("MZ_COLOR"));
  106. const onClickLeft = () => {
  107. history.back();
  108. };
  109. // 加载
  110. let isLoading = ref(true);
  111. // 活动信息
  112. const info = ref({
  113. siteName:{id:'',name:""}
  114. });
  115. // 文件
  116. let fileList = ref([]);
  117. let route = useRoute();
  118. onMounted(() => {
  119. new siteInspectionService().queryById(route.query.id).then((data) => {
  120. info.value = data;
  121. info.value.enclosure.split("|").forEach((item) => {
  122. console.log(item);
  123. if (item.trim().length > 0) {
  124. // fileList.value.push({
  125. // name: decodeURIComponent(
  126. // item.substring(item.lastIndexOf("/") + 1)
  127. // ),
  128. // url: $base + item.replace('程序附件//','程序附件/'),
  129. // });
  130. fileList.value.push({
  131. file: {
  132. name: decodeURIComponent(
  133. item.substring(item.lastIndexOf("/") + 1)
  134. ),
  135. },
  136. url: $base + item.replace("程序附件//", "程序附件/"),
  137. });
  138. }
  139. });
  140. isLoading.value = false;
  141. });
  142. });
  143. /**
  144. * 下载文件 网页端可用
  145. */
  146. const downHandle = (fileObj) => {
  147. if(!(fileObj.file.name.includes(".jpg")||fileObj.file.name.includes(".jpeg")||fileObj.file.name.includes(".png"))){
  148. // 声明a标签
  149. const aEle = document.createElement("a");
  150. // 设置下载文件名
  151. aEle.download = fileObj.file.name;
  152. // 下载地址
  153. aEle.href = fileObj.url;
  154. // 调用下载
  155. aEle.click();
  156. }
  157. };
  158. // 审核通过
  159. const update = () => {
  160. isLoading.value = true;
  161. info.value.assessment = 1;
  162. new siteInspectionService().save(info.value).then((res) => {
  163. isLoading.value = false;
  164. window.xm.showToast({
  165. message:"审核成功!"
  166. })
  167. history.back();
  168. });
  169. };
  170. return {
  171. // 导航栏颜色
  172. selectColor,
  173. onClickLeft,
  174. info,
  175. fileList,
  176. downHandle,
  177. isLoading,
  178. update,
  179. };
  180. },
  181. };
  182. </script>
  183. <style lang="less">
  184. .van-cell__value .van-field__right-icon .van-icon-location {
  185. color: #36a7f3 !important;
  186. }
  187. .btn-sub {
  188. width: 90%;
  189. border-radius: 20px;
  190. margin-left: 5%;
  191. margin-bottom: 40px;
  192. margin-top: -100px;
  193. }
  194. .van-loading {
  195. text-align: center;
  196. margin-top: 80px;
  197. }
  198. .van-popup--center {
  199. width: 98% !important;
  200. }
  201. </style>