fpd_detection.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <!-- 搜索框 -->
  4. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  5. <uni-col :span="24">
  6. <view class="u-page__tag-item">
  7. <u-search placeholder="请输入培训演练名称" bgColor="#edf6f9" borderColor="#4cb2b6" v-model="keyword"
  8. :show-action="true" @custom="search"></u-search>
  9. </view>
  10. </uni-col>
  11. </uni-row>
  12. <!-- 下拉框 -->
  13. <view class="u-page__tag-item"
  14. style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;background-color: #f5f7fa;">
  15. <u-form>
  16. <u-form-item prop="orgName" @click="
  17. showOrg = true;
  18. hideKeyboard();
  19. " label="单位选择:" labelWidth="100px">
  20. <!-- <u-picker :show="showOrg" :columns="actions"></u-picker> -->
  21. <u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
  22. <u-icon slot="right" name="arrow-down"></u-icon>
  23. </u-form-item>
  24. </u-form>
  25. </view>
  26. <!-- 卡片栏 -->
  27. <view v-if="tableData.length>0 && isLoaded">
  28. <view v-for="(item, index) in tableData" :key="index">
  29. <uni-card>
  30. <!-- 标题 -->
  31. <view class="titles">{{ item.detinspect }}</view>
  32. <!-- 简要内容 -->
  33. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  34. <text class="name-align-drill">检测项目:</text>
  35. <text class="conts">{{ item.detinspect }}</text>
  36. </view>
  37. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  38. <text class="name-align-drill">所属单位:</text>
  39. <text class="conts">{{ item.orgId }}</text>
  40. </view>
  41. <view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
  42. <text class="name-align-drill"> 检测维保结果:</text>
  43. <text class="conts max-width">{{ item.detresult }}</text>
  44. </view>
  45. <!-- 删除按钮 -->
  46. <view class="an-niu" @click.native="showModal(item)">
  47. <view class="detailDel">删除</view>
  48. </view>
  49. <view class="an-niu" @click.native="onClick(item,formData.orgName)" link><text
  50. class="detail">查看详情</text></view>
  51. </uni-card>
  52. </view>
  53. </view>
  54. <!-- tableData为空时显示 -->
  55. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  56. <view class="text-gray" style="padding-top: 20px;" v-if="tableData.length == 0">
  57. <img :src="tan90" alt="暂无数据" />
  58. </view>
  59. </view>
  60. <view>
  61. <image :src="Group" @click="addClick" class="tiantupian"></image>
  62. </view>
  63. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false"
  64. @select="sexSelect"></u-action-sheet>
  65. <u-modal :show="show" @confirm="confirm" @cancel="cancel" @close="close" asyncClose closeOnClickOverlay
  66. showCancelButton confirmColor="red" :title="title" :content="content" ref="uModal"></u-modal>
  67. <!-- 加载中 -->
  68. <isLodingModel></isLodingModel>
  69. </view>
  70. </template>
  71. <script>
  72. var that = '';
  73. import {
  74. createFpdDetection, //创建消防设备维护和检测台账
  75. updateFpdDetection, //更新消防设备维护和检测台账
  76. deleteFpdDetection, //删除消防设备维护和检测台账
  77. getFpdDetection, //获得消防设备维护和检测台账
  78. getFpdDetectionPage, //获得消防设备维护和检测台账分页
  79. exportFpdDetectionExcel, //导出消防设备维护和检测台账 Excel
  80. } from '@/api/fpdDetection/index.js';
  81. import config from '@/config'
  82. const baseUrlImg = config.baseUrlImg
  83. export default {
  84. data() {
  85. return {
  86. isLoaded: false,
  87. Group: `${baseUrlImg}/checkActive/Group.png`,
  88. showOrg: false,
  89. actions: [],
  90. // 数据
  91. tableData: [],
  92. title: '是否删除该数据项?',
  93. content: '确认删除?',
  94. id: '',
  95. tan90: `${baseUrlImg}/tan90.png`,
  96. // 每页数据量
  97. pageSize: 10,
  98. // 当前页
  99. pageNo: 1,
  100. // 数据总量
  101. total: 0,
  102. // tableData数据加载中
  103. loading: false,
  104. // 初始化时搜索框的值
  105. keyword: '',
  106. // 存放orgid,orgname
  107. formData: {
  108. orgName: ''
  109. },
  110. show: false,
  111. showtimeStart: false,
  112. showtimeEnd: false,
  113. // 查询参数
  114. queryParams: {
  115. pageNo: 1,
  116. pageSize: 10,
  117. detdate: [],
  118. detinspect: null,
  119. detresult: null,
  120. },
  121. }
  122. },
  123. methods: {
  124. //新增
  125. addClick() {
  126. this.isLoaded = false
  127. uni.navigateTo({
  128. url: '/pagesA/fire/fpd_detection/add_detection/add_detection'
  129. });
  130. },
  131. // 模态框内容
  132. showModal(val) {
  133. this.show = true;
  134. this.id = val.id;
  135. console.log('val', this.id);
  136. },
  137. close() {
  138. this.show = false;
  139. console.log('close');
  140. },
  141. cancel() {
  142. this.show = false;
  143. console.log('cancel');
  144. },
  145. //确定删除
  146. confirm() {
  147. this.show = false;
  148. deleteFpdDetection(this.id).then(response => {
  149. this.loading = true;
  150. this.isLoaded = false
  151. this.tableData = []
  152. this.getData();
  153. console.log(this.tableData, '删除后重新获取');
  154. });
  155. },
  156. //获取表格数据
  157. getData() {
  158. this.loading = true;
  159. getFpdDetectionPage(this.queryParams).then(response => {
  160. this.tableData = response.data.list;
  161. this.isLoaded = true
  162. this.loading = false;
  163. console.log('tableData', this.tableData);
  164. });
  165. },
  166. // 传递数据
  167. onClick(val, orgName) {
  168. console.log(val, orgName, 'val');
  169. this.isLoaded = false
  170. uni.navigateTo({
  171. url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id,
  172. events: {
  173. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  174. acceptDataFromOpenedPage: function(val) {
  175. console.log(val, '打开页面传送到当前页面的数据');
  176. }
  177. },
  178. success: function(res) {
  179. // 通过eventChannel向被打开页面传送数据
  180. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  181. }
  182. });
  183. },
  184. },
  185. watch: {
  186. loading: {
  187. handler(newLength, oldLength) {
  188. this.$modal.isLoadingModel(this.loading)
  189. },
  190. immediate: true
  191. }
  192. },
  193. onShow() {
  194. // 执行查询
  195. this.getData()
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. body {
  201. background-color: #f5f7f9;
  202. }
  203. page {
  204. background-color: #f5f7f9;
  205. }
  206. /deep/ .u-tabs__wrapper[data-v-0de61367],
  207. /deep/ .u-tabs__wrapper.data-v-0de61367,
  208. /deep/ .u-tabs__wrapper {
  209. width: 99%;
  210. }
  211. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  212. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  213. /deep/.u-tabs__wrapper__nav__item {
  214. padding: 0 60rpx;
  215. }
  216. .uni-container {
  217. height: 100vh;
  218. padding-right: 20upx;
  219. }
  220. .addInsp {
  221. width: 40px;
  222. position: fixed;
  223. right: 4px;
  224. z-index: 99999;
  225. }
  226. ::v-deep .u-icon__icon {
  227. margin-right: 0px !important;
  228. }
  229. .an-niu {
  230. float: right;
  231. font-size: 10px;
  232. text-align: center;
  233. display: flex;
  234. margin-top: -64upx;
  235. padding-bottom: 30rpx;
  236. // margin-top: 50rpx;
  237. color: #fff;
  238. .detail {
  239. width: 60px;
  240. height: 60rpx;
  241. padding: 0 20rpx;
  242. border-radius: 30px;
  243. background-color: #f7c41e;
  244. margin-right: 20rpx;
  245. text-align: center;
  246. line-height: 60rpx;
  247. font-size: 27upx;
  248. }
  249. .detailDel {
  250. width: 60px;
  251. height: 60rpx;
  252. padding: 0 20rpx;
  253. border-radius: 30px;
  254. background-color: #ff2e31;
  255. color: white;
  256. margin-right: 20rpx;
  257. text-align: center;
  258. line-height: 60rpx;
  259. font-size: 30upx;
  260. }
  261. .solve {
  262. width: 62px;
  263. height: 60rpx;
  264. margin-right: 20rpx;
  265. border-radius: 30px;
  266. background-color: #4cb2b6;
  267. line-height: 60rpx;
  268. }
  269. /deep/ .padding-tb-sm {
  270. padding-top: 0px;
  271. padding-bottom: 10px;
  272. }
  273. .deletes {
  274. width: 62px;
  275. height: 60rpx;
  276. border-radius: 60rpx;
  277. background-color: red;
  278. color: #fff;
  279. line-height: 60rpx;
  280. }
  281. }
  282. /deep/.segmented-control__item--button {
  283. background-color: rgb(76, 178, 182) !important;
  284. }
  285. /deep/.segmented-control__item--button--active {
  286. background-color: #ffffff !important;
  287. }
  288. /deep/.uni-card {
  289. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  290. border-radius: 30rpx;
  291. }
  292. .tiantupian {
  293. width: 110rpx;
  294. height: 110rpx;
  295. position: fixed;
  296. right: 15px;
  297. bottom: 80rpx;
  298. }
  299. //列表样式
  300. .titles {
  301. font-weight: 600;
  302. margin-bottom: 10rpx;
  303. color: black;
  304. font-size: 32rpx;
  305. }
  306. .conts {
  307. max-width: 470rpx;
  308. display: -webkit-box;
  309. /*弹性伸缩盒子模型显示*/
  310. -webkit-box-orient: vertical;
  311. /*排列方式*/
  312. -webkit-line-clamp: 1;
  313. /*显示文本行数*/
  314. overflow: hidden;
  315. /*溢出隐藏*/
  316. color: #274647;
  317. text-overflow: ellipsis;
  318. /*不知道干嘛的*/
  319. .conts-title {
  320. margin-right: 10rpx;
  321. color: #728f90;
  322. }
  323. }
  324. .max-width {
  325. max-width: 180upx;
  326. }
  327. /deep/ .u-form-item__body__left__content__label {
  328. font-size: 28upx !important;
  329. }
  330. </style>