index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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-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. />
  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. mounted() {
  151. this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
  152. this.init()
  153. },
  154. methods: {
  155. //单元格点击事件
  156. linkHandler(status,id,item){
  157. if(status==0){
  158. //判断当前时间是否小于开始时间 小于则不能进行操作
  159. let date = new Date().getTime()
  160. let startDate = Date.parse(new Date(item.planStartTime))
  161. if(date<=startDate){
  162. Toast.success('当前调阅任务还未开始,不能进行调阅')
  163. }else{
  164. this.startMonitorHandler(id)
  165. }
  166. }
  167. if(status!=0&&status!=3){
  168. this.lookInfoHandler(id,status)
  169. }
  170. },
  171. //机构变化
  172. getDataList(v) {
  173. this.cascaderValue = v
  174. this.selectListAppHandler()
  175. },
  176. //onLoad下拉刷新
  177. onLoad() {
  178. if (this.pageNum == 1) {
  179. this.pageNum = 2
  180. }
  181. this.selectListAppHandler(1, () => {
  182. this.loading = false
  183. this.pageNum++
  184. })
  185. },
  186. //清空查询条件
  187. clearSearch() {
  188. this.str = ''
  189. this.cascaderValue = ''
  190. this.value1 = ''
  191. this.currentDate = ''
  192. this.fieldValue = ''
  193. this.selectListAppHandler()
  194. },
  195. //nfc拍照功能完成
  196. change(img) {
  197. console.log(img)
  198. },
  199. //初始化
  200. init() {
  201. //获取调阅状态字典
  202. this.getDictHandler('retrieval_task_status', res => {
  203. this.statusList = res
  204. res.forEach(item => {
  205. this.columns.push(item.dictLabel)
  206. })
  207. })
  208. this.selectListAppHandler()
  209. },
  210. selectListAppHandler(type = 0, callBack = () => {}) {
  211. if (!type) {
  212. this.pageNum = 1
  213. }
  214. //获取任务列表
  215. selectListApp({
  216. pageNum: this.pageNum,
  217. pageSize: 10,
  218. status: this.str || '',
  219. orgId: this.cascaderValue || '',
  220. moth: this.currentDate || ''
  221. }).then(res => {
  222. let { code, rows, msg } = res
  223. if (code == 200) {
  224. if (type) {
  225. this.taskList.push(...rows)
  226. if (rows.length == 0 || rows.length < 10) {
  227. //已加载完全部数据
  228. this.finished = true
  229. }
  230. callBack()
  231. } else {
  232. this.finished = false
  233. this.taskList = rows
  234. }
  235. // if(num===1){
  236. // this.loading = false
  237. // this.pageNum++
  238. // }
  239. }
  240. })
  241. },
  242. //扫描NFC
  243. nfcHandler() {
  244. //NFC和图片对应字段先写死后期接入app之后再做更改
  245. let obj = {
  246. nfc: 'nfc',
  247. taskId: this.taskId
  248. }
  249. registration(obj).then(res => {
  250. let { code, data, msg } = res
  251. if (code == 200) {
  252. Toast.success('扫描成功')
  253. this.$router.push('/consultInfo/' + this.taskId)
  254. }
  255. })
  256. },
  257. //扫描图片并上传到服务器和后端
  258. photoHandler(img = '', nfc = '') {
  259. //上传到服务器
  260. //开始调阅上传
  261. let obj = {
  262. startPicture: img,
  263. startNfc: nfc,
  264. taskId: this.taskId
  265. }
  266. registration(obj).then(res => {
  267. let { code, data, msg } = res
  268. if (code == 200) {
  269. Toast.success('扫描成功')
  270. this.$router.push('/consultInfo/' + this.taskId)
  271. }
  272. })
  273. },
  274. //文件上传
  275. resultImg(img) {
  276. let obj = base64ToBlob(img.base)
  277. let formData = new FormData()
  278. obj.name = '调阅.jpg'
  279. formData.append('file', base64ToBlob(img.base))
  280. upload(formData, 'image')
  281. .then(res => {
  282. debugger
  283. console.log(process.env.NODE_ENV)
  284. /*上传成功*/
  285. let imgUrl = process.env.NODE_ENV === 'development' ? res.data.url : window.origin + res.data.url
  286. this.photoHandler(imgUrl)
  287. // this.$emit("imgUrl", res.data.url);
  288. })
  289. .catch(err => {
  290. /*上传失败*/
  291. })
  292. },
  293. //上传NFC
  294. getNFC(nfc) {
  295. this.photoHandler('', nfc)
  296. },
  297. //关闭弹框事件
  298. closeDialog() {
  299. this.show = false
  300. this.selectListAppHandler()
  301. },
  302. // 开始调阅事件
  303. startMonitorHandler(taskId) {
  304. this.taskId = taskId
  305. this.$refs.scandialog.visible = true
  306. },
  307. //查看调阅详情
  308. lookInfoHandler(taskId, status) {
  309. this.taskId = taskId
  310. this.$router.push('/consultInfo/' + taskId + '_' + status)
  311. },
  312. //级联选择当前任意层级触发
  313. changeCascader(val) {
  314. console.log(val)
  315. let { selectedOptions } = val
  316. //级联值
  317. this.cascaderValue = selectedOptions[selectedOptions.length - 1].id
  318. //输入框值
  319. this.value1 = selectedOptions[selectedOptions.length - 1].name
  320. },
  321. onFinish() {},
  322. //搜索选择状态时触发
  323. onConfirm(value, index) {
  324. this.fieldValue = value
  325. this.statusList.forEach(item => {
  326. if (value == item.dictLabel) {
  327. this.str = item.dictValue
  328. }
  329. })
  330. if(value=='全部'){
  331. this.str =''
  332. }
  333. this.showStatus = false
  334. this.selectListAppHandler()
  335. },
  336. //月份选中触发
  337. onDateConfirm() {
  338. this.currentDate = this.newDate(this.presentDate)
  339. this.showDate = false
  340. this.selectListAppHandler()
  341. },
  342. //日期转换
  343. newDate(time) {
  344. var date = new Date(time)
  345. var y = date.getFullYear()
  346. var m = date.getMonth() + 1
  347. m = m < 10 ? '0' + m : m
  348. var d = date.getDate()
  349. d = d < 10 ? '0' + d : d
  350. return y + '-' + m
  351. },
  352. // //日期组件change
  353. // changeHandler(Picker){
  354. // console.log(Picker);
  355. // console.log(Picker.getValues());
  356. // debugger
  357. // },
  358. onChange(picker, value, index) {},
  359. onCancel() {
  360. this.show = false
  361. this.showStatus = false
  362. this.showDate = false
  363. }
  364. }
  365. }
  366. </script>
  367. <style lang="scss" scoped>
  368. .topBox {
  369. border: 1px solid #ccc;
  370. margin: 20px;
  371. display: flex;
  372. .sonLeftBox {
  373. padding: 10px;
  374. flex: 1;
  375. background-color: #fff;
  376. }
  377. }
  378. .custom-title{
  379. font-weight: bold;
  380. }
  381. .van-cell__label{
  382. font-size: 20px;
  383. }
  384. .monitor {
  385. color: #ed6a0c;
  386. padding-left: 10px;
  387. padding-right: 10px;
  388. float: right;
  389. font-size: 20px;
  390. // border-radius: 10px;
  391. // background-color: #8cb585;
  392. }
  393. .monitored {
  394. color: #1989fa;
  395. padding-left: 10px;
  396. padding-right: 10px;
  397. float: right;
  398. font-size: 20px;
  399. // border-radius: 10px;
  400. // background-color: #1989fa;
  401. }
  402. .monitoring {
  403. color: #7fd355;
  404. padding-left: 10px;
  405. padding-right: 10px;
  406. float: right;
  407. font-size: 20px;
  408. // border-radius: 10px;
  409. // background-color: #25da0b;
  410. }
  411. .waringtoring {
  412. color: #e46962;
  413. padding-left: 10px;
  414. padding-right: 10px;
  415. float: right;
  416. font-size: 20px;
  417. // border-radius: 10px;
  418. // background-color: #e46962;
  419. }
  420. .title {
  421. margin: 10px;
  422. margin-left: 0px;
  423. font-size: 40px;
  424. }
  425. .time {
  426. font-size: 32px;
  427. }
  428. .startMonitor {
  429. background-color: #f5f5f9;
  430. color: #1989fa;
  431. width: 160px;
  432. line-height: 200px;
  433. font-size: 36px;
  434. text-align: center;
  435. }
  436. .endMonitor {
  437. background-color: #f5f5f9;
  438. color: #1989fa;
  439. width: 160px;
  440. line-height: 200px;
  441. font-size: 36px;
  442. text-align: center;
  443. }
  444. .img_box {
  445. text-align: center;
  446. .img {
  447. width: 200px;
  448. height: 200px;
  449. }
  450. }
  451. .text {
  452. text-align: center;
  453. font-size: 30px;
  454. margin-top: 30px;
  455. margin-bottom: 100px;
  456. }
  457. .btns {
  458. margin-top: 40px;
  459. margin-bottom: 40px;
  460. display: flex;
  461. justify-content: space-around;
  462. .nfcPhoto {
  463. color: #409bf2;
  464. div {
  465. width: 100%;
  466. text-align: center;
  467. }
  468. }
  469. }
  470. .btnf_box {
  471. background-color: #fff;
  472. }
  473. .van-dialog {
  474. padding: 30px;
  475. }
  476. .spanimg {
  477. display: flex;
  478. justify-content: flex-end;
  479. .close {
  480. width: 50px;
  481. height: 50px;
  482. }
  483. }
  484. .btn {
  485. float: right;
  486. margin-top: 24px;
  487. margin-right: 20px;
  488. box-sizing: border-box;
  489. }
  490. .bigbox {
  491. height: calc(100vh - 400px);
  492. overflow: scroll;
  493. margin-top: 20px;
  494. margin-left: 20px;
  495. margin-right: 20px;
  496. background-color: #fff;
  497. }
  498. .card {
  499. margin: 20px;
  500. margin-bottom: 0px;
  501. box-shadow: 0 8px 12px #ebedf0;
  502. }
  503. .titleClass {
  504. display: flex;
  505. align-items: center;
  506. height: 100%;
  507. padding: 20px;
  508. border-bottom: 1px solid #ccc;
  509. .title {
  510. font-size: 30px;
  511. font-weight: bold;
  512. flex: 1;
  513. line-height: 50px;
  514. }
  515. }
  516. .mainItem {
  517. display: flex;
  518. font-size: 28px;
  519. padding: 20px;
  520. justify-content: revert;
  521. .date {
  522. margin-left: 30px;
  523. }
  524. .condition {
  525. color: #1989fa;
  526. text-decoration: underline;
  527. }
  528. }
  529. .bttons {
  530. color: #1989fa;
  531. border: none;
  532. }
  533. :deep.van-field--disabled{
  534. color: #323233;
  535. }
  536. :deep.van-field--disabled .van-field__label{
  537. color: #323233;
  538. }
  539. :deep .van-field__control[disabled]{
  540. color: #323233;
  541. -webkit-text-fill-color: #323233;
  542. }
  543. </style>