index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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 :threshold="60" style="margin-bottom: 32rpx;" v-for="(item, index) in listData" :options="swipe"
  25. :disabled="swipeShow" @click="cancelT(item)" :key="index">
  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. },
  191. },
  192. methods: {
  193. // 跳转登录页面
  194. signIn() {
  195. uni.navigateTo({
  196. url: `/pages/signIn/signIn`
  197. })
  198. },
  199. // 列表数据请求
  200. getList() {
  201. let data = {
  202. pageNum: this.page,
  203. pageSize: 5,
  204. type: this.tobu,
  205. }
  206. if(this.key){
  207. data.search = this.key
  208. }
  209. this.$request({
  210. url: this.$api.index.emergencyList,
  211. data: data
  212. }).then( res => {
  213. if (res.code == 200) {
  214. for (let item of res.data.list) {
  215. item.createTime = item.createTime.replace('T', ' ')
  216. item.createTime = item.createTime.slice(0, item.createTime.length - 3)
  217. }
  218. this.listData.push(...res.data.list)
  219. this.total = res.data.total
  220. if (res.data.total > 5) {
  221. this.status = 'loadmore'
  222. } else {
  223. this.status = 'nomore'
  224. }
  225. this.getChildHead()
  226. } else {
  227. this.$u.toast(err.message)
  228. this.status = 'nomore'
  229. this.listData = []
  230. }
  231. }).catch(err => {
  232. this.$u.toast(err.message)
  233. this.status = 'nomore'
  234. this.listData = []
  235. })
  236. },
  237. getChildHead(){
  238. for(let index = 0 ;index< this.listData.length ;index++){
  239. let item = this.listData[index]
  240. if(item.headUrl) continue;
  241. let existIndex = this.listData.findIndex(s=>s.studentId == item.studentId && s.headUrl)
  242. if(existIndex > -1) {
  243. item.headUrl = this.listData[existIndex].headUrl
  244. continue;
  245. }
  246. this.$request({
  247. url: this.$api.index.getPortrait,
  248. data: {
  249. id: item.studentId,
  250. studentId: item.studentId,
  251. }
  252. }).then((headRes)=>{
  253. this.listData[index].headUrl = headRes.data
  254. this.$set(this.listData,index,this.listData[index])
  255. })
  256. }
  257. },
  258. // 请求头像
  259. getPortrait(id){
  260. this.$request({
  261. url: this.$api.index.getPortrait,
  262. data: {
  263. id: id,
  264. studentId: id,
  265. }
  266. }).then(res => {
  267. // var arr = res.data
  268. // this.img = res.data
  269. this.getImg(res.data)
  270. console.log(this.getImg(res.data), 'img')
  271. })
  272. },
  273. // 搜索
  274. search() {
  275. // 防抖
  276. if (this.setTime !== null) {
  277. clearTimeout(this.setTime);
  278. }
  279. this.setTime = setTimeout(() => {
  280. this.listData = []
  281. this.getList()
  282. }, 500)
  283. },
  284. // 点击改变是否观察或者处理记录
  285. to(data) {
  286. this.key = ''
  287. this.page = 1
  288. this.tobu = data
  289. this.listData = []
  290. this.status = 'loading'
  291. this.getList()
  292. },
  293. cancelT(data) {
  294. console.log(data)
  295. // return
  296. this.$request({
  297. url: this.$api.index.cancelWatch,
  298. header: {
  299. contentType: "application/json"
  300. },
  301. method: 'POST',
  302. data: {
  303. id: data.id
  304. }
  305. }).then(res => {
  306. this.$u.toast(res.msg)
  307. if (res.code == 200) {
  308. this.listData = []
  309. this.status = 'loading'
  310. this.getList()
  311. }
  312. })
  313. },
  314. // 跟踪处置
  315. track(data) {
  316. console.log(data)
  317. this.time = this.dateFormat("YYYY.mm.dd HH:MM", new Date())
  318. this.Record = data
  319. this.show = true
  320. },
  321. //跳转详情
  322. toDetails(id) {
  323. console.log(id)
  324. uni.navigateTo({
  325. url: `/pages/details/index?id=${id}`
  326. })
  327. },
  328. toFace() {
  329. uni.navigateTo({
  330. url: '/pages/face/index'
  331. })
  332. },
  333. addBehavior() {
  334. if (this.disposeText == '') {
  335. this.$u.toast('处理措施未填写')
  336. return
  337. }
  338. this.$request({
  339. url: this.$api.index.addDisposeRecord,
  340. header: {
  341. contentType: "application/json"
  342. },
  343. method: 'POST',
  344. data: {
  345. id: this.Record.id,
  346. disposeText: this.disposeText,
  347. }
  348. }).then(res => {
  349. this.$u.toast(res.msg)
  350. this.cancel()
  351. }).catch(err => {
  352. this.$u.toast(err.msg)
  353. this.cancel()
  354. })
  355. },
  356. cancel() {
  357. this.show = false
  358. this.disposeText = ''
  359. },
  360. // 获取时间
  361. dateFormat(fmt, date) {
  362. let ret;
  363. const opt = {
  364. "Y+": date.getFullYear().toString(), // 年
  365. "m+": (date.getMonth() + 1).toString(), // 月
  366. "d+": date.getDate().toString(), // 日
  367. "H+": date.getHours().toString(), // 时
  368. "M+": date.getMinutes().toString(), // 分
  369. "S+": date.getSeconds().toString() // 秒
  370. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  371. };
  372. for (let k in opt) {
  373. ret = new RegExp("(" + k + ")").exec(fmt);
  374. if (ret) {
  375. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  376. };
  377. };
  378. return fmt;
  379. },
  380. onReachBottom() {
  381. // console.log(this.page, this.total)
  382. if (this.total - this.page * 5 <= 0) {
  383. this.status = 'nomore'
  384. // console.log('ww')
  385. } else {
  386. // console.log('w')
  387. this.status = 'loading';
  388. this.page++
  389. this.getList()
  390. }
  391. }
  392. }
  393. }
  394. </script>
  395. <style lang="scss" scoped>
  396. page {
  397. padding: 0 32rpx;
  398. /* background-color: #D9D9D9; */
  399. background-color: #F5F5F5 !important;
  400. }
  401. .topTwo {
  402. position: fixed;
  403. top: -2rpx;
  404. background-color: #f5f5f5;
  405. padding-bottom: 10rpx;
  406. z-index: 999;
  407. width: 100%;
  408. box-sizing: border-box;
  409. padding-right: 65rpx;
  410. }
  411. .tesx {
  412. display: flex;
  413. align-items: center;
  414. font-size: 32rpx;
  415. color: rgba(0, 0, 0, 0.60);
  416. height: 128rpx;
  417. margin-bottom: 16rpx;
  418. }
  419. .con {
  420. font-size: 40rpx;
  421. font-weight: 600;
  422. color: #000;
  423. }
  424. .sou {
  425. margin-bottom: 30rpx;
  426. position: relative;
  427. overflow: hidden;
  428. }
  429. .inp {
  430. height: 72rpx;
  431. border: 2rpx solid #D9D9D9;
  432. border-radius: 50px;
  433. box-sizing: border-box;
  434. padding-left: 60rpx;
  435. }
  436. .inp-img {
  437. position: absolute;
  438. top: 10rpx;
  439. left: 10rpx;
  440. }
  441. .chunking {
  442. height: 400rpx;
  443. border-radius: 32rpx;
  444. background-color: #fff;
  445. box-sizing: border-box;
  446. padding: 32rpx;
  447. position: relative;
  448. }
  449. .img-no {
  450. width: 83rpx;
  451. height: 83rpx;
  452. background-color: #D9D9D9;
  453. border-radius: 50rpx;
  454. margin-right: 15rpx;
  455. float: left;
  456. overflow: hidden;
  457. image{
  458. width: 100%;
  459. height: 100%;
  460. }
  461. }
  462. .chunking-text {
  463. float: left;
  464. font-size: 25rpx;
  465. display: flex;
  466. flex-direction: column;
  467. justify-content: center;
  468. }
  469. .chunking-text .top {
  470. margin: 5rpx 0;
  471. }
  472. .chunking-text .buttom {}
  473. .chunking-time {
  474. float: right;
  475. font-size: 28rpx;
  476. color: rgba(0, 0, 0, 0.60);
  477. height: 83rpx;
  478. line-height: 83rpx;
  479. }
  480. .brief {
  481. width: 622rpx;
  482. height: 136rpx;
  483. background: #fafafa;
  484. border-radius: 16rpx;
  485. margin-top: 33rpx;
  486. box-sizing: border-box;
  487. padding: 16rpx 23rpx;
  488. font-size: 28rpx;
  489. color: rgba(0, 0, 0, 0.60);
  490. font-weight: 500;
  491. overflow:hidden;
  492. white-space:nowrap;
  493. text-overflow:ellipsis;
  494. }
  495. .block-end {
  496. height: 56rpx;
  497. font-size: 28rpx;
  498. color: #000;
  499. font-weight: 500;
  500. margin-top: 32rpx;
  501. }
  502. .handle {
  503. float: left;
  504. line-height: 58rpx;
  505. }
  506. .ann {
  507. float: right;
  508. border: 1px solid #fa8c16;
  509. box-sizing: border-box;
  510. padding: 9rpx 25rpx;
  511. color: #FA8C16;
  512. border-radius: 40rpx;
  513. position: relative;
  514. bottom: 56rpx;
  515. z-index: 9;
  516. font-size: 28rpx;
  517. }
  518. .suspension {
  519. width: 96rpx;
  520. height: 96rpx;
  521. border-radius: 50px;
  522. background-color: #7b5df0;
  523. position: fixed;
  524. right: 32rpx;
  525. bottom: 168rpx;
  526. z-index: 999;
  527. }
  528. .suspension image {
  529. width: 100%;
  530. height: 100%;
  531. }
  532. /* 滑块单元格样式 */
  533. .u-swipe-action-item {
  534. border-radius: 32rpx;
  535. }
  536. .swipe-action {
  537. &__content {
  538. padding: 25rpx 0;
  539. &__text {
  540. font-size: 28rpx;
  541. color: #fff;
  542. padding-left: 30rpx;
  543. }
  544. }
  545. }
  546. .handle-time {
  547. height: 80rpx;
  548. line-height: 80rpx;
  549. background: #f5f6f7;
  550. margin-top: 18rpx;
  551. box-sizing: border-box;
  552. padding-left: 32rpx;
  553. color: rgba(0, 0, 0, 0.60);
  554. font-size: 23rpx;
  555. text-align: left;
  556. }
  557. .behavior {
  558. height: 112rpx;
  559. line-height: 112rpx;
  560. font-size: 33rpx;
  561. color: #000;
  562. }
  563. // 暂无数据
  564. .noData {
  565. text-align: center;
  566. }
  567. </style>