fpd_detection.vue 11 KB

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