fpd_detection.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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. <view class="an-niu" @click.native="onClick(item,formData.orgName)" link><text
  46. class="detail">查看详情</text></view>
  47. </uni-card>
  48. </view>
  49. </view>
  50. <!-- tableData为空时显示 -->
  51. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  52. <view class="text-gray" style="padding-top: 20px;" v-if="tableData.length == 0">
  53. <img :src="tan90" alt="暂无数据" />
  54. </view>
  55. </view>
  56. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false"
  57. @select="sexSelect"></u-action-sheet>
  58. <!-- 加载中 -->
  59. <isLodingModel></isLodingModel>
  60. </view>
  61. </template>
  62. <script>
  63. var that = '';
  64. import {
  65. createFpdDetection, //创建消防设备维护和检测台账
  66. updateFpdDetection, //更新消防设备维护和检测台账
  67. deleteFpdDetection, //删除消防设备维护和检测台账
  68. getFpdDetection, //获得消防设备维护和检测台账
  69. getFpdDetectionPage, //获得消防设备维护和检测台账分页
  70. exportFpdDetectionExcel, //导出消防设备维护和检测台账 Excel
  71. getOrgId
  72. } from '@/api/fpdDetection/index.js';
  73. import config from '@/config'
  74. import {
  75. DICT_TYPE,
  76. getDictDatas
  77. } from '@/utils/dict';
  78. const baseUrlImg = config.baseUrlImg
  79. export default {
  80. data() {
  81. return {
  82. isLoaded: false,
  83. Group: `${baseUrlImg}/checkActive/Group.png`,
  84. showOrg: false,
  85. actions: [],
  86. // 数据
  87. tableData: [],
  88. id: '',
  89. tan90: `${baseUrlImg}/tan90.png`,
  90. // 每页数据量
  91. pageSize: 10,
  92. // 当前页
  93. pageNo: 1,
  94. // 数据总量
  95. total: 0,
  96. // tableData数据加载中
  97. loading: false,
  98. // 初始化时搜索框的值
  99. keyword: '',
  100. // 存放orgid,orgname
  101. formData: {
  102. orgName: ''
  103. },
  104. show: false,
  105. showtimeStart: false,
  106. showtimeEnd: false,
  107. // 查询参数
  108. queryParams: {
  109. pageNo: 1,
  110. pageSize: 10,
  111. detdate: [],
  112. detinspect: null,
  113. detresult: null,
  114. },
  115. }
  116. },
  117. methods: {
  118. //搜索
  119. search() {
  120. console.log('keyword', this.keyword);
  121. getFpdDetectionPage({
  122. detinspect: this.keyword
  123. }).then(res => {
  124. console.log('res', res);
  125. if (res.data) {
  126. //对检测结果进行初始化
  127. const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
  128. // console.log('reArr',reArr);
  129. this.tableData = res.data.list.map(item => {
  130. const thisItem = reArr.find(par=>par.value === item.detresult)
  131. // console.log('thisItem',thisItem);
  132. if(thisItem){
  133. item.detresult = {id:thisItem.value,name:thisItem.label}
  134. }
  135. return item
  136. })
  137. } else {
  138. this.tableData = []
  139. }
  140. })
  141. },
  142. // 隐藏键盘
  143. hideKeyboard() {
  144. uni.hideKeyboard();
  145. },
  146. sexSelect(e) {
  147. this.formData.orgId = e.id;
  148. this.formData.orgName = e.name;
  149. // 获取培训演练信息详细信息
  150. getFpdDetectionPage({
  151. pageNo: this.pageNo,
  152. pageSize: this.pageSize,
  153. orgId: this.formData.orgId
  154. }).then(response => {
  155. this.tableData = response.data.list;
  156. });
  157. },
  158. //获取表格数据
  159. getData() {
  160. this.loading = true;
  161. getFpdDetectionPage(this.queryParams).then(response => {
  162. // console.log('res',response );
  163. if (response.data) {
  164. //对检测结果进行初始化
  165. const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
  166. // console.log('reArr',reArr);
  167. this.tableData = response.data.list.map(item => {
  168. const thisItem = reArr.find(par=>par.value === item.detresult)
  169. // console.log('thisItem',thisItem);
  170. if(thisItem){
  171. item.detresult = {id:thisItem.value,name:thisItem.label}
  172. }
  173. return item
  174. })
  175. // this.tableData = response.data.list;
  176. }
  177. this.isLoaded = true
  178. this.loading = false;
  179. console.log('tableData', this.tableData);
  180. }).catch(err => {
  181. this.isLoaded = true
  182. this.loading = false;
  183. }
  184. );
  185. },
  186. // 传递数据
  187. onClick(val, orgName) {
  188. console.log(val.orgName, val, 'val');
  189. const navData = JSON.stringify({
  190. ...val
  191. })
  192. console.log('navData', navData);
  193. this.isLoaded = false
  194. uni.navigateTo({
  195. url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id+'&historyView=historyView',
  196. });
  197. },
  198. },
  199. watch: {
  200. loading: {
  201. handler(newLength, oldLength) {
  202. this.$modal.isLoadingModel(this.loading)
  203. },
  204. immediate: true
  205. }
  206. },
  207. mounted() {
  208. // 执行查询
  209. this.actions = []
  210. getOrgId({
  211. pageNo: this.pageNo,
  212. pageSize: this.pageSize,
  213. userId: this.$store.state.user.id
  214. }).then(response => {
  215. // console.log(response, 'response');
  216. // 取到用户对应的单位名称与id
  217. response.data.map(v => {
  218. this.actions.push({
  219. id: v.dwid,
  220. name: v.orgName
  221. });
  222. });
  223. // console.log(response.data, '21321312');
  224. this.formData.orgName = response.data[0].orgName;
  225. this.formData.orgId = response.data[0].dwid;
  226. this.tableData = []
  227. this.getData();
  228. }).catch(err => {
  229. this.loading = false
  230. this.$modal.msg(err)
  231. })
  232. // this.tableData={}
  233. // this.getData();
  234. // this.getData()
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. body {
  240. background-color: #f5f7f9;
  241. }
  242. page {
  243. background-color: #f5f7f9;
  244. }
  245. /deep/ .u-tabs__wrapper[data-v-0de61367],
  246. /deep/ .u-tabs__wrapper.data-v-0de61367,
  247. /deep/ .u-tabs__wrapper {
  248. width: 99%;
  249. }
  250. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  251. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  252. /deep/.u-tabs__wrapper__nav__item {
  253. padding: 0 60rpx;
  254. }
  255. .uni-container {
  256. height: 100vh;
  257. padding-right: 20upx;
  258. }
  259. .addInsp {
  260. width: 40px;
  261. position: fixed;
  262. right: 4px;
  263. z-index: 99999;
  264. }
  265. ::v-deep .u-icon__icon {
  266. margin-right: 0px !important;
  267. }
  268. .an-niu {
  269. float: right;
  270. font-size: 10px;
  271. text-align: center;
  272. display: flex;
  273. margin-top: -64upx;
  274. padding-bottom: 30rpx;
  275. // margin-top: 50rpx;
  276. color: #fff;
  277. .detail {
  278. width: 60px;
  279. height: 60rpx;
  280. padding: 0 20rpx;
  281. border-radius: 30px;
  282. background-color: #f7c41e;
  283. margin-right: 20rpx;
  284. text-align: center;
  285. line-height: 60rpx;
  286. font-size: 27upx;
  287. }
  288. .detailDel {
  289. width: 60px;
  290. height: 60rpx;
  291. padding: 0 20rpx;
  292. border-radius: 30px;
  293. background-color: #ff2e31;
  294. color: white;
  295. margin-right: 20rpx;
  296. text-align: center;
  297. line-height: 60rpx;
  298. font-size: 30upx;
  299. }
  300. .solve {
  301. width: 62px;
  302. height: 60rpx;
  303. margin-right: 20rpx;
  304. border-radius: 30px;
  305. background-color: #4cb2b6;
  306. line-height: 60rpx;
  307. }
  308. /deep/ .padding-tb-sm {
  309. padding-top: 0px;
  310. padding-bottom: 10px;
  311. }
  312. .deletes {
  313. width: 62px;
  314. height: 60rpx;
  315. border-radius: 60rpx;
  316. background-color: red;
  317. color: #fff;
  318. line-height: 60rpx;
  319. }
  320. }
  321. /deep/.segmented-control__item--button {
  322. background-color: rgb(76, 178, 182) !important;
  323. }
  324. /deep/.segmented-control__item--button--active {
  325. background-color: #ffffff !important;
  326. }
  327. /deep/.uni-card {
  328. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  329. border-radius: 30rpx;
  330. }
  331. .tiantupian {
  332. width: 110rpx;
  333. height: 110rpx;
  334. position: fixed;
  335. right: 15px;
  336. bottom: 80rpx;
  337. }
  338. //列表样式
  339. .titles {
  340. font-weight: 600;
  341. margin-bottom: 10rpx;
  342. color: black;
  343. font-size: 32rpx;
  344. }
  345. .conts {
  346. max-width: 470rpx;
  347. display: -webkit-box;
  348. /*弹性伸缩盒子模型显示*/
  349. -webkit-box-orient: vertical;
  350. /*排列方式*/
  351. -webkit-line-clamp: 1;
  352. /*显示文本行数*/
  353. overflow: hidden;
  354. /*溢出隐藏*/
  355. color: #274647;
  356. text-overflow: ellipsis;
  357. /*不知道干嘛的*/
  358. .conts-title {
  359. margin-right: 10rpx;
  360. color: #728f90;
  361. }
  362. }
  363. .max-width {
  364. max-width: 180upx;
  365. }
  366. /deep/ .u-form-item__body__left__content__label {
  367. font-size: 28upx !important;
  368. }
  369. </style>