fpd_detection.vue 9.6 KB

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