index.vue 13 KB

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