index.vue 10 KB

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