fpd_detection.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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.orgName }}</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.name }}</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. getOrgId
  81. } from '@/api/fpdDetection/index.js';
  82. import config from '@/config'
  83. import {
  84. DICT_TYPE,
  85. getDictDatas
  86. } from '@/utils/dict';
  87. const baseUrlImg = config.baseUrlImg
  88. export default {
  89. data() {
  90. return {
  91. isLoaded: false,
  92. Group: `${baseUrlImg}/checkActive/Group.png`,
  93. showOrg: false,
  94. actions: [],
  95. // 数据
  96. tableData: [],
  97. title: '是否删除该数据项?',
  98. content: '确认删除?',
  99. id: '',
  100. tan90: `${baseUrlImg}/tan90.png`,
  101. // 每页数据量
  102. pageSize: 10,
  103. // 当前页
  104. pageNo: 1,
  105. // 数据总量
  106. total: 0,
  107. // tableData数据加载中
  108. loading: false,
  109. // 初始化时搜索框的值
  110. keyword: '',
  111. // 存放orgid,orgname
  112. formData: {
  113. orgName: '',
  114. orgId: ''
  115. },
  116. show: false,
  117. showtimeStart: false,
  118. showtimeEnd: false,
  119. // 查询参数
  120. queryParams: {
  121. pageNo: 1,
  122. pageSize: 10,
  123. detdate: [],
  124. detinspect: null,
  125. detresult: null,
  126. orgIds:['']
  127. },
  128. }
  129. },
  130. methods: {
  131. //搜索
  132. search() {
  133. this.getData()
  134. // console.log('keyword', this.keyword);
  135. // getFpdDetectionPage({
  136. // detinspect: this.keyword
  137. // }).then(res => {
  138. // // console.log('res', res);
  139. // if (res.data) {
  140. // //对检测结果进行初始化
  141. // const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
  142. // // console.log('reArr',reArr);
  143. // this.tableData = res.data.list.map(item => {
  144. // const thisItem = reArr.find(par => par.value === item.detresult)
  145. // // console.log('thisItem',thisItem);
  146. // if (thisItem) {
  147. // item.detresult = {
  148. // id: thisItem.value,
  149. // name: thisItem.label
  150. // }
  151. // }
  152. // return item
  153. // })
  154. // } else {
  155. // this.tableData = []
  156. // }
  157. // })
  158. },
  159. //新增
  160. addClick() {
  161. this.isLoaded = false
  162. uni.navigateTo({
  163. url: `/pagesA/fire/fpd_detection/add_detection/add_detection?&orgName=${this.formData.orgName}&orgId=${this.formData.orgId}`,
  164. });
  165. },
  166. // 模态框内容
  167. showModal(val) {
  168. this.show = true;
  169. this.id = val.id;
  170. // console.log('val', this.id);
  171. },
  172. close() {
  173. this.show = false;
  174. // console.log('close');
  175. },
  176. cancel() {
  177. this.show = false;
  178. // console.log('cancel');
  179. },
  180. // 隐藏键盘
  181. hideKeyboard() {
  182. uni.hideKeyboard();
  183. },
  184. //确定删除
  185. confirm() {
  186. this.show = false;
  187. deleteFpdDetection(this.id).then(response => {
  188. this.loading = true;
  189. this.isLoaded = false
  190. this.tableData = []
  191. this.getData();
  192. // console.log(this.tableData, '删除后重新获取');
  193. });
  194. },
  195. sexSelect(e) {
  196. this.formData.orgId = e.id;
  197. this.formData.orgName = e.name;
  198. // 获取培训演练信息详细信息
  199. getFpdDetectionPage({
  200. pageNo: this.pageNo,
  201. pageSize: this.pageSize,
  202. orgId: this.formData.orgId
  203. }).then(response => {
  204. this.tableData = response.data.list;
  205. });
  206. },
  207. //获取表格数据
  208. getData() {
  209. this.loading = true;
  210. this.queryParams.detinspect=this.keyword
  211. getFpdDetectionPage(this.queryParams).then(response => {
  212. this.total = response.data.total
  213. this.tableData = [...this.tableData,...response.data.list]
  214. if (response.data) {
  215. this.loading = false;
  216. //对检测结果进行初始化
  217. const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
  218. // console.log('reArr',reArr);
  219. this.tableData = this.tableData.map(item => {
  220. const thisItem = reArr.find(par => par.value === item.detresult)
  221. // console.log('thisItem',thisItem);
  222. if (thisItem) {
  223. item.detresult = {
  224. id: thisItem.value,
  225. name: thisItem.label
  226. }
  227. }
  228. return item
  229. })
  230. // this.tableData = response.data.list;
  231. }
  232. this.isLoaded = true
  233. this.loading = false;
  234. // console.log('tableData', this.tableData);
  235. }).catch(err => {
  236. this.isLoaded = true
  237. this.loading = false;
  238. }
  239. );
  240. },
  241. // 传递数据
  242. onClick(val, orgName) {
  243. // console.log(val.orgName, val, 'val');
  244. const navData = JSON.stringify({
  245. ...val
  246. })
  247. // console.log('navData', navData);
  248. this.isLoaded = false
  249. uni.navigateTo({
  250. url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id
  251. });
  252. },
  253. // 触底的事件
  254. onReachBottom() {
  255. // 判断是否还有下一页数据
  256. if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
  257. return uni.showToast({
  258. title: `数据加载完毕`
  259. });
  260. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  261. if (this.loading) return;
  262. // this.pageNo += 1;
  263. this.queryParams.pageNo += 1
  264. this.getData();
  265. },
  266. },
  267. watch: {
  268. loading: {
  269. handler(newLength, oldLength) {
  270. this.$modal.isLoadingModel(this.loading)
  271. },
  272. immediate: true
  273. }
  274. },
  275. onShow() {
  276. // 执行查询
  277. // console.log('par',this.queryParams);
  278. // this.$set(this.queryParams,'detresult',this.keyword)
  279. this.keyword = ''
  280. this.actions = []
  281. getOrgId({
  282. pageNo: this.pageNo,
  283. pageSize: this.pageSize,
  284. userId: this.$store.state.user.id
  285. }).then(response => {
  286. // console.log(response, 'response');
  287. // 取到用户对应的单位名称与id
  288. response.data.map(v => {
  289. this.actions.push({
  290. id: v.dwid,
  291. name: v.orgName
  292. });
  293. });
  294. // console.log(response.data, '21321312');
  295. this.formData.orgName = response.data[0].orgName;
  296. this.formData.orgId = response.data[0].dwid;
  297. this.queryParams.orgName = response.data[0].orgName;
  298. this.queryParams.orgIds[0] = response.data[0].dwid;
  299. this.tableData = []
  300. this.getData()
  301. // this.search();
  302. }).catch(err => {
  303. this.loading = false
  304. this.$modal.msg(err)
  305. })
  306. // this.tableData={}
  307. // this.getData();
  308. }
  309. }
  310. </script>
  311. <style lang="scss" scoped>
  312. body {
  313. background-color: #f5f7f9;
  314. }
  315. page {
  316. background-color: #f5f7f9;
  317. }
  318. /deep/ .u-tabs__wrapper[data-v-0de61367],
  319. /deep/ .u-tabs__wrapper.data-v-0de61367,
  320. /deep/ .u-tabs__wrapper {
  321. width: 99%;
  322. }
  323. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  324. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  325. /deep/.u-tabs__wrapper__nav__item {
  326. padding: 0 60rpx;
  327. }
  328. .uni-container {
  329. height: 100vh;
  330. padding-right: 20upx;
  331. }
  332. .addInsp {
  333. width: 40px;
  334. position: fixed;
  335. right: 4px;
  336. z-index: 99999;
  337. }
  338. ::v-deep .u-icon__icon {
  339. margin-right: 0px !important;
  340. }
  341. .an-niu {
  342. float: right;
  343. font-size: 10px;
  344. text-align: center;
  345. display: flex;
  346. margin-top: -64upx;
  347. padding-bottom: 30rpx;
  348. // margin-top: 50rpx;
  349. color: #fff;
  350. .detail {
  351. width: 60px;
  352. height: 60rpx;
  353. padding: 0 20rpx;
  354. border-radius: 30px;
  355. background-color: #f7c41e;
  356. margin-right: 20rpx;
  357. text-align: center;
  358. line-height: 60rpx;
  359. font-size: 27upx;
  360. }
  361. .detailDel {
  362. width: 60px;
  363. height: 60rpx;
  364. padding: 0 20rpx;
  365. border-radius: 30px;
  366. background-color: #ff2e31;
  367. color: white;
  368. margin-right: 20rpx;
  369. text-align: center;
  370. line-height: 60rpx;
  371. font-size: 30upx;
  372. }
  373. .solve {
  374. width: 62px;
  375. height: 60rpx;
  376. margin-right: 20rpx;
  377. border-radius: 30px;
  378. background-color: #4cb2b6;
  379. line-height: 60rpx;
  380. }
  381. /deep/ .padding-tb-sm {
  382. padding-top: 0px;
  383. padding-bottom: 10px;
  384. }
  385. .deletes {
  386. width: 62px;
  387. height: 60rpx;
  388. border-radius: 60rpx;
  389. background-color: red;
  390. color: #fff;
  391. line-height: 60rpx;
  392. }
  393. }
  394. /deep/.segmented-control__item--button {
  395. background-color: rgb(76, 178, 182) !important;
  396. }
  397. /deep/.segmented-control__item--button--active {
  398. background-color: #ffffff !important;
  399. }
  400. /deep/.uni-card {
  401. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  402. border-radius: 30rpx;
  403. }
  404. .tiantupian {
  405. width: 110rpx;
  406. height: 110rpx;
  407. position: fixed;
  408. right: 15px;
  409. bottom: 80rpx;
  410. }
  411. //列表样式
  412. .titles {
  413. font-weight: 600;
  414. margin-bottom: 10rpx;
  415. color: black;
  416. font-size: 26rpx;
  417. }
  418. .conts {
  419. max-width: 470rpx;
  420. display: -webkit-box;
  421. /*弹性伸缩盒子模型显示*/
  422. -webkit-box-orient: vertical;
  423. /*排列方式*/
  424. -webkit-line-clamp: 1;
  425. /*显示文本行数*/
  426. overflow: hidden;
  427. /*溢出隐藏*/
  428. color: #274647;
  429. text-overflow: ellipsis;
  430. /*不知道干嘛的*/
  431. .conts-title {
  432. margin-right: 10rpx;
  433. color: #728f90;
  434. }
  435. }
  436. .max-width {
  437. max-width: 180upx;
  438. }
  439. /deep/ .u-form-item__body__left__content__label {
  440. font-size: 28upx !important;
  441. }
  442. </style>