index.vue 11 KB

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