index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <div>
  3. <NavBar :go="{ type: 'push', path: '/menu' }" />
  4. <van-row>
  5. <van-col span="24">
  6. <org-tree v-model="cascaderValue" @change="getDataList"></org-tree>
  7. </van-col>
  8. </van-row>
  9. <van-row>
  10. <van-col span="12"
  11. ><van-field
  12. v-model="fieldValue"
  13. label-width="3em"
  14. clearable
  15. :disabled="showStatus"
  16. label="状态"
  17. placeholder=""
  18. @click="showStatus = true"
  19. ><van-icon name="arrow-down" slot="button"
  20. /></van-field>
  21. <van-popup v-model="showStatus" round position="bottom">
  22. <van-picker
  23. title="调阅状态"
  24. show-toolbar
  25. :columns="columns"
  26. @confirm="onConfirm"
  27. confirm-button-text="确定"
  28. @cancel="onCancel"
  29. @change="onChange"
  30. :close-on-click-overlay="false"
  31. /> </van-popup
  32. ></van-col>
  33. <van-col span="12">
  34. <van-field
  35. v-model="currentDate"
  36. clearable
  37. :disabled="showDate"
  38. label-width="3em"
  39. label="月份"
  40. placeholder=""
  41. @click="showDate = true"
  42. ><van-icon name="arrow-down" slot="button"
  43. /></van-field>
  44. <van-popup v-model="showDate" round position="bottom">
  45. <van-datetime-picker
  46. v-model="presentDate"
  47. @cancel="onCancel"
  48. confirm-button-text="确定"
  49. @confirm="onDateConfirm"
  50. type="year-month"
  51. title="月份"
  52. ref="pickers"
  53. />
  54. </van-popup>
  55. </van-col>
  56. </van-row>
  57. <!-- 调阅列表 -->
  58. <div class="bigbox">
  59. <van-list
  60. v-model="loading"
  61. :immediate-check="false"
  62. :finished="finished"
  63. finished-text="没有更多了"
  64. @load="onLoad"
  65. >
  66. <van-cell-group>
  67. <van-cell
  68. @click.stop="linkHandler(item.status, item.id, item)"
  69. :title="item.taskName"
  70. v-for="item in taskList"
  71. :key="item.id"
  72. size="large"
  73. :label="item.planStartTime + '~' + item.planEndTime"
  74. :is-link="item.status != 3"
  75. >
  76. <template #title>
  77. <span class="custom-title">
  78. {{ item.taskName
  79. }}<van-tag class="resetDy" @click.stop="resetHandler(item.id)" v-if="item.status == 1" type="primary"
  80. >重新调阅</van-tag
  81. ></span
  82. >
  83. <!-- v-if="item.status == 1" -->
  84. <span :class="monitor[item.status]">{{ item.status | statusFilter(this_) }}</span>
  85. </template>
  86. </van-cell>
  87. </van-cell-group>
  88. </van-list>
  89. </div>
  90. <!-- 扫描弹框 -->
  91. <scandialog ref="scandialog" @input="resultImg" @changeNFC="getNFC"></scandialog>
  92. </div>
  93. </template>
  94. <script>
  95. import NavBar from '@/components/NavBar'
  96. import { Col, Row, Cascader, Dialog, DatetimePicker, Icon, Picker } from 'vant'
  97. import { deptTreeList, selectListApp, registration, resetTask } from '@/api/toConsult.js'
  98. import { Toast } from 'vant'
  99. import OrgTree from '@/components/orgTree'
  100. import { newDateMonth } from '@/utils/date.js'
  101. import scandialog from '@/components/nfcPopup/alone.vue'
  102. import { base64ToBlob } from '@/utils/base64TurnImg.js'
  103. import { upload } from '@/api/public'
  104. export default {
  105. data() {
  106. return {
  107. pageNum: 1,
  108. loading: false, //加载状态
  109. finished: false, //是否全部加载完成
  110. str: '',
  111. fieldValue: '全部',
  112. monitor: ['monitor', 'monitored', 'monitoring', 'waringtoring'], //状态样式
  113. value1: JSON.parse(sessionStorage.getItem('SET_USER_ORGNAME')) || '', //输入框model
  114. currentDate: newDateMonth(),
  115. presentDate: '', //当前时间
  116. cascaderValue: '',
  117. columns: ['全部'],
  118. statusList: [], //调阅状态字典数组
  119. show: false,
  120. this_: this,
  121. showStatus: false,
  122. showDate: false,
  123. showDialog: false,
  124. fieldNames: {
  125. text: 'name',
  126. value: 'id',
  127. children: 'children'
  128. },
  129. taskId: '', //当前点击所属任务ID
  130. taskList: [], //任务数组集合
  131. options: [] //机构数组
  132. }
  133. },
  134. components: {
  135. NavBar,
  136. OrgTree,
  137. scandialog,
  138. Dialog,
  139. Icon,
  140. DatetimePicker,
  141. Picker,
  142. Col,
  143. Row,
  144. Cascader
  145. },
  146. filters: {
  147. statusFilter(value, this_) {
  148. let str = ''
  149. if (this_.statusList.length > 0) {
  150. this_.statusList.forEach(item => {
  151. if (value == item.dictValue) {
  152. str = item.dictLabel
  153. }
  154. })
  155. }
  156. return str
  157. }
  158. },
  159. computed: {
  160. presentDateCpd() {
  161. return new Date(+newDateMonth().split('-')[0], +newDateMonth().split('-')[1] - 1)
  162. }
  163. },
  164. created() {
  165. this.presentDate = this.presentDateCpd
  166. this.init()
  167. },
  168. mounted() {
  169. this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
  170. },
  171. methods: {
  172. //单元格点击事件
  173. linkHandler(status, id, item) {
  174. if (item.isExist == 0 && status == 0) {
  175. Dialog.alert({
  176. message: '机构下没有主机摄像头,不能开启调阅任务!',
  177. confirmButtonText: '关闭'
  178. })
  179. return
  180. }
  181. if (status == 0) {
  182. //判断当前时间是否小于开始时间 小于则不能进行操作
  183. let date = new Date().getTime()
  184. let startDate = Date.parse(new Date(item.planStartTime))
  185. if (date <= startDate) {
  186. Toast.success('当前调阅任务还未开始,不能进行调阅')
  187. } else {
  188. this.startMonitorHandler(id)
  189. }
  190. }
  191. if (status == 3) {
  192. return Toast('当前监控调阅任务已逾期,无法操作!')
  193. }
  194. if (status != 0 && status != 3) {
  195. this.lookInfoHandler(id, status)
  196. }
  197. },
  198. //重新调阅
  199. resetHandler(id) {
  200. Dialog.confirm({
  201. title: '提示',
  202. message: '确认要对该任务进行重新调阅吗?'
  203. }).then(() => {
  204. resetTask(id).then(res => {
  205. if (res.code == 200) {
  206. Toast.success('初始化任务成功')
  207. this.selectListAppHandler()
  208. }
  209. })
  210. })
  211. },
  212. //机构变化
  213. getDataList(v) {
  214. this.cascaderValue = v
  215. this.selectListAppHandler()
  216. },
  217. //onLoad下拉刷新
  218. onLoad() {
  219. if (this.pageNum == 1) {
  220. this.pageNum = 2
  221. }
  222. this.loading = true
  223. this.selectListAppHandler(1, () => {
  224. this.pageNum++
  225. this.loading = false
  226. })
  227. },
  228. //清空查询条件
  229. clearSearch() {
  230. this.str = ''
  231. this.cascaderValue = ''
  232. this.value1 = ''
  233. this.currentDate = ''
  234. this.fieldValue = ''
  235. this.selectListAppHandler()
  236. },
  237. //nfc拍照功能完成
  238. change(img) {
  239. console.log(img)
  240. },
  241. //初始化
  242. init() {
  243. //获取调阅状态字典
  244. this.getDictHandler('retrieval_task_status', res => {
  245. this.statusList = res
  246. res.forEach(item => {
  247. this.columns.push(item.dictLabel)
  248. })
  249. })
  250. // this.selectListAppHandler()
  251. },
  252. selectListAppHandler(type = 0, callBack = () => {}) {
  253. if (!type) {
  254. this.pageNum = 1
  255. this.taskList = []
  256. }
  257. //获取任务列表
  258. selectListApp({
  259. pageNum: this.pageNum,
  260. pageSize: 10,
  261. status: this.str || '',
  262. orgId: this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || '',
  263. moth: this.currentDate || ''
  264. }).then(res => {
  265. let { code, rows, total } = res
  266. if (code == 200) {
  267. if (type) {
  268. this.taskList.push(...rows)
  269. if (this.taskList.length >= total) {
  270. //已加载完全部数据
  271. this.finished = true
  272. } else {
  273. callBack()
  274. }
  275. } else {
  276. this.taskList.push(...rows)
  277. this.finished = false
  278. this.loading = false
  279. if (this.taskList.length >= total) {
  280. //已加载完全部数据
  281. this.finished = true
  282. }
  283. // this.taskList = rows || []
  284. }
  285. } else {
  286. // this.finished = true
  287. // this.taskList = []
  288. }
  289. })
  290. },
  291. //扫描NFC
  292. nfcHandler() {
  293. //NFC和图片对应字段先写死后期接入app之后再做更改
  294. let obj = {
  295. nfc: 'nfc',
  296. taskId: this.taskId
  297. }
  298. registration(obj).then(res => {
  299. let { code, data, msg } = res
  300. if (code == 200) {
  301. Toast.success('扫描成功')
  302. this.$router.push('/consultInfo/' + this.taskId)
  303. }
  304. })
  305. },
  306. //扫描图片并上传到服务器和后端
  307. photoHandler(img = '', nfc = '') {
  308. //上传到服务器
  309. //开始调阅上传
  310. let obj = {
  311. startPicture: img,
  312. startNfc: nfc,
  313. taskId: this.taskId
  314. }
  315. registration(obj).then(res => {
  316. let { code, data, msg } = res
  317. if (code == 200) {
  318. Toast.success('扫描成功')
  319. this.$router.push('/consultInfo/' + this.taskId)
  320. }
  321. })
  322. },
  323. //文件上传
  324. resultImg(img) {
  325. this.photoHandler(img[0].url)
  326. },
  327. //上传NFC
  328. getNFC(nfc) {
  329. this.photoHandler('', nfc)
  330. },
  331. //关闭弹框事件
  332. closeDialog() {
  333. this.show = false
  334. this.selectListAppHandler()
  335. },
  336. // 开始调阅事件
  337. startMonitorHandler(taskId) {
  338. this.taskId = taskId
  339. this.$refs.scandialog.visible = true
  340. },
  341. //查看调阅详情
  342. lookInfoHandler(taskId, status) {
  343. this.taskId = taskId
  344. this.$router.push('/consultInfo/' + taskId + '_' + status)
  345. },
  346. //级联选择当前任意层级触发
  347. changeCascader(val) {
  348. console.log(val)
  349. let { selectedOptions } = val
  350. //级联值
  351. this.cascaderValue = selectedOptions[selectedOptions.length - 1].id
  352. //输入框值
  353. this.value1 = selectedOptions[selectedOptions.length - 1].name
  354. },
  355. onFinish() {},
  356. //搜索选择状态时触发
  357. onConfirm(value, index) {
  358. this.fieldValue = value
  359. this.statusList.forEach(item => {
  360. if (value == item.dictLabel) {
  361. this.str = item.dictValue
  362. }
  363. })
  364. if (value == '全部') {
  365. this.str = ''
  366. }
  367. this.showStatus = false
  368. this.selectListAppHandler()
  369. },
  370. //月份选中触发
  371. onDateConfirm() {
  372. this.currentDate = this.newDate(this.presentDate)
  373. this.showDate = false
  374. this.selectListAppHandler()
  375. },
  376. //日期转换
  377. newDate(time) {
  378. var date = new Date(time)
  379. var y = date.getFullYear()
  380. var m = date.getMonth() + 1
  381. m = m < 10 ? '0' + m : m
  382. var d = date.getDate()
  383. d = d < 10 ? '0' + d : d
  384. return y + '-' + m
  385. },
  386. onChange(picker, value, index) {},
  387. onCancel() {
  388. this.show = false
  389. this.showStatus = false
  390. this.showDate = false
  391. }
  392. }
  393. }
  394. </script>
  395. <style lang="scss" scoped>
  396. .topBox {
  397. border: 1px solid #ccc;
  398. margin: 20px;
  399. display: flex;
  400. .sonLeftBox {
  401. padding: 10px;
  402. flex: 1;
  403. background-color: #fff;
  404. }
  405. }
  406. .custom-title {
  407. font-weight: bold;
  408. }
  409. .van-cell__label {
  410. font-size: 25px;
  411. }
  412. .monitor {
  413. color: #008cd6;
  414. padding-left: 10px;
  415. padding-right: 10px;
  416. float: right;
  417. // font-size: 20px;
  418. // border-radius: 10px;
  419. // background-color: #8cb585;
  420. }
  421. .monitored {
  422. color: #bc9f71;
  423. padding-left: 10px;
  424. padding-right: 10px;
  425. float: right;
  426. // font-size: 20px;
  427. // border-radius: 10px;
  428. // background-color: #1989fa;
  429. }
  430. .monitoring {
  431. color: #009240;
  432. padding-left: 10px;
  433. padding-right: 10px;
  434. float: right;
  435. // font-size: 20px;
  436. // border-radius: 10px;
  437. // background-color: #25da0b;
  438. }
  439. .waringtoring {
  440. color: #d7000f;
  441. padding-left: 10px;
  442. padding-right: 10px;
  443. float: right;
  444. // font-size: 20px;
  445. // border-radius: 10px;
  446. // background-color: #e46962;
  447. }
  448. .title {
  449. margin: 10px;
  450. margin-left: 0px;
  451. font-size: 40px;
  452. }
  453. .time {
  454. font-size: 32px;
  455. }
  456. .startMonitor {
  457. background-color: #f5f5f9;
  458. color: #1989fa;
  459. width: 160px;
  460. line-height: 200px;
  461. font-size: 36px;
  462. text-align: center;
  463. }
  464. .endMonitor {
  465. background-color: #f5f5f9;
  466. color: #1989fa;
  467. width: 160px;
  468. line-height: 200px;
  469. font-size: 36px;
  470. text-align: center;
  471. }
  472. .img_box {
  473. text-align: center;
  474. .img {
  475. width: 200px;
  476. height: 200px;
  477. }
  478. }
  479. .text {
  480. text-align: center;
  481. font-size: 30px;
  482. margin-top: 30px;
  483. margin-bottom: 100px;
  484. }
  485. .btns {
  486. margin-top: 40px;
  487. margin-bottom: 40px;
  488. display: flex;
  489. justify-content: space-around;
  490. .nfcPhoto {
  491. color: #409bf2;
  492. div {
  493. width: 100%;
  494. text-align: center;
  495. }
  496. }
  497. }
  498. .btnf_box {
  499. background-color: #fff;
  500. }
  501. .van-dialog {
  502. padding: 30px;
  503. }
  504. .spanimg {
  505. display: flex;
  506. justify-content: flex-end;
  507. .close {
  508. width: 50px;
  509. height: 50px;
  510. }
  511. }
  512. .btn {
  513. float: right;
  514. margin-top: 24px;
  515. margin-right: 20px;
  516. box-sizing: border-box;
  517. }
  518. .bigbox {
  519. height: calc(100vh - 400px);
  520. overflow: scroll;
  521. margin-top: 20px;
  522. margin-left: 20px;
  523. margin-right: 20px;
  524. background-color: #fff;
  525. }
  526. .card {
  527. margin: 20px;
  528. margin-bottom: 0px;
  529. box-shadow: 0 8px 12px #ebedf0;
  530. }
  531. .titleClass {
  532. display: flex;
  533. align-items: center;
  534. height: 100%;
  535. padding: 20px;
  536. border-bottom: 1px solid #ccc;
  537. .title {
  538. font-size: 30px;
  539. font-weight: bold;
  540. flex: 1;
  541. line-height: 50px;
  542. }
  543. }
  544. .mainItem {
  545. display: flex;
  546. font-size: 28px;
  547. padding: 20px;
  548. justify-content: revert;
  549. .date {
  550. margin-left: 30px;
  551. }
  552. .condition {
  553. color: #1989fa;
  554. text-decoration: underline;
  555. }
  556. }
  557. .bttons {
  558. color: #1989fa;
  559. border: none;
  560. }
  561. :deep.van-field--disabled {
  562. color: #323233;
  563. }
  564. :deep.van-field--disabled .van-field__label {
  565. color: #323233;
  566. }
  567. :deep .van-field__control[disabled] {
  568. color: #323233;
  569. -webkit-text-fill-color: #323233;
  570. }
  571. .resetDy {
  572. margin-left: 20px;
  573. }
  574. </style>