index.vue 13 KB

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