addResult.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <view class="content">
  3. <view class="form-box">
  4. <view class="form-item">
  5. <text class="label">指标名称</text>
  6. <input type="text" :value="detail.indicatorName" class="form-input" disabled="disabled"/>
  7. </view>
  8. <view class="form-item">
  9. <text class="label">参考值范围</text>
  10. <input type="text" :value="detail.referenceMin+'-'+detail.referenceMax" class="form-input" disabled="disabled"/>
  11. </view>
  12. <view class="form-item">
  13. <text class="label">指标单位</text>
  14. <input type="text" :value="unitName" class="form-input" disabled="disabled"/>
  15. </view>
  16. <view class="form-item">
  17. <text class="label">检测值</text>
  18. <input type="digit" v-model="form.testValue" placeholder="请输入测量值" placeholder-class="form-input" />
  19. </view>
  20. </view>
  21. <view class="btn-box2">
  22. <view class="sub-btn" @click="submit()">
  23. 确认
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {getResultById,updateResult,addResult,getListAll,listEnabled,listByIndicator} from '@/api/companyUser.js'
  30. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  31. export default {
  32. mixins: [MescrollMixin],
  33. data() {
  34. return {
  35. orderStatus:[
  36. {name:"电话记录",val:1},
  37. {name:"短信记录",val:2},
  38. ],
  39. aIndex:0,
  40. cates:[],
  41. tags:[],
  42. str:null,
  43. end:null,
  44. showType:1,
  45. mescroll:null,
  46. indicatorName:null,
  47. unitName:null,
  48. // 上拉加载的配置
  49. upOption: {
  50. onScroll:true,
  51. use: true, // 是否启用上拉加载; 默认true
  52. page: {
  53. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  54. size: 10 // 每页数据的数量,默认10
  55. },
  56. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  57. empty: {
  58. icon:'/static/images/no_data.png',
  59. tip: '暂无数据'
  60. }
  61. },
  62. // 列表数据
  63. form:null,
  64. detail:null
  65. }
  66. },
  67. onLoad(options) {
  68. this.type=options.type;
  69. if(this.type=='edit'){
  70. this.resultId=options.resultId;
  71. this.reportId=options.reportId
  72. this.getResultById();
  73. // this.listByIndicator()
  74. }
  75. // this.form.reportId=options.reportId
  76. // this.form.resultId=options.resultId
  77. this.getListAll()
  78. this.listEnabled()
  79. // uni.$on('refreshDoctorOrder', () => {
  80. // this.mescroll.resetUpScroll()
  81. // })
  82. },
  83. methods: {
  84. changeTag(index){
  85. this.aIndex=index
  86. },
  87. bindNameChange:function(e,list) {
  88. console.log(list[e.target.value],'--')
  89. this.indicatorName = list[e.target.value].indicatorName
  90. this.form.indicatorName = list[e.target.value].indicatorName
  91. this.form.indicatorId=list[e.target.value].indicatorId
  92. },
  93. bindUnitChange:function(e,list) {
  94. console.log(e.target.value)
  95. this.unitName = list[e.target.value].unitSymbol
  96. this.form.unitName = list[e.target.value].unitSymbol
  97. },
  98. radioClick(id) {
  99. this.form.isAbnormal=id
  100. },
  101. getListAll(){
  102. getListAll().then(
  103. res => {
  104. if(res.code==200){
  105. this.tags=res.data;
  106. }else{
  107. uni.showToast({
  108. title: res.msg,
  109. });
  110. }
  111. },
  112. rej => {}
  113. );
  114. },
  115. listEnabled() {
  116. listEnabled().then(
  117. res => {
  118. if (res.code == 200) {
  119. this.cates = res.data;
  120. } else {
  121. uni.showToast({
  122. icon: 'none',
  123. title: res.msg,
  124. });
  125. }
  126. },
  127. rej => {}
  128. );
  129. },
  130. getResultById(){
  131. getResultById(this.resultId).then(
  132. res => {
  133. if(res.code==200){
  134. this.form=res.data;
  135. this.detail=res.indicator
  136. const unit = this.tags.find(item => item.unitId == res.indicator.unitId);
  137. // 安全地获取单位名称,避免空数组错误
  138. this.unitName = unit ? unit.unitSymbol : '';
  139. }else{
  140. uni.showToast({
  141. title: res.msg,
  142. });
  143. }
  144. },
  145. rej => {}
  146. );
  147. },
  148. listByIndicator(){
  149. listByIndicator(this.resultId).then(
  150. res => {
  151. if(res.code==200){
  152. this.form=res.data;
  153. // this.unitName = this.tags[res.data.unitId].unitSymbol
  154. // this.form.examDate=this.form.examDate.slice(0,5)
  155. }else{
  156. uni.showToast({
  157. title: res.msg,
  158. });
  159. }
  160. },
  161. rej => {}
  162. );
  163. },
  164. submit(){
  165. // if(this.form.testValue==null){
  166. // uni.showToast({
  167. // icon:'none',
  168. // title: "检测值不能为空",
  169. // });
  170. // return;
  171. // }
  172. // if(this.form.indicatorName==null){
  173. // uni.showToast({
  174. // icon:'none',
  175. // title: "指标名称不能为空",
  176. // });
  177. // return;
  178. // }
  179. // if(this.form.unitName==null){
  180. // uni.showToast({
  181. // icon:'none',
  182. // title: "单位不能为空",
  183. // });
  184. // return;
  185. // }
  186. if(this.form.testValue==null){
  187. uni.showToast({
  188. icon:'none',
  189. title: "检测值不能为空",
  190. });
  191. return;
  192. }
  193. this.form.unitName=this.unitName
  194. // if(this.form.recordTime==null){
  195. // uni.showToast({
  196. // icon:'none',
  197. // title: "记录时间不能为空",
  198. // });
  199. // return;
  200. // }
  201. // if(this.form.mealDescription==null){
  202. // uni.showToast({
  203. // icon:'none',
  204. // title: "用餐情况不能为空",
  205. // });
  206. // return;
  207. // }
  208. if(this.type=="add"){
  209. this.addResult()
  210. }
  211. else if(this.type=="edit"){
  212. this.updateResult()
  213. }
  214. },
  215. updateResult(){
  216. updateResult(this.form).then(
  217. res => {
  218. if(res.code==200){
  219. uni.showToast({
  220. icon:'success',
  221. title: "更新成功",
  222. });
  223. setTimeout(function() {
  224. uni.$emit('refreshInformation');
  225. uni.$emit('refreshBatchRecord');
  226. uni.navigateBack({
  227. delta: 1
  228. })
  229. }, 500);
  230. }else{
  231. uni.showToast({
  232. icon:'none',
  233. title: res.msg,
  234. });
  235. }
  236. },
  237. rej => {}
  238. );
  239. },
  240. addResult(){
  241. addResult(this.form).then(
  242. res => {
  243. if(res.code==200){
  244. uni.showToast({
  245. icon:'success',
  246. title: "操作成功",
  247. });
  248. setTimeout(function() {
  249. uni.$emit('refreshInformation');
  250. uni.$emit('refreshBatchRecord');
  251. uni.navigateBack({
  252. delta: 1
  253. })
  254. }, 500);
  255. }else{
  256. uni.showToast({
  257. icon:'none',
  258. title: res.msg,
  259. });
  260. }
  261. },
  262. rej => {}
  263. );
  264. },
  265. // tab切换
  266. orderStatusChange(item) {
  267. this.showType = item.val
  268. this.mescroll.resetUpScroll()
  269. },
  270. mescrollInit(mescroll) {
  271. this.mescroll = mescroll;
  272. },
  273. /*下拉刷新的回调 */
  274. downCallback(mescroll) {
  275. mescroll.resetUpScroll()
  276. },
  277. upCallback(page) {
  278. //联网加载数据
  279. var that = this;
  280. var data = {
  281. status:this.showType,
  282. page: page.num,
  283. pageSize: page.size
  284. };
  285. // getMyDoctorOrderList(data).then(res => {
  286. // if(res.code==200){
  287. // //设置列表数据
  288. // if (page.num == 1) {
  289. // that.dataList = res.data.list;
  290. // } else {
  291. // that.dataList = that.dataList.concat(res.data.list);
  292. // }
  293. // that.mescroll.endBySize(res.data.list.length, res.data.total);
  294. // }else{
  295. // uni.showToast({
  296. // icon:'none',
  297. // title: "请求失败",
  298. // });
  299. // that.dataList = null;
  300. // that.mescroll.endErr();
  301. // }
  302. // });
  303. },
  304. showDetail(item) {
  305. if(item.orderType==1){
  306. uni.navigateTo({
  307. url: '/pages_doctor/doctorOrderIM?orderId='+item.orderId
  308. })
  309. }
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss">
  315. .content{
  316. padding: 20upx;
  317. .form-box{
  318. // padding: 0 30upx;
  319. // background: #FFFFFF;
  320. // border-radius: 16upx;
  321. .form-item{
  322. padding: 30upx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: space-between;
  326. background: #FFFFFF;
  327. border-radius: 16rpx 16rpx 16rpx 16rpx;
  328. margin-bottom: 20rpx;
  329. // border-bottom: 1px solid #F1F1F1;
  330. &:last-child{
  331. margin-bottom:0;
  332. }
  333. .label{
  334. font-family: PingFang SC, PingFang SC;
  335. font-weight: 500;
  336. font-size: 32rpx;
  337. color: #222426;
  338. line-height: 34rpx;
  339. text-align: left;
  340. }
  341. input{
  342. text-align: right;
  343. }
  344. .to{
  345. color: #626468;
  346. margin: 0 20rpx;
  347. }
  348. .switch{
  349. width: 232rpx;
  350. height: 72rpx;
  351. background: #FFFFFF;
  352. border-radius: 36rpx 36rpx 36rpx 36rpx;
  353. border: 2rpx solid #008FD3;
  354. .item{
  355. width: 112rpx;
  356. height: 64rpx;
  357. line-height: 63rpx;
  358. font-weight: 400;
  359. font-size: 24rpx;
  360. color: #008FD3;
  361. text-align: center;
  362. &.active{
  363. color: #FFFFFF;
  364. background: #008FD3;
  365. border-radius: 32rpx 32rpx 32rpx 32rpx;
  366. }
  367. }
  368. }
  369. .form-input{
  370. font-size: 32upx;
  371. font-family: PingFang SC;
  372. font-weight: 400;
  373. color: #999999;
  374. text-align: right;
  375. }
  376. .form-input2{
  377. width: 150rpx;
  378. // font-size: 32upx;
  379. // font-family: PingFang SC;
  380. // font-weight: 400;
  381. // color: #999999;
  382. // text-align:center;
  383. }
  384. .birth-picker {
  385. flex: 1;
  386. display: flex;
  387. align-items: center;
  388. .right-box{
  389. width: 100%;
  390. display: flex;
  391. align-items: center;
  392. .input-box{
  393. width: 470upx;
  394. }
  395. .arrow{
  396. width: 13upx;
  397. height: 23upx;
  398. margin-left: 20upx;
  399. }
  400. }
  401. }
  402. }
  403. .note{
  404. font-family: PingFang SC, PingFang SC;
  405. font-weight: 400;
  406. font-size: 24rpx;
  407. color: #898E91;
  408. text-align: left;
  409. }
  410. }
  411. .btn-box2{
  412. z-index: 9999;
  413. width: 100%;
  414. padding: 30upx;
  415. // position: fixed;
  416. bottom: 0;
  417. left: 0;
  418. box-sizing: border-box;
  419. // background: #FFFFFF;
  420. display: flex;
  421. align-items: center;
  422. justify-content: space-between;
  423. padding-bottom: 40rpx;
  424. .sub-btn{
  425. flex:1;
  426. // width: 100%;
  427. height: 88upx;
  428. line-height: 88upx;
  429. text-align: center;
  430. font-size: 32upx;
  431. font-family: PingFang SC;
  432. font-weight: bold;
  433. color: #FFFFFF;
  434. background: #008FD3;
  435. border-radius: 44upx;
  436. display: flex;
  437. align-items: center;
  438. border: 2rpx solid #008FD3;
  439. justify-content: center;
  440. image{
  441. margin-right: 16rpx;
  442. }
  443. }
  444. .sub-btn2{
  445. flex:1;
  446. height: 88upx;
  447. line-height: 88upx;
  448. text-align: center;
  449. font-size: 32rpx;
  450. color: #008FD3;
  451. font-family: PingFang SC;
  452. font-weight: bold;
  453. background: #FFFFFF;
  454. border-radius: 44rpx 44rpx 44rpx 44rpx;
  455. border: 2rpx solid #008FD3;
  456. margin-right: 20rpx;
  457. }
  458. }
  459. .phone-list{
  460. // padding: 30rpx;
  461. .item{
  462. display: flex;
  463. align-items: center;
  464. justify-content: space-between;
  465. background: #FFFFFF;
  466. border-radius: 16rpx 16rpx 16rpx 16rpx;
  467. // border-bottom: 1rpx solid #ECECEC;
  468. padding: 20rpx;
  469. margin-bottom: 20rpx;
  470. &:last-child{
  471. margin-bottom: 0;
  472. }
  473. .phone-name{
  474. display: flex;
  475. flex-direction: column;
  476. align-items: flex-start;
  477. // justify-content: flex-start;
  478. // padding-left: 24rpx;
  479. flex: 1;
  480. .name{
  481. font-family: PingFang SC, PingFang SC;
  482. font-weight: 500;
  483. font-size: 32rpx;
  484. color: #222426;
  485. text-align: left;
  486. }
  487. .type{
  488. font-family: PingFang SC;
  489. font-weight: 400;
  490. font-size: 28rpx;
  491. color: #626468;
  492. text-align: right;
  493. }
  494. .time{
  495. font-family: PingFang SC;
  496. font-weight: 400;
  497. font-size: 24rpx;
  498. color: #898E91;
  499. text-align: left;
  500. margin-top: 14rpx;
  501. }
  502. }
  503. }
  504. }
  505. .sms-list{
  506. .item{
  507. padding: 30rpx;
  508. background: #FFFFFF;
  509. border-radius: 16rpx 16rpx 16rpx 16rpx;
  510. margin-bottom: 20rpx;
  511. .title{
  512. font-family: PingFang SC;
  513. font-weight: 500;
  514. font-size: 32rpx;
  515. color: #222426;
  516. text-align: left;
  517. }
  518. .box{
  519. display: flex;
  520. align-items: center;
  521. justify-content: space-between;
  522. padding-top: 22rpx;
  523. .time{
  524. font-family: PingFang SC;
  525. font-weight: 400;
  526. font-size: 24rpx;
  527. color: #898E91;
  528. text-align: left;
  529. }
  530. .state{
  531. font-family: PingFang SC;
  532. font-weight: 400;
  533. font-size: 24rpx;
  534. color: #2CAE5C;
  535. text-align: right;
  536. }
  537. }
  538. }
  539. }
  540. }
  541. </style>