index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <view class="container">
  4. <!-- <uni-section title="" padding style="background-color: #F5F7F9;">
  5. <view class="example-body">
  6. <view class="tag-view" style="display: flex;flex-wrap: wrap;">
  7. <uni-tag style="margin: 5px;cursor: pointer;padding: 5px;" v-for="(item,index) in tagLabel"
  8. :key="index" :inverted="true" :text="item.label" type="primary"
  9. @click="setInverted(item.value,item.rotues)" :class="{bg:item.value==clicKValue}" />
  10. </view>
  11. </view>
  12. </uni-section> -->
  13. <view style="margin-bottom: 20rpx;">
  14. <u-tabs :list="items" @click="onClickItem" activeStyle="color:#4CB2B6" inactiveStyle="color:#000"
  15. :current="current" :scrollable="true" lineWidth="60" lineColor="#4CB2B6"></u-tabs>
  16. <view style="height: 2rpx;background-color: #E5E5E5;margin-top: 10rpx;"></view>
  17. </view>
  18. <component :is="selectedTag" v-if="selectedTag!=''">
  19. </component>
  20. <view class="" v-else-if="fireInspection">
  21. <u-list @scrolltolower="scrolltolower" v-if="tableData.length>0 && isLoaded">
  22. <view class="top">
  23. <view class="">
  24. <u-search placeholder="请输入任务名称" bgColor="#edf6f9" borderColor="#4cb2b6" v-model="taskname"
  25. :showAction="false"></u-search>
  26. <view class="search-time">
  27. <uni-datetime-picker v-model="kewords" type="daterange" @custom="changeLog" />
  28. </view>
  29. </view>
  30. <view class="search-icon">
  31. <u-icon name="search" color="#4CB2B6" size="42" @click="changeLog"></u-icon>
  32. </view>
  33. </view>
  34. <u-list-item v-for="(item, index) in tableData" :key="index" @click.native="onClick(item)" link>
  35. <uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
  36. <uni-col :span="24" class="text-xl font-weight-700"
  37. v-if="my==''">{{ item.task_name }}</uni-col>
  38. <!-- <u-badge v-if="item.isdenger==1" :value="1011" numberType="overflow" isDot
  39. customStyle="margin-right:40px" /> -->
  40. <u-icon v-if="item.isdenger==1&&my==''" name="warning-fill" color="#ff5647" size="28"
  41. customStyle="margin-right:20px"></u-icon>
  42. </uni-row>
  43. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  44. <uni-col :span="24" class="text-cut text-grey1">任务介绍:{{ item.insp_name }}</uni-col>
  45. <u-icon v-if="item.isdenger==1&&my!=''" name="warning-fill" color="#ff5647" size="28"
  46. customStyle="margin-right:20px"></u-icon>
  47. </uni-row>
  48. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  49. <uni-col :span="24" class="text-cut text-grey1">详情描述:{{ item.description }}</uni-col>
  50. </uni-row>
  51. <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  52. <uni-col :span="24" class="text-cut text-grey1">提交时间:{{ item.inspect_time}}</uni-col>
  53. <!-- <uni-col :span="16" class="text-cut text-grey1">提交时间:{{ item.cutofftime }}</uni-col>
  54. <uni-col :span="8" class="justify-end flex ">
  55. <u-button class="margin-right-sm" size="small" color="#4CB2B6" style="width: 160rpx; "
  56. > 查看 </u-button>
  57. <u-button size="small" color="red" style="width: 160rpx;">删除</u-button>
  58. </uni-col> -->
  59. </uni-row>
  60. <!-- <uni-row class="demo-uni-row padding-bottom-sm" :gutter="20" width="100%">
  61. <uni-col :span="24" class="text-cut text-grey1">
  62. <u-avatar-group :urls="item.url" size="35" gap="0.4" maxCount='5' @showMore="onClick(item)">
  63. </u-avatar-group>
  64. </uni-col>
  65. </uni-row> -->
  66. </u-list-item>
  67. </u-list>
  68. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  69. <view class="text-gray" style="padding-top: 20px;">
  70. <img :src="tan90" alt="暂无数据" />
  71. </view>
  72. </view>
  73. <!-- 加载中 -->
  74. <isLodingModel></isLodingModel>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. let that = null;
  81. import {
  82. getInspecthisPage,
  83. getSelfInspecthisPage
  84. } from '@/api/task';
  85. import {
  86. getInsHisImgurl,
  87. } from '@/api/check_record';
  88. import {
  89. shijianc
  90. } from '@/utils/common.js'
  91. import config from '@/config'
  92. const baseUrlImg = config.baseUrlImg
  93. export default {
  94. components: {
  95. Drill: () => import('@/pagesB/components/drill/index.vue'),
  96. FpdDetection: () => import('@/pagesB/components/fpd_detection/fpd_detection.vue'),
  97. FireSpecial: () => import('@/pagesB/components/fireSpecial/index.vue'),
  98. FireWork: () => import('@/pagesB/components/fireWork/index.vue')
  99. },
  100. data() {
  101. return {
  102. items: [{
  103. name: '消防检查结果'
  104. }, {
  105. name: '检查项培训演练'
  106. }, {
  107. name: '消防设施维护和检测'
  108. }, {
  109. name: '特种作业人员'
  110. }, {
  111. name: '动火审批'
  112. }],
  113. isLoaded: false,
  114. tan90: `${baseUrlImg}/tan90.png`,
  115. // 数据
  116. tableData: [],
  117. taskname: '',
  118. // 每页数据量
  119. pageSize: 20,
  120. kewords: [],
  121. // 当前页
  122. pageNo: 1,
  123. // 数据总量
  124. total: 0,
  125. // tableData数据加载中
  126. loading: false,
  127. statusList: {
  128. 0: '未完成',
  129. 1: '已完成',
  130. 2: '审核中',
  131. 3: '审核未通过'
  132. },
  133. my: '',
  134. title: '暂无数据',
  135. tagLabel: [{
  136. value: 0,
  137. rotues: '',
  138. label: '消防检查结果'
  139. },
  140. {
  141. value: 1,
  142. rotues: 'Drill',
  143. label: '检查项培训演练'
  144. },
  145. {
  146. value: 2,
  147. rotues: 'fpd-detection',
  148. label: '消防设施维护和检测'
  149. },
  150. {
  151. value: 3,
  152. rotues: 'fire-special',
  153. label: '特种作业人员'
  154. },
  155. {
  156. value: 4,
  157. rotues: 'fire-work',
  158. label: '动火审批'
  159. },
  160. ],
  161. drill: false,
  162. fireService: false,
  163. special: false,
  164. hotApproval: false,
  165. fireInspection: true,
  166. clicKValue: 0, //点击的样式
  167. selectedTag: '',
  168. current: ''
  169. };
  170. },
  171. watch: {
  172. loading: {
  173. handler(newLength, oldLength) {
  174. this.$modal.isLoadingModel(this.loading)
  175. },
  176. immediate: true
  177. }
  178. },
  179. // 在 vue页面,向起始页通过事件传递数据
  180. onLoad: function(option) {
  181. if (option.my) {
  182. this.my = option.my
  183. }
  184. },
  185. onShow() {
  186. this.tableData = []
  187. this.getData(1);
  188. this.selectedTag = ''
  189. this.fireInspection = true
  190. this.current = 0
  191. },
  192. methods: {
  193. // tab头部点击
  194. onClickItem(e) {
  195. if (this.current !== e.index) {
  196. this.current = e.index
  197. }
  198. this.fireInspection = false;
  199. switch (e.index) {
  200. case 0:
  201. this.fireInspection = true //消防检查结果
  202. this.selectedTag = ''
  203. break;
  204. case 1:
  205. this.drill = true //培训与演练
  206. this.selectedTag = 'Drill'
  207. break;
  208. case 2:
  209. this.fireService = true //消防设施维护和检测
  210. this.selectedTag = 'FpdDetection'
  211. break;
  212. case 3:
  213. this.special = true //特种作业人员
  214. this.selectedTag = 'FireSpecial'
  215. break;
  216. case 4:
  217. this.hotApproval = true //动火审批
  218. this.selectedTag = 'FireWork'
  219. break;
  220. default:
  221. break;
  222. }
  223. },
  224. setInverted(value, rotues) { //标签的点击事件
  225. this.fireInspection = false;
  226. // this.drill = false;
  227. // this.fireService = false;
  228. // this.special = false;
  229. // this.hotApproval = false;
  230. switch (value) {
  231. case 0:
  232. this.fireInspection = true //消防检查结果
  233. break;
  234. case 1:
  235. // this.drill = true //培训与演练
  236. // break;
  237. // case 2:
  238. // this.fireService = true //消防设施维护和检测
  239. // break;
  240. // case 3:
  241. // this.special = true //特种作业人员
  242. // break;
  243. // case 4:
  244. // this.hotApproval = true //动火审批
  245. // break;
  246. // default:
  247. // break;
  248. }
  249. this.clicKValue = value
  250. this.selectedTag = rotues;
  251. },
  252. changeLog(e) {
  253. this.title = ''
  254. this.isLoaded = false
  255. this.tableData = []
  256. if (this.kewords.length > 0 && this.kewords[0].indexOf(":") === -1) {
  257. this.kewords[0] = this.kewords[0] + ' 00:00:00'
  258. this.kewords[1] = this.kewords[1] + ' 23:59:59'
  259. }
  260. this.getData(1)
  261. },
  262. // =================数据转换==================
  263. statusListTran(val) {
  264. //status状态转换
  265. return this.statusList[val];
  266. },
  267. // ================================
  268. // 获取数据
  269. getData(pageNo, value = '') {
  270. this.loading = true;
  271. this.pageNo = pageNo;
  272. let formChuan = {
  273. pageNo: this.pageNo,
  274. pageSize: this.pageSize,
  275. userId: this.$store.state.user.id,
  276. inspectTime: this.kewords,
  277. taskName: this.taskname
  278. }
  279. if (this.my == 'onlymy') {
  280. getSelfInspecthisPage(formChuan).then(response => {
  281. // 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
  282. this.isLoaded = true
  283. this.tableData = [...this.tableData, ...response.data.records];
  284. this.tableData.map(i => {
  285. i.inspect_time = shijianc(i.inspect_time)
  286. })
  287. // this.tableData = response.data.list;
  288. this.total = response.data.total;
  289. this.loading = false;
  290. });
  291. } else {
  292. getInspecthisPage(formChuan).then(response => {
  293. this.isLoaded = true
  294. // 为数据赋值:通过展开运算符的形式,进行新旧数据的拼接
  295. this.tableData = [...this.tableData, ...response.data.list];
  296. this.tableData.map(i => {
  297. i.inspect_time = shijianc(i.inspect_time)
  298. })
  299. // this.tableData = response.data.list;
  300. this.total = response.data.total;
  301. this.loading = false;
  302. });
  303. }
  304. },
  305. onClick(val) {
  306. this.isLoaded = false
  307. if (this.my == "myonly") {
  308. uni.navigateTo({
  309. url: `/pagesB/fire/check_record/picture/picture?items=${JSON.stringify(val)}`
  310. });
  311. } else {
  312. uni.navigateTo({
  313. url: `/pagesB/fire/check_record/picture/picture?id=${val.id}`
  314. });
  315. }
  316. },
  317. gotoDetails(val) {
  318. this.isLoaded = false
  319. var url = '';
  320. if (val.status == 1) {
  321. //主动检查详情
  322. url = '/pagesA/fire/check_active/check_details/check_details?id=' + val.id;
  323. } else if (val.status == 2) {
  324. //每日巡检详情
  325. url = '/pages/s9Unit/daily_inspection/inspection_details/inspection_details?id=' + val.id;
  326. } else if (val.status == 3) {
  327. url = '/pagesA/fire/hidden_trouble/trouble_details/trouble_details?id=' + val.id;
  328. } else if (val.status == 4) {
  329. url = '/pagesA/fire/check_tasks/tasks_details/tasks_details?id=' + val.id;
  330. } else {}
  331. uni.navigateTo({
  332. url: url
  333. });
  334. },
  335. gotoPersonnelDetails(val) {
  336. this.isLoaded = false
  337. uni.navigateTo({
  338. url: '/pagesB/fire/check_record/personnel_record/personnel_record?id=' + val.id
  339. });
  340. },
  341. // 触底的事件
  342. scrolltolower() {
  343. // 判断是否还有下一页数据
  344. if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  345. title: `数据加载完毕`
  346. });
  347. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  348. if (this.loading) return;
  349. this.pageNo += 1;
  350. this.getData(this.pageNo);
  351. }
  352. // 触底的事件
  353. // onReachBottom() {
  354. // // 判断是否还有下一页数据
  355. // if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  356. // title: `数据加载完毕`
  357. // })
  358. // // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  359. // if (this.loading) return
  360. // this.pageNo += 1
  361. // this.getData(this.pageNo)
  362. // }
  363. }
  364. };
  365. </script>
  366. <style scoped lang="scss">
  367. .uni-container {
  368. height: 100vh;
  369. }
  370. page{
  371. background-color:#F5F7F9 ;
  372. }
  373. .top {
  374. display: flex;
  375. align-items: center;
  376. width: 90%;
  377. margin-left: 5%;
  378. justify-content: space-between;
  379. .search-time {
  380. display: flex;
  381. align-items: center;
  382. margin-top: 40rpx;
  383. margin-bottom: 20rpx;
  384. .time-item {
  385. margin-right: 20rpx;
  386. }
  387. }
  388. }
  389. ::v-deep .u-icon__icon {
  390. top: 2px !important;
  391. padding-left: 3px !important;
  392. }
  393. ::v-deep .uni-section-header {
  394. padding: 0 !important;
  395. }
  396. .bg {
  397. background-color: #bdbdbd;
  398. }
  399. </style>