index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <view>
  3. <view>
  4. <view class="topTwo">
  5. <!-- 头部导航 -->
  6. <view class="tesx">
  7. <view :class="tobu == 1 ? 'con' : ''" @click="to(1)" style="margin-right: 20rpx;">需要观察</view>
  8. <view :class="tobu == 2 ? 'con' : ''" @click="to(2)">处置记录</view>
  9. </view>
  10. <!-- 搜索框 -->
  11. <view class="sou">
  12. <input class="inp" confirm-type="search" @confirm="search" @input="search" v-model="key"
  13. placeholder="学生姓名" />
  14. <u-icon class="inp-img" name="search" color="#8C8C8C" size="49rpx"></u-icon>
  15. </view>
  16. </view>
  17. </view>
  18. <view style="height: 256rpx;"></view>
  19. <!-- <view class="noData" v-if="listData.length == 0">
  20. 暂无数据
  21. </view> -->
  22. <view v-if="tobu == 1">
  23. <u-swipe-action>
  24. <u-swipe-action-item style="margin-bottom: 32rpx;" v-for="item in listData" :options="swipe"
  25. :disabled="swipeShow" @click="cancelT(item)">
  26. <!-- 任务分块部分 -->
  27. <view class="chunking">
  28. <view @click="toDetails(item.id)">
  29. <view style="overflow: hidden;">
  30. <view class="img-no">
  31. <image :src="item.headUrl"></image>
  32. </view>
  33. <!-- 图片替代 -->
  34. <!-- 基本信息 -->
  35. <view class="chunking-text">
  36. <view class="top">
  37. <text
  38. style="font-size: 32rpx; font-weight: 600 ; margin-right: 10rpx;">{{item.studentName}}</text>
  39. ·
  40. <!-- 这里有个点 -->
  41. <text style="margin-left: 10rpx;">{{item.sex == 1 ? '男' : '女'}}</text>
  42. </view>
  43. <view class="bottom">{{item.age}}岁 <text
  44. style="margin-left: 10rpx;">{{item.grade}}</text></view>
  45. </view>
  46. <!-- 时间 -->
  47. <view class="chunking-time">{{item.createTime}}</view>
  48. </view>
  49. <!-- 简略信息 -->
  50. <view class="brief">
  51. <view style="color: #6241D5; font-weight: 600; margin-bottom: 10rpx;">伤情:</view>
  52. {{item.symptom}}
  53. </view>
  54. <!-- 底部 -->
  55. <view class="block-end">
  56. <!-- 处理人信息 -->
  57. <view class="handle">
  58. 处理人: {{item.disposeUserName}}
  59. </view>
  60. <!-- 跟踪处置 - 按钮 -->
  61. <!-- <view class="ann" style="float: right;" @click="track(1)">
  62. 跟踪处置
  63. </view> -->
  64. </view>
  65. </view>
  66. <!-- 跟踪处置 - 按钮 -->
  67. <view class="ann" style="float: right;" @click="track(item)">
  68. 跟踪处置
  69. </view>
  70. </view>
  71. </u-swipe-action-item>
  72. </u-swipe-action>
  73. </view>
  74. <view v-else>
  75. <!-- 任务分块部分 -->
  76. <view class="chunking" style="margin-bottom: 32rpx;" v-for="(item, id) in listData" :key="id">
  77. <view @click="toDetails(item.id)">
  78. <view style="overflow: hidden;">
  79. <view class="img-no">
  80. <image :src="item.headUrl"></image>
  81. </view>
  82. <!-- 图片替代 -->
  83. <!-- 基本信息 -->
  84. <view class="chunking-text">
  85. <view class="top">
  86. <text
  87. style="font-size: 32rpx; font-weight: 600 ; margin-right: 10rpx;">{{item.studentName}}</text>
  88. ·
  89. <!-- 这里有个点 -->
  90. <text style="margin-left: 10rpx;">{{item.sex == 1 ? '男' : '女'}}</text>
  91. </view>
  92. <view class="bottom">{{item.age}}岁 <text style="margin-left: 10rpx;">{{item.grade}}</text>
  93. </view>
  94. </view>
  95. <!-- 时间 -->
  96. <view class="chunking-time">{{item.createTime}}</view>
  97. </view>
  98. <!-- 简略信息 -->
  99. <view class="brief">
  100. <view style="color: #6241D5; font-weight: 600; margin-bottom: 10rpx;">伤情:</view>
  101. {{item.symptom}}
  102. </view>
  103. <!-- 底部 -->
  104. <view class="block-end">
  105. <!-- 处理人信息 -->
  106. <view class="handle">
  107. 处理人: {{item.disposeUserName}}
  108. </view>
  109. <!-- 跟踪处置 - 按钮 -->
  110. <!-- <view class="ann" style="float: right;" @click="track(1)">
  111. 跟踪处置
  112. </view> -->
  113. </view>
  114. </view>
  115. <!-- 跟踪处置 - 按钮 -->
  116. <!-- <view class="ann" style="float: right;" @click="track(item)">
  117. 跟踪处置
  118. </view> -->
  119. </view>
  120. </view>
  121. <!-- 功能不明确,暂时 -->
  122. <!-- <view @click="signIn">
  123. 登录跳转
  124. </view> -->
  125. <!-- 悬浮按钮 -->
  126. <view class="suspension" @click="toFace">
  127. <image src="../../static/icon.svg"></image>
  128. </view>
  129. <!-- 跟踪处置 -->
  130. <u-action-sheet :closeOnClickOverlay="true" @close="cancel" @select="selectClick" :show="show">
  131. <template>
  132. <view style="padding: 32rpx; text-align: left;">
  133. <RedDot text="处理措施" :required="true"></RedDot>
  134. <u--textarea border="none" v-model="disposeText" style="margin: 32rpx 0 72rpx 0; padding: 0;"
  135. placeholder="请输入" autoHeight />
  136. </view>
  137. <view class="handle-time">
  138. 处理时间:{{time}}
  139. </view>
  140. <view class="behavior" @click="addBehavior" style="color: #7B5DF0; border: 1rpx solid #F5F6F7;">确认
  141. </view>
  142. <view class="behavior" @click="cancel">取消</view>
  143. </template>
  144. </u-action-sheet>
  145. <u-loadmore :status="status" :loading-text="loadingText" :nomore-text="nomoreText" />
  146. </view>
  147. </template>
  148. <script>
  149. import RedDot from '../../conponents/red-dot.vue'
  150. export default {
  151. components: {
  152. RedDot,
  153. },
  154. data() {
  155. return {
  156. providerList: [],
  157. version: '',
  158. tobu: '1',
  159. swipe: [{
  160. text: '取消跟踪',
  161. style: {
  162. backgroundColor: '#FA541C',
  163. }
  164. }],
  165. swipeShow: false,
  166. listData: [], // 列表数据
  167. page: 1, // 分页
  168. tobel: '', // 总数
  169. key: '', // 学生姓名关键字
  170. id: '',
  171. show: false,
  172. disposeText: '',
  173. Record: '', // 添加应急处理数据
  174. time: '', // 跟踪处理时间
  175. status: 'loading',
  176. loadingText: '努力加载中',
  177. nomoreText: '实在没有了',
  178. setTime: null,
  179. img: '',
  180. }
  181. },
  182. onShow() {
  183. this.tobu = '1'
  184. this.listData = []
  185. this.getList()
  186. },
  187. watch:{
  188. listData(newName, oldName){
  189. let time = 1000
  190. for(let item of newName){
  191. if(item.headUrl == null){
  192. setTimeout(()=>{
  193. // 获取头像
  194. this.$request({
  195. url: this.$api.index.getPortrait,
  196. data: {
  197. id: item.studentId,
  198. studentId: item.studentId,
  199. // id: '1612686444118147074',
  200. // studentId: '1612686444118147074',
  201. }
  202. }).then(res => {
  203. item.headUrl = res.data
  204. })
  205. }, time)
  206. time += 1000
  207. }
  208. }
  209. },
  210. },
  211. methods: {
  212. // 跳转登录页面
  213. signIn() {
  214. uni.navigateTo({
  215. url: `/pages/signIn/signIn`
  216. })
  217. },
  218. // 列表数据请求
  219. getList() {
  220. let data = {
  221. pageNum: this.page,
  222. pageSize: 10,
  223. type: this.tobu,
  224. }
  225. if(this.key){
  226. data.search = this.key
  227. }
  228. this.$request({
  229. url: this.$api.index.emergencyList,
  230. data: data
  231. }).then(res => {
  232. if (res.code == 200) {
  233. for (let item of res.data.list) {
  234. item.createTime = item.createTime.replace('T', ' ')
  235. item.createTime = item.createTime.slice(0, item.createTime.length - 3)
  236. }
  237. this.listData.push(...res.data.list)
  238. this.total = res.data.total
  239. if (res.data.total > 10) {
  240. this.status = 'loadmore'
  241. } else {
  242. this.status = 'nomore'
  243. }
  244. } else {
  245. this.$u.toast(err.message)
  246. this.status = 'nomore'
  247. this.listData = []
  248. }
  249. }).catch(err => {
  250. this.$u.toast(err.message)
  251. this.status = 'nomore'
  252. this.listData = []
  253. })
  254. },
  255. // 请求头像
  256. getPortrait(id){
  257. this.$request({
  258. url: this.$api.index.getPortrait,
  259. data: {
  260. id: id,
  261. studentId: id,
  262. }
  263. }).then(res => {
  264. // var arr = res.data
  265. // this.img = res.data
  266. this.getImg(res.data)
  267. console.log(this.getImg(res.data), 'img')
  268. })
  269. },
  270. // 搜索
  271. search() {
  272. // 防抖
  273. if (this.setTime !== null) {
  274. clearTimeout(this.setTime);
  275. }
  276. this.setTime = setTimeout(() => {
  277. this.listData = []
  278. this.getList()
  279. }, 500)
  280. },
  281. // 点击改变是否观察或者处理记录
  282. to(data) {
  283. if (this.status == 'loading') {
  284. return
  285. }
  286. this.page = 1
  287. this.tobu = data
  288. this.listData = []
  289. this.status = 'loading'
  290. setTimeout(() => {
  291. this.getList()
  292. }, 1000)
  293. },
  294. cancelT(data) {
  295. console.log(data)
  296. // return
  297. this.$request({
  298. url: this.$api.index.cancelWatch,
  299. header: {
  300. contentType: "application/json"
  301. },
  302. method: 'POST',
  303. data: {
  304. id: data.id
  305. }
  306. }).then(res => {
  307. this.$u.toast(res.msg)
  308. if (res.code == 200) {
  309. this.listData = []
  310. this.status = 'loading'
  311. this.getList()
  312. }
  313. })
  314. },
  315. // 跟踪处置
  316. track(data) {
  317. console.log(data)
  318. this.time = this.dateFormat("YYYY.mm.dd HH:MM", new Date())
  319. this.Record = data
  320. this.show = true
  321. },
  322. //跳转详情
  323. toDetails(id) {
  324. console.log(id)
  325. uni.navigateTo({
  326. url: `/pages/details/index?id=${id}`
  327. })
  328. },
  329. toFace() {
  330. uni.navigateTo({
  331. url: '/pages/face/index'
  332. })
  333. },
  334. addBehavior() {
  335. if (this.disposeText == '') {
  336. this.$u.toast('处理措施未填写')
  337. return
  338. }
  339. this.$request({
  340. url: this.$api.index.addDisposeRecord,
  341. header: {
  342. contentType: "application/json"
  343. },
  344. method: 'POST',
  345. data: {
  346. id: this.Record.id,
  347. disposeText: this.disposeText,
  348. }
  349. }).then(res => {
  350. this.$u.toast(res.msg)
  351. this.cancel()
  352. }).catch(err => {
  353. this.$u.toast(err.msg)
  354. this.cancel()
  355. })
  356. },
  357. cancel() {
  358. this.show = false
  359. this.disposeText = ''
  360. },
  361. // 获取时间
  362. dateFormat(fmt, date) {
  363. let ret;
  364. const opt = {
  365. "Y+": date.getFullYear().toString(), // 年
  366. "m+": (date.getMonth() + 1).toString(), // 月
  367. "d+": date.getDate().toString(), // 日
  368. "H+": date.getHours().toString(), // 时
  369. "M+": date.getMinutes().toString(), // 分
  370. "S+": date.getSeconds().toString() // 秒
  371. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  372. };
  373. for (let k in opt) {
  374. ret = new RegExp("(" + k + ")").exec(fmt);
  375. if (ret) {
  376. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  377. };
  378. };
  379. return fmt;
  380. },
  381. onReachBottom() {
  382. // console.log(this.page, this.total)
  383. setTimeout(() => {
  384. if (this.total - this.page * 10 <= 0) {
  385. this.status = 'nomore'
  386. // console.log('ww')
  387. } else {
  388. // console.log('w')
  389. this.status = 'loading';
  390. this.page++
  391. this.getList()
  392. }
  393. }, 1000)
  394. }
  395. }
  396. }
  397. </script>
  398. <style lang="scss" scoped>
  399. page {
  400. padding: 0 32rpx;
  401. /* background-color: #D9D9D9; */
  402. background-color: #F5F5F5 !important;
  403. }
  404. .topTwo {
  405. position: fixed;
  406. top: -2rpx;
  407. background-color: #f5f5f5;
  408. padding-bottom: 10rpx;
  409. z-index: 999;
  410. width: 100%;
  411. box-sizing: border-box;
  412. padding-right: 65rpx;
  413. }
  414. .tesx {
  415. display: flex;
  416. align-items: center;
  417. font-size: 32rpx;
  418. color: rgba(0, 0, 0, 0.60);
  419. height: 128rpx;
  420. margin-bottom: 16rpx;
  421. }
  422. .con {
  423. font-size: 40rpx;
  424. font-weight: 600;
  425. color: #000;
  426. }
  427. .sou {
  428. margin-bottom: 30rpx;
  429. position: relative;
  430. overflow: hidden;
  431. }
  432. .inp {
  433. height: 72rpx;
  434. border: 2rpx solid #D9D9D9;
  435. border-radius: 50px;
  436. box-sizing: border-box;
  437. padding-left: 60rpx;
  438. }
  439. .inp-img {
  440. position: absolute;
  441. top: 10rpx;
  442. left: 10rpx;
  443. }
  444. .chunking {
  445. height: 400rpx;
  446. border-radius: 32rpx;
  447. background-color: #fff;
  448. box-sizing: border-box;
  449. padding: 32rpx;
  450. position: relative;
  451. }
  452. .img-no {
  453. width: 83rpx;
  454. height: 83rpx;
  455. background-color: #D9D9D9;
  456. border-radius: 50rpx;
  457. margin-right: 15rpx;
  458. float: left;
  459. overflow: hidden;
  460. image{
  461. width: 100%;
  462. height: 100%;
  463. }
  464. }
  465. .chunking-text {
  466. float: left;
  467. font-size: 25rpx;
  468. display: flex;
  469. flex-direction: column;
  470. justify-content: center;
  471. }
  472. .chunking-text .top {
  473. margin: 5rpx 0;
  474. }
  475. .chunking-text .buttom {}
  476. .chunking-time {
  477. float: right;
  478. font-size: 28rpx;
  479. color: rgba(0, 0, 0, 0.60);
  480. height: 83rpx;
  481. line-height: 83rpx;
  482. }
  483. .brief {
  484. width: 622rpx;
  485. height: 136rpx;
  486. background: #fafafa;
  487. border-radius: 16rpx;
  488. margin-top: 33rpx;
  489. box-sizing: border-box;
  490. padding: 16rpx 23rpx;
  491. font-size: 28rpx;
  492. color: rgba(0, 0, 0, 0.60);
  493. font-weight: 500;
  494. overflow:hidden;
  495. white-space:nowrap;
  496. text-overflow:ellipsis;
  497. }
  498. .block-end {
  499. height: 56rpx;
  500. font-size: 28rpx;
  501. color: #000;
  502. font-weight: 500;
  503. margin-top: 32rpx;
  504. }
  505. .handle {
  506. float: left;
  507. line-height: 58rpx;
  508. }
  509. .ann {
  510. float: right;
  511. border: 1px solid #fa8c16;
  512. box-sizing: border-box;
  513. padding: 9rpx 25rpx;
  514. color: #FA8C16;
  515. border-radius: 40rpx;
  516. position: relative;
  517. bottom: 56rpx;
  518. z-index: 9;
  519. font-size: 28rpx;
  520. }
  521. .suspension {
  522. width: 96rpx;
  523. height: 96rpx;
  524. border-radius: 50px;
  525. background-color: #7b5df0;
  526. position: fixed;
  527. right: 32rpx;
  528. bottom: 168rpx;
  529. z-index: 999;
  530. }
  531. .suspension image {
  532. width: 100%;
  533. height: 100%;
  534. }
  535. /* 滑块单元格样式 */
  536. .u-swipe-action-item {
  537. border-radius: 32rpx;
  538. }
  539. .swipe-action {
  540. &__content {
  541. padding: 25rpx 0;
  542. &__text {
  543. font-size: 28rpx;
  544. color: #fff;
  545. padding-left: 30rpx;
  546. }
  547. }
  548. }
  549. .handle-time {
  550. height: 80rpx;
  551. line-height: 80rpx;
  552. background: #f5f6f7;
  553. margin-top: 18rpx;
  554. box-sizing: border-box;
  555. padding-left: 32rpx;
  556. color: rgba(0, 0, 0, 0.60);
  557. font-size: 23rpx;
  558. text-align: left;
  559. }
  560. .behavior {
  561. height: 112rpx;
  562. line-height: 112rpx;
  563. font-size: 33rpx;
  564. color: #000;
  565. }
  566. // 暂无数据
  567. .noData {
  568. text-align: center;
  569. }
  570. </style>