index.vue 11 KB

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