fpd_detection.vue 11 KB

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