index.vue 15 KB

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