works.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <div class="index-container">
  3. <nav-bar :leftArrow="false"></nav-bar>
  4. <!-- 步骤条 -->
  5. <van-tabs class="tab-tabs" color="#008cd6" @click="tabClickHandler" v-if="workList && workList.length > 0">
  6. <van-tab
  7. :title="i.taskTypeText"
  8. :name="worksLink(1, i.taskType)"
  9. v-for="i in workList"
  10. :key="i.taskType"
  11. :badge="i.nums"
  12. >
  13. <template v-for="item in workList">
  14. <!-- 列表 -->
  15. <div class="cellMargin" v-if="item.taskType == i.taskType" :key="item.taskType">
  16. <!-- 标题区域 -->
  17. <!-- lz -->
  18. <van-cell
  19. :value="item.nums"
  20. is-link
  21. :to="{ path: worksLink(3, item.taskType) }"
  22. :id="worksLink(1, item.taskType)"
  23. >
  24. <!-- 使用 title 插槽来自定义标题 -->
  25. <template #title>
  26. <span class="titleLeft"> </span>
  27. <span class="custom-title">{{ item.taskTypeText }} </span>
  28. </template>
  29. </van-cell>
  30. <!-- 待办区域 -->
  31. <div class="marginCls" v-if="item.taskType == i.taskType">
  32. <!-- <van-empty description="暂无数据" /> -->
  33. <van-cell-group>
  34. <van-cell
  35. @click.stop="isFalgHandler(i, item.taskType, item.id)"
  36. v-for="(i, index) in item.dataList"
  37. :key="index"
  38. class="mainTitle"
  39. :value="worksLink(2, item.taskType, i.recStatus ? i.recStatus : i.status)"
  40. :label="
  41. i.startTime.substring(5, i.startTime.length - 3) +
  42. '至' +
  43. i.endTime.substring(5, i.endTime.length - 3)
  44. "
  45. :value-class="iColorClas(item.taskType, i.status)"
  46. >
  47. <template #title>
  48. <span class="custom-title"
  49. >{{ i.taskName }}
  50. <van-tag
  51. class="resetDy"
  52. @click.stop="resetHandler(i.id)"
  53. v-if="i.status == 1 && item.taskType == 3"
  54. type="primary"
  55. >重新调阅</van-tag
  56. ></span
  57. >
  58. </template>
  59. <template #right-icon>
  60. <van-icon name="arrow" class="rightIcon" />
  61. </template>
  62. </van-cell>
  63. </van-cell-group>
  64. </div>
  65. </div>
  66. </template>
  67. </van-tab>
  68. </van-tabs>
  69. <!-- 扫描弹框 -->
  70. <scandialog ref="scandialog" @input="resultImg" @changeNFC="getNFC"></scandialog>
  71. </div>
  72. </template>
  73. <script>
  74. import scandialog from '@/components/nfcPopup/alone.vue'
  75. import TopBar from '@/components/TopBar'
  76. import { Toast, Dialog } from 'vant'
  77. import { base64ToBlob } from '@/utils/base64TurnImg.js'
  78. import { registration, resetTask } from '@/api/toConsult.js'
  79. import { upload } from '@/api/public'
  80. import { getPanelList } from '@/api/drillTask.js'
  81. export default {
  82. name: 'works',
  83. components: { TopBar, scandialog },
  84. data() {
  85. return {
  86. big_box: 'big_box',
  87. active: 0,
  88. taskId: '', //监控调阅ID
  89. workList: [], //工作台列表
  90. oldScrollTop: '',
  91. falg: false //待调阅的时候 不进行跳转页面单独处理
  92. }
  93. },
  94. mounted() {
  95. if (this.orgId) {
  96. this.$refs.topbar.getTheWeather()
  97. }
  98. // if (this.$refs.topbar.list?.length > 0) {
  99. // this.big_box = 'big_boxTwo'
  100. // }
  101. },
  102. created() {
  103. this.getList()
  104. },
  105. methods: {
  106. iColorClas(type, status) {
  107. if (status == 0|| (type == 9 && status == 1)|| (type == 9 && status == 10) || (type == 0 && status == 1) || (type == 2 && status == 1)) {
  108. return 'wj-title-blue'
  109. } else {
  110. return 'wj-title-orange'
  111. }
  112. },
  113. isFalgHandler(i, taskType, id) {
  114. if (i.isExist != undefined && i.isExist == 0) {
  115. return Dialog.alert({
  116. message: '机构下没有主机摄像头,不能开启调阅任务!',
  117. confirmButtonText: '关闭'
  118. })
  119. }
  120. //如果当前是待调阅任务 当前页面处理之后再跳转 不是则正常跳转
  121. if (i.status == 0 && taskType == 3) {
  122. this.falg = false
  123. this.taskId = i.id
  124. this.$refs.scandialog.visible = true
  125. this.globalLoading = true
  126. } else {
  127. this.falg = true
  128. this.$router.push({ path: this.worksLink(4, taskType, i.status, i.id, i) })
  129. }
  130. },
  131. getList() {
  132. getPanelList().then(res => {
  133. let { data, code, msg } = res
  134. this.workList = data
  135. })
  136. },
  137. worksLink(type, val, taskType = '', id = '', item) {
  138. //type 列表类型区分 //val 类型值 //taskType 具体列表项区分 //id 任务id
  139. let str = ''
  140. let strName = ''
  141. let path = ''
  142. let pathInfo = ''
  143. switch (val) {
  144. case 0:
  145. str = '/lz'
  146. strName = '待履职'
  147. path = '/resumption'
  148. pathInfo = `/resumption_detail`
  149. break
  150. case 3:
  151. str = '/dy'
  152. strName = '待调阅'
  153. path = '/monitoringCall'
  154. pathInfo = '/consultInfo_' + id
  155. break
  156. case 2:
  157. strName = '待检查'
  158. path = '/securityCheckRegister'
  159. pathInfo = '/securityDetail' + id
  160. str = '/jc'
  161. break
  162. case 4:
  163. str = '/yl'
  164. strName = '待登记'
  165. path = '/rehearsalTask'
  166. pathInfo = '/addRehearsalTask/' + id
  167. break
  168. case 5:
  169. str = '/px'
  170. strName = '待记录'
  171. path = '/training'
  172. pathInfo = '/Addtraining/' + id
  173. break
  174. case 7:
  175. str = '/py'
  176. strName = '待评优'
  177. path = '/rehearsaloptimal'
  178. pathInfo = '/commentSign/' + id
  179. break
  180. case 8:
  181. str = '/wbpj'
  182. strName = '待评价'
  183. path = '/resumptionEvaluate'
  184. pathInfo = '/evaluate/' + id + '_add'
  185. break
  186. case 9:
  187. str = '/wtzg'
  188. strName = '待确认'
  189. path = '/problemItem'
  190. pathInfo = '/problemDetail?id=' + id + '&type=confirm'
  191. break
  192. case '/qt':
  193. str = '/qt'
  194. case 10:
  195. str = '/lfsp'
  196. strName = '待审批'
  197. path = '/visitCheck'
  198. pathInfo = '/visitCheckDetail?id=' + id
  199. break
  200. }
  201. if (type == 1) {
  202. return str
  203. } else if (type == 2) {
  204. //返回跳转文字
  205. //履职
  206. if (val == 0 && taskType == 2) {
  207. strName = '进行中'
  208. }
  209. //安全检查
  210. if (val == 2 && taskType == 2) {
  211. strName = '进行中'
  212. }
  213. //监控调阅
  214. if (val == 3 && taskType == 1) {
  215. strName = '调阅中'
  216. }
  217. //演练登记
  218. if (val == 4 && taskType == 2) {
  219. strName = '待评价'
  220. } else if (val == 4 && taskType == 1) {
  221. strName = '待签名'
  222. } else if (val == 4 && taskType == 5) {
  223. strName = '待提交'
  224. } else if (val == 4 && taskType == 10) {
  225. strName = '待评优'
  226. }
  227. //教育培训
  228. if (val == 5 && taskType == 0) {
  229. strName = '待记录'
  230. } else if (val == 5 && taskType == 1) {
  231. strName = '待签名'
  232. } else if (val == 5 && taskType == 4) {
  233. strName = '待提交'
  234. }
  235. //问题整改
  236. if (val == 9 && taskType == 0) {
  237. strName = '待确认'
  238. } else if (val == 9 && taskType == 10) {
  239. strName = '待整改'
  240. } else if (val == 9 && taskType == 1) {
  241. strName = '待审批'
  242. }
  243. return strName
  244. } else if (type == 3) {
  245. //返回列表路径
  246. return path
  247. } else {
  248. //返回详情路径
  249. //问题整改
  250. if (val == 9 && taskType == 1) {
  251. strName = '待审批'
  252. // pathInfo = '/consultInfo/' + id + '_1'
  253. pathInfo = '/problemDetail?id=' + id + '&type=confirmDissent'
  254. }
  255. if (val == 9 && taskType == 10) {
  256. strName = '待整改'
  257. pathInfo = '/problemDetail?id=' + id + '&type=reform'
  258. }
  259. //监控调阅
  260. if (val == 3 && taskType == 1) {
  261. strName = '调阅中'
  262. pathInfo = '/consultInfo/' + id + '_1'
  263. }
  264. //演练登记评价跳转
  265. if (val == 4 && taskType == 2) {
  266. pathInfo = '/rehearsalTaskSign/' + id + '_evaluate'
  267. }
  268. //演练登记签名跳转
  269. if (val == 4 && taskType == 1) {
  270. pathInfo = '/rehearsalTaskSign/' + id + '_edit'
  271. }
  272. //评优推优跳转
  273. if (val == 7 && taskType == 10) {
  274. pathInfo = '/commentSign/' + id + '_comment'
  275. }
  276. //教育培训签名跳转
  277. if (val == 5 && taskType == 1) {
  278. pathInfo = '/personnelSignature/' + id + '_edit'
  279. }
  280. //安全检查跳转
  281. if ((val == 2 && taskType == 1) || (val == 2 && taskType == 2)) {
  282. pathInfo = `/securityAdd?id=${id}&enable=${taskType}`
  283. }
  284. //履职跳转
  285. if ((val == 0 && taskType == 1) || (val == 0 && taskType == 2)) {
  286. pathInfo = `/resumption_detail?id=${id}&enable=${taskType}&taskDate=${item.startTime.split(' ')[0]}
  287. `
  288. }
  289. return pathInfo
  290. }
  291. },
  292. //监控调阅待调阅弹框处理
  293. //文件上传
  294. resultImg(img) {
  295. this.photoHandler(img[0].url)
  296. },
  297. //上传NFC
  298. getNFC(nfc) {
  299. this.photoHandler('', nfc)
  300. },
  301. //扫描图片并上传到服务器和后端
  302. photoHandler(img = '', nfc = '') {
  303. //上传到服务器
  304. //开始调阅上传
  305. let obj = {
  306. startPicture: img,
  307. startNfc: nfc,
  308. taskId: this.taskId
  309. }
  310. registration(obj).then(res => {
  311. let { code, data, msg } = res
  312. if (code == 200) {
  313. Toast.success('扫描成功')
  314. this.$router.push('/consultInfo/' + this.taskId)
  315. }
  316. })
  317. },
  318. //tab栏点击
  319. tabClickHandler(name) {
  320. // const filePath = `/#${name}`
  321. // const tempLink = document.createElement('a')
  322. // tempLink.style.display = 'none'
  323. // tempLink.href = filePath
  324. // tempLink.setAttribute('target', '_self')
  325. // document.body.appendChild(tempLink)
  326. // tempLink.click()
  327. // document.body.removeChild(tempLink)
  328. },
  329. //重新调阅
  330. resetHandler(id) {
  331. Dialog.confirm({
  332. title: '提示',
  333. message: '确认要对该任务进行重新调阅吗?'
  334. }).then(() => {
  335. resetTask(id).then(res => {
  336. if (res.code == 200) {
  337. Toast.success('初始化任务成功')
  338. this.getList()
  339. }
  340. })
  341. })
  342. }
  343. },
  344. beforeDestroy() {
  345. window.removeEventListener('scroll', this.scrolling)
  346. }
  347. }
  348. </script>
  349. <style>
  350. .van-info {
  351. right: -12px;
  352. background-color: #008cd6;
  353. }
  354. </style>
  355. <style lang="scss" scoped>
  356. .van-cell__right-icon {
  357. }
  358. .van-cell::after {
  359. background-color: #008cd6;
  360. }
  361. .titleLeft {
  362. display: inline-block;
  363. width: 8px;
  364. height: 40px;
  365. background-color: #008cd6;
  366. vertical-align: middle;
  367. margin-right: 10px;
  368. }
  369. .van-cell__title {
  370. color: #008cd6;
  371. }
  372. ::v-deep.van-cell__value {
  373. // width: 20%;
  374. float: right;
  375. display: -webkit-flex;
  376. -webkit-flex: none;
  377. flex: none;
  378. }
  379. .mainTitle {
  380. .van-cell__title {
  381. color: black;
  382. }
  383. }
  384. .cellMargin {
  385. margin: 20px;
  386. margin-top: 0px;
  387. height: calc(100vh - 380px);
  388. box-shadow: 0 1px 4px #ccc;
  389. background-color: #fff;
  390. overflow-y: scroll;
  391. }
  392. .marginCls {
  393. min-height: 400px;
  394. width: 100%;
  395. background-color: #fff;
  396. // overflow-y: scroll;
  397. }
  398. .empty {
  399. width: 100%;
  400. height: 100%;
  401. box-sizing: border-box;
  402. }
  403. .index-container {
  404. }
  405. .big_box {
  406. height: calc(100vh - 520px);
  407. overflow: auto;
  408. }
  409. .tab-tabs {
  410. padding-top: 55px;
  411. }
  412. .big_boxTwo {
  413. height: calc(100vh - 570px);
  414. overflow: auto;
  415. }
  416. a {
  417. text-decoration: none;
  418. color: inherit;
  419. margin-right: 10px;
  420. }
  421. .rightIcon {
  422. color: #969799;
  423. line-height: 46px;
  424. font-size: 40px;
  425. }
  426. </style>